Commit Graph

9337 Commits

Author SHA1 Message Date
Evgenii Stepanov
980f233d2d Pass MTE RuntimeFlags to AppZygote.
Fix AppZygote process and its children (the actual service processes)
ignoring android:memtagMode attribute in the app manifest.

When starting a new AppZygote process, apply memtag-related flags as
determined by the app manifest (and modified by compat features and
actual h/w capabilities). If this is not done, MTE is always disabled in
an AppZygote process, which makes it impossible to enable it in the
AppZygote's children.

This change has no effect unless MTE is supported in the hardware
(ARMv9) and enabled in the system.

Bug: 207557677
Test: CtsTaggingHostTestCases
Merged-In: Ibf64db8882a1fbffe6c0cc3cd3bc2299b088876a
Change-Id: Ibf64db8882a1fbffe6c0cc3cd3bc2299b088876a
(cherry picked from commit 2e50afbd53)
2021-12-10 19:02:55 +00:00
John Reck
ea9f91778e Revert "Revert "Revert "Revert "SharedMemory: break Cleaner reference cycle.""""
This reverts commit d27119ce0a.

Reason for revert: This is still an extremely necessary FD leak fix

Test: android.os.cts.SharedMemoryTest passes
Fixes: 206767336

Change-Id: I33cdbde0554b9e1cb7e9f8ea3ee8dfbd30fe8a89
(cherry picked from commit 6d4a948b3d)
2021-11-30 16:18:58 +00:00
Michael Wright
dec589fbce Add constant for SC V2.
Bug: 204295952
Test: N/A
Merged-In: Ieecebfccf9366815c93d620b70aeabc1abcd3ebd
Change-Id: Ieecebfccf9366815c93d620b70aeabc1abcd3ebd
2021-10-27 17:51:58 +01:00
Michael Wachenschwanz
e031d50952 Update BatteryStatsImpl to handle multidisplay
Add screen on and doze timers for multiple displays.

For Battery history, charge/discharge logs and UnsupportedAppUsage, the
legacy screen state timers remain, as well. The legacy timers and
screen state tracking will now track overall screen state of the device.
The current overall screen state is the most "important" state currently
active.
Order of screen state importance is: on, doze, doze suspend, off.

Note: Utilizing per display measured energy will be handled in a follow
up CL.

Bug: 194107383
Test: atest FrameworksCoreTests:BatteryStatsTests
Change-Id: I4ad4f54b6897f406e4ec0f59834dd4762083e0d8
Merged-In: I4ad4f54b6897f406e4ec0f59834dd4762083e0d8
2021-10-14 17:15:57 -07:00
Martijn Coenen
499aac6d5e Merge "Fix race condition around CE storage becoming available." into sc-qpr1-dev am: d172b787d3
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15879518

Change-Id: I42a90611da276bf40face7645afcfeac5a3a9be6
2021-09-27 16:00:36 +00:00
Martijn Coenen
439e654fa1 Merge "Run a GC after killing a UID due to binder proxy limit." into sc-qpr1-dev am: 745bc36216
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15889363

Change-Id: Ic202efe6cf40dda3a0bd25c68e133f1d9405aa6b
2021-09-27 15:59:47 +00:00
TreeHugger Robot
d92c7d85d7 Merge "Wake foldable device when device unfolds." into sc-v2-dev 2021-09-27 13:16:54 +00:00
TreeHugger Robot
a401999f85 Merge "Check custom component names before aggregating BatteryUsageStats snapshots" into sc-qpr1-dev am: 0ef5152b17
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15872124

Change-Id: I453c8cda7d7d6ab29facc35acd1d6ab84f6ee5fa
2021-09-25 02:17:20 +00:00
Santos Cordon
812542c736 Wake foldable device when device unfolds.
Trigger a wake from within the display-layout transition
for the device-state specified in the config.xml file.

Bug: 190593710
Test: Manually verify that the device wakes when opening
Change-Id: I28419ce93a5df6caa7a116860d891814118c7bc2
2021-09-24 15:53:11 +01:00
Martijn Coenen
d172b787d3 Merge "Fix race condition around CE storage becoming available." into sc-qpr1-dev 2021-09-24 07:32:13 +00:00
Martijn Coenen
7d2da2c2d2 Run a GC after killing a UID due to binder proxy limit.
After we hit the per-UID proxy limit and kill the originating process,
there's actually no guarantee that the proxies to the (now dead)
processes are cleaned up immediately; if the processes get restarted and
start accumulating proxies again, we may go over the global proxy limit
(25k with this CL). Do a GC to make sure we clean them up.

Note that the GC here might not actually clean up all the proxies,
because the binder reference decrements will come in asynchronously; but
if new processes belonging to the UID keep adding proxies, we will get
another callback here, and run the GC again - this time cleaning up the
old proxies. Because of this potential delay, an app may temporarily
have many more outstanding proxies than the high watermark, so also
increase the global proxy limit to 25k proxies.

Bug: 198340142
Test: Manual
Change-Id: I75c7ea4f7aa4a5d448f610014770f1b9788cfb5b
Merged-In: I75c7ea4f7aa4a5d448f610014770f1b9788cfb5b
2021-09-23 14:48:52 +00:00
Martijn Coenen
6cc84a1415 Fix race condition around CE storage becoming available.
This fixes a race condition that exists around preparing CE storage, and
a package being reinstalled at the same time.

The normal CE data unlock procedure is something like this:

1. User state is RUNNING_LOCKED
2. UserController calls onBeforeUnlockUser()
3. onBeforeUnlockUser() prepares CE storage
4. onBeforeUnlockUser() calls PackageManagerService.reconcileAppsData()
5. reconcileAppsData() prepares app CE data directories, creating dirs
   when needed
6. UserController changes state to RUNNING_UNLOCKING

The race comes into the picture when an app is installed right between
step 5 and step 6; when a new app is installed, PMS does have a function
to create the CE app data directory; but that function only creates CE
data directories when the user state is RUNNING_UNLOCKING (or later); so
even though technically CE storage became available in step 3, other
parts of PMS will only use it after step 6 has completed.

To fix this, we use StorageManagerService to record the fact that CE
storage for a particular user is prepared; then, PackageManagerService
can query StorageManager to ask whether CE storage is prepared. That in
combination with the user key being unlocked is then used as a condition
for creating CE data directories from PackageManagerService.

Bug: 187103629
Test: manual
Change-Id: Ice81ae98441b9ed287e8db4196a041c3d47afce9
Merged-In: Ice81ae98441b9ed287e8db4196a041c3d47afce9
2021-09-22 16:28:19 +02:00
Dmitri Plotnikov
0c561475c3 Check custom component names before aggregating BatteryUsageStats snapshots
If the lists of custom power components do not match, a crash will occur.
Instead of causing a crash, simply skip incompatible snapshots.

Bug: 196040329
Bug: 200511361
Test: atest FrameworksCoreTests:com.android.internal.os.BatteryUsageStatsProviderTest

Change-Id: I87ba605371a5f3119dcff33f6109e94ee46ab57d
(cherry picked from commit a1ea9ecd56)
2021-09-20 18:35:09 +00:00
Tim Van Patten
f9387616af Merge "Enable ANGLE as a Game Dashboard Intervention" into sc-qpr1-dev am: 4de992c9cb
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15697303

Change-Id: I1c33f82a510da16fd4566915171ccd8ca35f31a1
2021-09-01 00:34:06 +00:00
Tim Van Patten
08c3f5b379 Enable ANGLE as a Game Dashboard Intervention
Enable ANGLE as a Game Dashboard intervention via Phenotype.

Bug: b/188475576
Test: GameManagerServiceTests
Change-Id: I91894a76b8dcf7a97244cff679a501001734f671
Merged-In: I91894a76b8dcf7a97244cff679a501001734f671
(cherry picked from commit acf3851b8f)
2021-08-31 15:08:38 -06:00
TreeHugger Robot
e162a1f9ca Merge "Remove support: libfeature_support_angle.so" into sc-qpr1-dev am: e61852b9c3
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15613738

Change-Id: I13d5e72892cb2072ec17aa23d3adda3c72eb5c2f
2021-08-27 20:21:12 +00:00
Tim Van Patten
de31075f7c Remove support: libfeature_support_angle.so
Remove support for ANGLE's libfeature_support_angle.so.

This also removes all of the logic related to checking the rules file,
since libfeature_support_angle.so is what parsed the JSON rules file.

Bug: b/187342779
Bug: b/184757175
Test: make and manual verification ANGLE is loaded
Change-Id: I02ac083fb8144465b60ac0ed2738c73b31addda1
Merged-In: I02ac083fb8144465b60ac0ed2738c73b31addda1
2021-08-24 20:41:44 +00:00
Brian Carlstrom
46a2b96892 Merge "Remove spammy convertToModernFd log" into sc-dev am: eac1d5a41c am: 86acac468f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15472605

Change-Id: I1283f7a7da3eff7631cd762506ee7553ffff2063
2021-08-08 21:10:56 +00:00
Zim
28df0ce32e Remove spammy convertToModernFd log
It is a common source of confusion that something went wrong while
triaging bugs.

Bug: 195587219
Test: m
Change-Id: Ieca96a2774f08367b05147b49fcea56dd4f2bfda
2021-08-06 23:35:32 +00:00
Nate Myren
e2942cb666 Merge "Revert sync app op chain changes" into sc-dev am: 50ff5ac8b8
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15424412

Change-Id: I63c16fa22d36295b9992740ea95ae69342f22307
2021-08-03 15:34:46 +00:00
Nate Myren
50ff5ac8b8 Merge "Revert sync app op chain changes" into sc-dev 2021-08-03 15:16:35 +00:00
Nate Myren
86c337659a Revert sync app op chain changes
These changes cause some noted app ops to be swallowed due to one-way
app ops.

Fixes: 187721493
Test: atest AppOpsLoggingTest
Change-Id: I3b761b65b2e06138fc1d130bf80587f8885bb1d5
2021-08-02 12:50:44 -07:00
Li Li
d2aeb490a8 Merge "Freezer: fix exception when parsing /proc/locks" into sc-dev am: ef12967b75
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15395534

Change-Id: I28f1b15ab636063727f02414a98896ee2679c6fc
2021-07-30 16:50:50 +00:00
Li Li
ef12967b75 Merge "Freezer: fix exception when parsing /proc/locks" into sc-dev 2021-07-30 16:35:16 +00:00
Zimuzo Ezeozue
ce692ac89c Merge "Fix fd leak while bypassing transcoding in media APIs" into sc-dev am: 3fefc5c3ed
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15423590

Change-Id: I88486c8e7278e5899405a379034a453ed95b19f9
2021-07-30 14:39:01 +00:00
Zim
366493edd2 Fix fd leak while bypassing transcoding in media APIs
To call the media service while bypassing transcoding there are 4 file
descriptors involved:

A: The original file descriptor the app owns and is responsible for
closing
B: Dupe of A, to pass into the MediaStore API as an input to receive a
non-transoding fd
C: The output from the MediaStore API
D: Final fd owned by the media service, after C gets duped over binder
as part of setDataSource

We were leaking (B) and (C). Now we close them appropriately.

See I0124ec8fbd0471237e99bab321f903544f8fe1f8 for another 2 fd leak
fix in MediaProvider

Test: atest TranscodeTest
Test: Manual with 'adb shell lsof | grep <filename>'
Bug: 194828489
Bug: 179804072
Change-Id: I978257bbc4a8f6813b6e6a5ce22124257204f432
Merged-In: I978257bbc4a8f6813b6e6a5ce22124257204f432
2021-07-29 22:05:17 +01:00
Li Li
bbe06e7b59 Freezer: fix exception when parsing /proc/locks
The original code is based on /proc/locks manpage. Unfortunately, that
manpage is never correctly updated to include the new field for blocked
locks. The new code detects the extra field. As StringTokenizer is too
heavy, ProcFileReader is used for better performance.

Bug: 194756340
Test: FrameworksUtilTests com.android.internal.util.ProcFileReaderTest
Test: FrameworksCoreTests com.android.internal.os.ProcLocksReaderTest
Test: No /proc/locks parsing exception with blocked locks
Change-Id: I4c9763f9d3091f7d84d2e4b672d7e5cb78b33f59
2021-07-29 09:18:53 -07:00
TreeHugger Robot
0bc5cce243 Merge "Revert "Add systrace tag for system property"" into sc-dev am: 95e50fed20
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15336322

Change-Id: I80ccd42ee9cea924cf038f5ae45de75cc41fd311
2021-07-28 14:53:52 +00:00
TreeHugger Robot
495abb7eab Merge changes from topic "native_hint" into sc-dev am: ea52c87596
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15326475

Change-Id: I805e930ede0c22bbcbec62d1b0738dd7c91f5dc5
2021-07-28 14:44:51 +00:00
Nandana Dutt
f89b637865 Note API alternatives in javadoc
Note alternatives for getExternalStorageDirectory() and
getExternalStoragePublicDirectory()

Change-Id: Ibb7238e0dfc780a88940507aaf1d5cf4103bbee4
BUG: 194164033
Test: treehugger build
2021-07-26 12:30:52 +00:00
TreeHugger Robot
95e50fed20 Merge "Revert "Add systrace tag for system property"" into sc-dev 2021-07-23 17:04:39 +00:00
Bo Liu
0b2ad9f70d Implement java PerformanceHintManager on top of native
Note some exceptions became silence errors in this conversion.

Test: None
Bug: 194204196
Change-Id: Ia3cc7f2396f2e307a23b40b3f104a2fa90352196
2021-07-22 11:33:13 -04:00
Bowgo Tsai
e169c22053 Revert "Add systrace tag for system property"
Revert "Add systrace tag for system property"

Revert "Adding system property tracing"

Revert submission 1403568-sysprop_trace

Reason for revert: makes property get/set non-reentrant
Reverted Changes:
I6f85f3f52:Add systrace tag for system property
Id2b93acb2:Adding system property tracing
Id78992d23:Add systrace tag for system property
I1ba9fc7bd:Add systrace tag for system property

Bug: 193050299
Change-Id: Iaf522b403e51abcf1d49804f35a184b4aa0d3209
Merged-In: Iaf522b403e51abcf1d49804f35a184b4aa0d3209
Test: build and boot a device
(cherry picked from commit 137d78bb67)
2021-07-22 04:41:03 +00:00
TreeHugger Robot
a945369393 Merge "DropBoxManager: Fix doc build error" into sc-dev am: 019189c35a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15341836

Change-Id: Iacd649005d0055d9b4b0dd087f0350b128314a9a
2021-07-21 01:40:27 +00:00
Shuzhen Wang
a00ce4e75f DropBoxManager: Fix doc build error
Test: make doc-comment-check-docs
Bug: 194230402
Change-Id: I38da2bbfbe7ed0a660274ec4d07e2b176a2a7542
2021-07-20 16:14:15 -07:00
Kalesh Singh
6ede05d88e Merge "Add API to get GPU private memory" into sc-dev am: 4b939ccd2f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15266039

Change-Id: If25bd7c69831f3c996dc0a25e200960a99d7d3ef
2021-07-16 01:54:59 +00:00
Kalesh Singh
4b939ccd2f Merge "Add API to get GPU private memory" into sc-dev 2021-07-15 17:21:49 +00:00
Kalesh Singh
c6deb0fd9d Add API to get GPU private memory
Remove getGpuDmabufUsageKb since the kernel no longer
supports the sysfs nodes that this depends on.

Add getGpuPrivateMemoryKb which uses the memtrack hal
to report the system-wide GPU private memory.

Bug: 193226716
Bug: 193465681
Bug: 192621117
Test: dumpsys meminfo
Change-Id: Ib90505ec184339d5acbcd42c67dad3ad65dbd933
2021-07-14 21:16:18 +00:00
Jeff Sharkey
f0f641d21d Merge "Consistent version documentation." into sc-dev am: af2d4c8c8f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15275398

Change-Id: Ia258cc5ac7a7bd4887422eb0a4d57f9c22fa5ae1
2021-07-14 15:33:27 +00:00
Jeff Sharkey
866af3b915 Consistent version documentation.
Aligns description of all VERSION_CODES based on details at:
https://en.wikipedia.org/wiki/Android_version_history

Bug: 193421818
Change-Id: I0ccb2480b5255b0e3a61a82d6be75f746166e536
2021-07-13 13:17:18 -06:00
Dmitri Plotnikov
f99c289be5 Merge "Address race condition in procstate time tracking" into sc-dev am: b1f548e3e4
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15177890

Change-Id: I322ee8c8ab5b64607c2815ae28122b9667fbc67c
2021-07-03 00:18:57 +00:00
Dmitri Plotnikov
dc3a78354e Address race condition in procstate time tracking
The issue occurs when the application proc state changes
rapidly, e.g. from FOREGROUND to BACKGROUND to CACHED.
The original code would sometimes attribute the time slice
to the wrong proc state.

Bug: 192550308
Test: (on cuttlefish) atest --rerun-until-failure 300 FrameworksCoreTests:com.android.internal.os.BstatsCpuTimesValidationTest -- --abi x86_64

Change-Id: Ic22bbfa3aae701014fc016ec9e2d32b1c528d462
2021-07-01 22:04:28 -07:00
TreeHugger Robot
f0dfbe020d Merge "FileBridge: use a ByteBuffer for the temp buffer" into sc-dev am: 64dcdac602
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15100555

Change-Id: If64fd555e446b76d76fb557bb34522f945ed844a
2021-06-25 21:30:43 +00:00
TreeHugger Robot
64dcdac602 Merge "FileBridge: use a ByteBuffer for the temp buffer" into sc-dev 2021-06-25 21:25:40 +00:00
Tim Murray
8c37737cbc FileBridge: use a ByteBuffer for the temp buffer
Using a direct ByteBuffer allows the buffer to be passed to/from JNI
without intermediate copies.

Test: FileBridgeTests, apps get installed without allocation churn
Bug: 192020559
Change-Id: Ic5965c94ba14de6599af67d2e3bba33cd9996046
2021-06-25 11:14:53 -07:00
Nandana Dutt
19325e4648 Merge "Undeprecate storage directory APIs" into sc-v2-dev 2021-06-25 10:50:42 +00:00
Lais Andrade
efc9cc93be Fix SystemVibrator constant support checks on device without vibrator
Fix the implementation of SystemVibrator to return always no support to
all effect and primitive constants on devices with no vibrator.

Fix: 191414125
Test: FrameworksCoreTests:VibratorTest
Change-Id: I0fd9e27d6e2890df9ee206029488ea70ff50712d
2021-06-24 12:33:40 +01:00
Nandana Dutt
9f77f7f31b Undeprecate storage directory APIs
Android 10 did not support file path operations for apps in
scoped storage. But Android 11 and above do support file path
operations for such apps.

Undeprecate getExternalStorageDirectory() and
getExternalStoragePublicDirectory() to reflect the current level of
support.

BUG: 153562415
Test: m
Change-Id: Ibd93ca07a0c08b11a82b70dca8c2cd7d49600354
(cherry picked from commit 74bf4e682d)
2021-06-23 11:40:17 +00:00
TreeHugger Robot
55a8db6450 Merge "Split long vibration composition using HAL limits" into sc-dev 2021-06-22 16:08:22 +00:00
TreeHugger Robot
8affbdac22 Merge "Create config for audio haptic channels max value" into sc-dev 2021-06-22 14:59:21 +00:00