IPackageManager.aidl revision edc84ee8392afa0102f098168329db5bb43a6d4b
1/*
2**
3** Copyright 2007, The Android Open Source Project
4**
5** Licensed under the Apache License, Version 2.0 (the "License");
6** you may not use this file except in compliance with the License.
7** You may obtain a copy of the License at
8**
9**     http://www.apache.org/licenses/LICENSE-2.0
10**
11** Unless required by applicable law or agreed to in writing, software
12** distributed under the License is distributed on an "AS IS" BASIS,
13** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14** See the License for the specific language governing permissions and
15** limitations under the License.
16*/
17
18package android.content.pm;
19
20import android.content.ComponentName;
21import android.content.Intent;
22import android.content.IntentFilter;
23import android.content.pm.ActivityInfo;
24import android.content.pm.ApplicationInfo;
25import android.content.pm.FeatureInfo;
26import android.content.pm.IPackageInstallObserver;
27import android.content.pm.IPackageDeleteObserver;
28import android.content.pm.IPackageDataObserver;
29import android.content.pm.IPackageMoveObserver;
30import android.content.pm.IPackageStatsObserver;
31import android.content.pm.InstrumentationInfo;
32import android.content.pm.PackageInfo;
33import android.content.pm.ManifestDigest;
34import android.content.pm.ParceledListSlice;
35import android.content.pm.ProviderInfo;
36import android.content.pm.PermissionGroupInfo;
37import android.content.pm.PermissionInfo;
38import android.content.pm.ResolveInfo;
39import android.content.pm.ServiceInfo;
40import android.content.pm.UserInfo;
41import android.content.pm.VerifierDeviceIdentity;
42import android.net.Uri;
43import android.content.IntentSender;
44
45/**
46 *  See {@link PackageManager} for documentation on most of the APIs
47 *  here.
48 *
49 *  {@hide}
50 */
51interface IPackageManager {
52    PackageInfo getPackageInfo(String packageName, int flags);
53    int getPackageUid(String packageName);
54    int[] getPackageGids(String packageName);
55
56    String[] currentToCanonicalPackageNames(in String[] names);
57    String[] canonicalToCurrentPackageNames(in String[] names);
58
59    PermissionInfo getPermissionInfo(String name, int flags);
60
61    List<PermissionInfo> queryPermissionsByGroup(String group, int flags);
62
63    PermissionGroupInfo getPermissionGroupInfo(String name, int flags);
64
65    List<PermissionGroupInfo> getAllPermissionGroups(int flags);
66
67    ApplicationInfo getApplicationInfo(String packageName, int flags);
68
69    ActivityInfo getActivityInfo(in ComponentName className, int flags);
70
71    ActivityInfo getReceiverInfo(in ComponentName className, int flags);
72
73    ServiceInfo getServiceInfo(in ComponentName className, int flags);
74
75    ProviderInfo getProviderInfo(in ComponentName className, int flags);
76
77    int checkPermission(String permName, String pkgName);
78
79    int checkUidPermission(String permName, int uid);
80
81    boolean addPermission(in PermissionInfo info);
82
83    void removePermission(String name);
84
85    void grantPermission(String packageName, String permissionName);
86
87    void revokePermission(String packageName, String permissionName);
88
89    boolean isProtectedBroadcast(String actionName);
90
91    int checkSignatures(String pkg1, String pkg2);
92
93    int checkUidSignatures(int uid1, int uid2);
94
95    String[] getPackagesForUid(int uid);
96
97    String getNameForUid(int uid);
98
99    int getUidForSharedUser(String sharedUserName);
100
101    ResolveInfo resolveIntent(in Intent intent, String resolvedType, int flags);
102
103    List<ResolveInfo> queryIntentActivities(in Intent intent,
104            String resolvedType, int flags);
105
106    List<ResolveInfo> queryIntentActivityOptions(
107            in ComponentName caller, in Intent[] specifics,
108            in String[] specificTypes, in Intent intent,
109            String resolvedType, int flags);
110
111    List<ResolveInfo> queryIntentReceivers(in Intent intent,
112            String resolvedType, int flags);
113
114    ResolveInfo resolveService(in Intent intent,
115            String resolvedType, int flags);
116
117    List<ResolveInfo> queryIntentServices(in Intent intent,
118            String resolvedType, int flags);
119
120    /**
121     * This implements getInstalledPackages via a "last returned row"
122     * mechanism that is not exposed in the API. This is to get around the IPC
123     * limit that kicks in when flags are included that bloat up the data
124     * returned.
125     */
126    ParceledListSlice getInstalledPackages(int flags, in String lastRead);
127
128    /**
129     * This implements getInstalledApplications via a "last returned row"
130     * mechanism that is not exposed in the API. This is to get around the IPC
131     * limit that kicks in when flags are included that bloat up the data
132     * returned.
133     */
134    ParceledListSlice getInstalledApplications(int flags, in String lastRead);
135
136    /**
137     * Retrieve all applications that are marked as persistent.
138     *
139     * @return A List&lt;applicationInfo> containing one entry for each persistent
140     *         application.
141     */
142    List<ApplicationInfo> getPersistentApplications(int flags);
143
144    ProviderInfo resolveContentProvider(String name, int flags);
145
146    /**
147     * Retrieve sync information for all content providers.
148     *
149     * @param outNames Filled in with a list of the root names of the content
150     *                 providers that can sync.
151     * @param outInfo Filled in with a list of the ProviderInfo for each
152     *                name in 'outNames'.
153     */
154    void querySyncProviders(inout List<String> outNames,
155            inout List<ProviderInfo> outInfo);
156
157    List<ProviderInfo> queryContentProviders(
158            String processName, int uid, int flags);
159
160    InstrumentationInfo getInstrumentationInfo(
161            in ComponentName className, int flags);
162
163    List<InstrumentationInfo> queryInstrumentation(
164            String targetPackage, int flags);
165
166    /**
167     * Install a package.
168     *
169     * @param packageURI The location of the package file to install.
170     * @param observer a callback to use to notify when the package installation in finished.
171     * @param flags - possible values: {@link #FORWARD_LOCK_PACKAGE},
172     * {@link #REPLACE_EXISITING_PACKAGE}
173     * @param installerPackageName Optional package name of the application that is performing the
174     * installation. This identifies which market the package came from.
175     */
176    void installPackage(in Uri packageURI, IPackageInstallObserver observer, int flags,
177            in String installerPackageName);
178
179    void finishPackageInstall(int token);
180
181    void setInstallerPackageName(in String targetPackage, in String installerPackageName);
182
183    /**
184     * Delete a package.
185     *
186     * @param packageName The fully qualified name of the package to delete.
187     * @param observer a callback to use to notify when the package deletion in finished.
188     * @param flags - possible values: {@link #DONT_DELETE_DATA}
189     */
190    void deletePackage(in String packageName, IPackageDeleteObserver observer, int flags);
191
192    String getInstallerPackageName(in String packageName);
193
194    void addPackageToPreferred(String packageName);
195
196    void removePackageFromPreferred(String packageName);
197
198    List<PackageInfo> getPreferredPackages(int flags);
199
200    void addPreferredActivity(in IntentFilter filter, int match,
201            in ComponentName[] set, in ComponentName activity);
202
203    void replacePreferredActivity(in IntentFilter filter, int match,
204            in ComponentName[] set, in ComponentName activity);
205
206    void clearPackagePreferredActivities(String packageName);
207
208    int getPreferredActivities(out List<IntentFilter> outFilters,
209            out List<ComponentName> outActivities, String packageName);
210
211    /**
212     * As per {@link android.content.pm.PackageManager#setComponentEnabledSetting}.
213     */
214    void setComponentEnabledSetting(in ComponentName componentName,
215            in int newState, in int flags);
216
217    /**
218     * As per {@link android.content.pm.PackageManager#getComponentEnabledSetting}.
219     */
220    int getComponentEnabledSetting(in ComponentName componentName);
221
222    /**
223     * As per {@link android.content.pm.PackageManager#setApplicationEnabledSetting}.
224     */
225    void setApplicationEnabledSetting(in String packageName, in int newState, int flags);
226
227    /**
228     * As per {@link android.content.pm.PackageManager#getApplicationEnabledSetting}.
229     */
230    int getApplicationEnabledSetting(in String packageName);
231
232    /**
233     * Set whether the given package should be considered stopped, making
234     * it not visible to implicit intents that filter out stopped packages.
235     */
236    void setPackageStoppedState(String packageName, boolean stopped);
237
238    /**
239     * Free storage by deleting LRU sorted list of cache files across
240     * all applications. If the currently available free storage
241     * on the device is greater than or equal to the requested
242     * free storage, no cache files are cleared. If the currently
243     * available storage on the device is less than the requested
244     * free storage, some or all of the cache files across
245     * all applications are deleted (based on last accessed time)
246     * to increase the free storage space on the device to
247     * the requested value. There is no guarantee that clearing all
248     * the cache files from all applications will clear up
249     * enough storage to achieve the desired value.
250     * @param freeStorageSize The number of bytes of storage to be
251     * freed by the system. Say if freeStorageSize is XX,
252     * and the current free storage is YY,
253     * if XX is less than YY, just return. if not free XX-YY number
254     * of bytes if possible.
255     * @param observer call back used to notify when
256     * the operation is completed
257     */
258     void freeStorageAndNotify(in long freeStorageSize,
259             IPackageDataObserver observer);
260
261    /**
262     * Free storage by deleting LRU sorted list of cache files across
263     * all applications. If the currently available free storage
264     * on the device is greater than or equal to the requested
265     * free storage, no cache files are cleared. If the currently
266     * available storage on the device is less than the requested
267     * free storage, some or all of the cache files across
268     * all applications are deleted (based on last accessed time)
269     * to increase the free storage space on the device to
270     * the requested value. There is no guarantee that clearing all
271     * the cache files from all applications will clear up
272     * enough storage to achieve the desired value.
273     * @param freeStorageSize The number of bytes of storage to be
274     * freed by the system. Say if freeStorageSize is XX,
275     * and the current free storage is YY,
276     * if XX is less than YY, just return. if not free XX-YY number
277     * of bytes if possible.
278     * @param pi IntentSender call back used to
279     * notify when the operation is completed.May be null
280     * to indicate that no call back is desired.
281     */
282     void freeStorage(in long freeStorageSize,
283             in IntentSender pi);
284
285    /**
286     * Delete all the cache files in an applications cache directory
287     * @param packageName The package name of the application whose cache
288     * files need to be deleted
289     * @param observer a callback used to notify when the deletion is finished.
290     */
291    void deleteApplicationCacheFiles(in String packageName, IPackageDataObserver observer);
292
293    /**
294     * Clear the user data directory of an application.
295     * @param packageName The package name of the application whose cache
296     * files need to be deleted
297     * @param observer a callback used to notify when the operation is completed.
298     */
299    void clearApplicationUserData(in String packageName, IPackageDataObserver observer);
300
301   /**
302     * Get package statistics including the code, data and cache size for
303     * an already installed package
304     * @param packageName The package name of the application
305     * @param observer a callback to use to notify when the asynchronous
306     * retrieval of information is complete.
307     */
308    void getPackageSizeInfo(in String packageName, IPackageStatsObserver observer);
309
310    /**
311     * Get a list of shared libraries that are available on the
312     * system.
313     */
314    String[] getSystemSharedLibraryNames();
315
316    /**
317     * Get a list of features that are available on the
318     * system.
319     */
320    FeatureInfo[] getSystemAvailableFeatures();
321
322    boolean hasSystemFeature(String name);
323
324    void enterSafeMode();
325    boolean isSafeMode();
326    void systemReady();
327    boolean hasSystemUidErrors();
328
329    /**
330     * Ask the package manager to perform boot-time dex-opt of all
331     * existing packages.
332     */
333    void performBootDexOpt();
334
335    /**
336     * Ask the package manager to perform dex-opt (if needed) on the given
337     * package, if it already hasn't done mode.  Only does this if running
338     * in the special development "no pre-dexopt" mode.
339     */
340    boolean performDexOpt(String packageName);
341
342    /**
343     * Update status of external media on the package manager to scan and
344     * install packages installed on the external media. Like say the
345     * MountService uses this to call into the package manager to update
346     * status of sdcard.
347     */
348    void updateExternalMediaStatus(boolean mounted, boolean reportStatus);
349
350    String nextPackageToClean(String lastPackage);
351
352    void movePackage(String packageName, IPackageMoveObserver observer, int flags);
353
354    boolean addPermissionAsync(in PermissionInfo info);
355
356    boolean setInstallLocation(int loc);
357    int getInstallLocation();
358
359    UserInfo createUser(in String name, int flags);
360    boolean removeUser(int userId);
361
362    void installPackageWithVerification(in Uri packageURI, in IPackageInstallObserver observer,
363            int flags, in String installerPackageName, in Uri verificationURI,
364            in ManifestDigest manifestDigest);
365
366    void verifyPendingInstall(int id, int verificationCode);
367
368    VerifierDeviceIdentity getVerifierDeviceIdentity();
369
370    boolean isFirstBoot();
371
372    List<UserInfo> getUsers();
373
374    void setPermissionEnforcement(String permission, int enforcement);
375    int getPermissionEnforcement(String permission);
376}
377