Commit Graph

8432 Commits

Author SHA1 Message Date
Darryl Johnson
b87e44ce32 Merge "Don't report device state until hardware state is known." into sc-dev 2021-03-09 06:20:01 +00:00
Darryl L Johnson
090b0afb1b Don't report device state until hardware state is known.
The previous implementation of DeviceStateProviderImpl would report the
current device state as soon as a listener was registered leading to a
series of device state changes on boot as the state of the hardware
becomes known. This changes the implementation to await callbacks before
notifying the listener of a change in device state.

Fixes: 181671216
Test: atest DeviceStateProviderImplTest
Test: atest DeviceStateManagerServiceTest
Test: atest DeviceStateManagerGlobalTest

Change-Id: I3f133b6d7135b829b79c9f225ae52c71061faa3e
2021-03-08 18:02:57 -08:00
Michael Wachenschwanz
b95b1a2eff Merge changes from topic "cpuEnergyAttribution" into sc-dev
* changes:
  Accumulate charge instead of energy in BatteryStatsImpl
  Accumulate and attribute measured Cpu energy in BatteryStats
2021-03-08 23:46:08 +00:00
Sally Yuen
8a070bb465 Merge "Revert "Service requests can interrupt node prefetching"" into sc-dev 2021-03-08 22:04:17 +00:00
Michael Wachenschwanz
68b8157e4e Accumulate charge instead of energy in BatteryStatsImpl
Track battery voltage along side the measured energy to calculate
battery charge consumption per EnergyConsumer. This better represents
a consumer's impact on battery. Also change numerous variable/method
names from energy units to charge units.

Bug: 180079165
Fixes: 173765509
Test: atest FrameworksCoreTests:com.android.internal.power.MeasuredEnergyStatsTest
Test: atest FrameworksCoreTests:com.android.internal.os.BatteryStatsNoteTest
Test: atest ScreenPowerCalculatorTest
Test: atest FrameworksServicesTests:com.android.server.am.MeasuredEnergySnapshotTest

Change-Id: I5e727cebf1252cc7b1645a53282de2281c68ae85
2021-03-08 11:53:59 -08:00
Sally Yuen
373028a524 Revert "Service requests can interrupt node prefetching"
This reverts commit 327de4b45c.

Reason for revert: b/182016372

Change-Id: I67ec01fc2f47b05a2dc11e7951c11a708fdbeebf
2021-03-08 19:49:37 +00:00
Yiwei Zhang
83c17c18b8 Merge "Nudge SurfaceControlFpsListener api to use task ID" into sc-dev 2021-03-07 03:44:19 +00:00
Tim Van Patten
3c4b8d977b Merge "GameManager: Add Public API" into sc-dev 2021-03-06 07:17:14 +00:00
Tim Van Patten
7f2f873b59 GameManager: Add Public API
Add the public API to GameManager:
- getGameMode()

Bug: b/178860939
Test: atest CtsGameManagerTestCases
Test: atest GameManagerTests
Test: atest GameManagerServiceTests
Test: atest GameManagerServiceSettingsTests
Change-Id: Ie6030e4ec796c9ecf2c756f24f00e445572accda
2021-03-05 19:59:28 -07:00
Dmitri Plotnikov
32a183264b Merge "Add batteryTimeRemaining and chargeTimeRemaining to BatteryUsageStats" into sc-dev 2021-03-06 01:56:32 +00:00
Alexander Dorokhine
db7aecbc3a Merge "Update Framework from Jetpack." into sc-dev 2021-03-05 22:01:56 +00:00
Alexander Dorokhine
73fb4da96d Update Framework from Jetpack.
Included changes:
* 509ebe: Rename getSchemasNotVisibleToSystemUi to setSchemaTypeDisplayedBySystem
* a532fe: Resolve merge conflicts from upstream sync.

Bug: 179143575
Bug: 175146044
Bug: 179160886
Bug: 175255572
Bug: 181887768
Test: Presubmit

