Commit Graph

8803 Commits

Author SHA1 Message Date
Adam Bookatz
52534776ec Merge "Measured screen energy into BatteryStatsHelper" into sc-dev 2021-02-04 00:33:10 +00:00
Steven Moreland
1cf1bbe0e6 Merge "binder: race condition by parcel finalize" am: 52f933552a am: 5cb323c59e am: 2795e91f14
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1553275

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Iaac87c24d1acd513b9743e2630168c6e28ca7ebc
2021-02-03 21:56:04 +00:00
Steven Moreland
2795e91f14 Merge "binder: race condition by parcel finalize" am: 52f933552a am: 5cb323c59e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1553275

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic3edc89022f831d7d0301bdd4734e45b62c49649
2021-02-03 21:43:03 +00:00
Dmitri Plotnikov
df5ebd7eab Merge "Calculate total power for a BatteryConsumer by adding up PowerComponents" into sc-dev 2021-02-03 19:06:15 +00:00
Steven Moreland
52f933552a Merge "binder: race condition by parcel finalize" 2021-02-03 18:46:50 +00:00
Adam Bookatz
c7f41b68a5 Measured screen energy into BatteryStatsHelper
Use measured screen energy usage (where available)
in battery reporting in BatteryStatsHelper, including
total and per-app screen energy usage.

Regardless of the data source (measured screen power usage vs.
estimating from screen time), the blame on apps is 'smeared',
meaning that it is apportioned (after-the-fact) based on each
app's foreground usage. That does not change here.

Also fixes a mistake in Uid.getScreenOnEnergy().

Future followups to do
1. Make getMeasuredOrEstimatedPower more universal (as more
   PowerCalculators follow suit)
2. Support for BatteryUsageStats
3. Deal with voltage properly
4. Toggle whether to report the measured energy on/off.

Test: atest BatteryStatsHelperTest
Bug: 174818228
Change-Id: I0eaa4bc594cb31b4a26b5488b08114cbf80e3884
Merged-In: I0eaa4bc594cb31b4a26b5488b08114cbf80e3884
(cherry picked from commit 30594e82d5)
2021-02-03 18:46:49 +00:00
Lais Andrade
27225f685c Merge "Implement dump and vibrate cmds for Vibrator Manager" into sc-dev 2021-02-02 22:58:54 +00:00
Lais Andrade
14edd62216 Merge "Implement vibrate and cancelVibrate on VibratorManagerService" into sc-dev 2021-02-02 17:15:44 +00:00
Charles Chen
8e9c693813 Merge "Unhide IncorrectContextUseViolation" into sc-dev 2021-02-02 16:04:13 +00:00
Lais Andrade
5985ce1b13 Implement dump and vibrate cmds for Vibrator Manager
Keep previous vibrations to be reported in the dump method, similar to
VibratorService.

Implement some vibrate commands to test VibratorManager in the adb
shell.

Bug: 167946816
Test: VibratorManagerTest
Change-Id: Ie7dd89b0e3b2747454b32fe3cc2d8751daae9e19
2021-02-02 16:00:12 +00:00
Lais Andrade
502e1ae7b7 Implement vibrate and cancelVibrate on VibratorManagerService
Use the same VibrationThread to control combined vibrations on all
vibrators.

Bug: 167946816
Test: VibratorManagerTest
Change-Id: I40c9f235f05baf85e5ed15bf3bce41451283c7f2
2021-02-02 14:14:13 +00:00
Charles Chen
bc42978259 Unhide IncorrectContextUseViolation
As a feedback from API review, we should unhide the violation so that
the developers can perform instanceof check when writing their own
logging stacks.

fixes: 177707145
Test: atest StrictModeTest
Change-Id: I6fbf10c915b5b6a7c72aacc5882ef5e33551c6e8
2021-02-02 09:59:33 +08:00
Dmitri Plotnikov
afe6fe643d Calculate total power for a BatteryConsumer by adding up PowerComponents
Bug: 158137862
Test: atest BatteryUsageStatsTest
Change-Id: I785799efcc895494be6e338475c6b4f276bdf9d5
2021-02-01 17:44:36 -08:00
Sean Stout
d43e5018a0 Update docs for PowerManager
Additionally, new "go to sleep" and "wake up" reasons have been added.

