Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0dd5e234 authored by Aaron Liu's avatar Aaron Liu Committed by Automerger Merge Worker
Browse files

Merge "Remove KeyguardHostView" into tm-qpr-dev am: 0231137e

parents 975ea2ce 0231137e
Loading
Loading
Loading
Loading
+11 −25
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
**
** Copyright 2012, The Android Open Source Project
** Copyright 2023, 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.
@@ -17,12 +17,10 @@
*/
-->

<!-- This is the host view that generally contains two sub views: the widget view
    and the security view. -->
<com.android.keyguard.KeyguardHostView
<com.android.keyguard.KeyguardSecurityContainer
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/res-auto"
    android:id="@+id/keyguard_host_view"
    android:id="@+id/keyguard_security_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clipChildren="false"
@@ -30,16 +28,6 @@
    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"
@@ -52,5 +40,3 @@
    </com.android.keyguard.KeyguardSecurityViewFlipper>
</com.android.keyguard.KeyguardSecurityContainer>
</com.android.keyguard.KeyguardHostView>
+0 −78
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;
    }
}
+0 −538

File deleted.

Preview size limit exceeded, changes collapsed.

+1 −20
Original line number Diff line number Diff line
@@ -51,26 +51,7 @@ 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() {
        @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() {}
    };
    private KeyguardSecurityCallback mNullCallback = new KeyguardSecurityCallback() {};

    protected KeyguardInputViewController(T view, SecurityMode securityMode,
            KeyguardSecurityCallback keyguardSecurityCallback,
+33 −8
Original line number Diff line number Diff line
@@ -25,7 +25,9 @@ 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.
     */
    void dismiss(boolean securityVerified, int targetUserId, SecurityMode expectedSecurityMode);
    default void dismiss(boolean securityVerified, int targetUserId,
            SecurityMode expectedSecurityMode) {
    }

    /**
     * Dismiss the given security screen.
@@ -35,19 +37,26 @@ public interface KeyguardSecurityCallback {
     *                                  if any, during this dismissal.
     * @param expectedSecurityMode The security mode that is invoking this dismiss.
     */
    void dismiss(boolean securityVerified, int targetUserId, boolean bypassSecondaryLockScreen,
            SecurityMode expectedSecurityMode);
    default boolean dismiss(boolean securityVerified, int targetUserId,
            boolean bypassSecondaryLockScreen,
            SecurityMode expectedSecurityMode) {
        return false;
    }

    /**
     * Manually report user activity to keep the device awake.
     */
    void userActivity();
    default void userActivity() {
    }

    /**
     * Checks if keyguard is in "verify credentials" mode.
     *
     * @return true if user has been asked to verify security.
     */
    boolean isVerifyUnlockOnly();
    default boolean isVerifyUnlockOnly() {
        return false;
    }

    /**
     * Call to report an unlock attempt.
@@ -56,12 +65,14 @@ public interface KeyguardSecurityCallback {
     * @param timeoutMs timeout in milliseconds to wait before reattempting an unlock.
     *                  Only nonzero if 'success' is false
     */
    void reportUnlockAttempt(int userId, boolean success, int timeoutMs);
    default void reportUnlockAttempt(int userId, boolean success, int timeoutMs) {
    }

    /**
     * Resets the keyguard view.
     */
    void reset();
    default void reset() {
    }

    /**
     * Call when cancel button is pressed in bouncer.
@@ -73,5 +84,19 @@ public interface KeyguardSecurityCallback {
    /**
     * Invoked whenever users are typing their password or drawing a pattern.
     */
    void onUserInput();
    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) {
    }
}
Loading