Commit Graph

7603 Commits

Author SHA1 Message Date
Ricky Wai
486d760e6b Pass bind mount storage data decision from java to zygote
Before we used store dirty data in system property to record
if FUSE for a user is mounted, and zygote uses it to determine
if storage mount is needed. It introduces performance issues and
not reliable.

This CL does the following changes:

- System server determines if storage dirs mount are needed, and store
the record inside system server.

- It passes the verdict to zygote so zygote just need to follow the
input.

- When emulated storage is mounted / unmounted, it will record if
FUSE for that user is ready to use, and will be used for determining
if storage dirs mount are needed when a new process starts.

- After emulated storage is mounted, it will create an async thread
to remount all storage dirs for existing app processes. As we have a
record of pids that storage dirs are not mounted yet, we can use it
directly without scanning the whole /proc in vold.

Bug: 149548518
Test: After flag is enabled, AdoptableHostTest still pass.
Change-Id: Ic99d027d42b2b9a1c7fd03070b36c44882c6e7c5
2020-03-12 19:36:26 +00:00
Philip P. Moltmann
b73aa1e008 Merge "Rename AppOpsCollector -> OnOpNotedCallback" into rvc-dev 2020-03-10 21:03:21 +00:00
Philip P. Moltmann
5892a8f7b0 Rename AppOpsCollector -> OnOpNotedCallback
and annotate time values used by this area of code correctly.

Fixes: 150699068
Test: Only renames
Change-Id: Ibd5b08900d6855603e7ce59048587d391a5c5410
2020-03-10 11:50:00 -07:00
Zimuzo Ezeozue
f46b9c9656 Merge "Add API for apps to query whether they have All Files Access" into rvc-dev 2020-03-10 17:03:16 +00:00
shafik
8187065889 Add API for apps to query whether they have All Files Access
This is a fix in response to developers' feedback on DP1.
Add Environment API that enables apps to check whether they have All
Files Access special app access. The API encapsulates the actual
mechanics of the check, which are as follows:
    * First check MANAGE_EXTERNAL_STORAGE app-op,
      if it's allowed, return true. If it's denied (ignored or errored),
      return false.
    * If the mode is default, then check for MANAGE_EXTERNAL_STORAGE
      permission, if it's GRANTED (not just declared), then return true,
      else return false.

Also add test.

Test: atest EnvironmentTest # not CTS
Fix: 150115615
Merged-In: I0574827c22960bf8f074313d983f289be7142149
Change-Id: I0574827c22960bf8f074313d983f289be7142149
2020-03-10 11:47:56 +00:00
Dmitri Plotnikov
2a594c9e64 Merge "Introduce thread-local allowBlocking flag" into rvc-dev 2020-03-09 17:16:18 +00:00
Jeff Sharkey
16c9fb8c0f Merge "Updates based on API council feedback." into rvc-dev 2020-03-08 20:59:38 +00:00
Jia-yi Chen
73e2b381f0 Merge "Support PowerHAL AIDL service" into rvc-dev 2020-03-07 06:27:22 +00:00
Jeff Sharkey
f5eebf9fe6 Updates based on API council feedback.
-- Promote generally-useful PFD API to public.
-- Add @WorkerThread annotations.
-- Add docs to explain how AUTHORITY_LEGACY works, and add explicit
START/FINISH_LEGACY_MIGRATION_CALL verbs to communicate progress.
-- Expand docs for createWriteRequest() to explain broader access
that it grants.  Expand all request methods to indicate the action
is fully completed before the result is delivered.
-- Expand docs for new generation fields to explain that version
also needs to be inspected.
-- Explicitly call out why getKindSize() is deprecated, and guide
towards better alternative.

Bug: 148867182, 148403418, 148011561, 147760276
Test: none
Change-Id: I54ff072a752497b6aba153bd4013567c269e5b19
2020-03-06 14:42:00 -07:00
Dmitri Plotnikov
1258084de2 Introduce thread-local allowBlocking flag
Test: see instructions in http://ag/7911739
Fixes: 146675384

