Commit Graph

588180 Commits

Author SHA1 Message Date
Jeff Sharkey
df8dc2b4a5 Apply fixes for EfficientCollections.
Drop-in replacements suggested for inefficient collections.  Also
annotate a handful of places where we're unable to update.

Bug: 155703208
Test: none
Exempt-From-Owner-Approval: trivial refactoring
Change-Id: I48b600508df8160ac9b40fea7afca974b2c972f6
2020-10-20 21:57:00 -06:00
Jeff Sharkey
a49ba3ac12 Trivial refactor for consistent naming.
This gives all our various new performance-related checkers a
consistent "EfficientFooChecker" naming style.

Bug: 155703208
Test: atest error_prone_android_framework_test
Change-Id: I8809fe46d20357201c8559037b468d717319afb9
2020-10-20 21:54:37 -06:00
Jeff Sharkey
caf66d02fd Expand formatSimple() to support widths.
One of the highest-traffic users of String.format() is in the
notification code, which uses argument widths.  To support these
use-cases, this change adds argument width support, with tests.

Bug: 170978902
Test: atest error_prone_android_framework_test
Exempt-From-Owner-Approval: trivial additions
Change-Id: I8e36d4725a6d0cc896dedc5c457eb5f38486d7b6
2020-10-20 21:54:26 -06:00
Jeff Sharkey
5c46da2a14 Refinement of EfficientStringsChecker.
It's okay if callers try mixing "static final" values into strings,
since the compiler will inline these to avoid the StringBuilder.

We also expand to catch any arguments that might be dynamically
calculated, such as method invocations.

Identify additional inefficient code patterns:

-- Passing dynamic strings into a StringBuilder, which acquires a
transparent StringBuilder for each append.
-- Using "str += val;" style concatenation, which acquires a
transparent StringBuilder for each append.
-- Using StringBuffer which has synchronization overhead.

Bug: 170978902
Test: atest error_prone_android_framework_test
Change-Id: Ia3758dd55a0e6753b0cc5bc83ae8fe45b6bfde1f
2020-10-20 19:58:16 -06:00
Anton Hansson
c0e3a09690 Merge "Remove @TestApi from @SystemApi symbols" 2020-10-20 13:41:39 +00:00
TreeHugger Robot
8e85d0e23d Merge "Deprecated unused TRANSIT_DOCK_TASK_FROM_RECENTS transition." 2020-10-20 13:37:22 +00:00
Dave Mankoff
f4c8103520 Merge changes from topic "b168904199-qs-injection"
* changes:
  5/N Move QS Tile tracking logic into QSPanelControllerBase.
  4/N Add QSPanelControllerBase
  3/N Remove UserTracker from QSPanel
  2/N Remove BroadcastDispatcher from QSPanel
  1/N Add QSFragmentComponent
2020-10-20 13:30:41 +00:00
Santos Cordon
ae31181f13 Merge "Integrate LogicalDisplayMapper with DisplayFoldController." 2020-10-20 11:47:44 +00:00
Issei Suzuki
823b309139 Deprecated unused TRANSIT_DOCK_TASK_FROM_RECENTS transition.
Test: existing tests pass.
Change-Id: I1ad4893c2153ffec1e268643135df8304bcca738
2020-10-20 13:32:27 +02:00
Marin Shalamanov
bfa53ec4ee Merge "Remove unused vars from LocalDisplayAdapter" 2020-10-20 10:19:33 +00:00
TreeHugger Robot
fdd8b128b8 Merge "Support platform AppSearchManager(backend) to accept database name." 2020-10-20 08:25:16 +00:00
Anton Hansson
586a3cf229 Remove @TestApi from @SystemApi symbols
I ran these commands:
    cd frameworks/base
    grep -rl '@TestApi' --include '*.java' | xargs perl -i -p0e \
        's/\@SystemApi[\s\n]+(\@\w+[\s\n]+)?\@TestApi/\@SystemApi\1/gs'
    grep -rl '@TestApi' --include '*.java' | xargs perl -i -p0e \
        's/\@TestApi[\s\n]+(\@\w+[\s\n]+)?\@SystemApi/\1\@SystemApi/gs'

