Merge "Don't create external storage dirs for apps with PROPERTY_NO_APP_DATA_STORAGE" into tm-dev am: 674eca9edf
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17712583 Change-Id: I88e35b3fb9888698408ef2116cdb91cf6a0ad258 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user