Bug: 138328918
Test: make
Change-Id: If3e8488264d461a7b1635bd80afac6bfd45ec778
2021-02-01 08:19:34 +00:00
Steven Moreland
435a2ef906 Merge "WatchDog: support dumping AIDL HALs" am: 4c0600b406 am: ac37ade768 am: 40b8fc37d4
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1564415

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I0ce40879a3dd677cd2a873d1b8bdf0c9392cd610
2021-01-30 00:52:26 +00:00
Steven Moreland
40b8fc37d4 Merge "WatchDog: support dumping AIDL HALs" am: 4c0600b406 am: ac37ade768
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1564415

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Icf6029ca6457bd3531b66dd816346ec69a533c5f
2021-01-29 23:53:23 +00:00
Alex Buynytskyy
07694ed49b Inherited installation support for Incremental.
Bug: 162345970
Test: atest PackageManagerShellCommandTest PackageManagerShellCommandIncrementalTest IncrementalServiceTest PackageManagerServiceTest ChecksumsTest
Change-Id: I360f44bc52e05553eacc448faa26f603d9eaae59
Merged-In: I360f44bc52e05553eacc448faa26f603d9eaae59
2021-01-29 11:16:02 -08:00
Songchun Fan
5f47bc6ba1 Revert "[pm/incremental] start monitoring progress on storage creation"
This reverts commit 31fa0fc9c1.

Reason for revert: Play data loader doesn't write data to incfs during "Downloading...", so we shouldn't use incfs progress to replace install progress. Reverting this, so that Launcher will display the install progress ring during "Downloading..." using the progress reported from Phonesky.

Change-Id: I124033d725fe488fd337b6ded0bdf319a764b6ca
Merged-In: I124033d725fe488fd337b6ded0bdf319a764b6ca

BUG: 178528778
(cherry picked from commit d0cec52acb)
Change-Id: Ib6637be489e36c78e5074c161d01ac510da5d045
2021-01-29 00:12:48 +00:00
Steven Moreland
f6fee67b6e WatchDog: support dumping AIDL HALs
Similar to how HIDL HALs are here, we don't know the commandline of the
service, so we can dump them based on service name prefixes.

Power stats and lights are added here, for parity w/ HIDL since these
hvae been converted to AIDL.

Fixes: 175322136
Test: after `adb shell am hang`, we can verify the light service is
  dumped, when it wasn't before:

  vsoc_x86_64:/data/anr # cat anr_2021-01-28-22-42-44-969  | grep light
  Cmd line: /vendor/bin/hw/android.hardware.lights-service.example

Change-Id: I8c8b0cff0c102221875114015a5524c03cfb5b5c
2021-01-28 22:53:23 +00:00
TreeHugger Robot
f47f057530 Merge "Provide API to access Intent that triggered StrictMode violation" into sc-dev 2021-01-28 15:34:14 +00:00
TreeHugger Robot
e1127fccde Merge "Add javadoc for (Persistable)Bundle.EMPTY" into sc-dev 2021-01-28 15:12:17 +00:00
Jintao Zhu
15b49e10ae binder: race condition by parcel finalize
Root cause:
1) a client thread calls "transact", and then, reads a java binder object from the java parcel object
2) the java binder object sends BC_ACQUIRE/BC_INCREFS, but still in the queue, not yet flushed to driver
3) the java parcel object is garbage-collect-ed, and, its finalize method may possibly sends BC_FREE_BUFFER

  Because "BC_FREE_BUFFER" is from the java finalize thread, which is different from the "client thread", so, it is possible that "BC_FREE_BUFFER" will be flushed to driver before "BC_ACQUIRE/BC_INCREFS", which makes driver destroy the related "binder_ref" object prematurely.

Consequences of the issue:
  The user space process might always hold the above java binder object, whose "handle value" is indeed invalid because the related "binder_ref" in driver is destroyed. This causes a lot of chaos inside the process:
<a> any binder call on the java binder object will be a failure, with kernel log complain: ...got transaction to invalid handle...
<b> afterward, any new bind object passed to this process will NOT create a brand new one for it, instead, it will be simply and incorrectly mapped to the above old biner object, because the new incoming one will use the same "handle value" as the old one. This will make a mess and many weird bugs.
 First, it may break "binder object identity" compare based functionality. For example, after registering a listener to a service, all following registering may fail because the latter new listener object is mapped to the old one incorrectly. The service will reject them as "already registered".
 Second, binder call on the old binder object is actually dispatched to the new remote binder object, it might even be a success if they are of the same class/interface, which is actually not we expected; and on the other hand, the new binder object may even be of different class/interface, and of course, the binder call may be a failure due to "interface descriptor check".
<c> the user space process cannot recover from the bug automatically unless restart.

Solution:
  Hold a temporary reference to the parcel object until "BC_ACQUIRE/BC_INCREFS" flushed to driver.

Bug: 139327211
Test: monkey test for one day and one night

