diff --git a/src/com/android/settings/MasterClear.java b/src/com/android/settings/MasterClear.java
index c8ec448..97942fe 100644
--- a/src/com/android/settings/MasterClear.java
+++ b/src/com/android/settings/MasterClear.java
@@ -21,7 +21,7 @@
 import android.accounts.Account;
 import android.accounts.AccountManager;
 import android.accounts.AuthenticatorDescription;
-import android.annotation.Nullable;
+import android.app.ActionBar;
 import android.app.Activity;
 import android.content.ComponentName;
 import android.content.ContentResolver;
@@ -31,6 +31,7 @@
 import android.content.pm.ResolveInfo;
 import android.content.pm.UserInfo;
 import android.content.res.Resources;
+import android.graphics.Color;
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
 import android.os.Environment;
@@ -61,8 +62,9 @@
 import com.android.settings.enterprise.ActionDisabledByAdminDialogHelper;
 import com.android.settings.password.ChooseLockSettingsHelper;
 import com.android.settings.password.ConfirmLockPattern;
-import com.android.settingslib.RestrictedLockUtils;
 import com.android.settingslib.RestrictedLockUtilsInternal;
+import com.android.setupwizardlib.TemplateLayout;
+import com.android.setupwizardlib.template.ButtonFooterMixin;
 
 import java.util.List;
 
