533 Commits

Author SHA1 Message Date
Sudheer Shanka
02f0e25661 Add read/write perf tests for BlobStore.
These tests will help us understand the difference
between local reads/writes vs blobstore reads/writes.

Bug: 226954650
Test: atest ./apct-tests/perftests/blobstore/src/com/android/perftests/blob/BlobStorePerfTests.java
Change-Id: Ibcc8497b4c32e90824b89e836716bdeb7490227b
2022-03-26 17:21:38 -07:00
Alex Buynytskyy
2f038309e0 Benchmark fix.
Previous change removed full GC from uninstall flow.
Add a shell command to force full GC.
Use the shell command to get to a clean state after install/uninstall
cycle.

==========================================================================================================================================================
(previous) Runtime.getRuntime().gc();
---------------------------------
com.android.perftests.packagemanager (1 Test(s))
[1/1] android.content.pm.PackageInstallerBenchmark#commit_threeMultiplePackageSessions_untilFinishBenchmark: PASSED (02m10.101s)
        commit_threeMultiplePackageSessions_untilFinishBenchmark_min (ns): 689576794
        commit_threeMultiplePackageSessions_untilFinishBenchmark_median (ns): 714554346
        commit_threeMultiplePackageSessions_untilFinishBenchmark_mean (ns): 711425403
        commit_threeMultiplePackageSessions_untilFinishBenchmark_standardDeviation: 17602400
---------------------------------
com.android.perftests.packagemanager (1 Test(s))
[1/1] android.content.pm.PackageInstallerBenchmark#commit_threeMultiplePackageSessions_untilFinishBenchmark: PASSED (02m24.778s)
        commit_threeMultiplePackageSessions_untilFinishBenchmark_min (ns): 733331347
        commit_threeMultiplePackageSessions_untilFinishBenchmark_median (ns): 761475101
        commit_threeMultiplePackageSessions_untilFinishBenchmark_mean (ns): 768526419
        commit_threeMultiplePackageSessions_untilFinishBenchmark_standardDeviation: 30700805
==========================================================================================================================================================
(current) VMRuntime.getRuntime().requestConcurrentGC();
---------------------------------
com.android.perftests.packagemanager (1 Test(s))
[1/1] android.content.pm.PackageInstallerBenchmark#commit_threeMultiplePackageSessions_untilFinishBenchmark: PASSED (01m42.290s)
        commit_threeMultiplePackageSessions_untilFinishBenchmark_min (ns): 781405493
        commit_threeMultiplePackageSessions_untilFinishBenchmark_median (ns): 793544987
        commit_threeMultiplePackageSessions_untilFinishBenchmark_mean (ns): 802736110
        commit_threeMultiplePackageSessions_untilFinishBenchmark_standardDeviation: 21416153
---------------------------------
com.android.perftests.packagemanager (1 Test(s))
[1/1] android.content.pm.PackageInstallerBenchmark#commit_threeMultiplePackageSessions_untilFinishBenchmark: PASSED (01m55.299s)
        commit_threeMultiplePackageSessions_untilFinishBenchmark_min (ns): 834772461
        commit_threeMultiplePackageSessions_untilFinishBenchmark_median (ns): 845870959
        commit_threeMultiplePackageSessions_untilFinishBenchmark_mean (ns): 853225375
        commit_threeMultiplePackageSessions_untilFinishBenchmark_standardDeviation: 20008646
==========================================================================================================================================================
(fixed)
---------------------------------
com.android.perftests.packagemanager (1 Test(s))
[1/1] android.content.pm.PackageInstallerBenchmark#commit_threeMultiplePackageSessions_untilFinishBenchmark: PASSED (01m53.377s)
        commit_threeMultiplePackageSessions_untilFinishBenchmark_min (ns): 692397872
        commit_threeMultiplePackageSessions_untilFinishBenchmark_median (ns): 724355473
        commit_threeMultiplePackageSessions_untilFinishBenchmark_mean (ns): 718845819
        commit_threeMultiplePackageSessions_untilFinishBenchmark_standardDeviation: 24269029