Bug: 171179806
Test: m checkapi
Change-Id: I772790b783b0a8730b8bf680c9e569a886b8d789
2020-10-20 09:04:03 +01:00
TreeHugger Robot
4af480c6c1 Merge "Make restoreCallingIdentity() @CriticalNative." 2020-10-20 06:20:57 +00:00
Riddle Hsu
ab8c0dde6f Merge "Fix that the top process is not cleared after device sleeps" 2020-10-20 05:15:50 +00:00
Terry Wang
57f1c75d13 Support platform AppSearchManager(backend) to accept database name.
This change also add namespace for getByUri and deleteByUri in AppSearchManagerService

Bug: 170285774
Test: AppSearchManagerTest
Change-Id: I8044fc5f22dbd03b2d73f85806659e12d75d8afa
2020-10-19 21:44:02 -07:00
TreeHugger Robot
ec72f9996b Merge "Support task listener by task id." 2020-10-20 04:24:24 +00:00
Jeff Sharkey
4c4ca9a50c Make restoreCallingIdentity() @CriticalNative.
The validation check that might throw an exception is almost a decade
old at this point, and isn't likely to be hit.  In addition, the
recently added "AndroidFrameworkBinderIdentity" Error Prone checker
ensures that clients working with these identities are well-behaved.

Removing this exception code is what enables @CriticalNative.

Bug: 171078335
Test: none
Change-Id: Ib4cc9becf325979a97a9b0e58ac2277f3b226aaa
2020-10-19 22:12:10 -06:00
TreeHugger Robot
28a1dccf2e Merge "Increase BatteryStats delay" 2020-10-20 03:59:30 +00:00
TreeHugger Robot
f1f0bd6951 Merge "Add gradient clock to AOD/LS behind LS flag" 2020-10-20 02:55:00 +00:00
Wale Ogunwale
0e6581c1e6 Support task listener by task id.
Allows for managing specific task regardless of windowing mode.
Converted TaskView which to use the new API.

Bug: 170153209
Test: All tests pass and bubbles works!
Change-Id: Ic5281bc9dd9124841834c88f2b85545107567417
2020-10-19 19:21:45 -07:00
Adam Bookatz
2dbc9473a0 Merge "Change a few UserController calls to use isProfile" 2020-10-20 01:43:10 +00:00
TreeHugger Robot
d366a177a7 Merge "Add a target for statsd nano proto definitions." 2020-10-20 01:42:23 +00:00
Songchun Fan
5c2ad1c98c Merge "Revert "Revert "[pm/incremental/api] exposing package state names and reasons""" 2020-10-20 01:12:08 +00:00
Amy Zhang
21e83bc7fd Merge "Add DTMB Frontend Status Support in Tuner JNI" 2020-10-20 01:11:40 +00:00
TreeHugger Robot
fd7d94ea33 Merge "Move reentry state into PipBoundsState" 2020-10-20 01:05:04 +00:00
Beverly
4116599e26 Add gradient clock to AOD/LS behind LS flag
Also updates "new lockscreen" smart space layout.

Currently TimeBasedColorsClockController will change the TextClock's
colors based on hardcoded times.
To toggle on the new lockscreen:
  adb shell settings put global show_new_lockscreen 1

Test: atest KeyguardSliceViewTest
Test: manual
Bug: 170228350
Change-Id: Ib72b45aad34fe4483538a9094154d6c473910612
2020-10-19 20:47:14 -04:00
TreeHugger Robot
ce2ae19588 Merge "Protect against NPE thrown by flaky integration test" 2020-10-20 00:43:46 +00:00
Treehugger Robot
3c61e7fd71 Merge "Fix documentation of heart beat sensor" am: 3bef7fe58b am: a3d54aaa88 am: 4807d99163 am: 8570351c5a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1465663

Change-Id: Id274e65bade2dbafdf213f282bd7343bb9425d18
2020-10-20 00:29:06 +00:00
TreeHugger Robot
142d98361a Merge "Add the flags for shortcut bubbles" 2020-10-20 00:22:05 +00:00
Jeff Sharkey
9199bca1ef Merge changes from topic "sep28r"
* changes:
  Add fuzzer for rewritten CursorWindow.
  Rewrite of CursorWindow internals.
2020-10-20 00:11:14 +00:00
Treehugger Robot
8570351c5a Merge "Fix documentation of heart beat sensor" am: 3bef7fe58b am: a3d54aaa88 am: 4807d99163
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1465663