Change-Id: I478f2a8c4e4d8d563e5e78f6e103a62fe120191f
2020-03-06 10:23:02 -08:00
Jia-yi Chen
bfd8f1f74d Support PowerHAL AIDL service
Bug: 147840082
Test: Boot & check logs
Change-Id: Iccdaf84053e0974ffb43857aaa2e382d2f1b4a6b
2020-03-06 10:08:30 -08:00
Yifan Hong
47af8f93b8 Merge "UpdateEngine: fix cleanupAppliedPayload impl" into rvc-dev 2020-03-05 22:57:08 +00:00
TreeHugger Robot
03a65f1a5e Merge "BatteryStatsManager: Address API council feedback" into rvc-dev 2020-03-05 21:42:12 +00:00
Roshan Pius
cdf5744a77 BatteryStatsManager: Address API council feedback
Bug: 144925883
Test: Compiles
Change-Id: Ibdc61769965a97222fdd968084eca71b997e8feb
2020-03-05 10:34:24 -08:00
Songchun Fan
7f051b5251 remove proxy binder service IIncrementalManager
This is no longer needed because native Incremental Service directly
uses IDataLoaderManager.

BUG: 150406132
Test: atest service.incremental_test
Test: atest PackageManagerShellCommandIncrementalTest
Change-Id: Idbde2988883becbf3eb707d42c0558774a6073e8
2020-03-04 19:50:44 -08:00
Songchun Fan
ecd96c2be4 Merge "make IDataLoaderManager and IDataLoader stable interfaces" into rvc-dev 2020-03-04 22:53:12 +00:00
Yifan Hong
8b0eedf99c UpdateEngine: fix cleanupAppliedPayload impl
IUpdateEngine.cleanupSuccessfulUpdate is now asynchronous with a callback.
Update UpdateEngine.cleanupAppliedPayload accordingly to use the new impl.

Bug: 147696014
Test: apply OTA
Change-Id: I9b308316dcb8e6a507063d3060fed7693da82a19
2020-03-04 11:38:59 -08:00
Songchun Fan
6381d6193e make IDataLoaderManager and IDataLoader stable interfaces
Instead of using Bundle, explicitly specify params when initializing a data loader.

BUG: 150406132
Test: atest PackageManagerShellCommandIncrementalTest
Change-Id: I2f89d3c3ea1058fdbd689da0d5cb801bf4d9a0b4
2020-03-03 21:18:30 -08:00
Kweku Adams
ede42f99ed Add PowerWhitelistManager.isWhitelisted.
The "XXXExceptIdle" lists and methods are expected to be a superset of
the XXX methods. That's not immediately obvious from the method names.
This effort is to clean up the naming and better document actual
behavior. As part of this, we're moving the isApplicationWhitelisted
methods to PowerWhitelistManager to also help clean up the interface
between the apex and the rest of the system.

Bug: 142420609
Bug: 144864180
Bug: 145014493
Test: atest CtsBatterySavingTestCases:DeviceIdleTest
Test: atest CtsSecurityTestCases:DeviceIdleControllerTest
Test: atest FrameworksServicesTests:AppStandbyControllerTests
Change-Id: I1d248a075992e2dc279a7bfec44f38c7e51780b4
2020-03-03 17:03:04 -08:00
Songchun Fan
b8ab0034c6 dataloader/incfs openWrite returns int
Plus minor refactors

