From 6b0fbb2cfb83d6118393eafb39f43eabe57637df Mon Sep 17 00:00:00 2001 From: Lucas Silva Date: Tue, 7 Dec 2021 16:44:29 +0000 Subject: [PATCH] Add debug logging to CommunalManagerService Been getting questions from some other engineers on why certain activities are not showing over the lockscreen. This logging will help debug issues and make them self-service. Test: locally on device Bug: n/a Change-Id: Ic74511851ec745a5b8b67690af1a7f5c707a332f --- .../communal/CommunalManagerService.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/communal/CommunalManagerService.java b/services/core/java/com/android/server/communal/CommunalManagerService.java index 1196442336072..8d9b13e21d770 100644 --- a/services/core/java/com/android/server/communal/CommunalManagerService.java +++ b/services/core/java/com/android/server/communal/CommunalManagerService.java @@ -84,6 +84,10 @@ public final class CommunalManagerService extends SystemService { @Override public Intent intercept(ActivityInterceptorInfo info) { if (!shouldIntercept(info.aInfo)) { + if (DEBUG) { + Slog.d(TAG, "Activity allowed, not intercepting: " + + info.aInfo.getComponentName()); + } return null; } @@ -188,8 +192,17 @@ public final class CommunalManagerService extends SystemService { return true; } - return isChangeEnabled(ALLOW_COMMUNAL_MODE_WITH_USER_CONSENT, appInfo) - && getUserEnabledApps().contains(appInfo.packageName); + if (!isChangeEnabled(ALLOW_COMMUNAL_MODE_WITH_USER_CONSENT, appInfo)) { + if (DEBUG) Slog.d(TAG, "App is not allowlisted: " + appInfo.packageName); + return false; + } + + if (!getUserEnabledApps().contains(appInfo.packageName)) { + if (DEBUG) Slog.d(TAG, "App does not have user consent: " + appInfo.packageName); + return false; + } + + return true; } private boolean isActiveDream(ApplicationInfo appInfo) { @@ -219,6 +232,10 @@ public final class CommunalManagerService extends SystemService { final boolean showWhenLocked = (activityInfo.flags & ActivityInfo.FLAG_SHOW_WHEN_LOCKED) != 0; if (!showWhenLocked) { + if (DEBUG) { + Slog.d(TAG, "Activity does not contain showWhenLocked attribute: " + + activityInfo.getComponentName()); + } return true; }