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.content.ComponentName;
21 import android.content.Intent;
22 import android.content.IntentSender;
23 import android.content.LocusId;
24 import android.content.pm.ActivityInfo;
25 import android.content.pm.ApplicationInfo;
26 import android.content.pm.IOnAppsChangedListener;
27 import android.content.pm.LauncherApps;
28 import android.content.pm.ShortcutQueryWrapper;
29 import android.content.pm.IPackageInstallerCallback;
30 import android.content.pm.IShortcutChangeCallback;
31 import android.content.pm.PackageInstaller;
32 import android.content.pm.ParceledListSlice;
33 import android.content.pm.ResolveInfo;
34 import android.content.pm.ShortcutInfo;
35 import android.graphics.Rect;
36 import android.os.Bundle;
37 import android.os.UserHandle;
38 import android.os.ParcelFileDescriptor;
39 
40 import java.util.List;
41 
42 /**
43  * {@hide}
44  */
45 interface ILauncherApps {
addOnAppsChangedListener(String callingPackage, in IOnAppsChangedListener listener)46     void addOnAppsChangedListener(String callingPackage, in IOnAppsChangedListener listener);
removeOnAppsChangedListener(in IOnAppsChangedListener listener)47     void removeOnAppsChangedListener(in IOnAppsChangedListener listener);
getLauncherActivities( String callingPackage, String packageName, in UserHandle user)48     ParceledListSlice getLauncherActivities(
49             String callingPackage, String packageName, in UserHandle user);
resolveActivity( String callingPackage, in ComponentName component, in UserHandle user)50     ActivityInfo resolveActivity(
51             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)52     void startSessionDetailsActivityAsUser(in IApplicationThread caller, String callingPackage,
53                 String callingFeatureId, in PackageInstaller.SessionInfo sessionInfo,
54                 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)55     void startActivityAsUser(in IApplicationThread caller, String callingPackage,
56             String callingFeatureId, in ComponentName component, in Rect sourceBounds,
57             in Bundle opts, in UserHandle user);
showAppDetailsAsUser(in IApplicationThread caller, String callingPackage, String callingFeatureId, in ComponentName component, in Rect sourceBounds, in Bundle opts, in UserHandle user)58     void showAppDetailsAsUser(in IApplicationThread caller, String callingPackage,
59             String callingFeatureId, in ComponentName component, in Rect sourceBounds,
60             in Bundle opts, in UserHandle user);
isPackageEnabled(String callingPackage, String packageName, in UserHandle user)61     boolean isPackageEnabled(String callingPackage, String packageName, in UserHandle user);
getSuspendedPackageLauncherExtras(String packageName, in UserHandle user)62     Bundle getSuspendedPackageLauncherExtras(String packageName, in UserHandle user);
isActivityEnabled( String callingPackage, in ComponentName component, in UserHandle user)63     boolean isActivityEnabled(
64             String callingPackage, in ComponentName component, in UserHandle user);
getApplicationInfo( String callingPackage, String packageName, int flags, in UserHandle user)65     ApplicationInfo getApplicationInfo(
66             String callingPackage, String packageName, int flags, in UserHandle user);
67 
getAppUsageLimit(String callingPackage, String packageName, in UserHandle user)68     LauncherApps.AppUsageLimit getAppUsageLimit(String callingPackage, String packageName,
69             in UserHandle user);
70 
getShortcuts(String callingPackage, in ShortcutQueryWrapper query, in UserHandle user)71     ParceledListSlice getShortcuts(String callingPackage, in ShortcutQueryWrapper query,
72             in UserHandle user);
pinShortcuts(String callingPackage, String packageName, in List<String> shortcutIds, in UserHandle user)73     void pinShortcuts(String callingPackage, String packageName, in List<String> shortcutIds,
74             in UserHandle user);
startShortcut(String callingPackage, String packageName, String featureId, String id, in Rect sourceBounds, in Bundle startActivityOptions, int userId)75     boolean startShortcut(String callingPackage, String packageName, String featureId, String id,
76             in Rect sourceBounds, in Bundle startActivityOptions, int userId);
77 
getShortcutIconResId(String callingPackage, String packageName, String id, int userId)78     int getShortcutIconResId(String callingPackage, String packageName, String id,
79             int userId);
getShortcutIconFd(String callingPackage, String packageName, String id, int userId)80     ParcelFileDescriptor getShortcutIconFd(String callingPackage, String packageName, String id,
81             int userId);
82 
hasShortcutHostPermission(String callingPackage)83     boolean hasShortcutHostPermission(String callingPackage);
shouldHideFromSuggestions(String packageName, in UserHandle user)84     boolean shouldHideFromSuggestions(String packageName, in UserHandle user);
85 
getShortcutConfigActivities( String callingPackage, String packageName, in UserHandle user)86     ParceledListSlice getShortcutConfigActivities(
87             String callingPackage, String packageName, in UserHandle user);
getShortcutConfigActivityIntent(String callingPackage, in ComponentName component, in UserHandle user)88     IntentSender getShortcutConfigActivityIntent(String callingPackage, in ComponentName component,
89             in UserHandle user);
90 
91     // Unregister is performed using package installer
registerPackageInstallerCallback(String callingPackage, in IPackageInstallerCallback callback)92     void registerPackageInstallerCallback(String callingPackage,
93             in IPackageInstallerCallback callback);
getAllSessions(String callingPackage)94     ParceledListSlice getAllSessions(String callingPackage);
95 
registerShortcutChangeCallback(String callingPackage, in ShortcutQueryWrapper query, in IShortcutChangeCallback callback)96     void registerShortcutChangeCallback(String callingPackage, in ShortcutQueryWrapper query,
97 	    in IShortcutChangeCallback callback);
unregisterShortcutChangeCallback(String callingPackage, in IShortcutChangeCallback callback)98     void unregisterShortcutChangeCallback(String callingPackage,
99             in IShortcutChangeCallback callback);
100 
cacheShortcuts(String callingPackage, String packageName, in List<String> shortcutIds, in UserHandle user, int cacheFlags)101     void cacheShortcuts(String callingPackage, String packageName, in List<String> shortcutIds,
102             in UserHandle user, int cacheFlags);
uncacheShortcuts(String callingPackage, String packageName, in List<String> shortcutIds, in UserHandle user, int cacheFlags)103     void uncacheShortcuts(String callingPackage, String packageName, in List<String> shortcutIds,
104             in UserHandle user, int cacheFlags);
105 
getShortcutIconUri(String callingPackage, String packageName, String shortcutId, int userId)106     String getShortcutIconUri(String callingPackage, String packageName, String shortcutId,
107             int userId);
108 }
109