66 Commits

Author SHA1 Message Date
Seigo Nonaka
749e57e5c3 Implement LineBreaker callback and fix indent repeating.
The last indent should be repeated, so we need to pass an int array
instead of null even if the indent offset is out of array length.

Bug: 65024629
Test: bit CtsTextTestCases:android.text.cts.StaticLayoutTest
Test: bit CtsTextTestCases:android.text.cts.DynamicLayoutTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Bug: 65024629

Change-Id: Ic1274d797db27ae1921135a27bab55e475369710
2017-08-30 14:57:50 -07:00
John Reck
938e884a1f Avoid setting high contrast in every view draw
Test: high contrast text still works
Change-Id: I6674d1aca8dddf7eb9725a5346aed12ef1dbc195
2017-08-24 16:15:58 -07:00
Roozbeh Pournader
737dfead64 Support extra linespacing based on fallback fonts
* Increase the ascent and descent of individual lines in StaticLayout
  as needed, if any fallback fonts that end up getting used call for
  it. For backward compatibility, this is hidden behind a builder
  flag.
* Document in Paint.java that the returned parameters are only for
  the default font, and a layout may need more space based on
  fallbacks used.

Also update for changes in minikin API:

* MinikinFont now requires a method for getting vertical extents
  (ascent, descent, and line gap).
* minikin API now allows asking for vertical extents of laid out
  text.
* minikin API's LineBreaker now returns ascents and descents for each
  line.

Finally, added performances test for creating a StaticLayout.
Follwing are the numbers on a marlin with a stable clock before and
after this CL.

For fixed text almost always hitting the cache:
Before: mean=260684 median=260188 min=258532 standardDeviation=1897
After:  mean=262432 median=261509 min=260429 standardDeviation=2185

For random text almost never hitting the cache:
Before: mean=5971827 median=5991126 min=5886871 standardDeviation=83724
After:  mean=6337093 median=6317010 min=6311222 standardDeviation=40213

Bug: 28963299
Bug: 29063863
Bug: 32057121
Bug: 37756858
Test: bit FrameworksCoreTests:android.text.
Test: bit CtsTextTestCases:*
Change-Id: I482a98ff8f472e8bab4f0ba9d1d7b368858038ff
2017-08-17 12:10:31 -07:00
Seigo Nonaka
917748ef50 Improve TextView.onMeasure() for multiline text.
Previously, measures all paragraph for deciding view width.
However, in case AT_MOST measurment, we can stop calculating measure if
the measured paragraph already exceeds the upper limit.

Bug: 64389125
Test: bit CtsWidgetTestCases:*
Test: CorePerfTest. Here is a result before and after this patch.

Before:
INSTRUMENTATION_STATUS: measure_AtMost_median=50332114
INSTRUMENTATION_STATUS: measure_Exactly_median=28276317
INSTRUMENTATION_STATUS: measure_Unspecified_median=50193036

After:
INSTRUMENTATION_STATUS: measure_AtMost_median=28475187
INSTRUMENTATION_STATUS: measure_Exactly_median=26944710
INSTRUMENTATION_STATUS: measure_Unspecified_median=50880088

Change-Id: I2a39eb39817a8f845c4fa2e174a905a2d057096e
2017-08-04 17:21:06 +00:00
Sudheer Shanka
2d0278b09f Update user perf tests to report only mean.
Test: bit MultiUserPerfTests:android.multiuser.UserLifecycleTests
Change-Id: Ib70123217c54b469844ce65ec52b7e7ed5b5998d
2017-07-12 18:15:02 -07:00
Sudheer Shanka
a319f8b35d Update test names in UserLifecycleTest.
Test: bit MultiUserPerfTests:android.multiuser.UserLifecycleTest
Change-Id: I49908f8da023a419b79124cc2f366f6d5e8a066d
2017-07-11 15:28:48 -07:00
Sudheer Shanka
d49d82b4c1 Merge "Fix UserLifecycleTest." 2017-06-29 23:27:47 +00:00
Sudheer Shanka
5f76e1fa85 Fix UserLifecycleTest.
Bug: 62058707
Test: bit MultiUserPerfTests:android.multiuser.UserLifecycleTest
Change-Id: I8667190f001f609040a977a19aa956d7064ccc18
2017-06-29 12:08:48 -07:00
Makoto Onuki
b148b6c3c8 Parcel: Use @CriticalNative when possible.
- Change some methods from FastNative to CritcialNative
- Change nativeGetBlobAshmemSize to CritcalNative

