Merge "Correct breadcrumbs of Wi-Fi scanning and Bluetooth scanning" into sc-dev
diff --git a/res/layout/manage_applications_apps.xml b/res/layout/manage_applications_apps.xml
index 7ea8803..f8f4a76 100644
--- a/res/layout/manage_applications_apps.xml
+++ b/res/layout/manage_applications_apps.xml
@@ -20,13 +20,6 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent">
 
-    <FrameLayout
-        android:id="@+id/pinned_header"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:elevation="2dp"
-        settings:layout_constraintTop_toTopOf="parent"/>
-
     <androidx.recyclerview.widget.RecyclerView
         android:id="@+id/apps_list"
         android:layout_width="match_parent"
@@ -57,5 +50,12 @@
         settings:layout_constraintTop_toBottomOf="@id/pinned_header"
         settings:layout_constraintBottom_toBottomOf="parent"/>
 
+    <FrameLayout
+        android:id="@+id/pinned_header"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="?android:colorBackground"
+        settings:layout_constraintTop_toTopOf="parent"/>
+
 </androidx.constraintlayout.widget.ConstraintLayout>
 
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 00577cd..3450665 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -1575,14 +1575,6 @@
         <item>@string/rtt_settings_always_visible</item>
     </string-array>
 
-    <!-- Array of titles list for one-handed timeout options. [DO NOT TRANSLATE] -->
-    <string-array name="one_handed_timeout_title" translatable="false">
-        <item>@string/screensaver_settings_summary_never</item>
-        <item>@string/one_handed_timeout_short</item>
-        <item>@string/one_handed_timeout_medium</item>
-        <item>@string/one_handed_timeout_long</item>
-    </string-array>
-
     <!-- Values of list for one-handed timeout options. [DO NOT TRANSLATE] -->
     <string-array name="one_handed_timeout_values" translatable="false">
         <item>0</item>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 26fbd79..32914b8 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -6155,11 +6155,11 @@
     <!-- Summary for the battery limited temporarily tip [CHAR LIMIT=NONE] -->
     <string name="battery_tip_limited_temporarily_summary">To preserve your battery. Learn more.</string>
     <!-- Message for battery tip dialog to show the status about the battery [CHAR LIMIT=NONE] -->
-    <string name="battery_tip_dialog_message" product="default">Your phone has been used more than usual. Your battery may run out sooner than expected.\n\nTop apps by battery usage:</string>
+    <string name="battery_tip_dialog_message" product="default">Because you’ve used your phone more than usual, your battery may run out sooner than it normally would.\n\nApps using most battery:</string>
     <!-- Message for battery tip dialog to show the status about the battery [CHAR LIMIT=NONE] -->
-    <string name="battery_tip_dialog_message" product="tablet">Your tablet has been used more than usual. Your battery may run out sooner than expected.\n\nTop apps by battery usage:</string>
+    <string name="battery_tip_dialog_message" product="tablet">Because you’ve used your tablet more than usual, your battery may run out sooner than it normally would.\n\nApps using most battery:</string>
     <!-- Message for battery tip dialog to show the status about the battery [CHAR LIMIT=NONE] -->
-    <string name="battery_tip_dialog_message" product="device">Your device has been used more than usual. Your battery may run out sooner than expected.\n\nTop apps by battery usage:</string>
+    <string name="battery_tip_dialog_message" product="device">Because you’ve used your device more than usual, your battery may run out sooner than it normally would.\n\nApps using most battery:</string>
     <!-- Footer message for battery tip dialog to show the status about the battery [CHAR LIMIT=NONE] -->
     <string name="battery_tip_dialog_message_footer">Includes high-power background activity</string>
     <!-- Title for restricted app preference, showing how many app need to be restricted [CHAR LIMIT=NONE] -->
@@ -6788,6 +6788,10 @@
     <string name="adaptive_connectivity_title">Adaptive connectivity</string>
     <!-- Summary of Adaptive connectivity preference. [CHAR LIMIT=NONE] -->
     <string name="adaptive_connectivity_summary">Extends battery life and improves device performance by automatically managing your network connections</string>
