From 0d5792e9822fb26a2e3c9fee67f46a02f2a84941 Mon Sep 17 00:00:00 2001 From: wilsonshih Date: Thu, 4 Jul 2019 11:23:54 +0800 Subject: [PATCH] Clear the calling identity in isUsableDisplay. The INTERNAL_SYSTEM_WINDOW permission is checked when WindowManagerService#shouldShowSystemDecors is called, we should leave this permission check because it is public method. Clear the calling identity in WallpaperManagerService#isUsableDisplay as this method should be used only internally. Fix: 136447676 Test: atest VrDisplayTests MultiDisplaySystemDecorationTests Change-Id: I97a93cdd0253933527010f97049694b59d5a4e2a --- .../server/wallpaper/WallpaperManagerService.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java index 9908b3657121b..b0f1e5d69be40 100644 --- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java +++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java @@ -1172,8 +1172,16 @@ public class WallpaperManagerService extends IWallpaperManager.Stub return false; } final int displayId = display.getDisplayId(); - return displayId == DEFAULT_DISPLAY - || mWindowManagerInternal.shouldShowSystemDecorOnDisplay(displayId); + if (displayId == DEFAULT_DISPLAY) { + return true; + } + + final long ident = Binder.clearCallingIdentity(); + try { + return mWindowManagerInternal.shouldShowSystemDecorOnDisplay(displayId); + } finally { + Binder.restoreCallingIdentity(ident); + } } void forEachDisplayConnector(Consumer action) {