Commit Graph

392 Commits

Author SHA1 Message Date
TreeHugger Robot
9db9a56c7e Merge "Introduce WaveformBuilder to VibrationEffect" into sc-dev 2021-03-23 14:32:56 +00:00
TreeHugger Robot
11d5b29d7c Merge "Introduce VibrationEffectSegment" into sc-dev 2021-03-23 08:52:21 +00:00
Kevin Chyn
7d11db35c9 2/n: Add UserAwareBiometricScheduler
Bug: 181984005
Test: atest com.android.server.biometrics
Change-Id: I67beecf1aee2631856da3541ca1e0d158050ac65
2021-03-22 20:51:26 -07:00
Lais Andrade
601a944e45 Introduce WaveformBuilder to VibrationEffect
Create a new parcelable RampSegment and introduce
VibrationEffect.startWaveform() method that returns a
WaveformBuilder that allows creating step/ramp waveforms that
changes amplitude and frequency of the effect.

Implementations of VibrationThread and InputManagerService for now just
ignore the new segments and keep existing behavior.

Bug: 167947076
Test: VibrationEffectTest
Change-Id: Ibac895b63196e779457efc297f1f5497a7814ae9
2021-03-18 18:06:45 +00:00
Lais Andrade
bd992109e0 Introduce VibrationEffectSegment
Create a new parcelable VibrationEffectSegment in the new package
android.os.vibrator, together with three concrete implementations for
the segment types: step, prebaked and primitive.

Remove all implementations of VibrationEffect to allow composition of
any effects, represented now by the concrete type VibrationEffect that
holds a list of segments.

Bug: 167947076
Test: VibrationEffectTest
Change-Id: I79c99e29f436ed77558af764f55633bb4636e034
2021-03-18 11:03:45 +00:00
Kevin Chyn
42968075d6 Biometric time-based resetLockout for multi-biometric devices
On devices with multiple sensors, lockout should be reset whenever
any strong sensor authenticates.

Bug: 163058911
Test: atest CtsBiometricsTestCases

Change-Id: I4bcdc0279cdaa444e59cf0fac6645d9a67e7d11d
2021-03-17 21:45:42 -07:00
Zhen Zhang
23f7206dbc Create component used metrics in UsageStats
Created a new metrics called mLastTimeComponentUsed in UsageStats.
It is persisted and loaded as other metrics.

Bug: 175829712
Test: core/tests/coretests/src/android/app/usage/UsageStatsTest
Test: cts/UsageStatsTest
Test: UsageStatsDatabaseTest
Test: UsageStatsServiceTest
Test: UsageStatsPersistenceTest
Change-Id: I10cf5c40cf5955246a6a04e96ac0352b4ed29acd
2021-03-15 14:24:08 -07:00
tomnatan
c3cb0cb12b WM: Add in_size_compat_mode to ActivityRecord proto
In addition, rename in_size_compat_mode in WindowState proto to
has_compat_scale for clarity.

Test: atest CtsWindowManagerDeviceTestCases:CompatScaleTests
Bug: 181878559
Change-Id: I0d6844be3f138fdc16a22497346e789d93af7396
2021-03-11 15:38:18 +00:00
Hui Yu
a7f8eaa171 callingUid needs to be passed from AMS to DeviceIdleController.
callingUid is the UID of the app who added the temp-allowlist entry, it
needs to be passed from AMS to DeviceIdleController.

The callingUid will go into Westworld metric
ForegroundServiceStateChanged.

Bug: 171305836
Test: Observe the callingUid while grepping for "tempAllowListReason" in adb logcat, it should be a non-zero value.
BYPASS_INCLUSIVE_LANGUAGE_REASON=Existing public API.

