diff --git a/res/xml/bluetooth_device_details_fragment.xml b/res/xml/bluetooth_device_details_fragment.xml
index f485c6a..94052b6 100644
--- a/res/xml/bluetooth_device_details_fragment.xml
+++ b/res/xml/bluetooth_device_details_fragment.xml
@@ -47,4 +47,10 @@
     <PreferenceCategory
         android:key="bluetooth_profiles"/>
 
+    <com.android.settingslib.widget.FooterPreference
+        android:key="device_details_footer"
+        android:selectable="false"
+        settings:searchable="false"
+        settings:controller="com.android.settings.bluetooth.BluetoothDetailsMacAddressController"/>
+
 </PreferenceScreen>
\ No newline at end of file
diff --git a/src/com/android/settings/accounts/AccountSyncSettings.java b/src/com/android/settings/accounts/AccountSyncSettings.java
index a652056..992cc67 100644
--- a/src/com/android/settings/accounts/AccountSyncSettings.java
+++ b/src/com/android/settings/accounts/AccountSyncSettings.java
@@ -42,7 +42,6 @@
 import android.view.MenuInflater;
 import android.view.MenuItem;
 
-import androidx.annotation.VisibleForTesting;
 import androidx.appcompat.app.AlertDialog;
 import androidx.preference.Preference;
 
@@ -460,7 +459,8 @@
             syncPref.setChecked(oneTimeSyncMode || syncEnabled);
         }
         if (syncIsFailing) {
-            createFooterPreference();
+            getPreferenceScreen().addPreference(new FooterPreference.Builder(
+                    getActivity()).setTitle(R.string.sync_is_failing).build());
         }
     }
 
@@ -553,11 +553,4 @@
                         | DateUtils.FORMAT_SHOW_YEAR
                         | DateUtils.FORMAT_SHOW_TIME);
     }
-
-    @VisibleForTesting
-    void createFooterPreference() {
-        final FooterPreference footerPreference = new FooterPreference(getActivity());
-        footerPreference.setTitle(R.string.sync_is_failing);
-        getPreferenceScreen().addPreference(footerPreference);
-    }
 }
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java b/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java
index c90a0de..68b21f5 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java
@@ -141,56 +141,57 @@
         private HashMap<Integer, String> mFingerprintsRenaming;
 
         FingerprintAuthenticateSidecar.Listener mAuthenticateListener =
