Merge "Add a protection for the null UID corner case" into main
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 6e24863..57c577d 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1704,6 +1704,12 @@
                 <category android:name="android.intent.category.BROWSABLE" />
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
+            <intent-filter android:priority="1">
+                <action android:name="android.settings.BACKGROUND_RESTRICTIONS_SETTINGS" />
+                <category android:name="android.intent.category.BROWSABLE" />
+                <category android:name="android.intent.category.DEFAULT" />
+                <data android:scheme="package" />
+            </intent-filter>
             <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
                 android:value="com.android.settings.applications.manageapplications.ManageApplications" />
             <meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 97a9cd5..45305ec 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1248,10 +1248,8 @@
     <string name="private_space_screen_lock_summary">Same as device screen lock</string>
     <!-- Dialog message to choose a new lock for Private Space. [CHAR LIMIT=50] -->
     <string name="private_space_new_lock_title">Choose a new lock for private space?</string>
-    <!-- Title for the preference for auto lock private space. [CHAR LIMIT=40] -->
-    <string name="private_space_auto_lock_title">Lock automatically</string>
-    <!-- Title for private space auto lock settings page. [CHAR LIMIT=50] -->
-    <string name="private_space_auto_lock_page_title">Lock private space automatically</string>
+    <!-- Title for the preference for auto lock private space and auto lock private space settings page. [CHAR LIMIT=50] -->
+    <string name="private_space_auto_lock_title">Lock private space automatically</string>
     <!-- Description for private space auto lock settings page. [CHAR LIMIT=NONE] -->
     <string name="private_space_auto_lock_page_summary">You can lock your private space automatically if you haven\’t used your device for a period of time</string>
     <!-- Configure auto lock: Value for auto lock configuration to lock private space every time device locks. [CHAR LIMIT=40] -->
@@ -10874,6 +10872,12 @@
     <!-- Title of the warning dialog for enabling the credential provider. [CHAR_LIMIT=NONE] -->
     <string name="credman_enable_confirmation_message_title">Use %1$s\?</string>
 
+    <!-- Positive button text for disabling credential manager. [CHAR_LIMIT=30] -->
+    <string name="credman_confirmation_turn_off_positive_button">Turn off</string>
+
+    <!-- Positive button text for changing credential manager provider. [CHAR_LIMIT=30] -->
+    <string name="credman_confirmation_change_provider_positive_button">Change</string>
+
     <!-- Title of the error dialog when too many credential providers are selected (new strings for 24Q3). [CHAR_LIMIT=NONE] -->
     <string name="credman_limit_error_msg_title">You can only have 5 services on</string>
 
diff --git a/res/xml/private_space_auto_lock_settings.xml b/res/xml/private_space_auto_lock_settings.xml
index 82f6c57..ae056a4 100644
--- a/res/xml/private_space_auto_lock_settings.xml
+++ b/res/xml/private_space_auto_lock_settings.xml
@@ -17,4 +17,4 @@
 
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
-    android:title="@string/private_space_auto_lock_page_title"/>
+    android:title="@string/private_space_auto_lock_title"/>
diff --git a/src/com/android/settings/applications/credentials/DefaultCombinedPicker.java b/src/com/android/settings/applications/credentials/DefaultCombinedPicker.java
index 0bffee9..d6f5289 100644
--- a/src/com/android/settings/applications/credentials/DefaultCombinedPicker.java
+++ b/src/com/android/settings/applications/credentials/DefaultCombinedPicker.java
@@ -114,6 +114,18 @@
             setCancelListener(target.mCancelListener);
             super.onCreate(savedInstanceState);
         }
+
+        @Override
+        protected CharSequence getPositiveButtonText() {
+            final Bundle bundle = getArguments();
+            if (TextUtils.isEmpty(bundle.getString(EXTRA_KEY))) {
+                return getContext().getString(
+                    R.string.credman_confirmation_turn_off_positive_button);
+            }
+
+            return getContext().getString(
+                R.string.credman_confirmation_change_provider_positive_button);
+        }
     }
 
     @Override
diff --git a/src/com/android/settings/applications/defaultapps/DefaultAppPickerFragment.java b/src/com/android/settings/applications/defaultapps/DefaultAppPickerFragment.java
index b089dd8..fda6b28 100644
--- a/src/com/android/settings/applications/defaultapps/DefaultAppPickerFragment.java
+++ b/src/com/android/settings/applications/defaultapps/DefaultAppPickerFragment.java
@@ -138,11 +138,15 @@
             final Bundle bundle = getArguments();
             final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity())
                     .setMessage(bundle.getCharSequence(EXTRA_MESSAGE))
-                    .setPositiveButton(android.R.string.ok, this)
+                    .setPositiveButton(getPositiveButtonText(), this)
                     .setNegativeButton(android.R.string.cancel, mCancelListener);
             return builder.create();
         }
 
