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

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

Merge "Run pending-intent-sent callback on UI thread."

parents 2b9930d0 32137e44
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -32,10 +32,11 @@ public interface ActivityStarter {
    void startPendingIntentDismissingKeyguard(PendingIntent intent);

    /**
     * Similar to {@link #startPendingIntentDismissingKeyguard(PendingIntent, Runnable)}, but
     * allow you to specify the callback that is executed after the intent is sent.
     * Similar to {@link #startPendingIntentDismissingKeyguard(PendingIntent, Runnable)}, but allows
     * you to specify the callback that is executed on the UI thread after the intent is sent.
     */
    void startPendingIntentDismissingKeyguard(PendingIntent intent, Runnable intentSentCallback);
    void startPendingIntentDismissingKeyguard(PendingIntent intent,
            Runnable intentSentUiThreadCallback);
    void startActivity(Intent intent, boolean dismissShade);
    void startActivity(Intent intent, boolean onlyProvisioned, boolean dismissShade);
    void startActivity(Intent intent, boolean dismissShade, Callback callback);
+9 −3
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.PowerManager;
import android.os.RemoteException;
@@ -572,6 +573,7 @@ public class StatusBar extends SystemUI implements DemoMode,
                    mEntryManager.updateNotifications();
                }
            };
    private final Handler mMainThreadHandler = new Handler(Looper.getMainLooper());

    private HeadsUpAppearanceController mHeadsUpAppearanceController;
    private boolean mVibrateOnOpening;
@@ -4261,7 +4263,7 @@ public class StatusBar extends SystemUI implements DemoMode,

    @Override
    public void startPendingIntentDismissingKeyguard(
            final PendingIntent intent, @Nullable final Runnable intentSentCallback) {
            final PendingIntent intent, @Nullable final Runnable intentSentUiThreadCallback) {
        final boolean afterKeyguardGone = intent.isActivity()
                && PreviewInflater.wouldLaunchResolverActivity(mContext, intent.getIntent(),
                mLockscreenUserManager.getCurrentUserId());
@@ -4280,12 +4282,16 @@ public class StatusBar extends SystemUI implements DemoMode,
            if (intent.isActivity()) {
                mAssistManager.hideAssist();
            }
            if (intentSentCallback != null) {
                intentSentCallback.run();
            if (intentSentUiThreadCallback != null) {
                postOnUiThread(intentSentUiThreadCallback);
            }
        }, afterKeyguardGone);
    }

    private void postOnUiThread(Runnable runnable) {
        mMainThreadHandler.post(runnable);
    }

    public static Bundle getActivityOptions(@Nullable RemoteAnimationAdapter animationAdapter) {
        ActivityOptions options;
        if (animationAdapter != null) {
+1 −9
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@ import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.InsetDrawable;
import android.graphics.drawable.RippleDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.Layout;
import android.text.TextPaint;
import android.text.method.TransformationMethod;
@@ -65,7 +63,6 @@ public class SmartReplyView extends ViewGroup {
    private final SmartReplyConstants mConstants;
    private final KeyguardDismissUtil mKeyguardDismissUtil;
    private final NotificationRemoteInputManager mRemoteInputManager;
    private final Handler mMainThreadHandler = new Handler(Looper.getMainLooper());

    /**
     * The upper bound for the height of this view in pixels. Notifications are automatically
@@ -311,8 +308,7 @@ public class SmartReplyView extends ViewGroup {
                        () -> {
                            smartReplyController.smartActionClicked(
                                    entry, actionIndex, action, smartActions.fromAssistant);
                            postOnUiThread(() ->
                                    headsUpManager.removeNotification(entry.key, true));
                            headsUpManager.removeNotification(entry.key, true);
                        }));

        // TODO(b/119010281): handle accessibility
@@ -323,10 +319,6 @@ public class SmartReplyView extends ViewGroup {
        return button;
    }

    private void postOnUiThread(Runnable runnable) {
        mMainThreadHandler.post(runnable);
    }

    @Override
    public LayoutParams generateLayoutParams(AttributeSet attrs) {
        return new LayoutParams(mContext, attrs);