Fixed some issues with alert window notifications
- Don't hold window manager lock while calling into notification
manager since it can end up calling into activity manager.
- Fixed issue with using checkCallingPermission() to check if the
system has the internal system window permission. This call fails
if it isn't a binder call. Change to use checkCallingorSelfPermission()
instead.
- Fixed class cast exception while getting app icon by using
IconUtilities class to the the drawable to bitmap convertion.
Change-Id: I4ef380618f558a8aac5b152d97536a614040397f
Fixes: 35780846
Fixes: 35846667
Fixes: 35854470
Bug: 35657567
Test: cts/hostsidetests/.../run-test CtsWindowManagerHostTestCases android.server.cts.AlertWindowsTests
diff --git a/services/core/java/com/android/server/wm/Session.java b/services/core/java/com/android/server/wm/Session.java
index 5355f31..720a454 100644
--- a/services/core/java/com/android/server/wm/Session.java
+++ b/services/core/java/com/android/server/wm/Session.java
@@ -93,7 +93,7 @@
mUid = Binder.getCallingUid();
mPid = Binder.getCallingPid();
mLastReportedAnimatorScale = service.getCurrentAnimatorScale();
- mCanAddInternalSystemWindow = service.mContext.checkCallingPermission(
+ mCanAddInternalSystemWindow = service.mContext.checkCallingOrSelfPermission(
INTERNAL_SYSTEM_WINDOW) == PERMISSION_GRANTED;
StringBuilder sb = new StringBuilder();
sb.append("Session{");
@@ -664,6 +664,7 @@
void dump(PrintWriter pw, String prefix) {
pw.print(prefix); pw.print("mNumWindow="); pw.print(mNumWindow);
+ pw.print(" mCanAddInternalSystemWindow="); pw.print(mCanAddInternalSystemWindow);
pw.print(" mAppOverlaySurfaces="); pw.print(mAppOverlaySurfaces);
pw.print(" mAlertWindowSurfaces="); pw.print(mAlertWindowSurfaces);
pw.print(" mClientDead="); pw.print(mClientDead);