Loading core/res/AndroidManifest.xml +7 −2 Original line number Diff line number Diff line Loading @@ -2970,11 +2970,16 @@ <permission android:name="android.permission.MANAGE_SCOPED_ACCESS_DIRECTORY_PERMISSIONS" android:protectionLevel="signature" /> <!-- @SystemApi Allows an application to delete cache files. <p>Not for use by third-party applications. --> <!-- @SystemApi Old permission for deleting an app's cache files, no longer used, but signals for us to quietly ignore calls instead of throwing an exception. --> <permission android:name="android.permission.DELETE_CACHE_FILES" android:protectionLevel="signature|privileged" /> <!-- Allows an application to delete cache files. @hide --> <permission android:name="android.permission.INTERNAL_DELETE_CACHE_FILES" android:protectionLevel="signature" /> <!-- @SystemApi Allows an application to delete packages. <p>Not for use by third-party applications. <p>Starting in {@link android.os.Build.VERSION_CODES#N}, user confirmation is requested Loading services/core/java/com/android/server/pm/PackageManagerService.java +15 −2 Original line number Diff line number Diff line Loading @@ -19118,8 +19118,21 @@ public class PackageManagerService extends IPackageManager.Stub public void deleteApplicationCacheFilesAsUser(final String packageName, final int userId, final IPackageDataObserver observer) { final int callingUid = Binder.getCallingUid(); if (mContext.checkCallingOrSelfPermission( android.Manifest.permission.INTERNAL_DELETE_CACHE_FILES) != PackageManager.PERMISSION_GRANTED) { // If the caller has the old delete cache permission, silently ignore. Else throw. if (mContext.checkCallingOrSelfPermission( android.Manifest.permission.DELETE_CACHE_FILES) == PackageManager.PERMISSION_GRANTED) { Slog.w(TAG, "Calling uid " + callingUid + " does not have " + android.Manifest.permission.INTERNAL_DELETE_CACHE_FILES + ", silently ignoring"); return; } mContext.enforceCallingOrSelfPermission( android.Manifest.permission.DELETE_CACHE_FILES, null); android.Manifest.permission.INTERNAL_DELETE_CACHE_FILES, null); } mPermissionManager.enforceCrossUserPermission(callingUid, userId, /* requireFullPermission= */ true, /* checkShell= */ false, "delete application cache files"); Loading
core/res/AndroidManifest.xml +7 −2 Original line number Diff line number Diff line Loading @@ -2970,11 +2970,16 @@ <permission android:name="android.permission.MANAGE_SCOPED_ACCESS_DIRECTORY_PERMISSIONS" android:protectionLevel="signature" /> <!-- @SystemApi Allows an application to delete cache files. <p>Not for use by third-party applications. --> <!-- @SystemApi Old permission for deleting an app's cache files, no longer used, but signals for us to quietly ignore calls instead of throwing an exception. --> <permission android:name="android.permission.DELETE_CACHE_FILES" android:protectionLevel="signature|privileged" /> <!-- Allows an application to delete cache files. @hide --> <permission android:name="android.permission.INTERNAL_DELETE_CACHE_FILES" android:protectionLevel="signature" /> <!-- @SystemApi Allows an application to delete packages. <p>Not for use by third-party applications. <p>Starting in {@link android.os.Build.VERSION_CODES#N}, user confirmation is requested Loading
services/core/java/com/android/server/pm/PackageManagerService.java +15 −2 Original line number Diff line number Diff line Loading @@ -19118,8 +19118,21 @@ public class PackageManagerService extends IPackageManager.Stub public void deleteApplicationCacheFilesAsUser(final String packageName, final int userId, final IPackageDataObserver observer) { final int callingUid = Binder.getCallingUid(); if (mContext.checkCallingOrSelfPermission( android.Manifest.permission.INTERNAL_DELETE_CACHE_FILES) != PackageManager.PERMISSION_GRANTED) { // If the caller has the old delete cache permission, silently ignore. Else throw. if (mContext.checkCallingOrSelfPermission( android.Manifest.permission.DELETE_CACHE_FILES) == PackageManager.PERMISSION_GRANTED) { Slog.w(TAG, "Calling uid " + callingUid + " does not have " + android.Manifest.permission.INTERNAL_DELETE_CACHE_FILES + ", silently ignoring"); return; } mContext.enforceCallingOrSelfPermission( android.Manifest.permission.DELETE_CACHE_FILES, null); android.Manifest.permission.INTERNAL_DELETE_CACHE_FILES, null); } mPermissionManager.enforceCrossUserPermission(callingUid, userId, /* requireFullPermission= */ true, /* checkShell= */ false, "delete application cache files");