blob: 11cd44667154d979283a6410c91c7becec6796a5 [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;
33import android.content.pm.ProviderInfo;
34import android.content.pm.PermissionGroupInfo;
35import android.content.pm.PermissionInfo;
36import android.content.pm.ResolveInfo;
37import android.content.pm.ServiceInfo;
Amith Yamasani0b285492011-04-14 17:35:23 -070038import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080039import android.net.Uri;
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -070040import android.content.IntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080041
42/**
43 * See {@link PackageManager} for documentation on most of the APIs
44 * here.
45 *
46 * {@hide}
47 */
48interface IPackageManager {
49 PackageInfo getPackageInfo(String packageName, int flags);
50 int getPackageUid(String packageName);
51 int[] getPackageGids(String packageName);
Dianne Hackborn47096932010-02-11 15:57:09 -080052
53 String[] currentToCanonicalPackageNames(in String[] names);
54 String[] canonicalToCurrentPackageNames(in String[] names);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080055
56 PermissionInfo getPermissionInfo(String name, int flags);
57
58 List<PermissionInfo> queryPermissionsByGroup(String group, int flags);
59
60 PermissionGroupInfo getPermissionGroupInfo(String name, int flags);
61
62 List<PermissionGroupInfo> getAllPermissionGroups(int flags);
63
64 ApplicationInfo getApplicationInfo(String packageName, int flags);
65
66 ActivityInfo getActivityInfo(in ComponentName className, int flags);
67
68 ActivityInfo getReceiverInfo(in ComponentName className, int flags);
69
70 ServiceInfo getServiceInfo(in ComponentName className, int flags);
71
Dianne Hackborn361199b2010-08-30 17:42:07 -070072 ProviderInfo getProviderInfo(in ComponentName className, int flags);
73
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080074 int checkPermission(String permName, String pkgName);
75
76 int checkUidPermission(String permName, int uid);
77
78 boolean addPermission(in PermissionInfo info);
79
80 void removePermission(String name);
81
Dianne Hackborn854060af2009-07-09 18:14:31 -070082 boolean isProtectedBroadcast(String actionName);
83
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080084 int checkSignatures(String pkg1, String pkg2);
85
Dianne Hackborn766cbfe2009-08-12 18:33:39 -070086 int checkUidSignatures(int uid1, int uid2);
87
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080088 String[] getPackagesForUid(int uid);
89
90 String getNameForUid(int uid);
91
92 int getUidForSharedUser(String sharedUserName);
93
94 ResolveInfo resolveIntent(in Intent intent, String resolvedType, int flags);
95
96 List<ResolveInfo> queryIntentActivities(in Intent intent,
97 String resolvedType, int flags);
98
99 List<ResolveInfo> queryIntentActivityOptions(
100 in ComponentName caller, in Intent[] specifics,
101 in String[] specificTypes, in Intent intent,
102 String resolvedType, int flags);
103
104 List<ResolveInfo> queryIntentReceivers(in Intent intent,
105 String resolvedType, int flags);
106
107 ResolveInfo resolveService(in Intent intent,
108 String resolvedType, int flags);
109
110 List<ResolveInfo> queryIntentServices(in Intent intent,
111 String resolvedType, int flags);
112
113 List<PackageInfo> getInstalledPackages(int flags);
114
115 List<ApplicationInfo> getInstalledApplications(int flags);
116
117 /**
118 * Retrieve all applications that are marked as persistent.
119 *
120 * @return A List&lt;applicationInfo> containing one entry for each persistent
121 * application.
122 */
123 List<ApplicationInfo> getPersistentApplications(int flags);
124
125 ProviderInfo resolveContentProvider(String name, int flags);
126
127 /**
128 * Retrieve sync information for all content providers.
129 *
130 * @param outNames Filled in with a list of the root names of the content
131 * providers that can sync.
132 * @param outInfo Filled in with a list of the ProviderInfo for each
133 * name in 'outNames'.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800134 */
135 void querySyncProviders(inout List<String> outNames,
136 inout List<ProviderInfo> outInfo);
137
138 List<ProviderInfo> queryContentProviders(
139 String processName, int uid, int flags);
140
141 InstrumentationInfo getInstrumentationInfo(
142 in ComponentName className, int flags);
143
144 List<InstrumentationInfo> queryInstrumentation(
145 String targetPackage, int flags);
146
147 /**
148 * Install a package.
149 *
150 * @param packageURI The location of the package file to install.
151 * @param observer a callback to use to notify when the package installation in finished.
152 * @param flags - possible values: {@link #FORWARD_LOCK_PACKAGE},
153 * {@link #REPLACE_EXISITING_PACKAGE}
Jacek Surazski65e13172009-04-28 15:26:38 +0200154 * @param installerPackageName Optional package name of the application that is performing the
155 * installation. This identifies which market the package came from.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800156 */
Jacek Surazski65e13172009-04-28 15:26:38 +0200157 void installPackage(in Uri packageURI, IPackageInstallObserver observer, int flags,
158 in String installerPackageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800159
Christopher Tate1bb69062010-02-19 17:02:12 -0800160 void finishPackageInstall(int token);
161
Dianne Hackborn880119b2010-11-18 22:26:40 -0800162 void setInstallerPackageName(in String targetPackage, in String installerPackageName);
163
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800164 /**
165 * Delete a package.
166 *
167 * @param packageName The fully qualified name of the package to delete.
168 * @param observer a callback to use to notify when the package deletion in finished.
169 * @param flags - possible values: {@link #DONT_DELETE_DATA}
170 */
171 void deletePackage(in String packageName, IPackageDeleteObserver observer, int flags);
172
Jacek Surazski65e13172009-04-28 15:26:38 +0200173 String getInstallerPackageName(in String packageName);
174
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800175 void addPackageToPreferred(String packageName);
176
177 void removePackageFromPreferred(String packageName);
178
179 List<PackageInfo> getPreferredPackages(int flags);
180
181 void addPreferredActivity(in IntentFilter filter, int match,
182 in ComponentName[] set, in ComponentName activity);
Satish Sampath8dbe6122009-06-02 23:35:54 +0100183
184 void replacePreferredActivity(in IntentFilter filter, int match,
185 in ComponentName[] set, in ComponentName activity);
186
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800187 void clearPackagePreferredActivities(String packageName);
Satish Sampath8dbe6122009-06-02 23:35:54 +0100188
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800189 int getPreferredActivities(out List<IntentFilter> outFilters,
190 out List<ComponentName> outActivities, String packageName);
191
192 /**
193 * As per {@link android.content.pm.PackageManager#setComponentEnabledSetting}.
194 */
195 void setComponentEnabledSetting(in ComponentName componentName,
196 in int newState, in int flags);
197
198 /**
199 * As per {@link android.content.pm.PackageManager#getComponentEnabledSetting}.
200 */
201 int getComponentEnabledSetting(in ComponentName componentName);
202
203 /**
204 * As per {@link android.content.pm.PackageManager#setApplicationEnabledSetting}.
205 */
206 void setApplicationEnabledSetting(in String packageName, in int newState, int flags);
207
208 /**
209 * As per {@link android.content.pm.PackageManager#getApplicationEnabledSetting}.
210 */
211 int getApplicationEnabledSetting(in String packageName);
212
213 /**
Dianne Hackborne7f97212011-02-24 14:40:20 -0800214 * Set whether the given package should be considered stopped, making
215 * it not visible to implicit intents that filter out stopped packages.
216 */
217 void setPackageStoppedState(String packageName, boolean stopped);
218
219 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800220 * Free storage by deleting LRU sorted list of cache files across
221 * all applications. If the currently available free storage
222 * on the device is greater than or equal to the requested
223 * free storage, no cache files are cleared. If the currently
224 * available storage on the device is less than the requested
225 * free storage, some or all of the cache files across
226 * all applications are deleted (based on last accessed time)
227 * to increase the free storage space on the device to
228 * the requested value. There is no guarantee that clearing all
229 * the cache files from all applications will clear up
230 * enough storage to achieve the desired value.
231 * @param freeStorageSize The number of bytes of storage to be
232 * freed by the system. Say if freeStorageSize is XX,
233 * and the current free storage is YY,
234 * if XX is less than YY, just return. if not free XX-YY number
235 * of bytes if possible.
236 * @param observer call back used to notify when
237 * the operation is completed
238 */
239 void freeStorageAndNotify(in long freeStorageSize,
240 IPackageDataObserver observer);
241
242 /**
243 * Free storage by deleting LRU sorted list of cache files across
244 * all applications. If the currently available free storage
245 * on the device is greater than or equal to the requested
246 * free storage, no cache files are cleared. If the currently
247 * available storage on the device is less than the requested
248 * free storage, some or all of the cache files across
249 * all applications are deleted (based on last accessed time)
250 * to increase the free storage space on the device to
251 * the requested value. There is no guarantee that clearing all
252 * the cache files from all applications will clear up
253 * enough storage to achieve the desired value.
254 * @param freeStorageSize The number of bytes of storage to be
255 * freed by the system. Say if freeStorageSize is XX,
256 * and the current free storage is YY,
257 * if XX is less than YY, just return. if not free XX-YY number
258 * of bytes if possible.
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -0700259 * @param pi IntentSender call back used to
260 * notify when the operation is completed.May be null
261 * to indicate that no call back is desired.
262 */
Suchi Amalapurapubc806f62009-06-17 15:18:19 -0700263 void freeStorage(in long freeStorageSize,
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -0700264 in IntentSender pi);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800265
266 /**
267 * Delete all the cache files in an applications cache directory
268 * @param packageName The package name of the application whose cache
269 * files need to be deleted
270 * @param observer a callback used to notify when the deletion is finished.
271 */
272 void deleteApplicationCacheFiles(in String packageName, IPackageDataObserver observer);
273
274 /**
275 * Clear the user data directory of an application.
276 * @param packageName The package name of the application whose cache
277 * files need to be deleted
278 * @param observer a callback used to notify when the operation is completed.
279 */
280 void clearApplicationUserData(in String packageName, IPackageDataObserver observer);
281
282 /**
283 * Get package statistics including the code, data and cache size for
284 * an already installed package
285 * @param packageName The package name of the application
286 * @param observer a callback to use to notify when the asynchronous
287 * retrieval of information is complete.
288 */
289 void getPackageSizeInfo(in String packageName, IPackageStatsObserver observer);
290
291 /**
292 * Get a list of shared libraries that are available on the
293 * system.
294 */
295 String[] getSystemSharedLibraryNames();
296
Dianne Hackborn49237342009-08-27 20:08:01 -0700297 /**
298 * Get a list of features that are available on the
299 * system.
300 */
301 FeatureInfo[] getSystemAvailableFeatures();
302
Dianne Hackborn039c68e2009-09-26 16:39:23 -0700303 boolean hasSystemFeature(String name);
304
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800305 void enterSafeMode();
306 boolean isSafeMode();
307 void systemReady();
308 boolean hasSystemUidErrors();
Dianne Hackborn5c1e00b2009-06-18 17:10:57 -0700309
310 /**
311 * Ask the package manager to perform dex-opt (if needed) on the given
312 * package, if it already hasn't done mode. Only does this if running
313 * in the special development "no pre-dexopt" mode.
314 */
315 boolean performDexOpt(String packageName);
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800316
317 /**
318 * Update status of external media on the package manager to scan and
319 * install packages installed on the external media. Like say the
320 * MountService uses this to call into the package manager to update
321 * status of sdcard.
322 */
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -0700323 void updateExternalMediaStatus(boolean mounted, boolean reportStatus);
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800324
Dianne Hackborne83cefce2010-02-04 17:38:14 -0800325 String nextPackageToClean(String lastPackage);
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800326
327 void movePackage(String packageName, IPackageMoveObserver observer, int flags);
Dianne Hackbornd7c09682010-03-30 10:42:20 -0700328
329 boolean addPermissionAsync(in PermissionInfo info);
Suchi Amalapurapu40e47252010-04-07 16:15:50 -0700330
331 boolean setInstallLocation(int loc);
332 int getInstallLocation();
Amith Yamasani0b285492011-04-14 17:35:23 -0700333
334 UserInfo createUser(in String name, int flags);
335 boolean removeUser(int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800336}