@@ -3106,6 +3106,15 @@ public Setting getSettingLocked(int type, int userId, String name) {
31063106 return settingsState .getSettingLocked (name );
31073107 }
31083108
3109+ private boolean shouldExcludeSettingFromReset (Setting setting , String prefix ) {
3110+ // If a prefix was specified, exclude settings whose names don't start with it.
3111+ if (prefix != null && !setting .getName ().startsWith (prefix )) {
3112+ return true ;
3113+ }
3114+ // Never reset SECURE_FRP_MODE, as it could be abused to bypass FRP via RescueParty.
3115+ return Secure .SECURE_FRP_MODE .equals (setting .getName ());
3116+ }
3117+
31093118 public void resetSettingsLocked (int type , int userId , String packageName , int mode ,
31103119 String tag ) {
31113120 resetSettingsLocked (type , userId , packageName , mode , tag , /*prefix=*/
@@ -3128,7 +3137,7 @@ public void resetSettingsLocked(int type, int userId, String packageName, int mo
31283137 Setting setting = settingsState .getSettingLocked (name );
31293138 if (packageName .equals (setting .getPackageName ())) {
31303139 if ((tag != null && !tag .equals (setting .getTag ()))
3131- || ( prefix != null && ! setting . getName (). startsWith ( prefix ) )) {
3140+ || shouldExcludeSettingFromReset ( setting , prefix )) {
31323141 continue ;
31333142 }
31343143 if (settingsState .resetSettingLocked (name )) {
@@ -3148,7 +3157,7 @@ public void resetSettingsLocked(int type, int userId, String packageName, int mo
31483157 Setting setting = settingsState .getSettingLocked (name );
31493158 if (!SettingsState .isSystemPackage (getContext (),
31503159 setting .getPackageName ())) {
3151- if (prefix != null && ! setting . getName (). startsWith ( prefix )) {
3160+ if (shouldExcludeSettingFromReset ( setting , prefix )) {
31523161 continue ;
31533162 }
31543163 if (settingsState .resetSettingLocked (name )) {
@@ -3168,7 +3177,7 @@ public void resetSettingsLocked(int type, int userId, String packageName, int mo
31683177 Setting setting = settingsState .getSettingLocked (name );
31693178 if (!SettingsState .isSystemPackage (getContext (),
31703179 setting .getPackageName ())) {
3171- if (prefix != null && ! setting . getName (). startsWith ( prefix )) {
3180+ if (shouldExcludeSettingFromReset ( setting , prefix )) {
31723181 continue ;
31733182 }
31743183 if (setting .isDefaultFromSystem ()) {
@@ -3191,7 +3200,7 @@ public void resetSettingsLocked(int type, int userId, String packageName, int mo
31913200 for (String name : settingsState .getSettingNamesLocked ()) {
31923201 Setting setting = settingsState .getSettingLocked (name );
31933202 boolean someSettingChanged = false ;
3194- if (prefix != null && ! setting . getName (). startsWith ( prefix )) {
3203+ if (shouldExcludeSettingFromReset ( setting , prefix )) {
31953204 continue ;
31963205 }
31973206 if (setting .isDefaultFromSystem ()) {
0 commit comments