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