Merge "Don't create external storage dirs for apps with PROPERTY_NO_APP_DATA_STORAGE" into tm-dev am: 674eca9edf am: 6063be0b64

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17712583

Change-Id: Ia451c849d5db64080996e130df06349eedfacaa5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Samiul Islam
2022-04-21 12:09:51 +00:00
committed by Automerger Merge Worker

View File

@@ -3742,6 +3742,16 @@ class StorageManagerService extends IStorageManager.Stub
Context.APP_OPS_SERVICE);
appOps.checkPackage(callingUid, callingPkg);
try {
final PackageManager.Property noAppStorageProp = mContext.getPackageManager()
.getProperty(PackageManager.PROPERTY_NO_APP_DATA_STORAGE, callingPkg);
if (noAppStorageProp != null && noAppStorageProp.getBoolean()) {
throw new SecurityException(callingPkg + " should not have " + appPath);
}
} catch (PackageManager.NameNotFoundException ignore) {
// Property not found
}
File appFile = null;
try {
appFile = new File(appPath).getCanonicalFile();