blob: f90ef631cd5210da3ad2740e98d46975965e5363 [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;
38import android.net.Uri;
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -070039import android.content.IntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080040
41/**
42 * See {@link PackageManager} for documentation on most of the APIs
43 * here.
44 *
45 * {@hide}
46 */
47interface IPackageManager {
48 PackageInfo getPackageInfo(String packageName, int flags);
49 int getPackageUid(String packageName);
50 int[] getPackageGids(String packageName);
Dianne Hackborn47096932010-02-11 15:57:09 -080051
52 String[] currentToCanonicalPackageNames(in String[] names);
53 String[] canonicalToCurrentPackageNames(in String[] names);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080054
55 PermissionInfo getPermissionInfo(String name, int flags);
56
57 List<PermissionInfo> queryPermissionsByGroup(String group, int flags);
58
59 PermissionGroupInfo getPermissionGroupInfo(String name, int flags);
60
61 List<PermissionGroupInfo> getAllPermissionGroups(int flags);
62
63 ApplicationInfo getApplicationInfo(String packageName, int flags);
64
65 ActivityInfo getActivityInfo(in ComponentName className, int flags);
66
67 ActivityInfo getReceiverInfo(in ComponentName className, int flags);
68
69 ServiceInfo getServiceInfo(in ComponentName className, int flags);
70
71 int checkPermission(String permName, String pkgName);
72
73 int checkUidPermission(String permName, int uid);
74
75 boolean addPermission(in PermissionInfo info);
76
77 void removePermission(String name);
78
Dianne Hackborn854060af2009-07-09 18:14:31 -070079 boolean isProtectedBroadcast(String actionName);
80
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080081 int checkSignatures(String pkg1, String pkg2);
82
Dianne Hackborn766cbfe2009-08-12 18:33:39 -070083 int checkUidSignatures(int uid1, int uid2);
84
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080085 String[] getPackagesForUid(int uid);
86
87 String getNameForUid(int uid);
88
89 int getUidForSharedUser(String sharedUserName);
90
91 ResolveInfo resolveIntent(in Intent intent, String resolvedType, int flags);
92
93 List<ResolveInfo> queryIntentActivities(in Intent intent,
94 String resolvedType, int flags);
95
96 List<ResolveInfo> queryIntentActivityOptions(
97 in ComponentName caller, in Intent[] specifics,
98 in String[] specificTypes, in Intent intent,
99 String resolvedType, int flags);
100
101 List<ResolveInfo> queryIntentReceivers(in Intent intent,
102 String resolvedType, int flags);
103
104 ResolveInfo resolveService(in Intent intent,
105 String resolvedType, int flags);
106
107 List<ResolveInfo> queryIntentServices(in Intent intent,
108 String resolvedType, int flags);
109
110 List<PackageInfo> getInstalledPackages(int flags);
111
112 List<ApplicationInfo> getInstalledApplications(int flags);
113
114 /**
115 * Retrieve all applications that are marked as persistent.
116 *
117 * @return A List&lt;applicationInfo> containing one entry for each persistent
118 * application.
119 */
120 List<ApplicationInfo> getPersistentApplications(int flags);
121
122 ProviderInfo resolveContentProvider(String name, int flags);
123
124 /**
125 * Retrieve sync information for all content providers.
126 *
127 * @param outNames Filled in with a list of the root names of the content
128 * providers that can sync.
129 * @param outInfo Filled in with a list of the ProviderInfo for each
130 * name in 'outNames'.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800131 */
132 void querySyncProviders(inout List<String> outNames,
133 inout List<ProviderInfo> outInfo);
134
135 List<ProviderInfo> queryContentProviders(
136 String processName, int uid, int flags);
137
138 InstrumentationInfo getInstrumentationInfo(
139 in ComponentName className, int flags);
140
141 List<InstrumentationInfo> queryInstrumentation(
142 String targetPackage, int flags);
143
144 /**
145 * Install a package.
146 *
147 * @param packageURI The location of the package file to install.
148 * @param observer a callback to use to notify when the package installation in finished.
149 * @param flags - possible values: {@link #FORWARD_LOCK_PACKAGE},
150 * {@link #REPLACE_EXISITING_PACKAGE}
Jacek Surazski65e13172009-04-28 15:26:38 +0200151 * @param installerPackageName Optional package name of the application that is performing the
152 * installation. This identifies which market the package came from.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800153 */
Jacek Surazski65e13172009-04-28 15:26:38 +0200154 void installPackage(in Uri packageURI, IPackageInstallObserver observer, int flags,
155 in String installerPackageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800156
Christopher Tate1bb69062010-02-19 17:02:12 -0800157 void finishPackageInstall(int token);
158
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800159 /**
160 * Delete a package.
161 *
162 * @param packageName The fully qualified name of the package to delete.
163 * @param observer a callback to use to notify when the package deletion in finished.
164 * @param flags - possible values: {@link #DONT_DELETE_DATA}
165 */
166 void deletePackage(in String packageName, IPackageDeleteObserver observer, int flags);
167
Jacek Surazski65e13172009-04-28 15:26:38 +0200168 String getInstallerPackageName(in String packageName);
169
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800170 void addPackageToPreferred(String packageName);
171
172 void removePackageFromPreferred(String packageName);
173
174 List<PackageInfo> getPreferredPackages(int flags);
175
176 void addPreferredActivity(in IntentFilter filter, int match,
177 in ComponentName[] set, in ComponentName activity);
Satish Sampath8dbe6122009-06-02 23:35:54 +0100178
179 void replacePreferredActivity(in IntentFilter filter, int match,
180 in ComponentName[] set, in ComponentName activity);
181
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800182 void clearPackagePreferredActivities(String packageName);
Satish Sampath8dbe6122009-06-02 23:35:54 +0100183
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800184 int getPreferredActivities(out List<IntentFilter> outFilters,
185 out List<ComponentName> outActivities, String packageName);
186
187 /**
188 * As per {@link android.content.pm.PackageManager#setComponentEnabledSetting}.
189 */
190 void setComponentEnabledSetting(in ComponentName componentName,
191 in int newState, in int flags);
192
193 /**
194 * As per {@link android.content.pm.PackageManager#getComponentEnabledSetting}.
195 */
196 int getComponentEnabledSetting(in ComponentName componentName);
197
198 /**
199 * As per {@link android.content.pm.PackageManager#setApplicationEnabledSetting}.
200 */
201 void setApplicationEnabledSetting(in String packageName, in int newState, int flags);
202
203 /**
204 * As per {@link android.content.pm.PackageManager#getApplicationEnabledSetting}.
205 */
206 int getApplicationEnabledSetting(in String packageName);
207
208 /**
209 * Free storage by deleting LRU sorted list of cache files across
210 * all applications. If the currently available free storage
211 * on the device is greater than or equal to the requested
212 * free storage, no cache files are cleared. If the currently
213 * available storage on the device is less than the requested
214 * free storage, some or all of the cache files across
215 * all applications are deleted (based on last accessed time)
216 * to increase the free storage space on the device to
217 * the requested value. There is no guarantee that clearing all
218 * the cache files from all applications will clear up
219 * enough storage to achieve the desired value.
220 * @param freeStorageSize The number of bytes of storage to be
221 * freed by the system. Say if freeStorageSize is XX,
222 * and the current free storage is YY,
223 * if XX is less than YY, just return. if not free XX-YY number
224 * of bytes if possible.
225 * @param observer call back used to notify when
226 * the operation is completed
227 */
228 void freeStorageAndNotify(in long freeStorageSize,
229 IPackageDataObserver observer);
230
231 /**
232 * Free storage by deleting LRU sorted list of cache files across
233 * all applications. If the currently available free storage
234 * on the device is greater than or equal to the requested
235 * free storage, no cache files are cleared. If the currently
236 * available storage on the device is less than the requested
237 * free storage, some or all of the cache files across
238 * all applications are deleted (based on last accessed time)
239 * to increase the free storage space on the device to
240 * the requested value. There is no guarantee that clearing all
241 * the cache files from all applications will clear up
242 * enough storage to achieve the desired value.
243 * @param freeStorageSize The number of bytes of storage to be
244 * freed by the system. Say if freeStorageSize is XX,
245 * and the current free storage is YY,
246 * if XX is less than YY, just return. if not free XX-YY number
247 * of bytes if possible.
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -0700248 * @param pi IntentSender call back used to
249 * notify when the operation is completed.May be null
250 * to indicate that no call back is desired.
251 */
Suchi Amalapurapubc806f62009-06-17 15:18:19 -0700252 void freeStorage(in long freeStorageSize,
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -0700253 in IntentSender pi);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800254
255 /**
256 * Delete all the cache files in an applications cache directory
257 * @param packageName The package name of the application whose cache
258 * files need to be deleted
259 * @param observer a callback used to notify when the deletion is finished.
260 */
261 void deleteApplicationCacheFiles(in String packageName, IPackageDataObserver observer);
262
263 /**
264 * Clear the user data directory of an application.
265 * @param packageName The package name of the application whose cache
266 * files need to be deleted
267 * @param observer a callback used to notify when the operation is completed.
268 */
269 void clearApplicationUserData(in String packageName, IPackageDataObserver observer);
270
271 /**
272 * Get package statistics including the code, data and cache size for
273 * an already installed package
274 * @param packageName The package name of the application
275 * @param observer a callback to use to notify when the asynchronous
276 * retrieval of information is complete.
277 */
278 void getPackageSizeInfo(in String packageName, IPackageStatsObserver observer);
279
280 /**
281 * Get a list of shared libraries that are available on the
282 * system.
283 */
284 String[] getSystemSharedLibraryNames();
285
Dianne Hackborn49237342009-08-27 20:08:01 -0700286 /**
287 * Get a list of features that are available on the
288 * system.
289 */
290 FeatureInfo[] getSystemAvailableFeatures();
291
Dianne Hackborn039c68e2009-09-26 16:39:23 -0700292 boolean hasSystemFeature(String name);
293
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800294 void enterSafeMode();
295 boolean isSafeMode();
296 void systemReady();
297 boolean hasSystemUidErrors();
Dianne Hackborn5c1e00b2009-06-18 17:10:57 -0700298
299 /**
300 * Ask the package manager to perform dex-opt (if needed) on the given
301 * package, if it already hasn't done mode. Only does this if running
302 * in the special development "no pre-dexopt" mode.
303 */
304 boolean performDexOpt(String packageName);
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800305
306 /**
307 * Update status of external media on the package manager to scan and
308 * install packages installed on the external media. Like say the
309 * MountService uses this to call into the package manager to update
310 * status of sdcard.
311 */
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -0700312 void updateExternalMediaStatus(boolean mounted, boolean reportStatus);
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800313
Dianne Hackborne83cefce2010-02-04 17:38:14 -0800314 String nextPackageToClean(String lastPackage);
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800315
316 void movePackage(String packageName, IPackageMoveObserver observer, int flags);
Dianne Hackbornd7c09682010-03-30 10:42:20 -0700317
318 boolean addPermissionAsync(in PermissionInfo info);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800319}