Revert^2 "7/N controllers for remaining Keyguard Password ..."
Revert submission 12656261-revert-12585643-b166448040-keyguard-message-area-NUUJOVRYJS This also fixes the original issue introduced in this CL. KeyguardAbsKeyInputViewController#reset would call mView#resetState instead of its own internal resetState method. However, all the logic from the various resetState methods had been moved from the views to their controllers. Simply calling resetState direclty resolves the issue (line 105 of KeyguardAbsKeyInputViewController). Reason for revert: Fixing http://b/169231892 and http://b/169145796 Reverted Changes: I7683b2234:Revert "4/N Setup Controller fo KeyguardSecurityCo... I5cbe04c0c:Revert "5/N Add KeyguardSecurityViewFlipperControl... I11dff38ad:Revert "6/N Add Controller for KeyguardPatternView... I55c250121:Revert "7/N controllers for remaining Keyguard Pas... Ie84234cb8:Revert "8/N Remove View Injection from KeyguardMes... Ic62f199a5:Revert "9/N Clean Up Keyguard Class Structure" Change-Id: Ie3669e0c9a23ffd4443ced0fb08ec754f1df55db Fixes: 169145796
This commit is contained in:
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Copyright (C) 2020 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.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.View.OnKeyListener;
|
||||
import android.view.View.OnTouchListener;
|
||||
|
||||
import com.android.internal.util.LatencyTracker;
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
|
||||
import com.android.systemui.R;
|
||||
|
||||
public abstract class KeyguardPinBasedInputViewController<T extends KeyguardPinBasedInputView>
|
||||
extends KeyguardAbsKeyInputViewController<T> {
|
||||
|
||||
private final LiftToActivateListener mLiftToActivateListener;
|
||||
protected PasswordTextView mPasswordEntry;
|
||||
|
||||
private final OnKeyListener mOnKeyListener = (v, keyCode, event) -> {
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
return mView.onKeyDown(keyCode, event);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
private final OnTouchListener mOnTouchListener = (v, event) -> {
|
||||
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
|
||||
mView.doHapticKeyClick();
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
protected KeyguardPinBasedInputViewController(T view,
|
||||
KeyguardUpdateMonitor keyguardUpdateMonitor,
|
||||
SecurityMode securityMode,
|
||||
LockPatternUtils lockPatternUtils,
|
||||
KeyguardSecurityCallback keyguardSecurityCallback,
|
||||
KeyguardMessageAreaController.Factory messageAreaControllerFactory,
|
||||
LatencyTracker latencyTracker,
|
||||
LiftToActivateListener liftToActivateListener) {
|
||||
super(view, keyguardUpdateMonitor, securityMode, lockPatternUtils, keyguardSecurityCallback,
|
||||
messageAreaControllerFactory, latencyTracker);
|
||||
mLiftToActivateListener = liftToActivateListener;
|
||||
mPasswordEntry = mView.findViewById(mView.getPasswordTextViewId());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onViewAttached() {
|
||||
super.onViewAttached();
|
||||
|
||||
mPasswordEntry.setOnKeyListener(mOnKeyListener);
|
||||
mPasswordEntry.setUserActivityListener(this::onUserInput);
|
||||
|
||||
View deleteButton = mView.findViewById(R.id.delete_button);
|
||||
deleteButton.setOnTouchListener(mOnTouchListener);
|
||||
deleteButton.setOnClickListener(v -> {
|
||||
// check for time-based lockouts
|
||||
if (mPasswordEntry.isEnabled()) {
|
||||
mPasswordEntry.deleteLastChar();
|
||||
}
|
||||
});
|
||||
deleteButton.setOnLongClickListener(v -> {
|
||||
// check for time-based lockouts
|
||||
if (mPasswordEntry.isEnabled()) {
|
||||
mView.resetPasswordText(true /* animate */, true /* announce */);
|
||||
}
|
||||
mView.doHapticKeyClick();
|
||||
return true;
|
||||
});
|
||||
|
||||
View okButton = mView.findViewById(R.id.key_enter);
|
||||
if (okButton != null) {
|
||||
okButton.setOnTouchListener(mOnTouchListener);
|
||||
okButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mPasswordEntry.isEnabled()) {
|
||||
verifyPasswordAndUnlock();
|
||||
}
|
||||
}
|
||||
});
|
||||
okButton.setOnHoverListener(mLiftToActivateListener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume(int reason) {
|
||||
super.onResume(reason);
|
||||
mPasswordEntry.requestFocus();
|
||||
}
|
||||
|
||||
@Override
|
||||
void resetState() {
|
||||
mView.setPasswordEntryEnabled(true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user