- ParcelPerfTest.java (CorePerfTests)
bullhead-userdebug + prep_buller.sh, mean(ns), changed methods only
-- After
timeGetDataCapacity_mean    166 +39.16%
timeGetDataPosition_mean    169 +53.25%
timeReadByte_mean           296 +39.86%
timeReadLong_mean           284 +61.97%
timeSetDataPosition_mean    173 +34.10%
timeGetDataSize_mean        173 +37.57%
timeReadInt_mean            284 +57.04%

-- Before
timeGetDataCapacity_mean    231
timeGetDataPosition_mean    259
timeReadByte_mean           414
timeReadLong_mean           460
timeSetDataPosition_mean    232
timeGetDataSize_mean        238
timeReadInt_mean            446

Bug: 62135986
Test: bit CtsOsTestCases:android.os.cts.ParcelTest
Change-Id: I8c7ede25c87017ef2c7a49beaa3ac781c08ea365
2017-06-28 09:03:09 -07:00
Chris Craik
716cf42552 Add CursorWindow perf tests
Test: adb install -r $OUT/data/app/CorePerfTests/CorePerfTests.apk && adb shell cmd package compile -m speed -f com.android.perftests.core && adb shell am instrument -w -e class android.database.CursorWindowPerfTest com.android.perftests.core/android.support.test.runner.AndroidJUnitRunner

Change-Id: Ie4b128ad8c6bca08be7bf2b4fb0f9db3c7aa3288
2017-06-16 11:41:21 -07:00
TreeHugger Robot
1062e533a9 Merge "Increase the timeout and add stopping managed profile test" 2017-06-01 11:44:17 +00:00
Tony Mak
ec7c6963bd Increase the timeout and add stopping managed profile test
The dashbaord suggests that multiple tests are always capped at the same
value due to the timeout. To collect the actual metric, set a larger
timeout value, 10s for now.

Also, added a test to stop managed profile user. However, the test is
still finishing surprisingly fast because of the empty broadcast queue.


Bug: 62096041

Test: adb shell am instrument -e class android.multiuser.UserLifecycleTest -w com.android.perftests.multiuser/android.support.test.runner.AndroidJUnitRunner

Change-Id: Ia52db17525d9eb960c9a8c860cdb52c0f487e5f1
2017-05-31 16:06:02 +01:00
Seigo Nonaka
c07169eddc Merge "Introduce early exit path for non resource path." into oc-dev am: 01d5b3d2af
am: 99c587a9b1

Change-Id: I7e09b074f7fff0f273ca2be896439bae0c0c92d0
2017-05-18 23:54:24 +00:00
Seigo Nonaka
2ea169a2ec Introduce early exit path for non resource path.
Developer can specify android:fontFamily with three ways, pre-defined
font family name, e.g. "sans-serif", path to the font file in resource
directory, e.g. "res/fonts/Roboto-Regular.ttf", or path to the XML font
family file, e.g. "res/fonts/Roboto.xml".

Resources.getFont treats font files and XML files but pre-defined family
name is handled by TextView. Thus, we can early exit if the passed value
is not likely resource path.

This improves the inflation performance.
The score without this patch:
gfx-avg-frame-time-50: 6.9
gfx-avg-frame-time-90: 9.4
gfx-avg-frame-time-95: 10.4
gfx-avg-frame-time-99: 16.7

