Merge "Disallow external storage access without restricting other api calls" into tm-dev
This commit is contained in:
@@ -1361,6 +1361,18 @@ public class Environment {
|
|||||||
return false;
|
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 defaultScopedStorage = Compatibility.isChangeEnabled(DEFAULT_SCOPED_STORAGE);
|
||||||
boolean forceEnableScopedStorage = Compatibility.isChangeEnabled(
|
boolean forceEnableScopedStorage = Compatibility.isChangeEnabled(
|
||||||
FORCE_ENABLE_SCOPED_STORAGE);
|
FORCE_ENABLE_SCOPED_STORAGE);
|
||||||
|
|||||||
@@ -3055,19 +3055,7 @@ class StorageManagerService extends IStorageManager.Stub
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (packageName == null) {
|
return mPmInternal.isSameApp(packageName, callerUid, UserHandle.getUserId(callerUid));
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user