Loading packages/SystemUI/res-keyguard/layout/keyguard_security_container_view.xml→packages/SystemUI/res-keyguard/layout/keyguard_host_view.xml +25 −11 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ** ** Copyright 2023, The Android Open Source Project ** Copyright 2012, 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. Loading @@ -17,10 +17,12 @@ */ --> <com.android.keyguard.KeyguardSecurityContainer <!-- This is the host view that generally contains two sub views: the widget view and the security view. --> <com.android.keyguard.KeyguardHostView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:androidprv="http://schemas.android.com/apk/res-auto" android:id="@+id/keyguard_security_container" android:id="@+id/keyguard_host_view" android:layout_width="match_parent" android:layout_height="match_parent" android:clipChildren="false" Loading @@ -28,6 +30,16 @@ android:paddingTop="@dimen/keyguard_lock_padding" android:importantForAccessibility="yes"> <!-- Needed because TYPE_WINDOW_STATE_CHANGED is sent from this view when bouncer is shown --> <com.android.keyguard.KeyguardSecurityContainer android:id="@+id/keyguard_security_container" android:layout_width="match_parent" android:layout_height="match_parent" android:clipChildren="false" android:clipToPadding="false" android:padding="0dp" android:fitsSystemWindows="true" android:layout_gravity="center"> <com.android.keyguard.KeyguardSecurityViewFlipper android:id="@+id/view_flipper" android:layout_width="wrap_content" Loading @@ -40,3 +52,5 @@ </com.android.keyguard.KeyguardSecurityViewFlipper> </com.android.keyguard.KeyguardSecurityContainer> </com.android.keyguard.KeyguardHostView> packages/SystemUI/src/com/android/keyguard/KeyguardHostView.java 0 → 100644 +78 −0 Original line number Diff line number Diff line /* * Copyright (C) 2007 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.keyguard; import android.content.Context; import android.graphics.Canvas; import android.util.AttributeSet; import android.view.MotionEvent; import android.widget.FrameLayout; /** * Base class for keyguard view. {@link #reset} is where you should * reset the state of your view. Use the {@link KeyguardViewCallback} via * {@link #getCallback()} to send information back (such as poking the wake lock, * or finishing the keyguard). * * Handles intercepting of media keys that still work when the keyguard is * showing. */ public class KeyguardHostView extends FrameLayout { protected ViewMediatorCallback mViewMediatorCallback; private boolean mIsInteractable; public KeyguardHostView(Context context) { this(context, null); } public KeyguardHostView(Context context, AttributeSet attrs) { super(context, attrs); } @Override protected void dispatchDraw(Canvas canvas) { super.dispatchDraw(canvas); if (mViewMediatorCallback != null) { mViewMediatorCallback.keyguardDoneDrawing(); } } public void setViewMediatorCallback(ViewMediatorCallback viewMediatorCallback) { mViewMediatorCallback = viewMediatorCallback; } /** Set true if the view can be interacted with */ public void setInteractable(boolean isInteractable) { mIsInteractable = isInteractable; } /** * Make sure to disallow touches while transitioning the bouncer, otherwise * it can remain interactable even when barely visible. */ @Override public boolean onInterceptTouchEvent(MotionEvent ev) { return !mIsInteractable; } /** True to consume any events that are sent to it */ @Override public boolean onTouchEvent(MotionEvent ev) { return true; } } packages/SystemUI/src/com/android/keyguard/KeyguardHostViewController.java 0 → 100644 +535 −0 File added.Preview size limit exceeded, changes collapsed. Show changes packages/SystemUI/src/com/android/keyguard/KeyguardInputViewController.java +20 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,26 @@ public abstract class KeyguardInputViewController<T extends KeyguardInputView> // The following is used to ignore callbacks from SecurityViews that are no longer current // (e.g. face unlock). This avoids unwanted asynchronous events from messing with the // state for the current security method. private KeyguardSecurityCallback mNullCallback = new KeyguardSecurityCallback() {}; private KeyguardSecurityCallback mNullCallback = new KeyguardSecurityCallback() { @Override public void userActivity() { } @Override public void reportUnlockAttempt(int userId, boolean success, int timeoutMs) { } @Override public boolean isVerifyUnlockOnly() { return false; } @Override public void dismiss(boolean securityVerified, int targetUserId, SecurityMode expectedSecurityMode) { } @Override public void dismiss(boolean authenticated, int targetId, boolean bypassSecondaryLockScreen, SecurityMode expectedSecurityMode) { } @Override public void onUserInput() { } @Override public void reset() {} }; protected KeyguardInputViewController(T view, SecurityMode securityMode, KeyguardSecurityCallback keyguardSecurityCallback, Loading packages/SystemUI/src/com/android/keyguard/KeyguardSecurityCallback.java +8 −33 Original line number Diff line number Diff line Loading @@ -25,9 +25,7 @@ public interface KeyguardSecurityCallback { * @param targetUserId a user that needs to be the foreground user at the dismissal completion. * @param expectedSecurityMode The security mode that is invoking this dismiss. */ default void dismiss(boolean securityVerified, int targetUserId, SecurityMode expectedSecurityMode) { } void dismiss(boolean securityVerified, int targetUserId, SecurityMode expectedSecurityMode); /** * Dismiss the given security screen. Loading @@ -37,26 +35,19 @@ public interface KeyguardSecurityCallback { * if any, during this dismissal. * @param expectedSecurityMode The security mode that is invoking this dismiss. */ default boolean dismiss(boolean securityVerified, int targetUserId, boolean bypassSecondaryLockScreen, SecurityMode expectedSecurityMode) { return false; } void dismiss(boolean securityVerified, int targetUserId, boolean bypassSecondaryLockScreen, SecurityMode expectedSecurityMode); /** * Manually report user activity to keep the device awake. */ default void userActivity() { } void userActivity(); /** * Checks if keyguard is in "verify credentials" mode. * * @return true if user has been asked to verify security. */ default boolean isVerifyUnlockOnly() { return false; } boolean isVerifyUnlockOnly(); /** * Call to report an unlock attempt. Loading @@ -65,14 +56,12 @@ public interface KeyguardSecurityCallback { * @param timeoutMs timeout in milliseconds to wait before reattempting an unlock. * Only nonzero if 'success' is false */ default void reportUnlockAttempt(int userId, boolean success, int timeoutMs) { } void reportUnlockAttempt(int userId, boolean success, int timeoutMs); /** * Resets the keyguard view. */ default void reset() { } void reset(); /** * Call when cancel button is pressed in bouncer. Loading @@ -84,19 +73,5 @@ public interface KeyguardSecurityCallback { /** * Invoked whenever users are typing their password or drawing a pattern. */ default void onUserInput() { } /** * Dismisses keyguard and go to unlocked state. */ default void finish(boolean strongAuth, int targetUserId) { } /** * Specifies that security mode has changed. */ default void onSecurityModeChanged(SecurityMode securityMode, boolean needsInput) { } void onUserInput(); } Loading
packages/SystemUI/res-keyguard/layout/keyguard_security_container_view.xml→packages/SystemUI/res-keyguard/layout/keyguard_host_view.xml +25 −11 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ** ** Copyright 2023, The Android Open Source Project ** Copyright 2012, 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. Loading @@ -17,10 +17,12 @@ */ --> <com.android.keyguard.KeyguardSecurityContainer <!-- This is the host view that generally contains two sub views: the widget view and the security view. --> <com.android.keyguard.KeyguardHostView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:androidprv="http://schemas.android.com/apk/res-auto" android:id="@+id/keyguard_security_container" android:id="@+id/keyguard_host_view" android:layout_width="match_parent" android:layout_height="match_parent" android:clipChildren="false" Loading @@ -28,6 +30,16 @@ android:paddingTop="@dimen/keyguard_lock_padding" android:importantForAccessibility="yes"> <!-- Needed because TYPE_WINDOW_STATE_CHANGED is sent from this view when bouncer is shown --> <com.android.keyguard.KeyguardSecurityContainer android:id="@+id/keyguard_security_container" android:layout_width="match_parent" android:layout_height="match_parent" android:clipChildren="false" android:clipToPadding="false" android:padding="0dp" android:fitsSystemWindows="true" android:layout_gravity="center"> <com.android.keyguard.KeyguardSecurityViewFlipper android:id="@+id/view_flipper" android:layout_width="wrap_content" Loading @@ -40,3 +52,5 @@ </com.android.keyguard.KeyguardSecurityViewFlipper> </com.android.keyguard.KeyguardSecurityContainer> </com.android.keyguard.KeyguardHostView>
packages/SystemUI/src/com/android/keyguard/KeyguardHostView.java 0 → 100644 +78 −0 Original line number Diff line number Diff line /* * Copyright (C) 2007 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.keyguard; import android.content.Context; import android.graphics.Canvas; import android.util.AttributeSet; import android.view.MotionEvent; import android.widget.FrameLayout; /** * Base class for keyguard view. {@link #reset} is where you should * reset the state of your view. Use the {@link KeyguardViewCallback} via * {@link #getCallback()} to send information back (such as poking the wake lock, * or finishing the keyguard). * * Handles intercepting of media keys that still work when the keyguard is * showing. */ public class KeyguardHostView extends FrameLayout { protected ViewMediatorCallback mViewMediatorCallback; private boolean mIsInteractable; public KeyguardHostView(Context context) { this(context, null); } public KeyguardHostView(Context context, AttributeSet attrs) { super(context, attrs); } @Override protected void dispatchDraw(Canvas canvas) { super.dispatchDraw(canvas); if (mViewMediatorCallback != null) { mViewMediatorCallback.keyguardDoneDrawing(); } } public void setViewMediatorCallback(ViewMediatorCallback viewMediatorCallback) { mViewMediatorCallback = viewMediatorCallback; } /** Set true if the view can be interacted with */ public void setInteractable(boolean isInteractable) { mIsInteractable = isInteractable; } /** * Make sure to disallow touches while transitioning the bouncer, otherwise * it can remain interactable even when barely visible. */ @Override public boolean onInterceptTouchEvent(MotionEvent ev) { return !mIsInteractable; } /** True to consume any events that are sent to it */ @Override public boolean onTouchEvent(MotionEvent ev) { return true; } }
packages/SystemUI/src/com/android/keyguard/KeyguardHostViewController.java 0 → 100644 +535 −0 File added.Preview size limit exceeded, changes collapsed. Show changes
packages/SystemUI/src/com/android/keyguard/KeyguardInputViewController.java +20 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,26 @@ public abstract class KeyguardInputViewController<T extends KeyguardInputView> // The following is used to ignore callbacks from SecurityViews that are no longer current // (e.g. face unlock). This avoids unwanted asynchronous events from messing with the // state for the current security method. private KeyguardSecurityCallback mNullCallback = new KeyguardSecurityCallback() {}; private KeyguardSecurityCallback mNullCallback = new KeyguardSecurityCallback() { @Override public void userActivity() { } @Override public void reportUnlockAttempt(int userId, boolean success, int timeoutMs) { } @Override public boolean isVerifyUnlockOnly() { return false; } @Override public void dismiss(boolean securityVerified, int targetUserId, SecurityMode expectedSecurityMode) { } @Override public void dismiss(boolean authenticated, int targetId, boolean bypassSecondaryLockScreen, SecurityMode expectedSecurityMode) { } @Override public void onUserInput() { } @Override public void reset() {} }; protected KeyguardInputViewController(T view, SecurityMode securityMode, KeyguardSecurityCallback keyguardSecurityCallback, Loading
packages/SystemUI/src/com/android/keyguard/KeyguardSecurityCallback.java +8 −33 Original line number Diff line number Diff line Loading @@ -25,9 +25,7 @@ public interface KeyguardSecurityCallback { * @param targetUserId a user that needs to be the foreground user at the dismissal completion. * @param expectedSecurityMode The security mode that is invoking this dismiss. */ default void dismiss(boolean securityVerified, int targetUserId, SecurityMode expectedSecurityMode) { } void dismiss(boolean securityVerified, int targetUserId, SecurityMode expectedSecurityMode); /** * Dismiss the given security screen. Loading @@ -37,26 +35,19 @@ public interface KeyguardSecurityCallback { * if any, during this dismissal. * @param expectedSecurityMode The security mode that is invoking this dismiss. */ default boolean dismiss(boolean securityVerified, int targetUserId, boolean bypassSecondaryLockScreen, SecurityMode expectedSecurityMode) { return false; } void dismiss(boolean securityVerified, int targetUserId, boolean bypassSecondaryLockScreen, SecurityMode expectedSecurityMode); /** * Manually report user activity to keep the device awake. */ default void userActivity() { } void userActivity(); /** * Checks if keyguard is in "verify credentials" mode. * * @return true if user has been asked to verify security. */ default boolean isVerifyUnlockOnly() { return false; } boolean isVerifyUnlockOnly(); /** * Call to report an unlock attempt. Loading @@ -65,14 +56,12 @@ public interface KeyguardSecurityCallback { * @param timeoutMs timeout in milliseconds to wait before reattempting an unlock. * Only nonzero if 'success' is false */ default void reportUnlockAttempt(int userId, boolean success, int timeoutMs) { } void reportUnlockAttempt(int userId, boolean success, int timeoutMs); /** * Resets the keyguard view. */ default void reset() { } void reset(); /** * Call when cancel button is pressed in bouncer. Loading @@ -84,19 +73,5 @@ public interface KeyguardSecurityCallback { /** * Invoked whenever users are typing their password or drawing a pattern. */ default void onUserInput() { } /** * Dismisses keyguard and go to unlocked state. */ default void finish(boolean strongAuth, int targetUserId) { } /** * Specifies that security mode has changed. */ default void onSecurityModeChanged(SecurityMode securityMode, boolean needsInput) { } void onUserInput(); }