Change-Id: I977baf47f6188e4c182a5cf96af4873d0e5284e0
2021-03-05 22:01:32 +00:00
Dmitri Plotnikov
cf2929ffe9 Add batteryTimeRemaining and chargeTimeRemaining to BatteryUsageStats
Bug: 158137862
Test: atest FrameworksCoreTests:com.android.internal.os.BatteryChargeCalculatorTest
Change-Id: I247a593de242a2864eef16b7c9ea956209f60cbe
2021-03-05 13:57:47 -08:00
Alec Mouri
2b54c82cc5 Nudge SurfaceControlFpsListener api to use task ID
Bug: 174956756
Test: e2e test with dashboard cls
Change-Id: I463a7bffc02b371e41752912736d1a6bb9f73633
2021-03-05 12:20:18 -08:00
Jeff Sharkey
34229aaf73 Merge "General BytesMatcher utility class." into sc-dev 2021-03-05 18:12:15 +00:00
Sally Yuen
515057f70d Merge "Service requests can interrupt node prefetching" into sc-dev 2021-03-05 17:27:51 +00:00
Alex Johnston
4183c1d4a7 Merge "AppUriAuthenticationPolicy and UrisToAliases equals and hashcode" into sc-dev 2021-03-05 09:31:15 +00:00
Sally
327de4b45c Service requests can interrupt node prefetching
This is the re-merging of ag/12923546 (where most of that original
message is posted below), which includes various bug fixes.

Slow prefetch requests would block user interactive requests, creating
noticeable sluggishness and unresponsiveness in accessibility services,
especially on the web.

Let's make it so a user interactive requests stops prefetching.
We can't interrupt an API call, but we can stop in between API calls.

On the service side, we have to separate the prefetch callbacks from the
find callback. And we have to make it asynchronous. It does dispatch
intothe main thread, so the AccessibilityCache can remain single threaded.

When the calls are interrupted on the application side,
returnPendingFindAccessibilityNodeInfosInPrefetch checks the find
requests that are waiting in the queue, to see if they can be addressed
by the prefetch results. If they can be, we don't have to call into
potentially non-performant application code. We don't  check requests
that have differing prefetch flags (FLAG_INCLUDE_NOT_IMPORTANT_VIEWS,
FLAG_REPORT_VIEW_IDS) that would result in different caches.

We also make mPendingFindNodeByIdMessages thread-safe and ensure in
ActionReplacingCallback we don't return null results. Merged
ag/13246536, ag/13256330

Messages should be added to PrivateHandler and
mPendingFindNodeIdMessages at the same time to avoid a race condition
where we try removing a message from the handler before it's actually
enqueued. This was causing double recycling

UiAutomation does't require a main thread, so getMainLooper may
return null. In this case, instead of posting to the main looper,
we cache nodes on the binder thread (which is our ultimate goal).

Added tests to verify AccessibilityInteractionController interactions

Test: atest AccessibilityInteractionControllerNodeRequestsTest,
FrameworksServicesTests FrameworksCoreTests, CtsAccessibility, Manual
testing

Bug: b/176195360, b/175877007, b/175884343, b/178726546, b/175832139,
b/176195505, b/181701570

Change-Id: I66902f995f33f0236003faa439925ec72fcf6952
2021-03-04 23:01:50 +00:00
Jeff Sharkey
6644436a75 General BytesMatcher utility class.
As part of an upcoming feature, we're anticipating the need to match
arbitrary byte sequences, such as Bluetooth UUIDs or MAC addresses,
so this change adds a new BytesMatcher similar in spirit to
the existing PatternMatcher.

It supports a reasonably compact serialization format which can be
used to transport a server-pushed deny-list.  The choice to support
both "accept" and "reject" rules in an ordered list means that very
complex matching rules can be expressed efficiently.

Bug: 181812624
Test: atest FrameworksCoreTests:android.os.BytesMatcherTest
Change-Id: I55193051354278abaef8bef51413c632b07c7177
2021-03-04 14:57:01 -07:00
TreeHugger Robot
2aebc3e739 Merge "Add vibrator capabilities to service dumpsys" into sc-dev 2021-03-04 20:09:57 +00:00
Paul Hu
40f09de8e6 Merge "Replace ConnectivityManager hidden symbols on framework" am: 1297f90193 am: 0e37e30151 am: 7a35f4b4de
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1607955

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ifd0d0d57bc74aaf9590dcdd4aa76919da8ccb7d0
2021-03-04 05:10:48 +00:00
Rajeev Kumar
2c293a43a3 Merge changes I0bd9becd,I1f2967dc into sc-dev
* changes:
  Add new component usage event (2/2)
  Add new component usage event (1/2)
