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

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

Merge "Smartspace - Allow clicks to avoid intent launch" into sc-v2-dev

parents 6b969c8b 1e859950
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -123,18 +123,18 @@ public interface BcSmartspaceDataPlugin extends Plugin {

    /** Interface for launching Intents, which can differ on the lockscreen */
    interface IntentStarter {
        default void startFromAction(SmartspaceAction action, View v) {
        default void startFromAction(SmartspaceAction action, View v, boolean showOnLockscreen) {
            if (action.getIntent() != null) {
                startIntent(v, action.getIntent());
                startIntent(v, action.getIntent(), showOnLockscreen);
            } else if (action.getPendingIntent() != null) {
                startPendingIntent(action.getPendingIntent());
                startPendingIntent(action.getPendingIntent(), showOnLockscreen);
            }
        }

        /** Start the intent */
        void startIntent(View v, Intent i);
        void startIntent(View v, Intent i, boolean showOnLockscreen);

        /** Start the PendingIntent */
        void startPendingIntent(PendingIntent pi);
        void startPendingIntent(PendingIntent pi, boolean showOnLockscreen);
    }
}
+20 −4
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import android.view.View
import android.view.ViewGroup
import com.android.settingslib.Utils
import com.android.systemui.R
import com.android.systemui.animation.ActivityLaunchAnimator
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.plugins.ActivityStarter
@@ -188,14 +189,29 @@ class LockscreenSmartspaceController @Inject constructor(

        val ssView = plugin.getView(parent)
        ssView.registerDataProvider(plugin)

        val animationController = ActivityLaunchAnimator.Controller.fromView(
            ssView as View,
            null /* cujType */
        )

        ssView.setIntentStarter(object : BcSmartspaceDataPlugin.IntentStarter {
            override fun startIntent(v: View?, i: Intent?) {
                activityStarter.startActivity(i, true /* dismissShade */)
            override fun startIntent(v: View?, i: Intent?, showOnLockscreen: Boolean) {
                activityStarter.startActivity(
                    i,
                    true, /* dismissShade */
                    animationController,
                    showOnLockscreen
                )
            }

            override fun startPendingIntent(pi: PendingIntent?) {
            override fun startPendingIntent(pi: PendingIntent?, showOnLockscreen: Boolean) {
                if (showOnLockscreen) {
                    pi?.send()
                } else {
                    activityStarter.startPendingIntentDismissingKeyguard(pi)
                }
            }
        })
        ssView.setFalsingManager(falsingManager)
        return (ssView as View).apply { addOnAttachStateChangeListener(stateChangeListener) }