Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5c720a5f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix AppOps exception for notification channel toasts" into oc-dev

parents 1ba237d2 2486f89b
Loading
Loading
Loading
Loading
+10 −11
Original line number Diff line number Diff line
@@ -1521,16 +1521,14 @@ public class NotificationManagerService extends SystemService {
            final boolean isPackageSuspended =
                    isPackageSuspendedForUser(pkg, Binder.getCallingUid());

            if (ENABLE_BLOCKED_TOASTS && (!noteNotificationOp(pkg, Binder.getCallingUid())
                    || isPackageSuspended)) {
                if (!isSystemToast) {
            if (ENABLE_BLOCKED_TOASTS && !isSystemToast &&
                    (!noteNotificationOp(pkg, Binder.getCallingUid()) || isPackageSuspended)) {
                Slog.e(TAG, "Suppressing toast from package " + pkg
                        + (isPackageSuspended
                                ? " due to package suspended by administrator."
                                : " by user request."));
                return;
            }
            }

            synchronized (mToastQueue) {
                int callingPid = Binder.getCallingPid();
@@ -3282,10 +3280,11 @@ public class NotificationManagerService extends SystemService {
    }

    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;
        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();
        }
    }