Update startPendingIntent to have a View v function parameter.

The `View v` parameter can be used to construct a custom
ActivityOptions for launching animations.

No behavior change.

Bug: 274104981
Test: N/A; passing existing tests.
Change-Id: I26f1f4c967a153697d4a6e38ea3a14b441c47bb5
This commit is contained in:
Xiaowen Lei
2023-04-14 18:09:14 -07:00
parent 1be684590b
commit fa365ee4be
3 changed files with 13 additions and 5 deletions

View File

@@ -187,7 +187,7 @@ public interface BcSmartspaceDataPlugin extends Plugin {
if (action.getIntent() != null) {
startIntent(v, action.getIntent(), showOnLockscreen);
} else if (action.getPendingIntent() != null) {
startPendingIntent(action.getPendingIntent(), showOnLockscreen);
startPendingIntent(v, action.getPendingIntent(), showOnLockscreen);
}
} catch (ActivityNotFoundException e) {
Log.w(TAG, "Could not launch intent for action: " + action, e);
@@ -199,7 +199,7 @@ public interface BcSmartspaceDataPlugin extends Plugin {
if (action.getIntent() != null) {
startIntent(v, action.getIntent(), showOnLockscreen);
} else if (action.getPendingIntent() != null) {
startPendingIntent(action.getPendingIntent(), showOnLockscreen);
startPendingIntent(v, action.getPendingIntent(), showOnLockscreen);
}
} catch (ActivityNotFoundException e) {
Log.w(TAG, "Could not launch intent for action: " + action, e);
@@ -210,6 +210,6 @@ public interface BcSmartspaceDataPlugin extends Plugin {
void startIntent(View v, Intent i, boolean showOnLockscreen);
/** Start the PendingIntent */
void startPendingIntent(PendingIntent pi, boolean showOnLockscreen);
void startPendingIntent(View v, PendingIntent pi, boolean showOnLockscreen);
}
}

View File

@@ -75,7 +75,11 @@ interface SmartspaceViewComponent {
)
}
override fun startPendingIntent(pi: PendingIntent, showOnLockscreen: Boolean) {
override fun startPendingIntent(
view: View,
pi: PendingIntent,
showOnLockscreen: Boolean
) {
if (showOnLockscreen) {
pi.send()
} else {

View File

@@ -353,7 +353,11 @@ constructor(
}
}
override fun startPendingIntent(pi: PendingIntent, showOnLockscreen: Boolean) {
override fun startPendingIntent(
view: View,
pi: PendingIntent,
showOnLockscreen: Boolean
) {
if (showOnLockscreen) {
pi.send()
} else {