Merge "Fix AppOps exception for notification channel toasts" into oc-dev
am: 5c720a5f09
Change-Id: Ic74620e9b9898d65ad98a5e884f5a233ec56a9b0
This commit is contained in:
@@ -1521,15 +1521,13 @@ public class NotificationManagerService extends SystemService {
|
|||||||
final boolean isPackageSuspended =
|
final boolean isPackageSuspended =
|
||||||
isPackageSuspendedForUser(pkg, Binder.getCallingUid());
|
isPackageSuspendedForUser(pkg, Binder.getCallingUid());
|
||||||
|
|
||||||
if (ENABLE_BLOCKED_TOASTS && (!noteNotificationOp(pkg, Binder.getCallingUid())
|
if (ENABLE_BLOCKED_TOASTS && !isSystemToast &&
|
||||||
|| isPackageSuspended)) {
|
(!noteNotificationOp(pkg, Binder.getCallingUid()) || isPackageSuspended)) {
|
||||||
if (!isSystemToast) {
|
Slog.e(TAG, "Suppressing toast from package " + pkg
|
||||||
Slog.e(TAG, "Suppressing toast from package " + pkg
|
+ (isPackageSuspended
|
||||||
+ (isPackageSuspended
|
? " due to package suspended by administrator."
|
||||||
? " due to package suspended by administrator."
|
: " by user request."));
|
||||||
: " by user request."));
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized (mToastQueue) {
|
synchronized (mToastQueue) {
|
||||||
@@ -3282,10 +3280,11 @@ public class NotificationManagerService extends SystemService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void doChannelWarningToast(CharSequence toastText) {
|
private void doChannelWarningToast(CharSequence toastText) {
|
||||||
final boolean warningEnabled = Settings.System.getInt(getContext().getContentResolver(),
|
final boolean warningEnabled = Settings.Global.getInt(getContext().getContentResolver(),
|
||||||
Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS, 0) != 0;
|
Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS, 0) != 0;
|
||||||
if (warningEnabled || Build.IS_DEBUGGABLE) {
|
if (warningEnabled || Build.IS_DEBUGGABLE) {
|
||||||
Toast toast = Toast.makeText(getContext(), mHandler.getLooper(), toastText, Toast.LENGTH_LONG);
|
Toast toast = Toast.makeText(getContext(), mHandler.getLooper(), toastText,
|
||||||
|
Toast.LENGTH_LONG);
|
||||||
toast.show();
|
toast.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user