Merge "Add Adaptive Connectivity switch on/off string for fixing string gender" 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/strings.xml b/res/values/strings.xml
index 25f4a25..02be71a 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] -->
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/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/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);
     }