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