The score with this patch:
gfx-avg-frame-time-50: 7.0
gfx-avg-frame-time-90: 8.9
gfx-avg-frame-time-95: 9.7
gfx-avg-frame-time-99: 16.5

Measured on bullhead-userdebug.

The APCT perf test improves from
String FontFamily: 200,086 -> 132,561
File FontFamily  : 199,256 -> 161,843
XML FontFamily   : 203,681 -> 158,553

Measured on angler-userdebug.

Bug: 38232467
Test: UiBenchmark
Change-Id: Ia601ae7207ae8c60848c9efdbb9396267a57257c
2017-05-16 10:14:56 -07:00
John Reck
f3903e9f15 Fix regression in getSharedPreferences performance
Only do access checks if there's a cache miss. If there's
a cache hit then those checks have necessarily already
passed once so we don't need to repeatedly do them
on every access.

Before:
timeCachedGetSharedPreferences_mean=126084

After:
timeCachedGetSharedPreferences_mean=362

Test: ran perf test
Change-Id: I51f0186f8e66c05ea0e5a457930377d1460dea17
2017-05-12 17:21:15 -07:00
Colin Cross
52f6ba9a9d Move SystemPerfTest out of java.* namespace
dx doesn't like classes in the java.* namespace unless it is compiling
a core library.  Move SystemPerfTest to
android.perftests.SystemPerfTest.

Test: builds
Change-Id: I24951d2c9a71d8bb873763d1ccd2f1a67f2be64e
2017-02-28 10:44:04 -08:00
Andrei Stingaceanu
ab18567419 AutoSize TextView (part 11) - fix final APIs
* public attr "autoSizeText" becomes "autoSizeTextType"
  (inlined with all other methods and naming)
* documentation for autoSizetextType "uniform" re-worked:
  "The TextView scales text size both horizontally and
  vertically to fit  within the container"
* converted comments into Javadoc for
  TextView#AUTO_SIZE_TEXT_TYPE_NONE and
  TextView#AUTO_SIZE_TEXT_TYPE_UNIFORM
* better documented attr "autoSizePresetSizes" to specify
  it is a resource array of dimensions
* various small fixes in comments

Bug: 35755149
Bug: 35763485
Bug: 35764658
Bug: 32221168
Test: run cts-dev -m CtsWidgetTestCases -t \
      android.widget.cts.TextViewTest

Change-Id: I36afd399e005521b6e85922aa9e1e4418bb960e1
2017-02-27 15:17:46 +00:00
Andrei Stingaceanu
fbfead24c2 AutoSize TextView (part 9) - sanitize APIs naming
This CL is no-op (cosmetics only)
* renames autoSizeText type "xy" to "uniform"
* renames attribute "autoSizeStepSizeSet" to "autoSizePresetSizes"
* renames "AUTO_SIZE_TEXT_TYPE_XY" to "AUTO_SIZE_TEXT_TYPE_UNIFORM"
* renames public TextView#getAutoSizeTextPresetSizes() to public
  TextView#getAutoSizeTextAvailableSizes() because this method can
  return either preset sizes or computed sizes (via min/max/step)

Bug: 34923754
Bug: 32221168
Test: associated test renames in the same topic
Change-Id: Ifacccf21ca014b6c0a07322fa02b7859ee53e387
2017-02-09 15:30:02 +00:00
Paul Duffin
1d0244a846 Prepare for removal of legacy-test from default targets
In preparation for removing junit classes from the Android API
the legacy-test target will be removed from the
TARGET_DEFAULT_JAVA_LIBRARIES. This change adds explicit
dependencies on junit and/or legacy-android-test to ensure that
modules will compile properly once it is removed.

Bug: 30188076
Test: make checkbuild
Change-Id: If507b641624a2933e722f61e815890fcdf442265
2017-01-20 09:00:33 +00:00
Chris Craik
fc29424a3c CriticalNative for RenderNode and DisplayListCanvas
Bug: 33460152
Test:  adb shell am instrument -w -e class android.view.ViewShowHidePerfTest com.android.perftests.core/android.support.test.runner.AndroidJUnitRunner

