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

Commit 610671a5 authored by Samiul Islam's avatar Samiul Islam Committed by Automerger Merge Worker
Browse files

Merge "Disallow external storage access without restricting other api calls"...

Merge "Disallow external storage access without restricting other api calls" into tm-dev am: 5f0c868b am: c545627a

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



Change-Id: I46b748579f068f000922a613f9ced2ea9b32e4e7
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 92d5d94f c545627a
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -1361,6 +1361,18 @@ public class Environment {
            return false;
        }

        // Apps with PROPERTY_NO_APP_DATA_STORAGE should not be allowed in scoped storage
        final String packageName = AppGlobals.getInitialPackage();
        try {
            final PackageManager.Property noAppStorageProp = packageManager.getProperty(
                    PackageManager.PROPERTY_NO_APP_DATA_STORAGE, packageName);
            if (noAppStorageProp != null && noAppStorageProp.getBoolean()) {
                return false;
            }
        } catch (PackageManager.NameNotFoundException ignore) {
            // Property not defined for the package
        }

        boolean defaultScopedStorage = Compatibility.isChangeEnabled(DEFAULT_SCOPED_STORAGE);
        boolean forceEnableScopedStorage = Compatibility.isChangeEnabled(
                FORCE_ENABLE_SCOPED_STORAGE);
+1 −13
Original line number Diff line number Diff line
@@ -3055,19 +3055,7 @@ class StorageManagerService extends IStorageManager.Stub
            return true;
        }

        if (packageName == null) {
            return false;
        }

        final int packageUid = mPmInternal.getPackageUid(packageName,
                PackageManager.MATCH_DEBUG_TRIAGED_MISSING, UserHandle.getUserId(callerUid));

        if (DEBUG_OBB) {
            Slog.d(TAG, "packageName = " + packageName + ", packageUid = " +
                    packageUid + ", callerUid = " + callerUid);
        }

        return callerUid == packageUid;
        return mPmInternal.isSameApp(packageName, callerUid, UserHandle.getUserId(callerUid));
    }

    @Override