Loading services/core/java/com/android/server/notification/NotificationManagerService.java +11 −11 Original line number Diff line number Diff line Loading @@ -3296,8 +3296,8 @@ public class NotificationManagerService extends SystemService { @Nullable ITransientNotification callback, int duration, boolean isUiContext, int displayId, @Nullable ITransientNotificationCallback textCallback) { if (DBG) { Slog.i(TAG, "enqueueToast pkg=" + pkg + " token=" + token + " duration=" + duration + " displayId=" + displayId); Slog.i(TAG, "enqueueToast pkg=" + pkg + " token=" + token + " duration=" + duration + " isUiContext=" + isUiContext + " displayId=" + displayId); } if (pkg == null || (text == null && callback == null) Loading @@ -3308,15 +3308,6 @@ public class NotificationManagerService extends SystemService { } final int callingUid = Binder.getCallingUid(); checkCallerIsSameApp(pkg); final boolean isSystemToast = isCallerSystemOrPhone() || PackageManagerService.PLATFORM_PACKAGE_NAME.equals(pkg); boolean isAppRenderedToast = (callback != null); if (!checkCanEnqueueToast(pkg, callingUid, displayId, isAppRenderedToast, isSystemToast)) { return; } if (!isUiContext && displayId == Display.DEFAULT_DISPLAY && mUm.isVisibleBackgroundUsersSupported()) { // When the caller is a visible background user using a non-UI context (like the Loading @@ -3333,6 +3324,15 @@ public class NotificationManagerService extends SystemService { } } checkCallerIsSameApp(pkg); final boolean isSystemToast = isCallerSystemOrPhone() || PackageManagerService.PLATFORM_PACKAGE_NAME.equals(pkg); boolean isAppRenderedToast = (callback != null); if (!checkCanEnqueueToast(pkg, callingUid, displayId, isAppRenderedToast, isSystemToast)) { return; } synchronized (mToastQueue) { int callingPid = Binder.getCallingPid(); final long callingId = Binder.clearCallingIdentity(); Loading services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +1 −2 Original line number Diff line number Diff line Loading @@ -197,7 +197,6 @@ import android.telecom.TelecomManager; import android.telephony.TelephonyManager; import android.test.suitebuilder.annotation.SmallTest; import android.testing.AndroidTestingRunner; import android.testing.TestableContext; import android.testing.TestableLooper; import android.testing.TestableLooper.RunWithLooper; import android.testing.TestablePermissions; Loading Loading @@ -254,7 +253,6 @@ import org.mockito.ArgumentMatcher; import org.mockito.ArgumentMatchers; import org.mockito.InOrder; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; Loading Loading @@ -6909,6 +6907,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { public void testTextToastsCallStatusBar_visibleBgUsers_nonUiContext_defaultDisplay() throws Exception { mockIsVisibleBackgroundUsersSupported(true); mockIsUserVisible(SECONDARY_DISPLAY_ID, true); mockDisplayAssignedToUser(SECONDARY_DISPLAY_ID); allowTestPackageToToast(); Loading Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +11 −11 Original line number Diff line number Diff line Loading @@ -3296,8 +3296,8 @@ public class NotificationManagerService extends SystemService { @Nullable ITransientNotification callback, int duration, boolean isUiContext, int displayId, @Nullable ITransientNotificationCallback textCallback) { if (DBG) { Slog.i(TAG, "enqueueToast pkg=" + pkg + " token=" + token + " duration=" + duration + " displayId=" + displayId); Slog.i(TAG, "enqueueToast pkg=" + pkg + " token=" + token + " duration=" + duration + " isUiContext=" + isUiContext + " displayId=" + displayId); } if (pkg == null || (text == null && callback == null) Loading @@ -3308,15 +3308,6 @@ public class NotificationManagerService extends SystemService { } final int callingUid = Binder.getCallingUid(); checkCallerIsSameApp(pkg); final boolean isSystemToast = isCallerSystemOrPhone() || PackageManagerService.PLATFORM_PACKAGE_NAME.equals(pkg); boolean isAppRenderedToast = (callback != null); if (!checkCanEnqueueToast(pkg, callingUid, displayId, isAppRenderedToast, isSystemToast)) { return; } if (!isUiContext && displayId == Display.DEFAULT_DISPLAY && mUm.isVisibleBackgroundUsersSupported()) { // When the caller is a visible background user using a non-UI context (like the Loading @@ -3333,6 +3324,15 @@ public class NotificationManagerService extends SystemService { } } checkCallerIsSameApp(pkg); final boolean isSystemToast = isCallerSystemOrPhone() || PackageManagerService.PLATFORM_PACKAGE_NAME.equals(pkg); boolean isAppRenderedToast = (callback != null); if (!checkCanEnqueueToast(pkg, callingUid, displayId, isAppRenderedToast, isSystemToast)) { return; } synchronized (mToastQueue) { int callingPid = Binder.getCallingPid(); final long callingId = Binder.clearCallingIdentity(); Loading
services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +1 −2 Original line number Diff line number Diff line Loading @@ -197,7 +197,6 @@ import android.telecom.TelecomManager; import android.telephony.TelephonyManager; import android.test.suitebuilder.annotation.SmallTest; import android.testing.AndroidTestingRunner; import android.testing.TestableContext; import android.testing.TestableLooper; import android.testing.TestableLooper.RunWithLooper; import android.testing.TestablePermissions; Loading Loading @@ -254,7 +253,6 @@ import org.mockito.ArgumentMatcher; import org.mockito.ArgumentMatchers; import org.mockito.InOrder; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; Loading Loading @@ -6909,6 +6907,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { public void testTextToastsCallStatusBar_visibleBgUsers_nonUiContext_defaultDisplay() throws Exception { mockIsVisibleBackgroundUsersSupported(true); mockIsUserVisible(SECONDARY_DISPLAY_ID, true); mockDisplayAssignedToUser(SECONDARY_DISPLAY_ID); allowTestPackageToToast(); Loading