Makoto Onuki | 6f7362d9 | 2016-03-04 13:39:41 -0800 | [diff] [blame] | 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; |
Sunny Goyal | 87a563e | 2017-01-01 19:42:45 -0800 | [diff] [blame] | 22 | import android.appwidget.AppWidgetProviderInfo; |
Makoto Onuki | 6f7362d9 | 2016-03-04 13:39:41 -0800 | [diff] [blame] | 23 | import android.content.ComponentName; |
| 24 | import android.content.Intent; |
Sunny Goyal | 87a563e | 2017-01-01 19:42:45 -0800 | [diff] [blame] | 25 | import android.content.IntentSender; |
Makoto Onuki | 6f7362d9 | 2016-03-04 13:39:41 -0800 | [diff] [blame] | 26 | import android.content.pm.LauncherApps.ShortcutQuery; |
Sunny Goyal | 4ad6b57 | 2017-02-28 11:11:51 -0800 | [diff] [blame] | 27 | import android.os.Bundle; |
Makoto Onuki | 5504622 | 2016-03-08 10:49:47 -0800 | [diff] [blame] | 28 | import android.os.ParcelFileDescriptor; |
Makoto Onuki | 6f7362d9 | 2016-03-04 13:39:41 -0800 | [diff] [blame] | 29 | |
| 30 | import java.util.List; |
| 31 | |
| 32 | /** |
| 33 | * Entry points used by {@link LauncherApps}. |
| 34 | * |
| 35 | * <p>No permission / argument checks will be performed inside. |
| 36 | * Callers must check the calling app permission and the calling package name. |
| 37 | * @hide |
| 38 | */ |
| 39 | public abstract class ShortcutServiceInternal { |
| 40 | public interface ShortcutChangeListener { |
Makoto Onuki | 4dbe0de | 2016-03-14 17:31:49 -0700 | [diff] [blame] | 41 | void onShortcutChanged(@NonNull String packageName, @UserIdInt int userId); |
Makoto Onuki | 6f7362d9 | 2016-03-04 13:39:41 -0800 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | public abstract List<ShortcutInfo> |
Makoto Onuki | d99c6f0 | 2016-03-28 11:02:54 -0700 | [diff] [blame] | 45 | getShortcuts(int launcherUserId, |
| 46 | @NonNull String callingPackage, long changedSince, |
Makoto Onuki | abe8442 | 2016-04-07 09:41:19 -0700 | [diff] [blame] | 47 | @Nullable String packageName, @Nullable List<String> shortcutIds, |
Makoto Onuki | 99302b5 | 2017-03-29 12:42:26 -0700 | [diff] [blame] | 48 | @Nullable ComponentName componentName, @ShortcutQuery.QueryFlags int flags, |
Makoto Onuki | 634cecb | 2017-10-13 17:10:48 -0700 | [diff] [blame] | 49 | int userId, int callingPid, int callingUid); |
Makoto Onuki | 6f7362d9 | 2016-03-04 13:39:41 -0800 | [diff] [blame] | 50 | |
Makoto Onuki | d99c6f0 | 2016-03-28 11:02:54 -0700 | [diff] [blame] | 51 | public abstract boolean |
| 52 | isPinnedByCaller(int launcherUserId, @NonNull String callingPackage, |
| 53 | @NonNull String packageName, @NonNull String id, int userId); |
| 54 | |
| 55 | public abstract void pinShortcuts(int launcherUserId, |
| 56 | @NonNull String callingPackage, @NonNull String packageName, |
Makoto Onuki | 6f7362d9 | 2016-03-04 13:39:41 -0800 | [diff] [blame] | 57 | @NonNull List<String> shortcutIds, int userId); |
| 58 | |
Makoto Onuki | 440a1ea | 2016-07-20 14:21:18 -0700 | [diff] [blame] | 59 | public abstract Intent[] createShortcutIntents( |
| 60 | int launcherUserId, @NonNull String callingPackage, |
Makoto Onuki | 634cecb | 2017-10-13 17:10:48 -0700 | [diff] [blame] | 61 | @NonNull String packageName, @NonNull String shortcutId, int userId, |
| 62 | int callingPid, int callingUid); |
Makoto Onuki | 6f7362d9 | 2016-03-04 13:39:41 -0800 | [diff] [blame] | 63 | |
| 64 | public abstract void addListener(@NonNull ShortcutChangeListener listener); |
Makoto Onuki | 5504622 | 2016-03-08 10:49:47 -0800 | [diff] [blame] | 65 | |
Makoto Onuki | d99c6f0 | 2016-03-28 11:02:54 -0700 | [diff] [blame] | 66 | public abstract int getShortcutIconResId(int launcherUserId, @NonNull String callingPackage, |
Makoto Onuki | abe8442 | 2016-04-07 09:41:19 -0700 | [diff] [blame] | 67 | @NonNull String packageName, @NonNull String shortcutId, int userId); |
Makoto Onuki | 5504622 | 2016-03-08 10:49:47 -0800 | [diff] [blame] | 68 | |
Makoto Onuki | d99c6f0 | 2016-03-28 11:02:54 -0700 | [diff] [blame] | 69 | public abstract ParcelFileDescriptor getShortcutIconFd(int launcherUserId, |
| 70 | @NonNull String callingPackage, |
Makoto Onuki | abe8442 | 2016-04-07 09:41:19 -0700 | [diff] [blame] | 71 | @NonNull String packageName, @NonNull String shortcutId, int userId); |
Makoto Onuki | 2d5b465 | 2016-03-11 16:09:54 -0800 | [diff] [blame] | 72 | |
Makoto Onuki | d99c6f0 | 2016-03-28 11:02:54 -0700 | [diff] [blame] | 73 | public abstract boolean hasShortcutHostPermission(int launcherUserId, |
Makoto Onuki | 634cecb | 2017-10-13 17:10:48 -0700 | [diff] [blame] | 74 | @NonNull String callingPackage, int callingPid, int callingUid); |
Sunny Goyal | 87a563e | 2017-01-01 19:42:45 -0800 | [diff] [blame] | 75 | |
Dianne Hackborn | c160fa4 | 2017-11-01 16:14:26 -0700 | [diff] [blame] | 76 | public abstract void setShortcutHostPackage(@NonNull String type, @Nullable String packageName, |
| 77 | int userId); |
| 78 | |
Sunny Goyal | 87a563e | 2017-01-01 19:42:45 -0800 | [diff] [blame] | 79 | public abstract boolean requestPinAppWidget(@NonNull String callingPackage, |
Sunny Goyal | 4ad6b57 | 2017-02-28 11:11:51 -0800 | [diff] [blame] | 80 | @NonNull AppWidgetProviderInfo appWidget, @Nullable Bundle extras, |
| 81 | @Nullable IntentSender resultIntent, int userId); |
Sunny Goyal | 7f7372a | 2017-01-24 11:53:54 -0800 | [diff] [blame] | 82 | |
| 83 | public abstract boolean isRequestPinItemSupported(int callingUserId, int requestType); |
Tony Mak | ed6ef62 | 2017-12-07 16:36:16 +0000 | [diff] [blame] | 84 | |
| 85 | public abstract boolean isForegroundDefaultLauncher(@NonNull String callingPackage, |
| 86 | int callingUid); |
Makoto Onuki | 6f7362d9 | 2016-03-04 13:39:41 -0800 | [diff] [blame] | 87 | } |