+    <!-- Switch on text of Adaptive connectivity preference. [CHAR LIMIT=NONE]-->
+    <string name="adaptive_connectivity_switch_on">On</string>
+    <!-- Switch off text of Adaptive connectivity preference. [CHAR LIMIT=NONE]-->
+    <string name="adaptive_connectivity_switch_off">Off</string>
 
     <!-- Title of preference group for credential storage settings [CHAR LIMIT=30] -->
     <string name="credentials_title">Credential storage</string>
@@ -11585,10 +11589,10 @@
 
     <!-- [CHAR LIMIT=60] Title of work profile setting page -->
     <string name="managed_profile_settings_title">Work profile settings</string>
-    <!-- [CHAR LIMIT=60] The preference title for enabling cross-profile remote contact search -->
-    <string name="managed_profile_contact_search_title">Contact search</string>
-    <!-- [CHAR LIMIT=NONE] The preference summary for enabling cross-profile remote contact search -->
-    <string name="managed_profile_contact_search_summary">Allow contact searches by your organization to identify callers and contacts</string>
+    <!-- [CHAR LIMIT=NONE] Settings toggle. This setting lets a user's personal apps identify contacts using the user's work directory. -->
+    <string name="managed_profile_contact_search_title">Let personal apps identify contacts using work directory</string>
+    <!-- [CHAR LIMIT=NONE] Settings toggle description. This setting lets a user's personal apps identify contacts using the user's work directory. "Searches" is a noun. -->
+    <string name="managed_profile_contact_search_summary">Searches and incoming calls may be visible to your IT admin</string>
     <!-- [CHAR LIMIT=NONE] Settings label. This setting lets the user show their work events on their personal calendar. The adjective 'Cross-profile' is referring to the work and personal profiles a user has on their phone. -->
     <string name="cross_profile_calendar_title">Cross-profile calendar</string>
     <!-- [CHAR LIMIT=NONE] Setting description. If the user turns on this setting, they can see their work events on their personal calendar. -->
@@ -11740,29 +11744,16 @@
     <!-- Preference and settings suggestion title text for ambient display double tap (device) [CHAR LIMIT=60]-->
     <string name="ambient_display_title" product="device">Double-tap to check device</string>
 
-    <!-- Title text for swiping downwards on the bottom of the screen for notifications [CHAR LIMIT=60]-->
-    <string name="swipe_bottom_to_notifications_title">Swipe for notifications</string>
-    <!-- Summary text for swiping downwards on the bottom of the screen for notifications [CHAR LIMIT=NONE]-->
-    <string name="swipe_bottom_to_notifications_summary">Swipe down on the bottom edge of the screen to show your notifications.\nYou can\'t use one-handed mode when this feature is turned on.</string>
-
     <!-- Preference and settings suggestion title text for one handed [CHAR LIMIT=60] -->
     <string name="one_handed_title">One-handed mode</string>
     <!-- Preference Switch for enabling one handed [CHAR LIMIT=60] -->
     <string name="one_handed_mode_enabled">Use one-handed mode</string>
-    <!-- Preference Switch for app taps to exit one handed [CHAR LIMIT=60] -->
-    <string name="one_handed_app_taps_to_exit">Exit when switching apps</string>
-    <!-- Timeout(Never) title for one handed [CHAR LIMIT=60] -->
-    <string name="one_handed_timeout_title">Timeout</string>
-    <!-- Timeout(Short) title for one handed [CHAR LIMIT=60] -->
-    <string name="one_handed_timeout_short">4 seconds</string>
-    <!-- Timeout(Medium) title for one handed [CHAR LIMIT=60] -->
-    <string name="one_handed_timeout_medium">8 seconds</string>
-    <!-- Timeout(Long) title for one handed [CHAR LIMIT=60] -->
-    <string name="one_handed_timeout_long">12 seconds</string>
     <!-- Search keywords for "One-Handed" settings [CHAR_LIMIT=NONE] -->
     <string name="keywords_one_handed">reachability</string>
     <!-- Category title for one handed swipe down [CHAR_LIMIT=60] -->
     <string name="one_handed_mode_swipe_down_category">Swipe down to</string>
