blob: 95b6feebd93e5a1d0002920570a67d2ab341603b [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
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;
Dianne Hackborn49237342009-08-27 20:08:01 -070025import android.content.pm.FeatureInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080026import android.content.pm.IPackageInstallObserver;
27import android.content.pm.IPackageDeleteObserver;
28import android.content.pm.IPackageDataObserver;
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -080029import android.content.pm.IPackageMoveObserver;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030import android.content.pm.IPackageStatsObserver;
31import android.content.pm.InstrumentationInfo;
32import android.content.pm.PackageInfo;
Kenny Root5ab21572011-07-27 11:11:19 -070033import android.content.pm.ManifestDigest;
Kenny Root0e2c0f32011-04-15 17:50:10 -070034import android.content.pm.ParceledListSlice;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080035import android.content.pm.ProviderInfo;
36import android.content.pm.PermissionGroupInfo;
37import android.content.pm.PermissionInfo;
38import android.content.pm.ResolveInfo;
39import android.content.pm.ServiceInfo;
Amith Yamasani0b285492011-04-14 17:35:23 -070040import android.content.pm.UserInfo;
Kenny Root0aaa0d92011-09-12 16:42:55 -070041import android.content.pm.VerifierDeviceIdentity;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042import android.net.Uri;
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -070043import android.content.IntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044
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);
Dianne Hackborn47096932010-02-11 15:57:09 -080055
56 String[] currentToCanonicalPackageNames(in String[] names);
57 String[] canonicalToCurrentPackageNames(in String[] names);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080058
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
Dianne Hackborn361199b2010-08-30 17:42:07 -070075 ProviderInfo getProviderInfo(in ComponentName className, int flags);
76
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080077 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);
Dianne Hackborne639da72012-02-21 15:11:13 -080084
85 void grantPermission(String packageName, String permissionName);
86
87 void revokePermission(String packageName, String permissionName);
88
Dianne Hackborn854060af2009-07-09 18:14:31 -070089 boolean isProtectedBroadcast(String actionName);
90
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080091 int checkSignatures(String pkg1, String pkg2);
92
Dianne Hackborn766cbfe2009-08-12 18:33:39 -070093 int checkUidSignatures(int uid1, int uid2);
94
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080095 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
Kenny Root0e2c0f32011-04-15 17:50:10 -0700120 /**
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);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800127
Kenny Root0e2c0f32011-04-15 17:50:10 -0700128 /**
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);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800135
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'.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800153 */
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}
Jacek Surazski65e13172009-04-28 15:26:38 +0200173 * @param installerPackageName Optional package name of the application that is performing the
174 * installation. This identifies which market the package came from.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800175 */
Jacek Surazski65e13172009-04-28 15:26:38 +0200176 void installPackage(in Uri packageURI, IPackageInstallObserver observer, int flags,
177 in String installerPackageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800178
Christopher Tate1bb69062010-02-19 17:02:12 -0800179 void finishPackageInstall(int token);
180
Dianne Hackborn880119b2010-11-18 22:26:40 -0800181 void setInstallerPackageName(in String targetPackage, in String installerPackageName);
182
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800183 /**
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
Jacek Surazski65e13172009-04-28 15:26:38 +0200192 String getInstallerPackageName(in String packageName);
193
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800194 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);
Satish Sampath8dbe6122009-06-02 23:35:54 +0100202
203 void replacePreferredActivity(in IntentFilter filter, int match,
204 in ComponentName[] set, in ComponentName activity);
205
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800206 void clearPackagePreferredActivities(String packageName);
Satish Sampath8dbe6122009-06-02 23:35:54 +0100207
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800208 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 /**
Dianne Hackborne7f97212011-02-24 14:40:20 -0800233 * 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 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800239 * 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.
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -0700278 * @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 */
Suchi Amalapurapubc806f62009-06-17 15:18:19 -0700282 void freeStorage(in long freeStorageSize,
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -0700283 in IntentSender pi);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800284
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
Dianne Hackborn49237342009-08-27 20:08:01 -0700316 /**
317 * Get a list of features that are available on the
318 * system.
319 */
320 FeatureInfo[] getSystemAvailableFeatures();
321
Dianne Hackborn039c68e2009-09-26 16:39:23 -0700322 boolean hasSystemFeature(String name);
323
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800324 void enterSafeMode();
325 boolean isSafeMode();
326 void systemReady();
327 boolean hasSystemUidErrors();
Dianne Hackborn661cd522011-08-22 00:26:20 -0700328
329 /**
330 * Ask the package manager to perform boot-time dex-opt of all
331 * existing packages.
332 */
333 void performBootDexOpt();
334
Dianne Hackborn5c1e00b2009-06-18 17:10:57 -0700335 /**
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);
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800341
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 */
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -0700348 void updateExternalMediaStatus(boolean mounted, boolean reportStatus);
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800349
Dianne Hackborne83cefce2010-02-04 17:38:14 -0800350 String nextPackageToClean(String lastPackage);
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800351
352 void movePackage(String packageName, IPackageMoveObserver observer, int flags);
Dianne Hackbornd7c09682010-03-30 10:42:20 -0700353
354 boolean addPermissionAsync(in PermissionInfo info);
Suchi Amalapurapu40e47252010-04-07 16:15:50 -0700355
356 boolean setInstallLocation(int loc);
357 int getInstallLocation();
Amith Yamasani0b285492011-04-14 17:35:23 -0700358
359 UserInfo createUser(in String name, int flags);
360 boolean removeUser(int userId);
Kenny Root5ab21572011-07-27 11:11:19 -0700361
362 void installPackageWithVerification(in Uri packageURI, in IPackageInstallObserver observer,
363 int flags, in String installerPackageName, in Uri verificationURI,
364 in ManifestDigest manifestDigest);
365
Kenny Root3a9b5fb2011-09-20 14:15:38 -0700366 void verifyPendingInstall(int id, int verificationCode);
Kenny Root0aaa0d92011-09-12 16:42:55 -0700367
368 VerifierDeviceIdentity getVerifierDeviceIdentity();
Dianne Hackborn58f42a52011-10-10 13:46:34 -0700369
370 boolean isFirstBoot();
Amith Yamasani742a6712011-05-04 14:49:28 -0700371
372 List<UserInfo> getUsers();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800373}