summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkwaky <kwaky@google.com>2020-09-25 05:27:04 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-09-25 05:27:04 +0000
commita33d9dde2f3534828c4364ba55a9c6f1f3a5cff5 (patch)
tree224df4a2d862a6c7136732a343e85678d07231ab
parenta608315e39206d2d26ac742a0911144435de3870 (diff)
parentc83cc01b62a4f6bfc2d5ba716a5a9e67f094f6ac (diff)
DO NOT MERGE Update current user for passwordEntry and restart input on user switch. am: c83cc01b62
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12655217 Change-Id: I37138281801c510f151f560fae62da88894efc69
-rw-r--r--packages/CarSystemUI/src/com/android/systemui/car/keyguard/CarKeyguardViewController.java39
1 files changed, 29 insertions, 10 deletions
diff --git a/packages/CarSystemUI/src/com/android/systemui/car/keyguard/CarKeyguardViewController.java b/packages/CarSystemUI/src/com/android/systemui/car/keyguard/CarKeyguardViewController.java
index 218c95c2496f..ec018f9bb62e 100644
--- a/packages/CarSystemUI/src/com/android/systemui/car/keyguard/CarKeyguardViewController.java
+++ b/packages/CarSystemUI/src/com/android/systemui/car/keyguard/CarKeyguardViewController.java
@@ -21,10 +21,13 @@ import android.car.user.CarUserManager;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
+import android.os.UserHandle;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewRootImpl;
+import android.view.inputmethod.InputMethodManager;
+import android.widget.EditText;
import androidx.annotation.VisibleForTesting;
@@ -61,7 +64,7 @@ import dagger.Lazy;
public class CarKeyguardViewController extends OverlayViewController implements
KeyguardViewController {
private static final String TAG = "CarKeyguardViewController";
- private static final boolean DEBUG = true;
+ private static final boolean DEBUG = false;
private final Context mContext;
private final Handler mHandler;
@@ -75,9 +78,10 @@ public class CarKeyguardViewController extends OverlayViewController implements
private final DismissCallbackRegistry mDismissCallbackRegistry;
private final ViewMediatorCallback mViewMediatorCallback;
private final CarNavigationBarController mCarNavigationBarController;
+ private final InputMethodManager mInputMethodManager;
// Needed to instantiate mBouncer.
- private final KeyguardBouncer.BouncerExpansionCallback
- mExpansionCallback = new KeyguardBouncer.BouncerExpansionCallback() {
+ private final KeyguardBouncer.BouncerExpansionCallback mExpansionCallback =
+ new KeyguardBouncer.BouncerExpansionCallback() {
@Override
public void onFullyShown() {
}
@@ -96,7 +100,8 @@ public class CarKeyguardViewController extends OverlayViewController implements
};
private final CarUserManager.UserLifecycleListener mUserLifecycleListener = (e) -> {
if (e.getEventType() == CarUserManager.USER_LIFECYCLE_EVENT_TYPE_SWITCHING) {
- revealKeyguardIfBouncerPrepared();
+ UserHandle currentUser = e.getUserHandle();
+ revealKeyguardIfBouncerPrepared(currentUser);
}
};
@@ -136,6 +141,8 @@ public class CarKeyguardViewController extends OverlayViewController implements
mDismissCallbackRegistry = dismissCallbackRegistry;
mViewMediatorCallback = viewMediatorCallback;
mCarNavigationBarController = carNavigationBarController;
+ // TODO(b/169280588): Inject InputMethodManager instead.
+ mInputMethodManager = mContext.getSystemService(InputMethodManager.class);
registerUserSwitchedListener();
}
@@ -363,9 +370,9 @@ public class CarKeyguardViewController extends OverlayViewController implements
}
/**
- * Hides Keyguard so that the transitioning Bouncer can be hidden until it is prepared. To be
- * called by {@link com.android.systemui.car.userswitcher.FullscreenUserSwitcherViewMediator}
- * when a new user is selected.
+ * Hides Keyguard so that the transitioning Bouncer can be hidden until it is prepared. To be
+ * called by {@link com.android.systemui.car.userswitcher.FullscreenUserSwitcherViewMediator}
+ * when a new user is selected.
*/
public void hideKeyguardToPrepareBouncer() {
getLayout().setVisibility(View.INVISIBLE);
@@ -376,29 +383,41 @@ public class CarKeyguardViewController extends OverlayViewController implements
mBouncer = keyguardBouncer;
}
- private void revealKeyguardIfBouncerPrepared() {
+ private void revealKeyguardIfBouncerPrepared(UserHandle currentUser) {
int reattemptDelayMillis = 50;
Runnable revealKeyguard = () -> {
if (mBouncer == null) {
if (DEBUG) {
Log.d(TAG, "revealKeyguardIfBouncerPrepared: revealKeyguard request is ignored "
- + "since the Bouncer has not been initialized yet.");
+ + "since the Bouncer has not been initialized yet.");
}
return;
}
if (!mBouncer.inTransit() || !mBouncer.isSecure()) {
getLayout().setVisibility(View.VISIBLE);
+ updateCurrentUserForPasswordEntry(currentUser);
} else {
if (DEBUG) {
Log.d(TAG, "revealKeyguardIfBouncerPrepared: Bouncer is not prepared "
+ "yet so reattempting after " + reattemptDelayMillis + "ms.");
}
- mHandler.postDelayed(this::revealKeyguardIfBouncerPrepared, reattemptDelayMillis);
+ mHandler.postDelayed(() -> revealKeyguardIfBouncerPrepared(currentUser),
+ reattemptDelayMillis);
}
};
mHandler.post(revealKeyguard);
}
+ private void updateCurrentUserForPasswordEntry(UserHandle currentUser) {
+ EditText passwordEntry = getLayout().findViewById(R.id.passwordEntry);
+ if (passwordEntry != null) {
+ mHandler.post(() -> {
+ mInputMethodManager.restartInput(passwordEntry);
+ passwordEntry.setTextOperationUser(currentUser);
+ });
+ }
+ }
+
private void notifyKeyguardUpdateMonitor() {
mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(mShowing);
if (mBouncer != null) {