+        protected CharSequence getPositiveButtonText() {
+            return getContext().getString(android.R.string.ok);
+        }
+
         @Override
         public void onClick(DialogInterface dialog, int which) {
             final Fragment fragment = getTargetFragment();
diff --git a/src/com/android/settings/bluetooth/BluetoothNameDialogFragment.java b/src/com/android/settings/bluetooth/BluetoothNameDialogFragment.java
index 74c39b6..c5b29f3 100644
--- a/src/com/android/settings/bluetooth/BluetoothNameDialogFragment.java
+++ b/src/com/android/settings/bluetooth/BluetoothNameDialogFragment.java
@@ -132,7 +132,7 @@
 
     @Override
     public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
-        if (actionId == EditorInfo.IME_ACTION_DONE) {
+        if (actionId == EditorInfo.IME_ACTION_DONE || actionId == EditorInfo.IME_NULL) {
             setDeviceName(v.getText().toString());
             if (mAlertDialog != null && mAlertDialog.isShowing()) {
                 mAlertDialog.dismiss();
diff --git a/src/com/android/settings/development/SensitiveContentProtectionPreferenceController.kt b/src/com/android/settings/development/SensitiveContentProtectionPreferenceController.kt
index 6fe56c8..e627f81 100644
--- a/src/com/android/settings/development/SensitiveContentProtectionPreferenceController.kt
+++ b/src/com/android/settings/development/SensitiveContentProtectionPreferenceController.kt
@@ -16,11 +16,11 @@
 package com.android.settings.development
 
 import android.content.Context
+import android.permission.flags.Flags.sensitiveNotificationAppProtection
 import android.provider.Settings
 import androidx.annotation.VisibleForTesting
 import androidx.preference.Preference
 import androidx.preference.TwoStatePreference
-import com.android.server.notification.Flags.sensitiveNotificationAppProtection
 import com.android.server.notification.Flags.screenshareNotificationHiding
 import com.android.settings.core.PreferenceControllerMixin
 import com.android.settingslib.development.DeveloperOptionsPreferenceController
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothNameDialogFragmentTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothNameDialogFragmentTest.java
index c3956d3..376c7ed 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothNameDialogFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothNameDialogFragmentTest.java
@@ -33,6 +33,8 @@
     private TestBluetoothNameDialogFragment mBluetoothNameDialogFragment;
     private TextView mTextView;
 
+    private static final String NAME_FOR_TEST = "test_device_name";
+
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
@@ -51,12 +53,24 @@
                         null)).isTrue();
     }
 
+    @Test
+    public void onEditorAction_ImeNull_setsDeviceName() {
+
+
+        mTextView.setText(NAME_FOR_TEST);
+        assertThat(
+                mBluetoothNameDialogFragment.onEditorAction(mTextView, EditorInfo.IME_NULL,
+                        null)).isTrue();
+        assertThat(mBluetoothNameDialogFragment.getDeviceName()).isEqualTo(NAME_FOR_TEST);
+    }
 
     /**
      * Test fragment for {@link BluetoothNameDialogFragment} to test common methods
      */
     public static class TestBluetoothNameDialogFragment extends BluetoothNameDialogFragment {
 
+        private String mName;
+
         @Override
         protected int getDialogTitle() {
             return 0;
@@ -64,12 +78,12 @@
 
         @Override
         protected String getDeviceName() {
-            return null;
+            return mName;
         }
 
         @Override
         protected void setDeviceName(String deviceName) {
-
+            mName = deviceName;
         }
 
         @Override
diff --git a/tests/spa_unit/src/com/android/settings/development/SensitiveContentProtectionPreferenceControllerTest.kt b/tests/spa_unit/src/com/android/settings/development/SensitiveContentProtectionPreferenceControllerTest.kt
index bb30619..18acbba 100644
--- a/tests/spa_unit/src/com/android/settings/development/SensitiveContentProtectionPreferenceControllerTest.kt
+++ b/tests/spa_unit/src/com/android/settings/development/SensitiveContentProtectionPreferenceControllerTest.kt
@@ -16,6 +16,7 @@
 package com.android.settings.development
 
 import android.content.Context
+import android.permission.flags.Flags.FLAG_SENSITIVE_NOTIFICATION_APP_PROTECTION
 import android.platform.test.annotations.RequiresFlagsDisabled
 import android.platform.test.annotations.RequiresFlagsEnabled
 import android.platform.test.flag.junit.DeviceFlagsValueProvider
@@ -27,7 +28,6 @@
 import androidx.test.ext.junit.runners.AndroidJUnit4
 import androidx.test.platform.app.InstrumentationRegistry
 import com.android.server.notification.Flags.FLAG_SCREENSHARE_NOTIFICATION_HIDING
-import com.android.server.notification.Flags.FLAG_SENSITIVE_NOTIFICATION_APP_PROTECTION
 import com.android.settings.development.SensitiveContentProtectionPreferenceController.Companion.SETTING_VALUE_OFF
 import com.android.settings.development.SensitiveContentProtectionPreferenceController.Companion.SETTING_VALUE_ON
 import org.junit.Assert.assertEquals