Merge "Fix IME window can't show on keyguard with setShowWhenLocked."
This commit is contained in:
committed by
Android (Google) Code Review
commit
635b58bca0
@@ -2295,9 +2295,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
}
|
||||
|
||||
final LayoutParams attrs = win.getAttrs();
|
||||
final boolean showImeOverKeyguard = imeTarget != null && imeTarget.isVisibleLw() &&
|
||||
((imeTarget.getAttrs().flags & FLAG_SHOW_WHEN_LOCKED) != 0
|
||||
|| !canBeHiddenByKeyguardLw(imeTarget));
|
||||
final boolean showImeOverKeyguard = imeTarget != null && imeTarget.isVisibleLw()
|
||||
&& (imeTarget.canShowWhenLocked() || !canBeHiddenByKeyguardLw(imeTarget));
|
||||
|
||||
// Show IME over the keyguard if the target allows it
|
||||
boolean allowWhenLocked = (win.isInputMethodWindow() || imeTarget == this)
|
||||
@@ -2305,7 +2304,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
|
||||
if (isKeyguardLocked() && isKeyguardOccluded()) {
|
||||
// Show SHOW_WHEN_LOCKED windows if Keyguard is occluded.
|
||||
allowWhenLocked |= (attrs.flags & FLAG_SHOW_WHEN_LOCKED) != 0
|
||||
allowWhenLocked |= win.canShowWhenLocked()
|
||||
// Show error dialogs over apps that are shown on lockscreen
|
||||
|| (attrs.privateFlags & PRIVATE_FLAG_SYSTEM_ERROR) != 0;
|
||||
}
|
||||
|
||||
@@ -468,6 +468,9 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants {
|
||||
/** @return true if this window desires key events. */
|
||||
boolean canReceiveKeys();
|
||||
|
||||
/** @return true if the window can show over keyguard. */
|
||||
boolean canShowWhenLocked();
|
||||
|
||||
/**
|
||||
* Writes {@link com.android.server.wm.IdentifierProto} to stream.
|
||||
*/
|
||||
|
||||
@@ -2405,6 +2405,14 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
&& !cantReceiveTouchInput();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canShowWhenLocked() {
|
||||
final boolean showBecauseOfActivity =
|
||||
mAppToken != null && mAppToken.mActivityRecord.canShowWhenLocked();
|
||||
final boolean showBecauseOfWindow = (getAttrs().flags & FLAG_SHOW_WHEN_LOCKED) != 0;
|
||||
return showBecauseOfActivity || showBecauseOfWindow;
|
||||
}
|
||||
|
||||
/** @return false if this window desires touch events. */
|
||||
boolean cantReceiveTouchInput() {
|
||||
return mAppToken != null && mAppToken.getTask() != null
|
||||
|
||||
Reference in New Issue
Block a user