Merge "Fix face enroll introduction crash after 10mins"
diff --git a/Android.bp b/Android.bp
index a991c89..37ddf93 100644
--- a/Android.bp
+++ b/Android.bp
@@ -72,7 +72,7 @@
         "setupcompat",
         "setupdesign",
         "androidx.lifecycle_lifecycle-runtime",
-        "androidx.lifecycle_lifecycle-extensions",
+        "androidx.lifecycle_lifecycle-viewmodel",
         "guava",
         "jsr305",
         "net-utils-framework-common",
diff --git a/res/values/config.xml b/res/values/config.xml
index e7efa6f..d7b2afa 100755
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -615,9 +615,6 @@
         <item>android.uid.system:1000</item>
     </string-array>
 
-    <!-- The default value for RedactionInterstitial in SUW -->
-    <bool name="default_allow_sensitive_lockscreen_content">true</bool>
-
     <!-- Whether to enable the app battery usage list page feature. -->
     <bool name="config_app_battery_usage_list_enabled">false</bool>
 
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1f525e6..2057666 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -8016,9 +8016,9 @@
 
     <!-- TODO(b/258550150): Finalize all strings in this section and remove translatable="false" -->
     <!-- [CHAR LIMIT=32] Name of Advanced memory protection page in "More Security Settings" and heading of page. -->
-    <string name="memtag_title" translatable="false">Advanced memory protection</string>
+    <string name="memtag_title" translatable="false">Advanced memory protection beta</string>
     <!-- [CHAR LIMIT=52] Label for button to turn on / off Advanced memory protection.-->
-    <string name="memtag_toggle" translatable="false">Try Advanced memory protection</string>
+    <string name="memtag_toggle" translatable="false">Advanced memory protection</string>
     <!-- [CHAR LIMIT=NONE] Subtitle of Advanced memory protection page. -->
     <string name="memtag_intro" translatable="false">This beta feature helps you protect your device from bugs that may put your security at risk.</string>
     <!-- [CHAR LIMIT=NONE] Status label indicating that Advanced memory protection is on. -->
diff --git a/src/com/android/settings/applications/intentpicker/ProgressDialogFragment.java b/src/com/android/settings/applications/intentpicker/ProgressDialogFragment.java
index e55d904..c8f4c0b 100644
--- a/src/com/android/settings/applications/intentpicker/ProgressDialogFragment.java
+++ b/src/com/android/settings/applications/intentpicker/ProgressDialogFragment.java
@@ -35,7 +35,7 @@
 import androidx.annotation.NonNull;
 import androidx.appcompat.app.AlertDialog;
 import androidx.fragment.app.FragmentManager;
-import androidx.lifecycle.ViewModelProviders;
+import androidx.lifecycle.ViewModelProvider;
 
 import com.android.settings.R;
 import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
@@ -62,7 +62,7 @@
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        mViewModel = ViewModelProviders.of(this.getActivity()).get(SupportedLinkViewModel.class);
+        mViewModel = new ViewModelProvider(this.getActivity()).get(SupportedLinkViewModel.class);
     }
 
     @Override
diff --git a/src/com/android/settings/applications/intentpicker/SupportedLinksDialogFragment.java b/src/com/android/settings/applications/intentpicker/SupportedLinksDialogFragment.java
index db93df2..dd5b746 100644
--- a/src/com/android/settings/applications/intentpicker/SupportedLinksDialogFragment.java
+++ b/src/com/android/settings/applications/intentpicker/SupportedLinksDialogFragment.java
@@ -28,7 +28,7 @@
 import androidx.appcompat.app.AlertDialog;
 import androidx.fragment.app.Fragment;
 import androidx.fragment.app.FragmentManager;
-import androidx.lifecycle.ViewModelProviders;
+import androidx.lifecycle.ViewModelProvider;
 
 import com.android.settings.R;
 import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
@@ -50,7 +50,7 @@
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         mPackage = getArguments().getString(AppLaunchSettings.APP_PACKAGE_KEY);
-        mViewModel = ViewModelProviders.of(this.getActivity()).get(SupportedLinkViewModel.class);
+        mViewModel = new ViewModelProvider(this.getActivity()).get(SupportedLinkViewModel.class);
         mSupportedLinkWrapperList = mViewModel.getSupportedLinkWrapperList();
     }
 
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
index 7fd711e..bacb65e 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
@@ -77,6 +77,8 @@
 import com.google.android.setupcompat.template.FooterButton;
 import com.google.android.setupcompat.util.WizardManagerHelper;
 import com.google.android.setupdesign.GlifLayout;
+import com.google.android.setupdesign.template.DescriptionMixin;
+import com.google.android.setupdesign.template.HeaderMixin;
 
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -341,6 +343,9 @@
                 return true;
             });
         }
+
+        final Configuration config = getApplicationContext().getResources().getConfiguration();
+        maybeHideSfpsText(config);
     }
 
     @Override
