From 4ff23211dd2a5930aab1e3c9c4ec58c87bcf377b Mon Sep 17 00:00:00 2001 From: Jyotiraditya Panda Date: Mon, 22 Jul 2024 19:51:20 +0530 Subject: [PATCH 1/6] Migrate to onViewCreated in DataSaverSummary The onActivityCreated method has been deprecated. This change updates DataSaverSummary to use onViewCreated instead, which is the recommended method for initializing views after the fragment's view has been created. Test: manual Change-Id: I08daa11b557b05441fa4f7ed0019802d991846e3 Signed-off-by: Jyotiraditya Panda --- src/com/android/settings/datausage/DataSaverSummary.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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() From d519d1fbaab781876b8d0769ff28fca8c1902df8 Mon Sep 17 00:00:00 2001 From: Pawan Wagh Date: Tue, 23 Jul 2024 22:14:41 +0000 Subject: [PATCH 2/6] Remove unecessary logs Test: m Settings Bug: N/A Flag: NONE remove logging Change-Id: Ib1e5923e2f10fdf5fa29bbaa24b74874c18c3045 --- src/com/android/settings/development/Enable16kUtils.java | 1 - 1 file changed, 1 deletion(-) 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]; From 31ec11f0b6d5b643bfb20835c9971514a07f30b6 Mon Sep 17 00:00:00 2001 From: Diya Bera Date: Wed, 24 Jul 2024 20:04:15 +0000 Subject: [PATCH 3/6] Hide background when identity check auth is requested Flag: android.hardware.biometrics.flags.mandatory_biometrics Fixes: 354014097 Test: atest UtilsTest Change-Id: I3af06fd9dca2bdc306496f1db832e1d1e2bfe8d2 --- src/com/android/settings/MainClear.java | 2 +- src/com/android/settings/Utils.java | 11 +++++++---- .../combination/BiometricsSettingsBase.java | 4 ++-- .../settings/biometrics/face/FaceSettings.java | 2 +- .../fingerprint/FingerprintSettings.java | 4 ++-- .../settings/password/ChooseLockGeneric.java | 2 +- .../password/ConfirmDeviceCredentialActivity.java | 15 +++++++++++---- .../src/com/android/settings/UtilsTest.java | 6 +++++- 8 files changed, 30 insertions(+), 16 deletions(-) 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 815c08e0de1..9b663a15a5e 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); @@ -783,7 +783,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/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( From e85695f88ce136454724d4483e39d90db79aabd9 Mon Sep 17 00:00:00 2001 From: Alina Zaidi Date: Thu, 25 Jul 2024 15:59:35 +0000 Subject: [PATCH 4/6] [dev_option] Update 'Desktop mode on secondary toggle' to be 'Freeform windows on secondary diplay'. Make sure the toggles enables freeform support on devices. This remove reliance on 'Enable freeform windows suppport' toggle when using this toggle. Also update strings for all toggles to just use term 'freeform windows' instead of 'desktop mode' or 'freeform windowing experiences'. Two toggles have the same name 'enable freeform windows', but users will see only one of them at a time. Test: Added new tests Bug: 348193756 Bug: 348186127 Flag: EXEMPT minor change Change-Id: Ic4528618e6902d084c58a6b5ddeb4b92d63386d6 --- res/values/strings.xml | 18 +++++----- ...eSecondaryDisplayPreferenceController.java | 6 ++++ ...ondaryDisplayPreferenceControllerTest.java | 35 +++++++++++++++---- 3 files changed, 44 insertions(+), 15 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 5fa003176ed..73cee9a467d 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -12268,11 +12268,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 @@ -13232,12 +13232,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/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/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); } From aab162f8146b1fbd8368ea8f3a2788a1caf1b97d Mon Sep 17 00:00:00 2001 From: Yuanru Qian Date: Mon, 29 Jul 2024 05:42:17 +0000 Subject: [PATCH 5/6] Do not cancel bonding during bt pairing when orientation happens. Flag: com.android.settings.flags.disable_bonding_cancellation_for_orientation_change Bug: b/349542301 Test: locally tested. Change-Id: I56867eb39ca783b23853318c39e0f25ce1a80e6f --- aconfig/settings_bluetooth_declarations.aconfig | 10 ++++++++++ .../BluetoothPairingDialogFragment.java | 16 ++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) 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/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(); } } From 691c0c3f6a3003a39f9acdb1dbddeec8e6dcc17d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Hern=C3=A1ndez?= Date: Mon, 29 Jul 2024 18:59:26 +0200 Subject: [PATCH 6/6] Fix unwanted animation when opening Modes list Fixes: 356151158 Test: manual Flag: android.app.modes_ui Change-Id: Ibbc54c68c4bcbf75e908d4a36ef2d8f609b5b797 --- .../modes/ZenModesListPreferenceController.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) 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