Merge changes Idd1f2b2b,I6a46bb2f,Ibdf7c175

* changes:
  Move the animation delay for credential UI up one layer
  Animate height animator together with the rest of the AnimatorSet
  Temporarily do not remove biometric view when animating to credential
This commit is contained in:
Kevin Chyn
2019-10-26 00:37:10 +00:00
committed by Android (Google) Code Review
5 changed files with 19 additions and 22 deletions

View File

@@ -23,7 +23,6 @@ import android.animation.ValueAnimator;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.hardware.biometrics.BiometricPrompt;
import android.os.Bundle;
@@ -41,7 +40,6 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.widget.LockPatternUtils;
import com.android.systemui.R;
import java.lang.annotation.Retention;
@@ -152,10 +150,6 @@ public abstract class AuthBiometricView extends LinearLayout {
public int getMediumToLargeAnimationDurationMs() {
return AuthDialog.ANIMATE_MEDIUM_TO_LARGE_DURATION_MS;
}
public int getAnimateCredentialStartDelayMs() {
return AuthDialog.ANIMATE_CREDENTIAL_START_DELAY_MS;
}
}
private final Injector mInjector;
@@ -632,9 +626,7 @@ public abstract class AuthBiometricView extends LinearLayout {
*/
void startTransitionToCredentialUI() {
updateSize(AuthDialog.SIZE_LARGE);
mHandler.postDelayed(() -> {
mCallback.onAction(Callback.ACTION_USE_DEVICE_CREDENTIAL);
}, mInjector.getAnimateCredentialStartDelayMs());
mCallback.onAction(Callback.ACTION_USE_DEVICE_CREDENTIAL);
}
@Override

View File

@@ -24,13 +24,12 @@ import android.content.Context;
import android.graphics.PixelFormat;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.hardware.biometrics.Authenticator;
import android.hardware.biometrics.BiometricAuthenticator;
import android.hardware.biometrics.BiometricPrompt;
import android.os.Binder;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.UserManager;
import android.os.Looper;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
@@ -75,6 +74,7 @@ public class AuthContainerView extends LinearLayout
@interface ContainerState {}
final Config mConfig;
private final Handler mHandler;
private final Injector mInjector;
private final IBinder mWindowToken = new Binder();
private final WindowManager mWindowManager;
@@ -177,6 +177,10 @@ public class AuthContainerView extends LinearLayout
View getPanelView(FrameLayout parent) {
return parent.findViewById(R.id.panel);
}
int getAnimateCredentialStartDelayMs() {
return AuthDialog.ANIMATE_CREDENTIAL_START_DELAY_MS;
}
}
@VisibleForTesting
@@ -201,7 +205,9 @@ public class AuthContainerView extends LinearLayout
break;
case AuthBiometricView.Callback.ACTION_USE_DEVICE_CREDENTIAL:
mConfig.mCallback.onDeviceCredentialPressed();
addCredentialView(false /* animatePanel */, true /* animateContents */);
mHandler.postDelayed(() -> {
addCredentialView(false /* animatePanel */, true /* animateContents */);
}, mInjector.getAnimateCredentialStartDelayMs());
break;
default:
Log.e(TAG, "Unhandled action: " + action);
@@ -223,6 +229,7 @@ public class AuthContainerView extends LinearLayout
mConfig = config;
mInjector = injector;
mHandler = new Handler(Looper.getMainLooper());
mWindowManager = mContext.getSystemService(WindowManager.class);
mWakefulnessLifecycle = Dependency.get(WakefulnessLifecycle.class);

View File

@@ -19,7 +19,6 @@ package com.android.systemui.biometrics;
import android.animation.AnimatorSet;
import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Outline;
import android.util.Log;
import android.view.View;
@@ -142,7 +141,6 @@ public class AuthPanelController extends ViewOutlineProvider {
mContentHeight = (int) animation.getAnimatedValue();
mPanelView.invalidateOutline();
});
heightAnimator.start();
// Animate width
ValueAnimator widthAnimator = ValueAnimator.ofInt(mContentWidth, contentWidth);
@@ -163,7 +161,8 @@ public class AuthPanelController extends ViewOutlineProvider {
AnimatorSet as = new AnimatorSet();
as.setDuration(animateDurationMs);
as.setInterpolator(new AccelerateDecelerateInterpolator());
as.playTogether(cornerAnimator, widthAnimator, marginAnimator, alphaAnimator);
as.playTogether(cornerAnimator, heightAnimator, widthAnimator, marginAnimator,
alphaAnimator);
as.start();
} else {

View File

@@ -370,11 +370,6 @@ public class AuthBiometricViewTest extends SysuiTestCase {
public int getMediumToLargeAnimationDurationMs() {
return 0;
}
@Override
public int getAnimateCredentialStartDelayMs() {
return 0;
}
}
private class TestableBiometricView extends AuthBiometricView {

View File

@@ -16,7 +16,6 @@
package com.android.systemui.biometrics;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
@@ -206,5 +205,10 @@ public class AuthContainerViewTest extends SysuiTestCase {
public View getPanelView(FrameLayout parent) {
return mock(View.class);
}
@Override
public int getAnimateCredentialStartDelayMs() {
return 0;
}
}
}