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

Commit bba26b18 authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Post channel error toasts as android

Since we're using system_server's context, our
calling identity needs to match

Test: test app that posts a notification to a non-existant
channel
Fixes: 117519040

Change-Id: I599d2a2c3f086bceef9f4b5c50f4cc7c55bdb207
parent 803a5249
Loading
Loading
Loading
Loading
+10 −8
Original line number Original line Diff line number Diff line
@@ -4282,6 +4282,7 @@ public class NotificationManagerService extends SystemService {
    }
    }


    private void doChannelWarningToast(CharSequence toastText) {
    private void doChannelWarningToast(CharSequence toastText) {
        Binder.withCleanCallingIdentity(() -> {
            final int defaultWarningEnabled = Build.IS_DEBUGGABLE ? 1 : 0;
            final int defaultWarningEnabled = Build.IS_DEBUGGABLE ? 1 : 0;
            final boolean warningEnabled = Settings.Global.getInt(getContext().getContentResolver(),
            final boolean warningEnabled = Settings.Global.getInt(getContext().getContentResolver(),
                    Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS, defaultWarningEnabled) != 0;
                    Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS, defaultWarningEnabled) != 0;
@@ -4290,6 +4291,7 @@ public class NotificationManagerService extends SystemService {
                        Toast.LENGTH_SHORT);
                        Toast.LENGTH_SHORT);
                toast.show();
                toast.show();
            }
            }
        });
    }
    }


    @VisibleForTesting
    @VisibleForTesting