Merge "Revert "Revert "[SettingsProvider] enforce permission on openFile""" into tm-dev

This commit is contained in:
TreeHugger Robot
2022-05-04 01:59:50 +00:00
committed by Android (Google) Code Review

View File

@@ -818,6 +818,13 @@ public class SettingsProvider extends ContentProvider {
getContext().enforceCallingPermission(Manifest.permission.INTERACT_ACROSS_USERS,
"Access files from the settings of another user");
}
final String callingPackage = getCallingPackage();
if (mode.contains("w") && !Settings.checkAndNoteWriteSettingsOperation(getContext(),
Binder.getCallingUid(), callingPackage, getCallingAttributionTag(),
true /* throwException */)) {
Slog.e(LOG_TAG, "Package: " + callingPackage + " is not allowed to modify "
+ "system settings files.");
}
uri = ContentProvider.getUriWithoutUserId(uri);
final String cacheRingtoneSetting;