---------------------------------
com.android.perftests.packagemanager (1 Test(s))
[1/1] android.content.pm.PackageInstallerBenchmark#commit_threeMultiplePackageSessions_untilFinishBenchmark: PASSED (02m12.683s)
        commit_threeMultiplePackageSessions_untilFinishBenchmark_min (ns): 745539006
        commit_threeMultiplePackageSessions_untilFinishBenchmark_median (ns): 793251286
        commit_threeMultiplePackageSessions_untilFinishBenchmark_mean (ns): 788150394
        commit_threeMultiplePackageSessions_untilFinishBenchmark_standardDeviation: 27868293

Bug: 222961573
Fixes: 222961573
Test: atest PackageInstallerBenchmark
Change-Id: I0dda41781b0de5f3350498a7ca3a6d1296f63a04
2022-03-21 13:57:35 -07:00
Robert Carr
027b59d90a WMS/ViewRoot: Prepare for Async BLAST Sync [1/N]
We would like to make relayoutWindow a non-blocking call,
and of course why not, who likes blocking. However it functions
as a critical path of BLASTSync. To understand why examine the
Guarantee described in BLASTSync.md.

In order to implement this guarantee we need to know
“Which frame has the client finished drawing” when it calls
finishDrawing. The current answer to this question is
“The frame reflecting the state observed in the last call
to relayoutWindow”. The comments on mPending and mCurrentDrawHandlers
also have a lot more context on how this works currently. Since
relayoutWindow has a critical section, it also ensures that changes
to syncable state and preparation of sync will be observed atomically
(since they are both observed over relayoutWindow, which is always
called before any frame drawing updated syncable state).

We design a new protocol described in BLASTSync.md, which uses a seqId
to track which call to finishDrawing reflects which syncable state.
We implement this seqId based system. Unfortunately the WindowManager
doesn’t quite conform to the requirements specified by the protocol,
and a follow up CL ensures that syncable state changes will
always be sent with the seqId.

This CL simply adds the protocol specification and makes some required
interface changes. It can be seen to be a no-op.

Bug: 161810301
Bug: 175861051
Bug: 175861127
Bug: 200285149
Change-Id: If2dea07121fe7de5d2524c5b63678dddf955d4b7
2022-03-14 08:08:40 -07:00
Treehugger Robot
e017c8ad89 Merge "Add a benchmark test for Resources.getIdentifier" am: 49665e8d49 am: 863e8c2eaa am: 9432472262
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1934472

Change-Id: Ie25cc4979b8d6a95a6b333deb596367452bb1899
2022-02-14 09:20:29 +00:00
Treehugger Robot
9432472262 Merge "Add a benchmark test for Resources.getIdentifier" am: 49665e8d49 am: 863e8c2eaa
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1934472

Change-Id: Ia5b7dec81c5e1fa6f79d0ef3a5bfb7cec3f59ae7
2022-02-14 09:04:50 +00:00
Felka Chang
ccb8c015b7 Add a benchmark test for Resources.getIdentifier
In order to prevent unstable benchmark results because of cache,
a random resource name with an expected value comes from
Random.nextInt(10001).The range is from 0 to 10000.

This patch creates 10001 color resources with the prefix
"i_am_color_%x".  The range is from "i_am_color_0" to
"i_am_color_2710". The benchmark measures randomly accessing any
of those resources.

Test: atest --request-upload-result \
    CorePerfTests:android.app.ResourcesPerfTest#getIdentifier

Bug: 191487225
Change-Id: I357b43fda77e31b6d234233fd902eb8e4696301e
2022-02-14 13:08:39 +08:00
Pedro Loureiro
2b2ddee296 Merge "Allow framework-res APK splits from Apexes" 2022-01-25 15:28:01 +00:00
Pedro Loureiro
c6d1dec22c Allow framework-res APK splits from Apexes
Test: m FrameworkResApkSplitsHostTest

Bug: 195732042