Change-Id: I9197744b37e3f2a082624e28a59a0a7e36536d87
2020-10-20 00:06:15 +00:00
Youngjun Kwak
d2cf9013e6 Merge "Create Sample 3" 2020-10-19 23:51:26 +00:00
Treehugger Robot
4807d99163 Merge "Fix documentation of heart beat sensor" am: 3bef7fe58b am: a3d54aaa88
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1465663

Change-Id: I7ccbaa984ded806aee599066dc13eacc31244ead
2020-10-19 23:45:44 +00:00
Amy Zhang
a0e22be70e Merge "Add two extended Frontend Scan Message in Tuner 1.1" 2020-10-19 23:41:08 +00:00
Rahul Ravikumar
e3e46e0a2c Add a target for statsd nano proto definitions.
Test: N/A
Change-Id: Ib4481fd010660510168d1f660a1fb2efde056f12
2020-10-19 16:35:13 -07:00
Treehugger Robot
a3d54aaa88 Merge "Fix documentation of heart beat sensor" am: 3bef7fe58b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1465663

Change-Id: Ib6ec0365c09e32ea0bce3cb00c20d1d3d8345916
2020-10-19 23:16:43 +00:00
Lyn Han
5ae394be12 Protect against NPE thrown by flaky integration test
Bug: 150344903
Test: atest PlatformScenarioTests:android.platform.test.scenario.sysui.bubble.Overflow -s [device] --rerun-until-failure 3
Change-Id: I603ee92a4bc83017d877bde721d1a2f4ccf15fa2
2020-10-19 18:00:59 -05:00
Songchun Fan
4377d446ce Revert "Revert "[pm/incremental/api] exposing package state names and reasons""
This reverts commit cf4c99720b.

Reason for revert: not related to launcher changes

Test: will add CTS tests.
BUG: 162600626
CTS-Coverage-Bug: 168925819
Change-Id: I5a6832ef7907c2be90758a553514fb0dedb8c8e1
2020-10-19 22:58:28 +00:00
Tej Singh
cfa32e13ef Perform update for duration metric
Creates a new metric if the metric is new/needs replacement.
Preserves the metrics that can be preserved. Ensures that indices are
updated, including within duration trackers.

Does not handle if a condition is true for a new metric based on an
existing condition.

Test: atest statsd_test
Bug: 162323124
Change-Id: Ibe0baf54678c1c6efde5aeba6a4b9b7fa2634c55
2020-10-19 15:51:05 -07:00
Treehugger Robot
3bef7fe58b Merge "Fix documentation of heart beat sensor" 2020-10-19 22:39:05 +00:00
Mady Mellor
731ddd86ae Add the flags for shortcut bubbles
Test: manual with test app now that it does shortcuts too
Fixes: 170976167
Change-Id: I923b82e62e7a1247a9b4c073a8e4bf00ebb02b48
2020-10-19 15:15:47 -07:00
Jeff Sharkey
256da5a361 Add fuzzer for rewritten CursorWindow.
We recently rewrote CursorWindow, so let's get a fuzzer wired up
to see if it has any bugs.

This change creates a separate "libandroidfw_fuzz" library, since we
can't link to libbinder when building Windows host-side binaries;
the fuzzer doesn't need Window support.

And fix our first vulnerability where getFieldSlot() could be
tricked into reading out of bounds data.

The included corpus seed was generated using this example code:

    CursorWindow* w = nullptr;
    CursorWindow::create(android::String8("test"), 1 << 21, &w);
    w->setNumColumns(3);

    w->allocRow();
    w->putLong(0,0,0xcafe);
    w->putLong(0,1,0xcafe);
    w->putLong(0,2,0xcafe);

    // Row purposefully left empty
    w->allocRow();

    w->allocRow();
    w->putNull(2,0);
    w->putNull(2,1);
    w->putNull(2,2);

    w->allocRow();
    w->putString(3,0,"cafe",5);
    w->putString(3,1,"cafe",5);
    w->putString(3,2,"cafe",5);

    w->allocRow();
    w->putDouble(4,0,3.14159f);
    w->putDouble(4,1,3.14159f);
    w->putDouble(4,2,3.14159f);

    Parcel p;
    w->writeToParcel(&p);