-            new FingerprintAuthenticateSidecar.Listener() {
-                @Override
-                public void onAuthenticationSucceeded(
-                        FingerprintManager.AuthenticationResult result) {
-                    int fingerId = result.getFingerprint().getBiometricId();
-                    mHandler.obtainMessage(MSG_FINGER_AUTH_SUCCESS, fingerId, 0).sendToTarget();
-                }
+                new FingerprintAuthenticateSidecar.Listener() {
+                    @Override
+                    public void onAuthenticationSucceeded(
+                            FingerprintManager.AuthenticationResult result) {
+                        int fingerId = result.getFingerprint().getBiometricId();
+                        mHandler.obtainMessage(MSG_FINGER_AUTH_SUCCESS, fingerId, 0).sendToTarget();
+                    }
 
-                @Override
-                public void onAuthenticationFailed() {
-                    mHandler.obtainMessage(MSG_FINGER_AUTH_FAIL).sendToTarget();
-                }
+                    @Override
+                    public void onAuthenticationFailed() {
+                        mHandler.obtainMessage(MSG_FINGER_AUTH_FAIL).sendToTarget();
+                    }
 
-                @Override
-                public void onAuthenticationError(int errMsgId, CharSequence errString) {
-                    mHandler.obtainMessage(MSG_FINGER_AUTH_ERROR, errMsgId, 0, errString)
-                            .sendToTarget();
-                }
+                    @Override
+                    public void onAuthenticationError(int errMsgId, CharSequence errString) {
+                        mHandler.obtainMessage(MSG_FINGER_AUTH_ERROR, errMsgId, 0, errString)
+                                .sendToTarget();
+                    }
 
-                @Override
-                public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) {
-                    mHandler.obtainMessage(MSG_FINGER_AUTH_HELP, helpMsgId, 0, helpString)
-                            .sendToTarget();
-                }
-            };
+                    @Override
+                    public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) {
+                        mHandler.obtainMessage(MSG_FINGER_AUTH_HELP, helpMsgId, 0, helpString)
+                                .sendToTarget();
+                    }
+                };
 
         FingerprintRemoveSidecar.Listener mRemovalListener =
                 new FingerprintRemoveSidecar.Listener() {
-            public void onRemovalSucceeded(Fingerprint fingerprint) {
-                mHandler.obtainMessage(MSG_REFRESH_FINGERPRINT_TEMPLATES,
-                        fingerprint.getBiometricId(), 0).sendToTarget();
-                updateDialog();
-            }
+                    public void onRemovalSucceeded(Fingerprint fingerprint) {
+                        mHandler.obtainMessage(MSG_REFRESH_FINGERPRINT_TEMPLATES,
+                                fingerprint.getBiometricId(), 0).sendToTarget();
+                        updateDialog();
+                    }
 
-            public void onRemovalError(Fingerprint fp, int errMsgId, CharSequence errString) {
-                final Activity activity = getActivity();
-                if (activity != null) {
-                    Toast.makeText(activity, errString, Toast.LENGTH_SHORT);
-                }
-                updateDialog();
-            }
+                    public void onRemovalError(Fingerprint fp, int errMsgId,
+                            CharSequence errString) {
+                        final Activity activity = getActivity();
+                        if (activity != null) {
+                            Toast.makeText(activity, errString, Toast.LENGTH_SHORT);
+                        }
+                        updateDialog();
+                    }
 
-            private void updateDialog() {
-                RenameDialog renameDialog = (RenameDialog) getFragmentManager().
-                        findFragmentByTag(RenameDialog.class.getName());
-                if (renameDialog != null) {
-                    renameDialog.enableDelete();
-                }
-            }
-        };
+                    private void updateDialog() {
+                        RenameDialog renameDialog = (RenameDialog) getFragmentManager().
+                                findFragmentByTag(RenameDialog.class.getName());
+                        if (renameDialog != null) {
+                            renameDialog.enableDelete();
+                        }
+                    }
+                };
 
         private final Handler mHandler = new Handler() {
             @Override
@@ -200,17 +201,17 @@
                         removeFingerprintPreference(msg.arg1);
                         updateAddPreference();
                         retryFingerprint();
-                    break;
+                        break;
                     case MSG_FINGER_AUTH_SUCCESS:
                         highlightFingerprintItem(msg.arg1);
                         retryFingerprint();
-                    break;
+                        break;
                     case MSG_FINGER_AUTH_FAIL:
                         // No action required... fingerprint will allow up to 5 of these
-                    break;
+                        break;
                     case MSG_FINGER_AUTH_ERROR:
-                        handleError(msg.arg1 /* errMsgId */, (CharSequence) msg.obj /* errStr */ );
-                    break;
+                        handleError(msg.arg1 /* errMsgId */, (CharSequence) msg.obj /* errStr */);
+                        break;
                     case MSG_FINGER_AUTH_HELP: {
                         // Not used
                     }
@@ -220,7 +221,7 @@
         };
 
         /**
-         * @param errMsgId
+         *
          */
         protected void handleError(int errMsgId, CharSequence msg) {
             switch (errMsgId) {
@@ -243,7 +244,7 @@
                 // Activity can be null on a screen rotation.
                 final Activity activity = getActivity();
                 if (activity != null) {
-                    Toast.makeText(activity, msg , Toast.LENGTH_SHORT).show();
+                    Toast.makeText(activity, msg, Toast.LENGTH_SHORT).show();
                 }
             }
             retryFingerprint(); // start again
@@ -425,11 +426,8 @@
             if (context == null) {
                 return;
             }
-
-            final FooterPreference footerPreference = new FooterPreference(context);
-            footerPreference.setTitle(mFooterTitle);
-            footerPreference.setSelectable(false);
-            root.addPreference(footerPreference);
+            root.addPreference(new FooterPreference.Builder(context).setTitle(
+                    mFooterTitle).build());
         }
 
         private static String genKey(int id) {
@@ -522,7 +520,8 @@
             RenameDialog renameDialog = new RenameDialog();
             Bundle args = new Bundle();
             if (mFingerprintsRenaming.containsKey(fp.getBiometricId())) {
-                final Fingerprint f = new Fingerprint(mFingerprintsRenaming.get(fp.getBiometricId()),
+                final Fingerprint f = new Fingerprint(
+                        mFingerprintsRenaming.get(fp.getBiometricId()),
                         fp.getGroupId(), fp.getBiometricId(), fp.getDeviceId());
                 args.putParcelable("fingerprint", f);
             } else {
diff --git a/src/com/android/settings/bluetooth/BluetoothDetailsMacAddressController.java b/src/com/android/settings/bluetooth/BluetoothDetailsMacAddressController.java
index 835961d..86c45bb 100644
--- a/src/com/android/settings/bluetooth/BluetoothDetailsMacAddressController.java
+++ b/src/com/android/settings/bluetooth/BluetoothDetailsMacAddressController.java
@@ -25,13 +25,13 @@
 import com.android.settingslib.bluetooth.CachedBluetoothDevice;
 import com.android.settingslib.core.lifecycle.Lifecycle;
 import com.android.settingslib.widget.FooterPreference;
-import com.android.settingslib.widget.FooterPreferenceMixinCompat;
 
 /**
  * This class adds the device MAC address to a footer.
  */
 public class BluetoothDetailsMacAddressController extends BluetoothDetailsController {
-    FooterPreferenceMixinCompat mFooterPreferenceMixin;
+    public static final String KEY_DEVICE_DETAILS_FOOTER = "device_details_footer";
+
     FooterPreference mFooterPreference;
 
     public BluetoothDetailsMacAddressController(Context context,
@@ -39,12 +39,11 @@
             CachedBluetoothDevice device,
             Lifecycle lifecycle) {
         super(context, fragment, device, lifecycle);
-        mFooterPreferenceMixin = new FooterPreferenceMixinCompat(fragment, lifecycle);
     }
 
     @Override
     protected void init(PreferenceScreen screen) {
-        mFooterPreference = mFooterPreferenceMixin.createFooterPreference();
+        mFooterPreference = screen.findPreference(KEY_DEVICE_DETAILS_FOOTER);
         mFooterPreference.setTitle(mContext.getString(
                 R.string.bluetooth_device_mac_address, mCachedDevice.getAddress()));
     }
@@ -57,9 +56,6 @@
 
     @Override
     public String getPreferenceKey() {
-        if (mFooterPreference == null) {
-            return null;
-        }
-        return mFooterPreference.getKey();
+        return KEY_DEVICE_DETAILS_FOOTER;
     }
 }
\ No newline at end of file
diff --git a/src/com/android/settings/deviceinfo/StorageDashboardFragment.java b/src/com/android/settings/deviceinfo/StorageDashboardFragment.java
index c9cec57..9dab2bd 100644
--- a/src/com/android/settings/deviceinfo/StorageDashboardFragment.java
+++ b/src/com/android/settings/deviceinfo/StorageDashboardFragment.java
@@ -66,7 +66,6 @@
     private static final int STORAGE_JOB_ID = 0;
     private static final int ICON_JOB_ID = 1;
     private static final int VOLUME_SIZE_JOB_ID = 2;
-    private static final int OPTIONS_MENU_MIGRATE_DATA = 100;
 
     private VolumeInfo mVolume;
     private PrivateStorageInfo mStorageInfo;
@@ -139,6 +138,7 @@
     }
 
     private void onReceivedSizes() {
+        boolean stopLoading = false;
         if (mStorageInfo != null) {
             long privateUsedBytes = mStorageInfo.totalBytes - mStorageInfo.freeBytes;
             mSummaryController.updateBytes(privateUsedBytes, mStorageInfo.totalBytes);
@@ -152,18 +152,21 @@
                     userController.setTotalSize(mStorageInfo.totalBytes);
                 }
             }
+            stopLoading = true;
+
         }
 
-        if (mAppsResult == null) {
-            return;
+        if (mAppsResult != null) {
+            mPreferenceController.onLoadFinished(mAppsResult, UserHandle.myUserId());
+            updateSecondaryUserControllers(mSecondaryUsers, mAppsResult);
+            stopLoading = true;
         }
 
-        mPreferenceController.onLoadFinished(mAppsResult, UserHandle.myUserId());
-        updateSecondaryUserControllers(mSecondaryUsers, mAppsResult);
-
         // setLoading always causes a flicker, so let's avoid doing it.
-        if (getView().findViewById(R.id.loading_container).getVisibility() == View.VISIBLE) {
-            setLoading(false, true);
+        if (stopLoading) {
+            if (getView().findViewById(R.id.loading_container).getVisibility() == View.VISIBLE) {
+                setLoading(false, true);
+            }
         }
     }
 
diff --git a/tests/robotests/src/com/android/settings/accounts/AccountSyncSettingsTest.java b/tests/robotests/src/com/android/settings/accounts/AccountSyncSettingsTest.java
index 59d1f60..dd1778f 100644
--- a/tests/robotests/src/com/android/settings/accounts/AccountSyncSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/accounts/AccountSyncSettingsTest.java
@@ -15,8 +15,6 @@
  */
 package com.android.settings.accounts;
 
-import static com.google.common.truth.Truth.assertThat;
-
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
@@ -26,9 +24,7 @@
 import android.os.UserHandle;
 
 import androidx.fragment.app.FragmentActivity;
-import androidx.preference.Preference;
 
-import com.android.settings.testutils.shadow.ShadowAuthenticationHelper;
 import com.android.settings.testutils.shadow.ShadowContentResolver;
 
 import org.junit.After;
@@ -37,7 +33,6 @@
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
 import org.robolectric.annotation.Config;
-import org.robolectric.shadows.androidx.fragment.FragmentController;
 import org.robolectric.util.ReflectionHelpers;
 
 @RunWith(RobolectricTestRunner.class)
@@ -62,18 +57,4 @@
         settings.onPreferenceTreeClick(preference);
         // no crash
     }
-
-    @Test
-    @Config(shadows = {ShadowAuthenticationHelper.class})
-    public void createFooterPreference_shouldReturnFooter() {
-        final AccountSyncSettings settings = FragmentController.of(new AccountSyncSettings())
-                .create()
-                .get();
-
-        settings.createFooterPreference();
-
-        final Preference footer = settings.getPreferenceScreen().findPreference(
-                "footer_preference");
-        assertThat(footer).isNotNull();
-    }
 }
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsMacAddressControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsMacAddressControllerTest.java
index 9798745..c7eb1bb 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsMacAddressControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsMacAddressControllerTest.java
@@ -15,6 +15,8 @@
  */
 package com.android.settings.bluetooth;
 
