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

Commit e64a7991 authored by markchien's avatar markchien Committed by Mark Chien
Browse files

Expose check write setting operation as system API

If tethering provisioning check is required, caller must have tethering
privilege permission to change tethering. If provisioning is not needed,
caller who has write settings permisssion also can change tethering.
Expose checkAndNoteWriteSettingsOperation for tethering check whether
caller has write settings permission.

Bug: 144814607
Test: -build, flash, boot
      -atest SettingsTest#testCheckWriteSettingsOperation
Change-Id: Ib3931bbe39361c2c4324935f16473cc675848032
parent 6a953996
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -6721,6 +6721,7 @@ package android.provider {
  }
  public final class Settings {
    method public static boolean checkAndNoteWriteSettingsOperation(@NonNull android.content.Context, int, @NonNull String, boolean);
    field public static final String ACTION_ACCESSIBILITY_DETAILS_SETTINGS = "android.settings.ACCESSIBILITY_DETAILS_SETTINGS";
    field public static final String ACTION_ENTERPRISE_PRIVACY_SETTINGS = "android.settings.ENTERPRISE_PRIVACY_SETTINGS";
    field public static final String ACTION_LOCATION_CONTROLLER_EXTRA_PACKAGE_SETTINGS = "android.settings.LOCATION_CONTROLLER_EXTRA_PACKAGE_SETTINGS";
+3 −2
Original line number Diff line number Diff line
@@ -15264,8 +15264,9 @@ public final class Settings {
     * current time.
     * @hide
     */
    public static boolean checkAndNoteWriteSettingsOperation(Context context, int uid,
            String callingPackage, boolean throwException) {
    @SystemApi
    public static boolean checkAndNoteWriteSettingsOperation(@NonNull Context context, int uid,
            @NonNull String callingPackage, boolean throwException) {
        return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
                callingPackage, throwException, AppOpsManager.OP_WRITE_SETTINGS,
                PM_WRITE_SETTINGS, true);