Merge "Set FLAG_DIM_BEHIND for Bidics Prompt window" into tm-qpr-dev am: 0641bef299
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19194825 Change-Id: I7b66f7434e37b9d0ecf21493e8fc1e697c3db6c9 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -23,7 +23,6 @@
|
|||||||
android:id="@+id/background"
|
android:id="@+id/background"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/biometric_dialog_dim_color"
|
|
||||||
android:contentDescription="@string/biometric_dialog_empty_space_description"/>
|
android:contentDescription="@string/biometric_dialog_empty_space_description"/>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
|
|||||||
@@ -129,7 +129,6 @@
|
|||||||
<color name="smart_reply_button_stroke">@*android:color/accent_device_default</color>
|
<color name="smart_reply_button_stroke">@*android:color/accent_device_default</color>
|
||||||
|
|
||||||
<!-- Biometric dialog colors -->
|
<!-- Biometric dialog colors -->
|
||||||
<color name="biometric_dialog_dim_color">#80000000</color> <!-- 50% black -->
|
|
||||||
<color name="biometric_dialog_gray">#ff757575</color>
|
<color name="biometric_dialog_gray">#ff757575</color>
|
||||||
<color name="biometric_dialog_accent">@color/material_dynamic_primary40</color>
|
<color name="biometric_dialog_accent">@color/material_dynamic_primary40</color>
|
||||||
<color name="biometric_dialog_error">#ffd93025</color> <!-- red 600 -->
|
<color name="biometric_dialog_error">#ffd93025</color> <!-- red 600 -->
|
||||||
|
|||||||
@@ -90,6 +90,8 @@ public class AuthContainerView extends LinearLayout
|
|||||||
private static final int STATE_ANIMATING_OUT = 4;
|
private static final int STATE_ANIMATING_OUT = 4;
|
||||||
private static final int STATE_GONE = 5;
|
private static final int STATE_GONE = 5;
|
||||||
|
|
||||||
|
private static final float BACKGROUND_DIM_AMOUNT = 0.5f;
|
||||||
|
|
||||||
/** Shows biometric prompt dialog animation. */
|
/** Shows biometric prompt dialog animation. */
|
||||||
private static final String SHOW = "show";
|
private static final String SHOW = "show";
|
||||||
/** Dismiss biometric prompt dialog animation. */
|
/** Dismiss biometric prompt dialog animation. */
|
||||||
@@ -754,6 +756,16 @@ public class AuthContainerView extends LinearLayout
|
|||||||
.setDuration(animateDuration)
|
.setDuration(animateDuration)
|
||||||
.setInterpolator(mLinearOutSlowIn)
|
.setInterpolator(mLinearOutSlowIn)
|
||||||
.setListener(getJankListener(this, DISMISS, animateDuration))
|
.setListener(getJankListener(this, DISMISS, animateDuration))
|
||||||
|
.setUpdateListener(animation -> {
|
||||||
|
if (mWindowManager == null || getViewRootImpl() == null) {
|
||||||
|
Log.w(TAG, "skip updateViewLayout() for dim animation.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final WindowManager.LayoutParams lp = getViewRootImpl().mWindowAttributes;
|
||||||
|
lp.dimAmount = (1.0f - (Float) animation.getAnimatedValue())
|
||||||
|
* BACKGROUND_DIM_AMOUNT;
|
||||||
|
mWindowManager.updateViewLayout(this, lp);
|
||||||
|
})
|
||||||
.withLayer()
|
.withLayer()
|
||||||
.start();
|
.start();
|
||||||
});
|
});
|
||||||
@@ -800,7 +812,8 @@ public class AuthContainerView extends LinearLayout
|
|||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
static WindowManager.LayoutParams getLayoutParams(IBinder windowToken, CharSequence title) {
|
static WindowManager.LayoutParams getLayoutParams(IBinder windowToken, CharSequence title) {
|
||||||
final int windowFlags = WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED
|
final int windowFlags = WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED
|
||||||
| WindowManager.LayoutParams.FLAG_SECURE;
|
| WindowManager.LayoutParams.FLAG_SECURE
|
||||||
|
| WindowManager.LayoutParams.FLAG_DIM_BEHIND;
|
||||||
final WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
|
final WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
@@ -811,6 +824,7 @@ public class AuthContainerView extends LinearLayout
|
|||||||
lp.setFitInsetsTypes(lp.getFitInsetsTypes() & ~WindowInsets.Type.ime());
|
lp.setFitInsetsTypes(lp.getFitInsetsTypes() & ~WindowInsets.Type.ime());
|
||||||
lp.setTitle("BiometricPrompt");
|
lp.setTitle("BiometricPrompt");
|
||||||
lp.accessibilityTitle = title;
|
lp.accessibilityTitle = title;
|
||||||
|
lp.dimAmount = BACKGROUND_DIM_AMOUNT;
|
||||||
lp.token = windowToken;
|
lp.token = windowToken;
|
||||||
return lp;
|
return lp;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -296,6 +296,16 @@ class AuthContainerViewTest : SysuiTestCase() {
|
|||||||
assertThat((layoutParams.flags and WindowManager.LayoutParams.FLAG_SECURE) != 0).isTrue()
|
assertThat((layoutParams.flags and WindowManager.LayoutParams.FLAG_SECURE) != 0).isTrue()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testLayoutParams_hasDimbehindWindowFlag() {
|
||||||
|
val layoutParams = AuthContainerView.getLayoutParams(windowToken, "")
|
||||||
|
val lpFlags = layoutParams.flags
|
||||||
|
val lpDimAmount = layoutParams.dimAmount
|
||||||
|
|
||||||
|
assertThat((lpFlags and WindowManager.LayoutParams.FLAG_DIM_BEHIND) != 0).isTrue()
|
||||||
|
assertThat(lpDimAmount).isGreaterThan(0f)
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testLayoutParams_excludesImeInsets() {
|
fun testLayoutParams_excludesImeInsets() {
|
||||||
val layoutParams = AuthContainerView.getLayoutParams(windowToken, "")
|
val layoutParams = AuthContainerView.getLayoutParams(windowToken, "")
|
||||||
|
|||||||
Reference in New Issue
Block a user