Change-Id: I19f5cf8f72d5fbfb3fd6caefe6978e75d4c1a801
2021-03-05 10:06:23 -08:00
TreeHugger Robot
cf82f60caf Merge "Remove frozen bounds of activity and task" into sc-dev 2021-03-03 13:06:56 +00:00
Hui Yu
3d96c757a5 Merge "Log the temp allowlist reason/duration at FGS start." into sc-dev 2021-02-26 01:21:13 +00:00
Thierry Strudel
d27ed1bd48 Merge "PowerStats: adjust time since boot to epoch before writing to disk" into sc-dev 2021-02-25 21:29:45 +00:00
Thierry Strudel
721bb44733 PowerStats: adjust time since boot to epoch before writing to disk
Data stored to disk are extracted into an incident report for timeseries
visualization which shows walltime and may span multiple reboot sessions
so storing walltime is better suited than relative time since device boot.

Bug: 179712445
Tests: atest FrameworksServicesTests:PowerStatsServiceTest
Signed-off-by: Thierry Strudel <tstrudel@google.com>
Change-Id: I5ae8e2fe22f1ab9ea960e5be8fef4e9fb1cc10f0
2021-02-25 10:38:01 -08:00
Riddle Hsu
52642a88f6 Remove frozen bounds of activity and task
Since unifying of hierarchy, the configuration of Activity and
windows are updated together. There won't be temporal inconsistent
bounds any more.
History commit: 0429f35

Also remove the update of override config even there are no changes.
Because performDisplayOverrideConfigUpdate was changed to not always
call setNewDisplayOverrideConfiguration for years. So the original
purpose of the change is gone.
History commit: c646717

Bug: 159103089
Bug: 163976519
Test: CtsWindowManagerDeviceTestCases
Change-Id: Ie5711ab4bcff7bf572cf6410df9bc8aaa5688e11
2021-02-25 20:15:19 +08:00
Louis Chang
09f52aa440 Merge "Rename Stack to Task related terms (7/n)" into sc-dev 2021-02-25 04:58:24 +00:00
Louis Chang
7efc57797c Rename Stack to Task related terms (7/n)
- Renaming PinnedStack to PinnedTask
- Renaming DockedStack to DockedTask

Bug: 157876447
Test: presubmit
Change-Id: I51c10564647ed0d46eddc0c51a1ee06eef897e43
2021-02-25 04:57:26 +00:00
Hui Yu
bd7619635d Log the temp allowlist reason/duration at FGS start.
There are four ways a package can be temp allowlisted:
1. Calling BroadcastOptions#setTemporaryAppWhitelistDuration() to
allowlist a BroadcastReceiver, this is a SystemApi.
2. Calling ActivityManagerService#setPendingIntentWhitelistDuration()
to allowlist a PendingIntent, this is not an API, it is an internal method.
3. Calling PowerWhitelistManager#whitelistAppTemporarily() to allowlist
a package, this is a SystemApi.
4. DeviceIdleController.addPowerSaveTempWhitelistApp(), this is an
internal method.

Also the package can be permanently allowlsited in
 ActivityManagerService#mDeviceIdleExceptIdleAllowlist.

Move the BG-FGS-launch reasonCode from ActiveService.java to
PowerWhitelistManager.java. Define a list of temp allowlist reasonCode
in addition to the BG-FGS-launch reasonCode. The reasonCode is passed
around in DeviceIdleController and ActivityManagerService, it will be
used in statsd FGS metric.

At FGS start, check all above allowlists and record the reasonCode/reason/duration in
ServiceRecord#mInfoTempAllowListReason field.

If mInfoTempAllowListReason is not null, log the reasonCode/reason/duration in "Background started FGS" log
message, with key "tempAllowListReason".

Bug: 171305836
Test: atest cts/tests/app/src/android/app/cts/ActivityManagerFgsBgStartTest.java
Reboot device, observe all "tempAllowListReason" listed above in logcat.
BYPASS_INCLUSIVE_LANGUAGE_REASON=existing APIs

