diff --git a/src/com/android/settings/MasterClear.java b/src/com/android/settings/MainClear.java
similarity index 94%
rename from src/com/android/settings/MasterClear.java
rename to src/com/android/settings/MainClear.java
index 62edfce..326aeef 100644
--- a/src/com/android/settings/MasterClear.java
+++ b/src/com/android/settings/MainClear.java
@@ -83,16 +83,16 @@
  *
  * 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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
             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 @@
                 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 @@
                     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 @@
                 .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 @@
             return new View(getContext());
         }
 
-        mContentView = inflater.inflate(R.layout.master_clear, null);
+        mContentView = inflater.inflate(R.layout.main_clear, null);
 
         establishInitialState();
         return mContentView;
diff --git a/src/com/android/settings/MasterClearConfirm.java b/src/com/android/settings/MainClearConfirm.java
similarity index 92%
rename from src/com/android/settings/MasterClearConfirm.java
rename to src/com/android/settings/MainClearConfirm.java
index 3ace436..c45a907 100644
--- a/src/com/android/settings/MasterClearConfirm.java
+++ b/src/com/android/settings/MainClearConfirm.java
@@ -64,8 +64,8 @@
  *
  * 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 @@
                         mProgressDialog.hide();
                         if (getActivity() != null) {
                             getActivity().setRequestedOrientation(mOldOrientation);
-                            doMasterClear();
+                            doMainClear();
                         }
                     }
 
@@ -121,7 +121,7 @@
                     }
                 }.execute();
             } else {
-                doMasterClear();
+                doMainClear();
             }
         }
 
@@ -130,9 +130,9 @@
             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 @@
         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 @@
         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 @@
                 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 @@
                     .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 @@
     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 @@
 
         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
diff --git a/src/com/android/settings/ResetNetwork.java b/src/com/android/settings/ResetNetwork.java
index ce2cd71..5ff59b5 100644
--- a/src/com/android/settings/ResetNetwork.java
+++ b/src/com/android/settings/ResetNetwork.java
@@ -125,7 +125,7 @@
             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())
diff --git a/src/com/android/settings/ResetNetworkConfirm.java b/src/com/android/settings/ResetNetworkConfirm.java
index 6856a5a..53fe369 100644
--- a/src/com/android/settings/ResetNetworkConfirm.java
+++ b/src/com/android/settings/ResetNetworkConfirm.java
@@ -188,7 +188,7 @@
         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 @@
         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();
diff --git a/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java b/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java
index 05147a8..f892c50 100644
--- a/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java
@@ -200,7 +200,7 @@
     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);
     }
diff --git a/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java b/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
index d0b83b6..b4e2fa6 100644
--- a/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
@@ -365,7 +365,7 @@
     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);
diff --git a/src/com/android/settings/core/gateway/SettingsGateway.java b/src/com/android/settings/core/gateway/SettingsGateway.java
index 8fcb009..6c6bc90 100644
--- a/src/com/android/settings/core/gateway/SettingsGateway.java
+++ b/src/com/android/settings/core/gateway/SettingsGateway.java
@@ -19,7 +19,7 @@
 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 @@
             TestingSettings.class.getName(),
             WifiAPITest.class.getName(),
             WifiInfo.class.getName(),
-            MasterClear.class.getName(),
+            MainClear.class.getName(),
             ResetDashboardFragment.class.getName(),
             NightDisplaySettings.class.getName(),
             ManageDomainUrls.class.getName(),
