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

Commit c545627a 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

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



Change-Id: I62f42122279fcbef58d144b05104baa2534f493c
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 4219739b 5f0c868b
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