Change-Id: Ieb52d95aae3258817a67734c093cb12fc78a81fd
CTS-Coverage-Bug: 181160445
2021-02-24 22:02:09 +00:00
Sergey Nikolaienkov
b0ad9cd284 Add compat info to WindowManager proto dump
Bug: 168419799
Test: atest CtsWindowManagerDeviceTestCases:CompatScaleTests
Change-Id: Idc321d5f1376a32b2b1b34b1a099cf12d96c943d
2021-02-23 08:09:05 +00:00
Lais Andrade
43bf46112c Clean up after VibratorManager feature introduced
- Move VibratorManagerService to com.android.server.vibrator and make
all other classes there package-private;
- Add some missing haptics-related files to OWNERS files;
- Remove some unused methods;
- Delegate CombinedVibrationEffect to input devices, instead of only
delegating VibrationEffect effects;
- Move vibratorservice.proto to vibrator folder and add missing fields;
- Mark large VibrationThread tests with @LargeTest;

Fix: 131311651
Fix: 177805090
Test: VibratorManagerServiceTest
Change-Id: Ic747190b70b2f45ac7671eb01f8f05cf66d3a96c
2021-02-12 14:45:58 +00:00
TreeHugger Robot
208c4707e8 Merge "Log energy consumer result attribution data" into sc-dev 2021-02-04 23:07:39 +00:00
Treehugger Robot
52dd967078 Merge changes If58d648d,Iec51a349 am: de246e1658 am: f5075fb162 am: a6de64a7b6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1566903

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Iaa608d60c0e4623ea1ef2a8020f2c131e7495411
2021-02-04 21:50:55 +00:00
Mat Bevilacqua
3bf7191228 Log energy consumer result attribution data
Bug: 175723658
Test: atest FrameworksServicesTests:PowerStatsServiceTest
Change-Id: I4d0dccd440b02a35e086b08e31b1bf1f087f61e3
2021-02-03 19:48:58 -08:00
Kevin Han
dba83c49dd Add persistence for app hibernation states
Persist hibernation states to disk. This CL persists the user-level
and global hibernation states to disk.

Bug: 175829330
Test: atest AppHibernationServiceTest
Test: atest HibernationStateDiskStoreTest
Change-Id: If58d648d720bed1693b9346c4d0e85074daec931
2021-02-03 18:17:25 -08:00
TreeHugger Robot
b87b87cf75 Merge "Add subsystem name field to Channel" into sc-dev 2021-01-28 21:36:10 +00:00
Mat Bevilacqua
1e271f59e0 Add subsystem name field to Channel
Bug: 178115561
Test: atest FrameworksServicesTests:PowerStatsServiceTest
Change-Id: I864d9ff729534d81a1f7a89c860a78d659ccc1b2
2021-01-27 18:08:58 -08:00
Louis Chang
5dc6029d31 Merge "Prevent set intent on non-leaf tasks" into sc-dev 2021-01-28 01:16:08 +00:00
Alan Stokes
dfebe6bd9b Clean up BLOCK_ACTIVITY_STARTS_AFTER_HOME_FLAG.
This flag was only introduced to allow teamfood testing of the change
to use background activity launch blocking instead of delaying app
launches after app switching protection is engaged. The flag has been
on everywhere for 2 weeks (ag/176961146) without problems and is no
longer needed.

This CL went in three stages:

- Change getBalAppSwitchesProtectionEnabled() in
  ActivityTaskManagerService to always return true.

- Inline the function (and selected others) into call sites and then
  eliminate the resulting dead code - done as a serious of automatic
  refactorings to minimise the risk of human error.

- Delete unit tests for code that no longer exists.

Apart from deleting the use of the flag I believe this CL is a pure
refactoring with no new behavior changes.

The end result is we eliminate quite a lot of code - especially
PendingActivityLaunch and all uses of it.

Test: atest BackgroundActivityLauncherTest
Test: atest ActivityStarterTests (both of them)
Test: manual
Bug: 176961146
Bug: 159433730
Change-Id: I01625843f67b00e5901833cff99aec16c1287a0c
Merged-In: I01625843f67b00e5901833cff99aec16c1287a0c
Exempt-From-Owner-Approval: proto change approved on main branch
(cherry picked from commit 5897ecc699)
2021-01-27 11:29:32 +00:00
Louis Chang
f666e494af Prevent set intent on non-leaf tasks
The root task was created with null intent, but the intent,
resize mode and other information were updated from child tasks,
which sets the split-screen-secondary root task to unresizeable.