BUG: 150470163
Test: atest PackageManagerShellCommandIncrementalTest
Change-Id: Ib3a1c7c45a4abaab793be73213545ce91c98510b
Merged-In: Ib3a1c7c45a4abaab793be73213545ce91c98510b
2020-03-03 10:18:56 -08:00
Songchun Fan
38dfe9a0d4 use shell to open v4 signature file
BUG: 133435829
Test: atest PackageManagerShellCommandIncrementalTest
Change-Id: I8e57b00f042f8b6c85d5f905460dd2da6199accc
(cherry picked from commit cdbcb34c2b)
2020-03-03 09:48:02 -08:00
SongFerngWang
53515a0ea6 CellularBatteryStats: Address API council feedback
Bug: 144925883
Test: Build pass, device boots up
atest TelephonyMetricsTest

Change-Id: Iac5904a3397a42aa5f015cb53bb63318f5c377a4
Merged-In: Iac5904a3397a42aa5f015cb53bb63318f5c377a4
(cherry picked from commit 84dc30fede)
2020-03-02 05:15:08 +00:00
Paul Chang
af730a12bd Merge "Improvements to Bugreporting API." into rvc-dev 2020-02-29 00:20:04 +00:00
Ytai Ben-Tsvi
d5065ba8a5 Pass models to soundtrigger middleware with shared memory
This both avoids the need to make extra copied for the models and
allows exceeding the parcel size limits.

Bug: 150100907
Test: Manual testing of basic sound trigger functionality
Change-Id: Ic4c5c1a9de3e29b1b6fa82442254e1afe7daec19
2020-02-28 13:01:24 -08:00
Paul Chang
1a44ed3a18 Improvements to Bugreporting API.
- Show a toast to indicate screenshot is taken.

BUG:149525300
Test: Flash and press bug report shortcut and check the toast
Change-Id: Ib210c8855d2b588b51f883e32070c8b748ea4e3f
Merged-In: Ib210c8855d2b588b51f883e32070c8b748ea4e3f
2020-02-28 17:14:48 +00:00
Chris Wailes
ee398f9664 Adds Zygote policy flags to control how applications are launched
This patch adds a zygote policy parameter to functions in the
ActivityManagerService (and associated classes) to allow for different
launch behavior based on the triggering event.  This will allow for
latency sensitive applications to utilize the Unspecialized App Process
Pool, without other processes draining the pool and causing excessive
refill events.

Test: Booted and launched several apps
Bug: 147613193
Change-Id: Ib0a51c8720f95a7eafcab4ad2b5bb08f27a58d8c
(cherry picked from commit 4d05188588)
2020-02-27 20:33:12 +00:00
Makoto Onuki
9577cd78ff Merge "Squash same ApplicationInfo's in Parcel" into rvc-dev 2020-02-25 15:17:14 +00:00
Makoto Onuki
2d80ca09fc Squash same ApplicationInfo's in Parcel
ApplicationInfo now automatically tries to "squash" the same instances in a
Parcel.

NOTE: This CL still does *not* optimize the package manager APIs that return a
list. e.g. PM.queryContentProviders() still return duplicate AppInfo's.
We can optimize them by making ParcelableListSlice call "allowSquashing",
but that *could* have negative side effects, so I'm not doing it in this CL.
I think we can do that for S.

Bug: 148588589
Test: atest CtsContentTestCases # except for two preexsiting failures:
- android.content.pm.cts.PackageManagerTest#testGetIcon
- android.content.pm.cts.PackageManagerTest#testGetPreferredActivities

Test: Use the debugger and make sure bindApplication() is not receiving
duplicate AppInfo's in the provider list.

Change-Id: I3ba2c047a469169340c0f75c36bdfd394bc5d627
(cherry picked from commit 7d09275d70)
2020-02-24 22:22:13 +00:00
Yo Chiang
9834448ca1 Add DSU default userdata partition size
Use DEFAULT_USERDATA_SIZE as userdata partition size if the calling
Intent desn't specify the userdata size or the specified size is zero.

Bug: 145891687
Test: adb shell am start-activity \
  -n com.android.dynsystem/com.android.dynsystem.VerificationActivity \
  -a android.os.image.action.START_INSTALL \
  -d file:///storage/emulated/0/Download/aosp_arm64-dsu_test.zip