Change-Id: I516e6267c661e112c234aed27e2eef2ce9ffaf9a
2022-01-25 10:05:57 +00:00
Tiger Huang
96c3e87e9e Remove the frame number from WindowManagerService
The frame number at the server side is not used anymore since BLAST.

Bug: 161810301
Test: presubmit
Change-Id: I01c6fb0750799aa94766f2582ce6ac031c9426cf
2022-01-24 21:43:28 +08:00
Tiger Huang
0456e9d5cb Let the client compute the surface size on its own
This is a step to move the layout logic to the client side. We won't
obtain the surface size from the server then.

This CL also moves the logic about adjusting the LayoutParams of
wallpaper to the client side.

Bug: 161810301
Test: presubmit
Change-Id: I3a81e174035c67a285cab449c0701ee2fe6f6a24
2022-01-24 21:40:45 +08:00
Haoyu Zhang
57620822d3 Scribe in View: enable Handwriting
Bug: 209854913
Test: atest FrameworksCoreTests:HandwritingInitiatorTest
Change-Id: I8449b3d9e713e226a2cd2b772103e79bf65b88c9
2022-01-20 16:31:04 -08:00
Winson
efbb319630 Move package parsing to services.jar
This facilitates exposing the Parsed_ classes as
@SystemApi(client = SYSTEM_SERVER) while keeping everything inside
services.jar rather than having it split across both jars.

This reverts getPackageArchiveInfo to use legacy PackageParser, since
framework.jar can no longer access the moved classes.

Bug: 214038417

Test: presubmit, no logic changes

Change-Id: I152d70fb4f643d32efb012cfb20b0fbc5f88f2d8
2022-01-18 12:47:45 -08:00
Haoyu Zhang
3b83af05b8 Add benchmark for HandwritingInitiator
Benchmark results:
android.view.HandwritingInitiatorPerfTest#onTouchEvent_actionMove_toolTypeFinger: PASSED (8.111s)
  onTouchEvent_actionMove_toolTypeFinger_min (ns): 86
  onTouchEvent_actionMove_toolTypeFinger_mean (ns): 88
  onTouchEvent_actionMove_toolTypeFinger_median (ns): 88
  onTouchEvent_actionMove_toolTypeFinger_standardDeviation: 2

android.view.HandwritingInitiatorPerfTest#onTouchEvent_actionDown_toolTypeFinger: PASSED (8.701s)
  onTouchEvent_actionDown_toolTypeFinger_min (ns): 27
  onTouchEvent_actionDown_toolTypeFinger_mean (ns): 30
  onTouchEvent_actionDown_toolTypeFinger_median (ns): 30
  onTouchEvent_actionDown_toolTypeFinger_standardDeviation: 2

ndroid.view.HandwritingInitiatorPerfTest#onTouchEvent_actionUp_toolTypeFinger: PASSED (9.227s)
  onTouchEvent_actionUp_toolTypeFinger_min (ns): 50
  onTouchEvent_actionUp_toolTypeFinger_mean (ns): 50
  onTouchEvent_actionUp_toolTypeFinger_median (ns): 51
  onTouchEvent_actionUp_toolTypeFinger_standardDeviation: 0

android.view.HandwritingInitiatorPerfTest#onTouchEvent_actionMove_toolTypeStylus: PASSED (9.732s)
  onTouchEvent_actionMove_toolTypeStylus_min (ns): 129
  onTouchEvent_actionMove_toolTypeStylus_mean (ns): 131
  onTouchEvent_actionMove_toolTypeStylus_median (ns): 129
  onTouchEvent_actionMove_toolTypeStylus_standardDeviation: 2

android.view.HandwritingInitiatorPerfTest#onTouchEvent_actionDown_toolTypeStylus: PASSED (9.254s)
  onTouchEvent_actionDown_toolTypeStylus_min (ns): 97
  onTouchEvent_actionDown_toolTypeStylus_mean (ns): 99
  onTouchEvent_actionDown_toolTypeStylus_median (ns): 98
  onTouchEvent_actionDown_toolTypeStylus_standardDeviation: 3

