Remove separate background for managed profiles
This change removes the managed profile background to address the two issues below: 1) When one-lock is enabled, the credential UI will no longer incorrectly show the managed profile background. This bug was introduced when credential authentication UI was moved to SystemUI 2) The new managed profile authentication UX no longer uses a separate background Fixes: 147653255 Bug: 141290838 Test: atest com.android.systemui.biometrics Change-Id: Ib48f5e5c97c4c16c430625864377a001e100de1a
This commit is contained in:
@@ -28,7 +28,6 @@ import android.hardware.biometrics.BiometricPrompt;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.UserManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
@@ -381,16 +380,7 @@ public abstract class AuthBiometricView extends LinearLayout {
|
||||
0 /* animateDurationMs */);
|
||||
mSize = newSize;
|
||||
} else if (newSize == AuthDialog.SIZE_LARGE) {
|
||||
final boolean isManagedProfile = Utils.isManagedProfile(mContext, mUserId);
|
||||
|
||||
// If it's a managed profile, animate the contents and panel down, since the credential
|
||||
// contents will be shown on the same "layer" as the background. If it's not a managed
|
||||
// profile, animate the contents up and expand the panel to full-screen - the credential
|
||||
// contents will be shown on the same "layer" as the panel.
|
||||
final float translationY = isManagedProfile ?
|
||||
-getResources().getDimension(
|
||||
R.dimen.biometric_dialog_animation_translation_offset)
|
||||
: getResources().getDimension(
|
||||
final float translationY = getResources().getDimension(
|
||||
R.dimen.biometric_dialog_medium_to_large_translation_offset);
|
||||
final AuthBiometricView biometricView = this;
|
||||
|
||||
@@ -421,26 +411,20 @@ public abstract class AuthBiometricView extends LinearLayout {
|
||||
biometricView.setAlpha(opacity);
|
||||
});
|
||||
|
||||
if (!isManagedProfile) {
|
||||
mPanelController.setUseFullScreen(true);
|
||||
mPanelController.updateForContentDimensions(
|
||||
mPanelController.getContainerWidth(),
|
||||
mPanelController.getContainerHeight(),
|
||||
mInjector.getMediumToLargeAnimationDurationMs());
|
||||
}
|
||||
mPanelController.setUseFullScreen(true);
|
||||
mPanelController.updateForContentDimensions(
|
||||
mPanelController.getContainerWidth(),
|
||||
mPanelController.getContainerHeight(),
|
||||
mInjector.getMediumToLargeAnimationDurationMs());
|
||||
|
||||
// Start the animations together
|
||||
AnimatorSet as = new AnimatorSet();
|
||||
List<Animator> animators = new ArrayList<>();
|
||||
animators.add(translationAnimator);
|
||||
animators.add(opacityAnimator);
|
||||
if (isManagedProfile) {
|
||||
animators.add(mPanelController.getTranslationAnimator(translationY));
|
||||
animators.add(mPanelController.getAlphaAnimator(0));
|
||||
}
|
||||
|
||||
as.playTogether(animators);
|
||||
as.setDuration(isManagedProfile ? mInjector.getMediumToLargeAnimationDurationMs()
|
||||
: mInjector.getMediumToLargeAnimationDurationMs() * 2 / 3);
|
||||
as.setDuration(mInjector.getMediumToLargeAnimationDurationMs() * 2 / 3);
|
||||
as.start();
|
||||
} else {
|
||||
Log.e(TAG, "Unknown transition from: " + mSize + " to: " + newSize);
|
||||
|
||||
@@ -19,11 +19,8 @@ package com.android.systemui.biometrics;
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.content.Context;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.hardware.biometrics.BiometricAuthenticator;
|
||||
import android.os.Binder;
|
||||
import android.os.Bundle;
|
||||
@@ -168,9 +165,8 @@ public class AuthContainerView extends LinearLayout
|
||||
R.layout.auth_container_view, root, false /* attachToRoot */);
|
||||
}
|
||||
|
||||
AuthPanelController getPanelController(Context context, View panelView,
|
||||
boolean isManagedProfile) {
|
||||
return new AuthPanelController(context, panelView, isManagedProfile);
|
||||
AuthPanelController getPanelController(Context context, View panelView) {
|
||||
return new AuthPanelController(context, panelView);
|
||||
}
|
||||
|
||||
ImageView getBackgroundView(FrameLayout parent) {
|
||||
@@ -256,10 +252,8 @@ public class AuthContainerView extends LinearLayout
|
||||
final LayoutInflater factory = LayoutInflater.from(mContext);
|
||||
mFrameLayout = mInjector.inflateContainerView(factory, this);
|
||||
|
||||
final boolean isManagedProfile = Utils.isManagedProfile(mContext, mConfig.mUserId);
|
||||
|
||||
mPanelView = mInjector.getPanelView(mFrameLayout);
|
||||
mPanelController = mInjector.getPanelController(mContext, mPanelView, isManagedProfile);
|
||||
mPanelController = mInjector.getPanelController(mContext, mPanelView);
|
||||
|
||||
// Inflate biometric view only if necessary.
|
||||
if (Utils.isBiometricAllowed(mConfig.mBiometricPromptBundle)) {
|
||||
@@ -281,16 +275,6 @@ public class AuthContainerView extends LinearLayout
|
||||
mBiometricScrollView = mInjector.getBiometricScrollView(mFrameLayout);
|
||||
mBackgroundView = mInjector.getBackgroundView(mFrameLayout);
|
||||
|
||||
if (isManagedProfile) {
|
||||
final Drawable image = getResources().getDrawable(R.drawable.work_challenge_background,
|
||||
mContext.getTheme());
|
||||
final DevicePolicyManager dpm = mContext.getSystemService(DevicePolicyManager.class);
|
||||
image.setColorFilter(dpm.getOrganizationColorForUser(mConfig.mUserId),
|
||||
PorterDuff.Mode.DARKEN);
|
||||
mBackgroundView.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
mBackgroundView.setImageDrawable(image);
|
||||
}
|
||||
|
||||
addView(mFrameLayout);
|
||||
|
||||
setOnKeyListener((v, keyCode, event) -> {
|
||||
|
||||
@@ -37,7 +37,6 @@ public class AuthPanelController extends ViewOutlineProvider {
|
||||
|
||||
private final Context mContext;
|
||||
private final View mPanelView;
|
||||
private final boolean mIsManagedProfile;
|
||||
|
||||
private boolean mUseFullScreen;
|
||||
|
||||
@@ -115,13 +114,6 @@ public class AuthPanelController extends ViewOutlineProvider {
|
||||
final float cornerRadius = mUseFullScreen ? 0 : mContext.getResources()
|
||||
.getDimension(R.dimen.biometric_dialog_corner_size);
|
||||
|
||||
// When going to full-screen for managed profiles, fade away so the managed profile
|
||||
// background behind this view becomes visible.
|
||||
final boolean shouldFadeAway = mUseFullScreen && mIsManagedProfile;
|
||||
final int alpha = shouldFadeAway ? 0 : 255;
|
||||
final float elevation = shouldFadeAway ? 0 :
|
||||
mContext.getResources().getDimension(R.dimen.biometric_dialog_elevation);
|
||||
|
||||
if (animateDurationMs > 0) {
|
||||
// Animate margin
|
||||
ValueAnimator marginAnimator = ValueAnimator.ofInt(mMargin, margin);
|
||||
@@ -148,21 +140,11 @@ public class AuthPanelController extends ViewOutlineProvider {
|
||||
mContentWidth = (int) animation.getAnimatedValue();
|
||||
});
|
||||
|
||||
// Animate background
|
||||
ValueAnimator alphaAnimator = ValueAnimator.ofInt(
|
||||
mPanelView.getBackground().getAlpha(), alpha);
|
||||
alphaAnimator.addUpdateListener((animation) -> {
|
||||
if (shouldFadeAway) {
|
||||
mPanelView.getBackground().setAlpha((int) animation.getAnimatedValue());
|
||||
}
|
||||
});
|
||||
|
||||
// Play together
|
||||
AnimatorSet as = new AnimatorSet();
|
||||
as.setDuration(animateDurationMs);
|
||||
as.setInterpolator(new AccelerateDecelerateInterpolator());
|
||||
as.playTogether(cornerAnimator, heightAnimator, widthAnimator, marginAnimator,
|
||||
alphaAnimator);
|
||||
as.playTogether(cornerAnimator, heightAnimator, widthAnimator, marginAnimator);
|
||||
as.start();
|
||||
|
||||
} else {
|
||||
@@ -170,7 +152,6 @@ public class AuthPanelController extends ViewOutlineProvider {
|
||||
mCornerRadius = cornerRadius;
|
||||
mContentWidth = contentWidth;
|
||||
mContentHeight = contentHeight;
|
||||
mPanelView.getBackground().setAlpha(alpha);
|
||||
mPanelView.invalidateOutline();
|
||||
}
|
||||
}
|
||||
@@ -183,10 +164,9 @@ public class AuthPanelController extends ViewOutlineProvider {
|
||||
return mContainerHeight;
|
||||
}
|
||||
|
||||
AuthPanelController(Context context, View panelView, boolean isManagedProfile) {
|
||||
AuthPanelController(Context context, View panelView) {
|
||||
mContext = context;
|
||||
mPanelView = panelView;
|
||||
mIsManagedProfile = isManagedProfile;
|
||||
mCornerRadius = context.getResources()
|
||||
.getDimension(R.dimen.biometric_dialog_corner_size);
|
||||
mMargin = (int) context.getResources()
|
||||
|
||||
@@ -211,8 +211,7 @@ public class AuthContainerViewTest extends SysuiTestCase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthPanelController getPanelController(Context context, View view,
|
||||
boolean isManagedProfile) {
|
||||
public AuthPanelController getPanelController(Context context, View view) {
|
||||
return mock(AuthPanelController.class);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user