Co-authored-by: Steven Moreland <smoreland@google.com>

Signed-off-by: Jintao Zhu <zhujtcsieee@gmail.com>
Change-Id: I9345f443996b0bdef9d57ddaad119b86205e817f
2021-01-28 19:38:18 +08:00
Adrian Roos
3dba833558 Add javadoc for (Persistable)Bundle.EMPTY
Bug: 152525509
Test: n/a
Change-Id: I5518433816f11a7c719531c60ffbcf4f4857aa87
2021-01-28 11:20:04 +00:00
Oliver Woodman
d58d038b1d Merge "API to get SOC manufacturer and model" am: a6b77e3294 am: 5fe83ca052 am: b5d864ee38
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1518117

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I2877e0aa0be6621b17932056f7d2f686b7964676
2021-01-28 10:54:23 +00:00
Oliver Woodman
b5d864ee38 Merge "API to get SOC manufacturer and model" am: a6b77e3294 am: 5fe83ca052
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1518117

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I740131a0a906356582e6ab1264ec135bba2a788e
2021-01-28 10:27:01 +00:00
Oliver Woodman
a6b77e3294 Merge "API to get SOC manufacturer and model" 2021-01-28 09:07:56 +00:00
Michael Groover
a7d65cc983 Provide API to access Intent that triggered StrictMode violation
Android 12 introduces a StrictMode check to warn developers if they
are launching an unsafe Intent (one that has been unparceled from the
delivered Intent). This commit provides an API to allow a developer
to access the Intent that triggered the StrictMode violation.

Bug: 178029824
Test: atest StrictModeTest
Test: Manually verified serialized violation does not result in
      an Exception
Change-Id: I392df3f80487503bc8235700ecb17c51d930830c
2021-01-27 16:59:22 -08:00
Treehugger Robot
88b454286d Merge "Change order of owners." am: 0d72e983ce am: 81ff12d6c1 am: e364dc06c4
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1556131

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If1f16db7fea5e1ac83482da6c3212e03ee4b3923
2021-01-27 07:55:01 +00:00
Treehugger Robot
e364dc06c4 Merge "Change order of owners." am: 0d72e983ce am: 81ff12d6c1
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1556131

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ibae68c02d08e220852526e2ad5f89b84c9e85f78
2021-01-26 23:09:17 +00:00
Dmitri Plotnikov
3274f73e97 Merge "Remove redundant method Binder.getNativeTid()" 2021-01-26 19:16:33 +00:00
Dmitri Plotnikov
bf06ab10de Remove redundant method Binder.getNativeTid()
Bug: 177257934
Test: atest BinderCallsStatsTest
Change-Id: I797a580e7bf6bc3c7174d061c1cf86bccc5b1f3a
2021-01-26 19:08:36 +00:00
Oliver Woodman
be2de18471 API to get SOC manufacturer and model
BUG: 158284209
Test: atest android.os.cts.BuildTest
Change-Id: I9a2e1a4f667e7751252ac0f404d0d56c452718a5
2021-01-26 15:34:18 +00:00
Corina
911c2e8bed Change order of owners.
Some tools use the first owner as default assignee for automatically
file bugs.

Bug: no
Test: no
Change-Id: Iad216857e9b8de705a4a0c4f09389a0efe7aca18
2021-01-26 13:31:56 +00:00
Nicholas Ambur
4838c0051c add full battery saver runtime modification API
New system API added for privledged clients to modify the full battery
saver mode policy. This API is used to override static settings at
runtime, and any overridden settings are cleared when exiting full
battery saver mode.

Bug: 172294448
Test: atest PowerManagerTest
Test: atest PowerManagerServiceTest
Test: atest BatterySaverPolicyTest
Test: build and boot ensuring SoundTrigger service behavior is not
changed

Change-Id: I41f968799b184a5dac702553379294795614be0a
2021-01-25 09:43:51 -08:00
Narayan Kamath
d9c361bebd Merge "StorageManager: Properly convert FAT volume identifiers." 2021-01-25 16:47:38 +00:00
Yurii Zubrytskyi
a2a7ffcfeb Merge "Incfs: Add the new .blocks_written control file" 2021-01-25 16:47:22 +00:00
Narayan Kamath
a1dba65675 StorageManager: Properly convert FAT volume identifiers.
FAT volume identifiers are randomly generated 32-bit identifiers
that are not UUIDs as per the spec. However, we need to coerce
them into UUIDs because several storage APIs are defined in terms
of UUIDs.

We need a follow up change to properly return UUIDs for public
volumes in order to complete developer support.