android.view.HandwritingInitiatorPerfTest#onTouchEvent_actionUp_toolTypeStylus: PASSED (9.304s)
  onTouchEvent_actionUp_toolTypeStylus_min (ns): 62
  onTouchEvent_actionUp_toolTypeStylus_mean (ns): 64
  onTouchEvent_actionUp_toolTypeStylus_median (ns): 64
  onTouchEvent_actionUp_toolTypeStylus_standardDeviation: 1

android.view.HandwritingInitiatorPerfTest#updateEditorBoundary: PASSED (8.498s)
  updateEditorBoundary_min (ns): 6
  updateEditorBoundary_mean (ns): 6
  updateEditorBoundary_median (ns): 6
  updateEditorBoundary_standardDeviation: 0

android.view.HandwritingInitiatorPerfTest#onInputConnectionCreated: PASSED (8.926s)
  onInputConnectionCreated_min (ns): 60
  onInputConnectionCreated_mean (ns): 60
  onInputConnectionCreated_median (ns): 60
  onInputConnectionCreated_standardDeviation: 0

android.view.HandwritingInitiatorPerfTest#onInputConnectionClosed: PASSED (8.975s)
  onInputConnectionClosed_min (ns): 47
  onInputConnectionClosed_mean (ns): 49
  onInputConnectionClosed_median (ns): 49
  onInputConnectionClosed_standardDeviation: 1

Bug: 213216947
Test: atest CorePerfTests:android.view.HandwritingInitiatorPerfTest
Change-Id: I3a506572691cbb6ab78ae475823a2e3628ff9fae
2022-01-05 15:26:42 -08:00
Michael Groover
6d63e6b2b2 Add unaudited exported flag to exposed runtime receivers
Android T allows apps to declare a runtime receiver as not exported
by invoking registerReceiver with a new RECEIVER_NOT_EXPORTED flag;
receivers registered with this flag will only receive broadcasts from
the platform and the app itself. However to ensure developers can
properly protect their receivers, all apps targeting T or later
registering a receiver for non-system broadcasts must specify either
the exported or not exported flag when invoking #registerReceiver;
if one of these flags is not provided, the platform will throw a
SecurityException. This commit updates all the exposed receivers
with a new RECEIVER_EXPORTED_UNAUDITED flag to maintain the existing
behavior of exporting the receiver while also flagging the receiver
for audit before the T release.

Bug: 161145287
Test: Build
Change-Id: I16d67d9e41ed1b4410e07f6614840f1898602e1f
2021-12-30 08:34:07 -08:00
Edgar Arriaga
9b724d67dd Add some tests for database operations
Test: atest SQLiteDatabasePerfTest
Bug: 193926152
Change-Id: I9b7994163bbe5992afba1b894b096ec1287f977c
2021-11-29 12:50:39 -08:00
TreeHugger Robot
6423d01b01 Merge "Implement fast hyphenation algorithm" 2021-11-19 01:32:34 +00:00
Seigo Nonaka
0f761404af Implement fast hyphenation algorithm
RandomText Balanced Hyphenation ON
	min: 2,312,291
	mean: 2,320,574
	median: 2,320,112

RandomText Balanced Hyphenation ON(Fast)
	min: 985,850
	mean: 990,922
	median: 986,586

RandomText Balanced Hyphenation OFF
	min: 909,060
	median: 923,585
	mean: 930,052

Bug: 201096525
Test: TreeHugger and minikin_tests
Change-Id: Ide2d73acb3de85e91018e524c89df2c949235a4e
2021-11-10 23:19:43 -08:00
Winson Chung
1477b975f1 Merge "Add multi-task support to recents-animation task-appeared" into sc-v2-dev am: 35b8e2b997 am: c7e8bbf286
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16184046

Change-Id: I739695f78712172bb90836df465e0b76492c99e9
2021-11-10 17:40:14 +00:00
Winson Chung
c7e8bbf286 Merge "Add multi-task support to recents-animation task-appeared" into sc-v2-dev am: 35b8e2b997
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16184046