@@ -1041,6 +1046,7 @@
     @SuppressWarnings("MissingSuperCall") // TODO: Fix me
     @Override
     public void onConfigurationChanged(@NonNull Configuration newConfig) {
+        maybeHideSfpsText(newConfig);
         switch(newConfig.orientation) {
             case Configuration.ORIENTATION_LANDSCAPE: {
                 updateOrientation(Configuration.ORIENTATION_LANDSCAPE);
@@ -1056,6 +1062,27 @@
         }
     }
 
+    private void maybeHideSfpsText(@NonNull Configuration newConfig) {
+        final HeaderMixin headerMixin = getLayout().getMixin(HeaderMixin.class);
+        final DescriptionMixin descriptionMixin = getLayout().getMixin(DescriptionMixin.class);
+        final boolean isLandscape = newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE;
+
+        if (mCanAssumeSfps) {
+            if (isLandscape) {
+                headerMixin.setAutoTextSizeEnabled(true);
+                headerMixin.getTextView().setMinLines(0);
+                headerMixin.getTextView().setMaxLines(10);
+                descriptionMixin.getTextView().setMinLines(0);
+                descriptionMixin.getTextView().setMaxLines(10);
+            } else {
+                headerMixin.setAutoTextSizeEnabled(false);
+                headerMixin.getTextView().setLines(4);
+                // hide the description
+                descriptionMixin.getTextView().setLines(0);
+            }
+        }
+    }
+
     public static class IconTouchDialog extends InstrumentedDialogFragment {
 
         @Override
diff --git a/src/com/android/settings/fuelgauge/BatteryUtils.java b/src/com/android/settings/fuelgauge/BatteryUtils.java
index 7739f6d..c5a8b00 100644
--- a/src/com/android/settings/fuelgauge/BatteryUtils.java
+++ b/src/com/android/settings/fuelgauge/BatteryUtils.java
@@ -23,6 +23,7 @@
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
+import android.os.BatteryManager;
 import android.os.BatteryStats;
 import android.os.BatteryStatsManager;
 import android.os.BatteryUsageStats;
@@ -397,8 +398,7 @@
         final long startTime = System.currentTimeMillis();
 
         // Stuff we always need to get BatteryInfo
-        final Intent batteryBroadcast = mContext.registerReceiver(null,
-                new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
+        final Intent batteryBroadcast = getBatteryIntent(mContext);
 
         final long elapsedRealtimeUs = PowerUtil.convertMsToUs(
                 SystemClock.elapsedRealtime());
@@ -577,4 +577,19 @@
 
         return -1L;
     }
+
+    /** Gets the latest sticky battery intent from the Android system. */
+    public static Intent getBatteryIntent(Context context) {
+        return context.registerReceiver(
+                /*receiver=*/ null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
+    }
+
+    /** Gets the battery level from the intent. */
+    public static int getBatteryLevel(Intent intent) {
+        final int level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);
+        final int scale = intent.getIntExtra(BatteryManager.EXTRA_SCALE, 0);
+        return scale == 0
+                ? -1 /*invalid battery level*/
+                : Math.round((level / (float) scale) * 100f);
+    }
 }
diff --git a/src/com/android/settings/fuelgauge/batteryusage/BatteryUsageBroadcastReceiver.java b/src/com/android/settings/fuelgauge/batteryusage/BatteryUsageBroadcastReceiver.java
index a9e3c1d..4eaa154 100644
--- a/src/com/android/settings/fuelgauge/batteryusage/BatteryUsageBroadcastReceiver.java
+++ b/src/com/android/settings/fuelgauge/batteryusage/BatteryUsageBroadcastReceiver.java
@@ -25,6 +25,7 @@
 
 import androidx.annotation.VisibleForTesting;
 
+import com.android.settings.fuelgauge.BatteryUtils;
 import com.android.settingslib.fuelgauge.BatteryStatus;
 
 import java.time.Duration;
@@ -64,7 +65,7 @@
     }
 
     private void tryToFetchUsageData(Context context) {
-        final Intent batteryIntent = DatabaseUtils.getBatteryIntent(context);
+        final Intent batteryIntent = BatteryUtils.getBatteryIntent(context);
         // Returns when battery is not fully charged.
         if (!BatteryStatus.isCharged(batteryIntent)) {
             return;
diff --git a/src/com/android/settings/fuelgauge/batteryusage/DatabaseUtils.java b/src/com/android/settings/fuelgauge/batteryusage/DatabaseUtils.java
index 29e0b0e..7efd152 100644
--- a/src/com/android/settings/fuelgauge/batteryusage/DatabaseUtils.java
+++ b/src/com/android/settings/fuelgauge/batteryusage/DatabaseUtils.java
@@ -19,7 +19,6 @@
 import android.content.ContentValues;
 import android.content.Context;
 import android.content.Intent;
-import android.content.IntentFilter;
 import android.content.SharedPreferences;
 import android.content.pm.PackageManager;
 import android.database.Cursor;
@@ -36,6 +35,7 @@
 
 import androidx.annotation.VisibleForTesting;
 
+import com.android.settings.fuelgauge.BatteryUtils;
 import com.android.settings.fuelgauge.batteryusage.db.BatteryStateDatabase;
 import com.android.settingslib.fuelgauge.BatteryStatus;
 
@@ -141,24 +141,18 @@
         });
     }
 
