Refactor Reset options Settings
Update language to comply with Android's inclusive language guidance See https://source.android.com/setup/contribute/respectful-code for reference Bug: 161896447 Test: robotest & manual Change-Id: I94969f6903d047b9bc41b1e8c14096c92c460b38
This commit is contained in:
@@ -83,16 +83,16 @@ import java.util.List;
|
||||
*
|
||||
* This is the initial screen.
|
||||
*/
|
||||
public class MasterClear extends InstrumentedFragment implements OnGlobalLayoutListener {
|
||||
private static final String TAG = "MasterClear";
|
||||
public class MainClear extends InstrumentedFragment implements OnGlobalLayoutListener {
|
||||
private static final String TAG = "MainClear";
|
||||
|
||||
@VisibleForTesting
|
||||
static final int KEYGUARD_REQUEST = 55;
|
||||
@VisibleForTesting
|
||||
static final int CREDENTIAL_CONFIRM_REQUEST = 56;
|
||||
|
||||
private static final String KEY_SHOW_ESIM_RESET_CHECKBOX
|
||||
= "masterclear.allow_retain_esim_profiles_after_fdr";
|
||||
private static final String KEY_SHOW_ESIM_RESET_CHECKBOX =
|
||||
"masterclear.allow_retain_esim_profiles_after_fdr";
|
||||
|
||||
static final String ERASE_EXTERNAL_EXTRA = "erase_sd";
|
||||
static final String ERASE_ESIMS_EXTRA = "erase_esim";
|
||||
@@ -142,7 +142,7 @@ public class MasterClear extends InstrumentedFragment implements OnGlobalLayoutL
|
||||
final ChooseLockSettingsHelper.Builder builder =
|
||||
new ChooseLockSettingsHelper.Builder(getActivity(), this);
|
||||
return builder.setRequestCode(request)
|
||||
.setTitle(res.getText(R.string.master_clear_short_title))
|
||||
.setTitle(res.getText(R.string.main_clear_short_title))
|
||||
.show();
|
||||
}
|
||||
|
||||
@@ -188,9 +188,9 @@ public class MasterClear extends InstrumentedFragment implements OnGlobalLayoutL
|
||||
args.putBoolean(ERASE_EXTERNAL_EXTRA, mExternalStorage.isChecked());
|
||||
args.putBoolean(ERASE_ESIMS_EXTRA, mEsimStorage.isChecked());
|
||||
new SubSettingLauncher(getContext())
|
||||
.setDestination(MasterClearConfirm.class.getName())
|
||||
.setDestination(MainClearConfirm.class.getName())
|
||||
.setArguments(args)
|
||||
.setTitleRes(R.string.master_clear_confirm_title)
|
||||
.setTitleRes(R.string.main_clear_confirm_title)
|
||||
.setSourceMetricsCategory(getMetricsCategory())
|
||||
.launch();
|
||||
}
|
||||
@@ -296,7 +296,7 @@ public class MasterClear extends InstrumentedFragment implements OnGlobalLayoutL
|
||||
if (mScrollView != null) {
|
||||
mScrollView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||
}
|
||||
mScrollView = mContentView.findViewById(R.id.master_clear_scrollview);
|
||||
mScrollView = mContentView.findViewById(R.id.main_clear_scrollview);
|
||||
|
||||
/*
|
||||
* If the external storage is emulated, it will be erased with a factory
|
||||
@@ -354,9 +354,9 @@ public class MasterClear extends InstrumentedFragment implements OnGlobalLayoutL
|
||||
final UserManager um = (UserManager) getActivity().getSystemService(Context.USER_SERVICE);
|
||||
loadAccountList(um);
|
||||
final StringBuffer contentDescription = new StringBuffer();
|
||||
final View masterClearContainer = mContentView.findViewById(R.id.master_clear_container);
|
||||
getContentDescription(masterClearContainer, contentDescription);
|
||||
masterClearContainer.setContentDescription(contentDescription);
|
||||
final View mainClearContainer = mContentView.findViewById(R.id.main_clear_container);
|
||||
getContentDescription(mainClearContainer, contentDescription);
|
||||
mainClearContainer.setContentDescription(contentDescription);
|
||||
|
||||
// Set the status of initiateButton based on scrollview
|
||||
mScrollView.setOnScrollChangeListener(new OnScrollChangeListener() {
|
||||
@@ -424,7 +424,7 @@ public class MasterClear extends InstrumentedFragment implements OnGlobalLayoutL
|
||||
final FooterBarMixin mixin = layout.getMixin(FooterBarMixin.class);
|
||||
mixin.setPrimaryButton(
|
||||
new FooterButton.Builder(getActivity())
|
||||
.setText(R.string.master_clear_button_text)
|
||||
.setText(R.string.main_clear_button_text)
|
||||
.setListener(mInitiateListener)
|
||||
.setButtonType(ButtonType.OTHER)
|
||||
.setTheme(R.style.SudGlifButton_Primary)
|
||||
@@ -475,15 +475,15 @@ public class MasterClear extends InstrumentedFragment implements OnGlobalLayoutL
|
||||
final int profileId = userInfo.id;
|
||||
final UserHandle userHandle = new UserHandle(profileId);
|
||||
Account[] accounts = mgr.getAccountsAsUser(profileId);
|
||||
final int N = accounts.length;
|
||||
if (N == 0) {
|
||||
final int accountLength = accounts.length;
|
||||
if (accountLength == 0) {
|
||||
continue;
|
||||
}
|
||||
accountsCount += N;
|
||||
accountsCount += accountLength;
|
||||
|
||||
AuthenticatorDescription[] descs = AccountManager.get(context)
|
||||
.getAuthenticatorTypesAsUser(profileId);
|
||||
final int M = descs.length;
|
||||
final int descLength = descs.length;
|
||||
|
||||
if (profilesSize > 1) {
|
||||
View titleView = Utils.inflateCategoryHeader(inflater, contents);
|
||||
@@ -493,10 +493,10 @@ public class MasterClear extends InstrumentedFragment implements OnGlobalLayoutL
|
||||
contents.addView(titleView);
|
||||
}
|
||||
|
||||
for (int i = 0; i < N; i++) {
|
||||
for (int i = 0; i < accountLength; i++) {
|
||||
Account account = accounts[i];
|
||||
AuthenticatorDescription desc = null;
|
||||
for (int j = 0; j < M; j++) {
|
||||
for (int j = 0; j < descLength; j++) {
|
||||
if (account.type.equals(descs[j].type)) {
|
||||
desc = descs[j];
|
||||
break;
|
||||
@@ -524,7 +524,7 @@ public class MasterClear extends InstrumentedFragment implements OnGlobalLayoutL
|
||||
icon = context.getPackageManager().getDefaultActivityIcon();
|
||||
}
|
||||
|
||||
View child = inflater.inflate(R.layout.master_clear_account, contents, false);
|
||||
View child = inflater.inflate(R.layout.main_clear_account, contents, false);
|
||||
((ImageView) child.findViewById(android.R.id.icon)).setImageDrawable(icon);
|
||||
((TextView) child.findViewById(android.R.id.title)).setText(account.name);
|
||||
contents.addView(child);
|
||||
@@ -552,7 +552,7 @@ public class MasterClear extends InstrumentedFragment implements OnGlobalLayoutL
|
||||
.hasBaseUserRestriction(context, UserManager.DISALLOW_FACTORY_RESET,
|
||||
UserHandle.myUserId());
|
||||
if (disallow && !Utils.isDemoUser(context)) {
|
||||
return inflater.inflate(R.layout.master_clear_disallowed_screen, null);
|
||||
return inflater.inflate(R.layout.main_clear_disallowed_screen, null);
|
||||
} else if (admin != null) {
|
||||
new ActionDisabledByAdminDialogHelper(getActivity())
|
||||
.prepareDialogBuilder(UserManager.DISALLOW_FACTORY_RESET, admin)
|
||||
@@ -561,7 +561,7 @@ public class MasterClear extends InstrumentedFragment implements OnGlobalLayoutL
|
||||
return new View(getContext());
|
||||
}
|
||||
|
||||
mContentView = inflater.inflate(R.layout.master_clear, null);
|
||||
mContentView = inflater.inflate(R.layout.main_clear, null);
|
||||
|
||||
establishInitialState();
|
||||
return mContentView;
|
@@ -64,8 +64,8 @@ import com.google.android.setupdesign.GlifLayout;
|
||||
*
|
||||
* This is the confirmation screen.
|
||||
*/
|
||||
public class MasterClearConfirm extends InstrumentedFragment {
|
||||
private final static String TAG = "MasterClearConfirm";
|
||||
public class MainClearConfirm extends InstrumentedFragment {
|
||||
private static final String TAG = "MainClearConfirm";
|
||||
|
||||
@VisibleForTesting View mContentView;
|
||||
private boolean mEraseSdCard;
|
||||
@@ -103,7 +103,7 @@ public class MasterClearConfirm extends InstrumentedFragment {
|
||||
mProgressDialog.hide();
|
||||
if (getActivity() != null) {
|
||||
getActivity().setRequestedOrientation(mOldOrientation);
|
||||
doMasterClear();
|
||||
doMainClear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ public class MasterClearConfirm extends InstrumentedFragment {
|
||||
}
|
||||
}.execute();
|
||||
} else {
|
||||
doMasterClear();
|
||||
doMainClear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,9 +130,9 @@ public class MasterClearConfirm extends InstrumentedFragment {
|
||||
progressDialog.setIndeterminate(true);
|
||||
progressDialog.setCancelable(false);
|
||||
progressDialog.setTitle(
|
||||
getActivity().getString(R.string.master_clear_progress_title));
|
||||
getActivity().getString(R.string.main_clear_progress_title));
|
||||
progressDialog.setMessage(
|
||||
getActivity().getString(R.string.master_clear_progress_text));
|
||||
getActivity().getString(R.string.main_clear_progress_text));
|
||||
return progressDialog;
|
||||
}
|
||||
};
|
||||
@@ -180,11 +180,11 @@ public class MasterClearConfirm extends InstrumentedFragment {
|
||||
return !WizardManagerHelper.isDeviceProvisioned(getActivity());
|
||||
}
|
||||
|
||||
private void doMasterClear() {
|
||||
private void doMainClear() {
|
||||
Intent intent = new Intent(Intent.ACTION_FACTORY_RESET);
|
||||
intent.setPackage("android");
|
||||
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
|
||||
intent.putExtra(Intent.EXTRA_REASON, "MasterClearConfirm");
|
||||
intent.putExtra(Intent.EXTRA_REASON, "MainClearConfirm");
|
||||
intent.putExtra(Intent.EXTRA_WIPE_EXTERNAL_STORAGE, mEraseSdCard);
|
||||
intent.putExtra(Intent.EXTRA_WIPE_ESIMS, mEraseEsims);
|
||||
getActivity().sendBroadcast(intent);
|
||||
@@ -200,7 +200,7 @@ public class MasterClearConfirm extends InstrumentedFragment {
|
||||
final FooterBarMixin mixin = layout.getMixin(FooterBarMixin.class);
|
||||
mixin.setPrimaryButton(
|
||||
new FooterButton.Builder(getActivity())
|
||||
.setText(R.string.master_clear_button_text)
|
||||
.setText(R.string.main_clear_button_text)
|
||||
.setListener(mFinalClickListener)
|
||||
.setButtonType(ButtonType.OTHER)
|
||||
.setTheme(R.style.SudGlifButton_Primary)
|
||||
@@ -230,7 +230,7 @@ public class MasterClearConfirm extends InstrumentedFragment {
|
||||
getActivity(), UserManager.DISALLOW_FACTORY_RESET, UserHandle.myUserId());
|
||||
if (RestrictedLockUtilsInternal.hasBaseUserRestriction(getActivity(),
|
||||
UserManager.DISALLOW_FACTORY_RESET, UserHandle.myUserId())) {
|
||||
return inflater.inflate(R.layout.master_clear_disallowed_screen, null);
|
||||
return inflater.inflate(R.layout.main_clear_disallowed_screen, null);
|
||||
} else if (admin != null) {
|
||||
new ActionDisabledByAdminDialogHelper(getActivity())
|
||||
.prepareDialogBuilder(UserManager.DISALLOW_FACTORY_RESET, admin)
|
||||
@@ -238,7 +238,7 @@ public class MasterClearConfirm extends InstrumentedFragment {
|
||||
.show();
|
||||
return new View(getActivity());
|
||||
}
|
||||
mContentView = inflater.inflate(R.layout.master_clear_confirm, null);
|
||||
mContentView = inflater.inflate(R.layout.main_clear_confirm, null);
|
||||
setUpActionBarAndTitle();
|
||||
establishFinalConfirmationState();
|
||||
setAccessibilityTitle();
|
||||
@@ -260,7 +260,7 @@ public class MasterClearConfirm extends InstrumentedFragment {
|
||||
void setSubtitle() {
|
||||
if (mEraseEsims) {
|
||||
((TextView) mContentView.findViewById(R.id.sud_layout_description))
|
||||
.setText(R.string.master_clear_final_desc_esim);
|
||||
.setText(R.string.main_clear_final_desc_esim);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,9 +270,9 @@ public class MasterClearConfirm extends InstrumentedFragment {
|
||||
|
||||
Bundle args = getArguments();
|
||||
mEraseSdCard = args != null
|
||||
&& args.getBoolean(MasterClear.ERASE_EXTERNAL_EXTRA);
|
||||
&& args.getBoolean(MainClear.ERASE_EXTERNAL_EXTRA);
|
||||
mEraseEsims = args != null
|
||||
&& args.getBoolean(MasterClear.ERASE_ESIMS_EXTRA);
|
||||
&& args.getBoolean(MainClear.ERASE_ESIMS_EXTRA);
|
||||
}
|
||||
|
||||
@Override
|
@@ -125,7 +125,7 @@ public class ResetNetwork extends InstrumentedFragment {
|
||||
args.putInt(SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX,
|
||||
subscription.getSubscriptionId());
|
||||
}
|
||||
args.putBoolean(MasterClear.ERASE_ESIMS_EXTRA,
|
||||
args.putBoolean(MainClear.ERASE_ESIMS_EXTRA,
|
||||
mEsimContainer.getVisibility() == View.VISIBLE && mEsimCheckbox.isChecked());
|
||||
new SubSettingLauncher(getContext())
|
||||
.setDestination(ResetNetworkConfirm.class.getName())
|
||||
|
@@ -188,7 +188,7 @@ public class ResetNetworkConfirm extends InstrumentedFragment {
|
||||
progressDialog.setIndeterminate(true);
|
||||
progressDialog.setCancelable(false);
|
||||
progressDialog.setMessage(
|
||||
context.getString(R.string.master_clear_progress_text));
|
||||
context.getString(R.string.main_clear_progress_text));
|
||||
return progressDialog;
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ public class ResetNetworkConfirm extends InstrumentedFragment {
|
||||
if (args != null) {
|
||||
mSubId = args.getInt(SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX,
|
||||
SubscriptionManager.INVALID_SUBSCRIPTION_ID);
|
||||
mEraseEsim = args.getBoolean(MasterClear.ERASE_ESIMS_EXTRA);
|
||||
mEraseEsim = args.getBoolean(MainClear.ERASE_ESIMS_EXTRA);
|
||||
}
|
||||
|
||||
mActivity = getActivity();
|
||||
|
@@ -200,7 +200,7 @@ public class ToggleAccessibilityServicePreferenceFragment extends
|
||||
protected void updateToggleServiceTitle(SwitchPreference switchPreference) {
|
||||
final AccessibilityServiceInfo info = getAccessibilityServiceInfo();
|
||||
final String switchBarText = (info == null) ? "" :
|
||||
getString(R.string.accessibility_service_master_switch_title,
|
||||
getString(R.string.accessibility_service_primary_switch_title,
|
||||
info.getResolveInfo().loadLabel(getPackageManager()));
|
||||
switchPreference.setTitle(switchBarText);
|
||||
}
|
||||
|
@@ -365,7 +365,7 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
|
||||
abstract int getUserShortcutTypes();
|
||||
|
||||
protected void updateToggleServiceTitle(SwitchPreference switchPreference) {
|
||||
switchPreference.setTitle(R.string.accessibility_service_master_switch_title);
|
||||
switchPreference.setTitle(R.string.accessibility_service_primary_switch_title);
|
||||
}
|
||||
|
||||
protected abstract void onPreferenceToggled(String preferenceKey, boolean enabled);
|
||||
|
@@ -19,7 +19,7 @@ package com.android.settings.core.gateway;
|
||||
import com.android.settings.AllInOneTetherSettings;
|
||||
import com.android.settings.DisplaySettings;
|
||||
import com.android.settings.IccLockSettings;
|
||||
import com.android.settings.MasterClear;
|
||||
import com.android.settings.MainClear;
|
||||
import com.android.settings.Settings;
|
||||
import com.android.settings.TestingSettings;
|
||||
import com.android.settings.TetherSettings;
|
||||
@@ -273,7 +273,7 @@ public class SettingsGateway {
|
||||
TestingSettings.class.getName(),
|
||||
WifiAPITest.class.getName(),
|
||||
WifiInfo.class.getName(),
|
||||
MasterClear.class.getName(),
|
||||
MainClear.class.getName(),
|
||||
ResetDashboardFragment.class.getName(),
|
||||
NightDisplaySettings.class.getName(),
|
||||
ManageDomainUrls.class.getName(),
|
||||
|
Reference in New Issue
Block a user