Change-Id: I57d186d78773bbd2bbb5c5095ff6a7110a8cdd04
2021-11-10 17:28:05 +00:00
Evan Rosky
1258abfefc Add multi-task support to recents-animation task-appeared
Allows handling of app-pairs

Bug: 204094785
Test: Existing RecentsAnimation tests pass
Change-Id: Ie71fa994912a67a6b15c2f1e2dc1959473f52b15
2021-11-08 18:30:17 -08:00
Jerry Chang
07f83aa857 Merge "Snapshot all tasks in pending recents animation when rotating devices" into sc-v2-dev am: b1626ac345 am: f71de80002
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16192190

Change-Id: Iedd0dc775b38e5e7c5adc9701b18ecfc58040bdf
2021-11-08 17:27:16 +00:00
Jerry Chang
f71de80002 Merge "Snapshot all tasks in pending recents animation when rotating devices" into sc-v2-dev am: b1626ac345
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16192190

Change-Id: I283edef740863faab271ca10bafb03fed250e849
2021-11-08 10:39:08 +00:00
Jerry Chang
79090d6930 Snapshot all tasks in pending recents animation when rotating devices
Since both of splitting tasks in split screen go to overview together
now, update to snapshot all pending animations when rotating while
showing overview to ensure both of splitting task snapshots are taken
with proper bounds before rotation.

Bug: 200813008
Test: atest RecentsAnimationControllerTest
Test: enter overview after activated split screen, observed task
      thumbnails showing with correct bounds after roation.
Change-Id: Id1101bf8be67593f85a43c1d4afae769ffc737d3
2021-11-05 22:32:34 +08:00
Jaineel
ec46371dc2 Update AutofillPerf tests with perfetto permission am: 7a58911bbf am: 02fa5d5e75
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16176434

Change-Id: Ib064eca2817a982aab1e55d4193a2a081249444b
2021-11-03 04:26:22 +00:00
Jaineel
7730d422d9 Update AutofillPerf tests with perfetto permission am: 7a58911bbf
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16176434

Change-Id: I9a86821f4fc88d8ea354e51545c3400b3aa665cd
2021-11-03 04:14:30 +00:00
Jaineel
02fa5d5e75 Update AutofillPerf tests with perfetto permission am: 7a58911bbf
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16176434

Change-Id: I14b7de7e10a9baa8a03a51b6954ab513357b4f95
2021-11-03 04:14:30 +00:00
Jaineel
7a58911bbf Update AutofillPerf tests with perfetto permission
Test: atest AutofillPerfTests
Bug: 192989101
Change-Id: Ic703dcff424c8496e588e3188299a8f52c36b626
(cherry picked from commit c56e0b3188c4e9eea220c6c1f5053993b5eefee8)
2021-11-02 18:45:36 +00:00
Jaineel Mehta
66fdcd8a59 add permission to capture perfetto traces
Inputmethod perf unit tests

Change-Id: Icfbbde16ceeee5e0033a92154e3000107a834c4d
Test: Yes, using forrest go/abtd/run/L69800000951726302
Bug: 204600547
2021-10-30 02:27:42 +00:00
Jaineel
d8d54a025d Adding permission to create dir in sdcard
TextClassifierPerfTest needed MANAGE_EXTERNAL_STORAGE and
WRITE_EXTERNAL_STORAGE permission to create and save perfetto files

Test: Yes, atest TextClassifierPerfTest
Bug: 183663695
Change-Id: Ia5bdffd37eeb890ac911969bf4cb3dd020b6274c
2021-10-25 15:11:26 +00:00
Jaineel
c56e0b3188 Update AutofillPerf tests with perfetto permission
Test: atest AutofillPerfTests
Bug: 192989101
Change-Id: Ic703dcff424c8496e588e3188299a8f52c36b626
2021-10-19 21:45:17 +00:00
Alex Buynytskyy
19f8adfbdf Cache least recently used output buffer.
- reduce memory allocations especially when Xml is serialized inside a
tight inner loop,
- performance slightly improved.

