Revert "Get enrollment animation from overlay"
This reverts commit 9ed7cb40cb
.
Bug: 111548033
Bug: 121222038
Change-Id: Ic9c85628c45ea5327d0d3b6969034c13789b920c
This commit is contained in:
@@ -29,7 +29,6 @@ import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
import com.android.settings.biometrics.BiometricEnrollSidecar;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
|
||||
/**
|
||||
* A drawable containing the circle cutout as well as the animations.
|
||||
@@ -42,17 +41,17 @@ public class FaceEnrollAnimationDrawable extends Drawable
|
||||
private static final int BORDER_BOUNDS = 20;
|
||||
|
||||
private final Context mContext;
|
||||
private final FaceFeatureProvider.Listener mListener;
|
||||
private final ParticleCollection.Listener mListener;
|
||||
private Rect mBounds;
|
||||
private final Paint mSquarePaint;
|
||||
private final Paint mCircleCutoutPaint;
|
||||
|
||||
private FaceFeatureProvider.EnrollingAnimation mEnrollingAnimation;
|
||||
private ParticleCollection mParticleCollection;
|
||||
|
||||
private TimeAnimator mTimeAnimator;
|
||||
|
||||
private final FaceFeatureProvider.Listener mAnimationListener
|
||||
= new FaceFeatureProvider.Listener() {
|
||||
private final ParticleCollection.Listener mAnimationListener
|
||||
= new ParticleCollection.Listener() {
|
||||
@Override
|
||||
public void onEnrolled() {
|
||||
if (mTimeAnimator != null && mTimeAnimator.isStarted()) {
|
||||
@@ -62,7 +61,7 @@ public class FaceEnrollAnimationDrawable extends Drawable
|
||||
}
|
||||
};
|
||||
|
||||
public FaceEnrollAnimationDrawable(Context context, FaceFeatureProvider.Listener listener) {
|
||||
public FaceEnrollAnimationDrawable(Context context, ParticleCollection.Listener listener) {
|
||||
mContext = context;
|
||||
mListener = listener;
|
||||
|
||||
@@ -78,29 +77,29 @@ public class FaceEnrollAnimationDrawable extends Drawable
|
||||
|
||||
@Override
|
||||
public void onEnrollmentHelp(int helpMsgId, CharSequence helpString) {
|
||||
mEnrollingAnimation.onEnrollmentHelp(helpMsgId, helpString);
|
||||
mParticleCollection.onEnrollmentHelp(helpMsgId, helpString);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnrollmentError(int errMsgId, CharSequence errString) {
|
||||
mEnrollingAnimation.onEnrollmentError(errMsgId, errString);
|
||||
mParticleCollection.onEnrollmentError(errMsgId, errString);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnrollmentProgressChange(int steps, int remaining) {
|
||||
mEnrollingAnimation.onEnrollmentProgressChange(steps, remaining);
|
||||
mParticleCollection.onEnrollmentProgressChange(steps, remaining);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBoundsChange(Rect bounds) {
|
||||
mBounds = bounds;
|
||||
mEnrollingAnimation = FeatureFactory.getFactory(mContext).getFaceFeatureProvider()
|
||||
.getEnrollingAnimation(mContext, mAnimationListener, bounds, BORDER_BOUNDS);
|
||||
mParticleCollection =
|
||||
new ParticleCollection(mContext, mAnimationListener, bounds, BORDER_BOUNDS);
|
||||
|
||||
if (mTimeAnimator == null) {
|
||||
mTimeAnimator = new TimeAnimator();
|
||||
mTimeAnimator.setTimeListener((animation, totalTimeMs, deltaTimeMs) -> {
|
||||
mEnrollingAnimation.update(totalTimeMs, deltaTimeMs);
|
||||
mParticleCollection.update(totalTimeMs, deltaTimeMs);
|
||||
FaceEnrollAnimationDrawable.this.invalidateSelf();
|
||||
});
|
||||
mTimeAnimator.start();
|
||||
@@ -122,7 +121,7 @@ public class FaceEnrollAnimationDrawable extends Drawable
|
||||
mBounds.height() / 2 - BORDER_BOUNDS, mCircleCutoutPaint);
|
||||
|
||||
// Draw the animation
|
||||
mEnrollingAnimation.draw(canvas);
|
||||
mParticleCollection.draw(canvas);
|
||||
|
||||
canvas.restore();
|
||||
}
|
||||
|
@@ -49,8 +49,7 @@ public class FaceEnrollEnrolling extends BiometricsEnrollEnrolling {
|
||||
private FaceEnrollPreviewFragment mPreviewFragment;
|
||||
|
||||
private ArrayList<Integer> mDisabledFeatures = new ArrayList<>();
|
||||
|
||||
private FaceFeatureProvider.Listener mListener = new FaceFeatureProvider.Listener() {
|
||||
private ParticleCollection.Listener mListener = new ParticleCollection.Listener() {
|
||||
@Override
|
||||
public void onEnrolled() {
|
||||
FaceEnrollEnrolling.this.launchFinish(mToken);
|
||||
|
@@ -63,7 +63,7 @@ public class FaceEnrollPreviewFragment extends InstrumentedPreferenceFragment
|
||||
private CameraCaptureSession mCaptureSession;
|
||||
private CaptureRequest mPreviewRequest;
|
||||
private Size mPreviewSize;
|
||||
private FaceFeatureProvider.Listener mListener;
|
||||
private ParticleCollection.Listener mListener;
|
||||
|
||||
// View used to contain the circular cutout and enrollment animation drawable
|
||||
private ImageView mCircleView;
|
||||
@@ -75,8 +75,8 @@ public class FaceEnrollPreviewFragment extends InstrumentedPreferenceFragment
|
||||
private FaceSquareTextureView mTextureView;
|
||||
|
||||
// Listener sent to the animation drawable
|
||||
private final FaceFeatureProvider.Listener mAnimationListener
|
||||
= new FaceFeatureProvider.Listener() {
|
||||
private final ParticleCollection.Listener mAnimationListener
|
||||
= new ParticleCollection.Listener() {
|
||||
@Override
|
||||
public void onEnrolled() {
|
||||
mListener.onEnrolled();
|
||||
@@ -234,7 +234,7 @@ public class FaceEnrollPreviewFragment extends InstrumentedPreferenceFragment
|
||||
mAnimationDrawable.onEnrollmentProgressChange(steps, remaining);
|
||||
}
|
||||
|
||||
public void setListener(FaceFeatureProvider.Listener listener) {
|
||||
public void setListener(ParticleCollection.Listener listener) {
|
||||
mListener = listener;
|
||||
}
|
||||
|
||||
|
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License
|
||||
*/
|
||||
|
||||
package com.android.settings.biometrics.face;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
|
||||
/**
|
||||
* Feature provider for face authentication.
|
||||
*/
|
||||
public interface FaceFeatureProvider {
|
||||
|
||||
interface EnrollingAnimation {
|
||||
void onEnrollmentHelp(int helpMsgId, CharSequence helpString);
|
||||
void onEnrollmentError(int errMsgId, CharSequence errString);
|
||||
void onEnrollmentProgressChange(int steps, int remaining);
|
||||
void draw(Canvas canvas);
|
||||
void update(long t, long dt);
|
||||
}
|
||||
|
||||
interface Listener {
|
||||
void onEnrolled();
|
||||
}
|
||||
|
||||
EnrollingAnimation getEnrollingAnimation(Context context, Listener listener, Rect bounds,
|
||||
int borderWidth);
|
||||
}
|
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License
|
||||
*/
|
||||
|
||||
package com.android.settings.biometrics.face;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
|
||||
public class FaceFeatureProviderImpl implements FaceFeatureProvider {
|
||||
@Override
|
||||
public EnrollingAnimation getEnrollingAnimation(Context context, Listener listener, Rect bounds,
|
||||
int borderWidth) {
|
||||
return new ParticleCollection(context, listener, bounds, borderWidth);
|
||||
}
|
||||
}
|
@@ -35,7 +35,7 @@ import java.util.List;
|
||||
* are updated/drawn in a special order so that the overlap is correct during the final completion
|
||||
* effect.
|
||||
*/
|
||||
public class ParticleCollection implements FaceFeatureProviderImpl.EnrollingAnimation {
|
||||
public class ParticleCollection implements BiometricEnrollSidecar.Listener {
|
||||
|
||||
private static final String TAG = "AnimationController";
|
||||
|
||||
@@ -49,7 +49,11 @@ public class ParticleCollection implements FaceFeatureProviderImpl.EnrollingAnim
|
||||
private final List<AnimationParticle> mParticleList;
|
||||
private final List<Integer> mPrimariesInProgress; // primary particles not done animating yet
|
||||
private int mState;
|
||||
private FaceFeatureProvider.Listener mListener;
|
||||
private Listener mListener;
|
||||
|
||||
public interface Listener {
|
||||
void onEnrolled();
|
||||
}
|
||||
|
||||
private final AnimationParticle.Listener mParticleListener = new AnimationParticle.Listener() {
|
||||
@Override
|
||||
@@ -68,8 +72,7 @@ public class ParticleCollection implements FaceFeatureProviderImpl.EnrollingAnim
|
||||
}
|
||||
};
|
||||
|
||||
public ParticleCollection(Context context, FaceFeatureProvider.Listener listener, Rect bounds,
|
||||
int borderWidth) {
|
||||
public ParticleCollection(Context context, Listener listener, Rect bounds, int borderWidth) {
|
||||
mParticleList = new ArrayList<>();
|
||||
mListener = listener;
|
||||
|
||||
@@ -100,14 +103,12 @@ public class ParticleCollection implements FaceFeatureProviderImpl.EnrollingAnim
|
||||
updateState(STATE_STARTED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(long t, long dt) {
|
||||
for (int i = 0; i < mParticleList.size(); i++) {
|
||||
mParticleList.get(i).update(t, dt);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Canvas canvas) {
|
||||
for (int i = 0; i < mParticleList.size(); i++) {
|
||||
mParticleList.get(i).draw(canvas);
|
||||
|
@@ -23,7 +23,6 @@ import android.util.Log;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.accounts.AccountFeatureProvider;
|
||||
import com.android.settings.applications.ApplicationFeatureProvider;
|
||||
import com.android.settings.biometrics.face.FaceFeatureProvider;
|
||||
import com.android.settings.bluetooth.BluetoothFeatureProvider;
|
||||
import com.android.settings.dashboard.DashboardFeatureProvider;
|
||||
import com.android.settings.dashboard.suggestions.SuggestionFeatureProvider;
|
||||
@@ -113,8 +112,6 @@ public abstract class FeatureFactory {
|
||||
|
||||
public abstract ContextualCardFeatureProvider getContextualCardFeatureProvider(Context context);
|
||||
|
||||
public abstract FaceFeatureProvider getFaceFeatureProvider();
|
||||
|
||||
public abstract BluetoothFeatureProvider getBluetoothFeatureProvider(Context context);
|
||||
|
||||
public static final class FactoryNotFoundException extends RuntimeException {
|
||||
|
@@ -28,8 +28,6 @@ import com.android.settings.accounts.AccountFeatureProvider;
|
||||
import com.android.settings.accounts.AccountFeatureProviderImpl;
|
||||
import com.android.settings.applications.ApplicationFeatureProvider;
|
||||
import com.android.settings.applications.ApplicationFeatureProviderImpl;
|
||||
import com.android.settings.biometrics.face.FaceFeatureProvider;
|
||||
import com.android.settings.biometrics.face.FaceFeatureProviderImpl;
|
||||
import com.android.settings.bluetooth.BluetoothFeatureProvider;
|
||||
import com.android.settings.bluetooth.BluetoothFeatureProviderImpl;
|
||||
import com.android.settings.connecteddevice.dock.DockUpdaterFeatureProviderImpl;
|
||||
@@ -82,7 +80,6 @@ public class FeatureFactoryImpl extends FeatureFactory {
|
||||
private AccountFeatureProvider mAccountFeatureProvider;
|
||||
private PanelFeatureProvider mPanelFeatureProvider;
|
||||
private ContextualCardFeatureProvider mContextualCardFeatureProvider;
|
||||
private FaceFeatureProvider mFaceFeatureProvider;
|
||||
private BluetoothFeatureProvider mBluetoothFeatureProvider;
|
||||
|
||||
@Override
|
||||
@@ -239,14 +236,6 @@ public class FeatureFactoryImpl extends FeatureFactory {
|
||||
return mContextualCardFeatureProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FaceFeatureProvider getFaceFeatureProvider() {
|
||||
if (mFaceFeatureProvider == null) {
|
||||
mFaceFeatureProvider = new FaceFeatureProviderImpl();
|
||||
}
|
||||
return mFaceFeatureProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BluetoothFeatureProvider getBluetoothFeatureProvider(Context context) {
|
||||
if (mBluetoothFeatureProvider == null) {
|
||||
|
@@ -23,7 +23,6 @@ import android.content.Context;
|
||||
|
||||
import com.android.settings.accounts.AccountFeatureProvider;
|
||||
import com.android.settings.applications.ApplicationFeatureProvider;
|
||||
import com.android.settings.biometrics.face.FaceFeatureProvider;
|
||||
import com.android.settings.bluetooth.BluetoothFeatureProvider;
|
||||
import com.android.settings.dashboard.DashboardFeatureProvider;
|
||||
import com.android.settings.dashboard.suggestions.SuggestionFeatureProvider;
|
||||
@@ -66,7 +65,6 @@ public class FakeFeatureFactory extends FeatureFactory {
|
||||
public final AssistGestureFeatureProvider assistGestureFeatureProvider;
|
||||
public final AccountFeatureProvider mAccountFeatureProvider;
|
||||
public final ContextualCardFeatureProvider mContextualCardFeatureProvider;
|
||||
public final FaceFeatureProvider mFaceFeatureProvider;
|
||||
public final BluetoothFeatureProvider mBluetoothFeatureProvider;
|
||||
|
||||
public PanelFeatureProvider panelFeatureProvider;
|
||||
@@ -112,7 +110,6 @@ public class FakeFeatureFactory extends FeatureFactory {
|
||||
mAccountFeatureProvider = mock(AccountFeatureProvider.class);
|
||||
mContextualCardFeatureProvider = mock(ContextualCardFeatureProvider.class);
|
||||
panelFeatureProvider = mock(PanelFeatureProvider.class);
|
||||
mFaceFeatureProvider = mock(FaceFeatureProvider.class);
|
||||
mBluetoothFeatureProvider = mock(BluetoothFeatureProvider.class);
|
||||
}
|
||||
|
||||
@@ -201,15 +198,11 @@ public class FakeFeatureFactory extends FeatureFactory {
|
||||
return panelFeatureProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContextualCardFeatureProvider getContextualCardFeatureProvider(Context context) {
|
||||
return mContextualCardFeatureProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FaceFeatureProvider getFaceFeatureProvider() {
|
||||
return mFaceFeatureProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BluetoothFeatureProvider getBluetoothFeatureProvider(Context context) {
|
||||
return mBluetoothFeatureProvider;
|
||||
|
Reference in New Issue
Block a user