Smartspace - Allow clicks to avoid intent launch
When 'show_on_lockscreen' == true in the SmartspaceAction extras, start the activity without requiring the device to be unlocked. Fixes: 203775218 Test: manual Change-Id: Iab5505fc7aec8d7e29364ff7d3d527f5d71ec5b3
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,13 +189,28 @@ 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?) {
|
||||
activityStarter.startPendingIntentDismissingKeyguard(pi)
|
||||
override fun startPendingIntent(pi: PendingIntent?, showOnLockscreen: Boolean) {
|
||||
if (showOnLockscreen) {
|
||||
pi?.send()
|
||||
} else {
|
||||
activityStarter.startPendingIntentDismissingKeyguard(pi)
|
||||
}
|
||||
}
|
||||
})
|
||||
ssView.setFalsingManager(falsingManager)
|
||||
|
||||
Reference in New Issue
Block a user