blob: e6f682d22b14873350e8be967340850cf16aa54b [file] [log] [blame]
Makoto Onuki6f7362d92016-03-04 13:39:41 -08001/*
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
17package android.content.pm;
18
19import android.annotation.NonNull;
20import android.annotation.Nullable;
21import android.annotation.UserIdInt;
Sunny Goyal87a563e2017-01-01 19:42:45 -080022import android.appwidget.AppWidgetProviderInfo;
Makoto Onuki6f7362d92016-03-04 13:39:41 -080023import android.content.ComponentName;
24import android.content.Intent;
Sunny Goyal87a563e2017-01-01 19:42:45 -080025import android.content.IntentSender;
Makoto Onuki6f7362d92016-03-04 13:39:41 -080026import android.content.pm.LauncherApps.ShortcutQuery;
Sunny Goyal4ad6b572017-02-28 11:11:51 -080027import android.os.Bundle;
Makoto Onuki55046222016-03-08 10:49:47 -080028import android.os.ParcelFileDescriptor;
Makoto Onuki6f7362d92016-03-04 13:39:41 -080029
30import 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 */
39public abstract class ShortcutServiceInternal {
40 public interface ShortcutChangeListener {
Makoto Onuki4dbe0de2016-03-14 17:31:49 -070041 void onShortcutChanged(@NonNull String packageName, @UserIdInt int userId);
Makoto Onuki6f7362d92016-03-04 13:39:41 -080042 }
43
44 public abstract List<ShortcutInfo>
Makoto Onukid99c6f02016-03-28 11:02:54 -070045 getShortcuts(int launcherUserId,
46 @NonNull String callingPackage, long changedSince,
Makoto Onukiabe84422016-04-07 09:41:19 -070047 @Nullable String packageName, @Nullable List<String> shortcutIds,
Makoto Onuki99302b52017-03-29 12:42:26 -070048 @Nullable ComponentName componentName, @ShortcutQuery.QueryFlags int flags,
Makoto Onuki634cecb2017-10-13 17:10:48 -070049 int userId, int callingPid, int callingUid);
Makoto Onuki6f7362d92016-03-04 13:39:41 -080050
Makoto Onukid99c6f02016-03-28 11:02:54 -070051 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 Onuki6f7362d92016-03-04 13:39:41 -080057 @NonNull List<String> shortcutIds, int userId);
58
Makoto Onuki440a1ea2016-07-20 14:21:18 -070059 public abstract Intent[] createShortcutIntents(
60 int launcherUserId, @NonNull String callingPackage,
Makoto Onuki634cecb2017-10-13 17:10:48 -070061 @NonNull String packageName, @NonNull String shortcutId, int userId,
62 int callingPid, int callingUid);
Makoto Onuki6f7362d92016-03-04 13:39:41 -080063
64 public abstract void addListener(@NonNull ShortcutChangeListener listener);
Makoto Onuki55046222016-03-08 10:49:47 -080065
Makoto Onukid99c6f02016-03-28 11:02:54 -070066 public abstract int getShortcutIconResId(int launcherUserId, @NonNull String callingPackage,
Makoto Onukiabe84422016-04-07 09:41:19 -070067 @NonNull String packageName, @NonNull String shortcutId, int userId);
Makoto Onuki55046222016-03-08 10:49:47 -080068
Makoto Onukid99c6f02016-03-28 11:02:54 -070069 public abstract ParcelFileDescriptor getShortcutIconFd(int launcherUserId,
70 @NonNull String callingPackage,
Makoto Onukiabe84422016-04-07 09:41:19 -070071 @NonNull String packageName, @NonNull String shortcutId, int userId);
Makoto Onuki2d5b4652016-03-11 16:09:54 -080072
Makoto Onukid99c6f02016-03-28 11:02:54 -070073 public abstract boolean hasShortcutHostPermission(int launcherUserId,
Makoto Onuki634cecb2017-10-13 17:10:48 -070074 @NonNull String callingPackage, int callingPid, int callingUid);
Sunny Goyal87a563e2017-01-01 19:42:45 -080075
Dianne Hackbornc160fa42017-11-01 16:14:26 -070076 public abstract void setShortcutHostPackage(@NonNull String type, @Nullable String packageName,
77 int userId);
78
Sunny Goyal87a563e2017-01-01 19:42:45 -080079 public abstract boolean requestPinAppWidget(@NonNull String callingPackage,
Sunny Goyal4ad6b572017-02-28 11:11:51 -080080 @NonNull AppWidgetProviderInfo appWidget, @Nullable Bundle extras,
81 @Nullable IntentSender resultIntent, int userId);
Sunny Goyal7f7372a2017-01-24 11:53:54 -080082
83 public abstract boolean isRequestPinItemSupported(int callingUserId, int requestType);
Tony Maked6ef622017-12-07 16:36:16 +000084
85 public abstract boolean isForegroundDefaultLauncher(@NonNull String callingPackage,
86 int callingUid);
Makoto Onuki6f7362d92016-03-04 13:39:41 -080087}