+    <!-- Category title for one handed use the shortcut [CHAR_LIMIT=60] -->
+    <string name="one_handed_mode_use_shortcut_category">Use the shortcut to</string>
     <!-- One-handed mode Intro Text [CHAR_LIMIT=NONE] -->
     <string name="one_handed_mode_intro_text">To use one handed mode, swipe down from the bottom edge of the screen. To use this feature, make sure gesture navigation is turned on in system navigation settings.</string>
     <!-- One-handed mode pull down screen into reach action title [CHAR_LIMIT=60] -->
diff --git a/res/xml/one_handed_settings.xml b/res/xml/one_handed_settings.xml
index 8893e1e..2f5c091 100644
--- a/res/xml/one_handed_settings.xml
+++ b/res/xml/one_handed_settings.xml
@@ -39,7 +39,8 @@
 
     <PreferenceCategory
         android:key="gesture_one_handed_mode_swipe_down"
-        android:title="@string/one_handed_mode_swipe_down_category">
+        android:title="@string/one_handed_mode_swipe_down_category"
+        settings:controller="com.android.settings.gestures.OneHandedPreferenceCategoryController">
 
         <com.android.settingslib.widget.RadioButtonPreference
             android:key="gesture_one_handed_action_pull_screen_down"
@@ -54,5 +55,4 @@
             settings:controller="com.android.settings.gestures.OneHandedActionShowNotificationPrefController"/>
 
     </PreferenceCategory>
-
 </PreferenceScreen>
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index 12f63ea..f3cdd6c 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -574,7 +574,7 @@
     /**
      * Switch to a specific Fragment with taking care of validation, Title and BackStack
      */
