• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.IntentSender;
26 import android.content.pm.LauncherApps.ShortcutQuery;
27 import android.os.Bundle;
28 import android.os.ParcelFileDescriptor;
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 {
onShortcutChanged(@onNull String packageName, @UserIdInt int userId)41         void onShortcutChanged(@NonNull String packageName, @UserIdInt int userId);
42     }
43 
44     public abstract List<ShortcutInfo>
getShortcuts(int launcherUserId, @NonNull String callingPackage, long changedSince, @Nullable String packageName, @Nullable List<String> shortcutIds, @Nullable ComponentName componentName, @ShortcutQuery.QueryFlags int flags, int userId, int callingPid, int callingUid)45             getShortcuts(int launcherUserId,
46             @NonNull String callingPackage, long changedSince,
47             @Nullable String packageName, @Nullable List<String> shortcutIds,
48             @Nullable ComponentName componentName, @ShortcutQuery.QueryFlags int flags,
49             int userId, int callingPid, int callingUid);
50 
51     public abstract boolean
isPinnedByCaller(int launcherUserId, @NonNull String callingPackage, @NonNull String packageName, @NonNull String id, int userId)52             isPinnedByCaller(int launcherUserId, @NonNull String callingPackage,
53             @NonNull String packageName, @NonNull String id, int userId);
54 
pinShortcuts(int launcherUserId, @NonNull String callingPackage, @NonNull String packageName, @NonNull List<String> shortcutIds, int userId)55     public abstract void pinShortcuts(int launcherUserId,
56             @NonNull String callingPackage, @NonNull String packageName,
57             @NonNull List<String> shortcutIds, int userId);
58 
createShortcutIntents( int launcherUserId, @NonNull String callingPackage, @NonNull String packageName, @NonNull String shortcutId, int userId, int callingPid, int callingUid)59     public abstract Intent[] createShortcutIntents(
60             int launcherUserId, @NonNull String callingPackage,
61             @NonNull String packageName, @NonNull String shortcutId, int userId,
62             int callingPid, int callingUid);
63 
addListener(@onNull ShortcutChangeListener listener)64     public abstract void addListener(@NonNull ShortcutChangeListener listener);
65 
getShortcutIconResId(int launcherUserId, @NonNull String callingPackage, @NonNull String packageName, @NonNull String shortcutId, int userId)66     public abstract int getShortcutIconResId(int launcherUserId, @NonNull String callingPackage,
67             @NonNull String packageName, @NonNull String shortcutId, int userId);
68 
getShortcutIconFd(int launcherUserId, @NonNull String callingPackage, @NonNull String packageName, @NonNull String shortcutId, int userId)69     public abstract ParcelFileDescriptor getShortcutIconFd(int launcherUserId,
70             @NonNull String callingPackage,
71             @NonNull String packageName, @NonNull String shortcutId, int userId);
72 
hasShortcutHostPermission(int launcherUserId, @NonNull String callingPackage, int callingPid, int callingUid)73     public abstract boolean hasShortcutHostPermission(int launcherUserId,
74             @NonNull String callingPackage, int callingPid, int callingUid);
75 
setShortcutHostPackage(@onNull String type, @Nullable String packageName, int userId)76     public abstract void setShortcutHostPackage(@NonNull String type, @Nullable String packageName,
77             int userId);
78 
requestPinAppWidget(@onNull String callingPackage, @NonNull AppWidgetProviderInfo appWidget, @Nullable Bundle extras, @Nullable IntentSender resultIntent, int userId)79     public abstract boolean requestPinAppWidget(@NonNull String callingPackage,
80             @NonNull AppWidgetProviderInfo appWidget, @Nullable Bundle extras,
81             @Nullable IntentSender resultIntent, int userId);
82 
isRequestPinItemSupported(int callingUserId, int requestType)83     public abstract boolean isRequestPinItemSupported(int callingUserId, int requestType);
84 
isForegroundDefaultLauncher(@onNull String callingPackage, int callingUid)85     public abstract boolean isForegroundDefaultLauncher(@NonNull String callingPackage,
86             int callingUid);
87 }
88