2 * Copyright (C) 2016 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package android.content.pm;
19 import android.annotation.NonNull;
20 import android.annotation.Nullable;
21 import android.annotation.UserIdInt;
22 import android.content.ComponentName;
23 import android.content.Intent;
24 import android.content.pm.LauncherApps.ShortcutQuery;
25 import android.os.ParcelFileDescriptor;
27 import java.util.List;
30 * Entry points used by {@link LauncherApps}.
32 * <p>No permission / argument checks will be performed inside.
33 * Callers must check the calling app permission and the calling package name.
36 public abstract class ShortcutServiceInternal {
37 public interface ShortcutChangeListener {
38 void onShortcutChanged(@NonNull String packageName, @UserIdInt int userId);
41 public abstract List<ShortcutInfo>
42 getShortcuts(int launcherUserId,
43 @NonNull String callingPackage, long changedSince,
44 @Nullable String packageName, @Nullable List<String> shortcutIds,
45 @Nullable ComponentName componentName, @ShortcutQuery.QueryFlags int flags,
48 public abstract boolean
49 isPinnedByCaller(int launcherUserId, @NonNull String callingPackage,
50 @NonNull String packageName, @NonNull String id, int userId);
52 public abstract void pinShortcuts(int launcherUserId,
53 @NonNull String callingPackage, @NonNull String packageName,
54 @NonNull List<String> shortcutIds, int userId);
56 public abstract Intent[] createShortcutIntents(
57 int launcherUserId, @NonNull String callingPackage,
58 @NonNull String packageName, @NonNull String shortcutId, int userId);
60 public abstract void addListener(@NonNull ShortcutChangeListener listener);
62 public abstract int getShortcutIconResId(int launcherUserId, @NonNull String callingPackage,
63 @NonNull String packageName, @NonNull String shortcutId, int userId);
65 public abstract ParcelFileDescriptor getShortcutIconFd(int launcherUserId,
66 @NonNull String callingPackage,
67 @NonNull String packageName, @NonNull String shortcutId, int userId);
69 public abstract boolean hasShortcutHostPermission(int launcherUserId,
70 @NonNull String callingPackage);