summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/proto/android/server/activitymanagerservice.proto1
-rw-r--r--services/core/java/com/android/server/wm/KeyguardController.java21
2 files changed, 18 insertions, 4 deletions
diff --git a/core/proto/android/server/activitymanagerservice.proto b/core/proto/android/server/activitymanagerservice.proto
index 6f9a5649d4ac..79a5dd78ffb3 100644
--- a/core/proto/android/server/activitymanagerservice.proto
+++ b/core/proto/android/server/activitymanagerservice.proto
@@ -132,6 +132,7 @@ message KeyguardControllerProto {
optional bool keyguard_showing = 1;
repeated KeyguardOccludedProto keyguard_occluded_states= 2;
+ optional bool aod_showing = 3;
}
message KeyguardOccludedProto {
diff --git a/services/core/java/com/android/server/wm/KeyguardController.java b/services/core/java/com/android/server/wm/KeyguardController.java
index feb711abaead..8c8b05f1307a 100644
--- a/services/core/java/com/android/server/wm/KeyguardController.java
+++ b/services/core/java/com/android/server/wm/KeyguardController.java
@@ -29,6 +29,7 @@ import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG
import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_TO_SHADE;
import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_WITH_WALLPAPER;
+import static com.android.server.am.KeyguardControllerProto.AOD_SHOWING;
import static com.android.server.am.KeyguardControllerProto.KEYGUARD_OCCLUDED_STATES;
import static com.android.server.am.KeyguardControllerProto.KEYGUARD_SHOWING;
import static com.android.server.am.KeyguardOccludedProto.DISPLAY_ID;
@@ -86,7 +87,7 @@ class KeyguardController {
/**
* @return true if either Keyguard or AOD are showing, not going away, and not being occluded
- * on the given display, false otherwise
+ * on the given display, false otherwise.
*/
boolean isKeyguardOrAodShowing(int displayId) {
return (mKeyguardShowing || mAodShowing) && !mKeyguardGoingAway
@@ -94,6 +95,16 @@ class KeyguardController {
}
/**
+ * @return {@code true} if 1) Keyguard is showing, not going away, and not being occluded on the
+ * given display, or 2) AOD is showing, {@code false} otherwise.
+ * TODO(b/125198167): Replace isKeyguardOrAodShowing() by this logic.
+ */
+ boolean isKeyguardUnoccludedOrAodShowing(int displayId) {
+ return (mKeyguardShowing && !mKeyguardGoingAway && !isDisplayOccluded(displayId))
+ || mAodShowing;
+ }
+
+ /**
* @return true if Keyguard is showing, not going away, and not being occluded on the given
* display, false otherwise
*/
@@ -380,10 +391,11 @@ class KeyguardController {
for (int displayNdx = mRootActivityContainer.getChildCount() - 1;
displayNdx >= 0; displayNdx--) {
final ActivityDisplay display = mRootActivityContainer.getChildAt(displayNdx);
- final KeyguardDisplayState state = getDisplay(display.mDisplayId);
- if (isKeyguardOrAodShowing(display.mDisplayId) && state.mSleepToken == null) {
+ final int displayId = display.mDisplayId;
+ final KeyguardDisplayState state = getDisplay(displayId);
+ if (isKeyguardUnoccludedOrAodShowing(displayId) && state.mSleepToken == null) {
state.acquiredSleepToken();
- } else if (!isKeyguardOrAodShowing(display.mDisplayId) && state.mSleepToken != null) {
+ } else if (!isKeyguardUnoccludedOrAodShowing(displayId) && state.mSleepToken != null) {
state.releaseSleepToken();
}
}
@@ -528,6 +540,7 @@ class KeyguardController {
void writeToProto(ProtoOutputStream proto, long fieldId) {
final long token = proto.start(fieldId);
+ proto.write(AOD_SHOWING, mAodShowing);
proto.write(KEYGUARD_SHOWING, mKeyguardShowing);
writeDisplayStatesToProto(proto, KEYGUARD_OCCLUDED_STATES);
proto.end(token);