summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorTony Mak <tonymak@google.com>2019-06-06 02:39:33 -0700
committerandroid-build-merger <android-build-merger@google.com>2019-06-06 02:39:33 -0700
commit01ac3d3a7bbc2107ba7adceebd52bf3a5e309c29 (patch)
tree2028b109e19789fa65b17e24b43f3a03bcae5dd6 /core/java
parent44149fc2c119f388a4b2f7ebb33c48ba3b4ab3c2 (diff)
parent78a48f5512f5996d5adc7ce0dc432ea2b6f42fc6 (diff)
Merge "Fix an issue that clicking on a smart action chip on keyguard ... failed to launch app resolver when there are more than one app handlers." into qt-dev
am: 78a48f5512 Change-Id: Ic7dd0c9f952e905c8f42001276f3def6e1797b70
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/view/textclassifier/ActionsSuggestionsHelper.java10
-rw-r--r--core/java/android/view/textclassifier/intent/LabeledIntent.java6
2 files changed, 11 insertions, 5 deletions
diff --git a/core/java/android/view/textclassifier/ActionsSuggestionsHelper.java b/core/java/android/view/textclassifier/ActionsSuggestionsHelper.java
index 9c268f2d18a8..3ed48f655d47 100644
--- a/core/java/android/view/textclassifier/ActionsSuggestionsHelper.java
+++ b/core/java/android/view/textclassifier/ActionsSuggestionsHelper.java
@@ -19,7 +19,9 @@ package android.view.textclassifier;
import android.annotation.Nullable;
import android.app.Person;
import android.app.RemoteAction;
+import android.content.ComponentName;
import android.content.Context;
+import android.content.Intent;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.Pair;
@@ -200,10 +202,12 @@ public final class ActionsSuggestionsHelper {
if (remoteAction == null) {
return null;
}
+ Intent actionIntent = ExtrasUtils.getActionIntent(conversationAction.getExtras());
+ ComponentName componentName = actionIntent.getComponent();
+ // Action without a component name will be considered as from the same app.
+ String packageName = componentName == null ? null : componentName.getPackageName();
return new Pair<>(
- conversationAction.getAction().getTitle().toString(),
- ExtrasUtils.getActionIntent(
- conversationAction.getExtras()).getComponent().getPackageName());
+ conversationAction.getAction().getTitle().toString(), packageName);
}
private static final class PersonEncoder {
diff --git a/core/java/android/view/textclassifier/intent/LabeledIntent.java b/core/java/android/view/textclassifier/intent/LabeledIntent.java
index b4bc8d39d562..30fc20ea86a1 100644
--- a/core/java/android/view/textclassifier/intent/LabeledIntent.java
+++ b/core/java/android/view/textclassifier/intent/LabeledIntent.java
@@ -118,14 +118,16 @@ public final class LabeledIntent {
return null;
}
Intent resolvedIntent = new Intent(intent);
- resolvedIntent.setComponent(new ComponentName(packageName, className));
resolvedIntent.putExtra(
TextClassifier.EXTRA_FROM_TEXT_CLASSIFIER,
getFromTextClassifierExtra(textLanguagesBundle));
-
boolean shouldShowIcon = false;
Icon icon = null;
if (!"android".equals(packageName)) {
+ // We only set the component name when the package name is not resolved to "android"
+ // to workaround a bug that explicit intent with component name == ResolverActivity
+ // can't be launched on keyguard.
+ resolvedIntent.setComponent(new ComponentName(packageName, className));
if (resolveInfo.activityInfo.getIconResource() != 0) {
icon = Icon.createWithResource(
packageName, resolveInfo.activityInfo.getIconResource());