BEFORE:
100 packages:
[2/4] android.util.XmlPerfTest#timeWrite_Binary: PASSED (10.516s)
	timeWrite_Binary_mean: 674979
	threadAllocCount_mean: 59
	timeWrite_Binary_min: 671194
	timeWrite_Binary_median: 674798
	timeWrite_Binary_standardDeviation: 3658
	threadAllocSize_mean: 530176
10 packages:
[2/4] android.util.XmlPerfTest#timeWrite_Binary: PASSED (10.542s)
	timeWrite_Binary_mean: 71113
	threadAllocCount_mean: 56
	timeWrite_Binary_min: 70201
	timeWrite_Binary_median: 71237
	timeWrite_Binary_standardDeviation: 692
	threadAllocSize_mean: 59136
1 package:
[2/4] android.util.XmlPerfTest#timeWrite_Binary: PASSED (10.091s)
	timeWrite_Binary_mean: 15698
	threadAllocCount_mean: 56
	timeWrite_Binary_min: 15072
	timeWrite_Binary_median: 15677
	timeWrite_Binary_standardDeviation: 410
	threadAllocSize_mean: 6439

AFTER:
100 packages:
[1/1] android.util.XmlPerfTest#timeWrite_Binary: PASSED (10.221s)
	timeWrite_Binary_mean: 605862
	threadAllocCount_mean: 53
	timeWrite_Binary_min: 602353
	timeWrite_Binary_median: 604424
	timeWrite_Binary_standardDeviation: 4972
	threadAllocSize_mean: 492748
10 packages:
[1/1] android.util.XmlPerfTest#timeWrite_Binary: PASSED (10.575s)
	timeWrite_Binary_mean: 58710
	threadAllocCount_mean: 50
	timeWrite_Binary_min: 57551
	timeWrite_Binary_median: 57798
	timeWrite_Binary_standardDeviation: 2129
	threadAllocSize_mean: 21696
1 package:
[1/1] android.util.XmlPerfTest#timeWrite_Binary: PASSED (10.151s)
	timeWrite_Binary_mean: 11576
	threadAllocCount_mean: 50
	timeWrite_Binary_min: 11315
	timeWrite_Binary_median: 11381
	timeWrite_Binary_standardDeviation: 431
	threadAllocSize_mean: 4336

Test: atest FastDataPerfTest XmlPerfTest
Bug: 195994150
Fixes: 195994150

Change-Id: Ieedd27a676d718967c2fac30bc48a68ae636a180
2021-09-16 19:06:31 +00:00
Dmitri Plotnikov
e5292b4a24 Make LongArrayMultiStateCounter parcelable
Bug: 197162116
Test: atest FrameworksCoreTests:LongArrayMultiStateCounterTest
      atest CorePerfTests:LongArrayMultiStateCounterPerfTest

Change-Id: Ibc94620f2f106695fa7f17fc0737496f0e32ba48
2021-09-14 12:40:56 -07:00
TreeHugger Robot
a4a53d2c45 Merge "Improve replaceAll." 2021-09-11 00:10:42 +00:00
Winson Chiu
be3c8efc93 Merge "Revert "Revert "Open up AndroidPackage as @SystemApi""" 2021-09-10 23:07:18 +00:00
Kweku Adams
6a97c5d9f5 Improve replaceAll.
The default implementation of Map.replaceAll() iterates through the
entrySet. Switch to a simple for loop iterating through the array
since the iterator is an inefficient way to access the array contents.

Benchmark results:

Before:

android.util.ArrayMapPerfTest#testReplaceAll_Large:
	replaceAll_Large_min (ns): 888977
	replaceAll_Large_median (ns): 904642
	replaceAll_Large_mean (ns): 914596
	replaceAll_Large_standardDeviation: 23960
android.util.ArrayMapPerfTest#testReplaceAll_Small:
	replaceAll_Small_min (ns): 177767
	replaceAll_Small_median (ns): 179955
	replaceAll_Small_mean (ns): 180331
	replaceAll_Small_standardDeviation: 2865

