The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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 | |
| 18 | package android.content.pm; |
| 19 | |
| 20 | import android.content.ComponentName; |
| 21 | import android.content.Intent; |
| 22 | import android.content.IntentFilter; |
| 23 | import android.content.pm.ActivityInfo; |
| 24 | import android.content.pm.ApplicationInfo; |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 25 | import android.content.pm.FeatureInfo; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 26 | import android.content.pm.IPackageInstallObserver; |
| 27 | import android.content.pm.IPackageDeleteObserver; |
| 28 | import android.content.pm.IPackageDataObserver; |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 29 | import android.content.pm.IPackageMoveObserver; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 30 | import android.content.pm.IPackageStatsObserver; |
| 31 | import android.content.pm.InstrumentationInfo; |
| 32 | import android.content.pm.PackageInfo; |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 33 | import android.content.pm.ManifestDigest; |
Kenny Root | 0e2c0f3 | 2011-04-15 17:50:10 -0700 | [diff] [blame] | 34 | import android.content.pm.ParceledListSlice; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 35 | import android.content.pm.ProviderInfo; |
| 36 | import android.content.pm.PermissionGroupInfo; |
| 37 | import android.content.pm.PermissionInfo; |
| 38 | import android.content.pm.ResolveInfo; |
| 39 | import android.content.pm.ServiceInfo; |
Amith Yamasani | 0b28549 | 2011-04-14 17:35:23 -0700 | [diff] [blame] | 40 | import android.content.pm.UserInfo; |
Kenny Root | 0aaa0d9 | 2011-09-12 16:42:55 -0700 | [diff] [blame] | 41 | import android.content.pm.VerifierDeviceIdentity; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 42 | import android.net.Uri; |
Suchi Amalapurapu | 1ccac75 | 2009-06-12 10:09:58 -0700 | [diff] [blame] | 43 | import android.content.IntentSender; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 44 | |
| 45 | /** |
| 46 | * See {@link PackageManager} for documentation on most of the APIs |
| 47 | * here. |
| 48 | * |
| 49 | * {@hide} |
| 50 | */ |
| 51 | interface IPackageManager { |
| 52 | PackageInfo getPackageInfo(String packageName, int flags); |
| 53 | int getPackageUid(String packageName); |
| 54 | int[] getPackageGids(String packageName); |
Dianne Hackborn | 4709693 | 2010-02-11 15:57:09 -0800 | [diff] [blame] | 55 | |
| 56 | String[] currentToCanonicalPackageNames(in String[] names); |
| 57 | String[] canonicalToCurrentPackageNames(in String[] names); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 58 | |
| 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 Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 75 | ProviderInfo getProviderInfo(in ComponentName className, int flags); |
| 76 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 77 | 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 Hackborn | e639da7 | 2012-02-21 15:11:13 -0800 | [diff] [blame^] | 84 | |
| 85 | void grantPermission(String packageName, String permissionName); |
| 86 | |
| 87 | void revokePermission(String packageName, String permissionName); |
| 88 | |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 89 | boolean isProtectedBroadcast(String actionName); |
| 90 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 91 | int checkSignatures(String pkg1, String pkg2); |
| 92 | |
Dianne Hackborn | 766cbfe | 2009-08-12 18:33:39 -0700 | [diff] [blame] | 93 | int checkUidSignatures(int uid1, int uid2); |
| 94 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 95 | 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 Root | 0e2c0f3 | 2011-04-15 17:50:10 -0700 | [diff] [blame] | 120 | /** |
| 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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 127 | |
Kenny Root | 0e2c0f3 | 2011-04-15 17:50:10 -0700 | [diff] [blame] | 128 | /** |
| 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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 135 | |
| 136 | /** |
| 137 | * Retrieve all applications that are marked as persistent. |
| 138 | * |
| 139 | * @return A List<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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 153 | */ |
| 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 Surazski | 65e1317 | 2009-04-28 15:26:38 +0200 | [diff] [blame] | 173 | * @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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 175 | */ |
Jacek Surazski | 65e1317 | 2009-04-28 15:26:38 +0200 | [diff] [blame] | 176 | void installPackage(in Uri packageURI, IPackageInstallObserver observer, int flags, |
| 177 | in String installerPackageName); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 178 | |
Christopher Tate | 1bb6906 | 2010-02-19 17:02:12 -0800 | [diff] [blame] | 179 | void finishPackageInstall(int token); |
| 180 | |
Dianne Hackborn | 880119b | 2010-11-18 22:26:40 -0800 | [diff] [blame] | 181 | void setInstallerPackageName(in String targetPackage, in String installerPackageName); |
| 182 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 183 | /** |
| 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 Surazski | 65e1317 | 2009-04-28 15:26:38 +0200 | [diff] [blame] | 192 | String getInstallerPackageName(in String packageName); |
| 193 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 194 | 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 Sampath | 8dbe612 | 2009-06-02 23:35:54 +0100 | [diff] [blame] | 202 | |
| 203 | void replacePreferredActivity(in IntentFilter filter, int match, |
| 204 | in ComponentName[] set, in ComponentName activity); |
| 205 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 206 | void clearPackagePreferredActivities(String packageName); |
Satish Sampath | 8dbe612 | 2009-06-02 23:35:54 +0100 | [diff] [blame] | 207 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 208 | 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 Hackborn | e7f9721 | 2011-02-24 14:40:20 -0800 | [diff] [blame] | 233 | * 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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 239 | * 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 Amalapurapu | 1ccac75 | 2009-06-12 10:09:58 -0700 | [diff] [blame] | 278 | * @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 Amalapurapu | bc806f6 | 2009-06-17 15:18:19 -0700 | [diff] [blame] | 282 | void freeStorage(in long freeStorageSize, |
Suchi Amalapurapu | 1ccac75 | 2009-06-12 10:09:58 -0700 | [diff] [blame] | 283 | in IntentSender pi); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 284 | |
| 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 Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 316 | /** |
| 317 | * Get a list of features that are available on the |
| 318 | * system. |
| 319 | */ |
| 320 | FeatureInfo[] getSystemAvailableFeatures(); |
| 321 | |
Dianne Hackborn | 039c68e | 2009-09-26 16:39:23 -0700 | [diff] [blame] | 322 | boolean hasSystemFeature(String name); |
| 323 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 324 | void enterSafeMode(); |
| 325 | boolean isSafeMode(); |
| 326 | void systemReady(); |
| 327 | boolean hasSystemUidErrors(); |
Dianne Hackborn | 661cd52 | 2011-08-22 00:26:20 -0700 | [diff] [blame] | 328 | |
| 329 | /** |
| 330 | * Ask the package manager to perform boot-time dex-opt of all |
| 331 | * existing packages. |
| 332 | */ |
| 333 | void performBootDexOpt(); |
| 334 | |
Dianne Hackborn | 5c1e00b | 2009-06-18 17:10:57 -0700 | [diff] [blame] | 335 | /** |
| 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 Amalapurapu | af8e9f4 | 2010-01-12 10:17:28 -0800 | [diff] [blame] | 341 | |
| 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 Amalapurapu | e99bb5f | 2010-03-19 14:36:49 -0700 | [diff] [blame] | 348 | void updateExternalMediaStatus(boolean mounted, boolean reportStatus); |
Suchi Amalapurapu | af8e9f4 | 2010-01-12 10:17:28 -0800 | [diff] [blame] | 349 | |
Dianne Hackborn | e83cefce | 2010-02-04 17:38:14 -0800 | [diff] [blame] | 350 | String nextPackageToClean(String lastPackage); |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 351 | |
| 352 | void movePackage(String packageName, IPackageMoveObserver observer, int flags); |
Dianne Hackborn | d7c0968 | 2010-03-30 10:42:20 -0700 | [diff] [blame] | 353 | |
| 354 | boolean addPermissionAsync(in PermissionInfo info); |
Suchi Amalapurapu | 40e4725 | 2010-04-07 16:15:50 -0700 | [diff] [blame] | 355 | |
| 356 | boolean setInstallLocation(int loc); |
| 357 | int getInstallLocation(); |
Amith Yamasani | 0b28549 | 2011-04-14 17:35:23 -0700 | [diff] [blame] | 358 | |
| 359 | UserInfo createUser(in String name, int flags); |
| 360 | boolean removeUser(int userId); |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 361 | |
| 362 | void installPackageWithVerification(in Uri packageURI, in IPackageInstallObserver observer, |
| 363 | int flags, in String installerPackageName, in Uri verificationURI, |
| 364 | in ManifestDigest manifestDigest); |
| 365 | |
Kenny Root | 3a9b5fb | 2011-09-20 14:15:38 -0700 | [diff] [blame] | 366 | void verifyPendingInstall(int id, int verificationCode); |
Kenny Root | 0aaa0d9 | 2011-09-12 16:42:55 -0700 | [diff] [blame] | 367 | |
| 368 | VerifierDeviceIdentity getVerifierDeviceIdentity(); |
Dianne Hackborn | 58f42a5 | 2011-10-10 13:46:34 -0700 | [diff] [blame] | 369 | |
| 370 | boolean isFirstBoot(); |
Amith Yamasani | 742a671 | 2011-05-04 14:49:28 -0700 | [diff] [blame] | 371 | |
| 372 | List<UserInfo> getUsers(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 373 | } |