Using NotificationManagerCompat
to cancel all notification.
NotificationManagerCompat manager =
NotificationManagerCompat.from(ctx.getApplicationContext());
manager.cancelAll();
It got exception some time (most time works).
on Andoid 6:
java.lang.SecurityException: Permission Denial: getCurrentUser() from pid=22994, uid=10184 requires android.permission.INTERACT_ACROSS_USERS
Fatal Exception: java.lang.SecurityException: Permission Denial: getCurrentUser() from pid=22994, uid=10184 requires android.permission.INTERACT_ACROSS_USERS
at android.os.Parcel.readException(Parcel.java:1602)
at android.os.Parcel.readException(Parcel.java:1555)
at android.app.INotificationManager$Stub$Proxy.cancelAllNotifications(INotificationManager.java:649)
at android.app.NotificationManager.cancelAll(NotificationManager.java:323)
at android.support.v4.app.NotificationManagerCompat.cancelAll(NotificationManagerCompat.java:197)
on Android 5.0, 4.4.2:
ava.lang.SecurityException: Permission Denial: getIntentSender() from pid=5460, uid=10135, (need uid=1000) is not allowed to send as package android at android.os.Parcel.readException(Parcel.java:1465)
Fatal Exception: java.lang.SecurityException: Permission Denial: getIntentSender() from pid=3109, uid=10153, (need uid=1000) is not allowed to send as package android
at android.os.Parcel.readException(Parcel.java:1472)
at android.os.Parcel.readException(Parcel.java:1426)
at android.app.INotificationManager$Stub$Proxy.cancelAllNotifications(INotificationManager.java:271)
at android.app.NotificationManager.cancelAll(NotificationManager.java:220)
at android.support.v4.app.NotificationManagerCompat.cancelAll(NotificationManagerCompat.java:197)
Questions:
- What could be the cause?
- What are those id here? Is it
ctx.getApplicationContext().getApplicationInfo().uid
orandroid.os.Process.myUid()
?
pid
anduid
belong to your app OR not, this could be either a bug in "Binder synchronization" when, say,getIntentSender()
was called with theuid
'sBinder
identity while it was to be called with the system's one (uid
=1000), OR while handling your call other object's Binders are called with the original callers (yours) identity without clearing it first. I guess there isn't much you can do about it but catching exceptions thrown by the problem calls. – Dodeca