After:

android.util.ArrayMapPerfTest#testReplaceAll_Large:
	replaceAll_Large_min (ns): 557385
	replaceAll_Large_median (ns): 586495
	replaceAll_Large_mean (ns): 583712
	replaceAll_Large_standardDeviation: 20356
android.util.ArrayMapPerfTest#testReplaceAll_Small:
	replaceAll_Small_min (ns): 108051
	replaceAll_Small_median (ns): 110802
	replaceAll_Small_mean (ns): 109987
	replaceAll_Small_standardDeviation: 1334

Bug: 194098491
Test: atest CorePerfTests:ArrayMapPerfTest (see results above)
Test: atest CtsUtilTestCases:ArrayMapTest
Test: atest FrameworksCoreTests:ArrayMapTest
Change-Id: If87ae5f3aa4b184b95c16aed5f2fb6f31d11668a
2021-09-10 14:33:40 -07:00
Winson Chiu
d7adbb01ba Revert "Revert "Open up AndroidPackage as @SystemApi""
This reverts commit 750ce30b8467d1e7c26568c0f2fb2c05b02bbb09.

Reason for revert: b/199246839 fixed, re-introduce change

Change-Id: I48f3fd20ac14c823c85de55f667d1860dade1f97
2021-09-10 16:50:01 +00:00
Winson Chiu
d433d2cd9a Merge "Revert "Open up AndroidPackage as @SystemApi"" 2021-09-09 23:29:51 +00:00
TreeHugger Robot
15c8b4eb44 Merge "UserLifecycleTests: use test-timeout" 2021-09-09 23:26:18 +00:00
Winson Chiu
750ce30b84 Revert "Open up AndroidPackage as @SystemApi"
This reverts commit b013a475eb49578d688ef7e13d5e7e0f937badcc.

Reason for revert: b/199246839, breaks some builds

Change-Id: If71cb271c6f4bb32f3cc9b31822fa0b9dbab7c37
2021-09-09 21:01:38 +00:00
Adam Bookatz
bc39626365 UserLifecycleTests: use test-timeout
Set a longer test timeout for use on slow devices. Use the
AndroidTest.xml test-timeout parameter for this.

Bug: 169449457
Bug: 198013452
Test: atest UserLifecycleTest
Change-Id: I9c66611e65dd07f500ee1b1ba9332fdd9b24a420
2021-09-03 13:55:57 -07:00
Winson
b013a475eb Open up AndroidPackage as @SystemApi
Moves all the PackageInfo/ApplicationInfo values into core SDK side
interfaces which represent all the mirrored functionality.

Creates AndroidPackageApi, PackageState, and a new PackageUserState
interface that act as the actual exposed interfaces for consumers like
mainline.

To avoid taking the PackageManagerService lock, and to avoid mutability
issues, PackageSettings are shallowly copied into PackageState objects.
And class PackageUserState objects into interface PackageUserState.

Eventually PackageSetting/class PackageUserState should be migrated to
the corresponding interfaces.

Miscellaneous additional changes:
 - Removes PackageSetting#uidError, was never used
 - Removes PackageUserState#categoryHint, was a package level field
   without per-user difference, use PackageSetting#categoryHint instead
 - Add locking to class PackageUserState overlay paths so they can be
   copied for the new interface.

Bug: 173455397

Test: atest com.android.server.pm.ScanTests

Change-Id: Ib98c66a9b4d78d09151724eaf14c16074c3621c9
2021-09-02 10:39:04 -07:00
Adam Bookatz
8a04e9691d UserLifecycleTests: long max test run time
In order to stabilize the tests, additional waits (for the system to
cool down) were added in ag/15685704. On slower devices, that can make
the tests time out, so we must increase the timeout time.

It would have been nice to use org.junit.rules.Timeout instead, but that
doesn't seem to work; the test still times out after 5min that way.

