1 /**
2  * Copyright (c) 2014, 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.app.IApplicationThread;
20 import android.app.PendingIntent;
21 import android.content.ComponentName;
22 import android.content.Intent;
23 import android.content.IntentSender;
24 import android.content.LocusId;
25 import android.content.pm.ApplicationInfo;
26 import android.content.pm.IOnAppsChangedListener;
27 import android.content.pm.LauncherActivityInfoInternal;
28 import android.content.pm.LauncherApps;
29 import android.content.pm.ShortcutQueryWrapper;
30 import android.content.pm.IPackageInstallerCallback;
31 import android.content.pm.IShortcutChangeCallback;
32 import android.content.pm.PackageInstaller;
33 import android.content.pm.ParceledListSlice;
34 import android.content.pm.ResolveInfo;
35 import android.content.pm.ShortcutInfo;
36 import android.content.pm.LauncherActivityInfoInternal;
37 import android.graphics.Rect;
38 import android.os.Bundle;
39 import android.os.UserHandle;
40 import android.os.ParcelFileDescriptor;
41 import android.window.IDumpCallback;
42 
43 import com.android.internal.infra.AndroidFuture;
44 
45 import java.util.List;
46 
47 /**
48  * {@hide}
49  */
50 interface ILauncherApps {
addOnAppsChangedListener(String callingPackage, in IOnAppsChangedListener listener)51     void addOnAppsChangedListener(String callingPackage, in IOnAppsChangedListener listener);
removeOnAppsChangedListener(in IOnAppsChangedListener listener)52     void removeOnAppsChangedListener(in IOnAppsChangedListener listener);
getLauncherActivities( String callingPackage, String packageName, in UserHandle user)53     ParceledListSlice getLauncherActivities(
54             String callingPackage, String packageName, in UserHandle user);
resolveLauncherActivityInternal( String callingPackage, in ComponentName component, in UserHandle user)55     LauncherActivityInfoInternal resolveLauncherActivityInternal(
56             String callingPackage, in ComponentName component, in UserHandle user);
startSessionDetailsActivityAsUser(in IApplicationThread caller, String callingPackage, String callingFeatureId, in PackageInstaller.SessionInfo sessionInfo, in Rect sourceBounds, in Bundle opts, in UserHandle user)57     void startSessionDetailsActivityAsUser(in IApplicationThread caller, String callingPackage,
58                 String callingFeatureId, in PackageInstaller.SessionInfo sessionInfo,
59                 in Rect sourceBounds, in Bundle opts, in UserHandle user);
startActivityAsUser(in IApplicationThread caller, String callingPackage, String callingFeatureId, in ComponentName component, in Rect sourceBounds, in Bundle opts, in UserHandle user)60     void startActivityAsUser(in IApplicationThread caller, String callingPackage,
61             String callingFeatureId, in ComponentName component, in Rect sourceBounds,
62             in Bundle opts, in UserHandle user);
getActivityLaunchIntent(String callingPackage, in ComponentName component, in UserHandle user)63     PendingIntent getActivityLaunchIntent(String callingPackage, in ComponentName component,
64             in UserHandle user);
showAppDetailsAsUser(in IApplicationThread caller, String callingPackage, String callingFeatureId, in ComponentName component, in Rect sourceBounds, in Bundle opts, in UserHandle user)65     void showAppDetailsAsUser(in IApplicationThread caller, String callingPackage,
66             String callingFeatureId, in ComponentName component, in Rect sourceBounds,
67             in Bundle opts, in UserHandle user);
isPackageEnabled(String callingPackage, String packageName, in UserHandle user)68     boolean isPackageEnabled(String callingPackage, String packageName, in UserHandle user);
getSuspendedPackageLauncherExtras(String packageName, in UserHandle user)69     Bundle getSuspendedPackageLauncherExtras(String packageName, in UserHandle user);
isActivityEnabled( String callingPackage, in ComponentName component, in UserHandle user)70     boolean isActivityEnabled(
71             String callingPackage, in ComponentName component, in UserHandle user);
getApplicationInfo( String callingPackage, String packageName, int flags, in UserHandle user)72     ApplicationInfo getApplicationInfo(
73             String callingPackage, String packageName, int flags, in UserHandle user);
74 
getAppUsageLimit(String callingPackage, String packageName, in UserHandle user)75     LauncherApps.AppUsageLimit getAppUsageLimit(String callingPackage, String packageName,
76             in UserHandle user);
77 
getShortcuts(String callingPackage, in ShortcutQueryWrapper query, in UserHandle user)78     ParceledListSlice getShortcuts(String callingPackage, in ShortcutQueryWrapper query,
79             in UserHandle user);
getShortcutsAsync(String callingPackage, in ShortcutQueryWrapper query, in UserHandle user, in AndroidFuture<List<ShortcutInfo>> cb)80     void getShortcutsAsync(String callingPackage, in ShortcutQueryWrapper query,
81             in UserHandle user, in AndroidFuture<List<ShortcutInfo>> cb);
pinShortcuts(String callingPackage, String packageName, in List<String> shortcutIds, in UserHandle user)82     void pinShortcuts(String callingPackage, String packageName, in List<String> shortcutIds,
83             in UserHandle user);
startShortcut(String callingPackage, String packageName, String featureId, String id, in Rect sourceBounds, in Bundle startActivityOptions, int userId)84     boolean startShortcut(String callingPackage, String packageName, String featureId, String id,
85             in Rect sourceBounds, in Bundle startActivityOptions, int userId);
86 
getShortcutIconResId(String callingPackage, String packageName, String id, int userId)87     int getShortcutIconResId(String callingPackage, String packageName, String id,
88             int userId);
getShortcutIconFd(String callingPackage, String packageName, String id, int userId)89     ParcelFileDescriptor getShortcutIconFd(String callingPackage, String packageName, String id,
90             int userId);
91 
hasShortcutHostPermission(String callingPackage)92     boolean hasShortcutHostPermission(String callingPackage);
shouldHideFromSuggestions(String packageName, in UserHandle user)93     boolean shouldHideFromSuggestions(String packageName, in UserHandle user);
94 
getShortcutConfigActivities( String callingPackage, String packageName, in UserHandle user)95     ParceledListSlice getShortcutConfigActivities(
96             String callingPackage, String packageName, in UserHandle user);
getShortcutConfigActivityIntent(String callingPackage, in ComponentName component, in UserHandle user)97     IntentSender getShortcutConfigActivityIntent(String callingPackage, in ComponentName component,
98             in UserHandle user);
getShortcutIntent(String callingPackage, String packageName, String shortcutId, in Bundle opts, in UserHandle user)99     PendingIntent getShortcutIntent(String callingPackage, String packageName, String shortcutId,
100             in Bundle opts, in UserHandle user);
101 
102     // Unregister is performed using package installer
registerPackageInstallerCallback(String callingPackage, in IPackageInstallerCallback callback)103     void registerPackageInstallerCallback(String callingPackage,
104             in IPackageInstallerCallback callback);
getAllSessions(String callingPackage)105     ParceledListSlice getAllSessions(String callingPackage);
106 
registerShortcutChangeCallback(String callingPackage, in ShortcutQueryWrapper query, in IShortcutChangeCallback callback)107     void registerShortcutChangeCallback(String callingPackage, in ShortcutQueryWrapper query,
108 	    in IShortcutChangeCallback callback);
unregisterShortcutChangeCallback(String callingPackage, in IShortcutChangeCallback callback)109     void unregisterShortcutChangeCallback(String callingPackage,
110             in IShortcutChangeCallback callback);
111 
cacheShortcuts(String callingPackage, String packageName, in List<String> shortcutIds, in UserHandle user, int cacheFlags)112     void cacheShortcuts(String callingPackage, String packageName, in List<String> shortcutIds,
113             in UserHandle user, int cacheFlags);
uncacheShortcuts(String callingPackage, String packageName, in List<String> shortcutIds, in UserHandle user, int cacheFlags)114     void uncacheShortcuts(String callingPackage, String packageName, in List<String> shortcutIds,
115             in UserHandle user, int cacheFlags);
116 
getShortcutIconUri(String callingPackage, String packageName, String shortcutId, int userId)117     String getShortcutIconUri(String callingPackage, String packageName, String shortcutId,
118             int userId);
getActivityOverrides(String callingPackage, int userId)119     Map<String, LauncherActivityInfoInternal> getActivityOverrides(String callingPackage, int userId);
120 
121     /** Register a callback to be called right before the wmtrace data is moved to the bugreport. */
registerDumpCallback(IDumpCallback cb)122     void registerDumpCallback(IDumpCallback cb);
123 
124     /** Unregister a callback, so that it won't be called when LauncherApps dumps. */
unRegisterDumpCallback(IDumpCallback cb)125     void unRegisterDumpCallback(IDumpCallback cb);
126 }
127