Bug: 169251528
Test: atest libandroidfw_tests:CursorWindowTest
Test: SANITIZE_HOST=address make ${FUZZER_NAME} && ${ANDROID_HOST_OUT}/fuzz/$(get_build_var HOST_ARCH)/${FUZZER_NAME}/${FUZZER_NAME}
Change-Id: I405d377900943de0ad732d3f1a1a0970e17d5140
2020-10-19 16:07:16 -06:00
Jeff Sharkey
ae2d88a65c Rewrite of CursorWindow internals.
The original CursorWindow implementation was created in Android 1.0
and has remained relatively unchanged since then.  Unfortunately that
design results in very poor performance on large windows, since
reading or writing each FieldSlot is O(row/100) to traverse through
a chain of RowSlotChunks.  It's also memory-inefficient due to how
it allocates RowSlotChunks in 404 byte chunks, even when there's only
a single row to store.

This change is a complete redesign of the CursorWindow internals to
use a "heap-and-stack" style approach, where a "heap" of strings
and blobs increment up from the bottom of the window while a "stack"
of FieldSlots increment down from the top of the window.

The included benchmarks show the following improvements, ensuring
no regressions for small windows, while offering very dramatic
improvements for larger windows:

                Big cores      Little cores
4x4 cursor      no regression  no regression
1024x4 cursor   2.2x faster    2.0x faster
16384x4 cursor  48.5x faster   24.4x faster

Detailed unit testing is also included to ensure that the rewrite
behaves correctly.

Bug: 169251528
Test: atest libandroidfw_tests
Test: atest CtsDatabaseTestCases
Test: atest FrameworksCoreTests:android.database
Test: ./frameworks/base/libs/hwui/tests/scripts/prep_generic.sh little && atest libandroidfw_benchmarks
Test: ./frameworks/base/libs/hwui/tests/scripts/prep_generic.sh little && atest CorePerfTests:android.database.CrossProcessCursorPerfTest
Change-Id: I90dff31fd550130dae917a33e0e1fa684e15c107
2020-10-19 16:07:04 -06:00
Amy Zhang
07e6258728 Merge changes from topic "frstatus"
* changes:
  Tuner JNI to use the extended frontend status types and build up extended status struct
  Add Frontend Status Extended types and getter APIs
2020-10-19 22:06:26 +00:00
Amy Zhang
8366252c0c Merge "Expose MediaEvent.release() as System API in Android S" 2020-10-19 22:05:39 +00:00
Jeff DeCew
d8168cf2fb [automerger skipped] Merge changes from topic "media_delete_intent_rvc_qpr2" into rvc-qpr-dev am: d4659de45d am: 1c7502c179 -s ours
am skip reason: Change-Id Iebb4f113d73179d7314ae1c6db3856ee0fd10b07 with SHA-1 c1b65c7387 is in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12814680

Change-Id: I4300590c299beb214e3b0a9363829bb5a10b4e7d
2020-10-19 21:58:26 +00:00
Jeff DeCew
a3748ff7db [automerger skipped] Disable player's "Dismiss" button when notification is not dismissible. am: a49a320e49 am: 542839d8fa -s ours
am skip reason: Change-Id I3c2a73e4885642965ec553387b5e91f0cb16ff2f with SHA-1 b62d02913b is in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12814679

Change-Id: Ia9d8c4cebcd2afdf9db0f35bed5a0d37c79198b8
2020-10-19 21:58:13 +00:00
Jeff DeCew
7259bd6572 [automerger skipped] Media player attempts to dismiss notifications when players removed. am: 734c374976 am: 02aa1dd89d -s ours
am skip reason: Change-Id I64db4cc618a812063c18a40ea4465aa4c520a3be with SHA-1 725d67d889 is in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12793888

Change-Id: I3dda2be17b82849e839a3ec5792f5ead58cc3bd2
2020-10-19 21:58:04 +00:00
jorgegil@google.com
5b8d244061 Move reentry state into PipBoundsState
Bug: 169373982
Test: existing tests pass, reentry works
Change-Id: I45af27637f24ad0822e4bdf65cd3a93d4a2442dd
2020-10-19 14:52:11 -07:00
TreeHugger Robot
9dfe748b50 Merge "PreBootBroadcaster.java: Make the PendingIntent immutable" 2020-10-19 21:46:28 +00:00