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

Commit cf5b12a6 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: 9d115b05

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



Change-Id: Ia74a004fd18509a78f9980dcaa3d54903dbfadcd
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 150ae67c 9d115b05
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
@@ -3051,19 +3051,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