2021-03-04 04:32:52 +00:00
Paul Hu
1297f90193 Merge "Replace ConnectivityManager hidden symbols on framework" 2021-03-04 03:07:08 +00:00
Seigo Nonaka
b797729b3f Merge "Avoid infinite loop for invalid XML format" into sc-dev 2021-03-04 02:31:25 +00:00
Kevin Han
157db238a6 Add new component usage event (1/2)
Add a new usage event to UsageStats when a component in a package is
used (content provider binding, explicit broadcast, activity resume)
and it is considered to be important usage.

The follow-up CL will handle the service binding case as it is a little
complicated due to job bindings.

Bug: 175829712
Test: adb shell dumpsys usagestats <package-name>
Test: atest UserUsageStatsServiceTest
Change-Id: I1f2967dcf5999a8f0affea94bce4c0873a04e022
2021-03-03 17:15:23 -08:00
Michael Wachenschwanz
95bd56660e Accumulate and attribute measured Cpu energy in BatteryStats
BatteryExternalStatsWorker will now include measured Cpu Cluster energy
data (if available) when triggering a Cpu update in BatteryStatsImpl.
Using the per cluster per uid duration read from the kernel, the
measured energy can be attributed per cluster and then totaled to get
the Cpu energy consumption of a uid since the last update.

Fixes: 180079165
Test: manual ("adb shell dumpsys batterystats --measured-energy" on an
unplugged PowerStatsHal2.0 enabled device)

Change-Id: I0127bf61decdd5a9a5744e3352d5a3ff3a5fa2fe
2021-03-03 16:20:39 -08:00
Jeff Sharkey
b375855856 Merge "Add OWNERS file for UsageStats unit tests." am: eeb577dc44 am: df5a88ea6d am: 1881ec9386
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1614160

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I46015cb552a7e276e97c5861d0887ab7f5e97725
2021-03-03 22:43:32 +00:00
Alex Johnston
0c3f0c51bc AppUriAuthenticationPolicy and UrisToAliases equals and hashcode
Bug: 177979648
Test: atest android.devicepolicy.cts.CredentialManagementAppTest
      atest android.devicepolicy.cts.AppUriAuthenticationPolicyTest
      atest android.security.CredentialManagementAppTest
Change-Id: I66d715ba6b47749e2e89c037caecc29f02d3a017
2021-03-03 18:13:21 +00:00
Varun Shah
0ef490024e Add OWNERS file for UsageStats unit tests.
Bug: n/a
Test: n/a
Change-Id: Iab4b0153c4e7bff94fb6a6d02b6439e3d6151820
2021-03-03 17:08:47 +00:00
Michael Rosenfeld
b8e3cea7ad Merge "Revert "Prefetching can be interrupted by other service requests."" into sc-dev 2021-03-03 08:23:05 +00:00
Michael Rosenfeld
4ce3fddf73 Revert "Prefetching can be interrupted by other service requests."
This reverts commit f94c85b130.

Reason for revert: Causing app crashes and runtime restarts in tests. See b/181701570 for details.

Change-Id: I2b5f7b80f07f5d8f564acdf20fcdb1e9b5b9da19
2021-03-03 00:30:05 +00:00
Sally Yuen
2f5d064577 Merge "Add OWNERS for A11yInteractionController and accessibility core tests" am: d379746bb9 am: 26d1ed8f94 am: e1921f4164
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1612071

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I5af7ce3223044c11f96e5d8a82af1969c8309c36
2021-03-02 21:36:21 +00:00
Sally Yuen
6996380ef9 Merge "Prefetching can be interrupted by other service requests." into sc-dev 2021-03-02 18:07:56 +00:00
Sally
ce20fed9b5 Add OWNERS for A11yInteractionController and accessibility core tests
Bug: n/a
Test: n/a
Change-Id: Ie20914b3be604e9908ea25746575b041682ee1c7
2021-03-02 17:51:26 +00:00
Lais Andrade
b847d63f25 Add vibrator capabilities to service dumpsys
Add list of supported vibrator capabilities to information reported to
dumpsys, and fix Vibration to log original effect before any change is
applied by the local service.