+import static com.android.settings.bluetooth.BluetoothDetailsMacAddressController.KEY_DEVICE_DETAILS_FOOTER;
+
 import static com.google.common.truth.Truth.assertThat;
 
 import com.android.settingslib.widget.FooterPreference;
@@ -25,22 +27,24 @@
 
 @RunWith(RobolectricTestRunner.class)
 public class BluetoothDetailsMacAddressControllerTest extends BluetoothDetailsControllerTestBase {
+    private BluetoothDetailsMacAddressController mController;
 
-  private BluetoothDetailsMacAddressController mController;
+    @Override
+    public void setUp() {
+        super.setUp();
+        mController =
+                new BluetoothDetailsMacAddressController(mContext, mFragment, mCachedDevice,
+                        mLifecycle);
+        setupDevice(mDeviceConfig);
+        mScreen.addPreference(new FooterPreference.Builder(mContext).setKey(
+                KEY_DEVICE_DETAILS_FOOTER).build());
+    }
 
-  @Override
-  public void setUp() {
-    super.setUp();
-    mController =
-        new BluetoothDetailsMacAddressController(mContext, mFragment, mCachedDevice, mLifecycle);
-    setupDevice(mDeviceConfig);
-  }
-
-  @Test
-  public void macAddress() {
-    showScreen(mController);
-    FooterPreference footer =
-        (FooterPreference) mScreen.findPreference(mController.getPreferenceKey());
-    assertThat(footer.getTitle().toString()).endsWith(mDeviceConfig.getAddress());
-  }
+    @Test
+    public void macAddress() {
+        showScreen(mController);
+        FooterPreference footer =
+                (FooterPreference) mScreen.findPreference(mController.getPreferenceKey());
+        assertThat(footer.getTitle().toString()).endsWith(mDeviceConfig.getAddress());
+    }
 }
