From e4445a6e868f2c835039d2b6607be310071a4406 Mon Sep 17 00:00:00 2001 From: Sayak Dutta Date: Tue, 15 Nov 2022 06:16:36 +0000 Subject: [PATCH 1/5] Modify call to Header function of Glif Layout to disable autosize Bug: 245483008 Change-Id: I117e11f40764bf599bfa655755107342252ca891 --- src/com/android/settings/deviceinfo/StorageWizardBase.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/deviceinfo/StorageWizardBase.java b/src/com/android/settings/deviceinfo/StorageWizardBase.java index c39f3841299..7203d8a7702 100644 --- a/src/com/android/settings/deviceinfo/StorageWizardBase.java +++ b/src/com/android/settings/deviceinfo/StorageWizardBase.java @@ -46,6 +46,7 @@ import com.android.settings.SetupWizardUtils; import com.google.android.setupcompat.template.FooterBarMixin; import com.google.android.setupcompat.template.FooterButton; import com.google.android.setupdesign.GlifLayout; +import com.google.android.setupdesign.template.HeaderMixin; import com.google.android.setupdesign.util.ThemeHelper; import com.google.android.setupdesign.util.ThemeResolver; @@ -167,7 +168,9 @@ public abstract class StorageWizardBase extends FragmentActivity { protected void setHeaderText(int resId, CharSequence... args) { final CharSequence headerText = TextUtils.expandTemplate(getText(resId), args); - getGlifLayout().setHeaderText(headerText); + final GlifLayout layout = getGlifLayout(); + layout.setHeaderText(headerText); + layout.getMixin(HeaderMixin.class).setAutoTextSizeEnabled(false); setTitle(headerText); } From 88e2f1e0e02565519fd985edb1e060b64ad78e43 Mon Sep 17 00:00:00 2001 From: Joshua McCloskey Date: Wed, 16 Nov 2022 01:20:04 +0000 Subject: [PATCH 2/5] Ensure text doesnt jump during enrollment Test: Verified via fingerprint enrollment that dynamic text no longer shifts the fingerprint icon view. Fixes: 251235423 Change-Id: Ia70bb251af9df581e5c1e2b7dfcd9290dcc66b26 --- .../FingerprintEnrollEnrolling.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java index 9598019f93d..373243a678b 100644 --- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java +++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java @@ -77,6 +77,8 @@ import com.google.android.setupcompat.template.FooterBarMixin; import com.google.android.setupcompat.template.FooterButton; import com.google.android.setupcompat.util.WizardManagerHelper; import com.google.android.setupdesign.GlifLayout; +import com.google.android.setupdesign.template.DescriptionMixin; +import com.google.android.setupdesign.template.HeaderMixin; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -341,6 +343,9 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling { return true; }); } + + final Configuration config = getApplicationContext().getResources().getConfiguration(); + maybeHideSfpsText(config); } @Override @@ -1040,6 +1045,7 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling { @Override public void onConfigurationChanged(@NonNull Configuration newConfig) { + maybeHideSfpsText(newConfig); switch(newConfig.orientation) { case Configuration.ORIENTATION_LANDSCAPE: { updateOrientation(Configuration.ORIENTATION_LANDSCAPE); @@ -1055,6 +1061,27 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling { } } + private void maybeHideSfpsText(@NonNull Configuration newConfig) { + final HeaderMixin headerMixin = getLayout().getMixin(HeaderMixin.class); + final DescriptionMixin descriptionMixin = getLayout().getMixin(DescriptionMixin.class); + final boolean isLandscape = newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE; + + if (mCanAssumeSfps) { + if (isLandscape) { + headerMixin.setAutoTextSizeEnabled(true); + headerMixin.getTextView().setMinLines(0); + headerMixin.getTextView().setMaxLines(10); + descriptionMixin.getTextView().setMinLines(0); + descriptionMixin.getTextView().setMaxLines(10); + } else { + headerMixin.setAutoTextSizeEnabled(false); + headerMixin.getTextView().setLines(4); + // hide the description + descriptionMixin.getTextView().setLines(0); + } + } + } + public static class IconTouchDialog extends InstrumentedDialogFragment { @Override From c4b95de5367a27e97c1da6121c2bbb2edfca3bc9 Mon Sep 17 00:00:00 2001 From: Diya Bera Date: Wed, 16 Nov 2022 18:34:26 +0000 Subject: [PATCH 3/5] Device displays fingerprint enrollment after swiping back Fixes: 259198369 Test: Manual - repro steps in bug Change-Id: Ide7fa0d16daba795cfc3c63a5da351000f918a81 --- .../settings/biometrics/MultiBiometricEnrollHelper.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/com/android/settings/biometrics/MultiBiometricEnrollHelper.java b/src/com/android/settings/biometrics/MultiBiometricEnrollHelper.java index 5d0b63c5ffb..a994b9564d9 100644 --- a/src/com/android/settings/biometrics/MultiBiometricEnrollHelper.java +++ b/src/com/android/settings/biometrics/MultiBiometricEnrollHelper.java @@ -103,10 +103,9 @@ public class MultiBiometricEnrollHelper { 0 /* requestCode */, faceIntent, PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT); intent.putExtra(EXTRA_ENROLL_AFTER_FINGERPRINT, faceAfterFp); - - BiometricUtils.launchEnrollForResult(mActivity, intent, REQUEST_FINGERPRINT_ENROLL, - hardwareAuthToken, mGkPwHandle, mUserId); } + BiometricUtils.launchEnrollForResult(mActivity, intent, REQUEST_FINGERPRINT_ENROLL, + hardwareAuthToken, mGkPwHandle, mUserId); })); } } From 68903de369a49385214ef4dc512d4c88ad9489a2 Mon Sep 17 00:00:00 2001 From: Diya Bera Date: Wed, 16 Nov 2022 21:01:41 +0000 Subject: [PATCH 4/5] Remove header "When using fingerprint unlock" for Udfps Fixes: 257272989 Test: Manual - Open Fingerprint Settings and observe the UI Change-Id: I98235e56a3537eff00490584c88f459ac755433f --- .../biometrics/fingerprint/FingerprintSettings.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java b/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java index 2cbef992ead..8ba20104f57 100644 --- a/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java +++ b/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java @@ -53,6 +53,7 @@ import androidx.annotation.VisibleForTesting; import androidx.appcompat.app.AlertDialog; import androidx.preference.Preference; import androidx.preference.Preference.OnPreferenceChangeListener; +import androidx.preference.PreferenceCategory; import androidx.preference.PreferenceGroup; import androidx.preference.PreferenceScreen; import androidx.preference.PreferenceViewHolder; @@ -158,6 +159,8 @@ public class FingerprintSettings extends SubSettings { private static final String KEY_IS_ENROLLING = "is_enrolled"; private static final String KEY_REQUIRE_SCREEN_ON_TO_AUTH = "security_settings_require_screen_on_to_auth"; + private static final String KEY_FINGERPRINT_UNLOCK_CATEGORY = + "security_settings_fingerprint_unlock_category"; private static final int MSG_REFRESH_FINGERPRINT_TEMPLATES = 1000; private static final int MSG_FINGER_AUTH_SUCCESS = 1001; @@ -177,6 +180,7 @@ public class FingerprintSettings extends SubSettings { private FingerprintSettingsRequireScreenOnToAuthPreferenceController mRequireScreenOnToAuthPreferenceController; private RestrictedSwitchPreference mRequireScreenOnToAuthPreference; + private PreferenceCategory mFingerprintUnlockCategory; private FingerprintManager mFingerprintManager; private FingerprintUpdater mFingerprintUpdater; @@ -493,6 +497,7 @@ public class FingerprintSettings extends SubSettings { addFingerprintItemPreferences(root); addPreferencesFromResource(getPreferenceScreenResId()); mRequireScreenOnToAuthPreference = findPreference(KEY_REQUIRE_SCREEN_ON_TO_AUTH); + mFingerprintUnlockCategory = findPreference(KEY_FINGERPRINT_UNLOCK_CATEGORY); for (AbstractPreferenceController controller : mControllers) { ((FingerprintSettingsPreferenceController) controller).setUserId(mUserId); } @@ -504,7 +509,7 @@ public class FingerprintSettings extends SubSettings { mRequireScreenOnToAuthPreferenceController.setChecked(!isChecked); return true; }); - mRequireScreenOnToAuthPreference.setVisible(false); + mFingerprintUnlockCategory.setVisible(false); if (isSfps()) { setRequireScreenOnToAuthVisibility(); } @@ -517,9 +522,9 @@ public class FingerprintSettings extends SubSettings { final boolean removalInProgress = mRemovalSidecar.inProgress(); // Removing last remaining fingerprint if (fingerprintsEnrolled == 0 && removalInProgress) { - mRequireScreenOnToAuthPreference.setVisible(false); + mFingerprintUnlockCategory.setVisible(false); } else { - mRequireScreenOnToAuthPreference.setVisible(true); + mFingerprintUnlockCategory.setVisible(true); } } From a2d06273c10e67ea78087d8b08ea9a418d321648 Mon Sep 17 00:00:00 2001 From: Sam Dubey Date: Thu, 17 Nov 2022 07:22:54 +0000 Subject: [PATCH 5/5] Revert "Add configuration for defaulting notification behavior" Likely causing b/259499400 This reverts commit a92688d64269ff9121c3a7c4ac94fd674725632a. Change-Id: I781a7ecf9139eca11e1db895f86268b893258543 --- res/values/config.xml | 3 -- .../notification/RedactionInterstitial.java | 5 +--- .../RedactionInterstitialTest.java | 29 ------------------- 3 files changed, 1 insertion(+), 36 deletions(-) diff --git a/res/values/config.xml b/res/values/config.xml index b7c0bad7fd2..205b9b5baa5 100755 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -634,9 +634,6 @@ android.uid.system:1000 - - true - false diff --git a/src/com/android/settings/notification/RedactionInterstitial.java b/src/com/android/settings/notification/RedactionInterstitial.java index d6fdaf81c95..f243250a611 100644 --- a/src/com/android/settings/notification/RedactionInterstitial.java +++ b/src/com/android/settings/notification/RedactionInterstitial.java @@ -189,16 +189,13 @@ public class RedactionInterstitial extends SettingsActivity { } private void loadFromSettings() { - final boolean showUnRedactedDefault = getContext().getResources().getBoolean( - R.bool.default_allow_sensitive_lockscreen_content); final boolean managedProfile = UserManager.get(getContext()).isManagedProfile(mUserId); // Hiding all notifications is device-wide setting, managed profiles can only set // whether their notifications are show in full or redacted. final boolean showNotifications = managedProfile || Settings.Secure.getIntForUser( getContentResolver(), LOCK_SCREEN_SHOW_NOTIFICATIONS, 0, mUserId) != 0; final boolean showUnredacted = Settings.Secure.getIntForUser( - getContentResolver(), LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, - showUnRedactedDefault ? 1 : 0, mUserId) != 0; + getContentResolver(), LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, 1, mUserId) != 0; int checkedButtonId = R.id.hide_all; if (showNotifications) { diff --git a/tests/robotests/src/com/android/settings/notification/RedactionInterstitialTest.java b/tests/robotests/src/com/android/settings/notification/RedactionInterstitialTest.java index 9d475b84524..5c6da495235 100644 --- a/tests/robotests/src/com/android/settings/notification/RedactionInterstitialTest.java +++ b/tests/robotests/src/com/android/settings/notification/RedactionInterstitialTest.java @@ -21,7 +21,6 @@ import android.widget.RadioButton; import com.android.settings.R; import com.android.settings.RestrictedRadioButton; import com.android.settings.notification.RedactionInterstitial.RedactionInterstitialFragment; -import com.android.settings.testutils.shadow.SettingsShadowResources; import com.android.settings.testutils.shadow.ShadowRestrictedLockUtilsInternal; import com.android.settings.testutils.shadow.ShadowUtils; @@ -39,7 +38,6 @@ import org.robolectric.shadows.ShadowUserManager; @Config(shadows = { ShadowUtils.class, ShadowRestrictedLockUtilsInternal.class, - SettingsShadowResources.class, }) public class RedactionInterstitialTest { private RedactionInterstitial mActivity; @@ -136,28 +134,6 @@ public class RedactionInterstitialTest { assertSelectedButton(R.id.redact_sensitive); } - @Test - public void defaultShowSensitiveContent_configDeny() { - final ContentResolver resolver = RuntimeEnvironment.application.getContentResolver(); - Settings.Secure.putIntForUser(resolver, - LOCK_SCREEN_SHOW_NOTIFICATIONS, 1, UserHandle.myUserId()); - setupConfig(false); - setupActivity(); - - assertSelectedButton(R.id.redact_sensitive); - } - - @Test - public void defaultShowSensitiveContent_configAllow() { - final ContentResolver resolver = RuntimeEnvironment.application.getContentResolver(); - Settings.Secure.putIntForUser(resolver, - LOCK_SCREEN_SHOW_NOTIFICATIONS, 1, UserHandle.myUserId()); - setupConfig(true); - setupActivity(); - - assertSelectedButton(R.id.show_all); - } - private void setupActivity() { mActivity = buildActivity(RedactionInterstitial.class, new Intent()).setup().get(); mFragment = (RedactionInterstitialFragment) @@ -166,11 +142,6 @@ public class RedactionInterstitialTest { assertThat(mFragment).isNotNull(); } - private void setupConfig(boolean allowSensitiveContent) { - SettingsShadowResources.overrideResource( - R.bool.default_allow_sensitive_lockscreen_content, allowSensitiveContent); - } - private void setupSettings(int show, int showUnredacted) { final ContentResolver resolver = RuntimeEnvironment.application.getContentResolver(); Settings.Secure.putIntForUser(resolver,