- Also FastNative for setDisplayList, simplifying upcall into field setter.

- Also removes depth sweep parameter for ViewShowHideTests for now, they're not
providing much extra info.

Together with Outline/Path CL, about 25% faster visibility toggles

960MHz Bullhead Before (prior to Outline/Path CL):

$ adb shell am instrument -w -e class android.view.ViewShowHidePerfTest com.android.perftests.core/android.support.test.runner.AndroidJUnitRunner | grep min
INSTRUMENTATION_STATUS: add[Factory:NestedLinearLayoutTree,depth:6]_min=743505
INSTRUMENTATION_STATUS: goneToVisible[Factory:NestedLinearLayoutTree,depth:6]_min=332420
INSTRUMENTATION_STATUS: invisibleToVisible[Factory:NestedLinearLayoutTree,depth:6]_min=354154
INSTRUMENTATION_STATUS: recordAfterAdd[Factory:NestedLinearLayoutTree,depth:6]_min=1106095
INSTRUMENTATION_STATUS: remove[Factory:NestedLinearLayoutTree,depth:6]_min=1261290
INSTRUMENTATION_STATUS: visibleToGone[Factory:NestedLinearLayoutTree,depth:6]_min=356153
INSTRUMENTATION_STATUS: visibleToInvisible[Factory:NestedLinearLayoutTree,depth:6]_min=362149

After (this CL + Outline/Path CL):

$ adb shell am instrument -w -e class android.view.ViewShowHidePerfTest com.android.perftests.core/android.support.test.runner.AndroidJUnitRunner | grep min
INSTRUMENTATION_STATUS: add[Factory:NestedLinearLayoutTree,depth:6]_min=636061
INSTRUMENTATION_STATUS: goneToVisible[Factory:NestedLinearLayoutTree,depth:6]_min=267481
INSTRUMENTATION_STATUS: invisibleToVisible[Factory:NestedLinearLayoutTree,depth:6]_min=289433
INSTRUMENTATION_STATUS: recordAfterAdd[Factory:NestedLinearLayoutTree,depth:6]_min=976827
INSTRUMENTATION_STATUS: remove[Factory:NestedLinearLayoutTree,depth:6]_min=1207286
INSTRUMENTATION_STATUS: visibleToGone[Factory:NestedLinearLayoutTree,depth:6]_min=286148
INSTRUMENTATION_STATUS: visibleToInvisible[Factory:NestedLinearLayoutTree,depth:6]_min=292834

Change-Id: Iaddfa9550bdbab807c662595d005126d98cdc277
2016-12-15 11:30:08 -08:00
Chris Craik
2414e1b051 Outline & Path perf improvements
Bug: 33460152
Test: device boots, ViewShowHidePerfTests#add[Factory:NestedLinearLayoutTree,depth:6] 770us -> 650us (userdebug 960MHz bullhead)

Improve perf for outline & simple path methods

native_methodName -> nMethodName in Path.java

Change-Id: Id2374bbaca3256d2e4f19dae9abe67f794a171b3
2016-12-13 16:52:08 -08:00
Chris Craik
7a5ad26406 Merge "Add Outline/RenderNode perf tests" 2016-12-12 21:15:09 +00:00
Chris Craik
2cbbd8d3ab Add Outline/RenderNode perf tests
Bug: 33460152
Test: benchmark CL. Ran new benchmarks.

Change-Id: I6ad5fb3b72c731ef0fb57654191c4b9ac3f6922d
2016-12-09 19:15:53 -08:00
Chris Craik
3f7c6adeef Add benchmarks for different ways to show/hide view subtrees
Bug: 33460152
Test: benchmark CL. Ran new benchmarks.

