From 0f43348867bfcd3cc7cd852532dee7e1bfce5e21 Mon Sep 17 00:00:00 2001 From: Alan Stokes Date: Tue, 18 Feb 2020 09:36:00 +0000 Subject: [PATCH] Add ChangeId for app data isolation. Currently we are using DeviceConfig to set the target SDK level as an experiment to determine if this causes any significant problem for existing apps. So for now we just report the change, but once that is done we can switch to using this for targeting. Test: Boot device, see "Compat change id reported: 143937733; UID ; state: LOGGED". Bug: 147266020 Change-Id: Ic7f9468fa5b246c0d8e52a1b321c87e72933ca76 --- .../java/com/android/server/am/ProcessList.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java index ffa7d9202371c..b0eaf93c64cf6 100644 --- a/services/core/java/com/android/server/am/ProcessList.java +++ b/services/core/java/com/android/server/am/ProcessList.java @@ -339,6 +339,14 @@ public final class ProcessList { @EnabledAfter(targetSdkVersion = VersionCodes.Q) private static final long NATIVE_HEAP_POINTER_TAGGING = 135754954; // This is a bug id. + /** + * Apps have no access to the private data directories of any other app, even if the other + * app has made them world-readable. + */ + @ChangeId + @EnabledAfter(targetSdkVersion = VersionCodes.Q) + private static final long APP_DATA_DIRECTORY_ISOLATION = 143937733; // See b/143937733 + ActivityManagerService mService = null; // To kill process groups asynchronously @@ -2060,7 +2068,14 @@ public final class ProcessList { } final int minTargetSdk = DeviceConfig.getInt(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, ANDROID_APP_DATA_ISOLATION_MIN_SDK, Build.VERSION_CODES.R); - return app.info.targetSdkVersion >= minTargetSdk; + if (app.info.targetSdkVersion < minTargetSdk) { + return false; + } + + // TODO(b/147266020): Remove non-standard gating above & switch to isChangeEnabled. + mPlatformCompat.reportChange(APP_DATA_DIRECTORY_ISOLATION, app.info); + + return true; } private Map> getPackageAppDataInfoMap(PackageManagerInternal pmInt,