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