The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2006 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.content.pm; |
| 18 | |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 19 | import android.annotation.SdkConstant; |
| 20 | import android.annotation.SdkConstant.SdkConstantType; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 21 | import android.content.ComponentName; |
| 22 | import android.content.Context; |
| 23 | import android.content.Intent; |
| 24 | import android.content.IntentFilter; |
Suchi Amalapurapu | 1ccac75 | 2009-06-12 10:09:58 -0700 | [diff] [blame] | 25 | import android.content.IntentSender; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 26 | import android.content.res.Resources; |
| 27 | import android.content.res.XmlResourceParser; |
| 28 | import android.graphics.drawable.Drawable; |
| 29 | import android.net.Uri; |
| 30 | import android.util.AndroidException; |
| 31 | import android.util.DisplayMetrics; |
| 32 | |
| 33 | import java.io.File; |
| 34 | import java.util.List; |
| 35 | |
| 36 | /** |
| 37 | * Class for retrieving various kinds of information related to the application |
| 38 | * packages that are currently installed on the device. |
| 39 | * |
| 40 | * You can find this class through {@link Context#getPackageManager}. |
| 41 | */ |
| 42 | public abstract class PackageManager { |
| 43 | |
| 44 | /** |
| 45 | * This exception is thrown when a given package, application, or component |
| 46 | * name can not be found. |
| 47 | */ |
| 48 | public static class NameNotFoundException extends AndroidException { |
| 49 | public NameNotFoundException() { |
| 50 | } |
| 51 | |
| 52 | public NameNotFoundException(String name) { |
| 53 | super(name); |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * {@link PackageInfo} flag: return information about |
| 59 | * activities in the package in {@link PackageInfo#activities}. |
| 60 | */ |
| 61 | public static final int GET_ACTIVITIES = 0x00000001; |
| 62 | |
| 63 | /** |
| 64 | * {@link PackageInfo} flag: return information about |
| 65 | * intent receivers in the package in |
| 66 | * {@link PackageInfo#receivers}. |
| 67 | */ |
| 68 | public static final int GET_RECEIVERS = 0x00000002; |
| 69 | |
| 70 | /** |
| 71 | * {@link PackageInfo} flag: return information about |
| 72 | * services in the package in {@link PackageInfo#services}. |
| 73 | */ |
| 74 | public static final int GET_SERVICES = 0x00000004; |
| 75 | |
| 76 | /** |
| 77 | * {@link PackageInfo} flag: return information about |
| 78 | * content providers in the package in |
| 79 | * {@link PackageInfo#providers}. |
| 80 | */ |
| 81 | public static final int GET_PROVIDERS = 0x00000008; |
| 82 | |
| 83 | /** |
| 84 | * {@link PackageInfo} flag: return information about |
| 85 | * instrumentation in the package in |
| 86 | * {@link PackageInfo#instrumentation}. |
| 87 | */ |
| 88 | public static final int GET_INSTRUMENTATION = 0x00000010; |
| 89 | |
| 90 | /** |
| 91 | * {@link PackageInfo} flag: return information about the |
| 92 | * intent filters supported by the activity. |
| 93 | */ |
| 94 | public static final int GET_INTENT_FILTERS = 0x00000020; |
| 95 | |
| 96 | /** |
| 97 | * {@link PackageInfo} flag: return information about the |
| 98 | * signatures included in the package. |
| 99 | */ |
| 100 | public static final int GET_SIGNATURES = 0x00000040; |
| 101 | |
| 102 | /** |
| 103 | * {@link ResolveInfo} flag: return the IntentFilter that |
| 104 | * was matched for a particular ResolveInfo in |
| 105 | * {@link ResolveInfo#filter}. |
| 106 | */ |
| 107 | public static final int GET_RESOLVED_FILTER = 0x00000040; |
| 108 | |
| 109 | /** |
| 110 | * {@link ComponentInfo} flag: return the {@link ComponentInfo#metaData} |
| 111 | * data {@link android.os.Bundle}s that are associated with a component. |
| 112 | * This applies for any API returning a ComponentInfo subclass. |
| 113 | */ |
| 114 | public static final int GET_META_DATA = 0x00000080; |
| 115 | |
| 116 | /** |
| 117 | * {@link PackageInfo} flag: return the |
| 118 | * {@link PackageInfo#gids group ids} that are associated with an |
| 119 | * application. |
| 120 | * This applies for any API returning an PackageInfo class, either |
| 121 | * directly or nested inside of another. |
| 122 | */ |
| 123 | public static final int GET_GIDS = 0x00000100; |
| 124 | |
| 125 | /** |
| 126 | * {@link PackageInfo} flag: include disabled components in the returned info. |
| 127 | */ |
| 128 | public static final int GET_DISABLED_COMPONENTS = 0x00000200; |
| 129 | |
| 130 | /** |
| 131 | * {@link ApplicationInfo} flag: return the |
| 132 | * {@link ApplicationInfo#sharedLibraryFiles paths to the shared libraries} |
| 133 | * that are associated with an application. |
| 134 | * This applies for any API returning an ApplicationInfo class, either |
| 135 | * directly or nested inside of another. |
| 136 | */ |
| 137 | public static final int GET_SHARED_LIBRARY_FILES = 0x00000400; |
| 138 | |
| 139 | /** |
| 140 | * {@link ProviderInfo} flag: return the |
| 141 | * {@link ProviderInfo#uriPermissionPatterns URI permission patterns} |
| 142 | * that are associated with a content provider. |
| 143 | * This applies for any API returning an ProviderInfo class, either |
| 144 | * directly or nested inside of another. |
| 145 | */ |
| 146 | public static final int GET_URI_PERMISSION_PATTERNS = 0x00000800; |
| 147 | /** |
| 148 | * {@link PackageInfo} flag: return information about |
| 149 | * permissions in the package in |
| 150 | * {@link PackageInfo#permissions}. |
| 151 | */ |
| 152 | public static final int GET_PERMISSIONS = 0x00001000; |
| 153 | |
| 154 | /** |
| 155 | * Flag parameter to retrieve all applications(even uninstalled ones) with data directories. |
| 156 | * This state could have resulted if applications have been deleted with flag |
| 157 | * DONT_DELETE_DATA |
| 158 | * with a possibility of being replaced or reinstalled in future |
| 159 | */ |
| 160 | public static final int GET_UNINSTALLED_PACKAGES = 0x00002000; |
| 161 | |
| 162 | /** |
| 163 | * {@link PackageInfo} flag: return information about |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 164 | * hardware preferences in |
| 165 | * {@link PackageInfo#configPreferences PackageInfo.configPreferences} and |
| 166 | * requested features in {@link PackageInfo#reqFeatures |
| 167 | * PackageInfo.reqFeatures}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 168 | */ |
| 169 | public static final int GET_CONFIGURATIONS = 0x00004000; |
| 170 | |
| 171 | /** |
Dianne Hackborn | 1655be4 | 2009-05-08 14:29:01 -0700 | [diff] [blame] | 172 | * Resolution and querying flag: if set, only filters that support the |
| 173 | * {@link android.content.Intent#CATEGORY_DEFAULT} will be considered for |
| 174 | * matching. This is a synonym for including the CATEGORY_DEFAULT in your |
| 175 | * supplied Intent. |
| 176 | */ |
| 177 | public static final int MATCH_DEFAULT_ONLY = 0x00010000; |
| 178 | |
| 179 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 180 | * Permission check result: this is returned by {@link #checkPermission} |
| 181 | * if the permission has been granted to the given package. |
| 182 | */ |
| 183 | public static final int PERMISSION_GRANTED = 0; |
| 184 | |
| 185 | /** |
| 186 | * Permission check result: this is returned by {@link #checkPermission} |
| 187 | * if the permission has not been granted to the given package. |
| 188 | */ |
| 189 | public static final int PERMISSION_DENIED = -1; |
| 190 | |
| 191 | /** |
| 192 | * Signature check result: this is returned by {@link #checkSignatures} |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 193 | * if all signatures on the two packages match. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 194 | */ |
| 195 | public static final int SIGNATURE_MATCH = 0; |
| 196 | |
| 197 | /** |
| 198 | * Signature check result: this is returned by {@link #checkSignatures} |
| 199 | * if neither of the two packages is signed. |
| 200 | */ |
| 201 | public static final int SIGNATURE_NEITHER_SIGNED = 1; |
| 202 | |
| 203 | /** |
| 204 | * Signature check result: this is returned by {@link #checkSignatures} |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 205 | * if the first package is not signed but the second is. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 206 | */ |
| 207 | public static final int SIGNATURE_FIRST_NOT_SIGNED = -1; |
| 208 | |
| 209 | /** |
| 210 | * Signature check result: this is returned by {@link #checkSignatures} |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 211 | * if the second package is not signed but the first is. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 212 | */ |
| 213 | public static final int SIGNATURE_SECOND_NOT_SIGNED = -2; |
| 214 | |
| 215 | /** |
| 216 | * Signature check result: this is returned by {@link #checkSignatures} |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 217 | * if not all signatures on both packages match. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 218 | */ |
| 219 | public static final int SIGNATURE_NO_MATCH = -3; |
| 220 | |
| 221 | /** |
| 222 | * Signature check result: this is returned by {@link #checkSignatures} |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 223 | * if either of the packages are not valid. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 224 | */ |
| 225 | public static final int SIGNATURE_UNKNOWN_PACKAGE = -4; |
| 226 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 227 | public static final int COMPONENT_ENABLED_STATE_DEFAULT = 0; |
| 228 | public static final int COMPONENT_ENABLED_STATE_ENABLED = 1; |
| 229 | public static final int COMPONENT_ENABLED_STATE_DISABLED = 2; |
| 230 | |
| 231 | /** |
| 232 | * Flag parameter for {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} to |
| 233 | * indicate that this package should be installed as forward locked, i.e. only the app itself |
Brad Fitzpatrick | 2e805b1 | 2010-03-22 10:10:51 -0700 | [diff] [blame] | 234 | * should have access to its code and non-resource assets. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 235 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 236 | */ |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 237 | public static final int INSTALL_FORWARD_LOCK = 0x00000001; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 238 | |
| 239 | /** |
| 240 | * Flag parameter for {@link #installPackage} to indicate that you want to replace an already |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 241 | * installed package, if one exists. |
| 242 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 243 | */ |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 244 | public static final int INSTALL_REPLACE_EXISTING = 0x00000002; |
| 245 | |
| 246 | /** |
| 247 | * Flag parameter for {@link #installPackage} to indicate that you want to |
| 248 | * allow test packages (those that have set android:testOnly in their |
| 249 | * manifest) to be installed. |
| 250 | * @hide |
| 251 | */ |
| 252 | public static final int INSTALL_ALLOW_TEST = 0x00000004; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 253 | |
| 254 | /** |
Suchi Amalapurapu | af8e9f4 | 2010-01-12 10:17:28 -0800 | [diff] [blame] | 255 | * Flag parameter for {@link #installPackage} to indicate that this |
| 256 | * package has to be installed on the sdcard. |
| 257 | * @hide |
| 258 | */ |
Suchi Amalapurapu | 5b993ce | 2010-02-12 09:43:29 -0800 | [diff] [blame] | 259 | public static final int INSTALL_EXTERNAL = 0x00000008; |
Oscar Montemayor | 539d3c4 | 2010-01-29 15:27:00 -0800 | [diff] [blame] | 260 | |
| 261 | /** |
Suchi Amalapurapu | 14b6abd | 2010-03-17 08:37:04 -0700 | [diff] [blame] | 262 | * Flag parameter for {@link #installPackage} to indicate that this |
| 263 | * package has to be installed on the sdcard. |
| 264 | * @hide |
| 265 | */ |
| 266 | public static final int INSTALL_INTERNAL = 0x00000010; |
| 267 | |
| 268 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 269 | * Flag parameter for |
| 270 | * {@link #setComponentEnabledSetting(android.content.ComponentName, int, int)} to indicate |
| 271 | * that you don't want to kill the app containing the component. Be careful when you set this |
| 272 | * since changing component states can make the containing application's behavior unpredictable. |
| 273 | */ |
| 274 | public static final int DONT_KILL_APP = 0x00000001; |
| 275 | |
| 276 | /** |
| 277 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 278 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} on success. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 279 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 280 | */ |
| 281 | public static final int INSTALL_SUCCEEDED = 1; |
| 282 | |
| 283 | /** |
| 284 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 285 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package is |
| 286 | * already installed. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 287 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 288 | */ |
| 289 | public static final int INSTALL_FAILED_ALREADY_EXISTS = -1; |
| 290 | |
| 291 | /** |
| 292 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 293 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package archive |
| 294 | * file is invalid. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 295 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 296 | */ |
| 297 | public static final int INSTALL_FAILED_INVALID_APK = -2; |
| 298 | |
| 299 | /** |
| 300 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 301 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the URI passed in |
| 302 | * is invalid. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 303 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 304 | */ |
| 305 | public static final int INSTALL_FAILED_INVALID_URI = -3; |
| 306 | |
| 307 | /** |
| 308 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 309 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package manager |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 310 | * service found that the device didn't have enough storage space to install the app. |
| 311 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 312 | */ |
| 313 | public static final int INSTALL_FAILED_INSUFFICIENT_STORAGE = -4; |
| 314 | |
| 315 | /** |
| 316 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 317 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if a |
| 318 | * package is already installed with the same name. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 319 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 320 | */ |
| 321 | public static final int INSTALL_FAILED_DUPLICATE_PACKAGE = -5; |
| 322 | |
| 323 | /** |
| 324 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 325 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 326 | * the requested shared user does not exist. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 327 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 328 | */ |
| 329 | public static final int INSTALL_FAILED_NO_SHARED_USER = -6; |
| 330 | |
| 331 | /** |
| 332 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 333 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 334 | * a previously installed package of the same name has a different signature |
| 335 | * than the new package (and the old package's data was not removed). |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 336 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 337 | */ |
| 338 | public static final int INSTALL_FAILED_UPDATE_INCOMPATIBLE = -7; |
| 339 | |
| 340 | /** |
| 341 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 342 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 343 | * the new package is requested a shared user which is already installed on the |
| 344 | * device and does not have matching signature. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 345 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 346 | */ |
| 347 | public static final int INSTALL_FAILED_SHARED_USER_INCOMPATIBLE = -8; |
| 348 | |
| 349 | /** |
| 350 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 351 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 352 | * the new package uses a shared library that is not available. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 353 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 354 | */ |
| 355 | public static final int INSTALL_FAILED_MISSING_SHARED_LIBRARY = -9; |
| 356 | |
| 357 | /** |
| 358 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 359 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 360 | * the new package uses a shared library that is not available. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 361 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 362 | */ |
| 363 | public static final int INSTALL_FAILED_REPLACE_COULDNT_DELETE = -10; |
| 364 | |
| 365 | /** |
| 366 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 367 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 368 | * the new package failed while optimizing and validating its dex files, |
| 369 | * either because there was not enough storage or the validation failed. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 370 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 371 | */ |
| 372 | public static final int INSTALL_FAILED_DEXOPT = -11; |
| 373 | |
| 374 | /** |
| 375 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 376 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 377 | * the new package failed because the current SDK version is older than |
| 378 | * that required by the package. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 379 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 380 | */ |
| 381 | public static final int INSTALL_FAILED_OLDER_SDK = -12; |
| 382 | |
| 383 | /** |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 384 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 385 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 386 | * the new package failed because it contains a content provider with the |
| 387 | * same authority as a provider already installed in the system. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 388 | * @hide |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 389 | */ |
| 390 | public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13; |
| 391 | |
| 392 | /** |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 393 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 394 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 395 | * the new package failed because the current SDK version is newer than |
| 396 | * that required by the package. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 397 | * @hide |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 398 | */ |
| 399 | public static final int INSTALL_FAILED_NEWER_SDK = -14; |
| 400 | |
| 401 | /** |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 402 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 403 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 404 | * the new package failed because it has specified that it is a test-only |
| 405 | * package and the caller has not supplied the {@link #INSTALL_ALLOW_TEST} |
| 406 | * flag. |
| 407 | * @hide |
| 408 | */ |
| 409 | public static final int INSTALL_FAILED_TEST_ONLY = -15; |
| 410 | |
| 411 | /** |
Dianne Hackborn | b181118 | 2009-05-21 15:45:42 -0700 | [diff] [blame] | 412 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 413 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 414 | * the package being installed contains native code, but none that is |
| 415 | * compatible with the the device's CPU_ABI. |
| 416 | * @hide |
| 417 | */ |
| 418 | public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16; |
| 419 | |
| 420 | /** |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 421 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 422 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 423 | * the new package uses a feature that is not available. |
| 424 | * @hide |
| 425 | */ |
| 426 | public static final int INSTALL_FAILED_MISSING_FEATURE = -17; |
| 427 | |
Suchi Amalapurapu | af8e9f4 | 2010-01-12 10:17:28 -0800 | [diff] [blame] | 428 | // ------ Errors related to sdcard |
| 429 | /** |
| 430 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 431 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 432 | * a secure container mount point couldn't be accessed on external media. |
| 433 | * @hide |
| 434 | */ |
| 435 | public static final int INSTALL_FAILED_CONTAINER_ERROR = -18; |
| 436 | |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 437 | /** |
Suchi Amalapurapu | b56ae20 | 2010-02-04 22:51:07 -0800 | [diff] [blame] | 438 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 439 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 440 | * the new package couldn't be installed in the specified install |
| 441 | * location. |
| 442 | * @hide |
| 443 | */ |
| 444 | public static final int INSTALL_FAILED_INVALID_INSTALL_LOCATION = -19; |
| 445 | |
| 446 | /** |
Suchi Amalapurapu | 8a9ab24 | 2010-03-11 16:49:16 -0800 | [diff] [blame] | 447 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 448 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 449 | * the new package couldn't be installed in the specified install |
| 450 | * location because the media is not available. |
| 451 | * @hide |
| 452 | */ |
| 453 | public static final int INSTALL_FAILED_MEDIA_UNAVAILABLE = -20; |
| 454 | |
| 455 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 456 | * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by |
| 457 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} |
| 458 | * if the parser was given a path that is not a file, or does not end with the expected |
| 459 | * '.apk' extension. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 460 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 461 | */ |
| 462 | public static final int INSTALL_PARSE_FAILED_NOT_APK = -100; |
| 463 | |
| 464 | /** |
| 465 | * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by |
| 466 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} |
| 467 | * if the parser was unable to retrieve the AndroidManifest.xml file. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 468 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 469 | */ |
| 470 | public static final int INSTALL_PARSE_FAILED_BAD_MANIFEST = -101; |
| 471 | |
| 472 | /** |
| 473 | * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by |
| 474 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} |
| 475 | * if the parser encountered an unexpected exception. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 476 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 477 | */ |
| 478 | public static final int INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION = -102; |
| 479 | |
| 480 | /** |
| 481 | * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by |
| 482 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} |
| 483 | * if the parser did not find any certificates in the .apk. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 484 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 485 | */ |
| 486 | public static final int INSTALL_PARSE_FAILED_NO_CERTIFICATES = -103; |
| 487 | |
| 488 | /** |
| 489 | * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by |
| 490 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} |
| 491 | * if the parser found inconsistent certificates on the files in the .apk. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 492 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 493 | */ |
| 494 | public static final int INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES = -104; |
| 495 | |
| 496 | /** |
| 497 | * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by |
| 498 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} |
| 499 | * if the parser encountered a CertificateEncodingException in one of the |
| 500 | * files in the .apk. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 501 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 502 | */ |
| 503 | public static final int INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING = -105; |
| 504 | |
| 505 | /** |
| 506 | * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by |
| 507 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} |
| 508 | * if the parser encountered a bad or missing package name in the manifest. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 509 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 510 | */ |
| 511 | public static final int INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME = -106; |
| 512 | |
| 513 | /** |
| 514 | * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by |
| 515 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} |
| 516 | * if the parser encountered a bad shared user id name in the manifest. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 517 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 518 | */ |
| 519 | public static final int INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID = -107; |
| 520 | |
| 521 | /** |
| 522 | * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by |
| 523 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} |
| 524 | * if the parser encountered some structural problem in the manifest. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 525 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 526 | */ |
| 527 | public static final int INSTALL_PARSE_FAILED_MANIFEST_MALFORMED = -108; |
| 528 | |
| 529 | /** |
| 530 | * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by |
| 531 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} |
| 532 | * if the parser did not find any actionable tags (instrumentation or application) |
| 533 | * in the manifest. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 534 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 535 | */ |
| 536 | public static final int INSTALL_PARSE_FAILED_MANIFEST_EMPTY = -109; |
| 537 | |
| 538 | /** |
Suchi Amalapurapu | 5b993ce | 2010-02-12 09:43:29 -0800 | [diff] [blame] | 539 | * Installation failed return code: this is passed to the {@link IPackageInstallObserver} by |
| 540 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} |
| 541 | * if the system failed to install the package because of system issues. |
| 542 | * @hide |
| 543 | */ |
| 544 | public static final int INSTALL_FAILED_INTERNAL_ERROR = -110; |
| 545 | |
| 546 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 547 | * Flag parameter for {@link #deletePackage} to indicate that you don't want to delete the |
| 548 | * package's data directory. |
| 549 | * |
| 550 | * @hide |
| 551 | */ |
| 552 | public static final int DONT_DELETE_DATA = 0x00000001; |
| 553 | |
| 554 | /** |
Kenny Root | c39bb4a | 2011-02-28 13:27:19 -0800 | [diff] [blame] | 555 | * Return code for when package deletion succeeds. This is passed to the |
| 556 | * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system |
| 557 | * succeeded in deleting the package. |
| 558 | * |
| 559 | * @hide |
| 560 | */ |
| 561 | public static final int DELETE_SUCCEEDED = 1; |
| 562 | |
| 563 | /** |
| 564 | * Deletion failed return code: this is passed to the |
| 565 | * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system |
| 566 | * failed to delete the package for an unspecified reason. |
| 567 | * |
| 568 | * @hide |
| 569 | */ |
| 570 | public static final int DELETE_FAILED_INTERNAL_ERROR = -1; |
| 571 | |
| 572 | /** |
| 573 | * Deletion failed return code: this is passed to the |
| 574 | * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system |
| 575 | * failed to delete the package because it is the active DevicePolicy |
| 576 | * manager. |
| 577 | * |
| 578 | * @hide |
| 579 | */ |
| 580 | public static final int DELETE_FAILED_DEVICE_POLICY_MANAGER = -2; |
| 581 | |
| 582 | /** |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 583 | * Return code that is passed to the {@link IPackageMoveObserver} by |
Kenny Root | c39bb4a | 2011-02-28 13:27:19 -0800 | [diff] [blame] | 584 | * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} when the |
| 585 | * package has been successfully moved by the system. |
| 586 | * |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 587 | * @hide |
| 588 | */ |
| 589 | public static final int MOVE_SUCCEEDED = 1; |
| 590 | /** |
| 591 | * Error code that is passed to the {@link IPackageMoveObserver} by |
| 592 | * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} |
| 593 | * when the package hasn't been successfully moved by the system |
| 594 | * because of insufficient memory on specified media. |
| 595 | * @hide |
| 596 | */ |
| 597 | public static final int MOVE_FAILED_INSUFFICIENT_STORAGE = -1; |
| 598 | |
| 599 | /** |
| 600 | * Error code that is passed to the {@link IPackageMoveObserver} by |
| 601 | * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} |
| 602 | * if the specified package doesn't exist. |
| 603 | * @hide |
| 604 | */ |
| 605 | public static final int MOVE_FAILED_DOESNT_EXIST = -2; |
| 606 | |
| 607 | /** |
| 608 | * Error code that is passed to the {@link IPackageMoveObserver} by |
| 609 | * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} |
| 610 | * if the specified package cannot be moved since its a system package. |
| 611 | * @hide |
| 612 | */ |
| 613 | public static final int MOVE_FAILED_SYSTEM_PACKAGE = -3; |
| 614 | |
| 615 | /** |
| 616 | * Error code that is passed to the {@link IPackageMoveObserver} by |
| 617 | * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} |
| 618 | * if the specified package cannot be moved since its forward locked. |
| 619 | * @hide |
| 620 | */ |
| 621 | public static final int MOVE_FAILED_FORWARD_LOCKED = -4; |
| 622 | |
| 623 | /** |
| 624 | * Error code that is passed to the {@link IPackageMoveObserver} by |
| 625 | * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} |
| 626 | * if the specified package cannot be moved to the specified location. |
| 627 | * @hide |
| 628 | */ |
| 629 | public static final int MOVE_FAILED_INVALID_LOCATION = -5; |
| 630 | |
| 631 | /** |
Suchi Amalapurapu | 8a9ab24 | 2010-03-11 16:49:16 -0800 | [diff] [blame] | 632 | * Error code that is passed to the {@link IPackageMoveObserver} by |
| 633 | * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} |
| 634 | * if the specified package cannot be moved to the specified location. |
| 635 | * @hide |
| 636 | */ |
| 637 | public static final int MOVE_FAILED_INTERNAL_ERROR = -6; |
| 638 | |
| 639 | /** |
Kenny Root | deb1126 | 2010-08-02 11:36:21 -0700 | [diff] [blame] | 640 | * Error code that is passed to the {@link IPackageMoveObserver} by |
| 641 | * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} if the |
| 642 | * specified package already has an operation pending in the |
| 643 | * {@link PackageHandler} queue. |
| 644 | * |
| 645 | * @hide |
| 646 | */ |
| 647 | public static final int MOVE_FAILED_OPERATION_PENDING = -7; |
| 648 | |
| 649 | /** |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 650 | * Flag parameter for {@link #movePackage} to indicate that |
| 651 | * the package should be moved to internal storage if its |
| 652 | * been installed on external media. |
| 653 | * @hide |
| 654 | */ |
| 655 | public static final int MOVE_INTERNAL = 0x00000001; |
| 656 | |
| 657 | /** |
| 658 | * Flag parameter for {@link #movePackage} to indicate that |
| 659 | * the package should be moved to external media. |
| 660 | * @hide |
| 661 | */ |
| 662 | public static final int MOVE_EXTERNAL_MEDIA = 0x00000002; |
| 663 | |
| 664 | /** |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 665 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 898e1e8 | 2010-09-26 17:28:30 -0700 | [diff] [blame] | 666 | * {@link #hasSystemFeature}: The device's audio pipeline is low-latency, |
| 667 | * more suitable for audio applications sensitive to delays or lag in |
| 668 | * sound input or output. |
| 669 | */ |
| 670 | @SdkConstant(SdkConstantType.FEATURE) |
| 671 | public static final String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency"; |
| 672 | |
| 673 | /** |
| 674 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 675 | * {@link #hasSystemFeature}: The device is capable of communicating with |
| 676 | * other devices via Bluetooth. |
| 677 | */ |
| 678 | @SdkConstant(SdkConstantType.FEATURE) |
| 679 | public static final String FEATURE_BLUETOOTH = "android.hardware.bluetooth"; |
| 680 | |
| 681 | /** |
| 682 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 683 | * {@link #hasSystemFeature}: The device has a camera facing away |
| 684 | * from the screen. |
| 685 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 686 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 687 | public static final String FEATURE_CAMERA = "android.hardware.camera"; |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 688 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 689 | /** |
| 690 | * Feature for {@link #getSystemAvailableFeatures} and |
| 691 | * {@link #hasSystemFeature}: The device's camera supports auto-focus. |
| 692 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 693 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 694 | public static final String FEATURE_CAMERA_AUTOFOCUS = "android.hardware.camera.autofocus"; |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 695 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 696 | /** |
| 697 | * Feature for {@link #getSystemAvailableFeatures} and |
| 698 | * {@link #hasSystemFeature}: The device's camera supports flash. |
| 699 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 700 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 701 | public static final String FEATURE_CAMERA_FLASH = "android.hardware.camera.flash"; |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 702 | |
| 703 | /** |
| 704 | * Feature for {@link #getSystemAvailableFeatures} and |
Chih-Chung Chang | de1057c | 2010-06-14 19:15:00 +0800 | [diff] [blame] | 705 | * {@link #hasSystemFeature}: The device has a front facing camera. |
| 706 | */ |
| 707 | @SdkConstant(SdkConstantType.FEATURE) |
| 708 | public static final String FEATURE_CAMERA_FRONT = "android.hardware.camera.front"; |
| 709 | |
| 710 | /** |
| 711 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 712 | * {@link #hasSystemFeature}: The device supports one or more methods of |
| 713 | * reporting current location. |
| 714 | */ |
| 715 | @SdkConstant(SdkConstantType.FEATURE) |
| 716 | public static final String FEATURE_LOCATION = "android.hardware.location"; |
| 717 | |
| 718 | /** |
| 719 | * Feature for {@link #getSystemAvailableFeatures} and |
| 720 | * {@link #hasSystemFeature}: The device has a Global Positioning System |
| 721 | * receiver and can report precise location. |
| 722 | */ |
| 723 | @SdkConstant(SdkConstantType.FEATURE) |
| 724 | public static final String FEATURE_LOCATION_GPS = "android.hardware.location.gps"; |
| 725 | |
| 726 | /** |
| 727 | * Feature for {@link #getSystemAvailableFeatures} and |
| 728 | * {@link #hasSystemFeature}: The device can report location with coarse |
| 729 | * accuracy using a network-based geolocation system. |
| 730 | */ |
| 731 | @SdkConstant(SdkConstantType.FEATURE) |
| 732 | public static final String FEATURE_LOCATION_NETWORK = "android.hardware.location.network"; |
| 733 | |
| 734 | /** |
| 735 | * Feature for {@link #getSystemAvailableFeatures} and |
| 736 | * {@link #hasSystemFeature}: The device can record audio via a |
| 737 | * microphone. |
| 738 | */ |
| 739 | @SdkConstant(SdkConstantType.FEATURE) |
| 740 | public static final String FEATURE_MICROPHONE = "android.hardware.microphone"; |
| 741 | |
| 742 | /** |
| 743 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 76437d3 | 2010-09-01 11:17:20 -0700 | [diff] [blame] | 744 | * {@link #hasSystemFeature}: The device can communicate using Near-Field |
| 745 | * Communications (NFC). |
| 746 | */ |
| 747 | @SdkConstant(SdkConstantType.FEATURE) |
| 748 | public static final String FEATURE_NFC = "android.hardware.nfc"; |
| 749 | |
| 750 | /** |
| 751 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 5744bb4 | 2010-09-01 19:18:57 -0700 | [diff] [blame] | 752 | * {@link #hasSystemFeature}: The device includes an accelerometer. |
| 753 | */ |
| 754 | @SdkConstant(SdkConstantType.FEATURE) |
| 755 | public static final String FEATURE_SENSOR_ACCELEROMETER = "android.hardware.sensor.accelerometer"; |
| 756 | |
| 757 | /** |
| 758 | * Feature for {@link #getSystemAvailableFeatures} and |
| 759 | * {@link #hasSystemFeature}: The device includes a barometer (air |
| 760 | * pressure sensor.) |
| 761 | */ |
| 762 | @SdkConstant(SdkConstantType.FEATURE) |
| 763 | public static final String FEATURE_SENSOR_BAROMETER = "android.hardware.sensor.barometer"; |
| 764 | |
| 765 | /** |
| 766 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 767 | * {@link #hasSystemFeature}: The device includes a magnetometer (compass). |
| 768 | */ |
| 769 | @SdkConstant(SdkConstantType.FEATURE) |
| 770 | public static final String FEATURE_SENSOR_COMPASS = "android.hardware.sensor.compass"; |
| 771 | |
| 772 | /** |
| 773 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 5744bb4 | 2010-09-01 19:18:57 -0700 | [diff] [blame] | 774 | * {@link #hasSystemFeature}: The device includes a gyroscope. |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 775 | */ |
| 776 | @SdkConstant(SdkConstantType.FEATURE) |
Dan Morrill | 5744bb4 | 2010-09-01 19:18:57 -0700 | [diff] [blame] | 777 | public static final String FEATURE_SENSOR_GYROSCOPE = "android.hardware.sensor.gyroscope"; |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 778 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 779 | /** |
| 780 | * Feature for {@link #getSystemAvailableFeatures} and |
| 781 | * {@link #hasSystemFeature}: The device includes a light sensor. |
| 782 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 783 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 784 | public static final String FEATURE_SENSOR_LIGHT = "android.hardware.sensor.light"; |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 785 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 786 | /** |
| 787 | * Feature for {@link #getSystemAvailableFeatures} and |
| 788 | * {@link #hasSystemFeature}: The device includes a proximity sensor. |
| 789 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 790 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 791 | public static final String FEATURE_SENSOR_PROXIMITY = "android.hardware.sensor.proximity"; |
| 792 | |
| 793 | /** |
| 794 | * Feature for {@link #getSystemAvailableFeatures} and |
| 795 | * {@link #hasSystemFeature}: The device has a telephony radio with data |
| 796 | * communication support. |
| 797 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 798 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 799 | public static final String FEATURE_TELEPHONY = "android.hardware.telephony"; |
| 800 | |
| 801 | /** |
| 802 | * Feature for {@link #getSystemAvailableFeatures} and |
| 803 | * {@link #hasSystemFeature}: The device has a CDMA telephony stack. |
| 804 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 805 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 806 | public static final String FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma"; |
| 807 | |
| 808 | /** |
| 809 | * Feature for {@link #getSystemAvailableFeatures} and |
| 810 | * {@link #hasSystemFeature}: The device has a GSM telephony stack. |
| 811 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 812 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 813 | public static final String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm"; |
Hung-ying Tyan | 3424c02 | 2010-08-27 18:08:19 +0800 | [diff] [blame] | 814 | |
| 815 | /** |
| 816 | * Feature for {@link #getSystemAvailableFeatures} and |
Mike Lockwood | f4ca247 | 2011-02-27 11:23:25 -0800 | [diff] [blame] | 817 | * {@link #hasSystemFeature}: The device supports connecting to USB devices |
| 818 | * as the USB host. |
| 819 | */ |
| 820 | @SdkConstant(SdkConstantType.FEATURE) |
| 821 | public static final String FEATURE_USB_HOST = "android.hardware.usb.host"; |
| 822 | |
| 823 | /** |
| 824 | * Feature for {@link #getSystemAvailableFeatures} and |
| 825 | * {@link #hasSystemFeature}: The device supports connecting to USB accessories. |
| 826 | */ |
| 827 | @SdkConstant(SdkConstantType.FEATURE) |
| 828 | public static final String FEATURE_USB_ACCESSORY = "android.hardware.usb.accessory"; |
| 829 | |
| 830 | /** |
| 831 | * Feature for {@link #getSystemAvailableFeatures} and |
Hung-ying Tyan | 3424c02 | 2010-08-27 18:08:19 +0800 | [diff] [blame] | 832 | * {@link #hasSystemFeature}: The SIP API is enabled on the device. |
| 833 | */ |
| 834 | @SdkConstant(SdkConstantType.FEATURE) |
| 835 | public static final String FEATURE_SIP = "android.software.sip"; |
| 836 | |
| 837 | /** |
| 838 | * Feature for {@link #getSystemAvailableFeatures} and |
| 839 | * {@link #hasSystemFeature}: The device supports SIP-based VOIP. |
| 840 | */ |
| 841 | @SdkConstant(SdkConstantType.FEATURE) |
| 842 | public static final String FEATURE_SIP_VOIP = "android.software.sip.voip"; |
| 843 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 844 | /** |
| 845 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | b0fe033 | 2010-04-05 14:43:58 -0700 | [diff] [blame] | 846 | * {@link #hasSystemFeature}: The device's display has a touch screen. |
| 847 | */ |
| 848 | @SdkConstant(SdkConstantType.FEATURE) |
| 849 | public static final String FEATURE_TOUCHSCREEN = "android.hardware.touchscreen"; |
| 850 | |
| 851 | |
| 852 | /** |
| 853 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 854 | * {@link #hasSystemFeature}: The device's touch screen supports |
| 855 | * multitouch sufficient for basic two-finger gesture detection. |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 856 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 857 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 858 | public static final String FEATURE_TOUCHSCREEN_MULTITOUCH = "android.hardware.touchscreen.multitouch"; |
| 859 | |
| 860 | /** |
| 861 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 862 | * {@link #hasSystemFeature}: The device's touch screen is capable of |
| 863 | * tracking two or more fingers fully independently. |
| 864 | */ |
| 865 | @SdkConstant(SdkConstantType.FEATURE) |
| 866 | public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT = "android.hardware.touchscreen.multitouch.distinct"; |
| 867 | |
| 868 | /** |
| 869 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 6993d3d | 2010-09-03 14:30:14 -0700 | [diff] [blame] | 870 | * {@link #hasSystemFeature}: The device's touch screen is capable of |
| 871 | * tracking a full hand of fingers fully independently -- that is, 5 or |
| 872 | * more simultaneous independent pointers. |
| 873 | */ |
| 874 | @SdkConstant(SdkConstantType.FEATURE) |
| 875 | public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND = "android.hardware.touchscreen.multitouch.jazzhand"; |
| 876 | |
| 877 | /** |
| 878 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | a537687 | 2011-01-23 13:15:53 -0800 | [diff] [blame] | 879 | * {@link #hasSystemFeature}: The device does not have a touch screen, but |
| 880 | * does support touch emulation for basic events. For instance, the |
| 881 | * device might use a mouse or remote control to drive a cursor, and |
| 882 | * emulate basic touch pointer events like down, up, drag, etc. All |
| 883 | * devices that support android.hardware.touchscreen or a sub-feature are |
| 884 | * presumed to also support faketouch. |
| 885 | */ |
| 886 | @SdkConstant(SdkConstantType.FEATURE) |
| 887 | public static final String FEATURE_FAKETOUCH = "android.hardware.faketouch"; |
| 888 | |
| 889 | /** |
| 890 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 891 | * {@link #hasSystemFeature}: The device supports live wallpapers. |
| 892 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 893 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 894 | public static final String FEATURE_LIVE_WALLPAPER = "android.software.live_wallpaper"; |
Oscar Montemayor | 1228d0a | 2010-01-28 12:01:44 -0800 | [diff] [blame] | 895 | |
Oscar Montemayor | 1228d0a | 2010-01-28 12:01:44 -0800 | [diff] [blame] | 896 | /** |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 897 | * Feature for {@link #getSystemAvailableFeatures} and |
| 898 | * {@link #hasSystemFeature}: The device supports WiFi (802.11) networking. |
| 899 | */ |
| 900 | @SdkConstant(SdkConstantType.FEATURE) |
| 901 | public static final String FEATURE_WIFI = "android.hardware.wifi"; |
| 902 | |
| 903 | /** |
Dianne Hackborn | e83cefce | 2010-02-04 17:38:14 -0800 | [diff] [blame] | 904 | * Action to external storage service to clean out removed apps. |
| 905 | * @hide |
| 906 | */ |
| 907 | public static final String ACTION_CLEAN_EXTERNAL_STORAGE |
| 908 | = "android.content.pm.CLEAN_EXTERNAL_STORAGE"; |
Oscar Montemayor | 1228d0a | 2010-01-28 12:01:44 -0800 | [diff] [blame] | 909 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 910 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 911 | * Retrieve overall information about an application package that is |
| 912 | * installed on the system. |
| 913 | * |
| 914 | * <p>Throws {@link NameNotFoundException} if a package with the given |
| 915 | * name can not be found on the system. |
| 916 | * |
| 917 | * @param packageName The full name (i.e. com.google.apps.contacts) of the |
| 918 | * desired package. |
| 919 | |
| 920 | * @param flags Additional option flags. Use any combination of |
| 921 | * {@link #GET_ACTIVITIES}, |
| 922 | * {@link #GET_GIDS}, |
| 923 | * {@link #GET_CONFIGURATIONS}, |
| 924 | * {@link #GET_INSTRUMENTATION}, |
| 925 | * {@link #GET_PERMISSIONS}, |
| 926 | * {@link #GET_PROVIDERS}, |
| 927 | * {@link #GET_RECEIVERS}, |
| 928 | * {@link #GET_SERVICES}, |
| 929 | * {@link #GET_SIGNATURES}, |
| 930 | * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned. |
| 931 | * |
| 932 | * @return Returns a PackageInfo object containing information about the package. |
| 933 | * If flag GET_UNINSTALLED_PACKAGES is set and if the package is not |
| 934 | * found in the list of installed applications, the package information is |
| 935 | * retrieved from the list of uninstalled applications(which includes |
| 936 | * installed applications as well as applications |
| 937 | * with data directory ie applications which had been |
| 938 | * deleted with DONT_DELTE_DATA flag set). |
| 939 | * |
| 940 | * @see #GET_ACTIVITIES |
| 941 | * @see #GET_GIDS |
| 942 | * @see #GET_CONFIGURATIONS |
| 943 | * @see #GET_INSTRUMENTATION |
| 944 | * @see #GET_PERMISSIONS |
| 945 | * @see #GET_PROVIDERS |
| 946 | * @see #GET_RECEIVERS |
| 947 | * @see #GET_SERVICES |
| 948 | * @see #GET_SIGNATURES |
| 949 | * @see #GET_UNINSTALLED_PACKAGES |
| 950 | * |
| 951 | */ |
| 952 | public abstract PackageInfo getPackageInfo(String packageName, int flags) |
| 953 | throws NameNotFoundException; |
| 954 | |
| 955 | /** |
Dianne Hackborn | 4709693 | 2010-02-11 15:57:09 -0800 | [diff] [blame] | 956 | * Map from the current package names in use on the device to whatever |
| 957 | * the current canonical name of that package is. |
| 958 | * @param names Array of current names to be mapped. |
| 959 | * @return Returns an array of the same size as the original, containing |
| 960 | * the canonical name for each package. |
| 961 | */ |
| 962 | public abstract String[] currentToCanonicalPackageNames(String[] names); |
| 963 | |
| 964 | /** |
| 965 | * Map from a packages canonical name to the current name in use on the device. |
| 966 | * @param names Array of new names to be mapped. |
| 967 | * @return Returns an array of the same size as the original, containing |
| 968 | * the current name for each package. |
| 969 | */ |
| 970 | public abstract String[] canonicalToCurrentPackageNames(String[] names); |
| 971 | |
| 972 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 973 | * Return a "good" intent to launch a front-door activity in a package, |
| 974 | * for use for example to implement an "open" button when browsing through |
| 975 | * packages. The current implementation will look first for a main |
| 976 | * activity in the category {@link Intent#CATEGORY_INFO}, next for a |
| 977 | * main activity in the category {@link Intent#CATEGORY_LAUNCHER}, or return |
| 978 | * null if neither are found. |
| 979 | * |
| 980 | * <p>Throws {@link NameNotFoundException} if a package with the given |
| 981 | * name can not be found on the system. |
| 982 | * |
| 983 | * @param packageName The name of the package to inspect. |
| 984 | * |
Dianne Hackborn | 1941576 | 2010-12-15 00:20:27 -0800 | [diff] [blame] | 985 | * @return Returns either a fully-qualified Intent that can be used to |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 986 | * launch the main activity in the package, or null if the package does |
| 987 | * not contain such an activity. |
| 988 | */ |
Mihai Preda | eae850c | 2009-05-13 10:13:48 +0200 | [diff] [blame] | 989 | public abstract Intent getLaunchIntentForPackage(String packageName); |
| 990 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 991 | /** |
| 992 | * Return an array of all of the secondary group-ids that have been |
| 993 | * assigned to a package. |
| 994 | * |
| 995 | * <p>Throws {@link NameNotFoundException} if a package with the given |
| 996 | * name can not be found on the system. |
| 997 | * |
| 998 | * @param packageName The full name (i.e. com.google.apps.contacts) of the |
| 999 | * desired package. |
| 1000 | * |
| 1001 | * @return Returns an int array of the assigned gids, or null if there |
| 1002 | * are none. |
| 1003 | */ |
| 1004 | public abstract int[] getPackageGids(String packageName) |
| 1005 | throws NameNotFoundException; |
| 1006 | |
| 1007 | /** |
| 1008 | * Retrieve all of the information we know about a particular permission. |
| 1009 | * |
| 1010 | * <p>Throws {@link NameNotFoundException} if a permission with the given |
| 1011 | * name can not be found on the system. |
| 1012 | * |
| 1013 | * @param name The fully qualified name (i.e. com.google.permission.LOGIN) |
| 1014 | * of the permission you are interested in. |
| 1015 | * @param flags Additional option flags. Use {@link #GET_META_DATA} to |
| 1016 | * retrieve any meta-data associated with the permission. |
| 1017 | * |
| 1018 | * @return Returns a {@link PermissionInfo} containing information about the |
| 1019 | * permission. |
| 1020 | */ |
| 1021 | public abstract PermissionInfo getPermissionInfo(String name, int flags) |
| 1022 | throws NameNotFoundException; |
| 1023 | |
| 1024 | /** |
| 1025 | * Query for all of the permissions associated with a particular group. |
| 1026 | * |
| 1027 | * <p>Throws {@link NameNotFoundException} if the given group does not |
| 1028 | * exist. |
| 1029 | * |
| 1030 | * @param group The fully qualified name (i.e. com.google.permission.LOGIN) |
| 1031 | * of the permission group you are interested in. Use null to |
| 1032 | * find all of the permissions not associated with a group. |
| 1033 | * @param flags Additional option flags. Use {@link #GET_META_DATA} to |
| 1034 | * retrieve any meta-data associated with the permissions. |
| 1035 | * |
| 1036 | * @return Returns a list of {@link PermissionInfo} containing information |
| 1037 | * about all of the permissions in the given group. |
| 1038 | */ |
| 1039 | public abstract List<PermissionInfo> queryPermissionsByGroup(String group, |
| 1040 | int flags) throws NameNotFoundException; |
| 1041 | |
| 1042 | /** |
| 1043 | * Retrieve all of the information we know about a particular group of |
| 1044 | * permissions. |
| 1045 | * |
| 1046 | * <p>Throws {@link NameNotFoundException} if a permission group with the given |
| 1047 | * name can not be found on the system. |
| 1048 | * |
| 1049 | * @param name The fully qualified name (i.e. com.google.permission_group.APPS) |
| 1050 | * of the permission you are interested in. |
| 1051 | * @param flags Additional option flags. Use {@link #GET_META_DATA} to |
| 1052 | * retrieve any meta-data associated with the permission group. |
| 1053 | * |
| 1054 | * @return Returns a {@link PermissionGroupInfo} containing information |
| 1055 | * about the permission. |
| 1056 | */ |
| 1057 | public abstract PermissionGroupInfo getPermissionGroupInfo(String name, |
| 1058 | int flags) throws NameNotFoundException; |
| 1059 | |
| 1060 | /** |
| 1061 | * Retrieve all of the known permission groups in the system. |
| 1062 | * |
| 1063 | * @param flags Additional option flags. Use {@link #GET_META_DATA} to |
| 1064 | * retrieve any meta-data associated with the permission group. |
| 1065 | * |
| 1066 | * @return Returns a list of {@link PermissionGroupInfo} containing |
| 1067 | * information about all of the known permission groups. |
| 1068 | */ |
| 1069 | public abstract List<PermissionGroupInfo> getAllPermissionGroups(int flags); |
| 1070 | |
| 1071 | /** |
| 1072 | * Retrieve all of the information we know about a particular |
| 1073 | * package/application. |
| 1074 | * |
| 1075 | * <p>Throws {@link NameNotFoundException} if an application with the given |
| 1076 | * package name can not be found on the system. |
| 1077 | * |
| 1078 | * @param packageName The full name (i.e. com.google.apps.contacts) of an |
| 1079 | * application. |
| 1080 | * @param flags Additional option flags. Use any combination of |
| 1081 | * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, |
| 1082 | * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned. |
| 1083 | * |
| 1084 | * @return {@link ApplicationInfo} Returns ApplicationInfo object containing |
| 1085 | * information about the package. |
| 1086 | * If flag GET_UNINSTALLED_PACKAGES is set and if the package is not |
| 1087 | * found in the list of installed applications, |
| 1088 | * the application information is retrieved from the |
| 1089 | * list of uninstalled applications(which includes |
| 1090 | * installed applications as well as applications |
| 1091 | * with data directory ie applications which had been |
| 1092 | * deleted with DONT_DELTE_DATA flag set). |
| 1093 | * |
| 1094 | * @see #GET_META_DATA |
| 1095 | * @see #GET_SHARED_LIBRARY_FILES |
| 1096 | * @see #GET_UNINSTALLED_PACKAGES |
| 1097 | */ |
| 1098 | public abstract ApplicationInfo getApplicationInfo(String packageName, |
| 1099 | int flags) throws NameNotFoundException; |
| 1100 | |
| 1101 | /** |
| 1102 | * Retrieve all of the information we know about a particular activity |
| 1103 | * class. |
| 1104 | * |
| 1105 | * <p>Throws {@link NameNotFoundException} if an activity with the given |
| 1106 | * class name can not be found on the system. |
| 1107 | * |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 1108 | * @param component The full component name (i.e. |
| 1109 | * com.google.apps.contacts/com.google.apps.contacts.ContactsList) of an Activity |
| 1110 | * class. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1111 | * @param flags Additional option flags. Use any combination of |
| 1112 | * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, |
| 1113 | * to modify the data (in ApplicationInfo) returned. |
| 1114 | * |
| 1115 | * @return {@link ActivityInfo} containing information about the activity. |
| 1116 | * |
| 1117 | * @see #GET_INTENT_FILTERS |
| 1118 | * @see #GET_META_DATA |
| 1119 | * @see #GET_SHARED_LIBRARY_FILES |
| 1120 | */ |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 1121 | public abstract ActivityInfo getActivityInfo(ComponentName component, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1122 | int flags) throws NameNotFoundException; |
| 1123 | |
| 1124 | /** |
| 1125 | * Retrieve all of the information we know about a particular receiver |
| 1126 | * class. |
| 1127 | * |
| 1128 | * <p>Throws {@link NameNotFoundException} if a receiver with the given |
| 1129 | * class name can not be found on the system. |
| 1130 | * |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 1131 | * @param component The full component name (i.e. |
| 1132 | * com.google.apps.calendar/com.google.apps.calendar.CalendarAlarm) of a Receiver |
| 1133 | * class. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1134 | * @param flags Additional option flags. Use any combination of |
| 1135 | * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, |
| 1136 | * to modify the data returned. |
| 1137 | * |
| 1138 | * @return {@link ActivityInfo} containing information about the receiver. |
| 1139 | * |
| 1140 | * @see #GET_INTENT_FILTERS |
| 1141 | * @see #GET_META_DATA |
| 1142 | * @see #GET_SHARED_LIBRARY_FILES |
| 1143 | */ |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 1144 | public abstract ActivityInfo getReceiverInfo(ComponentName component, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1145 | int flags) throws NameNotFoundException; |
| 1146 | |
| 1147 | /** |
| 1148 | * Retrieve all of the information we know about a particular service |
| 1149 | * class. |
| 1150 | * |
| 1151 | * <p>Throws {@link NameNotFoundException} if a service with the given |
| 1152 | * class name can not be found on the system. |
| 1153 | * |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 1154 | * @param component The full component name (i.e. |
| 1155 | * com.google.apps.media/com.google.apps.media.BackgroundPlayback) of a Service |
| 1156 | * class. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1157 | * @param flags Additional option flags. Use any combination of |
| 1158 | * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, |
| 1159 | * to modify the data returned. |
| 1160 | * |
| 1161 | * @return ServiceInfo containing information about the service. |
| 1162 | * |
| 1163 | * @see #GET_META_DATA |
| 1164 | * @see #GET_SHARED_LIBRARY_FILES |
| 1165 | */ |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 1166 | public abstract ServiceInfo getServiceInfo(ComponentName component, |
| 1167 | int flags) throws NameNotFoundException; |
| 1168 | |
| 1169 | /** |
| 1170 | * Retrieve all of the information we know about a particular content |
| 1171 | * provider class. |
| 1172 | * |
| 1173 | * <p>Throws {@link NameNotFoundException} if a provider with the given |
| 1174 | * class name can not be found on the system. |
| 1175 | * |
| 1176 | * @param component The full component name (i.e. |
| 1177 | * com.google.providers.media/com.google.providers.media.MediaProvider) of a |
| 1178 | * ContentProvider class. |
| 1179 | * @param flags Additional option flags. Use any combination of |
| 1180 | * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, |
| 1181 | * to modify the data returned. |
| 1182 | * |
| 1183 | * @return ProviderInfo containing information about the service. |
| 1184 | * |
| 1185 | * @see #GET_META_DATA |
| 1186 | * @see #GET_SHARED_LIBRARY_FILES |
| 1187 | */ |
| 1188 | public abstract ProviderInfo getProviderInfo(ComponentName component, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1189 | int flags) throws NameNotFoundException; |
| 1190 | |
| 1191 | /** |
| 1192 | * Return a List of all packages that are installed |
| 1193 | * on the device. |
| 1194 | * |
| 1195 | * @param flags Additional option flags. Use any combination of |
| 1196 | * {@link #GET_ACTIVITIES}, |
| 1197 | * {@link #GET_GIDS}, |
| 1198 | * {@link #GET_CONFIGURATIONS}, |
| 1199 | * {@link #GET_INSTRUMENTATION}, |
| 1200 | * {@link #GET_PERMISSIONS}, |
| 1201 | * {@link #GET_PROVIDERS}, |
| 1202 | * {@link #GET_RECEIVERS}, |
| 1203 | * {@link #GET_SERVICES}, |
| 1204 | * {@link #GET_SIGNATURES}, |
| 1205 | * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned. |
| 1206 | * |
| 1207 | * @return A List of PackageInfo objects, one for each package that is |
| 1208 | * installed on the device. In the unlikely case of there being no |
| 1209 | * installed packages, an empty list is returned. |
| 1210 | * If flag GET_UNINSTALLED_PACKAGES is set, a list of all |
| 1211 | * applications including those deleted with DONT_DELETE_DATA |
| 1212 | * (partially installed apps with data directory) will be returned. |
| 1213 | * |
| 1214 | * @see #GET_ACTIVITIES |
| 1215 | * @see #GET_GIDS |
| 1216 | * @see #GET_CONFIGURATIONS |
| 1217 | * @see #GET_INSTRUMENTATION |
| 1218 | * @see #GET_PERMISSIONS |
| 1219 | * @see #GET_PROVIDERS |
| 1220 | * @see #GET_RECEIVERS |
| 1221 | * @see #GET_SERVICES |
| 1222 | * @see #GET_SIGNATURES |
| 1223 | * @see #GET_UNINSTALLED_PACKAGES |
| 1224 | * |
| 1225 | */ |
| 1226 | public abstract List<PackageInfo> getInstalledPackages(int flags); |
| 1227 | |
| 1228 | /** |
| 1229 | * Check whether a particular package has been granted a particular |
| 1230 | * permission. |
| 1231 | * |
| 1232 | * @param permName The name of the permission you are checking for, |
| 1233 | * @param pkgName The name of the package you are checking against. |
| 1234 | * |
| 1235 | * @return If the package has the permission, PERMISSION_GRANTED is |
| 1236 | * returned. If it does not have the permission, PERMISSION_DENIED |
| 1237 | * is returned. |
| 1238 | * |
| 1239 | * @see #PERMISSION_GRANTED |
| 1240 | * @see #PERMISSION_DENIED |
| 1241 | */ |
| 1242 | public abstract int checkPermission(String permName, String pkgName); |
| 1243 | |
| 1244 | /** |
| 1245 | * Add a new dynamic permission to the system. For this to work, your |
| 1246 | * package must have defined a permission tree through the |
| 1247 | * {@link android.R.styleable#AndroidManifestPermissionTree |
| 1248 | * <permission-tree>} tag in its manifest. A package can only add |
| 1249 | * permissions to trees that were defined by either its own package or |
| 1250 | * another with the same user id; a permission is in a tree if it |
| 1251 | * matches the name of the permission tree + ".": for example, |
| 1252 | * "com.foo.bar" is a member of the permission tree "com.foo". |
| 1253 | * |
| 1254 | * <p>It is good to make your permission tree name descriptive, because you |
| 1255 | * are taking possession of that entire set of permission names. Thus, it |
| 1256 | * must be under a domain you control, with a suffix that will not match |
| 1257 | * any normal permissions that may be declared in any applications that |
| 1258 | * are part of that domain. |
| 1259 | * |
| 1260 | * <p>New permissions must be added before |
| 1261 | * any .apks are installed that use those permissions. Permissions you |
| 1262 | * add through this method are remembered across reboots of the device. |
| 1263 | * If the given permission already exists, the info you supply here |
| 1264 | * will be used to update it. |
| 1265 | * |
| 1266 | * @param info Description of the permission to be added. |
| 1267 | * |
| 1268 | * @return Returns true if a new permission was created, false if an |
| 1269 | * existing one was updated. |
| 1270 | * |
| 1271 | * @throws SecurityException if you are not allowed to add the |
| 1272 | * given permission name. |
| 1273 | * |
| 1274 | * @see #removePermission(String) |
| 1275 | */ |
| 1276 | public abstract boolean addPermission(PermissionInfo info); |
| 1277 | |
| 1278 | /** |
Dianne Hackborn | d7c0968 | 2010-03-30 10:42:20 -0700 | [diff] [blame] | 1279 | * Like {@link #addPermission(PermissionInfo)} but asynchronously |
| 1280 | * persists the package manager state after returning from the call, |
| 1281 | * allowing it to return quicker and batch a series of adds at the |
| 1282 | * expense of no guarantee the added permission will be retained if |
| 1283 | * the device is rebooted before it is written. |
| 1284 | */ |
| 1285 | public abstract boolean addPermissionAsync(PermissionInfo info); |
| 1286 | |
| 1287 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1288 | * Removes a permission that was previously added with |
| 1289 | * {@link #addPermission(PermissionInfo)}. The same ownership rules apply |
| 1290 | * -- you are only allowed to remove permissions that you are allowed |
| 1291 | * to add. |
| 1292 | * |
| 1293 | * @param name The name of the permission to remove. |
| 1294 | * |
| 1295 | * @throws SecurityException if you are not allowed to remove the |
| 1296 | * given permission name. |
| 1297 | * |
| 1298 | * @see #addPermission(PermissionInfo) |
| 1299 | */ |
| 1300 | public abstract void removePermission(String name); |
| 1301 | |
| 1302 | /** |
| 1303 | * Compare the signatures of two packages to determine if the same |
| 1304 | * signature appears in both of them. If they do contain the same |
| 1305 | * signature, then they are allowed special privileges when working |
| 1306 | * with each other: they can share the same user-id, run instrumentation |
| 1307 | * against each other, etc. |
| 1308 | * |
| 1309 | * @param pkg1 First package name whose signature will be compared. |
| 1310 | * @param pkg2 Second package name whose signature will be compared. |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 1311 | * |
| 1312 | * @return Returns an integer indicating whether all signatures on the |
| 1313 | * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if |
| 1314 | * all signatures match or < 0 if there is not a match ({@link |
| 1315 | * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}). |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1316 | * |
Dianne Hackborn | 766cbfe | 2009-08-12 18:33:39 -0700 | [diff] [blame] | 1317 | * @see #checkSignatures(int, int) |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1318 | * @see #SIGNATURE_MATCH |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1319 | * @see #SIGNATURE_NO_MATCH |
| 1320 | * @see #SIGNATURE_UNKNOWN_PACKAGE |
| 1321 | */ |
| 1322 | public abstract int checkSignatures(String pkg1, String pkg2); |
| 1323 | |
| 1324 | /** |
Dianne Hackborn | 766cbfe | 2009-08-12 18:33:39 -0700 | [diff] [blame] | 1325 | * Like {@link #checkSignatures(String, String)}, but takes UIDs of |
| 1326 | * the two packages to be checked. This can be useful, for example, |
| 1327 | * when doing the check in an IPC, where the UID is the only identity |
| 1328 | * available. It is functionally identical to determining the package |
| 1329 | * associated with the UIDs and checking their signatures. |
| 1330 | * |
Joe Onorato | 25660ec | 2009-08-12 22:40:37 -0700 | [diff] [blame] | 1331 | * @param uid1 First UID whose signature will be compared. |
| 1332 | * @param uid2 Second UID whose signature will be compared. |
Dianne Hackborn | 766cbfe | 2009-08-12 18:33:39 -0700 | [diff] [blame] | 1333 | * |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 1334 | * @return Returns an integer indicating whether all signatures on the |
| 1335 | * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if |
| 1336 | * all signatures match or < 0 if there is not a match ({@link |
| 1337 | * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}). |
| 1338 | * |
| 1339 | * @see #checkSignatures(String, String) |
Dianne Hackborn | 766cbfe | 2009-08-12 18:33:39 -0700 | [diff] [blame] | 1340 | * @see #SIGNATURE_MATCH |
Dianne Hackborn | 766cbfe | 2009-08-12 18:33:39 -0700 | [diff] [blame] | 1341 | * @see #SIGNATURE_NO_MATCH |
| 1342 | * @see #SIGNATURE_UNKNOWN_PACKAGE |
| 1343 | */ |
| 1344 | public abstract int checkSignatures(int uid1, int uid2); |
| 1345 | |
| 1346 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1347 | * Retrieve the names of all packages that are associated with a particular |
| 1348 | * user id. In most cases, this will be a single package name, the package |
| 1349 | * that has been assigned that user id. Where there are multiple packages |
| 1350 | * sharing the same user id through the "sharedUserId" mechanism, all |
| 1351 | * packages with that id will be returned. |
| 1352 | * |
| 1353 | * @param uid The user id for which you would like to retrieve the |
| 1354 | * associated packages. |
| 1355 | * |
| 1356 | * @return Returns an array of one or more packages assigned to the user |
| 1357 | * id, or null if there are no known packages with the given id. |
| 1358 | */ |
| 1359 | public abstract String[] getPackagesForUid(int uid); |
| 1360 | |
| 1361 | /** |
| 1362 | * Retrieve the official name associated with a user id. This name is |
| 1363 | * guaranteed to never change, though it is possibly for the underlying |
| 1364 | * user id to be changed. That is, if you are storing information about |
| 1365 | * user ids in persistent storage, you should use the string returned |
| 1366 | * by this function instead of the raw user-id. |
| 1367 | * |
| 1368 | * @param uid The user id for which you would like to retrieve a name. |
| 1369 | * @return Returns a unique name for the given user id, or null if the |
| 1370 | * user id is not currently assigned. |
| 1371 | */ |
| 1372 | public abstract String getNameForUid(int uid); |
| 1373 | |
| 1374 | /** |
| 1375 | * Return the user id associated with a shared user name. Multiple |
| 1376 | * applications can specify a shared user name in their manifest and thus |
| 1377 | * end up using a common uid. This might be used for new applications |
| 1378 | * that use an existing shared user name and need to know the uid of the |
| 1379 | * shared user. |
| 1380 | * |
| 1381 | * @param sharedUserName The shared user name whose uid is to be retrieved. |
| 1382 | * @return Returns the uid associated with the shared user, or NameNotFoundException |
| 1383 | * if the shared user name is not being used by any installed packages |
| 1384 | * @hide |
| 1385 | */ |
| 1386 | public abstract int getUidForSharedUser(String sharedUserName) |
| 1387 | throws NameNotFoundException; |
| 1388 | |
| 1389 | /** |
| 1390 | * Return a List of all application packages that are installed on the |
| 1391 | * device. If flag GET_UNINSTALLED_PACKAGES has been set, a list of all |
| 1392 | * applications including those deleted with DONT_DELETE_DATA(partially |
| 1393 | * installed apps with data directory) will be returned. |
| 1394 | * |
| 1395 | * @param flags Additional option flags. Use any combination of |
| 1396 | * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, |
| 1397 | * {link #GET_UNINSTALLED_PACKAGES} to modify the data returned. |
| 1398 | * |
| 1399 | * @return A List of ApplicationInfo objects, one for each application that |
| 1400 | * is installed on the device. In the unlikely case of there being |
| 1401 | * no installed applications, an empty list is returned. |
| 1402 | * If flag GET_UNINSTALLED_PACKAGES is set, a list of all |
| 1403 | * applications including those deleted with DONT_DELETE_DATA |
| 1404 | * (partially installed apps with data directory) will be returned. |
| 1405 | * |
| 1406 | * @see #GET_META_DATA |
| 1407 | * @see #GET_SHARED_LIBRARY_FILES |
| 1408 | * @see #GET_UNINSTALLED_PACKAGES |
| 1409 | */ |
| 1410 | public abstract List<ApplicationInfo> getInstalledApplications(int flags); |
| 1411 | |
| 1412 | /** |
| 1413 | * Get a list of shared libraries that are available on the |
| 1414 | * system. |
| 1415 | * |
| 1416 | * @return An array of shared library names that are |
| 1417 | * available on the system, or null if none are installed. |
| 1418 | * |
| 1419 | */ |
| 1420 | public abstract String[] getSystemSharedLibraryNames(); |
| 1421 | |
| 1422 | /** |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 1423 | * Get a list of features that are available on the |
| 1424 | * system. |
| 1425 | * |
| 1426 | * @return An array of FeatureInfo classes describing the features |
| 1427 | * that are available on the system, or null if there are none(!!). |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 1428 | */ |
| 1429 | public abstract FeatureInfo[] getSystemAvailableFeatures(); |
| 1430 | |
| 1431 | /** |
Dianne Hackborn | 039c68e | 2009-09-26 16:39:23 -0700 | [diff] [blame] | 1432 | * Check whether the given feature name is one of the available |
| 1433 | * features as returned by {@link #getSystemAvailableFeatures()}. |
| 1434 | * |
| 1435 | * @return Returns true if the devices supports the feature, else |
| 1436 | * false. |
| 1437 | */ |
| 1438 | public abstract boolean hasSystemFeature(String name); |
| 1439 | |
| 1440 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1441 | * Determine the best action to perform for a given Intent. This is how |
| 1442 | * {@link Intent#resolveActivity} finds an activity if a class has not |
| 1443 | * been explicitly specified. |
| 1444 | * |
Scott Main | ef6b305 | 2011-03-23 14:23:02 -0700 | [diff] [blame] | 1445 | * <p><em>Note:</em> if using an implicit Intent (without an explicit ComponentName |
Dianne Hackborn | 4d023d21 | 2010-10-01 13:41:04 -0700 | [diff] [blame] | 1446 | * specified), be sure to consider whether to set the {@link #MATCH_DEFAULT_ONLY} |
| 1447 | * only flag. You need to do so to resolve the activity in the same way |
| 1448 | * that {@link android.content.Context#startActivity(Intent)} and |
| 1449 | * {@link android.content.Intent#resolveActivity(PackageManager) |
| 1450 | * Intent.resolveActivity(PackageManager)} do.</p> |
| 1451 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1452 | * @param intent An intent containing all of the desired specification |
| 1453 | * (action, data, type, category, and/or component). |
| 1454 | * @param flags Additional option flags. The most important is |
Dianne Hackborn | 4d023d21 | 2010-10-01 13:41:04 -0700 | [diff] [blame] | 1455 | * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only |
| 1456 | * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1457 | * |
| 1458 | * @return Returns a ResolveInfo containing the final activity intent that |
| 1459 | * was determined to be the best action. Returns null if no |
Mike LeBeau | bd3f527 | 2010-02-18 19:27:17 -0800 | [diff] [blame] | 1460 | * matching activity was found. If multiple matching activities are |
| 1461 | * found and there is no default set, returns a ResolveInfo |
| 1462 | * containing something else, such as the activity resolver. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1463 | * |
| 1464 | * @see #MATCH_DEFAULT_ONLY |
| 1465 | * @see #GET_INTENT_FILTERS |
| 1466 | * @see #GET_RESOLVED_FILTER |
| 1467 | */ |
| 1468 | public abstract ResolveInfo resolveActivity(Intent intent, int flags); |
| 1469 | |
| 1470 | /** |
| 1471 | * Retrieve all activities that can be performed for the given intent. |
| 1472 | * |
| 1473 | * @param intent The desired intent as per resolveActivity(). |
| 1474 | * @param flags Additional option flags. The most important is |
Dianne Hackborn | 4d023d21 | 2010-10-01 13:41:04 -0700 | [diff] [blame] | 1475 | * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only |
| 1476 | * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1477 | * |
Dianne Hackborn | 4d023d21 | 2010-10-01 13:41:04 -0700 | [diff] [blame] | 1478 | * @return A List<ResolveInfo> containing one entry for each matching |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1479 | * Activity. These are ordered from best to worst match -- that |
| 1480 | * is, the first item in the list is what is returned by |
Dianne Hackborn | 4d023d21 | 2010-10-01 13:41:04 -0700 | [diff] [blame] | 1481 | * {@link #resolveActivity}. If there are no matching activities, an empty |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1482 | * list is returned. |
| 1483 | * |
| 1484 | * @see #MATCH_DEFAULT_ONLY |
| 1485 | * @see #GET_INTENT_FILTERS |
| 1486 | * @see #GET_RESOLVED_FILTER |
| 1487 | */ |
| 1488 | public abstract List<ResolveInfo> queryIntentActivities(Intent intent, |
| 1489 | int flags); |
| 1490 | |
| 1491 | /** |
| 1492 | * Retrieve a set of activities that should be presented to the user as |
| 1493 | * similar options. This is like {@link #queryIntentActivities}, except it |
| 1494 | * also allows you to supply a list of more explicit Intents that you would |
| 1495 | * like to resolve to particular options, and takes care of returning the |
| 1496 | * final ResolveInfo list in a reasonable order, with no duplicates, based |
| 1497 | * on those inputs. |
| 1498 | * |
| 1499 | * @param caller The class name of the activity that is making the |
| 1500 | * request. This activity will never appear in the output |
| 1501 | * list. Can be null. |
| 1502 | * @param specifics An array of Intents that should be resolved to the |
| 1503 | * first specific results. Can be null. |
| 1504 | * @param intent The desired intent as per resolveActivity(). |
| 1505 | * @param flags Additional option flags. The most important is |
Dianne Hackborn | 4d023d21 | 2010-10-01 13:41:04 -0700 | [diff] [blame] | 1506 | * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only |
| 1507 | * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1508 | * |
Dianne Hackborn | 4d023d21 | 2010-10-01 13:41:04 -0700 | [diff] [blame] | 1509 | * @return A List<ResolveInfo> containing one entry for each matching |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1510 | * Activity. These are ordered first by all of the intents resolved |
| 1511 | * in <var>specifics</var> and then any additional activities that |
| 1512 | * can handle <var>intent</var> but did not get included by one of |
| 1513 | * the <var>specifics</var> intents. If there are no matching |
| 1514 | * activities, an empty list is returned. |
| 1515 | * |
| 1516 | * @see #MATCH_DEFAULT_ONLY |
| 1517 | * @see #GET_INTENT_FILTERS |
| 1518 | * @see #GET_RESOLVED_FILTER |
| 1519 | */ |
| 1520 | public abstract List<ResolveInfo> queryIntentActivityOptions( |
| 1521 | ComponentName caller, Intent[] specifics, Intent intent, int flags); |
| 1522 | |
| 1523 | /** |
| 1524 | * Retrieve all receivers that can handle a broadcast of the given intent. |
| 1525 | * |
| 1526 | * @param intent The desired intent as per resolveActivity(). |
Dianne Hackborn | 4d023d21 | 2010-10-01 13:41:04 -0700 | [diff] [blame] | 1527 | * @param flags Additional option flags. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1528 | * |
Dianne Hackborn | 4d023d21 | 2010-10-01 13:41:04 -0700 | [diff] [blame] | 1529 | * @return A List<ResolveInfo> containing one entry for each matching |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1530 | * Receiver. These are ordered from first to last in priority. If |
| 1531 | * there are no matching receivers, an empty list is returned. |
| 1532 | * |
| 1533 | * @see #MATCH_DEFAULT_ONLY |
| 1534 | * @see #GET_INTENT_FILTERS |
| 1535 | * @see #GET_RESOLVED_FILTER |
| 1536 | */ |
| 1537 | public abstract List<ResolveInfo> queryBroadcastReceivers(Intent intent, |
| 1538 | int flags); |
| 1539 | |
| 1540 | /** |
| 1541 | * Determine the best service to handle for a given Intent. |
| 1542 | * |
| 1543 | * @param intent An intent containing all of the desired specification |
| 1544 | * (action, data, type, category, and/or component). |
| 1545 | * @param flags Additional option flags. |
| 1546 | * |
| 1547 | * @return Returns a ResolveInfo containing the final service intent that |
| 1548 | * was determined to be the best action. Returns null if no |
| 1549 | * matching service was found. |
| 1550 | * |
| 1551 | * @see #GET_INTENT_FILTERS |
| 1552 | * @see #GET_RESOLVED_FILTER |
| 1553 | */ |
| 1554 | public abstract ResolveInfo resolveService(Intent intent, int flags); |
| 1555 | |
| 1556 | /** |
| 1557 | * Retrieve all services that can match the given intent. |
| 1558 | * |
| 1559 | * @param intent The desired intent as per resolveService(). |
| 1560 | * @param flags Additional option flags. |
| 1561 | * |
Dianne Hackborn | 4d023d21 | 2010-10-01 13:41:04 -0700 | [diff] [blame] | 1562 | * @return A List<ResolveInfo> containing one entry for each matching |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1563 | * ServiceInfo. These are ordered from best to worst match -- that |
| 1564 | * is, the first item in the list is what is returned by |
| 1565 | * resolveService(). If there are no matching services, an empty |
| 1566 | * list is returned. |
| 1567 | * |
| 1568 | * @see #GET_INTENT_FILTERS |
| 1569 | * @see #GET_RESOLVED_FILTER |
| 1570 | */ |
| 1571 | public abstract List<ResolveInfo> queryIntentServices(Intent intent, |
| 1572 | int flags); |
| 1573 | |
| 1574 | /** |
| 1575 | * Find a single content provider by its base path name. |
| 1576 | * |
| 1577 | * @param name The name of the provider to find. |
| 1578 | * @param flags Additional option flags. Currently should always be 0. |
| 1579 | * |
| 1580 | * @return ContentProviderInfo Information about the provider, if found, |
| 1581 | * else null. |
| 1582 | */ |
| 1583 | public abstract ProviderInfo resolveContentProvider(String name, |
| 1584 | int flags); |
| 1585 | |
| 1586 | /** |
| 1587 | * Retrieve content provider information. |
| 1588 | * |
| 1589 | * <p><em>Note: unlike most other methods, an empty result set is indicated |
| 1590 | * by a null return instead of an empty list.</em> |
| 1591 | * |
| 1592 | * @param processName If non-null, limits the returned providers to only |
| 1593 | * those that are hosted by the given process. If null, |
| 1594 | * all content providers are returned. |
| 1595 | * @param uid If <var>processName</var> is non-null, this is the required |
| 1596 | * uid owning the requested content providers. |
| 1597 | * @param flags Additional option flags. Currently should always be 0. |
| 1598 | * |
Dianne Hackborn | 4d023d21 | 2010-10-01 13:41:04 -0700 | [diff] [blame] | 1599 | * @return A List<ContentProviderInfo> containing one entry for each |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1600 | * content provider either patching <var>processName</var> or, if |
| 1601 | * <var>processName</var> is null, all known content providers. |
| 1602 | * <em>If there are no matching providers, null is returned.</em> |
| 1603 | */ |
| 1604 | public abstract List<ProviderInfo> queryContentProviders( |
| 1605 | String processName, int uid, int flags); |
| 1606 | |
| 1607 | /** |
| 1608 | * Retrieve all of the information we know about a particular |
| 1609 | * instrumentation class. |
| 1610 | * |
| 1611 | * <p>Throws {@link NameNotFoundException} if instrumentation with the |
| 1612 | * given class name can not be found on the system. |
| 1613 | * |
| 1614 | * @param className The full name (i.e. |
| 1615 | * com.google.apps.contacts.InstrumentList) of an |
| 1616 | * Instrumentation class. |
| 1617 | * @param flags Additional option flags. Currently should always be 0. |
| 1618 | * |
| 1619 | * @return InstrumentationInfo containing information about the |
| 1620 | * instrumentation. |
| 1621 | */ |
| 1622 | public abstract InstrumentationInfo getInstrumentationInfo( |
| 1623 | ComponentName className, int flags) throws NameNotFoundException; |
| 1624 | |
| 1625 | /** |
| 1626 | * Retrieve information about available instrumentation code. May be used |
| 1627 | * to retrieve either all instrumentation code, or only the code targeting |
| 1628 | * a particular package. |
| 1629 | * |
| 1630 | * @param targetPackage If null, all instrumentation is returned; only the |
| 1631 | * instrumentation targeting this package name is |
| 1632 | * returned. |
| 1633 | * @param flags Additional option flags. Currently should always be 0. |
| 1634 | * |
Dianne Hackborn | 4d023d21 | 2010-10-01 13:41:04 -0700 | [diff] [blame] | 1635 | * @return A List<InstrumentationInfo> containing one entry for each |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1636 | * matching available Instrumentation. Returns an empty list if |
| 1637 | * there is no instrumentation available for the given package. |
| 1638 | */ |
| 1639 | public abstract List<InstrumentationInfo> queryInstrumentation( |
| 1640 | String targetPackage, int flags); |
| 1641 | |
| 1642 | /** |
| 1643 | * Retrieve an image from a package. This is a low-level API used by |
| 1644 | * the various package manager info structures (such as |
| 1645 | * {@link ComponentInfo} to implement retrieval of their associated |
| 1646 | * icon. |
| 1647 | * |
| 1648 | * @param packageName The name of the package that this icon is coming from. |
| 1649 | * Can not be null. |
| 1650 | * @param resid The resource identifier of the desired image. Can not be 0. |
| 1651 | * @param appInfo Overall information about <var>packageName</var>. This |
| 1652 | * may be null, in which case the application information will be retrieved |
| 1653 | * for you if needed; if you already have this information around, it can |
| 1654 | * be much more efficient to supply it here. |
| 1655 | * |
| 1656 | * @return Returns a Drawable holding the requested image. Returns null if |
| 1657 | * an image could not be found for any reason. |
| 1658 | */ |
| 1659 | public abstract Drawable getDrawable(String packageName, int resid, |
| 1660 | ApplicationInfo appInfo); |
| 1661 | |
| 1662 | /** |
| 1663 | * Retrieve the icon associated with an activity. Given the full name of |
| 1664 | * an activity, retrieves the information about it and calls |
| 1665 | * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its icon. |
| 1666 | * If the activity can not be found, NameNotFoundException is thrown. |
| 1667 | * |
| 1668 | * @param activityName Name of the activity whose icon is to be retrieved. |
| 1669 | * |
| 1670 | * @return Returns the image of the icon, or the default activity icon if |
| 1671 | * it could not be found. Does not return null. |
| 1672 | * @throws NameNotFoundException Thrown if the resources for the given |
| 1673 | * activity could not be loaded. |
| 1674 | * |
| 1675 | * @see #getActivityIcon(Intent) |
| 1676 | */ |
| 1677 | public abstract Drawable getActivityIcon(ComponentName activityName) |
| 1678 | throws NameNotFoundException; |
| 1679 | |
| 1680 | /** |
| 1681 | * Retrieve the icon associated with an Intent. If intent.getClassName() is |
| 1682 | * set, this simply returns the result of |
| 1683 | * getActivityIcon(intent.getClassName()). Otherwise it resolves the intent's |
| 1684 | * component and returns the icon associated with the resolved component. |
| 1685 | * If intent.getClassName() can not be found or the Intent can not be resolved |
| 1686 | * to a component, NameNotFoundException is thrown. |
| 1687 | * |
| 1688 | * @param intent The intent for which you would like to retrieve an icon. |
| 1689 | * |
| 1690 | * @return Returns the image of the icon, or the default activity icon if |
| 1691 | * it could not be found. Does not return null. |
| 1692 | * @throws NameNotFoundException Thrown if the resources for application |
| 1693 | * matching the given intent could not be loaded. |
| 1694 | * |
| 1695 | * @see #getActivityIcon(ComponentName) |
| 1696 | */ |
| 1697 | public abstract Drawable getActivityIcon(Intent intent) |
| 1698 | throws NameNotFoundException; |
| 1699 | |
| 1700 | /** |
| 1701 | * Return the generic icon for an activity that is used when no specific |
| 1702 | * icon is defined. |
| 1703 | * |
| 1704 | * @return Drawable Image of the icon. |
| 1705 | */ |
| 1706 | public abstract Drawable getDefaultActivityIcon(); |
| 1707 | |
| 1708 | /** |
| 1709 | * Retrieve the icon associated with an application. If it has not defined |
| 1710 | * an icon, the default app icon is returned. Does not return null. |
| 1711 | * |
| 1712 | * @param info Information about application being queried. |
| 1713 | * |
| 1714 | * @return Returns the image of the icon, or the default application icon |
| 1715 | * if it could not be found. |
| 1716 | * |
| 1717 | * @see #getApplicationIcon(String) |
| 1718 | */ |
| 1719 | public abstract Drawable getApplicationIcon(ApplicationInfo info); |
| 1720 | |
| 1721 | /** |
| 1722 | * Retrieve the icon associated with an application. Given the name of the |
| 1723 | * application's package, retrieves the information about it and calls |
| 1724 | * getApplicationIcon() to return its icon. If the application can not be |
| 1725 | * found, NameNotFoundException is thrown. |
| 1726 | * |
| 1727 | * @param packageName Name of the package whose application icon is to be |
| 1728 | * retrieved. |
| 1729 | * |
| 1730 | * @return Returns the image of the icon, or the default application icon |
| 1731 | * if it could not be found. Does not return null. |
| 1732 | * @throws NameNotFoundException Thrown if the resources for the given |
| 1733 | * application could not be loaded. |
| 1734 | * |
| 1735 | * @see #getApplicationIcon(ApplicationInfo) |
| 1736 | */ |
| 1737 | public abstract Drawable getApplicationIcon(String packageName) |
| 1738 | throws NameNotFoundException; |
| 1739 | |
| 1740 | /** |
Adam Powell | 81cd2e9 | 2010-04-21 16:35:18 -0700 | [diff] [blame] | 1741 | * Retrieve the logo associated with an activity. Given the full name of |
| 1742 | * an activity, retrieves the information about it and calls |
| 1743 | * {@link ComponentInfo#loadLogo ComponentInfo.loadLogo()} to return its logo. |
| 1744 | * If the activity can not be found, NameNotFoundException is thrown. |
| 1745 | * |
| 1746 | * @param activityName Name of the activity whose logo is to be retrieved. |
| 1747 | * |
| 1748 | * @return Returns the image of the logo or null if the activity has no |
| 1749 | * logo specified. |
| 1750 | * |
| 1751 | * @throws NameNotFoundException Thrown if the resources for the given |
| 1752 | * activity could not be loaded. |
| 1753 | * |
| 1754 | * @see #getActivityLogo(Intent) |
| 1755 | */ |
| 1756 | public abstract Drawable getActivityLogo(ComponentName activityName) |
| 1757 | throws NameNotFoundException; |
| 1758 | |
| 1759 | /** |
| 1760 | * Retrieve the logo associated with an Intent. If intent.getClassName() is |
| 1761 | * set, this simply returns the result of |
| 1762 | * getActivityLogo(intent.getClassName()). Otherwise it resolves the intent's |
| 1763 | * component and returns the logo associated with the resolved component. |
| 1764 | * If intent.getClassName() can not be found or the Intent can not be resolved |
| 1765 | * to a component, NameNotFoundException is thrown. |
| 1766 | * |
| 1767 | * @param intent The intent for which you would like to retrieve a logo. |
| 1768 | * |
| 1769 | * @return Returns the image of the logo, or null if the activity has no |
| 1770 | * logo specified. |
| 1771 | * |
| 1772 | * @throws NameNotFoundException Thrown if the resources for application |
| 1773 | * matching the given intent could not be loaded. |
| 1774 | * |
| 1775 | * @see #getActivityLogo(ComponentName) |
| 1776 | */ |
| 1777 | public abstract Drawable getActivityLogo(Intent intent) |
| 1778 | throws NameNotFoundException; |
| 1779 | |
| 1780 | /** |
| 1781 | * Retrieve the logo associated with an application. If it has not specified |
| 1782 | * a logo, this method returns null. |
| 1783 | * |
| 1784 | * @param info Information about application being queried. |
| 1785 | * |
| 1786 | * @return Returns the image of the logo, or null if no logo is specified |
| 1787 | * by the application. |
| 1788 | * |
| 1789 | * @see #getApplicationLogo(String) |
| 1790 | */ |
| 1791 | public abstract Drawable getApplicationLogo(ApplicationInfo info); |
| 1792 | |
| 1793 | /** |
| 1794 | * Retrieve the logo associated with an application. Given the name of the |
| 1795 | * application's package, retrieves the information about it and calls |
| 1796 | * getApplicationLogo() to return its logo. If the application can not be |
| 1797 | * found, NameNotFoundException is thrown. |
| 1798 | * |
| 1799 | * @param packageName Name of the package whose application logo is to be |
| 1800 | * retrieved. |
| 1801 | * |
| 1802 | * @return Returns the image of the logo, or null if no application logo |
| 1803 | * has been specified. |
| 1804 | * |
| 1805 | * @throws NameNotFoundException Thrown if the resources for the given |
| 1806 | * application could not be loaded. |
| 1807 | * |
| 1808 | * @see #getApplicationLogo(ApplicationInfo) |
| 1809 | */ |
| 1810 | public abstract Drawable getApplicationLogo(String packageName) |
| 1811 | throws NameNotFoundException; |
| 1812 | |
| 1813 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1814 | * Retrieve text from a package. This is a low-level API used by |
| 1815 | * the various package manager info structures (such as |
| 1816 | * {@link ComponentInfo} to implement retrieval of their associated |
| 1817 | * labels and other text. |
| 1818 | * |
| 1819 | * @param packageName The name of the package that this text is coming from. |
| 1820 | * Can not be null. |
| 1821 | * @param resid The resource identifier of the desired text. Can not be 0. |
| 1822 | * @param appInfo Overall information about <var>packageName</var>. This |
| 1823 | * may be null, in which case the application information will be retrieved |
| 1824 | * for you if needed; if you already have this information around, it can |
| 1825 | * be much more efficient to supply it here. |
| 1826 | * |
| 1827 | * @return Returns a CharSequence holding the requested text. Returns null |
| 1828 | * if the text could not be found for any reason. |
| 1829 | */ |
| 1830 | public abstract CharSequence getText(String packageName, int resid, |
| 1831 | ApplicationInfo appInfo); |
| 1832 | |
| 1833 | /** |
| 1834 | * Retrieve an XML file from a package. This is a low-level API used to |
| 1835 | * retrieve XML meta data. |
| 1836 | * |
| 1837 | * @param packageName The name of the package that this xml is coming from. |
| 1838 | * Can not be null. |
| 1839 | * @param resid The resource identifier of the desired xml. Can not be 0. |
| 1840 | * @param appInfo Overall information about <var>packageName</var>. This |
| 1841 | * may be null, in which case the application information will be retrieved |
| 1842 | * for you if needed; if you already have this information around, it can |
| 1843 | * be much more efficient to supply it here. |
| 1844 | * |
| 1845 | * @return Returns an XmlPullParser allowing you to parse out the XML |
| 1846 | * data. Returns null if the xml resource could not be found for any |
| 1847 | * reason. |
| 1848 | */ |
| 1849 | public abstract XmlResourceParser getXml(String packageName, int resid, |
| 1850 | ApplicationInfo appInfo); |
| 1851 | |
| 1852 | /** |
| 1853 | * Return the label to use for this application. |
| 1854 | * |
| 1855 | * @return Returns the label associated with this application, or null if |
| 1856 | * it could not be found for any reason. |
| 1857 | * @param info The application to get the label of |
| 1858 | */ |
| 1859 | public abstract CharSequence getApplicationLabel(ApplicationInfo info); |
| 1860 | |
| 1861 | /** |
| 1862 | * Retrieve the resources associated with an activity. Given the full |
| 1863 | * name of an activity, retrieves the information about it and calls |
| 1864 | * getResources() to return its application's resources. If the activity |
| 1865 | * can not be found, NameNotFoundException is thrown. |
| 1866 | * |
| 1867 | * @param activityName Name of the activity whose resources are to be |
| 1868 | * retrieved. |
| 1869 | * |
| 1870 | * @return Returns the application's Resources. |
| 1871 | * @throws NameNotFoundException Thrown if the resources for the given |
| 1872 | * application could not be loaded. |
| 1873 | * |
| 1874 | * @see #getResourcesForApplication(ApplicationInfo) |
| 1875 | */ |
| 1876 | public abstract Resources getResourcesForActivity(ComponentName activityName) |
| 1877 | throws NameNotFoundException; |
| 1878 | |
| 1879 | /** |
| 1880 | * Retrieve the resources for an application. Throws NameNotFoundException |
| 1881 | * if the package is no longer installed. |
| 1882 | * |
| 1883 | * @param app Information about the desired application. |
| 1884 | * |
| 1885 | * @return Returns the application's Resources. |
| 1886 | * @throws NameNotFoundException Thrown if the resources for the given |
| 1887 | * application could not be loaded (most likely because it was uninstalled). |
| 1888 | */ |
| 1889 | public abstract Resources getResourcesForApplication(ApplicationInfo app) |
| 1890 | throws NameNotFoundException; |
| 1891 | |
| 1892 | /** |
| 1893 | * Retrieve the resources associated with an application. Given the full |
| 1894 | * package name of an application, retrieves the information about it and |
| 1895 | * calls getResources() to return its application's resources. If the |
| 1896 | * appPackageName can not be found, NameNotFoundException is thrown. |
| 1897 | * |
| 1898 | * @param appPackageName Package name of the application whose resources |
| 1899 | * are to be retrieved. |
| 1900 | * |
| 1901 | * @return Returns the application's Resources. |
| 1902 | * @throws NameNotFoundException Thrown if the resources for the given |
| 1903 | * application could not be loaded. |
| 1904 | * |
| 1905 | * @see #getResourcesForApplication(ApplicationInfo) |
| 1906 | */ |
| 1907 | public abstract Resources getResourcesForApplication(String appPackageName) |
| 1908 | throws NameNotFoundException; |
| 1909 | |
| 1910 | /** |
| 1911 | * Retrieve overall information about an application package defined |
| 1912 | * in a package archive file |
| 1913 | * |
| 1914 | * @param archiveFilePath The path to the archive file |
| 1915 | * @param flags Additional option flags. Use any combination of |
| 1916 | * {@link #GET_ACTIVITIES}, |
| 1917 | * {@link #GET_GIDS}, |
| 1918 | * {@link #GET_CONFIGURATIONS}, |
| 1919 | * {@link #GET_INSTRUMENTATION}, |
| 1920 | * {@link #GET_PERMISSIONS}, |
| 1921 | * {@link #GET_PROVIDERS}, |
| 1922 | * {@link #GET_RECEIVERS}, |
| 1923 | * {@link #GET_SERVICES}, |
| 1924 | * {@link #GET_SIGNATURES}, to modify the data returned. |
| 1925 | * |
| 1926 | * @return Returns the information about the package. Returns |
| 1927 | * null if the package could not be successfully parsed. |
| 1928 | * |
| 1929 | * @see #GET_ACTIVITIES |
| 1930 | * @see #GET_GIDS |
| 1931 | * @see #GET_CONFIGURATIONS |
| 1932 | * @see #GET_INSTRUMENTATION |
| 1933 | * @see #GET_PERMISSIONS |
| 1934 | * @see #GET_PROVIDERS |
| 1935 | * @see #GET_RECEIVERS |
| 1936 | * @see #GET_SERVICES |
| 1937 | * @see #GET_SIGNATURES |
| 1938 | * |
| 1939 | */ |
| 1940 | public PackageInfo getPackageArchiveInfo(String archiveFilePath, int flags) { |
| 1941 | PackageParser packageParser = new PackageParser(archiveFilePath); |
| 1942 | DisplayMetrics metrics = new DisplayMetrics(); |
| 1943 | metrics.setToDefaults(); |
| 1944 | final File sourceFile = new File(archiveFilePath); |
| 1945 | PackageParser.Package pkg = packageParser.parsePackage( |
| 1946 | sourceFile, archiveFilePath, metrics, 0); |
| 1947 | if (pkg == null) { |
| 1948 | return null; |
| 1949 | } |
Dianne Hackborn | 78d688369 | 2010-10-07 01:12:46 -0700 | [diff] [blame] | 1950 | return PackageParser.generatePackageInfo(pkg, null, flags, 0, 0); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1951 | } |
| 1952 | |
| 1953 | /** |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1954 | * @hide |
| 1955 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1956 | * Install a package. Since this may take a little while, the result will |
| 1957 | * be posted back to the given observer. An installation will fail if the calling context |
| 1958 | * lacks the {@link android.Manifest.permission#INSTALL_PACKAGES} permission, if the |
| 1959 | * package named in the package file's manifest is already installed, or if there's no space |
| 1960 | * available on the device. |
| 1961 | * |
| 1962 | * @param packageURI The location of the package file to install. This can be a 'file:' or a |
| 1963 | * 'content:' URI. |
| 1964 | * @param observer An observer callback to get notified when the package installation is |
| 1965 | * complete. {@link IPackageInstallObserver#packageInstalled(String, int)} will be |
| 1966 | * called when that happens. observer may be null to indicate that no callback is desired. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1967 | * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK}, |
| 1968 | * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}. |
Jacek Surazski | 65e1317 | 2009-04-28 15:26:38 +0200 | [diff] [blame] | 1969 | * @param installerPackageName Optional package name of the application that is performing the |
| 1970 | * installation. This identifies which market the package came from. |
Jacek Surazski | 65e1317 | 2009-04-28 15:26:38 +0200 | [diff] [blame] | 1971 | */ |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1972 | public abstract void installPackage( |
Jacek Surazski | 65e1317 | 2009-04-28 15:26:38 +0200 | [diff] [blame] | 1973 | Uri packageURI, IPackageInstallObserver observer, int flags, |
| 1974 | String installerPackageName); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1975 | |
| 1976 | /** |
Dianne Hackborn | 880119b | 2010-11-18 22:26:40 -0800 | [diff] [blame] | 1977 | * Change the installer associated with a given package. There are limitations |
| 1978 | * on how the installer package can be changed; in particular: |
| 1979 | * <ul> |
| 1980 | * <li> A SecurityException will be thrown if <var>installerPackageName</var> |
| 1981 | * is not signed with the same certificate as the calling application. |
| 1982 | * <li> A SecurityException will be thrown if <var>targetPackage</var> already |
| 1983 | * has an installer package, and that installer package is not signed with |
| 1984 | * the same certificate as the calling application. |
| 1985 | * </ul> |
| 1986 | * |
| 1987 | * @param targetPackage The installed package whose installer will be changed. |
| 1988 | * @param installerPackageName The package name of the new installer. May be |
| 1989 | * null to clear the association. |
| 1990 | */ |
| 1991 | public abstract void setInstallerPackageName(String targetPackage, |
| 1992 | String installerPackageName); |
| 1993 | |
| 1994 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1995 | * Attempts to delete a package. Since this may take a little while, the result will |
| 1996 | * be posted back to the given observer. A deletion will fail if the calling context |
| 1997 | * lacks the {@link android.Manifest.permission#DELETE_PACKAGES} permission, if the |
| 1998 | * named package cannot be found, or if the named package is a "system package". |
| 1999 | * (TODO: include pointer to documentation on "system packages") |
| 2000 | * |
| 2001 | * @param packageName The name of the package to delete |
| 2002 | * @param observer An observer callback to get notified when the package deletion is |
| 2003 | * complete. {@link android.content.pm.IPackageDeleteObserver#packageDeleted(boolean)} will be |
| 2004 | * called when that happens. observer may be null to indicate that no callback is desired. |
| 2005 | * @param flags - possible values: {@link #DONT_DELETE_DATA} |
| 2006 | * |
| 2007 | * @hide |
| 2008 | */ |
| 2009 | public abstract void deletePackage( |
| 2010 | String packageName, IPackageDeleteObserver observer, int flags); |
Jacek Surazski | 65e1317 | 2009-04-28 15:26:38 +0200 | [diff] [blame] | 2011 | |
| 2012 | /** |
| 2013 | * Retrieve the package name of the application that installed a package. This identifies |
| 2014 | * which market the package came from. |
| 2015 | * |
| 2016 | * @param packageName The name of the package to query |
| 2017 | */ |
| 2018 | public abstract String getInstallerPackageName(String packageName); |
| 2019 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2020 | /** |
| 2021 | * Attempts to clear the user data directory of an application. |
| 2022 | * Since this may take a little while, the result will |
| 2023 | * be posted back to the given observer. A deletion will fail if the |
| 2024 | * named package cannot be found, or if the named package is a "system package". |
| 2025 | * |
| 2026 | * @param packageName The name of the package |
| 2027 | * @param observer An observer callback to get notified when the operation is finished |
| 2028 | * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)} |
| 2029 | * will be called when that happens. observer may be null to indicate that |
| 2030 | * no callback is desired. |
| 2031 | * |
| 2032 | * @hide |
| 2033 | */ |
| 2034 | public abstract void clearApplicationUserData(String packageName, |
| 2035 | IPackageDataObserver observer); |
| 2036 | /** |
| 2037 | * Attempts to delete the cache files associated with an application. |
| 2038 | * Since this may take a little while, the result will |
| 2039 | * be posted back to the given observer. A deletion will fail if the calling context |
| 2040 | * lacks the {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the |
| 2041 | * named package cannot be found, or if the named package is a "system package". |
| 2042 | * |
| 2043 | * @param packageName The name of the package to delete |
| 2044 | * @param observer An observer callback to get notified when the cache file deletion |
| 2045 | * is complete. |
| 2046 | * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)} |
| 2047 | * will be called when that happens. observer may be null to indicate that |
| 2048 | * no callback is desired. |
| 2049 | * |
| 2050 | * @hide |
| 2051 | */ |
| 2052 | public abstract void deleteApplicationCacheFiles(String packageName, |
| 2053 | IPackageDataObserver observer); |
| 2054 | |
| 2055 | /** |
| 2056 | * Free storage by deleting LRU sorted list of cache files across |
| 2057 | * all applications. If the currently available free storage |
| 2058 | * on the device is greater than or equal to the requested |
| 2059 | * free storage, no cache files are cleared. If the currently |
| 2060 | * available storage on the device is less than the requested |
| 2061 | * free storage, some or all of the cache files across |
| 2062 | * all applications are deleted (based on last accessed time) |
| 2063 | * to increase the free storage space on the device to |
| 2064 | * the requested value. There is no guarantee that clearing all |
| 2065 | * the cache files from all applications will clear up |
| 2066 | * enough storage to achieve the desired value. |
| 2067 | * @param freeStorageSize The number of bytes of storage to be |
| 2068 | * freed by the system. Say if freeStorageSize is XX, |
| 2069 | * and the current free storage is YY, |
| 2070 | * if XX is less than YY, just return. if not free XX-YY number |
| 2071 | * of bytes if possible. |
| 2072 | * @param observer call back used to notify when |
| 2073 | * the operation is completed |
| 2074 | * |
| 2075 | * @hide |
| 2076 | */ |
| 2077 | public abstract void freeStorageAndNotify(long freeStorageSize, IPackageDataObserver observer); |
Suchi Amalapurapu | 1ccac75 | 2009-06-12 10:09:58 -0700 | [diff] [blame] | 2078 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2079 | /** |
| 2080 | * Free storage by deleting LRU sorted list of cache files across |
| 2081 | * all applications. If the currently available free storage |
| 2082 | * on the device is greater than or equal to the requested |
| 2083 | * free storage, no cache files are cleared. If the currently |
| 2084 | * available storage on the device is less than the requested |
| 2085 | * free storage, some or all of the cache files across |
| 2086 | * all applications are deleted (based on last accessed time) |
| 2087 | * to increase the free storage space on the device to |
| 2088 | * the requested value. There is no guarantee that clearing all |
| 2089 | * the cache files from all applications will clear up |
| 2090 | * enough storage to achieve the desired value. |
| 2091 | * @param freeStorageSize The number of bytes of storage to be |
| 2092 | * freed by the system. Say if freeStorageSize is XX, |
| 2093 | * and the current free storage is YY, |
| 2094 | * if XX is less than YY, just return. if not free XX-YY number |
| 2095 | * of bytes if possible. |
Suchi Amalapurapu | 1ccac75 | 2009-06-12 10:09:58 -0700 | [diff] [blame] | 2096 | * @param pi IntentSender call back used to |
| 2097 | * notify when the operation is completed.May be null |
| 2098 | * to indicate that no call back is desired. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2099 | * |
| 2100 | * @hide |
| 2101 | */ |
Suchi Amalapurapu | bc806f6 | 2009-06-17 15:18:19 -0700 | [diff] [blame] | 2102 | public abstract void freeStorage(long freeStorageSize, IntentSender pi); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2103 | |
| 2104 | /** |
| 2105 | * Retrieve the size information for a package. |
| 2106 | * Since this may take a little while, the result will |
| 2107 | * be posted back to the given observer. The calling context |
| 2108 | * should have the {@link android.Manifest.permission#GET_PACKAGE_SIZE} permission. |
| 2109 | * |
| 2110 | * @param packageName The name of the package whose size information is to be retrieved |
| 2111 | * @param observer An observer callback to get notified when the operation |
| 2112 | * is complete. |
| 2113 | * {@link android.content.pm.IPackageStatsObserver#onGetStatsCompleted(PackageStats, boolean)} |
| 2114 | * The observer's callback is invoked with a PackageStats object(containing the |
| 2115 | * code, data and cache sizes of the package) and a boolean value representing |
| 2116 | * the status of the operation. observer may be null to indicate that |
| 2117 | * no callback is desired. |
| 2118 | * |
| 2119 | * @hide |
| 2120 | */ |
| 2121 | public abstract void getPackageSizeInfo(String packageName, |
| 2122 | IPackageStatsObserver observer); |
| 2123 | |
| 2124 | /** |
Dianne Hackborn | a7ca0e5 | 2009-12-01 14:31:55 -0800 | [diff] [blame] | 2125 | * @deprecated This function no longer does anything; it was an old |
| 2126 | * approach to managing preferred activities, which has been superceeded |
| 2127 | * (and conflicts with) the modern activity-based preferences. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2128 | */ |
Dianne Hackborn | a7ca0e5 | 2009-12-01 14:31:55 -0800 | [diff] [blame] | 2129 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2130 | public abstract void addPackageToPreferred(String packageName); |
| 2131 | |
| 2132 | /** |
Dianne Hackborn | a7ca0e5 | 2009-12-01 14:31:55 -0800 | [diff] [blame] | 2133 | * @deprecated This function no longer does anything; it was an old |
| 2134 | * approach to managing preferred activities, which has been superceeded |
| 2135 | * (and conflicts with) the modern activity-based preferences. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2136 | */ |
Dianne Hackborn | a7ca0e5 | 2009-12-01 14:31:55 -0800 | [diff] [blame] | 2137 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2138 | public abstract void removePackageFromPreferred(String packageName); |
| 2139 | |
| 2140 | /** |
| 2141 | * Retrieve the list of all currently configured preferred packages. The |
| 2142 | * first package on the list is the most preferred, the last is the |
| 2143 | * least preferred. |
| 2144 | * |
| 2145 | * @param flags Additional option flags. Use any combination of |
| 2146 | * {@link #GET_ACTIVITIES}, |
| 2147 | * {@link #GET_GIDS}, |
| 2148 | * {@link #GET_CONFIGURATIONS}, |
| 2149 | * {@link #GET_INSTRUMENTATION}, |
| 2150 | * {@link #GET_PERMISSIONS}, |
| 2151 | * {@link #GET_PROVIDERS}, |
| 2152 | * {@link #GET_RECEIVERS}, |
| 2153 | * {@link #GET_SERVICES}, |
| 2154 | * {@link #GET_SIGNATURES}, to modify the data returned. |
| 2155 | * |
| 2156 | * @return Returns a list of PackageInfo objects describing each |
| 2157 | * preferred application, in order of preference. |
| 2158 | * |
| 2159 | * @see #GET_ACTIVITIES |
| 2160 | * @see #GET_GIDS |
| 2161 | * @see #GET_CONFIGURATIONS |
| 2162 | * @see #GET_INSTRUMENTATION |
| 2163 | * @see #GET_PERMISSIONS |
| 2164 | * @see #GET_PROVIDERS |
| 2165 | * @see #GET_RECEIVERS |
| 2166 | * @see #GET_SERVICES |
| 2167 | * @see #GET_SIGNATURES |
| 2168 | */ |
| 2169 | public abstract List<PackageInfo> getPreferredPackages(int flags); |
| 2170 | |
| 2171 | /** |
Dianne Hackborn | 2ee89ea | 2010-03-10 18:27:09 -0800 | [diff] [blame] | 2172 | * @deprecated This is a protected API that should not have been available |
| 2173 | * to third party applications. It is the platform's responsibility for |
| 2174 | * assigning preferred activities and this can not be directly modified. |
| 2175 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2176 | * Add a new preferred activity mapping to the system. This will be used |
| 2177 | * to automatically select the given activity component when |
| 2178 | * {@link Context#startActivity(Intent) Context.startActivity()} finds |
| 2179 | * multiple matching activities and also matches the given filter. |
| 2180 | * |
| 2181 | * @param filter The set of intents under which this activity will be |
| 2182 | * made preferred. |
| 2183 | * @param match The IntentFilter match category that this preference |
| 2184 | * applies to. |
| 2185 | * @param set The set of activities that the user was picking from when |
| 2186 | * this preference was made. |
| 2187 | * @param activity The component name of the activity that is to be |
| 2188 | * preferred. |
| 2189 | */ |
Dianne Hackborn | 2ee89ea | 2010-03-10 18:27:09 -0800 | [diff] [blame] | 2190 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2191 | public abstract void addPreferredActivity(IntentFilter filter, int match, |
| 2192 | ComponentName[] set, ComponentName activity); |
| 2193 | |
| 2194 | /** |
Dianne Hackborn | 2ee89ea | 2010-03-10 18:27:09 -0800 | [diff] [blame] | 2195 | * @deprecated This is a protected API that should not have been available |
| 2196 | * to third party applications. It is the platform's responsibility for |
| 2197 | * assigning preferred activities and this can not be directly modified. |
| 2198 | * |
Satish Sampath | 8dbe612 | 2009-06-02 23:35:54 +0100 | [diff] [blame] | 2199 | * Replaces an existing preferred activity mapping to the system, and if that were not present |
| 2200 | * adds a new preferred activity. This will be used |
| 2201 | * to automatically select the given activity component when |
| 2202 | * {@link Context#startActivity(Intent) Context.startActivity()} finds |
| 2203 | * multiple matching activities and also matches the given filter. |
| 2204 | * |
| 2205 | * @param filter The set of intents under which this activity will be |
| 2206 | * made preferred. |
| 2207 | * @param match The IntentFilter match category that this preference |
| 2208 | * applies to. |
| 2209 | * @param set The set of activities that the user was picking from when |
| 2210 | * this preference was made. |
| 2211 | * @param activity The component name of the activity that is to be |
| 2212 | * preferred. |
| 2213 | * @hide |
| 2214 | */ |
Dianne Hackborn | 2ee89ea | 2010-03-10 18:27:09 -0800 | [diff] [blame] | 2215 | @Deprecated |
Satish Sampath | 8dbe612 | 2009-06-02 23:35:54 +0100 | [diff] [blame] | 2216 | public abstract void replacePreferredActivity(IntentFilter filter, int match, |
| 2217 | ComponentName[] set, ComponentName activity); |
| 2218 | |
| 2219 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2220 | * Remove all preferred activity mappings, previously added with |
| 2221 | * {@link #addPreferredActivity}, from the |
| 2222 | * system whose activities are implemented in the given package name. |
Dianne Hackborn | 2ee89ea | 2010-03-10 18:27:09 -0800 | [diff] [blame] | 2223 | * An application can only clear its own package(s). |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2224 | * |
| 2225 | * @param packageName The name of the package whose preferred activity |
| 2226 | * mappings are to be removed. |
| 2227 | */ |
| 2228 | public abstract void clearPackagePreferredActivities(String packageName); |
| 2229 | |
| 2230 | /** |
| 2231 | * Retrieve all preferred activities, previously added with |
| 2232 | * {@link #addPreferredActivity}, that are |
| 2233 | * currently registered with the system. |
| 2234 | * |
| 2235 | * @param outFilters A list in which to place the filters of all of the |
| 2236 | * preferred activities, or null for none. |
| 2237 | * @param outActivities A list in which to place the component names of |
| 2238 | * all of the preferred activities, or null for none. |
| 2239 | * @param packageName An option package in which you would like to limit |
| 2240 | * the list. If null, all activities will be returned; if non-null, only |
| 2241 | * those activities in the given package are returned. |
| 2242 | * |
| 2243 | * @return Returns the total number of registered preferred activities |
| 2244 | * (the number of distinct IntentFilter records, not the number of unique |
| 2245 | * activity components) that were found. |
| 2246 | */ |
| 2247 | public abstract int getPreferredActivities(List<IntentFilter> outFilters, |
| 2248 | List<ComponentName> outActivities, String packageName); |
| 2249 | |
| 2250 | /** |
| 2251 | * Set the enabled setting for a package component (activity, receiver, service, provider). |
| 2252 | * This setting will override any enabled state which may have been set by the component in its |
| 2253 | * manifest. |
| 2254 | * |
| 2255 | * @param componentName The component to enable |
| 2256 | * @param newState The new enabled state for the component. The legal values for this state |
| 2257 | * are: |
| 2258 | * {@link #COMPONENT_ENABLED_STATE_ENABLED}, |
| 2259 | * {@link #COMPONENT_ENABLED_STATE_DISABLED} |
| 2260 | * and |
| 2261 | * {@link #COMPONENT_ENABLED_STATE_DEFAULT} |
| 2262 | * The last one removes the setting, thereby restoring the component's state to |
| 2263 | * whatever was set in it's manifest (or enabled, by default). |
| 2264 | * @param flags Optional behavior flags: {@link #DONT_KILL_APP} or 0. |
| 2265 | */ |
| 2266 | public abstract void setComponentEnabledSetting(ComponentName componentName, |
| 2267 | int newState, int flags); |
| 2268 | |
| 2269 | |
| 2270 | /** |
| 2271 | * Return the the enabled setting for a package component (activity, |
| 2272 | * receiver, service, provider). This returns the last value set by |
| 2273 | * {@link #setComponentEnabledSetting(ComponentName, int, int)}; in most |
| 2274 | * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since |
| 2275 | * the value originally specified in the manifest has not been modified. |
| 2276 | * |
| 2277 | * @param componentName The component to retrieve. |
| 2278 | * @return Returns the current enabled state for the component. May |
| 2279 | * be one of {@link #COMPONENT_ENABLED_STATE_ENABLED}, |
| 2280 | * {@link #COMPONENT_ENABLED_STATE_DISABLED}, or |
| 2281 | * {@link #COMPONENT_ENABLED_STATE_DEFAULT}. The last one means the |
| 2282 | * component's enabled state is based on the original information in |
| 2283 | * the manifest as found in {@link ComponentInfo}. |
| 2284 | */ |
| 2285 | public abstract int getComponentEnabledSetting(ComponentName componentName); |
| 2286 | |
| 2287 | /** |
| 2288 | * Set the enabled setting for an application |
| 2289 | * This setting will override any enabled state which may have been set by the application in |
| 2290 | * its manifest. It also overrides the enabled state set in the manifest for any of the |
| 2291 | * application's components. It does not override any enabled state set by |
| 2292 | * {@link #setComponentEnabledSetting} for any of the application's components. |
| 2293 | * |
| 2294 | * @param packageName The package name of the application to enable |
| 2295 | * @param newState The new enabled state for the component. The legal values for this state |
| 2296 | * are: |
| 2297 | * {@link #COMPONENT_ENABLED_STATE_ENABLED}, |
| 2298 | * {@link #COMPONENT_ENABLED_STATE_DISABLED} |
| 2299 | * and |
| 2300 | * {@link #COMPONENT_ENABLED_STATE_DEFAULT} |
| 2301 | * The last one removes the setting, thereby restoring the applications's state to |
| 2302 | * whatever was set in its manifest (or enabled, by default). |
| 2303 | * @param flags Optional behavior flags: {@link #DONT_KILL_APP} or 0. |
| 2304 | */ |
| 2305 | public abstract void setApplicationEnabledSetting(String packageName, |
| 2306 | int newState, int flags); |
| 2307 | |
| 2308 | /** |
| 2309 | * Return the the enabled setting for an application. This returns |
| 2310 | * the last value set by |
| 2311 | * {@link #setApplicationEnabledSetting(String, int, int)}; in most |
| 2312 | * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since |
| 2313 | * the value originally specified in the manifest has not been modified. |
| 2314 | * |
| 2315 | * @param packageName The component to retrieve. |
| 2316 | * @return Returns the current enabled state for the component. May |
| 2317 | * be one of {@link #COMPONENT_ENABLED_STATE_ENABLED}, |
| 2318 | * {@link #COMPONENT_ENABLED_STATE_DISABLED}, or |
| 2319 | * {@link #COMPONENT_ENABLED_STATE_DEFAULT}. The last one means the |
| 2320 | * application's enabled state is based on the original information in |
| 2321 | * the manifest as found in {@link ComponentInfo}. |
| 2322 | */ |
| 2323 | public abstract int getApplicationEnabledSetting(String packageName); |
| 2324 | |
| 2325 | /** |
| 2326 | * Return whether the device has been booted into safe mode. |
| 2327 | */ |
| 2328 | public abstract boolean isSafeMode(); |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 2329 | |
| 2330 | /** |
| 2331 | * Attempts to move package resources from internal to external media or vice versa. |
| 2332 | * Since this may take a little while, the result will |
| 2333 | * be posted back to the given observer. This call may fail if the calling context |
| 2334 | * lacks the {@link android.Manifest.permission#MOVE_PACKAGE} permission, if the |
| 2335 | * named package cannot be found, or if the named package is a "system package". |
| 2336 | * |
| 2337 | * @param packageName The name of the package to delete |
| 2338 | * @param observer An observer callback to get notified when the package move is |
| 2339 | * complete. {@link android.content.pm.IPackageMoveObserver#packageMoved(boolean)} will be |
| 2340 | * called when that happens. observer may be null to indicate that no callback is desired. |
| 2341 | * @param flags To indicate install location {@link #MOVE_INTERNAL} or |
| 2342 | * {@link #MOVE_EXTERNAL_MEDIA} |
| 2343 | * |
| 2344 | * @hide |
| 2345 | */ |
| 2346 | public abstract void movePackage( |
| 2347 | String packageName, IPackageMoveObserver observer, int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2348 | } |