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

Commit af3cdd3e 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 am: 610671a5

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



Change-Id: Iebd5c8bd1a304a129e6df36ba65eb3139b22c157
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 323e8bd7 610671a5
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