Add null check for SensitiveContentProtectionService
mSensitiveContentProtectionService shouldn't be null when
sensitiveContentAppProtection() is true, adding wtf log to
track this.
Bug: 327305331
Test: atest SystemUIGoogleRobo2RNGTests
Change-Id: Ie655b63e7ddc387119edd40fc37a1ba3d11255b2
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 708751a..a7cb169 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -1210,6 +1210,9 @@
mSensitiveContentProtectionService =
ISensitiveContentProtectionManager.Stub.asInterface(
ServiceManager.getService(Context.SENSITIVE_CONTENT_PROTECTION_SERVICE));
+ if (mSensitiveContentProtectionService == null) {
+ Log.e(TAG, "SensitiveContentProtectionService shouldn't be null");
+ }
} else {
mSensitiveContentProtectionService = null;
}
@@ -4179,6 +4182,9 @@
*/
void notifySensitiveContentAppProtection(boolean showSensitiveContent) {
try {
+ if (mSensitiveContentProtectionService == null) {
+ return;
+ }
// The window would be blocked during screen share if it shows sensitive content.
mSensitiveContentProtectionService.setSensitiveContentProtection(
getWindowToken(), mContext.getPackageName(), showSensitiveContent);