From dc4ec9bfcacf0cc7893f50e677d75a83d2adbb07 Mon Sep 17 00:00:00 2001 From: Mill Chen Date: Thu, 21 Oct 2021 06:18:34 +0800 Subject: [PATCH 1/3] Update animation for fingerprint edu page Bug: 197264655 Test: visual verify 1) Navigate to fingerprint unlock and start fingerprint enrolling flow 2) Observe the education page and see if the animation works Change-Id: Id07ee17fac29f8f49babb137889e50514ec86326 --- .../fingerprint_enroll_find_sensor_base.xml | 23 +++++++ res/raw/fingerprint_edu_lottie.json | 0 res/raw/fingerprint_edu_lottie_portrait.json | 0 .../FingerprintEnrollFindSensor.java | 67 ++++++++++++++++++- 4 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 res/raw/fingerprint_edu_lottie.json create mode 100644 res/raw/fingerprint_edu_lottie_portrait.json diff --git a/res/layout/fingerprint_enroll_find_sensor_base.xml b/res/layout/fingerprint_enroll_find_sensor_base.xml index 62203f71c81..da7fc309711 100644 --- a/res/layout/fingerprint_enroll_find_sensor_base.xml +++ b/res/layout/fingerprint_enroll_find_sensor_base.xml @@ -17,6 +17,7 @@ + + + + diff --git a/res/raw/fingerprint_edu_lottie.json b/res/raw/fingerprint_edu_lottie.json new file mode 100644 index 00000000000..e69de29bb2d diff --git a/res/raw/fingerprint_edu_lottie_portrait.json b/res/raw/fingerprint_edu_lottie_portrait.json new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java index 3cea9629069..64e066ec00c 100644 --- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java +++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java @@ -21,13 +21,14 @@ import android.content.Intent; import android.hardware.fingerprint.FingerprintManager; import android.hardware.fingerprint.FingerprintSensorPropertiesInternal; import android.os.Bundle; +import android.view.OrientationEventListener; +import android.view.Surface; import android.view.View; import android.view.View.OnClickListener; import android.view.accessibility.AccessibilityManager; import androidx.annotation.Nullable; -import com.airbnb.lottie.LottieAnimationView; import com.android.settings.R; import com.android.settings.Utils; import com.android.settings.biometrics.BiometricEnrollBase; @@ -35,6 +36,7 @@ import com.android.settings.biometrics.BiometricEnrollSidecar; import com.android.settings.biometrics.BiometricUtils; import com.android.settings.password.ChooseLockSettingsHelper; +import com.airbnb.lottie.LottieAnimationView; import com.google.android.setupcompat.template.FooterBarMixin; import com.google.android.setupcompat.template.FooterButton; @@ -52,6 +54,10 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements private FingerprintEnrollSidecar mSidecar; private boolean mNextClicked; private boolean mCanAssumeUdfps; + private boolean mCanAssumeSidefps; + + private OrientationEventListener mOrientationEventListener; + private int mPreviousRotation = 0; @Override protected void onCreate(Bundle savedInstanceState) { @@ -61,6 +67,7 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements final List props = fingerprintManager.getSensorPropertiesInternal(); mCanAssumeUdfps = props != null && props.size() == 1 && props.get(0).isAnyUdfpsType(); + mCanAssumeSidefps = props != null && props.size() == 1 && props.get(0).isAnySidefpsType(); setContentView(getContentView()); mFooterBarMixin = getLayout().getMixin(FooterBarMixin.class); mFooterBarMixin.setSecondaryButton( @@ -72,6 +79,8 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements .build() ); + listenOrientationEvent(); + if (mCanAssumeUdfps) { setHeaderText(R.string.security_settings_udfps_enroll_find_sensor_title); setDescriptionText(R.string.security_settings_udfps_enroll_find_sensor_message); @@ -90,6 +99,28 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements lottieAnimationView.setAnimation(R.raw.udfps_edu_a11y_lottie); } + } else if (mCanAssumeSidefps) { + setHeaderText(R.string.security_settings_fingerprint_enroll_find_sensor_title); + setDescriptionText(R.string.security_settings_fingerprint_enroll_find_sensor_message); + final LottieAnimationView lottieAnimationView = findViewById(R.id.illustration_lottie); + final LottieAnimationView lottieAnimationViewPortrait = + findViewById(R.id.illustration_lottie_portrait); + final int rotation = getApplicationContext().getDisplay().getRotation(); + switch(rotation) { + case Surface.ROTATION_90: + lottieAnimationView.setVisibility(View.GONE); + lottieAnimationViewPortrait.setVisibility(View.VISIBLE); + break; + case Surface.ROTATION_270: + lottieAnimationView.setVisibility(View.GONE); + lottieAnimationViewPortrait.setVisibility(View.VISIBLE); + lottieAnimationViewPortrait.setRotation(180); + break; + default: + lottieAnimationView.setVisibility(View.VISIBLE); + lottieAnimationViewPortrait.setVisibility(View.GONE); + break; + } } else { setHeaderText(R.string.security_settings_fingerprint_enroll_find_sensor_title); setDescriptionText(R.string.security_settings_fingerprint_enroll_find_sensor_message); @@ -220,6 +251,7 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements @Override protected void onDestroy() { + stopListenOrientationEvent(); super.onDestroy(); if (mAnimation != null) { mAnimation.stopAnimation(); @@ -297,4 +329,37 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements public int getMetricsCategory() { return SettingsEnums.FINGERPRINT_FIND_SENSOR; } + + private void listenOrientationEvent() { + if (!mCanAssumeSidefps) { + // Do nothing if the device doesn't support SideFPS. + return; + } + mOrientationEventListener = new OrientationEventListener(this) { + @Override + public void onOrientationChanged(int orientation) { + final int currentRotation = getDisplay().getRotation(); + if ((mPreviousRotation == Surface.ROTATION_90 + && currentRotation == Surface.ROTATION_270) || ( + mPreviousRotation == Surface.ROTATION_270 + && currentRotation == Surface.ROTATION_90)) { + mPreviousRotation = currentRotation; + recreate(); + } + } + }; + mOrientationEventListener.enable(); + mPreviousRotation = getDisplay().getRotation(); + } + + private void stopListenOrientationEvent() { + if (!mCanAssumeSidefps) { + // Do nothing if the device doesn't support SideFPS. + return; + } + if (mOrientationEventListener != null) { + mOrientationEventListener.disable(); + } + mOrientationEventListener = null; + } } From e739b3c99bdf2c2baad3b142c0f271568c4e8556 Mon Sep 17 00:00:00 2001 From: Weng Su Date: Mon, 25 Oct 2021 11:24:01 +0800 Subject: [PATCH 2/3] Keep compatibility for old WiFi shortcut - WifiSettings2Activity has been replaced by WifiSettingsActivity Test: Create a shortcut to WifiSettings in R, update to S and test it Bug: 199033769 Change-Id: I735106578cd11a15ffef1fd4d8e9703ae781db6c Merged-In: Idb08b9650e7c5efce4ab40eb949ccab0e5949333 --- AndroidManifest.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 8fedf92b345..a29089a8498 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -298,6 +298,17 @@ android:value="true" /> + + + + + Date: Thu, 28 Oct 2021 16:36:21 +0800 Subject: [PATCH 3/3] Register the rule for injected apps We should align behavior between injected apps and in-app entries. Test: Open the Google/DW page and click back key. Then, app is closed directly. Fix: 204406425 Change-Id: I57831c4df78b502b3998b3f7384df2900dbfe56f --- .../dashboard/DashboardFeatureProviderImpl.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java b/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java index f8185db7178..2def817ac22 100644 --- a/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java +++ b/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java @@ -60,6 +60,8 @@ import androidx.preference.SwitchPreference; import com.android.settings.R; import com.android.settings.SettingsActivity; import com.android.settings.Utils; +import com.android.settings.activityembedding.ActivityEmbeddingRulesController; +import com.android.settings.activityembedding.ActivityEmbeddingUtils; import com.android.settings.dashboard.profileselector.ProfileSelectDialog; import com.android.settings.homepage.TopLevelSettings; import com.android.settings.overlay.FeatureFactory; @@ -170,7 +172,17 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider { } pref.setOnPreferenceClickListener(preference -> { OnCancelListener listener = null; - if (fragment instanceof TopLevelSettings) { + if (fragment instanceof TopLevelSettings + && ActivityEmbeddingUtils.isEmbeddingActivityEnabled(mContext)) { + // Register the rule for injected apps. + ActivityEmbeddingRulesController.registerTwoPanePairRule(mContext, + new ComponentName(activity.getPackageName(), + com.android.settings.Settings.class.getName()), + new ComponentName(tile.getPackageName(), + tile.getComponentName()), + null, true, true); + + // Highlight preference ui. final TopLevelSettings topLevelSettings = (TopLevelSettings) fragment; // Highlight the tile immediately whenever it's clicked topLevelSettings.setHighlightPreferenceKey(key);