Bug: 180924179
Test: manual
Change-Id: I97201771d3ee211dc2f4b6f9eac50b5b150affc0
2021-03-02 16:26:17 +00:00
Joanne Chung
af76755ff7 Update ContentCaptureContext to have a token information
In order to support auto translation, we need to give information to
content capture service to let the app can use this information to
find the Activity which needed to be translated.

It's not safe to provide an activity token to the client app directly
even if it is a privilege app. They can use this activity token to
access many activity/windows related functions. We create a new token
for use for content capture and translation. This token will be used
get the target Activity for translation new APIs.

This change focuses on the Content capture API change, the API change
about translation will be done in the next change,

Bug: 177789967
Test: manual. Make sure cc service can get the information.
Test: atest android.view.contentcapture.ContentCaptureContextTest
Test: atest CtsContentCaptureServiceTestCases

Change-Id: Ife8096a8bd1e71ce4e686d95043e347222ad7ee6
2021-03-02 06:47:48 +00:00
Sally
f94c85b130 Prefetching can be interrupted by other service requests.
This is the re-merging of ag/12923546 (where most of that original
message is posted below), which includes various bug fixes.

Slow prefetch requests would block user interactive requests, creating
noticeable sluggishness and unresponsiveness in accessibility services,
especially on the web.

Let's make it so a user interactive requests stops prefetching.
We can't interrupt an API call, but we can stop in between API calls.

On the service side, we have to separate the prefetch callbacks from the
find callback. And we have to make it asynchronous. It does dispatch
intothe main thread, so the AccessibilityCache can remain single threaded.

When the calls are interrupted on the application side,
returnPendingFindAccessibilityNodeInfosInPrefetch checks the find
requests that are waiting in the queue, to see if they can be addressed
by the prefetch results. If they can be, we don't have to call into
potentially non-performant application code. We don't  check requests
that have differing prefetch flags (FLAG_INCLUDE_NOT_IMPORTANT_VIEWS,
FLAG_REPORT_VIEW_IDS) that would result in different caches.

We also make mPendingFindNodeByIdMessages thread-safe and ensure in
ActionReplacingCallback we don't return null results. Merged
ag/13246536, ag/13256330

UiAutomation does't require a main thread, so getMainLooper may
return null. In this case, instead of posting to the main looper,
we cache nodes on the binder thread (which is our ultimate goal
once b/180957109 is fixed).

Added tests to verify AccessibilityInteractionController interactions

Test: atest AccessibilityInteractionControllerNodeRequestsTest,
FrameworksServicesTests FrameworksCoreTests, CtsAccessibility, Manual
testing

Bug: b/176195360, b/175877007, b/175884343, b/178726546, b/175832139,
b/176195505

Change-Id: I346a3f40c84c6697b8a1e1d84a636eada655b984
2021-03-01 23:58:46 +00:00
Pinyao Ting
4a08dabf99 Merge "Shortcut integration with AppSearch (Part 2)" into sc-dev 2021-03-01 23:10:11 +00:00
Darryl Johnson
e72cce5235 Merge "Add callbacks for change in supported device states and non-override state." into sc-dev 2021-03-01 22:22:06 +00:00
Pinyao Ting
47d1a02267 Shortcut integration with AppSearch (Part 2)
In order to move shortcuts from memory into AppSearch, we need to move
the bookkeeping states associated with ShortcutInfo into AppSearch as
well. This CL updates the schema to reflect the necessary chagnes.

Bug: 151359749
Test: atest ShortcutManagerTest1 ShortcutManagerTest2 ShortcutManagerTest3 ShortcutManagerTest4 ShortcutManagerTest5 ShortcutManagerTest6 ShortcutManagerTest7 ShortcutManagerTest8 ShortcutManagerTest9 ShortcutManagerTest10 ShortcutManagerTest11
Change-Id: Iaafaf6b81504b3f80c05b7f4a996b1b5b6beaeb7
2021-03-01 12:56:51 -08:00
Yohei Yukawa
b2e45a2dc6 Merge "Revert "Avoid IME restart for configChanges"" into sc-dev 2021-03-01 18:30:36 +00:00
Taran Singh
712fc24a34 Revert "Avoid IME restart for configChanges"
Revert "Add cts for InputMethodService configChanges"

