diff --git a/aconfig/settings_bluetooth_declarations.aconfig b/aconfig/settings_bluetooth_declarations.aconfig
index b8b9d9fe569..f6c271c38e9 100644
--- a/aconfig/settings_bluetooth_declarations.aconfig
+++ b/aconfig/settings_bluetooth_declarations.aconfig
@@ -31,3 +31,13 @@ flag {
description: "Gates whether to enable bluetooth device details polish"
bug: "343317785"
}
+
+flag {
+ name: "disable_bonding_cancellation_for_orientation_change"
+ namespace: "cross_device_experiences"
+ description: "Stop cancelling bonding process when there is an orientation change"
+ bug: "349542301"
+ metadata {
+ purpose: PURPOSE_BUGFIX
+ }
+}
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 31372cac8e9..311b56f81a3 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -12238,11 +12238,11 @@
Settings Panel
-
- Enable freeform windowing experiences
+
+ Enable freeform windows
-
- Enable desktop mode on secondary display
+
+ Enable freeform windows on secondary display
Enable non-resizable in multi window
@@ -13202,12 +13202,12 @@
Customize %1$s
-
+
A reboot is required to enable freeform window support.
-
- A reboot is required to update availability of freeform windowing experiences.
-
- A reboot is required to enable desktop mode on secondary displays.
+
+ A reboot is required to update availability of freeform windows.
+
+ A reboot is required to enable freeform windows on secondary displays.
Reboot now
diff --git a/src/com/android/settings/MainClear.java b/src/com/android/settings/MainClear.java
index 9dadcb9600d..ab7a7146329 100644
--- a/src/com/android/settings/MainClear.java
+++ b/src/com/android/settings/MainClear.java
@@ -188,7 +188,7 @@ public class MainClear extends InstrumentedFragment implements OnGlobalLayoutLis
false /* biometricsAuthenticationRequested */,
userId)) {
Utils.launchBiometricPromptForMandatoryBiometrics(this, BIOMETRICS_REQUEST,
- userId);
+ userId, false /* hideBackground */);
return;
}
}
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index add5604a617..badcb63791c 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -25,6 +25,7 @@ import static android.text.format.DateUtils.FORMAT_ABBREV_MONTH;
import static android.text.format.DateUtils.FORMAT_SHOW_DATE;
import static com.android.settings.password.ConfirmDeviceCredentialActivity.BIOMETRIC_PROMPT_AUTHENTICATORS;
+import static com.android.settings.password.ConfirmDeviceCredentialActivity.BIOMETRIC_PROMPT_HIDE_BACKGROUND;
import static com.android.settings.password.ConfirmDeviceCredentialActivity.BIOMETRIC_PROMPT_NEGATIVE_BUTTON_TEXT;
import android.app.ActionBar;
@@ -1519,12 +1520,13 @@ public final class Utils extends com.android.settingslib.Utils {
* to check if all requirements for mandatory biometrics is satisfied
* before launching biometric prompt.
*
- * @param fragment corresponding fragment of the surface
- * @param requestCode for starting the new activity
- * @param userId user id for the authentication request
+ * @param fragment corresponding fragment of the surface
+ * @param requestCode for starting the new activity
+ * @param userId user id for the authentication request
+ * @param hideBackground if the background activity screen needs to be hidden
*/
public static void launchBiometricPromptForMandatoryBiometrics(@NonNull Fragment fragment,
- int requestCode, int userId) {
+ int requestCode, int userId, boolean hideBackground) {
final Intent intent = new Intent();
intent.putExtra(BIOMETRIC_PROMPT_AUTHENTICATORS,
BiometricManager.Authenticators.MANDATORY_BIOMETRICS);
@@ -1534,6 +1536,7 @@ public final class Utils extends com.android.settingslib.Utils {
fragment.getString(R.string.mandatory_biometrics_prompt_description));
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_ALLOW_ANY_USER, true);
intent.putExtra(EXTRA_USER_ID, userId);
+ intent.putExtra(BIOMETRIC_PROMPT_HIDE_BACKGROUND, hideBackground);
intent.setClassName(SETTINGS_PACKAGE_NAME,
ConfirmDeviceCredentialActivity.InternalActivity.class.getName());
fragment.startActivityForResult(intent, requestCode);
diff --git a/src/com/android/settings/biometrics/combination/BiometricsSettingsBase.java b/src/com/android/settings/biometrics/combination/BiometricsSettingsBase.java
index 835f3a87d68..11194ce92dc 100644
--- a/src/com/android/settings/biometrics/combination/BiometricsSettingsBase.java
+++ b/src/com/android/settings/biometrics/combination/BiometricsSettingsBase.java
@@ -147,7 +147,7 @@ public abstract class BiometricsSettingsBase extends DashboardFragment {
mBiometricsAuthenticationRequested, mUserId)) {
mBiometricsAuthenticationRequested = true;
Utils.launchBiometricPromptForMandatoryBiometrics(this, BIOMETRIC_AUTH_REQUEST,
- mUserId);
+ mUserId, true /* hideBackground */);
}
updateUnlockPhonePreferenceSummary();
@@ -166,7 +166,7 @@ public abstract class BiometricsSettingsBase extends DashboardFragment {
&& mGkPwHandle != 0L) {
mBiometricsAuthenticationRequested = true;
Utils.launchBiometricPromptForMandatoryBiometrics(this, BIOMETRIC_AUTH_REQUEST,
- mUserId);
+ mUserId, true /* hideBackground */);
}
if (!mConfirmCredential) {
mDoNotFinishActivity = false;
diff --git a/src/com/android/settings/biometrics/face/FaceSettings.java b/src/com/android/settings/biometrics/face/FaceSettings.java
index 305d6703cfe..bcd523142be 100644
--- a/src/com/android/settings/biometrics/face/FaceSettings.java
+++ b/src/com/android/settings/biometrics/face/FaceSettings.java
@@ -293,7 +293,7 @@ public class FaceSettings extends DashboardFragment {
mUserId)) {
mBiometricsAuthenticationRequested = true;
Utils.launchBiometricPromptForMandatoryBiometrics(this, BIOMETRIC_AUTH_REQUEST,
- mUserId);
+ mUserId, true /* hideBackground */);
} else {
mAttentionController.setToken(mToken);
mEnrollController.setToken(mToken);
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java b/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java
index 83bc0e69607..9cda327744c 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java
@@ -489,7 +489,7 @@ public class FingerprintSettings extends SubSettings {
mUserId)) {
mBiometricsAuthenticationRequested = true;
Utils.launchBiometricPromptForMandatoryBiometrics(this, BIOMETRIC_AUTH_REQUEST,
- mUserId);
+ mUserId, true /* hideBackground */);
} else if (!mHasFirstEnrolled) {
mIsEnrolling = true;
addFirstFingerprint(null);
@@ -784,7 +784,7 @@ public class FingerprintSettings extends SubSettings {
mUserId)) {
mBiometricsAuthenticationRequested = true;
Utils.launchBiometricPromptForMandatoryBiometrics(this,
- BIOMETRIC_AUTH_REQUEST, mUserId);
+ BIOMETRIC_AUTH_REQUEST, mUserId, true /* hideBackground */);
}
}
diff --git a/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java b/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java
index 33e6fc3ccbd..e6b197c4d81 100644
--- a/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java
+++ b/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java
@@ -41,6 +41,7 @@ import androidx.appcompat.app.AlertDialog;
import com.android.settings.R;
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
+import com.android.settings.flags.Flags;
/**
* A dialogFragment used by {@link BluetoothPairingDialog} to create an appropriately styled dialog
@@ -87,12 +88,15 @@ public class BluetoothPairingDialogFragment extends InstrumentedDialogFragment i
@Override
public void onDestroy() {
super.onDestroy();
- if (mPairingController.getDialogType()
- != BluetoothPairingController.DISPLAY_PASSKEY_DIALOG) {
- /* Cancel pairing unless explicitly accepted by user */
- if (!mPositiveClicked) {
- mPairingController.onCancel();
- }
+ /* Cancel pairing unless 1) explicitly accepted by user 2) the event is triggered by
+ * orientation change. */
+ boolean shouldCancelPairing =
+ Flags.disableBondingCancellationForOrientationChange()
+ ? !mPositiveClicked && !getActivity().isChangingConfigurations()
+ : !mPositiveClicked;
+ if (mPairingController.getDialogType() != BluetoothPairingController.DISPLAY_PASSKEY_DIALOG
+ && shouldCancelPairing) {
+ mPairingController.onCancel();
}
}
diff --git a/src/com/android/settings/datausage/DataSaverSummary.kt b/src/com/android/settings/datausage/DataSaverSummary.kt
index cdd46f2fa40..e118bd67b8b 100644
--- a/src/com/android/settings/datausage/DataSaverSummary.kt
+++ b/src/com/android/settings/datausage/DataSaverSummary.kt
@@ -19,6 +19,7 @@ import android.app.settings.SettingsEnums
import android.content.Context
import android.os.Bundle
import android.telephony.SubscriptionManager
+import android.view.View
import com.android.settings.R
import com.android.settings.SettingsActivity
import com.android.settings.dashboard.DashboardFragment
@@ -45,8 +46,8 @@ class DataSaverSummary : DashboardFragment() {
dataSaverBackend = DataSaverBackend(requireContext())
}
- override fun onActivityCreated(savedInstanceState: Bundle?) {
- super.onActivityCreated(savedInstanceState)
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
switchBar = (activity as SettingsActivity).switchBar.apply {
setTitle(getString(R.string.data_saver_switch_title))
show()
diff --git a/src/com/android/settings/development/DesktopModeSecondaryDisplayPreferenceController.java b/src/com/android/settings/development/DesktopModeSecondaryDisplayPreferenceController.java
index 0d3d835dc5f..2bce9ad32bd 100644
--- a/src/com/android/settings/development/DesktopModeSecondaryDisplayPreferenceController.java
+++ b/src/com/android/settings/development/DesktopModeSecondaryDisplayPreferenceController.java
@@ -67,6 +67,12 @@ public class DesktopModeSecondaryDisplayPreferenceController extends
Settings.Global.putInt(mContext.getContentResolver(),
DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS,
isEnabled ? SETTING_VALUE_ON : SETTING_VALUE_OFF);
+ // Update freeform window support on device.
+ // DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT setting enables freeform support on device
+ // where it's not present by default.
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT,
+ isEnabled ? SETTING_VALUE_ON : SETTING_VALUE_OFF);
if (isEnabled && mFragment != null) {
RebootConfirmationDialogFragment.show(
mFragment, R.string.reboot_dialog_enable_desktop_mode_on_secondary_display,
diff --git a/src/com/android/settings/development/Enable16kUtils.java b/src/com/android/settings/development/Enable16kUtils.java
index 00b7ee9fd3b..b37c1f3823a 100644
--- a/src/com/android/settings/development/Enable16kUtils.java
+++ b/src/com/android/settings/development/Enable16kUtils.java
@@ -78,7 +78,6 @@ public class Enable16kUtils {
try (BufferedReader br = new BufferedReader(new FileReader("/proc/mounts"))) {
String line;
while ((line = br.readLine()) != null) {
- Log.i(TAG, line);
final String[] fields = line.split(" ");
final String partition = fields[1];
final String fsType = fields[2];
diff --git a/src/com/android/settings/notification/modes/ZenModesListPreferenceController.java b/src/com/android/settings/notification/modes/ZenModesListPreferenceController.java
index ba12b9ac842..12b727862c1 100644
--- a/src/com/android/settings/notification/modes/ZenModesListPreferenceController.java
+++ b/src/com/android/settings/notification/modes/ZenModesListPreferenceController.java
@@ -38,7 +38,8 @@ import java.util.Map;
* containing links to each individual mode. This is a central controller that populates and updates
* all the preferences that then lead to a mode configuration page.
*/
-class ZenModesListPreferenceController extends BasePreferenceController {
+class ZenModesListPreferenceController extends BasePreferenceController
+ implements BasePreferenceController.UiBlocker {
protected static final String KEY = "zen_modes_list";
protected ZenModesBackend mBackend;
@@ -48,11 +49,6 @@ class ZenModesListPreferenceController extends BasePreferenceController {
mBackend = backend;
}
- @Override
- public String getPreferenceKey() {
- return KEY;
- }
-
@Override
@AvailabilityStatus
public int getAvailabilityStatus() {
@@ -97,6 +93,8 @@ class ZenModesListPreferenceController extends BasePreferenceController {
for (String key : originalPreferences.keySet()) {
category.removePreferenceRecursively(key);
}
+
+ setUiBlockerFinished(true);
}
// Provide search data for the modes, which will allow users to reach the modes page if they
diff --git a/src/com/android/settings/password/ChooseLockGeneric.java b/src/com/android/settings/password/ChooseLockGeneric.java
index d5d079ecf6d..34c0731184e 100644
--- a/src/com/android/settings/password/ChooseLockGeneric.java
+++ b/src/com/android/settings/password/ChooseLockGeneric.java
@@ -495,7 +495,7 @@ public class ChooseLockGeneric extends SettingsActivity {
mBiometricsAuthSuccessful, mWaitingForConfirmation, mUserId)) {
mWaitingForConfirmation = true;
Utils.launchBiometricPromptForMandatoryBiometrics(this, BIOMETRIC_AUTH_REQUEST,
- mUserId);
+ mUserId, true /* hideBackground */);
}
} else if (requestCode == BIOMETRIC_AUTH_REQUEST) {
if (resultCode == Activity.RESULT_OK) {
diff --git a/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java b/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
index c0b3093c2f8..4f355324fc6 100644
--- a/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
+++ b/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
@@ -80,6 +80,8 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
public static final String BIOMETRIC_PROMPT_AUTHENTICATORS = "biometric_prompt_authenticators";
public static final String BIOMETRIC_PROMPT_NEGATIVE_BUTTON_TEXT =
"biometric_prompt_negative_button_text";
+ public static final String BIOMETRIC_PROMPT_HIDE_BACKGROUND =
+ "biometric_prompt_hide_background";
public static class InternalActivity extends ConfirmDeviceCredentialActivity {
}
@@ -165,15 +167,20 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
- getWindow().setStatusBarColor(Color.TRANSPARENT);
+ final Intent intent = getIntent();
+ if (intent.getBooleanExtra(BIOMETRIC_PROMPT_HIDE_BACKGROUND, false)) {
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
+ getWindow().setDimAmount(1);
+ intent.removeExtra(BIOMETRIC_PROMPT_HIDE_BACKGROUND);
+ } else {
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
+ getWindow().setStatusBarColor(Color.TRANSPARENT);
+ }
mDevicePolicyManager = getSystemService(DevicePolicyManager.class);
mUserManager = UserManager.get(this);
mTrustManager = getSystemService(TrustManager.class);
mLockPatternUtils = new LockPatternUtils(this);
-
- Intent intent = getIntent();
mContext = this;
mCheckDevicePolicyManager = intent
.getBooleanExtra(KeyguardManager.EXTRA_DISALLOW_BIOMETRICS_IF_POLICY_EXISTS, false);
diff --git a/tests/robotests/src/com/android/settings/UtilsTest.java b/tests/robotests/src/com/android/settings/UtilsTest.java
index b36e9d63e32..2aeb9063b1e 100644
--- a/tests/robotests/src/com/android/settings/UtilsTest.java
+++ b/tests/robotests/src/com/android/settings/UtilsTest.java
@@ -22,6 +22,7 @@ import static android.hardware.biometrics.SensorProperties.STRENGTH_WEAK;
import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
import static com.android.settings.password.ConfirmDeviceCredentialActivity.BIOMETRIC_PROMPT_AUTHENTICATORS;
+import static com.android.settings.password.ConfirmDeviceCredentialActivity.BIOMETRIC_PROMPT_HIDE_BACKGROUND;
import static com.android.settings.password.ConfirmDeviceCredentialActivity.BIOMETRIC_PROMPT_NEGATIVE_BUTTON_TEXT;
import static com.google.common.truth.Truth.assertThat;
@@ -581,7 +582,8 @@ public class UtilsTest {
final int requestCode = 1;
final ArgumentCaptor intentArgumentCaptor = ArgumentCaptor.forClass(Intent.class);
- Utils.launchBiometricPromptForMandatoryBiometrics(mFragment, requestCode, USER_ID);
+ Utils.launchBiometricPromptForMandatoryBiometrics(mFragment, requestCode, USER_ID,
+ false /* hideBackground */);
verify(mFragment).startActivityForResult(intentArgumentCaptor.capture(), eq(requestCode));
@@ -593,6 +595,8 @@ public class UtilsTest {
assertThat(intent.getExtra(KeyguardManager.EXTRA_DESCRIPTION)).isNotNull();
assertThat(intent.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_ALLOW_ANY_USER, false))
.isTrue();
+ assertThat(intent.getBooleanExtra(BIOMETRIC_PROMPT_HIDE_BACKGROUND, true))
+ .isFalse();
assertThat(intent.getIntExtra(Intent.EXTRA_USER_ID, 0)).isEqualTo(USER_ID);
assertThat(intent.getComponent().getPackageName()).isEqualTo(SETTINGS_PACKAGE_NAME);
assertThat(intent.getComponent().getClassName()).isEqualTo(
diff --git a/tests/robotests/src/com/android/settings/development/DesktopModeSecondaryDisplayPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/DesktopModeSecondaryDisplayPreferenceControllerTest.java
index 5931004cb66..3691d12e899 100644
--- a/tests/robotests/src/com/android/settings/development/DesktopModeSecondaryDisplayPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/DesktopModeSecondaryDisplayPreferenceControllerTest.java
@@ -16,6 +16,7 @@
package com.android.settings.development;
+import static android.provider.Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT;
import static android.provider.Settings.Global.DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS;
import static com.android.settings.development.DesktopModeSecondaryDisplayPreferenceController.SETTING_VALUE_OFF;
@@ -55,6 +56,7 @@ public class DesktopModeSecondaryDisplayPreferenceControllerTest {
private static final String ENG_BUILD_TYPE = "eng";
private static final String USER_BUILD_TYPE = "user";
+ private static final int SETTING_VALUE_INVALID = -1;
@Mock
private SwitchPreference mPreference;
@@ -102,21 +104,41 @@ public class DesktopModeSecondaryDisplayPreferenceControllerTest {
@Test
public void onPreferenceChange_switchEnabled_enablesDesktopModeOnSecondaryDisplay() {
- mController.onPreferenceChange(mPreference, true /* new value */);
+ mController.onPreferenceChange(mPreference, /* newValue= */ true);
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
- DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS, -1 /* default */);
+ DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS,
+ /* def= */ SETTING_VALUE_INVALID);
assertThat(mode).isEqualTo(SETTING_VALUE_ON);
verify(mTransaction).add(any(RebootConfirmationDialogFragment.class), any());
}
@Test
- public void onPreferenceChange_switchDisabled_disablesDesktopModeOnSecondaryDisplay() {
- mController.onPreferenceChange(mPreference, false /* new value */);
+ public void onPreferenceChange_switchEnabled_enablesFreeformSupport() {
+ mController.onPreferenceChange(mPreference, /* newValue= */ true);
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
- DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS, -1 /* default */);
+ DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT, /* def= */ SETTING_VALUE_INVALID);
+ assertThat(mode).isEqualTo(SETTING_VALUE_ON);
+ }
+
+ @Test
+ public void onPreferenceChange_switchDisabled_disablesDesktopModeOnSecondaryDisplay() {
+ mController.onPreferenceChange(mPreference, /* newValue= */ false);
+
+ final int mode = Settings.Global.getInt(mContext.getContentResolver(),
+ DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS,
+ /* def= */ SETTING_VALUE_INVALID);
+ assertThat(mode).isEqualTo(SETTING_VALUE_OFF);
+ }
+
+ @Test
+ public void onPreferenceChange_switchDisabled_disablesFreeformSupport() {
+ mController.onPreferenceChange(mPreference, /* newValue= */ false);
+
+ final int mode = Settings.Global.getInt(mContext.getContentResolver(),
+ DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT, /* def= */ SETTING_VALUE_INVALID);
assertThat(mode).isEqualTo(SETTING_VALUE_OFF);
}
@@ -145,7 +167,8 @@ public class DesktopModeSecondaryDisplayPreferenceControllerTest {
mController.onDeveloperOptionsSwitchDisabled();
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
- DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS, -1 /* default */);
+ DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS,
+ /* def= */ SETTING_VALUE_INVALID);
assertThat(mode).isEqualTo(SETTING_VALUE_OFF);
verify(mPreference).setEnabled(false);
}