-    private Fragment switchToFragment(String fragmentName, Bundle args, boolean validate,
+    private void switchToFragment(String fragmentName, Bundle args, boolean validate,
             int titleResId, CharSequence title) {
         Log.d(LOG_TAG, "Switching to fragment " + fragmentName);
         if (validate && !isValidFragment(fragmentName)) {
@@ -582,6 +582,9 @@
                     + fragmentName);
         }
         Fragment f = Utils.getTargetFragment(this, fragmentName, args);
+        if (f == null) {
+            return;
+        }
         FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
         transaction.replace(R.id.main_content, f);
         if (titleResId > 0) {
@@ -592,7 +595,6 @@
         transaction.commitAllowingStateLoss();
         getSupportFragmentManager().executePendingTransactions();
         Log.d(LOG_TAG, "Executed frag manager pendingTransactions");
-        return f;
     }
 
     private void updateTilesList() {
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index 708dbed..e79852b 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -1158,13 +1158,17 @@
                 == ProfileSelectFragment.ProfileType.PERSONAL : false;
         final boolean isWork = args != null ? args.getInt(ProfileSelectFragment.EXTRA_PROFILE)
                 == ProfileSelectFragment.ProfileType.WORK : false;
-        if (activity.getSystemService(UserManager.class).getUserProfiles().size() > 1
-                && ProfileFragmentBridge.FRAGMENT_MAP.get(fragmentName) != null
-                && !isWork && !isPersonal) {
-            f = Fragment.instantiate(activity, ProfileFragmentBridge.FRAGMENT_MAP.get(fragmentName),
-                    args);
-        } else {
-            f = Fragment.instantiate(activity, fragmentName, args);
+        try {
+            if (activity.getSystemService(UserManager.class).getUserProfiles().size() > 1
+                    && ProfileFragmentBridge.FRAGMENT_MAP.get(fragmentName) != null
+                    && !isWork && !isPersonal) {
+                f = Fragment.instantiate(activity,
+                        ProfileFragmentBridge.FRAGMENT_MAP.get(fragmentName), args);
+            } else {
+                f = Fragment.instantiate(activity, fragmentName, args);
+            }
+        } catch (Exception e) {
+            Log.e(TAG, "Unable to get target fragment", e);
         }
         return f;
     }
diff --git a/src/com/android/settings/applications/appinfo/AppBatteryPreferenceController.java b/src/com/android/settings/applications/appinfo/AppBatteryPreferenceController.java
index 89c3478..f0285bc 100644
--- a/src/com/android/settings/applications/appinfo/AppBatteryPreferenceController.java
+++ b/src/com/android/settings/applications/appinfo/AppBatteryPreferenceController.java
@@ -78,6 +78,7 @@
     private String mBatteryPercent;
     private final String mPackageName;
     private final int mUid;
+    private final int mUserId;
     private boolean mBatteryUsageStatsLoaded = false;
     private boolean mBatteryDiffEntriesLoaded = false;
 
@@ -88,6 +89,7 @@
         mBatteryUtils = BatteryUtils.getInstance(mContext);
         mPackageName = packageName;
         mUid = uid;
+        mUserId = mContext.getUserId();
         refreshFeatureFlag(mContext);
         if (lifecycle != null) {
             lifecycle.addObserver(this);
@@ -173,16 +175,29 @@
             protected BatteryDiffEntry doInBackground(Void... unused) {
                 final List<BatteryDiffEntry> batteryDiffEntries =
                         BatteryChartPreferenceController.getBatteryLast24HrUsageData(mContext);
-                if (batteryDiffEntries != null) {
-                    for (BatteryDiffEntry batteryDiffEntry : batteryDiffEntries) {
-                        if (batteryDiffEntry.mBatteryHistEntry.mUid == mUid
-                                && batteryDiffEntry.mBatteryHistEntry.mConsumerType
-                                == ConvertUtils.CONSUMER_TYPE_UID_BATTERY) {
-                            return batteryDiffEntry;
-                        }
-                    }
+                if (batteryDiffEntries == null) {
+                    return null;
                 }
-                return null;
+                // Filter entry with consumer type to avoid system app,
+                // then use user id to divide normal app and work profile app,
+                // return target application from filter list by package name.
+                return batteryDiffEntries.stream()
+                        .filter(entry -> entry.mBatteryHistEntry.mConsumerType
+                                == ConvertUtils.CONSUMER_TYPE_UID_BATTERY)
+                        .filter(entry -> entry.mBatteryHistEntry.mUserId == mUserId)
+                        .filter(entry -> {
+                            if (entry.mBatteryHistEntry.mPackageName
+                                    .equals(mPackageName)) {
+                                Log.i(TAG, "Return target application: "
+                                        + entry.mBatteryHistEntry.mPackageName
+                                        + " | uid: " + entry.mBatteryHistEntry.mUid
+                                        + " | userId: " + entry.mBatteryHistEntry.mUserId);
+                                return true;
+                            }
+                            return false;
+                        })
+                        .findFirst()
+                        .orElse(/* other */null);
             }
 
             @Override
diff --git a/src/com/android/settings/biometrics/BiometricEnrollActivity.java b/src/com/android/settings/biometrics/BiometricEnrollActivity.java
index 3b8f255..26d8a45 100644
--- a/src/com/android/settings/biometrics/BiometricEnrollActivity.java
+++ b/src/com/android/settings/biometrics/BiometricEnrollActivity.java
@@ -242,6 +242,7 @@
         // This will need to be updated if the device has sensors other than BIOMETRIC_STRONG
         if (!setupWizard && authenticators == BiometricManager.Authenticators.DEVICE_CREDENTIAL) {
             launchCredentialOnlyEnroll();
+            finish();
         } else if (canUseFace && canUseFingerprint) {
             if (mParentalOptionsRequired && mGkPwHandle != null) {
                 launchFaceAndFingerprintEnroll();
@@ -405,22 +406,6 @@
         super.onApplyThemeResource(theme, newResid, first);
     }
 
-    @Override
-    protected void onStop() {
-        super.onStop();
-
-        if (mConfirmingCredentials
-                || mParentalOptionsRequired
-                || mMultiBiometricEnrollHelper != null) {
-            return;
-        }
-
-        if (!isChangingConfigurations()) {
-            Log.d(TAG, "Finishing in onStop");
-            finish();
-        }
-    }
-
     private void setOrConfirmCredentialsNow() {
         if (!mConfirmingCredentials) {
             mConfirmingCredentials = true;
diff --git a/src/com/android/settings/connecteddevice/usb/UsbDetailsFragment.java b/src/com/android/settings/connecteddevice/usb/UsbDetailsFragment.java
index 8d14cf9..8850acd 100644
--- a/src/com/android/settings/connecteddevice/usb/UsbDetailsFragment.java
+++ b/src/com/android/settings/connecteddevice/usb/UsbDetailsFragment.java
@@ -107,7 +107,7 @@
                 @Override
                 protected boolean isPageSearchEnabled(Context context) {
                     return checkIfUsbDataSignalingIsDisabled(
-                            context, UserHandle.myUserId()) != null;
+                            context, UserHandle.myUserId()) == null;
                 }
 
                 @Override
diff --git a/src/com/android/settings/gestures/OneHandedActionPullDownPrefController.java b/src/com/android/settings/gestures/OneHandedActionPullDownPrefController.java
index 84ea8b6..e17165b 100644
--- a/src/com/android/settings/gestures/OneHandedActionPullDownPrefController.java
+++ b/src/com/android/settings/gestures/OneHandedActionPullDownPrefController.java
@@ -92,7 +92,8 @@
         if (mPreference == null) {
             return;
         }
-        if (uri.equals(OneHandedSettingsUtils.ONE_HANDED_MODE_ENABLED_URI)) {
+        if (uri.equals(OneHandedSettingsUtils.ONE_HANDED_MODE_ENABLED_URI)
+                || uri.equals(OneHandedSettingsUtils.SHORTCUT_ENABLED_URI)) {
             mPreference.setEnabled(OneHandedSettingsUtils.canEnableController(mContext));
         } else if (uri.equals(OneHandedSettingsUtils.SHOW_NOTIFICATION_ENABLED_URI)) {
             updateState(mPreference);
diff --git a/src/com/android/settings/gestures/OneHandedActionShowNotificationPrefController.java b/src/com/android/settings/gestures/OneHandedActionShowNotificationPrefController.java
index 5644299..9f56a14 100644
--- a/src/com/android/settings/gestures/OneHandedActionShowNotificationPrefController.java
+++ b/src/com/android/settings/gestures/OneHandedActionShowNotificationPrefController.java
@@ -92,7 +92,8 @@
         if (mPreference == null) {
             return;
         }
-        if (uri.equals(OneHandedSettingsUtils.ONE_HANDED_MODE_ENABLED_URI)) {
+        if (uri.equals(OneHandedSettingsUtils.ONE_HANDED_MODE_ENABLED_URI)
+                || uri.equals(OneHandedSettingsUtils.SHORTCUT_ENABLED_URI)) {
             mPreference.setEnabled(OneHandedSettingsUtils.canEnableController(mContext));
         } else if (uri.equals(OneHandedSettingsUtils.SHOW_NOTIFICATION_ENABLED_URI)) {
             updateState(mPreference);
diff --git a/src/com/android/settings/gestures/OneHandedEnablePreferenceController.java b/src/com/android/settings/gestures/OneHandedEnablePreferenceController.java
index bd8de9f..29004c8 100644
--- a/src/com/android/settings/gestures/OneHandedEnablePreferenceController.java
+++ b/src/com/android/settings/gestures/OneHandedEnablePreferenceController.java
@@ -17,7 +17,6 @@
 package com.android.settings.gestures;
 
 import android.content.Context;
-import android.provider.Settings;
 
 import com.android.settings.R;
 import com.android.settings.core.BasePreferenceController;
@@ -27,8 +26,6 @@
  */
 public class OneHandedEnablePreferenceController extends BasePreferenceController {
 
-    private static final String ONE_HANDED_ENABLED = Settings.Secure.ONE_HANDED_MODE_ENABLED;
-
     public OneHandedEnablePreferenceController(Context context, String preferenceKey) {
         super(context, preferenceKey);
     }
@@ -44,5 +41,4 @@
                 OneHandedSettingsUtils.isOneHandedModeEnabled(mContext)
                         ? R.string.gesture_setting_on : R.string.gesture_setting_off);
     }
-
 }
diff --git a/src/com/android/settings/gestures/OneHandedPreferenceCategoryController.java b/src/com/android/settings/gestures/OneHandedPreferenceCategoryController.java
new file mode 100644
index 0000000..9623299
--- /dev/null
+++ b/src/com/android/settings/gestures/OneHandedPreferenceCategoryController.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.gestures;
+
+import android.content.Context;
+
+import androidx.preference.Preference;
+import androidx.preference.PreferenceScreen;
+
+import com.android.settings.R;
+import com.android.settings.core.BasePreferenceController;
+
+/**
+ * Category Preference controller for One-handed mode category
+ */
+public class OneHandedPreferenceCategoryController extends BasePreferenceController {
+
+    private Preference mPreference;
+
+    public OneHandedPreferenceCategoryController(Context context, String preferenceKey) {
+        super(context, preferenceKey);
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        return AVAILABLE;
+    }
+
+    @Override
+    public void displayPreference(PreferenceScreen screen) {
+        super.displayPreference(screen);
+        mPreference = screen.findPreference(getPreferenceKey());
+        mPreference.setTitle(
+                OneHandedSettingsUtils.getNavigationBarMode(mContext) == 0 /* 3 button */
+                ? R.string.one_handed_mode_use_shortcut_category
+                : R.string.one_handed_mode_swipe_down_category);
+    }
+}
diff --git a/src/com/android/settings/gestures/OneHandedSettingsUtils.java b/src/com/android/settings/gestures/OneHandedSettingsUtils.java
index a931129..f058689 100644
--- a/src/com/android/settings/gestures/OneHandedSettingsUtils.java
+++ b/src/com/android/settings/gestures/OneHandedSettingsUtils.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.gestures;
 
+import static com.android.internal.accessibility.AccessibilityShortcutController.ONE_HANDED_COMPONENT_NAME;
+
 import android.content.ContentResolver;
 import android.content.Context;
 import android.database.ContentObserver;
@@ -33,6 +35,9 @@
  */
 public class OneHandedSettingsUtils {
 
+    static final String ONE_HANDED_MODE_TARGET_NAME =
+            ONE_HANDED_COMPONENT_NAME.getShortClassName();
+
     static final String SUPPORT_ONE_HANDED_MODE = "ro.support_one_handed_mode";
     static final int OFF = 0;
     static final int ON = 1;
@@ -40,6 +45,8 @@
             Settings.Secure.getUriFor(Settings.Secure.ONE_HANDED_MODE_ENABLED);
     static final Uri SHOW_NOTIFICATION_ENABLED_URI =
             Settings.Secure.getUriFor(Settings.Secure.SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED);
+    static final Uri SHORTCUT_ENABLED_URI =
+            Settings.Secure.getUriFor(Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS);
 
     public enum OneHandedTimeout {
         NEVER(0), SHORT(4), MEDIUM(8), LONG(12);
@@ -220,8 +227,30 @@
      * navigation settings.
      */
     public static boolean canEnableController(Context context) {
-        return (OneHandedSettingsUtils.isOneHandedModeEnabled(context)
-                && OneHandedSettingsUtils.getNavigationBarMode(context) != 0 /* 3-button mode */);
+        return ((OneHandedSettingsUtils.isOneHandedModeEnabled(context)
+                && getNavigationBarMode(context) != 0 /* 3-button */)
+                || getShortcutEnabled(context));
+    }
+
+    /**
+     * Queries one-handed mode shortcut enabled in settings or not.
+     *
+     * @return true if user enabled one-handed shortcut in settings, false otherwise.
+     */
+    public static boolean getShortcutEnabled(Context context) {
+        final String targets = Settings.Secure.getStringForUser(context.getContentResolver(),
+                Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS, sCurrentUserId);
+        return targets != null ? targets.contains(ONE_HANDED_MODE_TARGET_NAME) : false;
+    }
+
+    /**
+     * This is a test only API for set Shortcut enabled or not.
+     */
+    @VisibleForTesting
+    public void setShortcutEnabled(Context context, boolean enabled) {
+        final String targetName = enabled ? ONE_HANDED_MODE_TARGET_NAME : "";
+        Settings.Secure.putStringForUser(context.getContentResolver(),
+                Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS, targetName, sCurrentUserId);
     }
 
     /**
@@ -256,6 +285,7 @@
             final ContentResolver resolver = mContext.getContentResolver();
             resolver.registerContentObserver(ONE_HANDED_MODE_ENABLED_URI, true, this);
             resolver.registerContentObserver(SHOW_NOTIFICATION_ENABLED_URI, true, this);
+            resolver.registerContentObserver(SHORTCUT_ENABLED_URI, true, this);
         }
 
         @Override
diff --git a/src/com/android/settings/network/AdaptiveConnectivityPreferenceController.java b/src/com/android/settings/network/AdaptiveConnectivityPreferenceController.java
index 33d1d5b..a938515 100644
--- a/src/com/android/settings/network/AdaptiveConnectivityPreferenceController.java
+++ b/src/com/android/settings/network/AdaptiveConnectivityPreferenceController.java
@@ -48,7 +48,7 @@
     public CharSequence getSummary() {
         return Settings.Secure.getInt(mContext.getContentResolver(),
                 Settings.Secure.ADAPTIVE_CONNECTIVITY_ENABLED, 1) == 1
-                ? mContext.getString(R.string.switch_on_text)
-                : mContext.getString(R.string.switch_off_text);
+                ? mContext.getString(R.string.adaptive_connectivity_switch_on)
+                : mContext.getString(R.string.adaptive_connectivity_switch_off);
     }
 }
diff --git a/src/com/android/settings/network/ProviderModelSliceHelper.java b/src/com/android/settings/network/ProviderModelSliceHelper.java
index 16d5c92..6ecaae5 100644
--- a/src/com/android/settings/network/ProviderModelSliceHelper.java
+++ b/src/com/android/settings/network/ProviderModelSliceHelper.java
@@ -80,8 +80,7 @@
     public boolean hasCarrier() {
         if (isAirplaneModeEnabled()
                 || mSubscriptionManager == null || mTelephonyManager == null
-                || mSubscriptionManager.getDefaultDataSubscriptionId()
-                == mSubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+                || mSubscriptionManager.getActiveSubscriptionIdList().length <= 0) {
             return false;
         }
         return true;
diff --git a/src/com/android/settings/notification/history/NotificationSbnViewHolder.java b/src/com/android/settings/notification/history/NotificationSbnViewHolder.java
index c98b036..166ee5d 100644
--- a/src/com/android/settings/notification/history/NotificationSbnViewHolder.java
+++ b/src/com/android/settings/notification/history/NotificationSbnViewHolder.java
@@ -65,9 +65,6 @@
     }
 
     void setTitle(CharSequence title) {
-        if (title == null) {
-            return;
-        }
         mTitle.setText(title);
     }
 
diff --git a/tests/robotests/src/com/android/settings/gestures/OneHandedActionPullDownPrefControllerTest.java b/tests/robotests/src/com/android/settings/gestures/OneHandedActionPullDownPrefControllerTest.java
index 60398de..36938c2 100644
--- a/tests/robotests/src/com/android/settings/gestures/OneHandedActionPullDownPrefControllerTest.java
+++ b/tests/robotests/src/com/android/settings/gestures/OneHandedActionPullDownPrefControllerTest.java
@@ -105,4 +105,26 @@
         assertThat(mController.getAvailabilityStatus())
                 .isEqualTo(BasePreferenceController.DISABLED_DEPENDENT_SETTING);
     }
+
+    @Test
+    public void getAvailabilityStatus_setShortcutEnabled_shouldEnabled() {
+        SystemProperties.set(OneHandedSettingsUtils.SUPPORT_ONE_HANDED_MODE, "true");
+        OneHandedSettingsUtils.setOneHandedModeEnabled(mContext, false);
+        mUtils.setNavigationBarMode(mContext, "0" /* 3-button mode */);
+        mUtils.setShortcutEnabled(mContext, true);
+
+        assertThat(mController.getAvailabilityStatus())
+                .isEqualTo(BasePreferenceController.AVAILABLE);
+    }
+
+    @Test
+    public void getAvailabilityStatus_setShortcutDisabled_shouldDisabled() {
+        SystemProperties.set(OneHandedSettingsUtils.SUPPORT_ONE_HANDED_MODE, "true");
+        OneHandedSettingsUtils.setOneHandedModeEnabled(mContext, false);
+        mUtils.setNavigationBarMode(mContext, "0" /* 3-button mode */);
+        mUtils.setShortcutEnabled(mContext, false);
+
+        assertThat(mController.getAvailabilityStatus())
+                .isEqualTo(BasePreferenceController.DISABLED_DEPENDENT_SETTING);
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/gestures/OneHandedActionShowNotificationPrefControllerTest.java b/tests/robotests/src/com/android/settings/gestures/OneHandedActionShowNotificationPrefControllerTest.java
index b56a4f7..a7afccd 100644
--- a/tests/robotests/src/com/android/settings/gestures/OneHandedActionShowNotificationPrefControllerTest.java
+++ b/tests/robotests/src/com/android/settings/gestures/OneHandedActionShowNotificationPrefControllerTest.java
@@ -104,4 +104,26 @@
         assertThat(mController.getAvailabilityStatus())
                 .isEqualTo(BasePreferenceController.DISABLED_DEPENDENT_SETTING);
     }
+
+    @Test
+    public void getAvailabilityStatus_setShortcutEnabled_shouldEnabled() {
+        SystemProperties.set(OneHandedSettingsUtils.SUPPORT_ONE_HANDED_MODE, "true");
+        OneHandedSettingsUtils.setOneHandedModeEnabled(mContext, false);
+        mUtils.setNavigationBarMode(mContext, "0" /* 3-button mode */);
+        mUtils.setShortcutEnabled(mContext, true);
+
+        assertThat(mController.getAvailabilityStatus())
+                .isEqualTo(BasePreferenceController.AVAILABLE);
+    }
+
+    @Test
+    public void getAvailabilityStatus_setShortcutDisabled_shouldDisabled() {
+        SystemProperties.set(OneHandedSettingsUtils.SUPPORT_ONE_HANDED_MODE, "true");
+        OneHandedSettingsUtils.setOneHandedModeEnabled(mContext, false);
+        mUtils.setNavigationBarMode(mContext, "0" /* 3-button mode */);
+        mUtils.setShortcutEnabled(mContext, false);
+
+        assertThat(mController.getAvailabilityStatus())
+                .isEqualTo(BasePreferenceController.DISABLED_DEPENDENT_SETTING);
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/gestures/OneHandedPreferenceCategoryControllerTest.java b/tests/robotests/src/com/android/settings/gestures/OneHandedPreferenceCategoryControllerTest.java
new file mode 100644
index 0000000..112e04a
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/gestures/OneHandedPreferenceCategoryControllerTest.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.gestures;
+
+import static junit.framework.TestCase.assertTrue;
+
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.os.UserHandle;
+import android.text.TextUtils;
+
+import androidx.preference.PreferenceCategory;
+import androidx.preference.PreferenceScreen;
+
+import com.android.settings.R;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(RobolectricTestRunner.class)
+public class OneHandedPreferenceCategoryControllerTest {
+
+    private static final String KEY = "gesture_one_handed_mode_swipe_down";
+
+    private Context mContext;
+    private OneHandedSettingsUtils mUtils;
+    private OneHandedPreferenceCategoryController mController;
+    @Mock
+    private PreferenceCategory mPreference;
+    @Mock
+    private PreferenceScreen mScreen;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mContext = RuntimeEnvironment.application;
+        mUtils = new OneHandedSettingsUtils(mContext);
+        mController = new OneHandedPreferenceCategoryController(mContext, KEY);
+        OneHandedSettingsUtils.setUserId(UserHandle.myUserId());
+        mPreference = new PreferenceCategory(mContext);
+        when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
+    }
+
+    @Test
+    public void getTitle_set3ButtonMode_shouldReturnSetShortcutTo() {
+        mUtils.setNavigationBarMode(mContext, "0" /* 3 button */);
+        mController.displayPreference(mScreen);
+
+        assertTrue(TextUtils.equals(mPreference.getTitle(), mContext.getText(
+                R.string.one_handed_mode_use_shortcut_category)));
+    }
+
+    @Test
+    public void getTitle_setGestureMode_shouldReturnSwipeDownTo() {
+        mUtils.setNavigationBarMode(mContext, "2" /* fully gestural */);
+        mController.displayPreference(mScreen);
+
+        assertTrue(TextUtils.equals(mPreference.getTitle(), mContext.getText(
+                R.string.one_handed_mode_swipe_down_category)));
+    }
+}