Bug: 169449457
Bug: 198013452
Test: atest MultiUserPerfTests:android.multiuser.UserLifecycleTests with delays
Change-Id: Ia713121b2c52acd62d990b526e3d5aca2bb46b49
2021-08-30 18:08:47 -07:00
Adam Bookatz
0b1321c335 UserLifecycleTests: wait for idle before resume timing
Currently, we wait-for-broadcast-idle at the start of each test run.
However, we also have numerous pauses/resumes during individual tests.
We should also do wait-for-broadcast-idle before resuming in those cases.

Test: UserLifecycleTests
Bug: 169449457
Change-Id: I46f49f556b4c5b508c1d9f767871b0377e29a6ae
2021-08-27 08:52:11 -07:00
Dmitri Plotnikov
7058a51deb Merge "Add LongArrayMultiStateCounter" 2021-08-24 00:06:46 +00:00
Dmitri Plotnikov
2f618d1bab Add LongArrayMultiStateCounter
Bug: 197162116
Test: atest FrameworksCoreTests:LongArrayMultiStateCounterTest
Test: atest CorePerfTests:LongArrayMultiStateCounterPerfTest

Change-Id: I3e20aa1a64b6bb89658c57c74487f95681d4f0ff
2021-08-20 18:30:44 -07:00
Adam Bookatz
1226ec462d UserLifecycleTests: wait on storage before restart
When a user is stopped shortly after having started, the timing
results depend heavily on whether StorageManagerService had managed to
forge its connections yet. If it didn't, then stopping takes an
unrealistically short time. If it did, but is still in the process of
dealing with them, then stopping takes an unrealistically long time.

The solution is, for all appliable tests, to wait until storage is ready
before proceeding to stop or switch the user.

Also, some javadoc comments are added and clarified.

Bug: 169449457
Test: atest MultiUserPerfTests:android.multiuser.UserLifecycleTests
Change-Id: Ide848685637abac43488c8d89a3d6f6567c7deca
2021-08-19 17:14:34 -07:00
TreeHugger Robot
38090e938b Merge "Improve forEach." 2021-08-12 22:23:29 +00:00
Kweku Adams
4049d0fd9c Improve forEach.
The default implementation of Collection.forEach() uses the
iterator(). Switch to a simple for loop iterating through the array
since the iterator is an inefficient way to access the array contents.

Benchmark results:

Before:

android.util.ArrayMapPerfTest#testForEach_Large:
	forEach_Large_min (ns): 599759
	forEach_Large_median (ns): 655845
	forEach_Large_mean (ns): 636927
	forEach_Large_standardDeviation: 34373
android.util.ArrayMapPerfTest#testForEach_Small:
	forEach_Small_min (ns): 118822
	forEach_Small_median (ns): 121422
	forEach_Small_mean (ns): 121695
	forEach_Small_standardDeviation: 2079

After:

android.util.ArrayMapPerfTest#testForEach_Large:
	forEach_Large_min (ns): 403562
	forEach_Large_median (ns): 441364
	forEach_Large_mean (ns): 442301
	forEach_Large_standardDeviation: 24917
android.util.ArrayMapPerfTest#testForEach_Small:
	forEach_Small_min (ns): 81889
	forEach_Small_median (ns): 87889
	forEach_Small_mean (ns): 86905
	forEach_Small_standardDeviation: 2880

Bug: 194098491
Test: atest CorePerfTests:ArrayMapPerfTest (see results above)
Test: atest CtsUtilTestCases:ArrayMapTest
Test: atest FrameworksCoreTests:ArrayMapTest
Change-Id: Id528fe24f1d17af01a2d639753d42e2ad21144d2
2021-08-11 08:36:48 -07:00
Gopinath Elanchezhian
485081039e Update the perfetto config file.
Bug: b/196053531

Test: atest useLifeCycleTests
Change-Id: I6247dd7e12624b5a3205a672dcf88a8b2d6c8fd8
2021-08-10 09:58:29 -07:00
TreeHugger Robot
28b61fcdb8 Merge "Refactor to ensure thread safety" 2021-08-10 08:16:30 +00:00