Debian Codegraph @

core/java/android/content/pm/ShortcutServiceInternal.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package android.content.pm;
18
19 import android.annotation.NonNull;
20 import android.annotation.Nullable;
21 import android.annotation.UserIdInt;
22 import android.appwidget.AppWidgetProviderInfo;
23 import android.content.ComponentName;
24 import android.content.Intent;
25 import android.content.IntentFilter;
26 import android.content.IntentSender;
27 import android.content.LocusId;
28 import android.content.pm.LauncherApps.ShortcutQuery;
29 import android.os.Bundle;
30 import android.os.ParcelFileDescriptor;
31
32 import com.android.internal.infra.AndroidFuture;
33
34 import java.util.List;
35
36 /**
37 * Entry points used by {@link LauncherApps}.
38 *
39 * <p>No permission / argument checks will be performed inside.
40 * Callers must check the calling app permission and the calling package name.
41 * @hide
42 */
43 public abstract class ShortcutServiceInternal {
44 public interface ShortcutChangeListener {
45 void onShortcutChanged(@NonNull String packageName, @UserIdInt int userId);
46 }
47
48 public abstract List<ShortcutInfo>
49 getShortcuts(int launcherUserId,
50 @NonNull String callingPackage, long changedSince,
51 @Nullable String packageName, @Nullable List<String> shortcutIds,
52 @Nullable List<LocusId> locusIds, @Nullable ComponentName componentName,
53 @ShortcutQuery.QueryFlags int flags, int userId, int callingPid, int callingUid);
54
55 /**
56 * Retrieves shortcuts asynchronously. Query will go through persistence layer (thus making the
57 * call async) if querying by shortcutIds in a specific package; otherwise it's effectively the
58 * same as calling {@link #getShortcuts}.
59 */
60 public abstract void
61 getShortcutsAsync(int launcherUserId,
62 @NonNull String callingPackage, long changedSince,
63 @Nullable String packageName, @Nullable List<String> shortcutIds,
64 @Nullable List<LocusId> locusIds, @Nullable ComponentName componentName,
65 @ShortcutQuery.QueryFlags int flags, int userId, int callingPid, int callingUid,
66 AndroidFuture<List<ShortcutInfo>> cb);
67
68 public abstract boolean
69 isPinnedByCaller(int launcherUserId, @NonNull String callingPackage,
70 @NonNull String packageName, @NonNull String id, int userId);
71
72 public abstract void pinShortcuts(int launcherUserId,
73 @NonNull String callingPackage, @NonNull String packageName,
74 @NonNull List<String> shortcutIds, int userId);
75
76 public abstract Intent[] createShortcutIntents(
77 int launcherUserId, @NonNull String callingPackage,
78 @NonNull String packageName, @NonNull String shortcutId, int userId,
79 int callingPid, int callingUid);
80
81 /**
82 * Retrieves the intents from a specified shortcut asynchronously.
83 */
84 public abstract void createShortcutIntentsAsync(
85 int launcherUserId, @NonNull String callingPackage,
86 @NonNull String packageName, @NonNull String shortcutId, int userId,
87 int callingPid, int callingUid, @NonNull AndroidFuture<Intent[]> cb);
88
89 public abstract void addListener(@NonNull ShortcutChangeListener listener);
90
91 public abstract void addShortcutChangeCallback(
92 @NonNull LauncherApps.ShortcutChangeCallback callback);
93
94 public abstract int getShortcutIconResId(int launcherUserId, @NonNull String callingPackage,
95 @NonNull String packageName, @NonNull String shortcutId, int userId);
96
97 /**
98 * Get the theme res ID of the starting window, it can be 0 if not specified.
99 */
100 public abstract @Nullable String getShortcutStartingThemeResName(int launcherUserId,
101 @NonNull String callingPackage, @NonNull String packageName, @NonNull String shortcutId,
102 int userId);
103
104 public abstract ParcelFileDescriptor getShortcutIconFd(int launcherUserId,
105 @NonNull String callingPackage,
106 @NonNull String packageName, @NonNull String shortcutId, int userId);
107
108 /**
109 * Retrieves a file descriptor from the icon in a specified shortcut asynchronously.
110 */
111 public abstract void getShortcutIconFdAsync(int launcherUserId, @NonNull String callingPackage,
112 @NonNull String packageName, @NonNull String shortcutId, int userId,
113 @NonNull AndroidFuture<ParcelFileDescriptor> cb);
114
115 public abstract boolean hasShortcutHostPermission(int launcherUserId,
116 @NonNull String callingPackage, int callingPid, int callingUid);
117
118 public abstract void setShortcutHostPackage(@NonNull String type, @Nullable String packageName,
119 int userId);
120
121 public abstract boolean requestPinAppWidget(@NonNull String callingPackage,
122 @NonNull AppWidgetProviderInfo appWidget, @Nullable Bundle extras,
123 @Nullable IntentSender resultIntent, int userId);
124
125 public abstract boolean isRequestPinItemSupported(int callingUserId, int requestType);
126
127 public abstract boolean isForegroundDefaultLauncher(@NonNull String callingPackage,
128 int callingUid);
129
130 public abstract void cacheShortcuts(int launcherUserId,
131 @NonNull String callingPackage, @NonNull String packageName,
132 @NonNull List<String> shortcutIds, int userId, int cacheFlags);
133 public abstract void uncacheShortcuts(int launcherUserId,
134 @NonNull String callingPackage, @NonNull String packageName,
135 @NonNull List<String> shortcutIds, int userId, int cacheFlags);
136
137 /**
138 * Retrieves all of the direct share targets that match the given IntentFilter for the specified
139 * user.
140 */
141 public abstract List<ShortcutManager.ShareShortcutInfo> getShareTargets(
142 @NonNull String callingPackage, @NonNull IntentFilter intentFilter, int userId);
143
144 /**
145 * Returns the icon Uri of the shortcut, and grants Uri read permission to the caller.
146 */
147 public abstract String getShortcutIconUri(int launcherUserId, @NonNull String launcherPackage,
148 @NonNull String packageName, @NonNull String shortcutId, int userId);
149
150 /**
151 * Retrieves the icon Uri of the shortcut asynchronously, and grants Uri read permission to the
152 * caller.
153 */
154 public abstract void getShortcutIconUriAsync(int launcherUserId,
155 @NonNull String launcherPackage, @NonNull String packageName,
156 @NonNull String shortcutId, int userId, @NonNull AndroidFuture<String> cb);
157
158 public abstract boolean isSharingShortcut(int callingUserId, @NonNull String callingPackage,
159 @NonNull String packageName, @NonNull String shortcutId, int userId,
160 @NonNull IntentFilter filter);
161 }