Merge "Allow the background activity start from legacy suggestion cards" into main am: d78409d41f
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/3148096 Change-Id: If973cd5c6aa3d743fc7e764b8c59101311ad06ad Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.settings.homepage.contextualcards.legacysuggestion;
|
package com.android.settings.homepage.contextualcards.legacysuggestion;
|
||||||
|
|
||||||
|
import android.app.ActivityOptions;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -79,7 +80,10 @@ public class LegacySuggestionContextualCardController implements ContextualCardC
|
|||||||
@Override
|
@Override
|
||||||
public void onPrimaryClick(ContextualCard card) {
|
public void onPrimaryClick(ContextualCard card) {
|
||||||
try {
|
try {
|
||||||
((LegacySuggestionContextualCard) card).getPendingIntent().send();
|
ActivityOptions options = ActivityOptions.makeBasic()
|
||||||
|
.setPendingIntentBackgroundActivityStartMode(
|
||||||
|
ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED);
|
||||||
|
((LegacySuggestionContextualCard) card).getPendingIntent().send(options.toBundle());
|
||||||
} catch (PendingIntent.CanceledException e) {
|
} catch (PendingIntent.CanceledException e) {
|
||||||
Log.w(TAG, "Failed to start suggestion " + card.getTitleText());
|
Log.w(TAG, "Failed to start suggestion " + card.getTitleText());
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user