Loading src/com/android/settings/biometrics/face/FaceEnrollAnimationDrawable.java +13 −12 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ 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. Loading @@ -41,17 +42,17 @@ public class FaceEnrollAnimationDrawable extends Drawable private static final int BORDER_BOUNDS = 20; private final Context mContext; private final ParticleCollection.Listener mListener; private final FaceFeatureProvider.Listener mListener; private Rect mBounds; private final Paint mSquarePaint; private final Paint mCircleCutoutPaint; private ParticleCollection mParticleCollection; private FaceFeatureProvider.EnrollingAnimation mEnrollingAnimation; private TimeAnimator mTimeAnimator; private final ParticleCollection.Listener mAnimationListener = new ParticleCollection.Listener() { private final FaceFeatureProvider.Listener mAnimationListener = new FaceFeatureProvider.Listener() { @Override public void onEnrolled() { if (mTimeAnimator != null && mTimeAnimator.isStarted()) { Loading @@ -61,7 +62,7 @@ public class FaceEnrollAnimationDrawable extends Drawable } }; public FaceEnrollAnimationDrawable(Context context, ParticleCollection.Listener listener) { public FaceEnrollAnimationDrawable(Context context, FaceFeatureProvider.Listener listener) { mContext = context; mListener = listener; Loading @@ -77,29 +78,29 @@ public class FaceEnrollAnimationDrawable extends Drawable @Override public void onEnrollmentHelp(int helpMsgId, CharSequence helpString) { mParticleCollection.onEnrollmentHelp(helpMsgId, helpString); mEnrollingAnimation.onEnrollmentHelp(helpMsgId, helpString); } @Override public void onEnrollmentError(int errMsgId, CharSequence errString) { mParticleCollection.onEnrollmentError(errMsgId, errString); mEnrollingAnimation.onEnrollmentError(errMsgId, errString); } @Override public void onEnrollmentProgressChange(int steps, int remaining) { mParticleCollection.onEnrollmentProgressChange(steps, remaining); mEnrollingAnimation.onEnrollmentProgressChange(steps, remaining); } @Override protected void onBoundsChange(Rect bounds) { mBounds = bounds; mParticleCollection = new ParticleCollection(mContext, mAnimationListener, bounds, BORDER_BOUNDS); mEnrollingAnimation = FeatureFactory.getFactory(mContext).getFaceFeatureProvider() .getEnrollingAnimation(mContext, mAnimationListener, bounds, BORDER_BOUNDS); if (mTimeAnimator == null) { mTimeAnimator = new TimeAnimator(); mTimeAnimator.setTimeListener((animation, totalTimeMs, deltaTimeMs) -> { mParticleCollection.update(totalTimeMs, deltaTimeMs); mEnrollingAnimation.update(totalTimeMs, deltaTimeMs); FaceEnrollAnimationDrawable.this.invalidateSelf(); }); mTimeAnimator.start(); Loading @@ -121,7 +122,7 @@ public class FaceEnrollAnimationDrawable extends Drawable mBounds.height() / 2 - BORDER_BOUNDS, mCircleCutoutPaint); // Draw the animation mParticleCollection.draw(canvas); mEnrollingAnimation.draw(canvas); canvas.restore(); } Loading src/com/android/settings/biometrics/face/FaceEnrollEnrolling.java +1 −1 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ public class FaceEnrollEnrolling extends BiometricsEnrollEnrolling { private boolean mShouldFinishOnStop = true; private FaceEnrollPreviewFragment mPreviewFragment; private ParticleCollection.Listener mListener = new ParticleCollection.Listener() { private FaceFeatureProvider.Listener mListener = new FaceFeatureProvider.Listener() { @Override public void onEnrolled() { FaceEnrollEnrolling.this.launchFinish(mToken); Loading src/com/android/settings/biometrics/face/FaceEnrollPreviewFragment.java +4 −4 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ public class FaceEnrollPreviewFragment extends InstrumentedPreferenceFragment private CameraCaptureSession mCaptureSession; private CaptureRequest mPreviewRequest; private Size mPreviewSize; private ParticleCollection.Listener mListener; private FaceFeatureProvider.Listener mListener; // View used to contain the circular cutout and enrollment animation drawable private ImageView mCircleView; Loading @@ -75,8 +75,8 @@ public class FaceEnrollPreviewFragment extends InstrumentedPreferenceFragment private FaceSquareTextureView mTextureView; // Listener sent to the animation drawable private final ParticleCollection.Listener mAnimationListener = new ParticleCollection.Listener() { private final FaceFeatureProvider.Listener mAnimationListener = new FaceFeatureProvider.Listener() { @Override public void onEnrolled() { mListener.onEnrolled(); Loading Loading @@ -234,7 +234,7 @@ public class FaceEnrollPreviewFragment extends InstrumentedPreferenceFragment mAnimationDrawable.onEnrollmentProgressChange(steps, remaining); } public void setListener(ParticleCollection.Listener listener) { public void setListener(FaceFeatureProvider.Listener listener) { mListener = listener; } Loading src/com/android/settings/biometrics/face/FaceFeatureProvider.java 0 → 100644 +42 −0 Original line number Diff line number Diff line /* * 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); } src/com/android/settings/biometrics/face/FaceFeatureProviderImpl.java 0 → 100644 +28 −0 Original line number Diff line number Diff line /* * 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); } } Loading
src/com/android/settings/biometrics/face/FaceEnrollAnimationDrawable.java +13 −12 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ 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. Loading @@ -41,17 +42,17 @@ public class FaceEnrollAnimationDrawable extends Drawable private static final int BORDER_BOUNDS = 20; private final Context mContext; private final ParticleCollection.Listener mListener; private final FaceFeatureProvider.Listener mListener; private Rect mBounds; private final Paint mSquarePaint; private final Paint mCircleCutoutPaint; private ParticleCollection mParticleCollection; private FaceFeatureProvider.EnrollingAnimation mEnrollingAnimation; private TimeAnimator mTimeAnimator; private final ParticleCollection.Listener mAnimationListener = new ParticleCollection.Listener() { private final FaceFeatureProvider.Listener mAnimationListener = new FaceFeatureProvider.Listener() { @Override public void onEnrolled() { if (mTimeAnimator != null && mTimeAnimator.isStarted()) { Loading @@ -61,7 +62,7 @@ public class FaceEnrollAnimationDrawable extends Drawable } }; public FaceEnrollAnimationDrawable(Context context, ParticleCollection.Listener listener) { public FaceEnrollAnimationDrawable(Context context, FaceFeatureProvider.Listener listener) { mContext = context; mListener = listener; Loading @@ -77,29 +78,29 @@ public class FaceEnrollAnimationDrawable extends Drawable @Override public void onEnrollmentHelp(int helpMsgId, CharSequence helpString) { mParticleCollection.onEnrollmentHelp(helpMsgId, helpString); mEnrollingAnimation.onEnrollmentHelp(helpMsgId, helpString); } @Override public void onEnrollmentError(int errMsgId, CharSequence errString) { mParticleCollection.onEnrollmentError(errMsgId, errString); mEnrollingAnimation.onEnrollmentError(errMsgId, errString); } @Override public void onEnrollmentProgressChange(int steps, int remaining) { mParticleCollection.onEnrollmentProgressChange(steps, remaining); mEnrollingAnimation.onEnrollmentProgressChange(steps, remaining); } @Override protected void onBoundsChange(Rect bounds) { mBounds = bounds; mParticleCollection = new ParticleCollection(mContext, mAnimationListener, bounds, BORDER_BOUNDS); mEnrollingAnimation = FeatureFactory.getFactory(mContext).getFaceFeatureProvider() .getEnrollingAnimation(mContext, mAnimationListener, bounds, BORDER_BOUNDS); if (mTimeAnimator == null) { mTimeAnimator = new TimeAnimator(); mTimeAnimator.setTimeListener((animation, totalTimeMs, deltaTimeMs) -> { mParticleCollection.update(totalTimeMs, deltaTimeMs); mEnrollingAnimation.update(totalTimeMs, deltaTimeMs); FaceEnrollAnimationDrawable.this.invalidateSelf(); }); mTimeAnimator.start(); Loading @@ -121,7 +122,7 @@ public class FaceEnrollAnimationDrawable extends Drawable mBounds.height() / 2 - BORDER_BOUNDS, mCircleCutoutPaint); // Draw the animation mParticleCollection.draw(canvas); mEnrollingAnimation.draw(canvas); canvas.restore(); } Loading
src/com/android/settings/biometrics/face/FaceEnrollEnrolling.java +1 −1 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ public class FaceEnrollEnrolling extends BiometricsEnrollEnrolling { private boolean mShouldFinishOnStop = true; private FaceEnrollPreviewFragment mPreviewFragment; private ParticleCollection.Listener mListener = new ParticleCollection.Listener() { private FaceFeatureProvider.Listener mListener = new FaceFeatureProvider.Listener() { @Override public void onEnrolled() { FaceEnrollEnrolling.this.launchFinish(mToken); Loading
src/com/android/settings/biometrics/face/FaceEnrollPreviewFragment.java +4 −4 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ public class FaceEnrollPreviewFragment extends InstrumentedPreferenceFragment private CameraCaptureSession mCaptureSession; private CaptureRequest mPreviewRequest; private Size mPreviewSize; private ParticleCollection.Listener mListener; private FaceFeatureProvider.Listener mListener; // View used to contain the circular cutout and enrollment animation drawable private ImageView mCircleView; Loading @@ -75,8 +75,8 @@ public class FaceEnrollPreviewFragment extends InstrumentedPreferenceFragment private FaceSquareTextureView mTextureView; // Listener sent to the animation drawable private final ParticleCollection.Listener mAnimationListener = new ParticleCollection.Listener() { private final FaceFeatureProvider.Listener mAnimationListener = new FaceFeatureProvider.Listener() { @Override public void onEnrolled() { mListener.onEnrolled(); Loading Loading @@ -234,7 +234,7 @@ public class FaceEnrollPreviewFragment extends InstrumentedPreferenceFragment mAnimationDrawable.onEnrollmentProgressChange(steps, remaining); } public void setListener(ParticleCollection.Listener listener) { public void setListener(FaceFeatureProvider.Listener listener) { mListener = listener; } Loading
src/com/android/settings/biometrics/face/FaceFeatureProvider.java 0 → 100644 +42 −0 Original line number Diff line number Diff line /* * 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); }
src/com/android/settings/biometrics/face/FaceFeatureProviderImpl.java 0 → 100644 +28 −0 Original line number Diff line number Diff line /* * 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); } }