Change-Id: I7bdd8988543df821eee7b608ea439dfcf54464e5
2016-12-09 16:21:18 -08:00
Andrei Stingaceanu
0178c2392b AutoSize TextView (part 2) - benchmark number of sizes
Performance test for the number of sizes to choose from
when autosizing.

Tests for 5, 10, 50, 100, 300, 500, 1000, 10000 and
100000!!! different sizes.

Bug: 32740812
Bug: 32221168
Test: this is the test
Change-Id: I611bbf659e51d0236a2ddafb2e2498165cea07a0
2016-11-29 11:51:04 +00:00
John Reck
b2264c2bc5 Add int[] JNI benchmarks
Test: Ran benchmarks
Change-Id: I5faf4236a431199976abb0719c56904dabbbf54d
2016-11-21 16:15:05 -08:00
John Reck
55fe2695a0 Merge "Add more complex View inflation bench" 2016-11-17 22:06:27 +00:00
John Reck
24e98b7667 Add more complex View inflation bench
Test: ran ViewPerfTest#testTwelveKeyInflate

Change-Id: I644e1f77fa1108dcd2d54216d1e740b112a2e21b
2016-11-17 09:03:31 -08:00
Sudheer Shanka
dc589ac82b Update usage of ActivityManagerNative.
- Remove references to ActivityManagerProxy.
- Add isSystemReady to ActivityManager.

Bug: 30977067
Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test android.server.cts
      adb shell am instrument -e class com.android.server.am.ActivityManagerTest,com.android.server.am.TaskStackChangedListenerTest \
          -w com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I07390b6124fb1515821f5c0b37baf6ae74adc8fa
2016-11-14 11:27:12 -08:00
John Reck
3acf0382da Add benchmarks for View inflation
Also speed up RenderNode creation:

Use finalizer() instead of NativeAllocationRegistry, this
shaves ~3us off of creation currently

Avoid instanceof, instead have SurfaceView explicitly ask
for updates.

Remove unused method call.

Test: ran benchmarks
Change-Id: I3117fdf72313a4e6a9965baca9f2a8b855c19b34
2016-11-02 14:49:51 -07:00
John Reck
60bf972d48 Merge "Fix pause/resume timing" 2016-10-18 20:27:41 +00:00
John Reck
306928c49d Port Parcel benchmarks to APCT
Test: ran benchmarks
Change-Id: I5b4fad7e1183c8634df4f02bd71701b37fdbc3be
2016-10-17 15:29:17 -07:00
John Reck
c1d6ba4053 Fix pause/resume timing
Test: run SystemPerfTest#testPauseResumeOverhead

Change-Id: Icc34355e29f3a6ba8f7d73a904bf549d2685eee4
2016-10-17 13:49:16 -07:00
John Reck
295f9af9a8 Add a couple simple canvas benchmarks
Test: Manual, run the benchmark

Change-Id: I944b0e958e5df800f493af9e41a6202308301fc1
2016-10-14 14:57:52 -07:00
John Reck
62e5fea855 Greatly reduce BenchmarkState overhead
CL reduces BenchmarkState to minimal levels. It also adds
a warmup loop to get things going first before starting measurements.

With this change with clocks /not/ locked on bullhead the test for
RenderNodeJniOverhead is showing a stable (0ns std dev) result
of 54ns, which is approximately the expected amount.

Test: Ran a few perf benchmarks

Change-Id: If01e455884711ebd9cfb89f076efa19dc0b5436d
2016-10-13 08:41:35 -07:00
TreeHugger Robot
82d9e15a8f Merge "Switch APCT Perf test to JUnit 4.11 friendly" 2016-10-12 18:01:31 +00:00
Teng-Hui Zhu
578f47149d Switch APCT Perf test to JUnit 4.11 friendly
b/31928255

Test: run LayoutPerfTest VectorDrawablePerfTest before and after the change
      data is consistent.