Bug: 170801863
Test: presubmit
Change-Id: I57458c05c4c579d78894869c0590788d17912bc3
2021-01-27 08:26:07 +00:00
Benjamin Schwartz
3bf626d1cb Merge changes from topic "energyconsumer"
* changes:
  Update BatteryExternalStatsWorker to use the new EnergyConsumerType
  Update to new version of PowerStats HAL 2.0
2021-01-26 04:35:19 +00:00
Mat Bevilacqua
6058dc2190 Update to new version of PowerStats HAL 2.0
Bug: 178048034
Test: atest FrameworksServicesTests:PowerStatsServiceTest
Change-Id: I714d2037a3576a3f6f89211d64ccf88cefa51abf
2021-01-25 17:09:05 -08:00
Hai Zhang
0b4f1718f8 Move role into module.
These changes have to be in this CL together because:

- Code in service-permission depends on IRoleManager in
framework-permission, so the APIs in framework-permission and the code
in service-permission need to be moved together.

- The changes to service-permission build rules doesn't make sense
without the code moved in, so they have to be together as well.

Other details:

- framework-annotations: Several annotations are added into
framework-annoatations. Since the discussion with API council seems to
allow user IDs in system server in-process APIs, @UserIdInt and
@AppIdInt is added. @MainThread and @AnyThread is added since
@WorkerThread is already added. @CallSuper is added since @CheckResult
is also already added and they are similar in terms of category of
functionality.

- framework-permission-s-shared-srcs: 3 classes (and 2 AIDL files)
from framework is copied as shared source files and jarjared for
framework-permission, and an additional 3 is added for
service-permission as service-permission-shared-srcs. Similar to
framework-wifi and service-wifi, the 3 classes in framework-permission
is also available to service-permission by the stub library
framework-permission-pre-jarjar, and the other 3 classes used only for
service-permission is included separately to minimize our impact on
classes loaded into boot classpath. framework-permission and
service-permission shares the same jarjar rules to make sure the
classes remain available, and for the same reason framework-permission
cannot be shrank during any optimization.

- framework-permission-s-shared: A java_library target for
framework-permission-shared-srcs is created to make sure that the
public classes won't be counted as APIs, as it would be if directly
included as srcs for framework-permission
java_sdk_library. service-permission-shared is the same thing for
service-permission.

- framework-permission-s: A new java_sdk_library target created to be
loaded into bootclasspath by Android S+.

- Dumpsys Protobuf: The dumpsys protobuf
file (rolemanagerservice.proto) is moved into the module, and both the
platform (incident.proto) and the module uses protoc-gen-javastream to
generate the Java classes from it. This should be fine since it's a
"source level inclusion", and we jarjar the generated classes in our
module to avoid conflict with platform copies.

Bug: 158736025
Test: manual
Test: device boots, default apps can be changed successfully.
Change-Id: I1914774f631e51d0c587a7e527a1c9bc05ee1595
2021-01-24 12:55:16 -08:00
Kevin Chyn
7a707810e7 9/n: Add BiometricScheduler proto dump
1) Adds biometrics.proto definition for BaseClientMonitor subtypes
2) Adds BiometricScheduler proto dump

When dumping the scheduler, the caller may request for the recent
operation queue to be cleared after dumping or not.

Note that we don't need BiometricScheduler.Operation#STATE_*
in the dump, since (for now) we just want to know what operations
have been run.

We can always add additional state, success/failure, etc in the
future if needed.

Bug: 159667191
Test: atest com.android.server.biometrics
Test: atest CtsBiometricsTestCases
Change-Id: I7d2350f00aaeef03ab7d74013b476af053240320
2021-01-21 16:59:59 -08:00
Hui Yu
19b558678d DeviceIdleController updates AMS with temp allowlist type.
1. add a "type" parameter to AMS.updateDeviceIdleTempWhitelist() which is
called by DeviceIdleController.
2. The default temp allowlist type is TEMPORARY_WHITELIST_TYPE_FOREGROUND_SERVICE_ALLOWED
which allows BG-FGS launch.
3. AMS.tempWhitelistUidLocked() already has a type parameter. Other API
to add temp allowlist can also add type parameter other than the
default.