Test: atest StorageManagerTest
Bug: 166129035

Change-Id: Icaa4f3485af698ab7163031c540aa2b27d1e1f16
2021-01-25 16:45:35 +00:00
Nicholas Ambur
c0a3c8c5f8 add SoundTrigger service modes in battery saver
Control over the SoundTrigger service behavior in battery saver mode is
expanded to from a boolean to multiple modes. Modes include enabled,
disabled, and privileged. Adding the privedged mode allows for the
SoundTrigger service to selectively control clients which are deemed
esential to the Android system.

Bug: 172294448
Test: atest BatterySaverPolicyTest
Test: atest CtsBatterySavingTestCases
Test: atest PowerManagerTest
Test: build and verify backward compatibility with SoundTrigger system
service behavior

Change-Id: Ib701963b07b205e5902ef265198b390a9850cb88
2021-01-22 18:24:39 -08:00
Kelvin Zhang
b074f7a0a3 Merge "Revert "PM#goToSleep and PM#wakeUp only affects default display group"" 2021-01-22 23:20:53 +00:00
Kelvin Zhang
1431b8c32e Revert "PM#goToSleep and PM#wakeUp only affects default display group"
This reverts commit e2f209d260.

Reason for revert: b/178215050

Change-Id: Ie2de678eda2cc633a5f18cc14b155c56b8c633ca
2021-01-22 20:05:01 +00:00
Dmitri Plotnikov
d23c73f017 Merge "Convert SensorPowerCalculator to work with BatteryUsageStats" 2021-01-22 19:10:33 +00:00
Corina Grigoras
1744f3021f Merge "Add all storage team to owners." am: d17c69bccb am: 552bdafa3a am: 2baff21819
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1558549

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I5f2185e68fde92fa65708765faa1e5be4be9b73f
2021-01-22 17:53:46 +00:00
Corina Grigoras
2baff21819 Merge "Add all storage team to owners." am: d17c69bccb am: 552bdafa3a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1558549

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I7f9bdaf72fc875a0949d897558f0e1dd07a853d0
2021-01-22 17:39:39 +00:00
Corina Grigoras
d17c69bccb Merge "Add all storage team to owners." 2021-01-22 16:57:22 +00:00
Felipe Leme
7dc7910d9a Merge "Added evenWhenDisallowed param to removeUserOrSetEphemeral()." 2021-01-22 16:31:03 +00:00
Corina
6915543849 Add all storage team to owners.
Bug: no
Test: no
Change-Id: Ib4fba7af30cec8efd5fb9115fec9bd354e07a2fc
2021-01-22 14:10:07 +00:00
Paul Hu
6d5681b753 Merge "Expose Build.VERSION.FIRST_SDK_INT as module-lib API" am: 64625e9706 am: 7126f9404b am: f369634aae
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1540865

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ie9adc3def53e7708c715af665718669ff8e4c954
2021-01-22 13:10:21 +00:00
Paul Hu
f369634aae Merge "Expose Build.VERSION.FIRST_SDK_INT as module-lib API" am: 64625e9706 am: 7126f9404b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1540865

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ia8cb0ca497e0cbaea24d9e7c376f8f3f0ded69a2
2021-01-22 12:39:19 +00:00
paulhu
69f79b0aca Expose Build.VERSION.FIRST_SDK_INT as module-lib API
Connectivity service is going to become a mainline module which
will not be able to access hidden APIs. But PermissionMonitor
needs know Build.VERSION.FIRST_SDK_INT for granting network
restricted permission to system packages. Thus, expose the value
as module-lib API to support the usage.

Bug: 170598012
Test: make update-api
Change-Id: Id0ae42120f69faee43eeb7ebd35cae9e26cb7561
2021-01-22 15:30:07 +08:00
Felipe Leme
6ad393d896 Added evenWhenDisallowed param to removeUserOrSetEphemeral().
UserManager.removeUserOrSetEphemeral() was added primarily to
be used by CarDevicePolicyManager, in which case it should ignore
the no_remove_user restriction. But as it's also used in other
places, it needs a new parameter to define this behavior.

Test: atest FrameworksServicesTests:com.android.server.pm.UserManagerTest#testRemoveUserOrSetEphemeral_evenWhenRestricted
Test: atest FrameworksServicesTests:com.android.server.pm.UserManagerTest # to make sure it didn't break anything
Test: atest android.car.apitest.CarDevicePolicyManagerTest#testRemoveUser_whenDisallowed # on automotive

Bug: 170887769

Change-Id: If797ace64c0fa0262116f649212bbcb1d61e2046
2021-01-22 04:43:22 +00:00