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

Commit 4c86885a authored by Steve Elliott's avatar Steve Elliott
Browse files

Dismiss keyguard from GlobalActionsPanelPlugin

This allows for the GlobalActionsPanelPlugin impl to fire
PendingIntents from the lockscreen, prompting the user to unlock
first.

Test: manual
Change-Id: Ib2e8e756db03e6aace815f1097a32905c06a0a57
parent b3f042a6
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.plugins;

import android.app.PendingIntent;
import android.view.View;

import com.android.systemui.plugins.annotations.DependsOn;
@@ -62,6 +63,15 @@ public interface GlobalActionsPanelPlugin extends Plugin {

        /** Dismisses the Global Actions menu. */
        void dismissGlobalActionsMenu();

        /** Starts a PendingIntent, dismissing the keyguard if necessary. */
        default void startPendingIntentDismissingKeyguard(PendingIntent pendingIntent) {
            try {
                pendingIntent.send();
            } catch (PendingIntent.CanceledException e) {
                // no-op
            }
        }
    }

    /**
+20 −5
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STR
import android.app.ActivityManager;
import android.app.Dialog;
import android.app.KeyguardManager;
import android.app.PendingIntent;
import android.app.WallpaperManager;
import android.app.admin.DevicePolicyManager;
import android.app.trust.TrustManager;
@@ -87,6 +88,7 @@ import com.android.systemui.Interpolators;
import com.android.systemui.MultiListLayout;
import com.android.systemui.MultiListLayout.MultiListAdapter;
import com.android.systemui.colorextraction.SysuiColorExtractor;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.GlobalActions.GlobalActionsManager;
import com.android.systemui.plugins.GlobalActionsPanelPlugin;
import com.android.systemui.statusbar.phone.ScrimController;
@@ -163,6 +165,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
    private final ScreenRecordHelper mScreenRecordHelper;

    private final Extension<GlobalActionsPanelPlugin> mPanelExtension;
    private ActivityStarter mActivityStarter;

    /**
     * @param context everything needs a context :(
@@ -212,6 +215,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
            .newExtension(GlobalActionsPanelPlugin.class)
            .withPlugin(GlobalActionsPanelPlugin.class)
            .build();
        mActivityStarter = Dependency.get(ActivityStarter.class);
    }

    /**
@@ -401,10 +405,21 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,

        GlobalActionsPanelPlugin.PanelViewController panelViewController =
                mPanelExtension.get() != null
                        ? mPanelExtension.get().onPanelShown(() -> {
                        ? mPanelExtension.get().onPanelShown(
                                new GlobalActionsPanelPlugin.Callbacks() {
                                    @Override
                                    public void dismissGlobalActionsMenu() {
                                        if (mDialog != null) {
                                            mDialog.dismiss();
                                        }
                                    }

                                    @Override
                                    public void startPendingIntentDismissingKeyguard(
                                            PendingIntent intent) {
                                        mActivityStarter
                                                .startPendingIntentDismissingKeyguard(intent);
                                    }
                                })
                        : null;
        ActionsDialog dialog = new ActionsDialog(mContext, mAdapter, mUseSeparatedList,