Bug: 175244558.
Test: atest cts/tests/app/src/android/app/cts/ActivityManagerFgsBgStartTest.java

Change-Id: Ib42c445c15966bd260964782a7254ed2a7ffa405
2021-01-19 10:01:12 -08:00
Kevin Chyn
83010aa483 Merge "Add biometric modality to dumpsys" 2021-01-13 01:49:43 +00:00
Kevin Chyn
08dbb4b9c4 Add biometric modality to dumpsys
Bug: 177343709
Test: atest CtsBiometricsTestCases
Change-Id: Ic69f9ddb5dc145d1e83fe7488ac9b0e43ab5f45a
2021-01-12 12:40:57 -08:00
Mat Bevilacqua
723784a055 Add state residency logging to power stats
Test: atest FrameworksServicesTests:PowerStatsServiceTest
Bug: 175724197

Change-Id: I4ba7af3b9a895ecdc9f8c16cd371e5582458d212
2021-01-08 18:06:02 -08:00
Tiger Huang
ec1a69e87c Send display cutout to client via insetsChanged
Since the display cutout is a type of insets and the display cutout can
be obtained from WindowInsets, it makes sense that InsetsState has the
display cutout instance. In this way, we can send the display cutout to
client via W#insetsChanged instead of W#resized.

This can be a step to remove the class of ClientWindowFrames, and can
also be a step to make client compute its window frame locally.

Fix: 175858810
Bug: 161810301
Test: atest WindowAddRemovePerfTest ImeInsetsSourceConsumerTest
            InsetsControllerTest InsetsStateTest ViewRootImplTest
            WindowInsetsControllerTests ActivityRecordTests
            DisplayPolicyLayoutTests LaunchParamsControllerTests
            TaskSnapshotSurfaceTest WindowMetricsActivityTests
            WindowMetricsWindowContextTests WindowMetricsTest
            WindowFrameTests WindowStateTests WmDisplayCutoutTest
Change-Id: I9a930b1d2f7df3cea2b29629b767a4a5f31bca17
2021-01-05 22:22:38 +08:00
Kweku Adams
df2632f469 Rename "Foreground Job" & "HPJ" to "Expedited job".
Bug: 171305774
Test: atest CtsJobSchedulerTestCases
Test: atest FrameworksMockingServicesTests:JobSchedulerServiceTest
Test: atest FrameworksMockingServicesTests:QuotaControllerTest
Change-Id: I8721a66aa7de61474c23a7cc6ab8698864ddb44b
2020-12-15 11:54:31 -08:00
Kweku Adams
64345146b9 First version of HPJs.
This is the base implementation for HPJs. It allows scheduling and
running of HPJs with their own quota. Quota is regained when previous
sessions expire and when certain events take place.

A few things still aren't implemented yet. They'll be done in a separate
CL:
1. Free temp-allowlist jobs
2. Dedicated JobServiceContexts for HPJs
3. Additional quota for system-critical roles

Bug: 171305774
Test: atest --rerun-until-failure 5 com.android.server.job.controllers.QuotaControllerTest
Test: atest CtsJobSchedulerTestCases
Change-Id: I4b704cb0b406769f6de8b60bf762dd1f4eb10c68
2020-11-30 11:30:40 -08:00
Sean Stout
9b53f76524 Merge "Change shouldShowIme -> displayImePolicy" 2020-11-26 03:40:49 +00:00
Jeffrey Huang
17df403e9e Move enums file to new directory
Bug: 167962588
Test: m -j
Change-Id: I29b21fdc98c6c795902d23f21ef3dfd11d3f3216
Merged-In: I29b21fdc98c6c795902d23f21ef3dfd11d3f3216
2020-11-25 16:14:08 -08:00
Jeffrey Huang
677a0df03c Move enums file to new directory
Bug: 167962588
Test: m -j
Change-Id: I29b21fdc98c6c795902d23f21ef3dfd11d3f3216
2020-11-25 10:46:51 -08:00
Sean Stout
acd7a80462 Change shouldShowIme -> displayImePolicy
This CL allows for a Trusted Display to specify not only whether the IME
should show on itself or the fallback Display, but also whether the IME
should not show at all.

