Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 674eca9e authored by Samiul Islam's avatar Samiul Islam Committed by Android (Google) Code Review
Browse files

Merge "Don't create external storage dirs for apps with PROPERTY_NO_APP_DATA_STORAGE" into tm-dev

parents 64202a26 e20cef59
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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();