Change-Id: I30de1f09b1df571479009048d621fef57b94f316
2016-10-11 15:39:05 -07:00
Seigo Nonaka
eb22e31f7f Introduce Typeface.createXX performance tests.
BUG:29142734
Test: Performed following commands
mmma -j1024 ./frameworks/base/apct-tests/perftests/core/
adb install -r $OUT/data/app/CorePerfTests/CorePerfTests.apk
adb shell am instrument -w \
com.android.perftests.core/android.support.test.runner.AndroidJUnitRunner

Change-Id: I8e5ef3bf729f981d20dc88736d8a1a3d6b972c55
2016-10-03 19:58:02 +09:00
Sudheer Shanka
42ed497416 Merge "Add usermanager related perf tests - part2" 2016-09-24 01:12:01 +00:00
Seigo Nonaka
36e0f12892 Fix test failure due to out of UI thread runnning.
After Ie8c42d60a0bff7636795a958a475058798061fe5,
ActivityTestRule is no longer a subclass of UiThreadTestRule, and looks
like the new UiThreadTest annotation is not working for Parameterized
test. As a temporary fix, use runOnUiThread instead of @UiThreadTest.

Change-Id: I69d035864259c1f0765d52ebc53634d3ef8ef84a
2016-09-16 12:13:30 +09:00
Sudheer Shanka
2c4522cc1b Add usermanager related perf tests - part2
- Add onLockedBootComplete callback to UserSwitchObserver.

Bug: 30948225
Test: adb shell am instrument -e class android.multiuser.UserLifecycleTest -w com.android.perftests.multiuser/android.support.test.runner.AndroidJUnitRunner
Change-Id: I87533094805a81fbd85d4f492e637b3304ecd5e2
2016-09-08 13:30:34 -07:00
Keisuke Kuroyanagi
fe1a3b6f03 Merge changes from topic 'ksk_long_text_edit'
* changes:
  Always redraw text that protrude from line bounds.
  Lazy RenderNode creation to improve performance.
2016-09-08 04:37:17 +00:00
Keisuke Kuroyanagi
9612120965 Merge "Edit long text performance test." 2016-09-08 04:37:17 +00:00
Keisuke Kuroyanagi
f5af4a344e Always redraw text that protrude from line bounds.
With I63af3a6ecbf92, we create RenderNode lazily, but
blocks containing contents that protrude from line top or
bottom cannot be simply lazily redrawn after edit or
scroll.
With this CL, we check if the contents protrude from line
top or bottom by comparing the text bounds with relevant
font metrics values and we always redrawn such blocks after
edit or scroll.

Bug: 27889485
Change-Id: I666da5eeb39f780c341597f347bfcba21eb34295
2016-09-05 17:45:37 +09:00
Teng-Hui Zhu
022113ad0d Workaround the issue that parameterized test don't support @UiThreadTest
When the test infrastructure support it, this change should be reverted.
b/30746303

Change-Id: Ice181d93f4f1210bcd2c8566e61c90035fe12ec5
2016-08-30 15:06:28 -07:00
Teng-Hui Zhu
17e76971a1 Move RenderNodePerfTest to the merged package
Change-Id: I4eaa1cf058a83d6c9fbbde2bd97d9638c1152ae8
2016-08-30 13:44:30 -07:00
John Reck
70b70a6f86 Merge "Merge & fix package names" 2016-08-26 20:40:01 +00:00
John Reck
7a9a4eca14 Merge & fix package names
Merge core, graphics, and misc into one
test suite as the split is unneccessary.

Also cleans up package names

Change-Id: I82da6cd69b3a52c63770465780ac98628af334ca
2016-08-26 09:43:03 -07:00
John Reck
395e9b8db2 Modernize RenderNode JNI
Change-Id: I455271647f01f3ac8ceb73359a51a2d2720fdd47
2016-08-24 15:55:27 -07:00
Chris Craik
793075b317 Merge "Add misc apct perf tests" 2016-08-24 22:46:54 +00:00