This behavior is useful if interacting with a display that has a built
in IME; it will prevent an IME from also showing on the default Display.

Bug: 170233231
Test: atest MultiDisplaySystemDecorationTests#testDisplayPolicyImeHideImeOperation
Change-Id: Id86db922e8f2c3ca065f830ee371cccaa7c36101
2020-11-25 15:22:51 +00:00
Hongming Jin
0dbf1bbd38 Merge "Initial version of accessibility trace protos." 2020-11-23 19:40:07 +00:00
Hongming Jin
34643692c3 Initial version of accessibility trace protos.
Bug: 157601519
Test: N/A
Change-Id: Ic63ed4e3d0227fcd9854f19ba6f068ae02b6e77b
2020-11-20 18:19:39 -08:00
Tiger Huang
44a8e4daf0 Don't handle the system UI visibility at server side
The system UI visibility has been deprecated. Except disable flags, it
should be converted to the new APIs before being sent to WMS. This CL
renames mSystemUiVisibilitiy to mDisableFLags in WindowState.

Bug: 149813814
Test: atest TaskSnapshotControllerTest TaskSnapshotPersisterLoaderTest
Change-Id: I6730ba664359656ee814c7bc959844d6ed4aaeb9
2020-11-18 15:54:09 +08:00
Tiger Huang
b73471b4ec Remove legacy frames from WindowFrames and DisplayFrames
These frames are used for computing the legacy insets which won't be
used anymore. We should only maintain the new insets system now.

This CL also unhides Rect#inset APIs.

Bug: 149813814
Test: atest WindowFrameTests DisplayPolicyLayoutTests InsetsPolicyTest
            SplashscreenTests ManifestLayoutTests WindowMetricsTests
            WindowInsetsAnimationImeTests WindowInsetsControllerTests
            WindowUntrustedTouchTest DisplayContentTests
Change-Id: I06e40be6342b2ae35f7cc3e6f4ebdbe68edf0499
2020-11-18 10:59:15 +08:00
Kevin Chyn
3eb5c9c2d7 Initial implementation of BiometricManager TestApis
1) Finishes Face10 test implementation

2) Adds createTestSession and getSensorProperties to
   IBiometricAuthenticator. This way, BiometricService, which
   is the source of truth for all sensors is able to implement or
   forward TestApi requests as appropriate.

3) Removes a few unused parameters (callingUid, callingPid,
   callingUserId)

4) Moves proto def to a biometric proto. This is basically the
   common TestApi equivalent for getting states of _any_ sensor
   service (FingerprintService, FaceService, etc)

5) Moves AuthSession states to biometric.proto

6) Updates SysUI components to use separate positive buttons
   for better readability and testing

Bug: 171357779
Test: atest CtsBiometricsTestCases on fingerprint/face devices
Test: atest com.android.server.biometrics

Change-Id: I5d884d4a9f4afa3f947eb4587e869bacd6b2f805
2020-11-13 20:05:16 -08:00
Kurt Dresner
3d21c80934 Add projection state APIs to UiModeManager and UiModeManagerService.
Bug: 134997071
Bug: 169702986
Test: Code builds, runs, unit tests added for new functionality.
Change-Id: I29cfb198101cdc5d1f4de84f8701928643b756c3
2020-11-06 14:12:39 -08:00
Suprabh Shukla
5c46b18ddb Introducing a lazy alarm store
Lazily batching alarms should perform better. A flag has been
added to switch the implementation at runtime to be able to experiment
and measure the differences.

Test: atest CtsAppTestCases:android.app.cts.AlarmManagerTest
atest CtsAlarmManagerTestCases
atest FrameworksMockingServicesTests:com.android.server.alarm

Bug: 161497385
Change-Id: I240f4f3c5439d39b3a000ab47c512d2b0bd14f6f
2020-11-03 21:54:24 +00:00