Revert submission 13417792-b/167948419

Reason for revert: Causes bugs like b/181195100
Reverted Changes:
Iff88b768c:Avoid IME restart for configChanges
Ib7ce13340:Add cts for InputMethodService configChanges

Bug: 167948419
Fix: 181195100
Change-Id: I36bca545b09b4f870560964ec61fa6bb344fceaf
2021-03-01 18:28:10 +00:00
Darryl L Johnson
2c35bdf901 Add callbacks for change in supported device states and non-override
state.

This:
1. Renames DeviceStateListener to DeviceStateCallback as there is more
than one method in the callback.
2. Adds a callback to DeviceStateCallback to notify clients about a
change in supported device states.
3. Adds a callback to DeviceStateCallback to notify clients about a
change in non-override state (the state of the device without
considering override requests).
4. Restructures the IDeviceStateManager callback interface to return a
DeviceStateInfo object on successful registration of the callback
instead of triggering callbacks after registation. This simplifies the
callback code paths.

Bug: 159401801
Bug: 154038218
Fixes: 179291575
Test: atest DeviceStateManagerServiceTest
Test: atest DeviceStateManagerGlobalTest
Test: atest DeviceStateInfoTest

Change-Id: I42841de3e19ec0161a8c7b18c5baac0f2c2548bf
2021-03-01 09:31:22 -08:00
Ruslan Tkhakokhov
75ee2bf7f1 Update D2D logic in line with new opt-out rules
* Ignore android:fullBackupContent for apps targeting Android S+ while
  in D2D
* Update LocalTransport::getTransportFlags() to support
  FLAG_DEVICE_TO_DEVICE_TRANSFER (required for CTS testing)

Bug: 180523564
Test: atest FullBackupRulesHostSideTest
Change-Id: I115c1c76f4b0d8b486cc9f146ef630fda3ff2a03
2021-03-01 10:26:07 +00:00
Dmitri Plotnikov
20720fa188 Add battery history to BatteryStatsUsage
Bug: 173745486
Test: atest FrameworksCoreTests:com.android.internal.os.BatteryUsageStatsProviderTest
Change-Id: Icfd9e49b68f1be99312c88ac889b06aa669367ef
2021-02-28 17:05:39 -08:00
Dmitri Plotnikov
5ab97fffe0 Break out battery history reading into a separate class
This class will be used by BatteryUsageStats

Bug: 180765532
Test: atest FrameworksCoreTests:com.android.internal.os.BatteryStatsHistoryTest
Test: atest FrameworksCoreTests:com.android.internal.os.BatteryStatsNoteTest
Test: atest FrameworksCoreTests:com.android.internal.os.BatteryStatsHistoryIteratorTest

Change-Id: Ic392bcdb6eb815afcc3cd882aa32dd4c78b6484f
2021-02-28 10:34:01 -08:00
Shuo Qian
8b8f2625db Merge changes from topic "cp-rvc-aosp" into sc-dev
* changes:
  [automerged blank] Add Emergency callback mode shell command 2p: b201f9b1e6
  Add Emergency callback mode shell command
2021-02-26 22:56:18 +00:00
Adam Bookatz
47fe2c6ade Merge "TEST_MAPPING for BatteryStats" into sc-dev 2021-02-26 17:11:40 +00:00
Galia Peycheva
656d774184 Merge "Fix synchronisation in BackgroundBlurDrawable" into sc-dev 2021-02-26 14:30:04 +00:00
Jeff Sharkey
869d848e45 Merge "Add OWNERS for long screenshots framework code" am: 79bed70aa2 am: 4df29fd76a am: 2b3fee42d8
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1600453

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Icb05293712e0b6127bda0e8e297e447956ee5aa1
2021-02-26 13:08:55 +00:00