summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorMehdi Alizadeh <mett@google.com>2020-01-21 13:39:53 -0800
committerMehdi Alizadeh <mett@google.com>2020-02-05 13:53:47 -0800
commitae808ff765dcfe0806d1ab73d97e33d8bebd5d70 (patch)
tree22d737a96b825101b51227e04fd35fb7a3854af3 /core/java
parent9f680190662deec6cf83489a3af487b021c6bc71 (diff)
Adds locus Id to ShortcutQuery to find shortcuts based on LocusId
Bug: 148085173 Test: atest com.android.server.pm.ShortcutManagerTest1 \ com.android.server.pm.ShortcutManagerTest2 \ com.android.server.pm.ShortcutManagerTest3 \ com.android.server.pm.ShortcutManagerTest4 \ com.android.server.pm.ShortcutManagerTest5 \ com.android.server.pm.ShortcutManagerTest6 \ com.android.server.pm.ShortcutManagerTest7 \ com.android.server.pm.ShortcutManagerTest8 \ com.android.server.pm.ShortcutManagerTest9 \ com.android.server.pm.ShortcutManagerTest10 Test: atest DataManagerTest Change-Id: Ie789582a43db6d53130f4a0e5bff646a3c08c71e
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/content/pm/ILauncherApps.aidl9
-rw-r--r--core/java/android/content/pm/LauncherApps.java26
-rw-r--r--core/java/android/content/pm/ShortcutServiceInternal.java5
3 files changed, 31 insertions, 9 deletions
diff --git a/core/java/android/content/pm/ILauncherApps.aidl b/core/java/android/content/pm/ILauncherApps.aidl
index 173fa5f2b4ba..04923590b413 100644
--- a/core/java/android/content/pm/ILauncherApps.aidl
+++ b/core/java/android/content/pm/ILauncherApps.aidl
@@ -20,6 +20,7 @@ import android.app.IApplicationThread;
import android.content.ComponentName;
import android.content.Intent;
import android.content.IntentSender;
+import android.content.LocusId;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.IOnAppsChangedListener;
@@ -67,7 +68,8 @@ interface ILauncherApps {
in UserHandle user);
ParceledListSlice getShortcuts(String callingPackage, long changedSince, String packageName,
- in List shortcutIds, in ComponentName componentName, int flags, in UserHandle user);
+ in List shortcutIds, in List<LocusId> locusIds, in ComponentName componentName,
+ int flags, in UserHandle user);
void pinShortcuts(String callingPackage, String packageName, in List<String> shortcutIds,
in UserHandle user);
boolean startShortcut(String callingPackage, String packageName, String id,
@@ -92,7 +94,8 @@ interface ILauncherApps {
ParceledListSlice getAllSessions(String callingPackage);
void registerShortcutChangeCallback(String callingPackage, long changedSince,
- String packageName, in List shortcutIds, in ComponentName componentName, int flags,
- in IShortcutChangeCallback callback, int callbackId);
+ String packageName, in List shortcutIds, in List<LocusId> locusIds,
+ in ComponentName componentName, int flags, in IShortcutChangeCallback callback,
+ int callbackId);
void unregisterShortcutChangeCallback(String callingPackage, int callbackId);
}
diff --git a/core/java/android/content/pm/LauncherApps.java b/core/java/android/content/pm/LauncherApps.java
index c647f6868021..73c9e4d843b7 100644
--- a/core/java/android/content/pm/LauncherApps.java
+++ b/core/java/android/content/pm/LauncherApps.java
@@ -34,6 +34,7 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentSender;
+import android.content.LocusId;
import android.content.pm.PackageInstaller.SessionCallback;
import android.content.pm.PackageInstaller.SessionCallbackDelegate;
import android.content.pm.PackageInstaller.SessionInfo;
@@ -415,6 +416,9 @@ public class LauncherApps {
List<String> mShortcutIds;
@Nullable
+ List<LocusId> mLocusIds;
+
+ @Nullable
ComponentName mActivity;
@QueryFlags
@@ -451,6 +455,19 @@ public class LauncherApps {
}
/**
+ * If non-null, return only the specified shortcuts by locus ID. When setting this field,
+ * a package name must also be set with {@link #setPackage}.
+ *
+ * @hide
+ */
+ @SystemApi
+ @NonNull
+ public ShortcutQuery setLocusIds(@Nullable List<LocusId> locusIds) {
+ mLocusIds = locusIds;
+ return this;
+ }
+
+ /**
* If non-null, returns only shortcuts associated with the activity; i.e.
* {@link ShortcutInfo}s whose {@link ShortcutInfo#getActivity()} are equal
* to {@code activity}.
@@ -1022,8 +1039,8 @@ public class LauncherApps {
// changed callback, but that only returns shortcuts with the "key" information, so
// that won't return disabled message.
return maybeUpdateDisabledMessage(mService.getShortcuts(mContext.getPackageName(),
- query.mChangedSince, query.mPackage, query.mShortcutIds, query.mActivity,
- query.mQueryFlags, user)
+ query.mChangedSince, query.mPackage, query.mShortcutIds, query.mLocusIds,
+ query.mActivity, query.mQueryFlags, user)
.getList());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
@@ -1680,8 +1697,9 @@ public class LauncherApps {
mShortcutChangeCallbacks.put(callbackId, state);
try {
mService.registerShortcutChangeCallback(mContext.getPackageName(),
- query.mChangedSince, query.mPackage, query.mShortcutIds, query.mActivity,
- query.mQueryFlags, new ShortcutChangeCallbackProxy(state), callbackId);
+ query.mChangedSince, query.mPackage, query.mShortcutIds, query.mLocusIds,
+ query.mActivity, query.mQueryFlags, new ShortcutChangeCallbackProxy(state),
+ callbackId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
diff --git a/core/java/android/content/pm/ShortcutServiceInternal.java b/core/java/android/content/pm/ShortcutServiceInternal.java
index e6f682d22b14..a11a1dd5a68b 100644
--- a/core/java/android/content/pm/ShortcutServiceInternal.java
+++ b/core/java/android/content/pm/ShortcutServiceInternal.java
@@ -23,6 +23,7 @@ import android.appwidget.AppWidgetProviderInfo;
import android.content.ComponentName;
import android.content.Intent;
import android.content.IntentSender;
+import android.content.LocusId;
import android.content.pm.LauncherApps.ShortcutQuery;
import android.os.Bundle;
import android.os.ParcelFileDescriptor;
@@ -45,8 +46,8 @@ public abstract class ShortcutServiceInternal {
getShortcuts(int launcherUserId,
@NonNull String callingPackage, long changedSince,
@Nullable String packageName, @Nullable List<String> shortcutIds,
- @Nullable ComponentName componentName, @ShortcutQuery.QueryFlags int flags,
- int userId, int callingPid, int callingUid);
+ @Nullable List<LocusId> locusIds, @Nullable ComponentName componentName,
+ @ShortcutQuery.QueryFlags int flags, int userId, int callingPid, int callingUid);
public abstract boolean
isPinnedByCaller(int launcherUserId, @NonNull String callingPackage,