-    /** Gets the latest sticky battery intent from framework. */
-    static Intent getBatteryIntent(Context context) {
-        return context.registerReceiver(
-                /*receiver=*/ null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
-    }
-
     static List<ContentValues> sendBatteryEntryData(
             Context context,
             List<BatteryEntry> batteryEntryList,
             BatteryUsageStats batteryUsageStats) {
         final long startTime = System.currentTimeMillis();
-        final Intent intent = getBatteryIntent(context);
+        final Intent intent = BatteryUtils.getBatteryIntent(context);
         if (intent == null) {
             Log.e(TAG, "sendBatteryEntryData(): cannot fetch battery intent");
             clearMemory();
             return null;
         }
-        final int batteryLevel = getBatteryLevel(intent);
+        final int batteryLevel = BatteryUtils.getBatteryLevel(intent);
         final int batteryStatus = intent.getIntExtra(
                 BatteryManager.EXTRA_STATUS, BatteryManager.BATTERY_STATUS_UNKNOWN);
         final int batteryHealth = intent.getIntExtra(
@@ -306,14 +300,6 @@
         return resultMap;
     }
 
-    private static int getBatteryLevel(Intent intent) {
-        final int level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);
-        final int scale = intent.getIntExtra(BatteryManager.EXTRA_SCALE, 0);
-        return scale == 0
-                ? -1 /*invalid battery level*/
-                : Math.round((level / (float) scale) * 100f);
-    }
-
     private static void clearMemory() {
         if (SystemClock.uptimeMillis() > CLEAR_MEMORY_THRESHOLD_MS) {
             return;
diff --git a/src/com/android/settings/notification/RedactionInterstitial.java b/src/com/android/settings/notification/RedactionInterstitial.java
index d6fdaf8..f243250 100644
--- a/src/com/android/settings/notification/RedactionInterstitial.java
+++ b/src/com/android/settings/notification/RedactionInterstitial.java
@@ -189,16 +189,13 @@
         }
 
         private void loadFromSettings() {
-            final boolean showUnRedactedDefault = getContext().getResources().getBoolean(
-                    R.bool.default_allow_sensitive_lockscreen_content);
             final boolean managedProfile = UserManager.get(getContext()).isManagedProfile(mUserId);
             // Hiding all notifications is device-wide setting, managed profiles can only set
             // whether their notifications are show in full or redacted.
             final boolean showNotifications = managedProfile || Settings.Secure.getIntForUser(
                     getContentResolver(), LOCK_SCREEN_SHOW_NOTIFICATIONS, 0, mUserId) != 0;
             final boolean showUnredacted = Settings.Secure.getIntForUser(
-                    getContentResolver(), LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS,
-                    showUnRedactedDefault ? 1 : 0, mUserId) != 0;
+                    getContentResolver(), LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, 1, mUserId) != 0;
 
             int checkedButtonId = R.id.hide_all;
             if (showNotifications) {
diff --git a/src/com/android/settings/tts/TextToSpeechSettings.java b/src/com/android/settings/tts/TextToSpeechSettings.java
index 6db5710..621b222 100644
--- a/src/com/android/settings/tts/TextToSpeechSettings.java
+++ b/src/com/android/settings/tts/TextToSpeechSettings.java
@@ -38,7 +38,7 @@
 import android.util.Pair;
 
 import androidx.appcompat.app.AlertDialog;
-import androidx.lifecycle.ViewModelProviders;
+import androidx.lifecycle.ViewModelProvider;
 import androidx.preference.ListPreference;
 import androidx.preference.Preference;
 
@@ -208,7 +208,7 @@
         }
 
         final TextToSpeechViewModel ttsViewModel =
-                ViewModelProviders.of(this).get(TextToSpeechViewModel.class);
+                new ViewModelProvider(this).get(TextToSpeechViewModel.class);
         Pair<TextToSpeech, Boolean> ttsAndNew = ttsViewModel.getTtsAndWhetherNew(mInitListener);
         mTts = ttsAndNew.first;
         // If the TTS object is not newly created, we need to run the setup on the settings side to
@@ -237,7 +237,7 @@
         }
         if (!mTts.getDefaultEngine().equals(mTts.getCurrentEngine())) {
             final TextToSpeechViewModel ttsViewModel =
-                    ViewModelProviders.of(this).get(TextToSpeechViewModel.class);
+                    new ViewModelProvider(this).get(TextToSpeechViewModel.class);
             try {
                 // If the current engine isn't the default engine shut down the current engine in
                 // preparation for creating the new engine.
diff --git a/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java b/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java
index 17475df..5d393ef 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java
@@ -37,7 +37,7 @@
 import android.widget.Button;
 import android.widget.ImageView;
 
-import androidx.lifecycle.ViewModelProviders;
+import androidx.lifecycle.ViewModelProvider;
 
 import com.android.settings.R;
 
@@ -74,7 +74,7 @@
 
         @Override
         public void onFailure(int code, String ssid, SparseArray<int[]> channelListArray,
-                int[] operatingClassArray) {
+                              int[] operatingClassArray) {
             Log.d(TAG, "EasyConnectConfiguratorStatusCallback.onFailure: " + code);
             if (!TextUtils.isEmpty(ssid)) {
                 Log.d(TAG, "Tried SSID: " + ssid);
@@ -123,7 +123,7 @@
     }
 
     private Intent getResultIntent(int code, String ssid, SparseArray<int[]> channelListArray,
-            int[] operatingClassArray) {
+                                   int[] operatingClassArray) {
         Intent intent = new Intent();
         intent.putExtra(EXTRA_EASY_CONNECT_ERROR_CODE, code);
 
@@ -195,7 +195,7 @@
                 }
 
                 if (code == mLatestStatusCode) {
-                    throw(new IllegalStateException("Tried restarting EasyConnectSession but still"
+                    throw (new IllegalStateException("Tried restarting EasyConnectSession but still"
                             + "receiving EASY_CONNECT_EVENT_FAILURE_BUSY"));
                 }
 
@@ -220,7 +220,7 @@
                 break;
 
             case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_INVALID_NETWORK:
-                throw(new IllegalStateException("Wi-Fi DPP configurator used a non-PSK/non-SAE"
+                throw (new IllegalStateException("Wi-Fi DPP configurator used a non-PSK/non-SAE"
                         + "network to handshake"));
 
             case EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_CANNOT_FIND_NETWORK:
@@ -238,7 +238,7 @@
                 break;
 
             default:
-                throw(new IllegalStateException("Unexpected Wi-Fi DPP error"));
+                throw (new IllegalStateException("Unexpected Wi-Fi DPP error"));
         }
 
         setHeaderTitle(R.string.wifi_dpp_could_not_add_device);
@@ -297,7 +297,7 @@
         }
 
         final WifiDppInitiatorViewModel model =
-                ViewModelProviders.of(this).get(WifiDppInitiatorViewModel.class);
+                new ViewModelProvider(this).get(WifiDppInitiatorViewModel.class);
 
         model.getStatusCode().observe(this, statusCode -> {
             // After configuration change, observe callback will be triggered,
@@ -318,7 +318,7 @@
 
     @Override
     public final View onCreateView(LayoutInflater inflater, ViewGroup container,
-            Bundle savedInstanceState) {
+                                   Bundle savedInstanceState) {
         return inflater.inflate(R.layout.wifi_dpp_add_device_fragment, container,
                 /* attachToRoot */ false);
     }
@@ -343,7 +343,7 @@
 
         mChooseDifferentNetwork = view.findViewById(R.id.choose_different_network);
         mChooseDifferentNetwork.setOnClickListener(v ->
-            mClickChooseDifferentNetworkListener.onClickChooseDifferentNetwork()
+                mClickChooseDifferentNetworkListener.onClickChooseDifferentNetwork()
         );
 
         mLeftButton.setText(getContext(), R.string.cancel);
@@ -394,7 +394,7 @@
         final int networkId =
                 ((WifiDppConfiguratorActivity) getActivity()).getWifiNetworkConfig().getNetworkId();
         final WifiDppInitiatorViewModel model =
-                ViewModelProviders.of(this).get(WifiDppInitiatorViewModel.class);
+                new ViewModelProvider(this).get(WifiDppInitiatorViewModel.class);
 
         model.startEasyConnectAsConfiguratorInitiator(qrCode, networkId);
     }
@@ -403,6 +403,7 @@
     public interface OnClickChooseDifferentNetworkListener {
         void onClickChooseDifferentNetwork();
     }
+
     private OnClickChooseDifferentNetworkListener mClickChooseDifferentNetworkListener;
 
     @Override
@@ -422,7 +423,7 @@
     // Check is Easy Connect handshaking or not
     private boolean isEasyConnectHandshaking() {
         final WifiDppInitiatorViewModel model =
-                ViewModelProviders.of(this).get(WifiDppInitiatorViewModel.class);
+                new ViewModelProvider(this).get(WifiDppInitiatorViewModel.class);
 
         return model.isWifiDppHandshaking();
     }
diff --git a/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java b/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
index 3fd6c45..872c61a 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
@@ -53,7 +53,7 @@
 import androidx.annotation.StringRes;
 import androidx.annotation.UiThread;
 import androidx.annotation.VisibleForTesting;
-import androidx.lifecycle.ViewModelProviders;
+import androidx.lifecycle.ViewModelProvider;
 
 import com.android.settings.R;
 import com.android.settings.overlay.FeatureFactory;
@@ -298,7 +298,7 @@
         }
 
         final WifiDppInitiatorViewModel model =
-                ViewModelProviders.of(this).get(WifiDppInitiatorViewModel.class);
+                new ViewModelProvider(this).get(WifiDppInitiatorViewModel.class);
 
         model.getEnrolleeSuccessNetworkId().observe(this, networkId -> {
             // After configuration change, observe callback will be triggered,
@@ -719,7 +719,7 @@
 
     private void startWifiDppEnrolleeInitiator(WifiQrCode wifiQrCode) {
         final WifiDppInitiatorViewModel model =
-                ViewModelProviders.of(this).get(WifiDppInitiatorViewModel.class);
+                new ViewModelProvider(this).get(WifiDppInitiatorViewModel.class);
 
         model.startEasyConnectAsEnrolleeInitiator(wifiQrCode.getQrCode());
     }
@@ -765,7 +765,7 @@
     // Check is Easy Connect handshaking or not
     private boolean isWifiDppHandshaking() {
         final WifiDppInitiatorViewModel model =
-                ViewModelProviders.of(this).get(WifiDppInitiatorViewModel.class);
+                new ViewModelProvider(this).get(WifiDppInitiatorViewModel.class);
 
         return model.isWifiDppHandshaking();
     }
diff --git a/tests/robotests/Android.bp b/tests/robotests/Android.bp
index 26c4d19..9cc8439 100644
--- a/tests/robotests/Android.bp
+++ b/tests/robotests/Android.bp
@@ -39,7 +39,6 @@
         "setupcompat",
         "setupdesign",
         "androidx.lifecycle_lifecycle-runtime",
-        "androidx.lifecycle_lifecycle-extensions",
         "androidx.test.core",
         "androidx.test.runner",
         "androidx.test.ext.junit",
diff --git a/tests/robotests/src/com/android/settings/datetime/AutoTimeZonePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/datetime/AutoTimeZonePreferenceControllerTest.java
index e6a44a8..61fca2c 100644
--- a/tests/robotests/src/com/android/settings/datetime/AutoTimeZonePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/datetime/AutoTimeZonePreferenceControllerTest.java
@@ -16,6 +16,11 @@
 
 package com.android.settings.datetime;
 
+import static android.app.time.DetectorStatusTypes.DETECTION_ALGORITHM_STATUS_RUNNING;
+import static android.app.time.DetectorStatusTypes.DETECTOR_STATUS_RUNNING;
+import static android.app.time.LocationTimeZoneAlgorithmStatus.PROVIDER_STATUS_NOT_PRESENT;
+import static android.app.time.LocationTimeZoneAlgorithmStatus.PROVIDER_STATUS_NOT_READY;
+
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.Mockito.spy;
@@ -23,10 +28,13 @@
 import static org.mockito.Mockito.when;
 
 import android.app.time.Capabilities;
+import android.app.time.LocationTimeZoneAlgorithmStatus;
+import android.app.time.TelephonyTimeZoneAlgorithmStatus;
 import android.app.time.TimeManager;
 import android.app.time.TimeZoneCapabilities;
 import android.app.time.TimeZoneCapabilitiesAndConfig;
 import android.app.time.TimeZoneConfiguration;
+import android.app.time.TimeZoneDetectorStatus;
 import android.content.Context;
 import android.os.UserHandle;
 
@@ -215,6 +223,11 @@
 
     private static TimeZoneCapabilitiesAndConfig createCapabilitiesAndConfig(
             boolean autoSupported, boolean autoEnabled) {
+        TimeZoneDetectorStatus status = new TimeZoneDetectorStatus(DETECTOR_STATUS_RUNNING,
+                new TelephonyTimeZoneAlgorithmStatus(DETECTION_ALGORITHM_STATUS_RUNNING),
+                new LocationTimeZoneAlgorithmStatus(DETECTION_ALGORITHM_STATUS_RUNNING,
+                        PROVIDER_STATUS_NOT_READY, null,
+                        PROVIDER_STATUS_NOT_PRESENT, null));
         int configureAutoDetectionEnabledCapability =
                 autoSupported ? Capabilities.CAPABILITY_POSSESSED
                         : Capabilities.CAPABILITY_NOT_SUPPORTED;
@@ -227,6 +240,6 @@
                 .setAutoDetectionEnabled(autoEnabled)
                 .setGeoDetectionEnabled(false)
                 .build();
-        return new TimeZoneCapabilitiesAndConfig(capabilities, config);
+        return new TimeZoneCapabilitiesAndConfig(status, capabilities, config);
     }
 }
diff --git a/tests/robotests/src/com/android/settings/datetime/LocationTimeZoneDetectionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/datetime/LocationTimeZoneDetectionPreferenceControllerTest.java
index 32d27a9..ea83366 100644
--- a/tests/robotests/src/com/android/settings/datetime/LocationTimeZoneDetectionPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/datetime/LocationTimeZoneDetectionPreferenceControllerTest.java
@@ -19,6 +19,11 @@
 import static android.app.time.Capabilities.CAPABILITY_NOT_APPLICABLE;
 import static android.app.time.Capabilities.CAPABILITY_NOT_SUPPORTED;
 import static android.app.time.Capabilities.CAPABILITY_POSSESSED;
+import static android.app.time.DetectorStatusTypes.DETECTION_ALGORITHM_STATUS_NOT_SUPPORTED;
+import static android.app.time.DetectorStatusTypes.DETECTION_ALGORITHM_STATUS_RUNNING;
+import static android.app.time.DetectorStatusTypes.DETECTOR_STATUS_RUNNING;
+import static android.app.time.LocationTimeZoneAlgorithmStatus.PROVIDER_STATUS_NOT_PRESENT;
+import static android.app.time.LocationTimeZoneAlgorithmStatus.PROVIDER_STATUS_NOT_READY;
 
 import static com.google.common.truth.Truth.assertThat;
 
@@ -27,18 +32,20 @@
 import static org.mockito.Mockito.verifyNoInteractions;
 import static org.mockito.Mockito.when;
 
-import android.app.time.Capabilities;
+import android.app.time.Capabilities.CapabilityState;
+import android.app.time.LocationTimeZoneAlgorithmStatus;
+import android.app.time.TelephonyTimeZoneAlgorithmStatus;
 import android.app.time.TimeManager;
 import android.app.time.TimeZoneCapabilities;
 import android.app.time.TimeZoneCapabilitiesAndConfig;
 import android.app.time.TimeZoneConfiguration;
+import android.app.time.TimeZoneDetectorStatus;
 import android.content.Context;
 import android.location.LocationManager;
 import android.os.UserHandle;
 
 import com.android.settings.R;
 import com.android.settings.core.InstrumentedPreferenceFragment;
-import com.android.settingslib.core.lifecycle.Lifecycle;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -59,8 +66,6 @@
     private LocationTimeZoneDetectionPreferenceController mController;
     @Mock(answer = Answers.RETURNS_DEEP_STUBS)
     private InstrumentedPreferenceFragment mFragment;
-    @Mock
-    private Lifecycle mLifecycle;
 
     @Before
     public void setUp() {
@@ -116,11 +121,8 @@
 
     @Test
     public void testLocationTimeZoneDetection_supported_shouldBeShown() {
-        TimeZoneCapabilities capabilities =
-                createTimeZoneCapabilities(CAPABILITY_POSSESSED);
-        TimeZoneConfiguration configuration = createTimeZoneConfig(/* geoDetectionEnabled= */ true);
         TimeZoneCapabilitiesAndConfig capabilitiesAndConfig =
-                new TimeZoneCapabilitiesAndConfig(capabilities, configuration);
+                createTimeZoneCapabilitiesAndConfig(CAPABILITY_POSSESSED);
         when(mTimeManager.getTimeZoneCapabilitiesAndConfig()).thenReturn(capabilitiesAndConfig);
 
         assertThat(mController.isAvailable()).isTrue();
@@ -128,11 +130,8 @@
 
     @Test
     public void testLocationTimeZoneDetection_unsupported_shouldNotBeShown() {
-        TimeZoneCapabilities capabilities =
-                createTimeZoneCapabilities(CAPABILITY_NOT_SUPPORTED);
-        TimeZoneConfiguration configuration = createTimeZoneConfig(/* geoDetectionEnabled= */ true);
         TimeZoneCapabilitiesAndConfig capabilitiesAndConfig =
-                new TimeZoneCapabilitiesAndConfig(capabilities, configuration);
+                createTimeZoneCapabilitiesAndConfig(CAPABILITY_NOT_SUPPORTED);
         when(mTimeManager.getTimeZoneCapabilitiesAndConfig()).thenReturn(capabilitiesAndConfig);
 
         assertThat(mController.isAvailable()).isFalse();
@@ -143,11 +142,8 @@
      */
     @Test
     public void testLocationTimeZoneDetection_summary_geoDetectionEnabled() {
-        TimeZoneCapabilities capabilities =
-                createTimeZoneCapabilities(CAPABILITY_POSSESSED);
-        TimeZoneConfiguration configuration = createTimeZoneConfig(/* geoDetectionEnabled= */ true);
         TimeZoneCapabilitiesAndConfig capabilitiesAndConfig =
-                new TimeZoneCapabilitiesAndConfig(capabilities, configuration);
+                createTimeZoneCapabilitiesAndConfig(CAPABILITY_POSSESSED);
 
         when(mTimeManager.getTimeZoneCapabilitiesAndConfig()).thenReturn(capabilitiesAndConfig);
         assertThat(mController.getSummary()).isEqualTo(
@@ -156,11 +152,8 @@
 
     @Test
     public void testLocationTimeZoneDetection_toggleIsOn_whenGeoDetectionEnabledAnsMlsIsOff() {
-        TimeZoneCapabilities capabilities =
-                createTimeZoneCapabilities(CAPABILITY_NOT_APPLICABLE);
-        TimeZoneConfiguration configuration = createTimeZoneConfig(/* geoDetectionEnabled= */ true);
         TimeZoneCapabilitiesAndConfig capabilitiesAndConfig =
-                new TimeZoneCapabilitiesAndConfig(capabilities, configuration);
+                createTimeZoneCapabilitiesAndConfig(CAPABILITY_NOT_APPLICABLE);
 
         when(mTimeManager.getTimeZoneCapabilitiesAndConfig()).thenReturn(capabilitiesAndConfig);
         when(mLocationManager.isLocationEnabled()).thenReturn(false);
@@ -170,20 +163,43 @@
                 mContext.getString(R.string.location_app_permission_summary_location_off));
     }
 
-    private static TimeZoneCapabilities createTimeZoneCapabilities(
-            @Capabilities.CapabilityState int geoDetectionCapability) {
+    private static TimeZoneCapabilitiesAndConfig createTimeZoneCapabilitiesAndConfig(
+            @CapabilityState int configureGeoDetectionEnabledCapability) {
+
+        // Create a status that matches the user's capability state.
+        LocationTimeZoneAlgorithmStatus locationAlgorithmStatus;
+        switch (configureGeoDetectionEnabledCapability) {
+            case CAPABILITY_NOT_SUPPORTED:
+                locationAlgorithmStatus = new LocationTimeZoneAlgorithmStatus(
+                        DETECTION_ALGORITHM_STATUS_NOT_SUPPORTED,
+                        PROVIDER_STATUS_NOT_PRESENT, null, PROVIDER_STATUS_NOT_PRESENT, null);
+                break;
+            case CAPABILITY_NOT_APPLICABLE:
+            case CAPABILITY_POSSESSED:
+                locationAlgorithmStatus = new LocationTimeZoneAlgorithmStatus(
+                        DETECTION_ALGORITHM_STATUS_RUNNING,
+                        PROVIDER_STATUS_NOT_READY, null, PROVIDER_STATUS_NOT_READY, null);
+                break;
+            default:
+                throw new AssertionError(
+                        "Unsupported capability state: " + configureGeoDetectionEnabledCapability);
+        }
+        TimeZoneDetectorStatus status = new TimeZoneDetectorStatus(DETECTOR_STATUS_RUNNING,
+                new TelephonyTimeZoneAlgorithmStatus(DETECTION_ALGORITHM_STATUS_RUNNING),
+                locationAlgorithmStatus);
+
         UserHandle arbitraryUserHandle = UserHandle.of(123);
-        return new TimeZoneCapabilities.Builder(arbitraryUserHandle)
+        TimeZoneCapabilities capabilities = new TimeZoneCapabilities.Builder(arbitraryUserHandle)
                 .setConfigureAutoDetectionEnabledCapability(CAPABILITY_POSSESSED)
-                .setConfigureGeoDetectionEnabledCapability(geoDetectionCapability)
+                .setConfigureGeoDetectionEnabledCapability(configureGeoDetectionEnabledCapability)
                 .setSetManualTimeZoneCapability(CAPABILITY_NOT_APPLICABLE)
                 .build();
-    }
 
-    private static TimeZoneConfiguration createTimeZoneConfig(boolean geoDetectionEnabled) {
-        return new TimeZoneConfiguration.Builder()
+        TimeZoneConfiguration configuration = new TimeZoneConfiguration.Builder()
                 .setAutoDetectionEnabled(true)
-                .setGeoDetectionEnabled(geoDetectionEnabled)
+                .setGeoDetectionEnabled(true)
                 .build();
+
+        return new TimeZoneCapabilitiesAndConfig(status, capabilities, configuration);
     }
 }
diff --git a/tests/robotests/src/com/android/settings/datetime/TimeZonePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/datetime/TimeZonePreferenceControllerTest.java
index d07d68b..77ab9a2 100644
--- a/tests/robotests/src/com/android/settings/datetime/TimeZonePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/datetime/TimeZonePreferenceControllerTest.java
@@ -16,6 +16,11 @@
 
 package com.android.settings.datetime;
 
+import static android.app.time.DetectorStatusTypes.DETECTION_ALGORITHM_STATUS_RUNNING;
+import static android.app.time.DetectorStatusTypes.DETECTOR_STATUS_RUNNING;
+import static android.app.time.LocationTimeZoneAlgorithmStatus.PROVIDER_STATUS_NOT_PRESENT;
+import static android.app.time.LocationTimeZoneAlgorithmStatus.PROVIDER_STATUS_NOT_READY;
+
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.Mockito.doReturn;
@@ -23,10 +28,13 @@
 import static org.mockito.Mockito.when;
 
 import android.app.time.Capabilities;
+import android.app.time.LocationTimeZoneAlgorithmStatus;
+import android.app.time.TelephonyTimeZoneAlgorithmStatus;
 import android.app.time.TimeManager;
 import android.app.time.TimeZoneCapabilities;
 import android.app.time.TimeZoneCapabilitiesAndConfig;
 import android.app.time.TimeZoneConfiguration;
+import android.app.time.TimeZoneDetectorStatus;
 import android.content.Context;
 import android.os.UserHandle;
 
@@ -97,6 +105,11 @@
 
     private static TimeZoneCapabilitiesAndConfig createCapabilitiesAndConfig(
             boolean suggestManualAllowed) {
+        TimeZoneDetectorStatus status = new TimeZoneDetectorStatus(DETECTOR_STATUS_RUNNING,
+                new TelephonyTimeZoneAlgorithmStatus(DETECTION_ALGORITHM_STATUS_RUNNING),
+                new LocationTimeZoneAlgorithmStatus(DETECTION_ALGORITHM_STATUS_RUNNING,
+                        PROVIDER_STATUS_NOT_READY, null,
+                        PROVIDER_STATUS_NOT_PRESENT, null));
         int suggestManualCapability = suggestManualAllowed ? Capabilities.CAPABILITY_POSSESSED
                 : Capabilities.CAPABILITY_NOT_SUPPORTED;
         TimeZoneCapabilities capabilities = new TimeZoneCapabilities.Builder(UserHandle.SYSTEM)
@@ -108,6 +121,6 @@
                 .setAutoDetectionEnabled(!suggestManualAllowed)
                 .setGeoDetectionEnabled(false)
                 .build();
-        return new TimeZoneCapabilitiesAndConfig(capabilities, config);
+        return new TimeZoneCapabilitiesAndConfig(status, capabilities, config);
     }
 }
diff --git a/tests/robotests/src/com/android/settings/notification/RedactionInterstitialTest.java b/tests/robotests/src/com/android/settings/notification/RedactionInterstitialTest.java
index 9d475b8..5c6da49 100644
--- a/tests/robotests/src/com/android/settings/notification/RedactionInterstitialTest.java
+++ b/tests/robotests/src/com/android/settings/notification/RedactionInterstitialTest.java
@@ -21,7 +21,6 @@
 import com.android.settings.R;
 import com.android.settings.RestrictedRadioButton;
 import com.android.settings.notification.RedactionInterstitial.RedactionInterstitialFragment;
-import com.android.settings.testutils.shadow.SettingsShadowResources;
 import com.android.settings.testutils.shadow.ShadowRestrictedLockUtilsInternal;
 import com.android.settings.testutils.shadow.ShadowUtils;
 
@@ -39,7 +38,6 @@
 @Config(shadows = {
         ShadowUtils.class,
         ShadowRestrictedLockUtilsInternal.class,
-        SettingsShadowResources.class,
 })
 public class RedactionInterstitialTest {
     private RedactionInterstitial mActivity;
@@ -136,28 +134,6 @@
         assertSelectedButton(R.id.redact_sensitive);
     }
 
-    @Test
-    public void defaultShowSensitiveContent_configDeny() {
-        final ContentResolver resolver = RuntimeEnvironment.application.getContentResolver();
-        Settings.Secure.putIntForUser(resolver,
-                LOCK_SCREEN_SHOW_NOTIFICATIONS, 1, UserHandle.myUserId());
-        setupConfig(false);
-        setupActivity();
-
-        assertSelectedButton(R.id.redact_sensitive);
-    }
-
-    @Test
-    public void defaultShowSensitiveContent_configAllow() {
-        final ContentResolver resolver = RuntimeEnvironment.application.getContentResolver();
-        Settings.Secure.putIntForUser(resolver,
-                LOCK_SCREEN_SHOW_NOTIFICATIONS, 1, UserHandle.myUserId());
-        setupConfig(true);
-        setupActivity();
-
-        assertSelectedButton(R.id.show_all);
-    }
-
     private void setupActivity() {
         mActivity = buildActivity(RedactionInterstitial.class, new Intent()).setup().get();
         mFragment = (RedactionInterstitialFragment)
@@ -166,11 +142,6 @@
         assertThat(mFragment).isNotNull();
     }
 
-    private void setupConfig(boolean allowSensitiveContent) {
-        SettingsShadowResources.overrideResource(
-                R.bool.default_allow_sensitive_lockscreen_content, allowSensitiveContent);
-    }
-
     private void setupSettings(int show, int showUnredacted) {
         final ContentResolver resolver = RuntimeEnvironment.application.getContentResolver();
         Settings.Secure.putIntForUser(resolver,