From ec40b3a6b76506e6192c38dbbc0bf8463dbf8e9e Mon Sep 17 00:00:00 2001 From: kwaky Date: Mon, 20 Apr 2020 18:37:04 -0700 Subject: [PATCH] Enable IME on Keyguard Password security challenge Bug: 154055972 Test: Manual Change-Id: Id2a28a8ac507d8b75e785ee195bfa917b69c5f38 --- .../car/keyguard/CarKeyguardViewController.java | 6 +++++- .../window/OverlayViewGlobalStateController.java | 6 ++++++ .../window/SystemUIOverlayWindowController.java | 10 ++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) 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 60ee19eec25ff..4fde30987e509 100644 --- a/packages/CarSystemUI/src/com/android/systemui/car/keyguard/CarKeyguardViewController.java +++ b/packages/CarSystemUI/src/com/android/systemui/car/keyguard/CarKeyguardViewController.java @@ -205,6 +205,9 @@ public class CarKeyguardViewController extends OverlayViewController implements @Override public void onCancelClicked() { + getOverlayViewGlobalStateController().setWindowFocusable(/* focusable= */ false); + getOverlayViewGlobalStateController().setWindowNeedsInput(/* needsInput= */ false); + mBouncer.hide(/* destroyView= */ true); mKeyguardCancelClickedListener.onCancelClicked(); } @@ -226,7 +229,8 @@ public class CarKeyguardViewController extends OverlayViewController implements @Override public void setNeedsInput(boolean needsInput) { - getLayout().setFocusable(needsInput); + getOverlayViewGlobalStateController().setWindowFocusable(needsInput); + getOverlayViewGlobalStateController().setWindowNeedsInput(needsInput); } /** diff --git a/packages/CarSystemUI/src/com/android/systemui/window/OverlayViewGlobalStateController.java b/packages/CarSystemUI/src/com/android/systemui/window/OverlayViewGlobalStateController.java index 402d742cb949f..5fe03f17919bd 100644 --- a/packages/CarSystemUI/src/com/android/systemui/window/OverlayViewGlobalStateController.java +++ b/packages/CarSystemUI/src/com/android/systemui/window/OverlayViewGlobalStateController.java @@ -123,6 +123,12 @@ public class OverlayViewGlobalStateController { mSystemUIOverlayWindowController.setWindowFocusable(focusable); } + /** Sets the {@link android.view.WindowManager.LayoutParams#FLAG_ALT_FOCUSABLE_IM} flag of the + * sysui overlay window */ + public void setWindowNeedsInput(boolean needsInput) { + mSystemUIOverlayWindowController.setWindowNeedsInput(needsInput); + } + /** Returns {@code true} if the window is focusable. */ public boolean isWindowFocusable() { return mSystemUIOverlayWindowController.isWindowFocusable(); diff --git a/packages/CarSystemUI/src/com/android/systemui/window/SystemUIOverlayWindowController.java b/packages/CarSystemUI/src/com/android/systemui/window/SystemUIOverlayWindowController.java index 0dbe1a3ea1dd3..31d73a181f7fa 100644 --- a/packages/CarSystemUI/src/com/android/systemui/window/SystemUIOverlayWindowController.java +++ b/packages/CarSystemUI/src/com/android/systemui/window/SystemUIOverlayWindowController.java @@ -132,6 +132,16 @@ public class SystemUIOverlayWindowController implements updateWindow(); } + /** Sets the window to enable IME. */ + public void setWindowNeedsInput(boolean needsInput) { + if (needsInput) { + mLpChanged.flags &= ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM; + } else { + mLpChanged.flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM; + } + updateWindow(); + } + /** Returns {@code true} if the window is visible */ public boolean isWindowVisible() { return mVisible;