Merged-In: I52767dfefef394403c5e16fcfd40792b14ff9a71
Change-Id: I52767dfefef394403c5e16fcfd40792b14ff9a71
(cherry picked from commit f41e145480)
2020-02-24 17:13:20 +08:00
Sudheer Shanka
77f2a2c3dd Merge "Update BlobStoreMS to augment storage stats with blobs data." 2020-02-21 19:28:09 +00:00
Chris Ye
e078ee507e Merge "Add native Thermal Throttling API to libandroid." 2020-02-21 03:21:18 +00:00
Iavor-Valentin Iftime
4eb7c72945 Merge "Address API council suggestions for UserManager APIs" 2020-02-20 20:35:44 +00:00
Valentin Iftime
4bf82c8206 Address API council suggestions for UserManager APIs
Test: atest UserManagerTest
Bug: 149742406
Change-Id: I8b408a17de0282b91fcb5c0b66e9d0404fda54b1
2020-02-20 14:29:43 +01:00
Charles Chen
c56ce6fd08 Merge "Exempt-From-Owner-Approval: Report non-visual Context misuse" 2020-02-20 12:30:06 +00:00
TreeHugger Robot
58a8b7f51d Merge "Switch to new project ID constants." 2020-02-20 07:59:07 +00:00
Andrii Kulian
5877c7d6c0 Exempt-From-Owner-Approval: Report non-visual Context misuse
Make obtaining a visual service from non-visual Context instance
report a strict mode violation and print the stacktrace.

Make calling getDisplay() throw an exception if called on an instance
that is not associated with a display. For existing usages introduce
a new internal method that does not perform the verification until
the usages are properly fixed.

Bug: 128338354
Test: StrictModeTest#testIncorrectContextUse_GetSystemService
Test: StrictModeTest#testIncorrectContextUse_GetDisplay
Change-Id: Id25d590eca6e10066e55d7ed6436d3bc9e433beb
2020-02-20 01:29:25 +00:00
Chris Ye
48dbcaae41 Add native Thermal Throttling API to libandroid.
Add native thermal manager API of thermal mananger service into
libandroid. Export Thermal API as NDK library.

Bug: 137151587
Bug: 136285293
Test: build, atest thermalmanager-test atest CtsThermalTestCases

Change-Id: Ia49fb2133624ffcd6168af804ae612ef2bb190f2
2020-02-19 16:25:25 -08:00
Sudheer Shanka
e9232d6d6f Update BlobStoreMS to augment storage stats with blobs data.
- Any pending sessions data is attributed to the apps
  which contributed them.
- Any commited blobs data is attributed to the app which
  has a lease on it. If multiple apps have lease on a blob, don't
  attribute the blob to those apps for now.
- Remove StorageStatsAugmenter.augmentStatsForUser as it
  is not used for anything currently.
- Fix an issue in how we override existing committers and leasees.

Bug: 148694869
Test: atest cts/tests/BlobStore/src/com/android/cts/blob/BlobStoreManagerTest.java
Test: atest tests/tests/os/src/android/os/storage/cts/StorageStatsManagerTest.java
Test: atest hostsidetests/appsecurity/src/android/appsecurity/cts/StorageHostTest.java
Test: manual
Change-Id: Ia4af0a2549c75db66741f2d1979de95d2d150bc8
2020-02-19 14:45:12 -08:00
Yurii Zubrytskyi
df7c050e16 Add a version field to the v4 signature file format
Test: atest PackageManagerShellCommandTest PackageManagerShellCommandIncrementalTest
Bug: b/136132412 b/133435829
Change-Id: I09fd36eb5914f59d63c5c244e34db75aa4f43639
2020-02-19 14:03:23 -08:00
Ricky Wai
62048287d9 Merge "Bind mount obb directory in emulated storage." 2020-02-19 19:42:13 +00:00
Pavel Grafov
fba650eaed Merge "Add "Forgot my password" to start profile in locked state." 2020-02-19 19:09:20 +00:00
Dan Stoza
a6781c835d Merge "Add PowerManager#getThermalHeadroom" 2020-02-19 18:18:31 +00:00
Martijn Coenen
fd12f36fb9 Switch to new project ID constants.
These are used on devices without sdcardfs.

