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

Commit a09944f7 authored by Christopher Tate's avatar Christopher Tate
Browse files

Mark various SysUI PendingIntent sends "interactive"

Bug: 251902289
Test: atest SystemUITests
Change-Id: I97057d682de7245149d03e1f64730082f138ed9a
parent e36b1ca4
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -832,6 +832,20 @@ public final class PendingIntent implements Parcelable {
        send(context, code, intent, null, null, null, null);
    }

    /**
     * Perform the operation associated with this PendingIntent, supplying additional
     * options for the operation.
     *
     * @param options Additional options the caller would like to provide to modify the
     * sending behavior.  May be built from an {@link ActivityOptions} to apply to an
     * activity start.
     *
     * @hide
     */
    public void send(Bundle options) throws CanceledException {
        send(null, 0, null, null, null, null, options);
    }

    /**
     * Perform the operation associated with this PendingIntent, allowing the
     * caller to be notified when the send has completed.
+4 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.plugins;

import android.annotation.Nullable;
import android.app.BroadcastOptions;
import android.app.PendingIntent;
import android.graphics.drawable.Drawable;
import android.view.View;
@@ -70,7 +71,9 @@ public interface GlobalActionsPanelPlugin extends Plugin {
        /** Starts a PendingIntent, dismissing the keyguard if necessary. */
        default void startPendingIntentDismissingKeyguard(PendingIntent pendingIntent) {
            try {
                pendingIntent.send();
                BroadcastOptions options = BroadcastOptions.makeBasic();
                options.setInteractive(true);
                pendingIntent.send(options.toBundle());
            } catch (PendingIntent.CanceledException e) {
                // no-op
            }
+2 −0
Original line number Diff line number Diff line
@@ -156,6 +156,8 @@ class DetailDialog(
                    // Remove the task explicitly, since onRelease() callback will be executed after
                    // startActivity() below is called.
                    broadcastSender.closeSystemDialogs()
                    // not sent as interactive, lest the higher-importance activity launch
                    // be impacted
                    pendingIntent.send()
                    false
                }
+4 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.media.controls.pipeline

import android.app.BroadcastOptions
import android.app.Notification
import android.app.Notification.EXTRA_SUBSTITUTE_APP_NAME
import android.app.PendingIntent
@@ -1149,7 +1150,9 @@ class MediaDataManager(

    private fun sendPendingIntent(intent: PendingIntent): Boolean {
        return try {
            intent.send()
            val options = BroadcastOptions.makeBasic()
            options.setInteractive(true)
            intent.send(options.toBundle())
            true
        } catch (e: PendingIntent.CanceledException) {
            Log.d(TAG, "Intent canceled", e)
+6 −2
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import static com.android.systemui.media.controls.models.recommendation.Smartspa
import android.animation.Animator;
import android.animation.AnimatorInflater;
import android.animation.AnimatorSet;
import android.app.BroadcastOptions;
import android.app.PendingIntent;
import android.app.WallpaperColors;
import android.app.smartspace.SmartspaceAction;
@@ -113,6 +114,8 @@ import com.android.systemui.util.ColorUtilKt;
import com.android.systemui.util.animation.TransitionLayout;
import com.android.systemui.util.time.SystemClock;

import dagger.Lazy;

import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
@@ -120,7 +123,6 @@ import java.util.concurrent.Executor;

import javax.inject.Inject;

import dagger.Lazy;
import kotlin.Unit;

/**
@@ -621,7 +623,9 @@ public class MediaControlPanel {
                                        device.getIntent().getIntent(), true);
                            } else {
                                try {
                                    device.getIntent().send();
                                    BroadcastOptions options = BroadcastOptions.makeBasic();
                                    options.setInteractive(true);
                                    device.getIntent().send(options.toBundle());
                                } catch (PendingIntent.CanceledException e) {
                                    Log.e(TAG, "Device pending intent was canceled");
                                }
Loading