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.content.ComponentName; 23 import android.content.Intent; 24 import android.content.pm.LauncherApps.ShortcutQuery; 25 import android.os.ParcelFileDescriptor; 26 27 import java.util.List; 28 29 /** 30 * Entry points used by {@link LauncherApps}. 31 * 32 * <p>No permission / argument checks will be performed inside. 33 * Callers must check the calling app permission and the calling package name. 34 * @hide 35 */ 36 public abstract class ShortcutServiceInternal { 37 public interface ShortcutChangeListener { 38 void onShortcutChanged(@NonNull String packageName, @UserIdInt int userId); 39 } 40 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, 46 int userId); 47 48 public abstract boolean 49 isPinnedByCaller(int launcherUserId, @NonNull String callingPackage, 50 @NonNull String packageName, @NonNull String id, int userId); 51 52 public abstract void pinShortcuts(int launcherUserId, 53 @NonNull String callingPackage, @NonNull String packageName, 54 @NonNull List<String> shortcutIds, int userId); 55 56 public abstract Intent[] createShortcutIntents( 57 int launcherUserId, @NonNull String callingPackage, 58 @NonNull String packageName, @NonNull String shortcutId, int userId); 59 60 public abstract void addListener(@NonNull ShortcutChangeListener listener); 61 62 public abstract int getShortcutIconResId(int launcherUserId, @NonNull String callingPackage, 63 @NonNull String packageName, @NonNull String shortcutId, int userId); 64 65 public abstract ParcelFileDescriptor getShortcutIconFd(int launcherUserId, 66 @NonNull String callingPackage, 67 @NonNull String packageName, @NonNull String shortcutId, int userId); 68 69 public abstract boolean hasShortcutHostPermission(int launcherUserId, 70 @NonNull String callingPackage); 71 } 72