Bug: 146419093
Test: lsattr -pR
Change-Id: I87c900d409c90770fb3eaa595324dab385458c6c
2020-02-19 16:04:02 +01:00
Martijn Coenen
961709fbab Merge "Fixup OBB directories correctly after package install." 2020-02-19 14:02:25 +00:00
Pavel Grafov
4513e24323 Add "Forgot my password" to start profile in locked state.
Feature is disabled on non-FBE devices since the profile user will
end up in RUNNING_UNLOCKED state.

Bug: 143516540
Test: atest com.android.server.devicepolicy.DevicePolicyManagerTest
Test: manual
Change-Id: Ib87492577b4e5153a8108036af89c547e4bb76ee
2020-02-19 12:44:12 +00:00
Ricky Wai
e5088d92df Bind mount obb directory in emulated storage.
- Create obb directories for packages when zygote starts.

- During zygote fork, bind all visible obb package directories
for an app.

- If app data isolation is not enabled for that process, bind
mount the whole obb directory instead.

Bug: 148049767
Bug: 137890172
Test: atest android.appsecurity.cts.AdoptableHostTest
Change-Id: I841e98c120d447b148c22cfd809d738427b04f2e
2020-02-19 12:37:23 +00:00
Dan Stoza
b04705837a Add PowerManager#getThermalHeadroom
Adds getThermalHeadroom, which allows users to determine how close the
device currently is to SEVERE thermal throttling. For intensive
applications which can scale their workloads, this allows them to help
manage the thermal envelope of the device.

Test: Manual, modify Filament test app to call and observe values
Test: PowerManagerTest#testGetThermalHeadroom
Test: atest android.os.cts.PowerManager_ThermalTest
Test: atest com.android.systemui.statusbar.phone.StatusBarTest
Test: atest CachedDeviceStateServiceTest
Test: atest AbstractAccessibilityServiceConnectionTest
Test: atest KeyEventDispatcherTest
Test: atest AttentionManagerServiceTest
Test: atest HdmiControlServiceTest
Test: atest ThermalManagerServiceTest
Test: atest RecoverySystemServiceTest
Bug: 136285293
Change-Id: I26e1c849c4b08cbf7ee0057f555cf0893750da43
2020-02-18 17:29:26 -08:00
Collin Fijalkovich
ceb5e24ae6 Merge "Cache PowerManager binder calls" 2020-02-18 19:31:36 +00:00
Martijn Coenen
b3562f43d2 Fixup OBB directories correctly after package install.
The installer may pre-create OBB directories for packages that it is
installing on external storage, in locations like
/storage/emulated/0/data/obb/com.foo . The permissions on this directory
is never explicitly setup; instead, sdcardfs magically fixed up the
permissions to match the package name "com.foo".

With sdcardfs going away in devices launching with R, we need to set
the permissions for these paths up explicitly. Since only vold can do
that, have PackageManager call into StorageManager after an app
install/upgrade to do the correct setup.

Bug: 146419093
Test: manually verify directories are setup correctly
Change-Id: I530c8de196011b1dc97c7a9ab612e5d6dc9403a1
2020-02-18 15:23:35 +01:00
Treehugger Robot
46d77cf71c Merge "Add getAvbPublicKey to IDynamicSystemService" am: ecd7c440df am: d584bb1ef0 am: 0ed127a6b6
Change-Id: I8d6ae5ccebe085e08f48abc6f7624419e4de043e
2020-02-18 13:19:50 +00:00