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; |
| 25 | import android.content.pm.IPackageInstallObserver; |
| 26 | import android.content.pm.IPackageDeleteObserver; |
| 27 | import android.content.pm.IPackageDataObserver; |
| 28 | import android.content.pm.IPackageStatsObserver; |
| 29 | import android.content.pm.InstrumentationInfo; |
| 30 | import android.content.pm.PackageInfo; |
| 31 | import android.content.pm.ProviderInfo; |
| 32 | import android.content.pm.PermissionGroupInfo; |
| 33 | import android.content.pm.PermissionInfo; |
| 34 | import android.content.pm.ResolveInfo; |
| 35 | import android.content.pm.ServiceInfo; |
| 36 | import android.net.Uri; |
| 37 | import android.app.PendingIntent; |
| 38 | |
| 39 | /** |
| 40 | * See {@link PackageManager} for documentation on most of the APIs |
| 41 | * here. |
| 42 | * |
| 43 | * {@hide} |
| 44 | */ |
| 45 | interface IPackageManager { |
| 46 | PackageInfo getPackageInfo(String packageName, int flags); |
| 47 | int getPackageUid(String packageName); |
| 48 | int[] getPackageGids(String packageName); |
| 49 | |
| 50 | PermissionInfo getPermissionInfo(String name, int flags); |
| 51 | |
| 52 | List<PermissionInfo> queryPermissionsByGroup(String group, int flags); |
| 53 | |
| 54 | PermissionGroupInfo getPermissionGroupInfo(String name, int flags); |
| 55 | |
| 56 | List<PermissionGroupInfo> getAllPermissionGroups(int flags); |
| 57 | |
| 58 | ApplicationInfo getApplicationInfo(String packageName, int flags); |
| 59 | |
| 60 | ActivityInfo getActivityInfo(in ComponentName className, int flags); |
| 61 | |
| 62 | ActivityInfo getReceiverInfo(in ComponentName className, int flags); |
| 63 | |
| 64 | ServiceInfo getServiceInfo(in ComponentName className, int flags); |
| 65 | |
| 66 | int checkPermission(String permName, String pkgName); |
| 67 | |
| 68 | int checkUidPermission(String permName, int uid); |
| 69 | |
| 70 | boolean addPermission(in PermissionInfo info); |
| 71 | |
| 72 | void removePermission(String name); |
| 73 | |
| 74 | int checkSignatures(String pkg1, String pkg2); |
| 75 | |
| 76 | String[] getPackagesForUid(int uid); |
| 77 | |
| 78 | String getNameForUid(int uid); |
| 79 | |
| 80 | int getUidForSharedUser(String sharedUserName); |
| 81 | |
| 82 | ResolveInfo resolveIntent(in Intent intent, String resolvedType, int flags); |
| 83 | |
| 84 | List<ResolveInfo> queryIntentActivities(in Intent intent, |
| 85 | String resolvedType, int flags); |
| 86 | |
| 87 | List<ResolveInfo> queryIntentActivityOptions( |
| 88 | in ComponentName caller, in Intent[] specifics, |
| 89 | in String[] specificTypes, in Intent intent, |
| 90 | String resolvedType, int flags); |
| 91 | |
| 92 | List<ResolveInfo> queryIntentReceivers(in Intent intent, |
| 93 | String resolvedType, int flags); |
| 94 | |
| 95 | ResolveInfo resolveService(in Intent intent, |
| 96 | String resolvedType, int flags); |
| 97 | |
| 98 | List<ResolveInfo> queryIntentServices(in Intent intent, |
| 99 | String resolvedType, int flags); |
| 100 | |
| 101 | List<PackageInfo> getInstalledPackages(int flags); |
| 102 | |
| 103 | List<ApplicationInfo> getInstalledApplications(int flags); |
| 104 | |
| 105 | /** |
| 106 | * Retrieve all applications that are marked as persistent. |
| 107 | * |
| 108 | * @return A List<applicationInfo> containing one entry for each persistent |
| 109 | * application. |
| 110 | */ |
| 111 | List<ApplicationInfo> getPersistentApplications(int flags); |
| 112 | |
| 113 | ProviderInfo resolveContentProvider(String name, int flags); |
| 114 | |
| 115 | /** |
| 116 | * Retrieve sync information for all content providers. |
| 117 | * |
| 118 | * @param outNames Filled in with a list of the root names of the content |
| 119 | * providers that can sync. |
| 120 | * @param outInfo Filled in with a list of the ProviderInfo for each |
| 121 | * name in 'outNames'. |
Fred Quintana | 718d8a2 | 2009-04-29 17:53:20 -0700 | [diff] [blame] | 122 | * @deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 123 | */ |
| 124 | void querySyncProviders(inout List<String> outNames, |
| 125 | inout List<ProviderInfo> outInfo); |
| 126 | |
| 127 | List<ProviderInfo> queryContentProviders( |
| 128 | String processName, int uid, int flags); |
| 129 | |
| 130 | InstrumentationInfo getInstrumentationInfo( |
| 131 | in ComponentName className, int flags); |
| 132 | |
| 133 | List<InstrumentationInfo> queryInstrumentation( |
| 134 | String targetPackage, int flags); |
| 135 | |
| 136 | /** |
| 137 | * Install a package. |
| 138 | * |
| 139 | * @param packageURI The location of the package file to install. |
| 140 | * @param observer a callback to use to notify when the package installation in finished. |
| 141 | * @param flags - possible values: {@link #FORWARD_LOCK_PACKAGE}, |
| 142 | * {@link #REPLACE_EXISITING_PACKAGE} |
| 143 | */ |
| 144 | void installPackage(in Uri packageURI, IPackageInstallObserver observer, int flags); |
| 145 | |
| 146 | /** |
| 147 | * Delete a package. |
| 148 | * |
| 149 | * @param packageName The fully qualified name of the package to delete. |
| 150 | * @param observer a callback to use to notify when the package deletion in finished. |
| 151 | * @param flags - possible values: {@link #DONT_DELETE_DATA} |
| 152 | */ |
| 153 | void deletePackage(in String packageName, IPackageDeleteObserver observer, int flags); |
| 154 | |
| 155 | void addPackageToPreferred(String packageName); |
| 156 | |
| 157 | void removePackageFromPreferred(String packageName); |
| 158 | |
| 159 | List<PackageInfo> getPreferredPackages(int flags); |
| 160 | |
| 161 | void addPreferredActivity(in IntentFilter filter, int match, |
| 162 | in ComponentName[] set, in ComponentName activity); |
| 163 | void clearPackagePreferredActivities(String packageName); |
| 164 | int getPreferredActivities(out List<IntentFilter> outFilters, |
| 165 | out List<ComponentName> outActivities, String packageName); |
| 166 | |
| 167 | /** |
| 168 | * As per {@link android.content.pm.PackageManager#setComponentEnabledSetting}. |
| 169 | */ |
| 170 | void setComponentEnabledSetting(in ComponentName componentName, |
| 171 | in int newState, in int flags); |
| 172 | |
| 173 | /** |
| 174 | * As per {@link android.content.pm.PackageManager#getComponentEnabledSetting}. |
| 175 | */ |
| 176 | int getComponentEnabledSetting(in ComponentName componentName); |
| 177 | |
| 178 | /** |
| 179 | * As per {@link android.content.pm.PackageManager#setApplicationEnabledSetting}. |
| 180 | */ |
| 181 | void setApplicationEnabledSetting(in String packageName, in int newState, int flags); |
| 182 | |
| 183 | /** |
| 184 | * As per {@link android.content.pm.PackageManager#getApplicationEnabledSetting}. |
| 185 | */ |
| 186 | int getApplicationEnabledSetting(in String packageName); |
| 187 | |
| 188 | /** |
| 189 | * Free storage by deleting LRU sorted list of cache files across |
| 190 | * all applications. If the currently available free storage |
| 191 | * on the device is greater than or equal to the requested |
| 192 | * free storage, no cache files are cleared. If the currently |
| 193 | * available storage on the device is less than the requested |
| 194 | * free storage, some or all of the cache files across |
| 195 | * all applications are deleted (based on last accessed time) |
| 196 | * to increase the free storage space on the device to |
| 197 | * the requested value. There is no guarantee that clearing all |
| 198 | * the cache files from all applications will clear up |
| 199 | * enough storage to achieve the desired value. |
| 200 | * @param freeStorageSize The number of bytes of storage to be |
| 201 | * freed by the system. Say if freeStorageSize is XX, |
| 202 | * and the current free storage is YY, |
| 203 | * if XX is less than YY, just return. if not free XX-YY number |
| 204 | * of bytes if possible. |
| 205 | * @param observer call back used to notify when |
| 206 | * the operation is completed |
| 207 | */ |
| 208 | void freeStorageAndNotify(in long freeStorageSize, |
| 209 | IPackageDataObserver observer); |
| 210 | |
| 211 | /** |
| 212 | * Free storage by deleting LRU sorted list of cache files across |
| 213 | * all applications. If the currently available free storage |
| 214 | * on the device is greater than or equal to the requested |
| 215 | * free storage, no cache files are cleared. If the currently |
| 216 | * available storage on the device is less than the requested |
| 217 | * free storage, some or all of the cache files across |
| 218 | * all applications are deleted (based on last accessed time) |
| 219 | * to increase the free storage space on the device to |
| 220 | * the requested value. There is no guarantee that clearing all |
| 221 | * the cache files from all applications will clear up |
| 222 | * enough storage to achieve the desired value. |
| 223 | * @param freeStorageSize The number of bytes of storage to be |
| 224 | * freed by the system. Say if freeStorageSize is XX, |
| 225 | * and the current free storage is YY, |
| 226 | * if XX is less than YY, just return. if not free XX-YY number |
| 227 | * of bytes if possible. |
| 228 | * @param opFinishedIntent PendingIntent call back used to |
| 229 | * notify when the operation is completed.May be null |
| 230 | * to indicate that no call back is desired. |
| 231 | */ |
| 232 | void freeStorage(in long freeStorageSize, |
| 233 | in PendingIntent opFinishedIntent); |
| 234 | |
| 235 | /** |
| 236 | * Delete all the cache files in an applications cache directory |
| 237 | * @param packageName The package name of the application whose cache |
| 238 | * files need to be deleted |
| 239 | * @param observer a callback used to notify when the deletion is finished. |
| 240 | */ |
| 241 | void deleteApplicationCacheFiles(in String packageName, IPackageDataObserver observer); |
| 242 | |
| 243 | /** |
| 244 | * Clear the user data directory of an application. |
| 245 | * @param packageName The package name of the application whose cache |
| 246 | * files need to be deleted |
| 247 | * @param observer a callback used to notify when the operation is completed. |
| 248 | */ |
| 249 | void clearApplicationUserData(in String packageName, IPackageDataObserver observer); |
| 250 | |
| 251 | /** |
| 252 | * Get package statistics including the code, data and cache size for |
| 253 | * an already installed package |
| 254 | * @param packageName The package name of the application |
| 255 | * @param observer a callback to use to notify when the asynchronous |
| 256 | * retrieval of information is complete. |
| 257 | */ |
| 258 | void getPackageSizeInfo(in String packageName, IPackageStatsObserver observer); |
| 259 | |
| 260 | /** |
| 261 | * Get a list of shared libraries that are available on the |
| 262 | * system. |
| 263 | */ |
| 264 | String[] getSystemSharedLibraryNames(); |
| 265 | |
| 266 | void enterSafeMode(); |
| 267 | boolean isSafeMode(); |
| 268 | void systemReady(); |
| 269 | boolean hasSystemUidErrors(); |
| 270 | } |