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; |
| 33 | import android.content.pm.ProviderInfo; |
| 34 | import android.content.pm.PermissionGroupInfo; |
| 35 | import android.content.pm.PermissionInfo; |
| 36 | import android.content.pm.ResolveInfo; |
| 37 | import android.content.pm.ServiceInfo; |
| 38 | import android.net.Uri; |
Suchi Amalapurapu | 1ccac75 | 2009-06-12 10:09:58 -0700 | [diff] [blame] | 39 | import android.content.IntentSender; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 40 | |
| 41 | /** |
| 42 | * See {@link PackageManager} for documentation on most of the APIs |
| 43 | * here. |
| 44 | * |
| 45 | * {@hide} |
| 46 | */ |
| 47 | interface IPackageManager { |
| 48 | PackageInfo getPackageInfo(String packageName, int flags); |
| 49 | int getPackageUid(String packageName); |
| 50 | int[] getPackageGids(String packageName); |
Dianne Hackborn | 4709693 | 2010-02-11 15:57:09 -0800 | [diff] [blame] | 51 | |
| 52 | String[] currentToCanonicalPackageNames(in String[] names); |
| 53 | String[] canonicalToCurrentPackageNames(in String[] names); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 54 | |
| 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 Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 79 | boolean isProtectedBroadcast(String actionName); |
| 80 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 81 | int checkSignatures(String pkg1, String pkg2); |
| 82 | |
Dianne Hackborn | 766cbfe | 2009-08-12 18:33:39 -0700 | [diff] [blame] | 83 | int checkUidSignatures(int uid1, int uid2); |
| 84 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 85 | 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<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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 131 | */ |
| 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 Surazski | 65e1317 | 2009-04-28 15:26:38 +0200 | [diff] [blame] | 151 | * @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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 153 | */ |
Jacek Surazski | 65e1317 | 2009-04-28 15:26:38 +0200 | [diff] [blame] | 154 | void installPackage(in Uri packageURI, IPackageInstallObserver observer, int flags, |
| 155 | in String installerPackageName); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 156 | |
Christopher Tate | 1bb6906 | 2010-02-19 17:02:12 -0800 | [diff] [blame] | 157 | void finishPackageInstall(int token); |
| 158 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 159 | /** |
| 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 Surazski | 65e1317 | 2009-04-28 15:26:38 +0200 | [diff] [blame] | 168 | String getInstallerPackageName(in String packageName); |
| 169 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 170 | 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 Sampath | 8dbe612 | 2009-06-02 23:35:54 +0100 | [diff] [blame] | 178 | |
| 179 | void replacePreferredActivity(in IntentFilter filter, int match, |
| 180 | in ComponentName[] set, in ComponentName activity); |
| 181 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 182 | void clearPackagePreferredActivities(String packageName); |
Satish Sampath | 8dbe612 | 2009-06-02 23:35:54 +0100 | [diff] [blame] | 183 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 184 | 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 Amalapurapu | 1ccac75 | 2009-06-12 10:09:58 -0700 | [diff] [blame] | 248 | * @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 Amalapurapu | bc806f6 | 2009-06-17 15:18:19 -0700 | [diff] [blame] | 252 | void freeStorage(in long freeStorageSize, |
Suchi Amalapurapu | 1ccac75 | 2009-06-12 10:09:58 -0700 | [diff] [blame] | 253 | in IntentSender pi); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 254 | |
| 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 Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 286 | /** |
| 287 | * Get a list of features that are available on the |
| 288 | * system. |
| 289 | */ |
| 290 | FeatureInfo[] getSystemAvailableFeatures(); |
| 291 | |
Dianne Hackborn | 039c68e | 2009-09-26 16:39:23 -0700 | [diff] [blame] | 292 | boolean hasSystemFeature(String name); |
| 293 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 294 | void enterSafeMode(); |
| 295 | boolean isSafeMode(); |
| 296 | void systemReady(); |
| 297 | boolean hasSystemUidErrors(); |
Dianne Hackborn | 5c1e00b | 2009-06-18 17:10:57 -0700 | [diff] [blame] | 298 | |
| 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 Amalapurapu | af8e9f4 | 2010-01-12 10:17:28 -0800 | [diff] [blame] | 305 | |
| 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 Amalapurapu | e99bb5f | 2010-03-19 14:36:49 -0700 | [diff] [blame^] | 312 | void updateExternalMediaStatus(boolean mounted, boolean reportStatus); |
Suchi Amalapurapu | af8e9f4 | 2010-01-12 10:17:28 -0800 | [diff] [blame] | 313 | |
Dianne Hackborn | e83cefce | 2010-02-04 17:38:14 -0800 | [diff] [blame] | 314 | String nextPackageToClean(String lastPackage); |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 315 | |
| 316 | void movePackage(String packageName, IPackageMoveObserver observer, int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 317 | } |