Refactor power menu bug reporting flow to work for multiple admins
Existing implementation of power menu bugreporting flow works only for the primary user. In HSUM(Headless system user mode) there is going to be more than one admin users who are allowed to trigger bug report from the power menu, below refactorings has been done do handle this case. Configurations for custom_bugreport_handler_app and custom_bugreport_handler_user are moved from Global to Secure settings so that each user can save them. The current context user will be the fallback default user in the absence of a correctly configured handlerApp or handlerUser. Retrieval of the current bug report handler apps are refactored to add shell as user's default preferences for any user(current user). Test: manually tested the bugreport is working for multiple admin with different combination of handlerApp and handlerUser Bug: 261184202 Change-Id: I3110c1f9619ede2edeb744daf37521318f0ff6e7
This commit is contained in:
@@ -59,7 +59,7 @@ public class BugReportInPowerPreferenceController extends
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
final boolean isEnabled = (Boolean) newValue;
|
||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||
Settings.Global.BUGREPORT_IN_POWER_MENU,
|
||||
Settings.Secure.BUGREPORT_IN_POWER_MENU,
|
||||
isEnabled ? SETTING_VALUE_ON : SETTING_VALUE_OFF);
|
||||
return true;
|
||||
}
|
||||
@@ -67,7 +67,7 @@ public class BugReportInPowerPreferenceController extends
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
final int mode = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||
Settings.Global.BUGREPORT_IN_POWER_MENU, SETTING_VALUE_OFF);
|
||||
Settings.Secure.BUGREPORT_IN_POWER_MENU, SETTING_VALUE_OFF);
|
||||
((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public class BugReportInPowerPreferenceController extends
|
||||
protected void onDeveloperOptionsSwitchDisabled() {
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||
Settings.Global.BUGREPORT_IN_POWER_MENU, SETTING_VALUE_OFF);
|
||||
Settings.Secure.BUGREPORT_IN_POWER_MENU, SETTING_VALUE_OFF);
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user