@@ -79,8 +81,10 @@
 public class MasterClear extends InstrumentedFragment implements OnGlobalLayoutListener {
     private static final String TAG = "MasterClear";
 
-    @VisibleForTesting static final int KEYGUARD_REQUEST = 55;
-    @VisibleForTesting static final int CREDENTIAL_CONFIRM_REQUEST = 56;
+    @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";
@@ -89,27 +93,41 @@
     static final String ERASE_ESIMS_EXTRA = "erase_esim";
 
     private View mContentView;
-    @VisibleForTesting Button mInitiateButton;
+    @VisibleForTesting
+    Button mInitiateButton;
     private View mExternalStorageContainer;
-    @VisibleForTesting CheckBox mExternalStorage;
+    @VisibleForTesting
+    CheckBox mExternalStorage;
     private View mEsimStorageContainer;
-    @VisibleForTesting CheckBox mEsimStorage;
-    @VisibleForTesting ScrollView mScrollView;
+    @VisibleForTesting
+    CheckBox mEsimStorage;
+    @VisibleForTesting
+    ScrollView mScrollView;
 
     @Override
     public void onGlobalLayout() {
         mInitiateButton.setEnabled(hasReachedBottom(mScrollView));
     }
 
-    @Override
-    public void onCreate(@Nullable Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        getActivity().setTitle(R.string.master_clear_short_title);
+    private void setUpActionBarAndTitle() {
+        final Activity activity = getActivity();
+        if (activity == null) {
+            Log.e(TAG, "No activity attached, skipping setUpActionBarAndTitle");
+            return;
+        }
+        final ActionBar actionBar = activity.getActionBar();
+        if (actionBar == null) {
+            Log.e(TAG, "No actionbar, skipping setUpActionBarAndTitle");
+            return;
+        }
+        actionBar.hide();
+        activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
     }
 
     /**
      * Keyguard validation is run using the standard {@link ConfirmLockPattern}
      * component as a subactivity
+     *
      * @param request the request code to be returned once confirmation finishes
      * @return true if confirmation launched
      */
@@ -189,8 +207,8 @@
         Account[] accounts = am.getAccountsByType(accountType);
         if (accounts != null && accounts.length > 0) {
             final Intent requestAccountConfirmation = new Intent()
-                .setPackage(packageName)
-                .setComponent(new ComponentName(packageName, className));
+                    .setPackage(packageName)
+                    .setComponent(new ComponentName(packageName, className));
             // Check to make sure that the intent is supported.
             final PackageManager pm = context.getPackageManager();
             final ResolveInfo resolution = pm.resolveActivity(requestAccountConfirmation, 0);
@@ -259,8 +277,9 @@
      */
     @VisibleForTesting
     void establishInitialState() {
-        mInitiateButton = mContentView.findViewById(R.id.initiate_master_clear);
-        mInitiateButton.setOnClickListener(mInitiateListener);
+        setUpActionBarAndTitle();
+        setUpInitiateButton();
+
         mExternalStorageContainer = mContentView.findViewById(R.id.erase_external_container);
         mExternalStorage = mContentView.findViewById(R.id.erase_external);
         mEsimStorageContainer = mContentView.findViewById(R.id.erase_esim_container);
@@ -334,7 +353,7 @@
         mScrollView.setOnScrollChangeListener(new OnScrollChangeListener() {
             @Override
             public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX,
-                int oldScrollY) {
+                    int oldScrollY) {
                 if (v instanceof ScrollView && hasReachedBottom((ScrollView) v)) {
                     mInitiateButton.setEnabled(true);
                     mScrollView.setOnScrollChangeListener(null);
@@ -360,8 +379,8 @@
         }
         ContentResolver cr = context.getContentResolver();
         return Settings.Global.getInt(cr, Settings.Global.EUICC_PROVISIONED, 0) != 0
-                ||  Settings.Global.getInt(
-                        cr, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0;
+                || Settings.Global.getInt(
+                cr, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0;
     }
 
     @VisibleForTesting
@@ -388,21 +407,36 @@
         return diff <= 0;
     }
 
+    private void setUpInitiateButton() {
+        if (mInitiateButton != null) {
+            return;
+        }
+
+        final TemplateLayout layout = mContentView.findViewById(R.id.setup_wizard_layout);
+        final ButtonFooterMixin buttonFooterMixin = layout.getMixin(ButtonFooterMixin.class);
+        buttonFooterMixin.removeAllViews();
+        buttonFooterMixin.addSpace();
+        buttonFooterMixin.addSpace();
+        mInitiateButton = buttonFooterMixin.addButton(R.string.master_clear_button_text,
+                R.style.SuwGlifButton_Primary);
+        mInitiateButton.setOnClickListener(mInitiateListener);
+    }
+
     private void getContentDescription(View v, StringBuffer description) {
-       if (v.getVisibility() != View.VISIBLE) {
-           return;
-       }
-       if (v instanceof ViewGroup) {
-           ViewGroup vGroup = (ViewGroup) v;
-           for (int i = 0; i < vGroup.getChildCount(); i++) {
-               View nextChild = vGroup.getChildAt(i);
-               getContentDescription(nextChild, description);
-           }
-       } else if (v instanceof TextView) {
-           TextView vText = (TextView) v;
-           description.append(vText.getText());
-           description.append(","); // Allow Talkback to pause between sections.
-       }
+        if (v.getVisibility() != View.VISIBLE) {
+            return;
+        }
+        if (v instanceof ViewGroup) {
+            ViewGroup vGroup = (ViewGroup) v;
+            for (int i = 0; i < vGroup.getChildCount(); i++) {
+                View nextChild = vGroup.getChildAt(i);
+                getContentDescription(nextChild, description);
+            }
+        } else if (v instanceof TextView) {
+            TextView vText = (TextView) v;
+            description.append(vText.getText());
+            description.append(","); // Allow Talkback to pause between sections.
+        }
     }
 
     private boolean isExtStorageEncrypted() {
@@ -412,7 +446,7 @@
 
     private void loadAccountList(final UserManager um) {
         View accountsLabel = mContentView.findViewById(R.id.accounts_label);
-        LinearLayout contents = (LinearLayout)mContentView.findViewById(R.id.accounts);
+        LinearLayout contents = (LinearLayout) mContentView.findViewById(R.id.accounts);
         contents.removeAllViews();
 
         Context context = getActivity();
@@ -421,7 +455,7 @@
 
         AccountManager mgr = AccountManager.get(context);
 
-        LayoutInflater inflater = (LayoutInflater)context.getSystemService(
+        LayoutInflater inflater = (LayoutInflater) context.getSystemService(
                 Context.LAYOUT_INFLATER_SERVICE);
 
         int accountsCount = 0;
diff --git a/src/com/android/settings/MasterClearConfirm.java b/src/com/android/settings/MasterClearConfirm.java
index cfd20eb..8ebb710 100644
--- a/src/com/android/settings/MasterClearConfirm.java
+++ b/src/com/android/settings/MasterClearConfirm.java
@@ -16,18 +16,23 @@
 
 package com.android.settings;
 
+
 import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
 
+import android.app.ActionBar;
+import android.app.Activity;
 import android.app.ProgressDialog;
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.ActivityInfo;
+import android.graphics.Color;
 import android.os.AsyncTask;
 import android.os.Bundle;
 import android.os.UserHandle;
 import android.os.UserManager;
 import android.service.oemlock.OemLockManager;
 import android.service.persistentdata.PersistentDataBlockManager;
+import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -37,8 +42,9 @@
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
 import com.android.settings.core.InstrumentedFragment;
 import com.android.settings.enterprise.ActionDisabledByAdminDialogHelper;
-import com.android.settingslib.RestrictedLockUtils;
 import com.android.settingslib.RestrictedLockUtilsInternal;
+import com.android.setupwizardlib.TemplateLayout;
+import com.android.setupwizardlib.template.ButtonFooterMixin;
 
 /**
  * Confirm and execute a reset of the device to a clean "just out of the box"
@@ -51,6 +57,7 @@
  * This is the confirmation screen.
  */
 public class MasterClearConfirm extends InstrumentedFragment {
+    private final static String TAG = "MasterClearConfirm";
 
     private View mContentView;
     private boolean mEraseSdCard;
@@ -103,9 +110,11 @@
                         mProgressDialog.show();
 
                         // need to prevent orientation changes as we're about to go into
-                        // a long IO request, so we won't be able to access inflate resources on flash
+                        // a long IO request, so we won't be able to access inflate resources on
+                        // flash
                         mOldOrientation = getActivity().getRequestedOrientation();
-                        getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);
+                        getActivity().setRequestedOrientation(
+                                ActivityInfo.SCREEN_ORIENTATION_LOCKED);
                     }
                 }.execute();
             } else {
@@ -140,8 +149,29 @@
      * Configure the UI for the final confirmation interaction
      */
     private void establishFinalConfirmationState() {
-        mContentView.findViewById(R.id.execute_master_clear)
-                .setOnClickListener(mFinalClickListener);
+        final TemplateLayout layout = mContentView.findViewById(R.id.setup_wizard_layout);
+
+        final ButtonFooterMixin buttonFooterMixin = layout.getMixin(ButtonFooterMixin.class);
+        buttonFooterMixin.removeAllViews();
+        buttonFooterMixin.addSpace();
+        buttonFooterMixin.addSpace();
+        buttonFooterMixin.addButton(R.string.master_clear_button_text,
+                R.style.SuwGlifButton_Primary).setOnClickListener(mFinalClickListener);
+    }
+
+    private void setUpActionBarAndTitle() {
+        final Activity activity = getActivity();
+        if (activity == null) {
+            Log.e(TAG, "No activity attached, skipping setUpActionBarAndTitle");
+            return;
+        }
+        final ActionBar actionBar = activity.getActionBar();
+        if (actionBar == null) {
+            Log.e(TAG, "No actionbar, skipping setUpActionBarAndTitle");
+            return;
+        }
+        actionBar.hide();
+        activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
     }
 
     @Override
@@ -160,6 +190,7 @@
             return new View(getActivity());
         }
         mContentView = inflater.inflate(R.layout.master_clear_confirm, null);
+        setUpActionBarAndTitle();
         establishFinalConfirmationState();
         setAccessibilityTitle();
         return mContentView;
@@ -167,8 +198,7 @@
 
     private void setAccessibilityTitle() {
         CharSequence currentTitle = getActivity().getTitle();
-        TextView confirmationMessage =
-                (TextView) mContentView.findViewById(R.id.master_clear_confirm);
+        TextView confirmationMessage = mContentView.findViewById(R.id.master_clear_confirm);
         if (confirmationMessage != null) {
             String accessibleText = new StringBuilder(currentTitle).append(",").append(
                     confirmationMessage.getText()).toString();
