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 | |
Tor Norbye | 1c2bf03 | 2015-03-02 10:57:08 -0800 | [diff] [blame] | 19 | import android.annotation.CheckResult; |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 20 | import android.annotation.DrawableRes; |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 21 | import android.annotation.IntDef; |
Jeff Sharkey | 16c8e3f | 2014-07-24 17:08:17 -0700 | [diff] [blame] | 22 | import android.annotation.NonNull; |
Jeff Sharkey | e2d45be | 2015-04-15 17:14:12 -0700 | [diff] [blame] | 23 | import android.annotation.Nullable; |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 24 | import android.annotation.SdkConstant; |
| 25 | import android.annotation.SdkConstant.SdkConstantType; |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 26 | import android.annotation.StringRes; |
Jeff Sharkey | bb58067 | 2014-07-10 12:10:25 -0700 | [diff] [blame] | 27 | import android.annotation.SystemApi; |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 28 | import android.annotation.XmlRes; |
Jeff Sharkey | 6c0b9da | 2014-08-07 22:07:11 -0700 | [diff] [blame] | 29 | import android.app.PackageDeleteObserver; |
Christopher Tate | f1977b4 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 30 | import android.app.PackageInstallObserver; |
Amith Yamasani | 1d65327 | 2014-09-11 17:56:05 -0700 | [diff] [blame] | 31 | import android.app.admin.DevicePolicyManager; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 32 | import android.content.ComponentName; |
| 33 | import android.content.Context; |
| 34 | import android.content.Intent; |
| 35 | import android.content.IntentFilter; |
Suchi Amalapurapu | 1ccac75 | 2009-06-12 10:09:58 -0700 | [diff] [blame] | 36 | import android.content.IntentSender; |
Jeff Sharkey | c4858a2 | 2014-06-16 10:51:20 -0700 | [diff] [blame] | 37 | import android.content.pm.PackageParser.PackageParserException; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 38 | import android.content.res.Resources; |
| 39 | import android.content.res.XmlResourceParser; |
Svetoslav | c7d62f0 | 2014-09-04 15:39:54 -0700 | [diff] [blame] | 40 | import android.graphics.Rect; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 41 | import android.graphics.drawable.Drawable; |
| 42 | import android.net.Uri; |
Jeff Sharkey | bb58067 | 2014-07-10 12:10:25 -0700 | [diff] [blame] | 43 | import android.os.Bundle; |
Amith Yamasani | 742a671 | 2011-05-04 14:49:28 -0700 | [diff] [blame] | 44 | import android.os.Environment; |
Jeff Sharkey | 6c0b9da | 2014-08-07 22:07:11 -0700 | [diff] [blame] | 45 | import android.os.RemoteException; |
Dianne Hackborn | 0c38049 | 2012-08-20 17:23:30 -0700 | [diff] [blame] | 46 | import android.os.UserHandle; |
Jeff Sharkey | b2b9ab8 | 2015-04-05 21:10:42 -0700 | [diff] [blame] | 47 | import android.os.storage.VolumeInfo; |
Jeff Sharkey | b9f3674 | 2015-04-08 21:02:14 -0700 | [diff] [blame] | 48 | import android.text.TextUtils; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 49 | import android.util.AndroidException; |
Jeff Sharkey | b2b9ab8 | 2015-04-05 21:10:42 -0700 | [diff] [blame] | 50 | |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 51 | import com.android.internal.util.ArrayUtils; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 52 | |
| 53 | import java.io.File; |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 54 | import java.lang.annotation.Retention; |
| 55 | import java.lang.annotation.RetentionPolicy; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 56 | import java.util.List; |
| 57 | |
| 58 | /** |
| 59 | * Class for retrieving various kinds of information related to the application |
| 60 | * packages that are currently installed on the device. |
| 61 | * |
| 62 | * You can find this class through {@link Context#getPackageManager}. |
| 63 | */ |
| 64 | public abstract class PackageManager { |
| 65 | |
| 66 | /** |
| 67 | * This exception is thrown when a given package, application, or component |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 68 | * name cannot be found. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 69 | */ |
| 70 | public static class NameNotFoundException extends AndroidException { |
| 71 | public NameNotFoundException() { |
| 72 | } |
| 73 | |
| 74 | public NameNotFoundException(String name) { |
| 75 | super(name); |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * {@link PackageInfo} flag: return information about |
| 81 | * activities in the package in {@link PackageInfo#activities}. |
| 82 | */ |
| 83 | public static final int GET_ACTIVITIES = 0x00000001; |
| 84 | |
| 85 | /** |
| 86 | * {@link PackageInfo} flag: return information about |
| 87 | * intent receivers in the package in |
| 88 | * {@link PackageInfo#receivers}. |
| 89 | */ |
| 90 | public static final int GET_RECEIVERS = 0x00000002; |
| 91 | |
| 92 | /** |
| 93 | * {@link PackageInfo} flag: return information about |
| 94 | * services in the package in {@link PackageInfo#services}. |
| 95 | */ |
| 96 | public static final int GET_SERVICES = 0x00000004; |
| 97 | |
| 98 | /** |
| 99 | * {@link PackageInfo} flag: return information about |
| 100 | * content providers in the package in |
| 101 | * {@link PackageInfo#providers}. |
| 102 | */ |
| 103 | public static final int GET_PROVIDERS = 0x00000008; |
| 104 | |
| 105 | /** |
| 106 | * {@link PackageInfo} flag: return information about |
| 107 | * instrumentation in the package in |
| 108 | * {@link PackageInfo#instrumentation}. |
| 109 | */ |
| 110 | public static final int GET_INSTRUMENTATION = 0x00000010; |
| 111 | |
| 112 | /** |
| 113 | * {@link PackageInfo} flag: return information about the |
| 114 | * intent filters supported by the activity. |
| 115 | */ |
| 116 | public static final int GET_INTENT_FILTERS = 0x00000020; |
| 117 | |
| 118 | /** |
| 119 | * {@link PackageInfo} flag: return information about the |
| 120 | * signatures included in the package. |
| 121 | */ |
| 122 | public static final int GET_SIGNATURES = 0x00000040; |
| 123 | |
| 124 | /** |
| 125 | * {@link ResolveInfo} flag: return the IntentFilter that |
| 126 | * was matched for a particular ResolveInfo in |
| 127 | * {@link ResolveInfo#filter}. |
| 128 | */ |
| 129 | public static final int GET_RESOLVED_FILTER = 0x00000040; |
| 130 | |
| 131 | /** |
| 132 | * {@link ComponentInfo} flag: return the {@link ComponentInfo#metaData} |
| 133 | * data {@link android.os.Bundle}s that are associated with a component. |
| 134 | * This applies for any API returning a ComponentInfo subclass. |
| 135 | */ |
| 136 | public static final int GET_META_DATA = 0x00000080; |
| 137 | |
| 138 | /** |
| 139 | * {@link PackageInfo} flag: return the |
| 140 | * {@link PackageInfo#gids group ids} that are associated with an |
| 141 | * application. |
Ken Wakasa | f76a50c | 2012-03-09 19:56:35 +0900 | [diff] [blame] | 142 | * This applies for any API returning a PackageInfo class, either |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 143 | * directly or nested inside of another. |
| 144 | */ |
| 145 | public static final int GET_GIDS = 0x00000100; |
| 146 | |
| 147 | /** |
| 148 | * {@link PackageInfo} flag: include disabled components in the returned info. |
| 149 | */ |
| 150 | public static final int GET_DISABLED_COMPONENTS = 0x00000200; |
| 151 | |
| 152 | /** |
| 153 | * {@link ApplicationInfo} flag: return the |
| 154 | * {@link ApplicationInfo#sharedLibraryFiles paths to the shared libraries} |
| 155 | * that are associated with an application. |
| 156 | * This applies for any API returning an ApplicationInfo class, either |
| 157 | * directly or nested inside of another. |
| 158 | */ |
| 159 | public static final int GET_SHARED_LIBRARY_FILES = 0x00000400; |
| 160 | |
| 161 | /** |
| 162 | * {@link ProviderInfo} flag: return the |
| 163 | * {@link ProviderInfo#uriPermissionPatterns URI permission patterns} |
| 164 | * that are associated with a content provider. |
Ken Wakasa | f76a50c | 2012-03-09 19:56:35 +0900 | [diff] [blame] | 165 | * This applies for any API returning a ProviderInfo class, either |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 166 | * directly or nested inside of another. |
| 167 | */ |
| 168 | public static final int GET_URI_PERMISSION_PATTERNS = 0x00000800; |
| 169 | /** |
| 170 | * {@link PackageInfo} flag: return information about |
| 171 | * permissions in the package in |
| 172 | * {@link PackageInfo#permissions}. |
| 173 | */ |
| 174 | public static final int GET_PERMISSIONS = 0x00001000; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 175 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 176 | /** |
Kenny Root | 685f490 | 2011-11-03 10:13:29 -0700 | [diff] [blame] | 177 | * Flag parameter to retrieve some information about all applications (even |
| 178 | * uninstalled ones) which have data directories. This state could have |
| 179 | * resulted if applications have been deleted with flag |
| 180 | * {@code DONT_DELETE_DATA} with a possibility of being replaced or |
| 181 | * reinstalled in future. |
| 182 | * <p> |
| 183 | * Note: this flag may cause less information about currently installed |
| 184 | * applications to be returned. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 185 | */ |
| 186 | public static final int GET_UNINSTALLED_PACKAGES = 0x00002000; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 187 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 188 | /** |
| 189 | * {@link PackageInfo} flag: return information about |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 190 | * hardware preferences in |
Adam Lesinski | d3edfde | 2014-08-08 17:32:44 -0700 | [diff] [blame] | 191 | * {@link PackageInfo#configPreferences PackageInfo.configPreferences}, |
| 192 | * and requested features in {@link PackageInfo#reqFeatures} and |
| 193 | * {@link PackageInfo#featureGroups}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 194 | */ |
| 195 | public static final int GET_CONFIGURATIONS = 0x00004000; |
| 196 | |
| 197 | /** |
Dianne Hackborn | fd7aded | 2013-01-22 17:10:23 -0800 | [diff] [blame] | 198 | * {@link PackageInfo} flag: include disabled components which are in |
| 199 | * that state only because of {@link #COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED} |
| 200 | * in the returned info. Note that if you set this flag, applications |
| 201 | * that are in this disabled state will be reported as enabled. |
| 202 | */ |
| 203 | public static final int GET_DISABLED_UNTIL_USED_COMPONENTS = 0x00008000; |
| 204 | |
| 205 | /** |
Dianne Hackborn | 1655be4 | 2009-05-08 14:29:01 -0700 | [diff] [blame] | 206 | * Resolution and querying flag: if set, only filters that support the |
| 207 | * {@link android.content.Intent#CATEGORY_DEFAULT} will be considered for |
| 208 | * matching. This is a synonym for including the CATEGORY_DEFAULT in your |
| 209 | * supplied Intent. |
| 210 | */ |
| 211 | public static final int MATCH_DEFAULT_ONLY = 0x00010000; |
| 212 | |
Nicolas Prevot | 63798c5 | 2014-05-27 13:22:38 +0100 | [diff] [blame] | 213 | /** |
Nicolas Prevot | 63798c5 | 2014-05-27 13:22:38 +0100 | [diff] [blame] | 214 | * Flag for {@link addCrossProfileIntentFilter}: if this flag is set: |
| 215 | * when resolving an intent that matches the {@link CrossProfileIntentFilter}, the current |
| 216 | * profile will be skipped. |
| 217 | * Only activities in the target user can respond to the intent. |
| 218 | * @hide |
| 219 | */ |
| 220 | public static final int SKIP_CURRENT_PROFILE = 0x00000002; |
| 221 | |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 222 | /** @hide */ |
| 223 | @IntDef({PERMISSION_GRANTED, PERMISSION_DENIED}) |
| 224 | @Retention(RetentionPolicy.SOURCE) |
| 225 | public @interface PermissionResult {} |
| 226 | |
Dianne Hackborn | 1655be4 | 2009-05-08 14:29:01 -0700 | [diff] [blame] | 227 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 228 | * Permission check result: this is returned by {@link #checkPermission} |
| 229 | * if the permission has been granted to the given package. |
| 230 | */ |
| 231 | public static final int PERMISSION_GRANTED = 0; |
| 232 | |
| 233 | /** |
| 234 | * Permission check result: this is returned by {@link #checkPermission} |
| 235 | * if the permission has not been granted to the given package. |
| 236 | */ |
| 237 | public static final int PERMISSION_DENIED = -1; |
| 238 | |
| 239 | /** |
| 240 | * Signature check result: this is returned by {@link #checkSignatures} |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 241 | * if all signatures on the two packages match. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 242 | */ |
| 243 | public static final int SIGNATURE_MATCH = 0; |
| 244 | |
| 245 | /** |
| 246 | * Signature check result: this is returned by {@link #checkSignatures} |
| 247 | * if neither of the two packages is signed. |
| 248 | */ |
| 249 | public static final int SIGNATURE_NEITHER_SIGNED = 1; |
| 250 | |
| 251 | /** |
| 252 | * Signature check result: this is returned by {@link #checkSignatures} |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 253 | * 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] | 254 | */ |
| 255 | public static final int SIGNATURE_FIRST_NOT_SIGNED = -1; |
| 256 | |
| 257 | /** |
| 258 | * Signature check result: this is returned by {@link #checkSignatures} |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 259 | * 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] | 260 | */ |
| 261 | public static final int SIGNATURE_SECOND_NOT_SIGNED = -2; |
| 262 | |
| 263 | /** |
| 264 | * Signature check result: this is returned by {@link #checkSignatures} |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 265 | * if not all signatures on both packages match. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 266 | */ |
| 267 | public static final int SIGNATURE_NO_MATCH = -3; |
| 268 | |
| 269 | /** |
| 270 | * Signature check result: this is returned by {@link #checkSignatures} |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 271 | * if either of the packages are not valid. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 272 | */ |
| 273 | public static final int SIGNATURE_UNKNOWN_PACKAGE = -4; |
| 274 | |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 275 | /** |
| 276 | * Flag for {@link #setApplicationEnabledSetting(String, int, int)} |
| 277 | * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This |
| 278 | * component or application is in its default enabled state (as specified |
| 279 | * in its manifest). |
| 280 | */ |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 281 | public static final int COMPONENT_ENABLED_STATE_DEFAULT = 0; |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 282 | |
| 283 | /** |
| 284 | * Flag for {@link #setApplicationEnabledSetting(String, int, int)} |
| 285 | * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This |
| 286 | * component or application has been explictily enabled, regardless of |
| 287 | * what it has specified in its manifest. |
| 288 | */ |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 289 | public static final int COMPONENT_ENABLED_STATE_ENABLED = 1; |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 290 | |
| 291 | /** |
| 292 | * Flag for {@link #setApplicationEnabledSetting(String, int, int)} |
| 293 | * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This |
| 294 | * component or application has been explicitly disabled, regardless of |
| 295 | * what it has specified in its manifest. |
| 296 | */ |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 297 | public static final int COMPONENT_ENABLED_STATE_DISABLED = 2; |
| 298 | |
| 299 | /** |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 300 | * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: The |
| 301 | * user has explicitly disabled the application, regardless of what it has |
| 302 | * specified in its manifest. Because this is due to the user's request, |
| 303 | * they may re-enable it if desired through the appropriate system UI. This |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 304 | * option currently <strong>cannot</strong> be used with |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 305 | * {@link #setComponentEnabledSetting(ComponentName, int, int)}. |
| 306 | */ |
| 307 | public static final int COMPONENT_ENABLED_STATE_DISABLED_USER = 3; |
| 308 | |
| 309 | /** |
Dianne Hackborn | fd7aded | 2013-01-22 17:10:23 -0800 | [diff] [blame] | 310 | * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: This |
| 311 | * application should be considered, until the point where the user actually |
| 312 | * wants to use it. This means that it will not normally show up to the user |
| 313 | * (such as in the launcher), but various parts of the user interface can |
| 314 | * use {@link #GET_DISABLED_UNTIL_USED_COMPONENTS} to still see it and allow |
| 315 | * the user to select it (as for example an IME, device admin, etc). Such code, |
| 316 | * once the user has selected the app, should at that point also make it enabled. |
| 317 | * This option currently <strong>can not</strong> be used with |
| 318 | * {@link #setComponentEnabledSetting(ComponentName, int, int)}. |
| 319 | */ |
| 320 | public static final int COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED = 4; |
| 321 | |
| 322 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 323 | * Flag parameter for {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} to |
| 324 | * 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] | 325 | * should have access to its code and non-resource assets. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 326 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 327 | */ |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 328 | public static final int INSTALL_FORWARD_LOCK = 0x00000001; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 329 | |
| 330 | /** |
| 331 | * 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] | 332 | * installed package, if one exists. |
| 333 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 334 | */ |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 335 | public static final int INSTALL_REPLACE_EXISTING = 0x00000002; |
| 336 | |
| 337 | /** |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 338 | * Flag parameter for {@link #installPackage} to indicate that you want to |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 339 | * allow test packages (those that have set android:testOnly in their |
| 340 | * manifest) to be installed. |
| 341 | * @hide |
| 342 | */ |
| 343 | public static final int INSTALL_ALLOW_TEST = 0x00000004; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 344 | |
| 345 | /** |
Jeff Sharkey | b2b9ab8 | 2015-04-05 21:10:42 -0700 | [diff] [blame] | 346 | * Flag parameter for {@link #installPackage} to indicate that this package |
| 347 | * must be installed to an ASEC on a {@link VolumeInfo#TYPE_PUBLIC}. |
| 348 | * |
Suchi Amalapurapu | af8e9f4 | 2010-01-12 10:17:28 -0800 | [diff] [blame] | 349 | * @hide |
| 350 | */ |
Suchi Amalapurapu | 5b993ce | 2010-02-12 09:43:29 -0800 | [diff] [blame] | 351 | public static final int INSTALL_EXTERNAL = 0x00000008; |
Oscar Montemayor | 539d3c4 | 2010-01-29 15:27:00 -0800 | [diff] [blame] | 352 | |
| 353 | /** |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 354 | * Flag parameter for {@link #installPackage} to indicate that this package |
Jeff Sharkey | b2b9ab8 | 2015-04-05 21:10:42 -0700 | [diff] [blame] | 355 | * must be installed to internal storage. |
| 356 | * |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 357 | * @hide |
| 358 | */ |
| 359 | public static final int INSTALL_INTERNAL = 0x00000010; |
| 360 | |
| 361 | /** |
| 362 | * Flag parameter for {@link #installPackage} to indicate that this install |
| 363 | * was initiated via ADB. |
| 364 | * |
| 365 | * @hide |
| 366 | */ |
| 367 | public static final int INSTALL_FROM_ADB = 0x00000020; |
Suchi Amalapurapu | 14b6abd | 2010-03-17 08:37:04 -0700 | [diff] [blame] | 368 | |
| 369 | /** |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 370 | * Flag parameter for {@link #installPackage} to indicate that this install |
| 371 | * should immediately be visible to all users. |
| 372 | * |
| 373 | * @hide |
| 374 | */ |
| 375 | public static final int INSTALL_ALL_USERS = 0x00000040; |
| 376 | |
| 377 | /** |
| 378 | * Flag parameter for {@link #installPackage} to indicate that it is okay |
| 379 | * to install an update to an app where the newly installed app has a lower |
| 380 | * version code than the currently installed app. |
| 381 | * |
| 382 | * @hide |
| 383 | */ |
| 384 | public static final int INSTALL_ALLOW_DOWNGRADE = 0x00000080; |
| 385 | |
| 386 | /** |
Svet Ganov | 95c1ade | 2015-03-19 09:38:52 -0700 | [diff] [blame] | 387 | * Flag parameter for {@link #installPackage} to indicate that all runtime |
| 388 | * permissions should be granted to the package. If {@link #INSTALL_ALL_USERS} |
| 389 | * is set the runtime permissions will be granted to all users, otherwise |
| 390 | * only to the owner. |
| 391 | * |
| 392 | * @hide |
| 393 | */ |
| 394 | public static final int INSTALL_GRANT_RUNTIME_PERMISSIONS = 0x00000100; |
| 395 | |
| 396 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 397 | * Flag parameter for |
| 398 | * {@link #setComponentEnabledSetting(android.content.ComponentName, int, int)} to indicate |
| 399 | * that you don't want to kill the app containing the component. Be careful when you set this |
| 400 | * since changing component states can make the containing application's behavior unpredictable. |
| 401 | */ |
| 402 | public static final int DONT_KILL_APP = 0x00000001; |
| 403 | |
| 404 | /** |
| 405 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 406 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} on success. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 407 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 408 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 409 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 410 | public static final int INSTALL_SUCCEEDED = 1; |
| 411 | |
| 412 | /** |
| 413 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 414 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package is |
| 415 | * already installed. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 416 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 417 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 418 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 419 | public static final int INSTALL_FAILED_ALREADY_EXISTS = -1; |
| 420 | |
| 421 | /** |
| 422 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 423 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package archive |
| 424 | * file is invalid. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 425 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 426 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 427 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 428 | public static final int INSTALL_FAILED_INVALID_APK = -2; |
| 429 | |
| 430 | /** |
| 431 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 432 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the URI passed in |
| 433 | * is invalid. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 434 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 435 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 436 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 437 | public static final int INSTALL_FAILED_INVALID_URI = -3; |
| 438 | |
| 439 | /** |
| 440 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 441 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package manager |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 442 | * service found that the device didn't have enough storage space to install the app. |
| 443 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 444 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 445 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 446 | public static final int INSTALL_FAILED_INSUFFICIENT_STORAGE = -4; |
| 447 | |
| 448 | /** |
| 449 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 450 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if a |
| 451 | * package is already installed with the same name. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 452 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 453 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 454 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 455 | public static final int INSTALL_FAILED_DUPLICATE_PACKAGE = -5; |
| 456 | |
| 457 | /** |
| 458 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 459 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 460 | * the requested shared user does not exist. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 461 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 462 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 463 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 464 | public static final int INSTALL_FAILED_NO_SHARED_USER = -6; |
| 465 | |
| 466 | /** |
| 467 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 468 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 469 | * a previously installed package of the same name has a different signature |
| 470 | * 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] | 471 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 472 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 473 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 474 | public static final int INSTALL_FAILED_UPDATE_INCOMPATIBLE = -7; |
| 475 | |
| 476 | /** |
| 477 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 478 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 479 | * the new package is requested a shared user which is already installed on the |
| 480 | * device and does not have matching signature. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 481 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 482 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 483 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 484 | public static final int INSTALL_FAILED_SHARED_USER_INCOMPATIBLE = -8; |
| 485 | |
| 486 | /** |
| 487 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 488 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 489 | * the new package uses a shared library that is not available. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 490 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 491 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 492 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 493 | public static final int INSTALL_FAILED_MISSING_SHARED_LIBRARY = -9; |
| 494 | |
| 495 | /** |
| 496 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 497 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 498 | * the new package uses a shared library that is not available. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 499 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 500 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 501 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 502 | public static final int INSTALL_FAILED_REPLACE_COULDNT_DELETE = -10; |
| 503 | |
| 504 | /** |
| 505 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 506 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 507 | * the new package failed while optimizing and validating its dex files, |
| 508 | * either because there was not enough storage or the validation failed. |
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 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 511 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 512 | public static final int INSTALL_FAILED_DEXOPT = -11; |
| 513 | |
| 514 | /** |
| 515 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 516 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 517 | * the new package failed because the current SDK version is older than |
| 518 | * that required by the package. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 519 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 520 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 521 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 522 | public static final int INSTALL_FAILED_OLDER_SDK = -12; |
| 523 | |
| 524 | /** |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 525 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 526 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 527 | * the new package failed because it contains a content provider with the |
| 528 | * same authority as a provider already installed in the system. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 529 | * @hide |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 530 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 531 | @SystemApi |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 532 | public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13; |
| 533 | |
| 534 | /** |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 535 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 536 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 537 | * the new package failed because the current SDK version is newer than |
| 538 | * that required by the package. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 539 | * @hide |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 540 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 541 | @SystemApi |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 542 | public static final int INSTALL_FAILED_NEWER_SDK = -14; |
| 543 | |
| 544 | /** |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 545 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 546 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 547 | * the new package failed because it has specified that it is a test-only |
| 548 | * package and the caller has not supplied the {@link #INSTALL_ALLOW_TEST} |
| 549 | * flag. |
| 550 | * @hide |
| 551 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 552 | @SystemApi |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 553 | public static final int INSTALL_FAILED_TEST_ONLY = -15; |
| 554 | |
| 555 | /** |
Dianne Hackborn | b181118 | 2009-05-21 15:45:42 -0700 | [diff] [blame] | 556 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 557 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 558 | * the package being installed contains native code, but none that is |
Amaury Medeiros | dde2426 | 2014-06-03 20:06:41 -0300 | [diff] [blame] | 559 | * compatible with the device's CPU_ABI. |
Dianne Hackborn | b181118 | 2009-05-21 15:45:42 -0700 | [diff] [blame] | 560 | * @hide |
| 561 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 562 | @SystemApi |
Dianne Hackborn | b181118 | 2009-05-21 15:45:42 -0700 | [diff] [blame] | 563 | public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16; |
| 564 | |
| 565 | /** |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 566 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 567 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 568 | * the new package uses a feature that is not available. |
| 569 | * @hide |
| 570 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 571 | @SystemApi |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 572 | public static final int INSTALL_FAILED_MISSING_FEATURE = -17; |
| 573 | |
Suchi Amalapurapu | af8e9f4 | 2010-01-12 10:17:28 -0800 | [diff] [blame] | 574 | // ------ Errors related to sdcard |
| 575 | /** |
| 576 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 577 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 578 | * a secure container mount point couldn't be accessed on external media. |
| 579 | * @hide |
| 580 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 581 | @SystemApi |
Suchi Amalapurapu | af8e9f4 | 2010-01-12 10:17:28 -0800 | [diff] [blame] | 582 | public static final int INSTALL_FAILED_CONTAINER_ERROR = -18; |
| 583 | |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 584 | /** |
Suchi Amalapurapu | b56ae20 | 2010-02-04 22:51:07 -0800 | [diff] [blame] | 585 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 586 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 587 | * the new package couldn't be installed in the specified install |
| 588 | * location. |
| 589 | * @hide |
| 590 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 591 | @SystemApi |
Suchi Amalapurapu | b56ae20 | 2010-02-04 22:51:07 -0800 | [diff] [blame] | 592 | public static final int INSTALL_FAILED_INVALID_INSTALL_LOCATION = -19; |
| 593 | |
| 594 | /** |
Suchi Amalapurapu | 8a9ab24 | 2010-03-11 16:49:16 -0800 | [diff] [blame] | 595 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 596 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 597 | * the new package couldn't be installed in the specified install |
| 598 | * location because the media is not available. |
| 599 | * @hide |
| 600 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 601 | @SystemApi |
Suchi Amalapurapu | 8a9ab24 | 2010-03-11 16:49:16 -0800 | [diff] [blame] | 602 | public static final int INSTALL_FAILED_MEDIA_UNAVAILABLE = -20; |
| 603 | |
| 604 | /** |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 605 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 606 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 607 | * the new package couldn't be installed because the verification timed out. |
| 608 | * @hide |
| 609 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 610 | @SystemApi |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 611 | public static final int INSTALL_FAILED_VERIFICATION_TIMEOUT = -21; |
| 612 | |
| 613 | /** |
| 614 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 615 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 616 | * the new package couldn't be installed because the verification did not succeed. |
| 617 | * @hide |
| 618 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 619 | @SystemApi |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 620 | public static final int INSTALL_FAILED_VERIFICATION_FAILURE = -22; |
| 621 | |
| 622 | /** |
| 623 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 624 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 625 | * the package changed from what the calling program expected. |
| 626 | * @hide |
| 627 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 628 | @SystemApi |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 629 | public static final int INSTALL_FAILED_PACKAGE_CHANGED = -23; |
| 630 | |
| 631 | /** |
Dianne Hackborn | d0c5f51 | 2012-06-07 16:53:59 -0700 | [diff] [blame] | 632 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 633 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 634 | * the new package is assigned a different UID than it previously held. |
| 635 | * @hide |
| 636 | */ |
| 637 | public static final int INSTALL_FAILED_UID_CHANGED = -24; |
| 638 | |
| 639 | /** |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 640 | * Installation return code: this is passed to the {@link IPackageInstallObserver} by |
| 641 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if |
| 642 | * the new package has an older version code than the currently installed package. |
| 643 | * @hide |
| 644 | */ |
| 645 | public static final int INSTALL_FAILED_VERSION_DOWNGRADE = -25; |
| 646 | |
| 647 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 648 | * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by |
| 649 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} |
| 650 | * if the parser was given a path that is not a file, or does not end with the expected |
| 651 | * '.apk' extension. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 652 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 653 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 654 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 655 | public static final int INSTALL_PARSE_FAILED_NOT_APK = -100; |
| 656 | |
| 657 | /** |
| 658 | * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by |
| 659 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} |
| 660 | * if the parser was unable to retrieve the AndroidManifest.xml file. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 661 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 662 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 663 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 664 | public static final int INSTALL_PARSE_FAILED_BAD_MANIFEST = -101; |
| 665 | |
| 666 | /** |
| 667 | * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by |
| 668 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} |
| 669 | * if the parser encountered an unexpected exception. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 670 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 671 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 672 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 673 | public static final int INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION = -102; |
| 674 | |
| 675 | /** |
| 676 | * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by |
| 677 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} |
| 678 | * if the parser did not find any certificates in the .apk. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 679 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 680 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 681 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 682 | public static final int INSTALL_PARSE_FAILED_NO_CERTIFICATES = -103; |
| 683 | |
| 684 | /** |
| 685 | * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by |
| 686 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} |
| 687 | * if the parser found inconsistent certificates on the files in the .apk. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 688 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 689 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 690 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 691 | public static final int INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES = -104; |
| 692 | |
| 693 | /** |
| 694 | * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by |
| 695 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} |
| 696 | * if the parser encountered a CertificateEncodingException in one of the |
| 697 | * files in the .apk. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 698 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 699 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 700 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 701 | public static final int INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING = -105; |
| 702 | |
| 703 | /** |
| 704 | * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by |
| 705 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} |
| 706 | * 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] | 707 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 708 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 709 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 710 | public static final int INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME = -106; |
| 711 | |
| 712 | /** |
| 713 | * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by |
| 714 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} |
| 715 | * 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] | 716 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 717 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 718 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 719 | public static final int INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID = -107; |
| 720 | |
| 721 | /** |
| 722 | * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by |
| 723 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} |
| 724 | * if the parser encountered some structural problem in the manifest. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 725 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 726 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 727 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 728 | public static final int INSTALL_PARSE_FAILED_MANIFEST_MALFORMED = -108; |
| 729 | |
| 730 | /** |
| 731 | * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by |
| 732 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} |
| 733 | * if the parser did not find any actionable tags (instrumentation or application) |
| 734 | * in the manifest. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 735 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 736 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 737 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 738 | public static final int INSTALL_PARSE_FAILED_MANIFEST_EMPTY = -109; |
| 739 | |
| 740 | /** |
Suchi Amalapurapu | 5b993ce | 2010-02-12 09:43:29 -0800 | [diff] [blame] | 741 | * Installation failed return code: this is passed to the {@link IPackageInstallObserver} by |
| 742 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} |
| 743 | * if the system failed to install the package because of system issues. |
| 744 | * @hide |
| 745 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 746 | @SystemApi |
Suchi Amalapurapu | 5b993ce | 2010-02-12 09:43:29 -0800 | [diff] [blame] | 747 | public static final int INSTALL_FAILED_INTERNAL_ERROR = -110; |
| 748 | |
| 749 | /** |
Amith Yamasani | e4cf734 | 2012-12-17 11:12:09 -0800 | [diff] [blame] | 750 | * Installation failed return code: this is passed to the {@link IPackageInstallObserver} by |
| 751 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} |
| 752 | * if the system failed to install the package because the user is restricted from installing |
| 753 | * apps. |
| 754 | * @hide |
| 755 | */ |
| 756 | public static final int INSTALL_FAILED_USER_RESTRICTED = -111; |
| 757 | |
| 758 | /** |
Christopher Tate | f1977b4 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 759 | * Installation failed return code: this is passed to the {@link IPackageInstallObserver} by |
| 760 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} |
| 761 | * if the system failed to install the package because it is attempting to define a |
| 762 | * permission that is already defined by some existing package. |
| 763 | * |
| 764 | * <p>The package name of the app which has already defined the permission is passed to |
Jeff Sharkey | bb58067 | 2014-07-10 12:10:25 -0700 | [diff] [blame] | 765 | * a {@link PackageInstallObserver}, if any, as the {@link #EXTRA_EXISTING_PACKAGE} |
Christopher Tate | f1977b4 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 766 | * string extra; and the name of the permission being redefined is passed in the |
| 767 | * {@link #EXTRA_EXISTING_PERMISSION} string extra. |
| 768 | * @hide |
| 769 | */ |
| 770 | public static final int INSTALL_FAILED_DUPLICATE_PERMISSION = -112; |
| 771 | |
| 772 | /** |
Narayan Kamath | d11f223 | 2014-04-10 10:37:17 +0100 | [diff] [blame] | 773 | * Installation failed return code: this is passed to the {@link IPackageInstallObserver} by |
| 774 | * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 775 | * if the system failed to install the package because its packaged native code did not |
| 776 | * match any of the ABIs supported by the system. |
| 777 | * |
| 778 | * @hide |
| 779 | */ |
Narayan Kamath | d11f223 | 2014-04-10 10:37:17 +0100 | [diff] [blame] | 780 | public static final int INSTALL_FAILED_NO_MATCHING_ABIS = -113; |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 781 | |
| 782 | /** |
| 783 | * Internal return code for NativeLibraryHelper methods to indicate that the package |
| 784 | * being processed did not contain any native code. This is placed here only so that |
| 785 | * it can belong to the same value space as the other install failure codes. |
| 786 | * |
| 787 | * @hide |
| 788 | */ |
Narayan Kamath | d11f223 | 2014-04-10 10:37:17 +0100 | [diff] [blame] | 789 | public static final int NO_NATIVE_LIBRARIES = -114; |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 790 | |
Jeff Sharkey | 7328a1b | 2014-08-07 14:01:43 -0700 | [diff] [blame] | 791 | /** {@hide} */ |
Jeff Sharkey | f060095 | 2014-08-07 17:31:53 -0700 | [diff] [blame] | 792 | public static final int INSTALL_FAILED_ABORTED = -115; |
Jeff Sharkey | 7328a1b | 2014-08-07 14:01:43 -0700 | [diff] [blame] | 793 | |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 794 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 795 | * Flag parameter for {@link #deletePackage} to indicate that you don't want to delete the |
| 796 | * package's data directory. |
| 797 | * |
| 798 | * @hide |
| 799 | */ |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 800 | public static final int DELETE_KEEP_DATA = 0x00000001; |
| 801 | |
| 802 | /** |
| 803 | * Flag parameter for {@link #deletePackage} to indicate that you want the |
| 804 | * package deleted for all users. |
| 805 | * |
| 806 | * @hide |
| 807 | */ |
| 808 | public static final int DELETE_ALL_USERS = 0x00000002; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 809 | |
| 810 | /** |
Dianne Hackborn | c895be7 | 2013-03-11 17:48:43 -0700 | [diff] [blame] | 811 | * Flag parameter for {@link #deletePackage} to indicate that, if you are calling |
| 812 | * uninstall on a system that has been updated, then don't do the normal process |
| 813 | * of uninstalling the update and rolling back to the older system version (which |
| 814 | * needs to happen for all users); instead, just mark the app as uninstalled for |
| 815 | * the current user. |
| 816 | * |
| 817 | * @hide |
| 818 | */ |
| 819 | public static final int DELETE_SYSTEM_APP = 0x00000004; |
| 820 | |
| 821 | /** |
Kenny Root | c39bb4a | 2011-02-28 13:27:19 -0800 | [diff] [blame] | 822 | * Return code for when package deletion succeeds. This is passed to the |
| 823 | * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system |
| 824 | * succeeded in deleting the package. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 825 | * |
Kenny Root | c39bb4a | 2011-02-28 13:27:19 -0800 | [diff] [blame] | 826 | * @hide |
| 827 | */ |
| 828 | public static final int DELETE_SUCCEEDED = 1; |
| 829 | |
| 830 | /** |
| 831 | * Deletion failed return code: this is passed to the |
| 832 | * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system |
| 833 | * failed to delete the package for an unspecified reason. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 834 | * |
Kenny Root | c39bb4a | 2011-02-28 13:27:19 -0800 | [diff] [blame] | 835 | * @hide |
| 836 | */ |
| 837 | public static final int DELETE_FAILED_INTERNAL_ERROR = -1; |
| 838 | |
| 839 | /** |
| 840 | * Deletion failed return code: this is passed to the |
| 841 | * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system |
| 842 | * failed to delete the package because it is the active DevicePolicy |
| 843 | * manager. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 844 | * |
Kenny Root | c39bb4a | 2011-02-28 13:27:19 -0800 | [diff] [blame] | 845 | * @hide |
| 846 | */ |
| 847 | public static final int DELETE_FAILED_DEVICE_POLICY_MANAGER = -2; |
| 848 | |
| 849 | /** |
Amith Yamasani | e4cf734 | 2012-12-17 11:12:09 -0800 | [diff] [blame] | 850 | * Deletion failed return code: this is passed to the |
| 851 | * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system |
| 852 | * failed to delete the package since the user is restricted. |
| 853 | * |
| 854 | * @hide |
| 855 | */ |
| 856 | public static final int DELETE_FAILED_USER_RESTRICTED = -3; |
| 857 | |
| 858 | /** |
Kenny Guy | 1b88da5 | 2014-07-10 16:33:49 +0100 | [diff] [blame] | 859 | * Deletion failed return code: this is passed to the |
| 860 | * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system |
| 861 | * failed to delete the package because a profile |
Kenny Guy | c13053b | 2014-05-29 14:17:17 +0100 | [diff] [blame] | 862 | * or device owner has marked the package as uninstallable. |
| 863 | * |
| 864 | * @hide |
| 865 | */ |
Jeff Sharkey | f060095 | 2014-08-07 17:31:53 -0700 | [diff] [blame] | 866 | public static final int DELETE_FAILED_OWNER_BLOCKED = -4; |
| 867 | |
| 868 | /** {@hide} */ |
| 869 | public static final int DELETE_FAILED_ABORTED = -5; |
Kenny Guy | c13053b | 2014-05-29 14:17:17 +0100 | [diff] [blame] | 870 | |
| 871 | /** |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 872 | * Return code that is passed to the {@link IPackageMoveObserver} by |
Kenny Root | c39bb4a | 2011-02-28 13:27:19 -0800 | [diff] [blame] | 873 | * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} when the |
| 874 | * package has been successfully moved by the system. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 875 | * |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 876 | * @hide |
| 877 | */ |
| 878 | public static final int MOVE_SUCCEEDED = 1; |
| 879 | /** |
| 880 | * Error code that is passed to the {@link IPackageMoveObserver} by |
| 881 | * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} |
| 882 | * when the package hasn't been successfully moved by the system |
| 883 | * because of insufficient memory on specified media. |
| 884 | * @hide |
| 885 | */ |
| 886 | public static final int MOVE_FAILED_INSUFFICIENT_STORAGE = -1; |
| 887 | |
| 888 | /** |
| 889 | * Error code that is passed to the {@link IPackageMoveObserver} by |
| 890 | * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} |
| 891 | * if the specified package doesn't exist. |
| 892 | * @hide |
| 893 | */ |
| 894 | public static final int MOVE_FAILED_DOESNT_EXIST = -2; |
| 895 | |
| 896 | /** |
| 897 | * Error code that is passed to the {@link IPackageMoveObserver} by |
| 898 | * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} |
| 899 | * if the specified package cannot be moved since its a system package. |
| 900 | * @hide |
| 901 | */ |
| 902 | public static final int MOVE_FAILED_SYSTEM_PACKAGE = -3; |
| 903 | |
| 904 | /** |
| 905 | * Error code that is passed to the {@link IPackageMoveObserver} by |
| 906 | * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} |
| 907 | * if the specified package cannot be moved since its forward locked. |
| 908 | * @hide |
| 909 | */ |
| 910 | public static final int MOVE_FAILED_FORWARD_LOCKED = -4; |
| 911 | |
| 912 | /** |
| 913 | * Error code that is passed to the {@link IPackageMoveObserver} by |
| 914 | * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} |
| 915 | * if the specified package cannot be moved to the specified location. |
| 916 | * @hide |
| 917 | */ |
| 918 | public static final int MOVE_FAILED_INVALID_LOCATION = -5; |
| 919 | |
| 920 | /** |
Suchi Amalapurapu | 8a9ab24 | 2010-03-11 16:49:16 -0800 | [diff] [blame] | 921 | * Error code that is passed to the {@link IPackageMoveObserver} by |
| 922 | * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} |
| 923 | * if the specified package cannot be moved to the specified location. |
| 924 | * @hide |
| 925 | */ |
| 926 | public static final int MOVE_FAILED_INTERNAL_ERROR = -6; |
| 927 | |
| 928 | /** |
Kenny Root | deb1126 | 2010-08-02 11:36:21 -0700 | [diff] [blame] | 929 | * Error code that is passed to the {@link IPackageMoveObserver} by |
| 930 | * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} if the |
| 931 | * specified package already has an operation pending in the |
| 932 | * {@link PackageHandler} queue. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 933 | * |
Kenny Root | deb1126 | 2010-08-02 11:36:21 -0700 | [diff] [blame] | 934 | * @hide |
| 935 | */ |
| 936 | public static final int MOVE_FAILED_OPERATION_PENDING = -7; |
| 937 | |
| 938 | /** |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 939 | * Flag parameter for {@link #movePackage} to indicate that |
| 940 | * the package should be moved to internal storage if its |
| 941 | * been installed on external media. |
| 942 | * @hide |
| 943 | */ |
| 944 | public static final int MOVE_INTERNAL = 0x00000001; |
| 945 | |
| 946 | /** |
| 947 | * Flag parameter for {@link #movePackage} to indicate that |
| 948 | * the package should be moved to external media. |
| 949 | * @hide |
| 950 | */ |
| 951 | public static final int MOVE_EXTERNAL_MEDIA = 0x00000002; |
| 952 | |
| 953 | /** |
Kenny Root | 05ca4c9 | 2011-09-15 10:36:25 -0700 | [diff] [blame] | 954 | * Usable by the required verifier as the {@code verificationCode} argument |
| 955 | * for {@link PackageManager#verifyPendingInstall} to indicate that it will |
| 956 | * allow the installation to proceed without any of the optional verifiers |
| 957 | * needing to vote. |
| 958 | * |
| 959 | * @hide |
| 960 | */ |
| 961 | public static final int VERIFICATION_ALLOW_WITHOUT_SUFFICIENT = 2; |
| 962 | |
| 963 | /** |
Kenny Root | 3a9b5fb | 2011-09-20 14:15:38 -0700 | [diff] [blame] | 964 | * Used as the {@code verificationCode} argument for |
| 965 | * {@link PackageManager#verifyPendingInstall} to indicate that the calling |
| 966 | * package verifier allows the installation to proceed. |
| 967 | */ |
| 968 | public static final int VERIFICATION_ALLOW = 1; |
| 969 | |
| 970 | /** |
| 971 | * Used as the {@code verificationCode} argument for |
| 972 | * {@link PackageManager#verifyPendingInstall} to indicate the calling |
| 973 | * package verifier does not vote to allow the installation to proceed. |
| 974 | */ |
| 975 | public static final int VERIFICATION_REJECT = -1; |
| 976 | |
| 977 | /** |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 978 | * Used as the {@code verificationCode} argument for |
| 979 | * {@link PackageManager#verifyIntentFilter} to indicate that the calling |
| 980 | * IntentFilter Verifier confirms that the IntentFilter is verified. |
| 981 | * |
| 982 | * @hide |
| 983 | */ |
| 984 | public static final int INTENT_FILTER_VERIFICATION_SUCCESS = 1; |
| 985 | |
| 986 | /** |
| 987 | * Used as the {@code verificationCode} argument for |
| 988 | * {@link PackageManager#verifyIntentFilter} to indicate that the calling |
| 989 | * IntentFilter Verifier confirms that the IntentFilter is NOT verified. |
| 990 | * |
| 991 | * @hide |
| 992 | */ |
| 993 | public static final int INTENT_FILTER_VERIFICATION_FAILURE = -1; |
| 994 | |
| 995 | /** |
| 996 | * Internal status code to indicate that an IntentFilter verification result is not specified. |
| 997 | * |
| 998 | * @hide |
| 999 | */ |
| 1000 | public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED = 0; |
| 1001 | |
| 1002 | /** |
| 1003 | * Used as the {@code status} argument for {@link PackageManager#updateIntentVerificationStatus} |
| 1004 | * to indicate that the User will always be prompted the Intent Disambiguation Dialog if there |
| 1005 | * are two or more Intent resolved for the IntentFilter's domain(s). |
| 1006 | * |
| 1007 | * @hide |
| 1008 | */ |
| 1009 | public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK = 1; |
| 1010 | |
| 1011 | /** |
| 1012 | * Used as the {@code status} argument for {@link PackageManager#updateIntentVerificationStatus} |
| 1013 | * to indicate that the User will never be prompted the Intent Disambiguation Dialog if there |
| 1014 | * are two or more resolution of the Intent. The default App for the domain(s) specified in the |
| 1015 | * IntentFilter will also ALWAYS be used. |
| 1016 | * |
| 1017 | * @hide |
| 1018 | */ |
| 1019 | public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS = 2; |
| 1020 | |
| 1021 | /** |
| 1022 | * Used as the {@code status} argument for {@link PackageManager#updateIntentVerificationStatus} |
| 1023 | * to indicate that the User may be prompted the Intent Disambiguation Dialog if there |
| 1024 | * are two or more Intent resolved. The default App for the domain(s) specified in the |
| 1025 | * IntentFilter will also NEVER be presented to the User. |
| 1026 | * |
| 1027 | * @hide |
| 1028 | */ |
| 1029 | public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER = 3; |
| 1030 | |
| 1031 | /** |
rich cannings | d9ef3e5 | 2012-08-22 14:28:05 -0700 | [diff] [blame] | 1032 | * Can be used as the {@code millisecondsToDelay} argument for |
| 1033 | * {@link PackageManager#extendVerificationTimeout}. This is the |
| 1034 | * maximum time {@code PackageManager} waits for the verification |
| 1035 | * agent to return (in milliseconds). |
| 1036 | */ |
| 1037 | public static final long MAXIMUM_VERIFICATION_TIMEOUT = 60*60*1000; |
| 1038 | |
| 1039 | /** |
Amith Yamasani | 0b28549 | 2011-04-14 17:35:23 -0700 | [diff] [blame] | 1040 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device's |
| 1041 | * audio pipeline is low-latency, more suitable for audio applications sensitive to delays or |
| 1042 | * lag in sound input or output. |
Dan Morrill | 898e1e8 | 2010-09-26 17:28:30 -0700 | [diff] [blame] | 1043 | */ |
| 1044 | @SdkConstant(SdkConstantType.FEATURE) |
| 1045 | public static final String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency"; |
| 1046 | |
| 1047 | /** |
| 1048 | * Feature for {@link #getSystemAvailableFeatures} and |
Unsuk Jung | 50909f6 | 2014-09-02 18:25:49 -0700 | [diff] [blame] | 1049 | * {@link #hasSystemFeature}: The device includes at least one form of audio |
| 1050 | * output, such as speakers, audio jack or streaming over bluetooth |
| 1051 | */ |
| 1052 | @SdkConstant(SdkConstantType.FEATURE) |
| 1053 | public static final String FEATURE_AUDIO_OUTPUT = "android.hardware.audio.output"; |
| 1054 | |
| 1055 | /** |
| 1056 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1057 | * {@link #hasSystemFeature}: The device is capable of communicating with |
| 1058 | * other devices via Bluetooth. |
| 1059 | */ |
| 1060 | @SdkConstant(SdkConstantType.FEATURE) |
| 1061 | public static final String FEATURE_BLUETOOTH = "android.hardware.bluetooth"; |
| 1062 | |
| 1063 | /** |
| 1064 | * Feature for {@link #getSystemAvailableFeatures} and |
Matthew Xie | a722772 | 2013-04-18 15:25:59 -0700 | [diff] [blame] | 1065 | * {@link #hasSystemFeature}: The device is capable of communicating with |
| 1066 | * other devices via Bluetooth Low Energy radio. |
| 1067 | */ |
| 1068 | @SdkConstant(SdkConstantType.FEATURE) |
| 1069 | public static final String FEATURE_BLUETOOTH_LE = "android.hardware.bluetooth_le"; |
| 1070 | |
| 1071 | /** |
| 1072 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1073 | * {@link #hasSystemFeature}: The device has a camera facing away |
| 1074 | * from the screen. |
| 1075 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 1076 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1077 | public static final String FEATURE_CAMERA = "android.hardware.camera"; |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1078 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1079 | /** |
| 1080 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1081 | * {@link #hasSystemFeature}: The device's camera supports auto-focus. |
| 1082 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 1083 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1084 | public static final String FEATURE_CAMERA_AUTOFOCUS = "android.hardware.camera.autofocus"; |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1085 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1086 | /** |
| 1087 | * Feature for {@link #getSystemAvailableFeatures} and |
Eino-Ville Talvala | 752af83 | 2012-09-18 14:45:37 -0700 | [diff] [blame] | 1088 | * {@link #hasSystemFeature}: The device has at least one camera pointing in |
Eino-Ville Talvala | 9131da2 | 2014-05-08 11:39:53 -0700 | [diff] [blame] | 1089 | * some direction, or can support an external camera being connected to it. |
Eino-Ville Talvala | 752af83 | 2012-09-18 14:45:37 -0700 | [diff] [blame] | 1090 | */ |
| 1091 | @SdkConstant(SdkConstantType.FEATURE) |
| 1092 | public static final String FEATURE_CAMERA_ANY = "android.hardware.camera.any"; |
| 1093 | |
| 1094 | /** |
| 1095 | * Feature for {@link #getSystemAvailableFeatures} and |
Eino-Ville Talvala | 9131da2 | 2014-05-08 11:39:53 -0700 | [diff] [blame] | 1096 | * {@link #hasSystemFeature}: The device can support having an external camera connected to it. |
| 1097 | * The external camera may not always be connected or available to applications to use. |
| 1098 | */ |
| 1099 | @SdkConstant(SdkConstantType.FEATURE) |
| 1100 | public static final String FEATURE_CAMERA_EXTERNAL = "android.hardware.camera.external"; |
| 1101 | |
| 1102 | /** |
| 1103 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1104 | * {@link #hasSystemFeature}: The device's camera supports flash. |
| 1105 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 1106 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1107 | public static final String FEATURE_CAMERA_FLASH = "android.hardware.camera.flash"; |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1108 | |
| 1109 | /** |
| 1110 | * Feature for {@link #getSystemAvailableFeatures} and |
Chih-Chung Chang | de1057c | 2010-06-14 19:15:00 +0800 | [diff] [blame] | 1111 | * {@link #hasSystemFeature}: The device has a front facing camera. |
| 1112 | */ |
| 1113 | @SdkConstant(SdkConstantType.FEATURE) |
| 1114 | public static final String FEATURE_CAMERA_FRONT = "android.hardware.camera.front"; |
| 1115 | |
| 1116 | /** |
Eino-Ville Talvala | 611fece | 2014-07-10 17:29:38 -0700 | [diff] [blame] | 1117 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one |
| 1118 | * of the cameras on the device supports the |
| 1119 | * {@link android.hardware.camera2.CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL full hardware} |
| 1120 | * capability level. |
| 1121 | */ |
| 1122 | @SdkConstant(SdkConstantType.FEATURE) |
| 1123 | public static final String FEATURE_CAMERA_LEVEL_FULL = "android.hardware.camera.level.full"; |
| 1124 | |
| 1125 | /** |
| 1126 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one |
| 1127 | * of the cameras on the device supports the |
| 1128 | * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR manual sensor} |
| 1129 | * capability level. |
| 1130 | */ |
| 1131 | @SdkConstant(SdkConstantType.FEATURE) |
| 1132 | public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_SENSOR = |
| 1133 | "android.hardware.camera.capability.manual_sensor"; |
| 1134 | |
| 1135 | /** |
| 1136 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one |
| 1137 | * of the cameras on the device supports the |
| 1138 | * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING manual post-processing} |
| 1139 | * capability level. |
| 1140 | */ |
| 1141 | @SdkConstant(SdkConstantType.FEATURE) |
| 1142 | public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_POST_PROCESSING = |
| 1143 | "android.hardware.camera.capability.manual_post_processing"; |
| 1144 | |
| 1145 | /** |
| 1146 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one |
| 1147 | * of the cameras on the device supports the |
| 1148 | * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_RAW RAW} |
| 1149 | * capability level. |
| 1150 | */ |
| 1151 | @SdkConstant(SdkConstantType.FEATURE) |
| 1152 | public static final String FEATURE_CAMERA_CAPABILITY_RAW = |
| 1153 | "android.hardware.camera.capability.raw"; |
| 1154 | |
| 1155 | /** |
Chih-Chung Chang | de1057c | 2010-06-14 19:15:00 +0800 | [diff] [blame] | 1156 | * Feature for {@link #getSystemAvailableFeatures} and |
Alex Ray | 0c9d61f | 2013-10-03 12:17:54 -0700 | [diff] [blame] | 1157 | * {@link #hasSystemFeature}: The device is capable of communicating with |
| 1158 | * consumer IR devices. |
| 1159 | */ |
| 1160 | @SdkConstant(SdkConstantType.FEATURE) |
| 1161 | public static final String FEATURE_CONSUMER_IR = "android.hardware.consumerir"; |
| 1162 | |
| 1163 | /** |
| 1164 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1165 | * {@link #hasSystemFeature}: The device supports one or more methods of |
| 1166 | * reporting current location. |
| 1167 | */ |
| 1168 | @SdkConstant(SdkConstantType.FEATURE) |
| 1169 | public static final String FEATURE_LOCATION = "android.hardware.location"; |
| 1170 | |
| 1171 | /** |
| 1172 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1173 | * {@link #hasSystemFeature}: The device has a Global Positioning System |
| 1174 | * receiver and can report precise location. |
| 1175 | */ |
| 1176 | @SdkConstant(SdkConstantType.FEATURE) |
| 1177 | public static final String FEATURE_LOCATION_GPS = "android.hardware.location.gps"; |
| 1178 | |
| 1179 | /** |
| 1180 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1181 | * {@link #hasSystemFeature}: The device can report location with coarse |
| 1182 | * accuracy using a network-based geolocation system. |
| 1183 | */ |
| 1184 | @SdkConstant(SdkConstantType.FEATURE) |
| 1185 | public static final String FEATURE_LOCATION_NETWORK = "android.hardware.location.network"; |
| 1186 | |
| 1187 | /** |
| 1188 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1189 | * {@link #hasSystemFeature}: The device can record audio via a |
| 1190 | * microphone. |
| 1191 | */ |
| 1192 | @SdkConstant(SdkConstantType.FEATURE) |
| 1193 | public static final String FEATURE_MICROPHONE = "android.hardware.microphone"; |
| 1194 | |
| 1195 | /** |
| 1196 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 76437d3 | 2010-09-01 11:17:20 -0700 | [diff] [blame] | 1197 | * {@link #hasSystemFeature}: The device can communicate using Near-Field |
| 1198 | * Communications (NFC). |
| 1199 | */ |
| 1200 | @SdkConstant(SdkConstantType.FEATURE) |
| 1201 | public static final String FEATURE_NFC = "android.hardware.nfc"; |
| 1202 | |
| 1203 | /** |
| 1204 | * Feature for {@link #getSystemAvailableFeatures} and |
Martijn Coenen | f4bf158 | 2013-07-22 12:01:19 -0700 | [diff] [blame] | 1205 | * {@link #hasSystemFeature}: The device supports host- |
| 1206 | * based NFC card emulation. |
Martijn Coenen | df4d1d6 | 2013-08-28 11:18:58 -0700 | [diff] [blame] | 1207 | * |
| 1208 | * TODO remove when depending apps have moved to new constant. |
| 1209 | * @hide |
| 1210 | * @deprecated |
Martijn Coenen | f4bf158 | 2013-07-22 12:01:19 -0700 | [diff] [blame] | 1211 | */ |
Jose Lima | 970417c | 2014-04-10 10:42:19 -0700 | [diff] [blame] | 1212 | @Deprecated |
Martijn Coenen | f4bf158 | 2013-07-22 12:01:19 -0700 | [diff] [blame] | 1213 | @SdkConstant(SdkConstantType.FEATURE) |
| 1214 | public static final String FEATURE_NFC_HCE = "android.hardware.nfc.hce"; |
| 1215 | |
| 1216 | /** |
| 1217 | * Feature for {@link #getSystemAvailableFeatures} and |
Martijn Coenen | df4d1d6 | 2013-08-28 11:18:58 -0700 | [diff] [blame] | 1218 | * {@link #hasSystemFeature}: The device supports host- |
| 1219 | * based NFC card emulation. |
| 1220 | */ |
| 1221 | @SdkConstant(SdkConstantType.FEATURE) |
| 1222 | public static final String FEATURE_NFC_HOST_CARD_EMULATION = "android.hardware.nfc.hce"; |
| 1223 | |
| 1224 | /** |
| 1225 | * Feature for {@link #getSystemAvailableFeatures} and |
Jesse Hall | 7f51706 | 2014-07-18 11:54:41 -0700 | [diff] [blame] | 1226 | * {@link #hasSystemFeature}: The device supports the OpenGL ES |
| 1227 | * <a href="http://www.khronos.org/registry/gles/extensions/ANDROID/ANDROID_extension_pack_es31a.txt"> |
| 1228 | * Android Extension Pack</a>. |
| 1229 | */ |
| 1230 | @SdkConstant(SdkConstantType.FEATURE) |
| 1231 | public static final String FEATURE_OPENGLES_EXTENSION_PACK = "android.hardware.opengles.aep"; |
| 1232 | |
| 1233 | /** |
| 1234 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 5744bb4 | 2010-09-01 19:18:57 -0700 | [diff] [blame] | 1235 | * {@link #hasSystemFeature}: The device includes an accelerometer. |
| 1236 | */ |
| 1237 | @SdkConstant(SdkConstantType.FEATURE) |
| 1238 | public static final String FEATURE_SENSOR_ACCELEROMETER = "android.hardware.sensor.accelerometer"; |
| 1239 | |
| 1240 | /** |
| 1241 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1242 | * {@link #hasSystemFeature}: The device includes a barometer (air |
| 1243 | * pressure sensor.) |
| 1244 | */ |
| 1245 | @SdkConstant(SdkConstantType.FEATURE) |
| 1246 | public static final String FEATURE_SENSOR_BAROMETER = "android.hardware.sensor.barometer"; |
| 1247 | |
| 1248 | /** |
| 1249 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1250 | * {@link #hasSystemFeature}: The device includes a magnetometer (compass). |
| 1251 | */ |
| 1252 | @SdkConstant(SdkConstantType.FEATURE) |
| 1253 | public static final String FEATURE_SENSOR_COMPASS = "android.hardware.sensor.compass"; |
| 1254 | |
| 1255 | /** |
| 1256 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 5744bb4 | 2010-09-01 19:18:57 -0700 | [diff] [blame] | 1257 | * {@link #hasSystemFeature}: The device includes a gyroscope. |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1258 | */ |
| 1259 | @SdkConstant(SdkConstantType.FEATURE) |
Dan Morrill | 5744bb4 | 2010-09-01 19:18:57 -0700 | [diff] [blame] | 1260 | public static final String FEATURE_SENSOR_GYROSCOPE = "android.hardware.sensor.gyroscope"; |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1261 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1262 | /** |
| 1263 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1264 | * {@link #hasSystemFeature}: The device includes a light sensor. |
| 1265 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 1266 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1267 | public static final String FEATURE_SENSOR_LIGHT = "android.hardware.sensor.light"; |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1268 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1269 | /** |
| 1270 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1271 | * {@link #hasSystemFeature}: The device includes a proximity sensor. |
| 1272 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 1273 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1274 | public static final String FEATURE_SENSOR_PROXIMITY = "android.hardware.sensor.proximity"; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 1275 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1276 | /** |
| 1277 | * Feature for {@link #getSystemAvailableFeatures} and |
Aravind Akella | 068b0c0 | 2013-10-12 17:39:15 -0700 | [diff] [blame] | 1278 | * {@link #hasSystemFeature}: The device includes a hardware step counter. |
| 1279 | */ |
| 1280 | @SdkConstant(SdkConstantType.FEATURE) |
| 1281 | public static final String FEATURE_SENSOR_STEP_COUNTER = "android.hardware.sensor.stepcounter"; |
| 1282 | |
| 1283 | /** |
| 1284 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1285 | * {@link #hasSystemFeature}: The device includes a hardware step detector. |
| 1286 | */ |
| 1287 | @SdkConstant(SdkConstantType.FEATURE) |
| 1288 | public static final String FEATURE_SENSOR_STEP_DETECTOR = "android.hardware.sensor.stepdetector"; |
| 1289 | |
| 1290 | /** |
| 1291 | * Feature for {@link #getSystemAvailableFeatures} and |
Vinod Krishnan | 8afb23c | 2014-04-30 11:11:39 -0700 | [diff] [blame] | 1292 | * {@link #hasSystemFeature}: The device includes a heart rate monitor. |
| 1293 | */ |
| 1294 | @SdkConstant(SdkConstantType.FEATURE) |
| 1295 | public static final String FEATURE_SENSOR_HEART_RATE = "android.hardware.sensor.heartrate"; |
| 1296 | |
| 1297 | /** |
| 1298 | * Feature for {@link #getSystemAvailableFeatures} and |
Vinod Krishnan | 1ab7689 | 2014-08-20 11:11:55 -0700 | [diff] [blame] | 1299 | * {@link #hasSystemFeature}: The heart rate sensor on this device is an Electrocargiogram. |
| 1300 | */ |
| 1301 | @SdkConstant(SdkConstantType.FEATURE) |
| 1302 | public static final String FEATURE_SENSOR_HEART_RATE_ECG = |
| 1303 | "android.hardware.sensor.heartrate.ecg"; |
| 1304 | |
| 1305 | /** |
| 1306 | * Feature for {@link #getSystemAvailableFeatures} and |
Aravind Akella | 8b8e74b | 2014-07-09 11:52:39 -0700 | [diff] [blame] | 1307 | * {@link #hasSystemFeature}: The device includes a relative humidity sensor. |
| 1308 | */ |
| 1309 | @SdkConstant(SdkConstantType.FEATURE) |
| 1310 | public static final String FEATURE_SENSOR_RELATIVE_HUMIDITY = |
| 1311 | "android.hardware.sensor.relative_humidity"; |
| 1312 | |
| 1313 | /** |
| 1314 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1315 | * {@link #hasSystemFeature}: The device includes an ambient temperature sensor. |
| 1316 | */ |
| 1317 | @SdkConstant(SdkConstantType.FEATURE) |
| 1318 | public static final String FEATURE_SENSOR_AMBIENT_TEMPERATURE = |
| 1319 | "android.hardware.sensor.ambient_temperature"; |
| 1320 | |
| 1321 | /** |
| 1322 | * Feature for {@link #getSystemAvailableFeatures} and |
Ashutosh Joshi | eae371b | 2015-04-09 10:30:07 -0700 | [diff] [blame] | 1323 | * {@link #hasSystemFeature}: The device supports high fidelity sensor processing |
| 1324 | * capabilities. |
| 1325 | */ |
| 1326 | @SdkConstant(SdkConstantType.FEATURE) |
| 1327 | public static final String FEATURE_HIFI_SENSORS = |
| 1328 | "android.hardware.sensor.hifi_sensors"; |
| 1329 | |
| 1330 | /** |
| 1331 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1332 | * {@link #hasSystemFeature}: The device has a telephony radio with data |
| 1333 | * communication support. |
| 1334 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 1335 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1336 | public static final String FEATURE_TELEPHONY = "android.hardware.telephony"; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 1337 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1338 | /** |
| 1339 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1340 | * {@link #hasSystemFeature}: The device has a CDMA telephony stack. |
| 1341 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 1342 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1343 | public static final String FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma"; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 1344 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1345 | /** |
| 1346 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1347 | * {@link #hasSystemFeature}: The device has a GSM telephony stack. |
| 1348 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 1349 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1350 | public static final String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm"; |
Hung-ying Tyan | 3424c02 | 2010-08-27 18:08:19 +0800 | [diff] [blame] | 1351 | |
| 1352 | /** |
| 1353 | * Feature for {@link #getSystemAvailableFeatures} and |
Mike Lockwood | f4ca247 | 2011-02-27 11:23:25 -0800 | [diff] [blame] | 1354 | * {@link #hasSystemFeature}: The device supports connecting to USB devices |
| 1355 | * as the USB host. |
| 1356 | */ |
| 1357 | @SdkConstant(SdkConstantType.FEATURE) |
| 1358 | public static final String FEATURE_USB_HOST = "android.hardware.usb.host"; |
| 1359 | |
| 1360 | /** |
| 1361 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1362 | * {@link #hasSystemFeature}: The device supports connecting to USB accessories. |
| 1363 | */ |
| 1364 | @SdkConstant(SdkConstantType.FEATURE) |
| 1365 | public static final String FEATURE_USB_ACCESSORY = "android.hardware.usb.accessory"; |
| 1366 | |
| 1367 | /** |
| 1368 | * Feature for {@link #getSystemAvailableFeatures} and |
Hung-ying Tyan | 3424c02 | 2010-08-27 18:08:19 +0800 | [diff] [blame] | 1369 | * {@link #hasSystemFeature}: The SIP API is enabled on the device. |
| 1370 | */ |
| 1371 | @SdkConstant(SdkConstantType.FEATURE) |
| 1372 | public static final String FEATURE_SIP = "android.software.sip"; |
| 1373 | |
| 1374 | /** |
| 1375 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1376 | * {@link #hasSystemFeature}: The device supports SIP-based VOIP. |
| 1377 | */ |
| 1378 | @SdkConstant(SdkConstantType.FEATURE) |
| 1379 | public static final String FEATURE_SIP_VOIP = "android.software.sip.voip"; |
| 1380 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1381 | /** |
| 1382 | * Feature for {@link #getSystemAvailableFeatures} and |
Ihab Awad | 1ec6888 | 2014-09-12 11:09:01 -0700 | [diff] [blame] | 1383 | * {@link #hasSystemFeature}: The Connection Service API is enabled on the device. |
| 1384 | */ |
| 1385 | @SdkConstant(SdkConstantType.FEATURE) |
| 1386 | public static final String FEATURE_CONNECTION_SERVICE = "android.software.connectionservice"; |
| 1387 | |
| 1388 | /** |
| 1389 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | b0fe033 | 2010-04-05 14:43:58 -0700 | [diff] [blame] | 1390 | * {@link #hasSystemFeature}: The device's display has a touch screen. |
| 1391 | */ |
| 1392 | @SdkConstant(SdkConstantType.FEATURE) |
| 1393 | public static final String FEATURE_TOUCHSCREEN = "android.hardware.touchscreen"; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 1394 | |
Dan Morrill | b0fe033 | 2010-04-05 14:43:58 -0700 | [diff] [blame] | 1395 | /** |
| 1396 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1397 | * {@link #hasSystemFeature}: The device's touch screen supports |
| 1398 | * multitouch sufficient for basic two-finger gesture detection. |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1399 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 1400 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1401 | public static final String FEATURE_TOUCHSCREEN_MULTITOUCH = "android.hardware.touchscreen.multitouch"; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 1402 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1403 | /** |
| 1404 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1405 | * {@link #hasSystemFeature}: The device's touch screen is capable of |
| 1406 | * tracking two or more fingers fully independently. |
| 1407 | */ |
| 1408 | @SdkConstant(SdkConstantType.FEATURE) |
| 1409 | public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT = "android.hardware.touchscreen.multitouch.distinct"; |
| 1410 | |
| 1411 | /** |
| 1412 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 6993d3d | 2010-09-03 14:30:14 -0700 | [diff] [blame] | 1413 | * {@link #hasSystemFeature}: The device's touch screen is capable of |
| 1414 | * tracking a full hand of fingers fully independently -- that is, 5 or |
| 1415 | * more simultaneous independent pointers. |
| 1416 | */ |
| 1417 | @SdkConstant(SdkConstantType.FEATURE) |
| 1418 | public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND = "android.hardware.touchscreen.multitouch.jazzhand"; |
| 1419 | |
| 1420 | /** |
| 1421 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | a537687 | 2011-01-23 13:15:53 -0800 | [diff] [blame] | 1422 | * {@link #hasSystemFeature}: The device does not have a touch screen, but |
| 1423 | * does support touch emulation for basic events. For instance, the |
| 1424 | * device might use a mouse or remote control to drive a cursor, and |
| 1425 | * emulate basic touch pointer events like down, up, drag, etc. All |
| 1426 | * devices that support android.hardware.touchscreen or a sub-feature are |
| 1427 | * presumed to also support faketouch. |
| 1428 | */ |
| 1429 | @SdkConstant(SdkConstantType.FEATURE) |
| 1430 | public static final String FEATURE_FAKETOUCH = "android.hardware.faketouch"; |
| 1431 | |
| 1432 | /** |
| 1433 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | e22fe93 | 2011-06-08 20:24:29 -0700 | [diff] [blame] | 1434 | * {@link #hasSystemFeature}: The device does not have a touch screen, but |
| 1435 | * does support touch emulation for basic events that supports distinct |
| 1436 | * tracking of two or more fingers. This is an extension of |
| 1437 | * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note |
| 1438 | * that unlike a distinct multitouch screen as defined by |
| 1439 | * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT}, these kinds of input |
| 1440 | * devices will not actually provide full two-finger gestures since the |
| 1441 | * input is being transformed to cursor movement on the screen. That is, |
| 1442 | * single finger gestures will move a cursor; two-finger swipes will |
| 1443 | * result in single-finger touch events; other two-finger gestures will |
| 1444 | * result in the corresponding two-finger touch event. |
| 1445 | */ |
| 1446 | @SdkConstant(SdkConstantType.FEATURE) |
| 1447 | public static final String FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT = "android.hardware.faketouch.multitouch.distinct"; |
| 1448 | |
| 1449 | /** |
| 1450 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1451 | * {@link #hasSystemFeature}: The device does not have a touch screen, but |
| 1452 | * does support touch emulation for basic events that supports tracking |
| 1453 | * a hand of fingers (5 or more fingers) fully independently. |
| 1454 | * This is an extension of |
| 1455 | * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note |
| 1456 | * that unlike a multitouch screen as defined by |
| 1457 | * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND}, not all two finger |
| 1458 | * gestures can be detected due to the limitations described for |
| 1459 | * {@link #FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT}. |
| 1460 | */ |
| 1461 | @SdkConstant(SdkConstantType.FEATURE) |
| 1462 | public static final String FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND = "android.hardware.faketouch.multitouch.jazzhand"; |
| 1463 | |
| 1464 | /** |
| 1465 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | e289bff | 2011-06-13 19:33:22 -0700 | [diff] [blame] | 1466 | * {@link #hasSystemFeature}: The device supports portrait orientation |
| 1467 | * screens. For backwards compatibility, you can assume that if neither |
| 1468 | * this nor {@link #FEATURE_SCREEN_LANDSCAPE} is set then the device supports |
| 1469 | * both portrait and landscape. |
| 1470 | */ |
| 1471 | @SdkConstant(SdkConstantType.FEATURE) |
| 1472 | public static final String FEATURE_SCREEN_PORTRAIT = "android.hardware.screen.portrait"; |
| 1473 | |
| 1474 | /** |
| 1475 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1476 | * {@link #hasSystemFeature}: The device supports landscape orientation |
| 1477 | * screens. For backwards compatibility, you can assume that if neither |
| 1478 | * this nor {@link #FEATURE_SCREEN_PORTRAIT} is set then the device supports |
| 1479 | * both portrait and landscape. |
| 1480 | */ |
| 1481 | @SdkConstant(SdkConstantType.FEATURE) |
| 1482 | public static final String FEATURE_SCREEN_LANDSCAPE = "android.hardware.screen.landscape"; |
| 1483 | |
| 1484 | /** |
| 1485 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1486 | * {@link #hasSystemFeature}: The device supports live wallpapers. |
| 1487 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 1488 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1489 | public static final String FEATURE_LIVE_WALLPAPER = "android.software.live_wallpaper"; |
Oscar Montemayor | 1228d0a | 2010-01-28 12:01:44 -0800 | [diff] [blame] | 1490 | /** |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1491 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | 119bbc3 | 2013-03-22 17:27:25 -0700 | [diff] [blame] | 1492 | * {@link #hasSystemFeature}: The device supports app widgets. |
| 1493 | */ |
| 1494 | @SdkConstant(SdkConstantType.FEATURE) |
| 1495 | public static final String FEATURE_APP_WIDGETS = "android.software.app_widgets"; |
| 1496 | |
| 1497 | /** |
Dianne Hackborn | 91097de | 2014-04-04 18:02:06 -0700 | [diff] [blame] | 1498 | * @hide |
| 1499 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1500 | * {@link #hasSystemFeature}: The device supports |
| 1501 | * {@link android.service.voice.VoiceInteractionService} and |
| 1502 | * {@link android.app.VoiceInteractor}. |
| 1503 | */ |
| 1504 | @SdkConstant(SdkConstantType.FEATURE) |
| 1505 | public static final String FEATURE_VOICE_RECOGNIZERS = "android.software.voice_recognizers"; |
| 1506 | |
| 1507 | |
| 1508 | /** |
Dianne Hackborn | 119bbc3 | 2013-03-22 17:27:25 -0700 | [diff] [blame] | 1509 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1510 | * {@link #hasSystemFeature}: The device supports a home screen that is replaceable |
| 1511 | * by third party applications. |
| 1512 | */ |
| 1513 | @SdkConstant(SdkConstantType.FEATURE) |
| 1514 | public static final String FEATURE_HOME_SCREEN = "android.software.home_screen"; |
| 1515 | |
| 1516 | /** |
| 1517 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1518 | * {@link #hasSystemFeature}: The device supports adding new input methods implemented |
| 1519 | * with the {@link android.inputmethodservice.InputMethodService} API. |
| 1520 | */ |
| 1521 | @SdkConstant(SdkConstantType.FEATURE) |
| 1522 | public static final String FEATURE_INPUT_METHODS = "android.software.input_methods"; |
| 1523 | |
| 1524 | /** |
| 1525 | * Feature for {@link #getSystemAvailableFeatures} and |
Amith Yamasani | 44a01b7 | 2013-09-16 10:44:57 -0700 | [diff] [blame] | 1526 | * {@link #hasSystemFeature}: The device supports device policy enforcement via device admins. |
| 1527 | */ |
| 1528 | @SdkConstant(SdkConstantType.FEATURE) |
| 1529 | public static final String FEATURE_DEVICE_ADMIN = "android.software.device_admin"; |
| 1530 | |
| 1531 | /** |
| 1532 | * Feature for {@link #getSystemAvailableFeatures} and |
Tim Kilbourn | f94b6a9 | 2014-03-07 15:13:48 -0800 | [diff] [blame] | 1533 | * {@link #hasSystemFeature}: The device supports leanback UI. This is |
| 1534 | * typically used in a living room television experience, but is a software |
| 1535 | * feature unlike {@link #FEATURE_TELEVISION}. Devices running with this |
| 1536 | * feature will use resources associated with the "television" UI mode. |
| 1537 | */ |
| 1538 | @SdkConstant(SdkConstantType.FEATURE) |
| 1539 | public static final String FEATURE_LEANBACK = "android.software.leanback"; |
| 1540 | |
| 1541 | /** |
| 1542 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1543 | * {@link #hasSystemFeature}: The device supports only leanback UI. Only |
| 1544 | * applications designed for this experience should be run, though this is |
| 1545 | * not enforced by the system. |
| 1546 | * @hide |
| 1547 | */ |
| 1548 | @SdkConstant(SdkConstantType.FEATURE) |
| 1549 | public static final String FEATURE_LEANBACK_ONLY = "android.software.leanback_only"; |
| 1550 | |
| 1551 | /** |
| 1552 | * Feature for {@link #getSystemAvailableFeatures} and |
Jae Seo | cfd861e | 2014-08-27 14:02:15 -0700 | [diff] [blame] | 1553 | * {@link #hasSystemFeature}: The device supports live TV and can display |
| 1554 | * contents from TV inputs implemented with the |
| 1555 | * {@link android.media.tv.TvInputService} API. |
| 1556 | */ |
| 1557 | @SdkConstant(SdkConstantType.FEATURE) |
| 1558 | public static final String FEATURE_LIVE_TV = "android.software.live_tv"; |
| 1559 | |
| 1560 | /** |
| 1561 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1562 | * {@link #hasSystemFeature}: The device supports WiFi (802.11) networking. |
| 1563 | */ |
| 1564 | @SdkConstant(SdkConstantType.FEATURE) |
| 1565 | public static final String FEATURE_WIFI = "android.hardware.wifi"; |
| 1566 | |
| 1567 | /** |
Irfan Sheriff | 45b8b46 | 2011-09-07 11:24:16 -0700 | [diff] [blame] | 1568 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1569 | * {@link #hasSystemFeature}: The device supports Wi-Fi Direct networking. |
| 1570 | */ |
| 1571 | @SdkConstant(SdkConstantType.FEATURE) |
| 1572 | public static final String FEATURE_WIFI_DIRECT = "android.hardware.wifi.direct"; |
| 1573 | |
| 1574 | /** |
Dianne Hackborn | 0cf2c8a | 2012-05-17 17:29:49 -0700 | [diff] [blame] | 1575 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1576 | * {@link #hasSystemFeature}: This is a device dedicated to showing UI |
| 1577 | * on a television. Television here is defined to be a typical living |
| 1578 | * room television experience: displayed on a big screen, where the user |
| 1579 | * is sitting far away from it, and the dominant form of input will be |
| 1580 | * something like a DPAD, not through touch or mouse. |
Tim Kilbourn | f94b6a9 | 2014-03-07 15:13:48 -0800 | [diff] [blame] | 1581 | * @deprecated use {@link #FEATURE_LEANBACK} instead. |
Dianne Hackborn | 0cf2c8a | 2012-05-17 17:29:49 -0700 | [diff] [blame] | 1582 | */ |
Jose Lima | 970417c | 2014-04-10 10:42:19 -0700 | [diff] [blame] | 1583 | @Deprecated |
Dianne Hackborn | 0cf2c8a | 2012-05-17 17:29:49 -0700 | [diff] [blame] | 1584 | @SdkConstant(SdkConstantType.FEATURE) |
| 1585 | public static final String FEATURE_TELEVISION = "android.hardware.type.television"; |
| 1586 | |
| 1587 | /** |
Justin Koh | b5731f091c | 2014-02-13 16:06:59 -0800 | [diff] [blame] | 1588 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1589 | * {@link #hasSystemFeature}: This is a device dedicated to showing UI |
| 1590 | * on a watch. A watch here is defined to be a device worn on the body, perhaps on |
| 1591 | * the wrist. The user is very close when interacting with the device. |
| 1592 | */ |
| 1593 | @SdkConstant(SdkConstantType.FEATURE) |
| 1594 | public static final String FEATURE_WATCH = "android.hardware.type.watch"; |
| 1595 | |
| 1596 | /** |
Adam Lesinski | 3d9bcb9 | 2014-02-18 14:05:14 -0800 | [diff] [blame] | 1597 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
| 1598 | * The device supports printing. |
| 1599 | */ |
| 1600 | @SdkConstant(SdkConstantType.FEATURE) |
| 1601 | public static final String FEATURE_PRINTING = "android.software.print"; |
| 1602 | |
| 1603 | /** |
| 1604 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
| 1605 | * The device can perform backup and restore operations on installed applications. |
| 1606 | */ |
| 1607 | @SdkConstant(SdkConstantType.FEATURE) |
| 1608 | public static final String FEATURE_BACKUP = "android.software.backup"; |
| 1609 | |
| 1610 | /** |
Adam Connors | 23cc04e | 2014-04-01 12:12:20 +0100 | [diff] [blame] | 1611 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Amith Yamasani | 1d65327 | 2014-09-11 17:56:05 -0700 | [diff] [blame] | 1612 | * The device supports creating secondary users and managed profiles via |
| 1613 | * {@link DevicePolicyManager}. |
Adam Connors | 23cc04e | 2014-04-01 12:12:20 +0100 | [diff] [blame] | 1614 | */ |
| 1615 | @SdkConstant(SdkConstantType.FEATURE) |
Amith Yamasani | 1d65327 | 2014-09-11 17:56:05 -0700 | [diff] [blame] | 1616 | public static final String FEATURE_MANAGED_USERS = "android.software.managed_users"; |
| 1617 | |
| 1618 | /** |
| 1619 | * @hide |
| 1620 | * TODO: Remove after dependencies updated b/17392243 |
| 1621 | */ |
| 1622 | public static final String FEATURE_MANAGED_PROFILES = "android.software.managed_users"; |
Adam Connors | 23cc04e | 2014-04-01 12:12:20 +0100 | [diff] [blame] | 1623 | |
| 1624 | /** |
Ben Murdoch | f564c7f | 2014-05-20 18:58:06 +0100 | [diff] [blame] | 1625 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Adam Connors | 19ccb5f | 2014-09-08 17:31:50 +0100 | [diff] [blame] | 1626 | * The device supports verified boot. |
| 1627 | */ |
| 1628 | @SdkConstant(SdkConstantType.FEATURE) |
| 1629 | public static final String FEATURE_VERIFIED_BOOT = "android.software.verified_boot"; |
| 1630 | |
| 1631 | /** |
| 1632 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
| 1633 | * The device supports secure removal of users. When a user is deleted the data associated |
| 1634 | * with that user is securely deleted and no longer available. |
| 1635 | */ |
| 1636 | @SdkConstant(SdkConstantType.FEATURE) |
| 1637 | public static final String FEATURE_SECURELY_REMOVES_USERS |
| 1638 | = "android.software.securely_removes_users"; |
| 1639 | |
| 1640 | /** |
| 1641 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Ben Murdoch | 422c7a5 | 2014-05-16 13:45:47 +0100 | [diff] [blame] | 1642 | * The device has a full implementation of the android.webkit.* APIs. Devices |
| 1643 | * lacking this feature will not have a functioning WebView implementation. |
| 1644 | */ |
| 1645 | @SdkConstant(SdkConstantType.FEATURE) |
| 1646 | public static final String FEATURE_WEBVIEW = "android.software.webview"; |
| 1647 | |
| 1648 | /** |
Joe LaPenna | 4bb015d | 2014-07-04 17:15:54 -0700 | [diff] [blame] | 1649 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1650 | * {@link #hasSystemFeature}: This device supports ethernet. |
| 1651 | * @hide |
| 1652 | */ |
| 1653 | @SdkConstant(SdkConstantType.FEATURE) |
| 1654 | public static final String FEATURE_ETHERNET = "android.hardware.ethernet"; |
| 1655 | |
| 1656 | /** |
Yuncheol Heo | a0c4a06 | 2014-07-10 20:49:27 +0900 | [diff] [blame] | 1657 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1658 | * {@link #hasSystemFeature}: This device supports HDMI-CEC. |
| 1659 | * @hide |
| 1660 | */ |
| 1661 | @SdkConstant(SdkConstantType.FEATURE) |
| 1662 | public static final String FEATURE_HDMI_CEC = "android.hardware.hdmi.cec"; |
| 1663 | |
| 1664 | /** |
Michael Wright | 6faa675 | 2014-09-05 17:57:44 -0700 | [diff] [blame] | 1665 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
| 1666 | * The device has all of the inputs necessary to be considered a compatible game controller, or |
| 1667 | * includes a compatible game controller in the box. |
| 1668 | */ |
| 1669 | @SdkConstant(SdkConstantType.FEATURE) |
| 1670 | public static final String FEATURE_GAMEPAD = "android.hardware.gamepad"; |
| 1671 | |
Mike Lockwood | 5781cd5 | 2015-03-27 13:23:41 -0700 | [diff] [blame] | 1672 | /** |
| 1673 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
| 1674 | * The device has a full implementation of the android.media.midi.* APIs. |
| 1675 | */ |
| 1676 | @SdkConstant(SdkConstantType.FEATURE) |
| 1677 | public static final String FEATURE_MIDI = "android.software.midi"; |
Michael Wright | 6faa675 | 2014-09-05 17:57:44 -0700 | [diff] [blame] | 1678 | |
| 1679 | /** |
Dianne Hackborn | e83cefce | 2010-02-04 17:38:14 -0800 | [diff] [blame] | 1680 | * Action to external storage service to clean out removed apps. |
| 1681 | * @hide |
| 1682 | */ |
| 1683 | public static final String ACTION_CLEAN_EXTERNAL_STORAGE |
| 1684 | = "android.content.pm.CLEAN_EXTERNAL_STORAGE"; |
Oscar Montemayor | 1228d0a | 2010-01-28 12:01:44 -0800 | [diff] [blame] | 1685 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1686 | /** |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 1687 | * Extra field name for the URI to a verification file. Passed to a package |
| 1688 | * verifier. |
| 1689 | * |
| 1690 | * @hide |
| 1691 | */ |
| 1692 | public static final String EXTRA_VERIFICATION_URI = "android.content.pm.extra.VERIFICATION_URI"; |
| 1693 | |
| 1694 | /** |
| 1695 | * Extra field name for the ID of a package pending verification. Passed to |
| 1696 | * a package verifier and is used to call back to |
Kenny Root | 3a9b5fb | 2011-09-20 14:15:38 -0700 | [diff] [blame] | 1697 | * {@link PackageManager#verifyPendingInstall(int, int)} |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 1698 | */ |
| 1699 | public static final String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID"; |
| 1700 | |
| 1701 | /** |
| 1702 | * Extra field name for the package identifier which is trying to install |
| 1703 | * the package. |
| 1704 | * |
| 1705 | * @hide |
| 1706 | */ |
| 1707 | public static final String EXTRA_VERIFICATION_INSTALLER_PACKAGE |
| 1708 | = "android.content.pm.extra.VERIFICATION_INSTALLER_PACKAGE"; |
| 1709 | |
| 1710 | /** |
| 1711 | * Extra field name for the requested install flags for a package pending |
| 1712 | * verification. Passed to a package verifier. |
| 1713 | * |
| 1714 | * @hide |
| 1715 | */ |
| 1716 | public static final String EXTRA_VERIFICATION_INSTALL_FLAGS |
| 1717 | = "android.content.pm.extra.VERIFICATION_INSTALL_FLAGS"; |
| 1718 | |
| 1719 | /** |
rich cannings | 13d428e | 2012-09-13 13:43:07 -0700 | [diff] [blame] | 1720 | * Extra field name for the uid of who is requesting to install |
| 1721 | * the package. |
| 1722 | * |
| 1723 | * @hide |
| 1724 | */ |
| 1725 | public static final String EXTRA_VERIFICATION_INSTALLER_UID |
| 1726 | = "android.content.pm.extra.VERIFICATION_INSTALLER_UID"; |
| 1727 | |
| 1728 | /** |
| 1729 | * Extra field name for the package name of a package pending verification. |
| 1730 | * |
| 1731 | * @hide |
| 1732 | */ |
| 1733 | public static final String EXTRA_VERIFICATION_PACKAGE_NAME |
| 1734 | = "android.content.pm.extra.VERIFICATION_PACKAGE_NAME"; |
| 1735 | /** |
rich cannings | d1b5cfc | 2012-08-29 14:49:51 -0700 | [diff] [blame] | 1736 | * Extra field name for the result of a verification, either |
| 1737 | * {@link #VERIFICATION_ALLOW}, or {@link #VERIFICATION_REJECT}. |
| 1738 | * Passed to package verifiers after a package is verified. |
| 1739 | */ |
| 1740 | public static final String EXTRA_VERIFICATION_RESULT |
| 1741 | = "android.content.pm.extra.VERIFICATION_RESULT"; |
| 1742 | |
| 1743 | /** |
rich cannings | 13d428e | 2012-09-13 13:43:07 -0700 | [diff] [blame] | 1744 | * Extra field name for the version code of a package pending verification. |
| 1745 | * |
| 1746 | * @hide |
| 1747 | */ |
| 1748 | public static final String EXTRA_VERIFICATION_VERSION_CODE |
| 1749 | = "android.content.pm.extra.VERIFICATION_VERSION_CODE"; |
| 1750 | |
| 1751 | /** |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 1752 | * Extra field name for the ID of a intent filter pending verification. Passed to |
| 1753 | * an intent filter verifier and is used to call back to |
| 1754 | * {@link PackageManager#verifyIntentFilter(int, int)} |
| 1755 | * |
| 1756 | * @hide |
| 1757 | */ |
| 1758 | public static final String EXTRA_INTENT_FILTER_VERIFICATION_ID |
| 1759 | = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_ID"; |
| 1760 | |
| 1761 | /** |
| 1762 | * Extra field name for the scheme used for an intent filter pending verification. Passed to |
| 1763 | * an intent filter verifier and is used to construct the URI to verify against. |
| 1764 | * |
| 1765 | * Usually this is "https" |
| 1766 | * |
| 1767 | * @hide |
| 1768 | */ |
| 1769 | public static final String EXTRA_INTENT_FILTER_VERIFICATION_URI_SCHEME |
| 1770 | = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_URI_SCHEME"; |
| 1771 | |
| 1772 | /** |
| 1773 | * Extra field name for the host names to be used for an intent filter pending verification. |
| 1774 | * Passed to an intent filter verifier and is used to construct the URI to verify the |
| 1775 | * intent filter. |
| 1776 | * |
| 1777 | * This is a space delimited list of hosts. |
| 1778 | * |
| 1779 | * @hide |
| 1780 | */ |
| 1781 | public static final String EXTRA_INTENT_FILTER_VERIFICATION_HOSTS |
| 1782 | = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_HOSTS"; |
| 1783 | |
| 1784 | /** |
| 1785 | * Extra field name for the package name to be used for an intent filter pending verification. |
| 1786 | * Passed to an intent filter verifier and is used to check the verification responses coming |
| 1787 | * from the hosts. Each host response will need to include the package name of APK containing |
| 1788 | * the intent filter. |
| 1789 | * |
| 1790 | * @hide |
| 1791 | */ |
| 1792 | public static final String EXTRA_INTENT_FILTER_VERIFICATION_PACKAGE_NAME |
| 1793 | = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_PACKAGE_NAME"; |
| 1794 | |
| 1795 | /** |
| 1796 | * The action used to request that the user approve a permission request |
| 1797 | * from the application. |
Nick Kralevich | 035f80d | 2013-03-27 15:20:08 -0700 | [diff] [blame] | 1798 | * |
| 1799 | * @hide |
| 1800 | */ |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 1801 | @SystemApi |
| 1802 | public static final String ACTION_REQUEST_PERMISSIONS = |
| 1803 | "android.content.pm.action.REQUEST_PERMISSIONS"; |
Nick Kralevich | 035f80d | 2013-03-27 15:20:08 -0700 | [diff] [blame] | 1804 | |
| 1805 | /** |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 1806 | * The component name handling runtime permission grants. |
Nick Kralevich | 035f80d | 2013-03-27 15:20:08 -0700 | [diff] [blame] | 1807 | * |
| 1808 | * @hide |
| 1809 | */ |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 1810 | public static final String GRANT_PERMISSIONS_PACKAGE_NAME = |
| 1811 | "com.android.packageinstaller"; |
| 1812 | |
| 1813 | /** |
| 1814 | * The names of the requested permissions. |
| 1815 | * <p> |
| 1816 | * <strong>Type:</strong> String[] |
| 1817 | * </p> |
| 1818 | * |
| 1819 | * @hide |
| 1820 | */ |
| 1821 | @SystemApi |
| 1822 | public static final String EXTRA_REQUEST_PERMISSIONS_NAMES = |
| 1823 | "android.content.pm.extra.REQUEST_PERMISSIONS_NAMES"; |
| 1824 | |
| 1825 | /** |
| 1826 | * The results from the permissions request. |
| 1827 | * <p> |
| 1828 | * <strong>Type:</strong> int[] of #PermissionResult |
| 1829 | * </p> |
| 1830 | * |
| 1831 | * @hide |
| 1832 | */ |
| 1833 | @SystemApi |
| 1834 | public static final String EXTRA_REQUEST_PERMISSIONS_RESULTS |
| 1835 | = "android.content.pm.extra.REQUEST_PERMISSIONS_RESULTS"; |
Nick Kralevich | 035f80d | 2013-03-27 15:20:08 -0700 | [diff] [blame] | 1836 | |
| 1837 | /** |
Jeff Sharkey | bb58067 | 2014-07-10 12:10:25 -0700 | [diff] [blame] | 1838 | * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of |
Christopher Tate | f1977b4 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 1839 | * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the package which provides |
| 1840 | * the existing definition for the permission. |
| 1841 | * @hide |
| 1842 | */ |
| 1843 | public static final String EXTRA_FAILURE_EXISTING_PACKAGE |
| 1844 | = "android.content.pm.extra.FAILURE_EXISTING_PACKAGE"; |
| 1845 | |
| 1846 | /** |
Jeff Sharkey | bb58067 | 2014-07-10 12:10:25 -0700 | [diff] [blame] | 1847 | * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of |
Christopher Tate | f1977b4 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 1848 | * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the permission that is |
| 1849 | * being redundantly defined by the package being installed. |
| 1850 | * @hide |
| 1851 | */ |
| 1852 | public static final String EXTRA_FAILURE_EXISTING_PERMISSION |
| 1853 | = "android.content.pm.extra.FAILURE_EXISTING_PERMISSION"; |
| 1854 | |
| 1855 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1856 | * Retrieve overall information about an application package that is |
| 1857 | * installed on the system. |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 1858 | * <p> |
| 1859 | * Throws {@link NameNotFoundException} if a package with the given name can |
| 1860 | * not be found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1861 | * |
| 1862 | * @param packageName The full name (i.e. com.google.apps.contacts) of the |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 1863 | * desired package. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1864 | * @param flags Additional option flags. Use any combination of |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 1865 | * {@link #GET_ACTIVITIES}, {@link #GET_GIDS}, |
| 1866 | * {@link #GET_CONFIGURATIONS}, {@link #GET_INSTRUMENTATION}, |
| 1867 | * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS}, |
| 1868 | * {@link #GET_RECEIVERS}, {@link #GET_SERVICES}, |
| 1869 | * {@link #GET_SIGNATURES}, {@link #GET_UNINSTALLED_PACKAGES} to |
| 1870 | * modify the data returned. |
| 1871 | * @return Returns a PackageInfo object containing information about the |
| 1872 | * package. If flag GET_UNINSTALLED_PACKAGES is set and if the |
| 1873 | * package is not found in the list of installed applications, the |
| 1874 | * package information is retrieved from the list of uninstalled |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 1875 | * applications (which includes installed applications as well as |
| 1876 | * applications with data directory i.e. applications which had been |
| 1877 | * deleted with {@code DONT_DELETE_DATA} flag set). |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1878 | * @see #GET_ACTIVITIES |
| 1879 | * @see #GET_GIDS |
| 1880 | * @see #GET_CONFIGURATIONS |
| 1881 | * @see #GET_INSTRUMENTATION |
| 1882 | * @see #GET_PERMISSIONS |
| 1883 | * @see #GET_PROVIDERS |
| 1884 | * @see #GET_RECEIVERS |
| 1885 | * @see #GET_SERVICES |
| 1886 | * @see #GET_SIGNATURES |
| 1887 | * @see #GET_UNINSTALLED_PACKAGES |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1888 | */ |
| 1889 | public abstract PackageInfo getPackageInfo(String packageName, int flags) |
| 1890 | throws NameNotFoundException; |
| 1891 | |
| 1892 | /** |
Dianne Hackborn | 4709693 | 2010-02-11 15:57:09 -0800 | [diff] [blame] | 1893 | * Map from the current package names in use on the device to whatever |
| 1894 | * the current canonical name of that package is. |
| 1895 | * @param names Array of current names to be mapped. |
| 1896 | * @return Returns an array of the same size as the original, containing |
| 1897 | * the canonical name for each package. |
| 1898 | */ |
| 1899 | public abstract String[] currentToCanonicalPackageNames(String[] names); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 1900 | |
Dianne Hackborn | 4709693 | 2010-02-11 15:57:09 -0800 | [diff] [blame] | 1901 | /** |
| 1902 | * Map from a packages canonical name to the current name in use on the device. |
| 1903 | * @param names Array of new names to be mapped. |
| 1904 | * @return Returns an array of the same size as the original, containing |
| 1905 | * the current name for each package. |
| 1906 | */ |
| 1907 | public abstract String[] canonicalToCurrentPackageNames(String[] names); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 1908 | |
Dianne Hackborn | 4709693 | 2010-02-11 15:57:09 -0800 | [diff] [blame] | 1909 | /** |
Andrew Solovay | 5ae1335 | 2014-06-06 12:23:09 -0700 | [diff] [blame] | 1910 | * Returns a "good" intent to launch a front-door activity in a package. |
| 1911 | * This is used, for example, to implement an "open" button when browsing |
| 1912 | * through packages. The current implementation looks first for a main |
| 1913 | * activity in the category {@link Intent#CATEGORY_INFO}, and next for a |
| 1914 | * main activity in the category {@link Intent#CATEGORY_LAUNCHER}. Returns |
| 1915 | * <code>null</code> if neither are found. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1916 | * |
| 1917 | * @param packageName The name of the package to inspect. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 1918 | * |
Andrew Solovay | 5ae1335 | 2014-06-06 12:23:09 -0700 | [diff] [blame] | 1919 | * @return A fully-qualified {@link Intent} that can be used to launch the |
| 1920 | * main activity in the package. Returns <code>null</code> if the package |
| 1921 | * does not contain such an activity, or if <em>packageName</em> is not |
Ihab Awad | 1ec6888 | 2014-09-12 11:09:01 -0700 | [diff] [blame] | 1922 | * recognized. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1923 | */ |
Mihai Preda | eae850c | 2009-05-13 10:13:48 +0200 | [diff] [blame] | 1924 | public abstract Intent getLaunchIntentForPackage(String packageName); |
| 1925 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1926 | /** |
Jose Lima | 970417c | 2014-04-10 10:42:19 -0700 | [diff] [blame] | 1927 | * Return a "good" intent to launch a front-door Leanback activity in a |
| 1928 | * package, for use for example to implement an "open" button when browsing |
| 1929 | * through packages. The current implementation will look for a main |
| 1930 | * activity in the category {@link Intent#CATEGORY_LEANBACK_LAUNCHER}, or |
| 1931 | * return null if no main leanback activities are found. |
| 1932 | * <p> |
| 1933 | * Throws {@link NameNotFoundException} if a package with the given name |
| 1934 | * cannot be found on the system. |
Adam Connors | 551c078 | 2014-06-05 12:13:03 +0100 | [diff] [blame] | 1935 | * |
Jose Lima | 970417c | 2014-04-10 10:42:19 -0700 | [diff] [blame] | 1936 | * @param packageName The name of the package to inspect. |
| 1937 | * @return Returns either a fully-qualified Intent that can be used to launch |
| 1938 | * the main Leanback activity in the package, or null if the package |
| 1939 | * does not contain such an activity. |
| 1940 | */ |
| 1941 | public abstract Intent getLeanbackLaunchIntentForPackage(String packageName); |
| 1942 | |
| 1943 | /** |
| 1944 | * Return an array of all of the secondary group-ids that have been assigned |
| 1945 | * to a package. |
| 1946 | * <p> |
| 1947 | * Throws {@link NameNotFoundException} if a package with the given name |
| 1948 | * cannot be found on the system. |
Adam Connors | 551c078 | 2014-06-05 12:13:03 +0100 | [diff] [blame] | 1949 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1950 | * @param packageName The full name (i.e. com.google.apps.contacts) of the |
Jose Lima | 970417c | 2014-04-10 10:42:19 -0700 | [diff] [blame] | 1951 | * desired package. |
| 1952 | * @return Returns an int array of the assigned gids, or null if there are |
| 1953 | * none. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1954 | */ |
| 1955 | public abstract int[] getPackageGids(String packageName) |
| 1956 | throws NameNotFoundException; |
| 1957 | |
| 1958 | /** |
Dianne Hackborn | a06de0f | 2012-12-11 16:34:47 -0800 | [diff] [blame] | 1959 | * @hide Return the uid associated with the given package name for the |
| 1960 | * given user. |
| 1961 | * |
| 1962 | * <p>Throws {@link NameNotFoundException} if a package with the given |
| 1963 | * name can not be found on the system. |
| 1964 | * |
| 1965 | * @param packageName The full name (i.e. com.google.apps.contacts) of the |
| 1966 | * desired package. |
| 1967 | * @param userHandle The user handle identifier to look up the package under. |
| 1968 | * |
| 1969 | * @return Returns an integer uid who owns the given package name. |
| 1970 | */ |
| 1971 | public abstract int getPackageUid(String packageName, int userHandle) |
| 1972 | throws NameNotFoundException; |
| 1973 | |
| 1974 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1975 | * Retrieve all of the information we know about a particular permission. |
| 1976 | * |
| 1977 | * <p>Throws {@link NameNotFoundException} if a permission with the given |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 1978 | * name cannot be found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1979 | * |
| 1980 | * @param name The fully qualified name (i.e. com.google.permission.LOGIN) |
| 1981 | * of the permission you are interested in. |
| 1982 | * @param flags Additional option flags. Use {@link #GET_META_DATA} to |
| 1983 | * retrieve any meta-data associated with the permission. |
| 1984 | * |
| 1985 | * @return Returns a {@link PermissionInfo} containing information about the |
| 1986 | * permission. |
| 1987 | */ |
| 1988 | public abstract PermissionInfo getPermissionInfo(String name, int flags) |
| 1989 | throws NameNotFoundException; |
| 1990 | |
| 1991 | /** |
| 1992 | * Query for all of the permissions associated with a particular group. |
| 1993 | * |
| 1994 | * <p>Throws {@link NameNotFoundException} if the given group does not |
| 1995 | * exist. |
| 1996 | * |
| 1997 | * @param group The fully qualified name (i.e. com.google.permission.LOGIN) |
| 1998 | * of the permission group you are interested in. Use null to |
| 1999 | * find all of the permissions not associated with a group. |
| 2000 | * @param flags Additional option flags. Use {@link #GET_META_DATA} to |
| 2001 | * retrieve any meta-data associated with the permissions. |
| 2002 | * |
| 2003 | * @return Returns a list of {@link PermissionInfo} containing information |
| 2004 | * about all of the permissions in the given group. |
| 2005 | */ |
| 2006 | public abstract List<PermissionInfo> queryPermissionsByGroup(String group, |
| 2007 | int flags) throws NameNotFoundException; |
| 2008 | |
| 2009 | /** |
| 2010 | * Retrieve all of the information we know about a particular group of |
| 2011 | * permissions. |
| 2012 | * |
| 2013 | * <p>Throws {@link NameNotFoundException} if a permission group with the given |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 2014 | * name cannot be found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2015 | * |
| 2016 | * @param name The fully qualified name (i.e. com.google.permission_group.APPS) |
| 2017 | * of the permission you are interested in. |
| 2018 | * @param flags Additional option flags. Use {@link #GET_META_DATA} to |
| 2019 | * retrieve any meta-data associated with the permission group. |
| 2020 | * |
| 2021 | * @return Returns a {@link PermissionGroupInfo} containing information |
| 2022 | * about the permission. |
| 2023 | */ |
| 2024 | public abstract PermissionGroupInfo getPermissionGroupInfo(String name, |
| 2025 | int flags) throws NameNotFoundException; |
| 2026 | |
| 2027 | /** |
| 2028 | * Retrieve all of the known permission groups in the system. |
| 2029 | * |
| 2030 | * @param flags Additional option flags. Use {@link #GET_META_DATA} to |
| 2031 | * retrieve any meta-data associated with the permission group. |
| 2032 | * |
| 2033 | * @return Returns a list of {@link PermissionGroupInfo} containing |
| 2034 | * information about all of the known permission groups. |
| 2035 | */ |
| 2036 | public abstract List<PermissionGroupInfo> getAllPermissionGroups(int flags); |
| 2037 | |
| 2038 | /** |
| 2039 | * Retrieve all of the information we know about a particular |
| 2040 | * package/application. |
| 2041 | * |
| 2042 | * <p>Throws {@link NameNotFoundException} if an application with the given |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 2043 | * package name cannot be found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2044 | * |
| 2045 | * @param packageName The full name (i.e. com.google.apps.contacts) of an |
| 2046 | * application. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2047 | * @param flags Additional option flags. Use any combination of |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2048 | * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, |
| 2049 | * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned. |
| 2050 | * |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2051 | * @return {@link ApplicationInfo} Returns ApplicationInfo object containing |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2052 | * information about the package. |
| 2053 | * If flag GET_UNINSTALLED_PACKAGES is set and if the package is not |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2054 | * found in the list of installed applications, |
| 2055 | * the application information is retrieved from the |
| 2056 | * list of uninstalled applications(which includes |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2057 | * installed applications as well as applications |
| 2058 | * with data directory ie applications which had been |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 2059 | * deleted with {@code DONT_DELETE_DATA} flag set). |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2060 | * |
| 2061 | * @see #GET_META_DATA |
| 2062 | * @see #GET_SHARED_LIBRARY_FILES |
| 2063 | * @see #GET_UNINSTALLED_PACKAGES |
| 2064 | */ |
| 2065 | public abstract ApplicationInfo getApplicationInfo(String packageName, |
| 2066 | int flags) throws NameNotFoundException; |
| 2067 | |
| 2068 | /** |
| 2069 | * Retrieve all of the information we know about a particular activity |
| 2070 | * class. |
| 2071 | * |
| 2072 | * <p>Throws {@link NameNotFoundException} if an activity with the given |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 2073 | * class name cannot be found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2074 | * |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 2075 | * @param component The full component name (i.e. |
| 2076 | * com.google.apps.contacts/com.google.apps.contacts.ContactsList) of an Activity |
| 2077 | * class. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2078 | * @param flags Additional option flags. Use any combination of |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2079 | * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, |
| 2080 | * to modify the data (in ApplicationInfo) returned. |
| 2081 | * |
| 2082 | * @return {@link ActivityInfo} containing information about the activity. |
| 2083 | * |
| 2084 | * @see #GET_INTENT_FILTERS |
| 2085 | * @see #GET_META_DATA |
| 2086 | * @see #GET_SHARED_LIBRARY_FILES |
| 2087 | */ |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 2088 | public abstract ActivityInfo getActivityInfo(ComponentName component, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2089 | int flags) throws NameNotFoundException; |
| 2090 | |
| 2091 | /** |
| 2092 | * Retrieve all of the information we know about a particular receiver |
| 2093 | * class. |
| 2094 | * |
| 2095 | * <p>Throws {@link NameNotFoundException} if a receiver with the given |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 2096 | * class name cannot be found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2097 | * |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 2098 | * @param component The full component name (i.e. |
| 2099 | * com.google.apps.calendar/com.google.apps.calendar.CalendarAlarm) of a Receiver |
| 2100 | * class. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2101 | * @param flags Additional option flags. Use any combination of |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2102 | * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, |
| 2103 | * to modify the data returned. |
| 2104 | * |
| 2105 | * @return {@link ActivityInfo} containing information about the receiver. |
| 2106 | * |
| 2107 | * @see #GET_INTENT_FILTERS |
| 2108 | * @see #GET_META_DATA |
| 2109 | * @see #GET_SHARED_LIBRARY_FILES |
| 2110 | */ |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 2111 | public abstract ActivityInfo getReceiverInfo(ComponentName component, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2112 | int flags) throws NameNotFoundException; |
| 2113 | |
| 2114 | /** |
| 2115 | * Retrieve all of the information we know about a particular service |
| 2116 | * class. |
| 2117 | * |
| 2118 | * <p>Throws {@link NameNotFoundException} if a service with the given |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 2119 | * class name cannot be found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2120 | * |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 2121 | * @param component The full component name (i.e. |
| 2122 | * com.google.apps.media/com.google.apps.media.BackgroundPlayback) of a Service |
| 2123 | * class. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2124 | * @param flags Additional option flags. Use any combination of |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2125 | * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, |
| 2126 | * to modify the data returned. |
| 2127 | * |
| 2128 | * @return ServiceInfo containing information about the service. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2129 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2130 | * @see #GET_META_DATA |
| 2131 | * @see #GET_SHARED_LIBRARY_FILES |
| 2132 | */ |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 2133 | public abstract ServiceInfo getServiceInfo(ComponentName component, |
| 2134 | int flags) throws NameNotFoundException; |
| 2135 | |
| 2136 | /** |
| 2137 | * Retrieve all of the information we know about a particular content |
| 2138 | * provider class. |
| 2139 | * |
| 2140 | * <p>Throws {@link NameNotFoundException} if a provider with the given |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 2141 | * class name cannot be found on the system. |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 2142 | * |
| 2143 | * @param component The full component name (i.e. |
| 2144 | * com.google.providers.media/com.google.providers.media.MediaProvider) of a |
| 2145 | * ContentProvider class. |
| 2146 | * @param flags Additional option flags. Use any combination of |
| 2147 | * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, |
| 2148 | * to modify the data returned. |
| 2149 | * |
| 2150 | * @return ProviderInfo containing information about the service. |
| 2151 | * |
| 2152 | * @see #GET_META_DATA |
| 2153 | * @see #GET_SHARED_LIBRARY_FILES |
| 2154 | */ |
| 2155 | public abstract ProviderInfo getProviderInfo(ComponentName component, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2156 | int flags) throws NameNotFoundException; |
| 2157 | |
| 2158 | /** |
| 2159 | * Return a List of all packages that are installed |
| 2160 | * on the device. |
| 2161 | * |
| 2162 | * @param flags Additional option flags. Use any combination of |
| 2163 | * {@link #GET_ACTIVITIES}, |
| 2164 | * {@link #GET_GIDS}, |
| 2165 | * {@link #GET_CONFIGURATIONS}, |
| 2166 | * {@link #GET_INSTRUMENTATION}, |
| 2167 | * {@link #GET_PERMISSIONS}, |
| 2168 | * {@link #GET_PROVIDERS}, |
| 2169 | * {@link #GET_RECEIVERS}, |
| 2170 | * {@link #GET_SERVICES}, |
| 2171 | * {@link #GET_SIGNATURES}, |
| 2172 | * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned. |
| 2173 | * |
| 2174 | * @return A List of PackageInfo objects, one for each package that is |
| 2175 | * installed on the device. In the unlikely case of there being no |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2176 | * installed packages, an empty list is returned. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2177 | * If flag GET_UNINSTALLED_PACKAGES is set, a list of all |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 2178 | * applications including those deleted with {@code DONT_DELETE_DATA} |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2179 | * (partially installed apps with data directory) will be returned. |
| 2180 | * |
| 2181 | * @see #GET_ACTIVITIES |
| 2182 | * @see #GET_GIDS |
| 2183 | * @see #GET_CONFIGURATIONS |
| 2184 | * @see #GET_INSTRUMENTATION |
| 2185 | * @see #GET_PERMISSIONS |
| 2186 | * @see #GET_PROVIDERS |
| 2187 | * @see #GET_RECEIVERS |
| 2188 | * @see #GET_SERVICES |
| 2189 | * @see #GET_SIGNATURES |
| 2190 | * @see #GET_UNINSTALLED_PACKAGES |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2191 | */ |
| 2192 | public abstract List<PackageInfo> getInstalledPackages(int flags); |
| 2193 | |
| 2194 | /** |
Dianne Hackborn | e799175 | 2013-01-16 17:56:46 -0800 | [diff] [blame] | 2195 | * Return a List of all installed packages that are currently |
| 2196 | * holding any of the given permissions. |
| 2197 | * |
| 2198 | * @param flags Additional option flags. Use any combination of |
| 2199 | * {@link #GET_ACTIVITIES}, |
| 2200 | * {@link #GET_GIDS}, |
| 2201 | * {@link #GET_CONFIGURATIONS}, |
| 2202 | * {@link #GET_INSTRUMENTATION}, |
| 2203 | * {@link #GET_PERMISSIONS}, |
| 2204 | * {@link #GET_PROVIDERS}, |
| 2205 | * {@link #GET_RECEIVERS}, |
| 2206 | * {@link #GET_SERVICES}, |
| 2207 | * {@link #GET_SIGNATURES}, |
| 2208 | * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned. |
| 2209 | * |
| 2210 | * @return Returns a List of PackageInfo objects, one for each installed |
| 2211 | * application that is holding any of the permissions that were provided. |
| 2212 | * |
| 2213 | * @see #GET_ACTIVITIES |
| 2214 | * @see #GET_GIDS |
| 2215 | * @see #GET_CONFIGURATIONS |
| 2216 | * @see #GET_INSTRUMENTATION |
| 2217 | * @see #GET_PERMISSIONS |
| 2218 | * @see #GET_PROVIDERS |
| 2219 | * @see #GET_RECEIVERS |
| 2220 | * @see #GET_SERVICES |
| 2221 | * @see #GET_SIGNATURES |
| 2222 | * @see #GET_UNINSTALLED_PACKAGES |
| 2223 | */ |
| 2224 | public abstract List<PackageInfo> getPackagesHoldingPermissions( |
| 2225 | String[] permissions, int flags); |
| 2226 | |
| 2227 | /** |
Amith Yamasani | 151ec4c | 2012-09-07 19:25:16 -0700 | [diff] [blame] | 2228 | * Return a List of all packages that are installed on the device, for a specific user. |
| 2229 | * Requesting a list of installed packages for another user |
| 2230 | * will require the permission INTERACT_ACROSS_USERS_FULL. |
| 2231 | * @param flags Additional option flags. Use any combination of |
| 2232 | * {@link #GET_ACTIVITIES}, |
| 2233 | * {@link #GET_GIDS}, |
| 2234 | * {@link #GET_CONFIGURATIONS}, |
| 2235 | * {@link #GET_INSTRUMENTATION}, |
| 2236 | * {@link #GET_PERMISSIONS}, |
| 2237 | * {@link #GET_PROVIDERS}, |
| 2238 | * {@link #GET_RECEIVERS}, |
| 2239 | * {@link #GET_SERVICES}, |
| 2240 | * {@link #GET_SIGNATURES}, |
| 2241 | * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned. |
| 2242 | * @param userId The user for whom the installed packages are to be listed |
| 2243 | * |
| 2244 | * @return A List of PackageInfo objects, one for each package that is |
| 2245 | * installed on the device. In the unlikely case of there being no |
| 2246 | * installed packages, an empty list is returned. |
| 2247 | * If flag GET_UNINSTALLED_PACKAGES is set, a list of all |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 2248 | * applications including those deleted with {@code DONT_DELETE_DATA} |
Amith Yamasani | 151ec4c | 2012-09-07 19:25:16 -0700 | [diff] [blame] | 2249 | * (partially installed apps with data directory) will be returned. |
| 2250 | * |
| 2251 | * @see #GET_ACTIVITIES |
| 2252 | * @see #GET_GIDS |
| 2253 | * @see #GET_CONFIGURATIONS |
| 2254 | * @see #GET_INSTRUMENTATION |
| 2255 | * @see #GET_PERMISSIONS |
| 2256 | * @see #GET_PROVIDERS |
| 2257 | * @see #GET_RECEIVERS |
| 2258 | * @see #GET_SERVICES |
| 2259 | * @see #GET_SIGNATURES |
| 2260 | * @see #GET_UNINSTALLED_PACKAGES |
| 2261 | * |
| 2262 | * @hide |
| 2263 | */ |
| 2264 | public abstract List<PackageInfo> getInstalledPackages(int flags, int userId); |
| 2265 | |
| 2266 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2267 | * Check whether a particular package has been granted a particular |
| 2268 | * permission. |
| 2269 | * |
| 2270 | * @param permName The name of the permission you are checking for, |
| 2271 | * @param pkgName The name of the package you are checking against. |
| 2272 | * |
| 2273 | * @return If the package has the permission, PERMISSION_GRANTED is |
| 2274 | * returned. If it does not have the permission, PERMISSION_DENIED |
| 2275 | * is returned. |
| 2276 | * |
| 2277 | * @see #PERMISSION_GRANTED |
| 2278 | * @see #PERMISSION_DENIED |
| 2279 | */ |
Tor Norbye | 1c2bf03 | 2015-03-02 10:57:08 -0800 | [diff] [blame] | 2280 | @CheckResult |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2281 | public abstract int checkPermission(String permName, String pkgName); |
| 2282 | |
| 2283 | /** |
| 2284 | * Add a new dynamic permission to the system. For this to work, your |
| 2285 | * package must have defined a permission tree through the |
| 2286 | * {@link android.R.styleable#AndroidManifestPermissionTree |
| 2287 | * <permission-tree>} tag in its manifest. A package can only add |
| 2288 | * permissions to trees that were defined by either its own package or |
| 2289 | * another with the same user id; a permission is in a tree if it |
| 2290 | * matches the name of the permission tree + ".": for example, |
| 2291 | * "com.foo.bar" is a member of the permission tree "com.foo". |
| 2292 | * |
| 2293 | * <p>It is good to make your permission tree name descriptive, because you |
| 2294 | * are taking possession of that entire set of permission names. Thus, it |
| 2295 | * must be under a domain you control, with a suffix that will not match |
| 2296 | * any normal permissions that may be declared in any applications that |
| 2297 | * are part of that domain. |
| 2298 | * |
| 2299 | * <p>New permissions must be added before |
| 2300 | * any .apks are installed that use those permissions. Permissions you |
| 2301 | * add through this method are remembered across reboots of the device. |
| 2302 | * If the given permission already exists, the info you supply here |
| 2303 | * will be used to update it. |
| 2304 | * |
| 2305 | * @param info Description of the permission to be added. |
| 2306 | * |
| 2307 | * @return Returns true if a new permission was created, false if an |
| 2308 | * existing one was updated. |
| 2309 | * |
| 2310 | * @throws SecurityException if you are not allowed to add the |
| 2311 | * given permission name. |
| 2312 | * |
| 2313 | * @see #removePermission(String) |
| 2314 | */ |
| 2315 | public abstract boolean addPermission(PermissionInfo info); |
| 2316 | |
| 2317 | /** |
Dianne Hackborn | d7c0968 | 2010-03-30 10:42:20 -0700 | [diff] [blame] | 2318 | * Like {@link #addPermission(PermissionInfo)} but asynchronously |
| 2319 | * persists the package manager state after returning from the call, |
| 2320 | * allowing it to return quicker and batch a series of adds at the |
| 2321 | * expense of no guarantee the added permission will be retained if |
| 2322 | * the device is rebooted before it is written. |
| 2323 | */ |
| 2324 | public abstract boolean addPermissionAsync(PermissionInfo info); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2325 | |
Dianne Hackborn | d7c0968 | 2010-03-30 10:42:20 -0700 | [diff] [blame] | 2326 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2327 | * Removes a permission that was previously added with |
| 2328 | * {@link #addPermission(PermissionInfo)}. The same ownership rules apply |
| 2329 | * -- you are only allowed to remove permissions that you are allowed |
| 2330 | * to add. |
| 2331 | * |
| 2332 | * @param name The name of the permission to remove. |
| 2333 | * |
| 2334 | * @throws SecurityException if you are not allowed to remove the |
| 2335 | * given permission name. |
| 2336 | * |
| 2337 | * @see #addPermission(PermissionInfo) |
| 2338 | */ |
| 2339 | public abstract void removePermission(String name); |
| 2340 | |
| 2341 | /** |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 2342 | * Grant a runtime permission to an application which the application does not |
| 2343 | * already have. The permission must have been requested by the application. |
| 2344 | * If the application is not allowed to hold the permission, a {@link |
| 2345 | * java.lang.SecurityException} is thrown. |
| 2346 | * <p> |
| 2347 | * <strong>Note: </strong>Using this API requires holding |
| 2348 | * android.permission.GRANT_REVOKE_PERMISSIONS and if the user id is |
| 2349 | * not the current user android.permission.INTERACT_ACROSS_USERS_FULL. |
| 2350 | * </p> |
Nick Kralevich | 035f80d | 2013-03-27 15:20:08 -0700 | [diff] [blame] | 2351 | * |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 2352 | * @param packageName The package to which to grant the permission. |
| 2353 | * @param permissionName The permission name to grant. |
| 2354 | * @param user The user for which to grant the permission. |
| 2355 | * |
| 2356 | * @see #revokePermission(String, String, android.os.UserHandle) |
| 2357 | * |
| 2358 | * @hide |
Nick Kralevich | 035f80d | 2013-03-27 15:20:08 -0700 | [diff] [blame] | 2359 | */ |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 2360 | @SystemApi |
| 2361 | public abstract void grantPermission(@NonNull String packageName, |
| 2362 | @NonNull String permissionName, @NonNull UserHandle user); |
Nick Kralevich | 035f80d | 2013-03-27 15:20:08 -0700 | [diff] [blame] | 2363 | |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 2364 | /** |
| 2365 | * Revoke a runtime permission that was previously granted by {@link |
| 2366 | * #grantPermission(String, String, android.os.UserHandle)}. The permission |
| 2367 | * must have been requested by and granted to the application. If the |
| 2368 | * application is not allowed to hold the permission, a {@link |
| 2369 | * java.lang.SecurityException} is thrown. |
| 2370 | * <p> |
| 2371 | * <strong>Note: </strong>Using this API requires holding |
| 2372 | * android.permission.GRANT_REVOKE_PERMISSIONS and if the user id is |
| 2373 | * not the current user android.permission.INTERACT_ACROSS_USERS_FULL. |
| 2374 | * </p> |
| 2375 | * |
| 2376 | * @param packageName The package from which to revoke the permission. |
| 2377 | * @param permissionName The permission name to revoke. |
| 2378 | * @param user The user for which to revoke the permission. |
| 2379 | * |
| 2380 | * @see #grantPermission(String, String, android.os.UserHandle) |
| 2381 | * |
| 2382 | * @hide |
| 2383 | */ |
| 2384 | @SystemApi |
| 2385 | public abstract void revokePermission(@NonNull String packageName, |
| 2386 | @NonNull String permissionName, @NonNull UserHandle user); |
| 2387 | |
| 2388 | /** |
| 2389 | * Returns an {@link android.content.Intent} suitable for passing to |
| 2390 | * {@link android.app.Activity#startActivityForResult(android.content.Intent, int)} |
| 2391 | * which prompts the user to grant permissions to this application. |
| 2392 | * |
| 2393 | * @throws NullPointerException if {@code permissions} is {@code null} or empty. |
| 2394 | * |
| 2395 | * @hide |
| 2396 | */ |
| 2397 | public Intent buildRequestPermissionsIntent(@NonNull String[] permissions) { |
| 2398 | if (ArrayUtils.isEmpty(permissions)) { |
| 2399 | throw new NullPointerException("permission cannot be null or empty"); |
| 2400 | } |
| 2401 | Intent intent = new Intent(ACTION_REQUEST_PERMISSIONS); |
| 2402 | intent.putExtra(EXTRA_REQUEST_PERMISSIONS_NAMES, permissions); |
| 2403 | intent.setPackage(GRANT_PERMISSIONS_PACKAGE_NAME); |
| 2404 | return intent; |
Nick Kralevich | 035f80d | 2013-03-27 15:20:08 -0700 | [diff] [blame] | 2405 | } |
| 2406 | |
| 2407 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2408 | * Compare the signatures of two packages to determine if the same |
| 2409 | * signature appears in both of them. If they do contain the same |
| 2410 | * signature, then they are allowed special privileges when working |
| 2411 | * with each other: they can share the same user-id, run instrumentation |
| 2412 | * against each other, etc. |
| 2413 | * |
| 2414 | * @param pkg1 First package name whose signature will be compared. |
| 2415 | * @param pkg2 Second package name whose signature will be compared. |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 2416 | * |
| 2417 | * @return Returns an integer indicating whether all signatures on the |
| 2418 | * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if |
| 2419 | * all signatures match or < 0 if there is not a match ({@link |
| 2420 | * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}). |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2421 | * |
Dianne Hackborn | 766cbfe | 2009-08-12 18:33:39 -0700 | [diff] [blame] | 2422 | * @see #checkSignatures(int, int) |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2423 | * @see #SIGNATURE_MATCH |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2424 | * @see #SIGNATURE_NO_MATCH |
| 2425 | * @see #SIGNATURE_UNKNOWN_PACKAGE |
| 2426 | */ |
Tor Norbye | 1c2bf03 | 2015-03-02 10:57:08 -0800 | [diff] [blame] | 2427 | @CheckResult |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2428 | public abstract int checkSignatures(String pkg1, String pkg2); |
| 2429 | |
| 2430 | /** |
Dianne Hackborn | 766cbfe | 2009-08-12 18:33:39 -0700 | [diff] [blame] | 2431 | * Like {@link #checkSignatures(String, String)}, but takes UIDs of |
| 2432 | * the two packages to be checked. This can be useful, for example, |
| 2433 | * when doing the check in an IPC, where the UID is the only identity |
| 2434 | * available. It is functionally identical to determining the package |
| 2435 | * associated with the UIDs and checking their signatures. |
| 2436 | * |
Joe Onorato | 25660ec | 2009-08-12 22:40:37 -0700 | [diff] [blame] | 2437 | * @param uid1 First UID whose signature will be compared. |
| 2438 | * @param uid2 Second UID whose signature will be compared. |
Dianne Hackborn | 766cbfe | 2009-08-12 18:33:39 -0700 | [diff] [blame] | 2439 | * |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 2440 | * @return Returns an integer indicating whether all signatures on the |
| 2441 | * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if |
| 2442 | * all signatures match or < 0 if there is not a match ({@link |
| 2443 | * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}). |
| 2444 | * |
| 2445 | * @see #checkSignatures(String, String) |
Dianne Hackborn | 766cbfe | 2009-08-12 18:33:39 -0700 | [diff] [blame] | 2446 | * @see #SIGNATURE_MATCH |
Dianne Hackborn | 766cbfe | 2009-08-12 18:33:39 -0700 | [diff] [blame] | 2447 | * @see #SIGNATURE_NO_MATCH |
| 2448 | * @see #SIGNATURE_UNKNOWN_PACKAGE |
| 2449 | */ |
Tor Norbye | 1c2bf03 | 2015-03-02 10:57:08 -0800 | [diff] [blame] | 2450 | @CheckResult |
Dianne Hackborn | 766cbfe | 2009-08-12 18:33:39 -0700 | [diff] [blame] | 2451 | public abstract int checkSignatures(int uid1, int uid2); |
| 2452 | |
| 2453 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2454 | * Retrieve the names of all packages that are associated with a particular |
| 2455 | * user id. In most cases, this will be a single package name, the package |
| 2456 | * that has been assigned that user id. Where there are multiple packages |
| 2457 | * sharing the same user id through the "sharedUserId" mechanism, all |
| 2458 | * packages with that id will be returned. |
| 2459 | * |
| 2460 | * @param uid The user id for which you would like to retrieve the |
| 2461 | * associated packages. |
| 2462 | * |
| 2463 | * @return Returns an array of one or more packages assigned to the user |
| 2464 | * id, or null if there are no known packages with the given id. |
| 2465 | */ |
| 2466 | public abstract String[] getPackagesForUid(int uid); |
| 2467 | |
| 2468 | /** |
| 2469 | * Retrieve the official name associated with a user id. This name is |
| 2470 | * guaranteed to never change, though it is possibly for the underlying |
| 2471 | * user id to be changed. That is, if you are storing information about |
| 2472 | * user ids in persistent storage, you should use the string returned |
| 2473 | * by this function instead of the raw user-id. |
| 2474 | * |
| 2475 | * @param uid The user id for which you would like to retrieve a name. |
| 2476 | * @return Returns a unique name for the given user id, or null if the |
| 2477 | * user id is not currently assigned. |
| 2478 | */ |
| 2479 | public abstract String getNameForUid(int uid); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2480 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2481 | /** |
| 2482 | * Return the user id associated with a shared user name. Multiple |
| 2483 | * applications can specify a shared user name in their manifest and thus |
| 2484 | * end up using a common uid. This might be used for new applications |
| 2485 | * that use an existing shared user name and need to know the uid of the |
| 2486 | * shared user. |
| 2487 | * |
| 2488 | * @param sharedUserName The shared user name whose uid is to be retrieved. |
| 2489 | * @return Returns the uid associated with the shared user, or NameNotFoundException |
| 2490 | * if the shared user name is not being used by any installed packages |
| 2491 | * @hide |
| 2492 | */ |
| 2493 | public abstract int getUidForSharedUser(String sharedUserName) |
| 2494 | throws NameNotFoundException; |
| 2495 | |
| 2496 | /** |
| 2497 | * Return a List of all application packages that are installed on the |
| 2498 | * device. If flag GET_UNINSTALLED_PACKAGES has been set, a list of all |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 2499 | * applications including those deleted with {@code DONT_DELETE_DATA} (partially |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2500 | * installed apps with data directory) will be returned. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2501 | * |
| 2502 | * @param flags Additional option flags. Use any combination of |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2503 | * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, |
Jeff Smith | a45746e | 2012-07-19 14:19:24 -0500 | [diff] [blame] | 2504 | * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2505 | * |
Dianne Hackborn | e799175 | 2013-01-16 17:56:46 -0800 | [diff] [blame] | 2506 | * @return Returns a List of ApplicationInfo objects, one for each application that |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2507 | * is installed on the device. In the unlikely case of there being |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2508 | * no installed applications, an empty list is returned. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2509 | * If flag GET_UNINSTALLED_PACKAGES is set, a list of all |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 2510 | * applications including those deleted with {@code DONT_DELETE_DATA} |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2511 | * (partially installed apps with data directory) will be returned. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2512 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2513 | * @see #GET_META_DATA |
| 2514 | * @see #GET_SHARED_LIBRARY_FILES |
| 2515 | * @see #GET_UNINSTALLED_PACKAGES |
| 2516 | */ |
| 2517 | public abstract List<ApplicationInfo> getInstalledApplications(int flags); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2518 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2519 | /** |
| 2520 | * Get a list of shared libraries that are available on the |
| 2521 | * system. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2522 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2523 | * @return An array of shared library names that are |
| 2524 | * available on the system, or null if none are installed. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2525 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2526 | */ |
| 2527 | public abstract String[] getSystemSharedLibraryNames(); |
| 2528 | |
| 2529 | /** |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 2530 | * Get a list of features that are available on the |
| 2531 | * system. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2532 | * |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 2533 | * @return An array of FeatureInfo classes describing the features |
| 2534 | * that are available on the system, or null if there are none(!!). |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 2535 | */ |
| 2536 | public abstract FeatureInfo[] getSystemAvailableFeatures(); |
| 2537 | |
| 2538 | /** |
Dianne Hackborn | 039c68e | 2009-09-26 16:39:23 -0700 | [diff] [blame] | 2539 | * Check whether the given feature name is one of the available |
| 2540 | * features as returned by {@link #getSystemAvailableFeatures()}. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2541 | * |
Dianne Hackborn | 039c68e | 2009-09-26 16:39:23 -0700 | [diff] [blame] | 2542 | * @return Returns true if the devices supports the feature, else |
| 2543 | * false. |
| 2544 | */ |
| 2545 | public abstract boolean hasSystemFeature(String name); |
| 2546 | |
| 2547 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2548 | * Determine the best action to perform for a given Intent. This is how |
| 2549 | * {@link Intent#resolveActivity} finds an activity if a class has not |
| 2550 | * been explicitly specified. |
| 2551 | * |
Scott Main | ef6b305 | 2011-03-23 14:23:02 -0700 | [diff] [blame] | 2552 | * <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] | 2553 | * specified), be sure to consider whether to set the {@link #MATCH_DEFAULT_ONLY} |
| 2554 | * only flag. You need to do so to resolve the activity in the same way |
| 2555 | * that {@link android.content.Context#startActivity(Intent)} and |
| 2556 | * {@link android.content.Intent#resolveActivity(PackageManager) |
| 2557 | * Intent.resolveActivity(PackageManager)} do.</p> |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2558 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2559 | * @param intent An intent containing all of the desired specification |
| 2560 | * (action, data, type, category, and/or component). |
| 2561 | * @param flags Additional option flags. The most important is |
Dianne Hackborn | 4d023d21 | 2010-10-01 13:41:04 -0700 | [diff] [blame] | 2562 | * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only |
| 2563 | * 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] | 2564 | * |
| 2565 | * @return Returns a ResolveInfo containing the final activity intent that |
| 2566 | * was determined to be the best action. Returns null if no |
Mike LeBeau | bd3f527 | 2010-02-18 19:27:17 -0800 | [diff] [blame] | 2567 | * matching activity was found. If multiple matching activities are |
| 2568 | * found and there is no default set, returns a ResolveInfo |
| 2569 | * containing something else, such as the activity resolver. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2570 | * |
| 2571 | * @see #MATCH_DEFAULT_ONLY |
| 2572 | * @see #GET_INTENT_FILTERS |
| 2573 | * @see #GET_RESOLVED_FILTER |
| 2574 | */ |
| 2575 | public abstract ResolveInfo resolveActivity(Intent intent, int flags); |
| 2576 | |
| 2577 | /** |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 2578 | * Determine the best action to perform for a given Intent for a given user. This |
| 2579 | * is how {@link Intent#resolveActivity} finds an activity if a class has not |
| 2580 | * been explicitly specified. |
| 2581 | * |
| 2582 | * <p><em>Note:</em> if using an implicit Intent (without an explicit ComponentName |
| 2583 | * specified), be sure to consider whether to set the {@link #MATCH_DEFAULT_ONLY} |
| 2584 | * only flag. You need to do so to resolve the activity in the same way |
| 2585 | * that {@link android.content.Context#startActivity(Intent)} and |
| 2586 | * {@link android.content.Intent#resolveActivity(PackageManager) |
| 2587 | * Intent.resolveActivity(PackageManager)} do.</p> |
| 2588 | * |
| 2589 | * @param intent An intent containing all of the desired specification |
| 2590 | * (action, data, type, category, and/or component). |
| 2591 | * @param flags Additional option flags. The most important is |
| 2592 | * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only |
| 2593 | * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}. |
| 2594 | * @param userId The user id. |
| 2595 | * |
| 2596 | * @return Returns a ResolveInfo containing the final activity intent that |
| 2597 | * was determined to be the best action. Returns null if no |
| 2598 | * matching activity was found. If multiple matching activities are |
| 2599 | * found and there is no default set, returns a ResolveInfo |
| 2600 | * containing something else, such as the activity resolver. |
| 2601 | * |
| 2602 | * @see #MATCH_DEFAULT_ONLY |
| 2603 | * @see #GET_INTENT_FILTERS |
| 2604 | * @see #GET_RESOLVED_FILTER |
| 2605 | * |
| 2606 | * @hide |
| 2607 | */ |
| 2608 | public abstract ResolveInfo resolveActivityAsUser(Intent intent, int flags, int userId); |
| 2609 | |
| 2610 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2611 | * Retrieve all activities that can be performed for the given intent. |
| 2612 | * |
| 2613 | * @param intent The desired intent as per resolveActivity(). |
| 2614 | * @param flags Additional option flags. The most important is |
Dianne Hackborn | 4d023d21 | 2010-10-01 13:41:04 -0700 | [diff] [blame] | 2615 | * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only |
| 2616 | * 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] | 2617 | * |
Dianne Hackborn | 4d023d21 | 2010-10-01 13:41:04 -0700 | [diff] [blame] | 2618 | * @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] | 2619 | * Activity. These are ordered from best to worst match -- that |
| 2620 | * is, the first item in the list is what is returned by |
Dianne Hackborn | 4d023d21 | 2010-10-01 13:41:04 -0700 | [diff] [blame] | 2621 | * {@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] | 2622 | * list is returned. |
| 2623 | * |
| 2624 | * @see #MATCH_DEFAULT_ONLY |
| 2625 | * @see #GET_INTENT_FILTERS |
| 2626 | * @see #GET_RESOLVED_FILTER |
| 2627 | */ |
| 2628 | public abstract List<ResolveInfo> queryIntentActivities(Intent intent, |
| 2629 | int flags); |
| 2630 | |
| 2631 | /** |
Amith Yamasani | 151ec4c | 2012-09-07 19:25:16 -0700 | [diff] [blame] | 2632 | * Retrieve all activities that can be performed for the given intent, for a specific user. |
| 2633 | * |
| 2634 | * @param intent The desired intent as per resolveActivity(). |
| 2635 | * @param flags Additional option flags. The most important is |
| 2636 | * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only |
| 2637 | * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}. |
| 2638 | * |
| 2639 | * @return A List<ResolveInfo> containing one entry for each matching |
| 2640 | * Activity. These are ordered from best to worst match -- that |
| 2641 | * is, the first item in the list is what is returned by |
| 2642 | * {@link #resolveActivity}. If there are no matching activities, an empty |
| 2643 | * list is returned. |
| 2644 | * |
| 2645 | * @see #MATCH_DEFAULT_ONLY |
| 2646 | * @see #GET_INTENT_FILTERS |
| 2647 | * @see #GET_RESOLVED_FILTER |
| 2648 | * @hide |
| 2649 | */ |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 2650 | public abstract List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent, |
Amith Yamasani | 151ec4c | 2012-09-07 19:25:16 -0700 | [diff] [blame] | 2651 | int flags, int userId); |
| 2652 | |
| 2653 | |
| 2654 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2655 | * Retrieve a set of activities that should be presented to the user as |
| 2656 | * similar options. This is like {@link #queryIntentActivities}, except it |
| 2657 | * also allows you to supply a list of more explicit Intents that you would |
| 2658 | * like to resolve to particular options, and takes care of returning the |
| 2659 | * final ResolveInfo list in a reasonable order, with no duplicates, based |
| 2660 | * on those inputs. |
| 2661 | * |
| 2662 | * @param caller The class name of the activity that is making the |
| 2663 | * request. This activity will never appear in the output |
| 2664 | * list. Can be null. |
| 2665 | * @param specifics An array of Intents that should be resolved to the |
| 2666 | * first specific results. Can be null. |
| 2667 | * @param intent The desired intent as per resolveActivity(). |
| 2668 | * @param flags Additional option flags. The most important is |
Dianne Hackborn | 4d023d21 | 2010-10-01 13:41:04 -0700 | [diff] [blame] | 2669 | * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only |
| 2670 | * 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] | 2671 | * |
Dianne Hackborn | 4d023d21 | 2010-10-01 13:41:04 -0700 | [diff] [blame] | 2672 | * @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] | 2673 | * Activity. These are ordered first by all of the intents resolved |
| 2674 | * in <var>specifics</var> and then any additional activities that |
| 2675 | * can handle <var>intent</var> but did not get included by one of |
| 2676 | * the <var>specifics</var> intents. If there are no matching |
| 2677 | * activities, an empty list is returned. |
| 2678 | * |
| 2679 | * @see #MATCH_DEFAULT_ONLY |
| 2680 | * @see #GET_INTENT_FILTERS |
| 2681 | * @see #GET_RESOLVED_FILTER |
| 2682 | */ |
| 2683 | public abstract List<ResolveInfo> queryIntentActivityOptions( |
| 2684 | ComponentName caller, Intent[] specifics, Intent intent, int flags); |
| 2685 | |
| 2686 | /** |
| 2687 | * Retrieve all receivers that can handle a broadcast of the given intent. |
| 2688 | * |
| 2689 | * @param intent The desired intent as per resolveActivity(). |
Dianne Hackborn | 4d023d21 | 2010-10-01 13:41:04 -0700 | [diff] [blame] | 2690 | * @param flags Additional option flags. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2691 | * |
Dianne Hackborn | 4d023d21 | 2010-10-01 13:41:04 -0700 | [diff] [blame] | 2692 | * @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] | 2693 | * Receiver. These are ordered from first to last in priority. If |
| 2694 | * there are no matching receivers, an empty list is returned. |
| 2695 | * |
| 2696 | * @see #MATCH_DEFAULT_ONLY |
| 2697 | * @see #GET_INTENT_FILTERS |
| 2698 | * @see #GET_RESOLVED_FILTER |
| 2699 | */ |
| 2700 | public abstract List<ResolveInfo> queryBroadcastReceivers(Intent intent, |
| 2701 | int flags); |
| 2702 | |
| 2703 | /** |
Amith Yamasani | f203aee | 2012-08-29 18:41:53 -0700 | [diff] [blame] | 2704 | * Retrieve all receivers that can handle a broadcast of the given intent, for a specific |
| 2705 | * user. |
| 2706 | * |
| 2707 | * @param intent The desired intent as per resolveActivity(). |
| 2708 | * @param flags Additional option flags. |
| 2709 | * @param userId The userId of the user being queried. |
| 2710 | * |
| 2711 | * @return A List<ResolveInfo> containing one entry for each matching |
| 2712 | * Receiver. These are ordered from first to last in priority. If |
| 2713 | * there are no matching receivers, an empty list is returned. |
| 2714 | * |
| 2715 | * @see #MATCH_DEFAULT_ONLY |
| 2716 | * @see #GET_INTENT_FILTERS |
| 2717 | * @see #GET_RESOLVED_FILTER |
| 2718 | * @hide |
| 2719 | */ |
| 2720 | public abstract List<ResolveInfo> queryBroadcastReceivers(Intent intent, |
| 2721 | int flags, int userId); |
| 2722 | |
| 2723 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2724 | * Determine the best service to handle for a given Intent. |
| 2725 | * |
| 2726 | * @param intent An intent containing all of the desired specification |
| 2727 | * (action, data, type, category, and/or component). |
| 2728 | * @param flags Additional option flags. |
| 2729 | * |
| 2730 | * @return Returns a ResolveInfo containing the final service intent that |
| 2731 | * was determined to be the best action. Returns null if no |
| 2732 | * matching service was found. |
| 2733 | * |
| 2734 | * @see #GET_INTENT_FILTERS |
| 2735 | * @see #GET_RESOLVED_FILTER |
| 2736 | */ |
| 2737 | public abstract ResolveInfo resolveService(Intent intent, int flags); |
| 2738 | |
| 2739 | /** |
| 2740 | * Retrieve all services that can match the given intent. |
| 2741 | * |
| 2742 | * @param intent The desired intent as per resolveService(). |
| 2743 | * @param flags Additional option flags. |
| 2744 | * |
Dianne Hackborn | 4d023d21 | 2010-10-01 13:41:04 -0700 | [diff] [blame] | 2745 | * @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] | 2746 | * ServiceInfo. These are ordered from best to worst match -- that |
| 2747 | * is, the first item in the list is what is returned by |
| 2748 | * resolveService(). If there are no matching services, an empty |
| 2749 | * list is returned. |
| 2750 | * |
| 2751 | * @see #GET_INTENT_FILTERS |
| 2752 | * @see #GET_RESOLVED_FILTER |
| 2753 | */ |
| 2754 | public abstract List<ResolveInfo> queryIntentServices(Intent intent, |
| 2755 | int flags); |
| 2756 | |
| 2757 | /** |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 2758 | * Retrieve all services that can match the given intent for a given user. |
| 2759 | * |
| 2760 | * @param intent The desired intent as per resolveService(). |
| 2761 | * @param flags Additional option flags. |
| 2762 | * @param userId The user id. |
| 2763 | * |
| 2764 | * @return A List<ResolveInfo> containing one entry for each matching |
| 2765 | * ServiceInfo. These are ordered from best to worst match -- that |
| 2766 | * is, the first item in the list is what is returned by |
| 2767 | * resolveService(). If there are no matching services, an empty |
| 2768 | * list is returned. |
| 2769 | * |
| 2770 | * @see #GET_INTENT_FILTERS |
| 2771 | * @see #GET_RESOLVED_FILTER |
| 2772 | * |
| 2773 | * @hide |
| 2774 | */ |
| 2775 | public abstract List<ResolveInfo> queryIntentServicesAsUser(Intent intent, |
| 2776 | int flags, int userId); |
| 2777 | |
Jeff Sharkey | 85f5f81 | 2013-10-07 10:16:12 -0700 | [diff] [blame] | 2778 | /** {@hide} */ |
| 2779 | public abstract List<ResolveInfo> queryIntentContentProvidersAsUser( |
| 2780 | Intent intent, int flags, int userId); |
| 2781 | |
| 2782 | /** |
| 2783 | * Retrieve all providers that can match the given intent. |
| 2784 | * |
| 2785 | * @param intent An intent containing all of the desired specification |
| 2786 | * (action, data, type, category, and/or component). |
| 2787 | * @param flags Additional option flags. |
| 2788 | * @return A List<ResolveInfo> containing one entry for each matching |
| 2789 | * ProviderInfo. These are ordered from best to worst match. If |
| 2790 | * there are no matching providers, an empty list is returned. |
| 2791 | * @see #GET_INTENT_FILTERS |
| 2792 | * @see #GET_RESOLVED_FILTER |
| 2793 | */ |
| 2794 | public abstract List<ResolveInfo> queryIntentContentProviders(Intent intent, int flags); |
| 2795 | |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 2796 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2797 | * Find a single content provider by its base path name. |
| 2798 | * |
| 2799 | * @param name The name of the provider to find. |
| 2800 | * @param flags Additional option flags. Currently should always be 0. |
| 2801 | * |
| 2802 | * @return ContentProviderInfo Information about the provider, if found, |
| 2803 | * else null. |
| 2804 | */ |
| 2805 | public abstract ProviderInfo resolveContentProvider(String name, |
| 2806 | int flags); |
| 2807 | |
| 2808 | /** |
Alexandra Gherghina | 0363c3e | 2014-06-23 13:34:59 +0100 | [diff] [blame] | 2809 | * Find a single content provider by its base path name. |
| 2810 | * |
| 2811 | * @param name The name of the provider to find. |
| 2812 | * @param flags Additional option flags. Currently should always be 0. |
| 2813 | * @param userId The user id. |
| 2814 | * |
| 2815 | * @return ContentProviderInfo Information about the provider, if found, |
| 2816 | * else null. |
| 2817 | * @hide |
| 2818 | */ |
| 2819 | public abstract ProviderInfo resolveContentProviderAsUser(String name, int flags, int userId); |
| 2820 | |
| 2821 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2822 | * Retrieve content provider information. |
| 2823 | * |
| 2824 | * <p><em>Note: unlike most other methods, an empty result set is indicated |
| 2825 | * by a null return instead of an empty list.</em> |
| 2826 | * |
| 2827 | * @param processName If non-null, limits the returned providers to only |
| 2828 | * those that are hosted by the given process. If null, |
| 2829 | * all content providers are returned. |
| 2830 | * @param uid If <var>processName</var> is non-null, this is the required |
| 2831 | * uid owning the requested content providers. |
| 2832 | * @param flags Additional option flags. Currently should always be 0. |
| 2833 | * |
Dianne Hackborn | 4d023d21 | 2010-10-01 13:41:04 -0700 | [diff] [blame] | 2834 | * @return A List<ContentProviderInfo> containing one entry for each |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2835 | * content provider either patching <var>processName</var> or, if |
| 2836 | * <var>processName</var> is null, all known content providers. |
| 2837 | * <em>If there are no matching providers, null is returned.</em> |
| 2838 | */ |
| 2839 | public abstract List<ProviderInfo> queryContentProviders( |
| 2840 | String processName, int uid, int flags); |
| 2841 | |
| 2842 | /** |
| 2843 | * Retrieve all of the information we know about a particular |
| 2844 | * instrumentation class. |
| 2845 | * |
| 2846 | * <p>Throws {@link NameNotFoundException} if instrumentation with the |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 2847 | * given class name cannot be found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2848 | * |
| 2849 | * @param className The full name (i.e. |
| 2850 | * com.google.apps.contacts.InstrumentList) of an |
| 2851 | * Instrumentation class. |
| 2852 | * @param flags Additional option flags. Currently should always be 0. |
| 2853 | * |
| 2854 | * @return InstrumentationInfo containing information about the |
| 2855 | * instrumentation. |
| 2856 | */ |
| 2857 | public abstract InstrumentationInfo getInstrumentationInfo( |
| 2858 | ComponentName className, int flags) throws NameNotFoundException; |
| 2859 | |
| 2860 | /** |
| 2861 | * Retrieve information about available instrumentation code. May be used |
| 2862 | * to retrieve either all instrumentation code, or only the code targeting |
| 2863 | * a particular package. |
| 2864 | * |
| 2865 | * @param targetPackage If null, all instrumentation is returned; only the |
| 2866 | * instrumentation targeting this package name is |
| 2867 | * returned. |
| 2868 | * @param flags Additional option flags. Currently should always be 0. |
| 2869 | * |
Dianne Hackborn | 4d023d21 | 2010-10-01 13:41:04 -0700 | [diff] [blame] | 2870 | * @return A List<InstrumentationInfo> containing one entry for each |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2871 | * matching available Instrumentation. Returns an empty list if |
| 2872 | * there is no instrumentation available for the given package. |
| 2873 | */ |
| 2874 | public abstract List<InstrumentationInfo> queryInstrumentation( |
| 2875 | String targetPackage, int flags); |
| 2876 | |
| 2877 | /** |
| 2878 | * Retrieve an image from a package. This is a low-level API used by |
| 2879 | * the various package manager info structures (such as |
| 2880 | * {@link ComponentInfo} to implement retrieval of their associated |
| 2881 | * icon. |
| 2882 | * |
| 2883 | * @param packageName The name of the package that this icon is coming from. |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 2884 | * Cannot be null. |
| 2885 | * @param resid The resource identifier of the desired image. Cannot be 0. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2886 | * @param appInfo Overall information about <var>packageName</var>. This |
| 2887 | * may be null, in which case the application information will be retrieved |
| 2888 | * for you if needed; if you already have this information around, it can |
| 2889 | * be much more efficient to supply it here. |
| 2890 | * |
| 2891 | * @return Returns a Drawable holding the requested image. Returns null if |
| 2892 | * an image could not be found for any reason. |
| 2893 | */ |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 2894 | public abstract Drawable getDrawable(String packageName, @DrawableRes int resid, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2895 | ApplicationInfo appInfo); |
| 2896 | |
| 2897 | /** |
| 2898 | * Retrieve the icon associated with an activity. Given the full name of |
| 2899 | * an activity, retrieves the information about it and calls |
| 2900 | * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its icon. |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 2901 | * If the activity cannot be found, NameNotFoundException is thrown. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2902 | * |
| 2903 | * @param activityName Name of the activity whose icon is to be retrieved. |
| 2904 | * |
| 2905 | * @return Returns the image of the icon, or the default activity icon if |
| 2906 | * it could not be found. Does not return null. |
| 2907 | * @throws NameNotFoundException Thrown if the resources for the given |
| 2908 | * activity could not be loaded. |
| 2909 | * |
| 2910 | * @see #getActivityIcon(Intent) |
| 2911 | */ |
| 2912 | public abstract Drawable getActivityIcon(ComponentName activityName) |
| 2913 | throws NameNotFoundException; |
| 2914 | |
| 2915 | /** |
| 2916 | * Retrieve the icon associated with an Intent. If intent.getClassName() is |
| 2917 | * set, this simply returns the result of |
| 2918 | * getActivityIcon(intent.getClassName()). Otherwise it resolves the intent's |
| 2919 | * component and returns the icon associated with the resolved component. |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 2920 | * If intent.getClassName() cannot be found or the Intent cannot be resolved |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2921 | * to a component, NameNotFoundException is thrown. |
| 2922 | * |
| 2923 | * @param intent The intent for which you would like to retrieve an icon. |
| 2924 | * |
| 2925 | * @return Returns the image of the icon, or the default activity icon if |
| 2926 | * it could not be found. Does not return null. |
| 2927 | * @throws NameNotFoundException Thrown if the resources for application |
| 2928 | * matching the given intent could not be loaded. |
| 2929 | * |
| 2930 | * @see #getActivityIcon(ComponentName) |
| 2931 | */ |
| 2932 | public abstract Drawable getActivityIcon(Intent intent) |
| 2933 | throws NameNotFoundException; |
| 2934 | |
| 2935 | /** |
Jose Lima | f78e312 | 2014-03-06 12:13:15 -0800 | [diff] [blame] | 2936 | * Retrieve the banner associated with an activity. Given the full name of |
| 2937 | * an activity, retrieves the information about it and calls |
| 2938 | * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its |
| 2939 | * banner. If the activity cannot be found, NameNotFoundException is thrown. |
| 2940 | * |
| 2941 | * @param activityName Name of the activity whose banner is to be retrieved. |
| 2942 | * @return Returns the image of the banner, or null if the activity has no |
| 2943 | * banner specified. |
| 2944 | * @throws NameNotFoundException Thrown if the resources for the given |
| 2945 | * activity could not be loaded. |
| 2946 | * @see #getActivityBanner(Intent) |
| 2947 | */ |
| 2948 | public abstract Drawable getActivityBanner(ComponentName activityName) |
| 2949 | throws NameNotFoundException; |
| 2950 | |
| 2951 | /** |
| 2952 | * Retrieve the banner associated with an Intent. If intent.getClassName() |
| 2953 | * is set, this simply returns the result of |
| 2954 | * getActivityBanner(intent.getClassName()). Otherwise it resolves the |
| 2955 | * intent's component and returns the banner associated with the resolved |
| 2956 | * component. If intent.getClassName() cannot be found or the Intent cannot |
| 2957 | * be resolved to a component, NameNotFoundException is thrown. |
| 2958 | * |
| 2959 | * @param intent The intent for which you would like to retrieve a banner. |
| 2960 | * @return Returns the image of the banner, or null if the activity has no |
| 2961 | * banner specified. |
| 2962 | * @throws NameNotFoundException Thrown if the resources for application |
| 2963 | * matching the given intent could not be loaded. |
| 2964 | * @see #getActivityBanner(ComponentName) |
| 2965 | */ |
| 2966 | public abstract Drawable getActivityBanner(Intent intent) |
| 2967 | throws NameNotFoundException; |
| 2968 | |
| 2969 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2970 | * Return the generic icon for an activity that is used when no specific |
| 2971 | * icon is defined. |
Adam Connors | 23cc04e | 2014-04-01 12:12:20 +0100 | [diff] [blame] | 2972 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2973 | * @return Drawable Image of the icon. |
| 2974 | */ |
| 2975 | public abstract Drawable getDefaultActivityIcon(); |
| 2976 | |
| 2977 | /** |
| 2978 | * Retrieve the icon associated with an application. If it has not defined |
| 2979 | * an icon, the default app icon is returned. Does not return null. |
| 2980 | * |
| 2981 | * @param info Information about application being queried. |
| 2982 | * |
| 2983 | * @return Returns the image of the icon, or the default application icon |
| 2984 | * if it could not be found. |
| 2985 | * |
| 2986 | * @see #getApplicationIcon(String) |
| 2987 | */ |
| 2988 | public abstract Drawable getApplicationIcon(ApplicationInfo info); |
| 2989 | |
| 2990 | /** |
| 2991 | * Retrieve the icon associated with an application. Given the name of the |
| 2992 | * application's package, retrieves the information about it and calls |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 2993 | * getApplicationIcon() to return its icon. If the application cannot be |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2994 | * found, NameNotFoundException is thrown. |
| 2995 | * |
| 2996 | * @param packageName Name of the package whose application icon is to be |
| 2997 | * retrieved. |
| 2998 | * |
| 2999 | * @return Returns the image of the icon, or the default application icon |
| 3000 | * if it could not be found. Does not return null. |
| 3001 | * @throws NameNotFoundException Thrown if the resources for the given |
| 3002 | * application could not be loaded. |
| 3003 | * |
| 3004 | * @see #getApplicationIcon(ApplicationInfo) |
| 3005 | */ |
| 3006 | public abstract Drawable getApplicationIcon(String packageName) |
| 3007 | throws NameNotFoundException; |
| 3008 | |
| 3009 | /** |
Jose Lima | f78e312 | 2014-03-06 12:13:15 -0800 | [diff] [blame] | 3010 | * Retrieve the banner associated with an application. |
| 3011 | * |
| 3012 | * @param info Information about application being queried. |
| 3013 | * @return Returns the image of the banner or null if the application has no |
| 3014 | * banner specified. |
| 3015 | * @see #getApplicationBanner(String) |
| 3016 | */ |
| 3017 | public abstract Drawable getApplicationBanner(ApplicationInfo info); |
| 3018 | |
| 3019 | /** |
| 3020 | * Retrieve the banner associated with an application. Given the name of the |
| 3021 | * application's package, retrieves the information about it and calls |
| 3022 | * getApplicationIcon() to return its banner. If the application cannot be |
| 3023 | * found, NameNotFoundException is thrown. |
| 3024 | * |
| 3025 | * @param packageName Name of the package whose application banner is to be |
| 3026 | * retrieved. |
| 3027 | * @return Returns the image of the banner or null if the application has no |
| 3028 | * banner specified. |
| 3029 | * @throws NameNotFoundException Thrown if the resources for the given |
| 3030 | * application could not be loaded. |
| 3031 | * @see #getApplicationBanner(ApplicationInfo) |
| 3032 | */ |
| 3033 | public abstract Drawable getApplicationBanner(String packageName) |
| 3034 | throws NameNotFoundException; |
| 3035 | |
| 3036 | /** |
| 3037 | * Retrieve the logo associated with an activity. Given the full name of an |
| 3038 | * activity, retrieves the information about it and calls |
| 3039 | * {@link ComponentInfo#loadLogo ComponentInfo.loadLogo()} to return its |
| 3040 | * logo. If the activity cannot be found, NameNotFoundException is thrown. |
Adam Powell | 81cd2e9 | 2010-04-21 16:35:18 -0700 | [diff] [blame] | 3041 | * |
| 3042 | * @param activityName Name of the activity whose logo is to be retrieved. |
Jose Lima | f78e312 | 2014-03-06 12:13:15 -0800 | [diff] [blame] | 3043 | * @return Returns the image of the logo or null if the activity has no logo |
| 3044 | * specified. |
Adam Powell | 81cd2e9 | 2010-04-21 16:35:18 -0700 | [diff] [blame] | 3045 | * @throws NameNotFoundException Thrown if the resources for the given |
Jose Lima | f78e312 | 2014-03-06 12:13:15 -0800 | [diff] [blame] | 3046 | * activity could not be loaded. |
Adam Powell | 81cd2e9 | 2010-04-21 16:35:18 -0700 | [diff] [blame] | 3047 | * @see #getActivityLogo(Intent) |
| 3048 | */ |
| 3049 | public abstract Drawable getActivityLogo(ComponentName activityName) |
| 3050 | throws NameNotFoundException; |
| 3051 | |
| 3052 | /** |
| 3053 | * Retrieve the logo associated with an Intent. If intent.getClassName() is |
| 3054 | * set, this simply returns the result of |
| 3055 | * getActivityLogo(intent.getClassName()). Otherwise it resolves the intent's |
| 3056 | * component and returns the logo associated with the resolved component. |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 3057 | * If intent.getClassName() cannot be found or the Intent cannot be resolved |
Adam Powell | 81cd2e9 | 2010-04-21 16:35:18 -0700 | [diff] [blame] | 3058 | * to a component, NameNotFoundException is thrown. |
| 3059 | * |
| 3060 | * @param intent The intent for which you would like to retrieve a logo. |
| 3061 | * |
| 3062 | * @return Returns the image of the logo, or null if the activity has no |
| 3063 | * logo specified. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3064 | * |
Adam Powell | 81cd2e9 | 2010-04-21 16:35:18 -0700 | [diff] [blame] | 3065 | * @throws NameNotFoundException Thrown if the resources for application |
| 3066 | * matching the given intent could not be loaded. |
| 3067 | * |
| 3068 | * @see #getActivityLogo(ComponentName) |
| 3069 | */ |
| 3070 | public abstract Drawable getActivityLogo(Intent intent) |
| 3071 | throws NameNotFoundException; |
| 3072 | |
| 3073 | /** |
| 3074 | * Retrieve the logo associated with an application. If it has not specified |
| 3075 | * a logo, this method returns null. |
| 3076 | * |
| 3077 | * @param info Information about application being queried. |
| 3078 | * |
| 3079 | * @return Returns the image of the logo, or null if no logo is specified |
| 3080 | * by the application. |
| 3081 | * |
| 3082 | * @see #getApplicationLogo(String) |
| 3083 | */ |
| 3084 | public abstract Drawable getApplicationLogo(ApplicationInfo info); |
| 3085 | |
| 3086 | /** |
| 3087 | * Retrieve the logo associated with an application. Given the name of the |
| 3088 | * application's package, retrieves the information about it and calls |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 3089 | * getApplicationLogo() to return its logo. If the application cannot be |
Adam Powell | 81cd2e9 | 2010-04-21 16:35:18 -0700 | [diff] [blame] | 3090 | * found, NameNotFoundException is thrown. |
| 3091 | * |
| 3092 | * @param packageName Name of the package whose application logo is to be |
| 3093 | * retrieved. |
| 3094 | * |
| 3095 | * @return Returns the image of the logo, or null if no application logo |
| 3096 | * has been specified. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3097 | * |
Adam Powell | 81cd2e9 | 2010-04-21 16:35:18 -0700 | [diff] [blame] | 3098 | * @throws NameNotFoundException Thrown if the resources for the given |
| 3099 | * application could not be loaded. |
| 3100 | * |
| 3101 | * @see #getApplicationLogo(ApplicationInfo) |
| 3102 | */ |
| 3103 | public abstract Drawable getApplicationLogo(String packageName) |
| 3104 | throws NameNotFoundException; |
| 3105 | |
| 3106 | /** |
Svetoslav | c7d62f0 | 2014-09-04 15:39:54 -0700 | [diff] [blame] | 3107 | * If the target user is a managed profile of the calling user or the caller |
| 3108 | * is itself a managed profile, then this returns a badged copy of the given |
| 3109 | * icon to be able to distinguish it from the original icon. For badging an |
| 3110 | * arbitrary drawable use {@link #getUserBadgedDrawableForDensity( |
| 3111 | * android.graphics.drawable.Drawable, UserHandle, android.graphics.Rect, int)}. |
| 3112 | * <p> |
| 3113 | * If the original drawable is a BitmapDrawable and the backing bitmap is |
| 3114 | * mutable as per {@link android.graphics.Bitmap#isMutable()}, the badging |
| 3115 | * is performed in place and the original drawable is returned. |
| 3116 | * </p> |
| 3117 | * |
| 3118 | * @param icon The icon to badge. |
| 3119 | * @param user The target user. |
| 3120 | * @return A drawable that combines the original icon and a badge as |
| 3121 | * determined by the system. |
| 3122 | */ |
| 3123 | public abstract Drawable getUserBadgedIcon(Drawable icon, UserHandle user); |
| 3124 | |
| 3125 | /** |
| 3126 | * If the target user is a managed profile of the calling user or the caller |
| 3127 | * is itself a managed profile, then this returns a badged copy of the given |
| 3128 | * drawable allowing the user to distinguish it from the original drawable. |
| 3129 | * The caller can specify the location in the bounds of the drawable to be |
| 3130 | * badged where the badge should be applied as well as the density of the |
| 3131 | * badge to be used. |
| 3132 | * <p> |
| 3133 | * If the original drawable is a BitmapDrawable and the backing bitmap is |
| 3134 | * mutable as per {@link android.graphics.Bitmap#isMutable()}, the bading |
| 3135 | * is performed in place and the original drawable is returned. |
| 3136 | * </p> |
| 3137 | * |
| 3138 | * @param drawable The drawable to badge. |
| 3139 | * @param user The target user. |
| 3140 | * @param badgeLocation Where in the bounds of the badged drawable to place |
| 3141 | * the badge. If not provided, the badge is applied on top of the entire |
| 3142 | * drawable being badged. |
| 3143 | * @param badgeDensity The optional desired density for the badge as per |
| 3144 | * {@link android.util.DisplayMetrics#densityDpi}. If not provided, |
| 3145 | * the density of the display is used. |
| 3146 | * @return A drawable that combines the original drawable and a badge as |
| 3147 | * determined by the system. |
| 3148 | */ |
| 3149 | public abstract Drawable getUserBadgedDrawableForDensity(Drawable drawable, |
| 3150 | UserHandle user, Rect badgeLocation, int badgeDensity); |
| 3151 | |
| 3152 | /** |
| 3153 | * If the target user is a managed profile of the calling user or the caller |
| 3154 | * is itself a managed profile, then this returns a drawable to use as a small |
| 3155 | * icon to include in a view to distinguish it from the original icon. |
| 3156 | * |
| 3157 | * @param user The target user. |
| 3158 | * @param density The optional desired density for the badge as per |
| 3159 | * {@link android.util.DisplayMetrics#densityDpi}. If not provided |
| 3160 | * the density of the current display is used. |
| 3161 | * @return the drawable or null if no drawable is required. |
| 3162 | * @hide |
| 3163 | */ |
| 3164 | public abstract Drawable getUserBadgeForDensity(UserHandle user, int density); |
| 3165 | |
| 3166 | /** |
| 3167 | * If the target user is a managed profile of the calling user or the caller |
| 3168 | * is itself a managed profile, then this returns a copy of the label with |
| 3169 | * badging for accessibility services like talkback. E.g. passing in "Email" |
| 3170 | * and it might return "Work Email" for Email in the work profile. |
| 3171 | * |
| 3172 | * @param label The label to change. |
| 3173 | * @param user The target user. |
| 3174 | * @return A label that combines the original label and a badge as |
| 3175 | * determined by the system. |
| 3176 | */ |
| 3177 | public abstract CharSequence getUserBadgedLabel(CharSequence label, UserHandle user); |
| 3178 | |
| 3179 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3180 | * Retrieve text from a package. This is a low-level API used by |
| 3181 | * the various package manager info structures (such as |
| 3182 | * {@link ComponentInfo} to implement retrieval of their associated |
| 3183 | * labels and other text. |
| 3184 | * |
| 3185 | * @param packageName The name of the package that this text is coming from. |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 3186 | * Cannot be null. |
| 3187 | * @param resid The resource identifier of the desired text. Cannot be 0. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3188 | * @param appInfo Overall information about <var>packageName</var>. This |
| 3189 | * may be null, in which case the application information will be retrieved |
| 3190 | * for you if needed; if you already have this information around, it can |
| 3191 | * be much more efficient to supply it here. |
| 3192 | * |
| 3193 | * @return Returns a CharSequence holding the requested text. Returns null |
| 3194 | * if the text could not be found for any reason. |
| 3195 | */ |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 3196 | public abstract CharSequence getText(String packageName, @StringRes int resid, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3197 | ApplicationInfo appInfo); |
| 3198 | |
| 3199 | /** |
| 3200 | * Retrieve an XML file from a package. This is a low-level API used to |
| 3201 | * retrieve XML meta data. |
| 3202 | * |
| 3203 | * @param packageName The name of the package that this xml is coming from. |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 3204 | * Cannot be null. |
| 3205 | * @param resid The resource identifier of the desired xml. Cannot be 0. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3206 | * @param appInfo Overall information about <var>packageName</var>. This |
| 3207 | * may be null, in which case the application information will be retrieved |
| 3208 | * for you if needed; if you already have this information around, it can |
| 3209 | * be much more efficient to supply it here. |
| 3210 | * |
| 3211 | * @return Returns an XmlPullParser allowing you to parse out the XML |
| 3212 | * data. Returns null if the xml resource could not be found for any |
| 3213 | * reason. |
| 3214 | */ |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 3215 | public abstract XmlResourceParser getXml(String packageName, @XmlRes int resid, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3216 | ApplicationInfo appInfo); |
| 3217 | |
| 3218 | /** |
| 3219 | * Return the label to use for this application. |
| 3220 | * |
| 3221 | * @return Returns the label associated with this application, or null if |
| 3222 | * it could not be found for any reason. |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 3223 | * @param info The application to get the label of. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3224 | */ |
| 3225 | public abstract CharSequence getApplicationLabel(ApplicationInfo info); |
| 3226 | |
| 3227 | /** |
| 3228 | * Retrieve the resources associated with an activity. Given the full |
| 3229 | * name of an activity, retrieves the information about it and calls |
| 3230 | * getResources() to return its application's resources. If the activity |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 3231 | * cannot be found, NameNotFoundException is thrown. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3232 | * |
| 3233 | * @param activityName Name of the activity whose resources are to be |
| 3234 | * retrieved. |
| 3235 | * |
| 3236 | * @return Returns the application's Resources. |
| 3237 | * @throws NameNotFoundException Thrown if the resources for the given |
| 3238 | * application could not be loaded. |
| 3239 | * |
| 3240 | * @see #getResourcesForApplication(ApplicationInfo) |
| 3241 | */ |
| 3242 | public abstract Resources getResourcesForActivity(ComponentName activityName) |
| 3243 | throws NameNotFoundException; |
| 3244 | |
| 3245 | /** |
| 3246 | * Retrieve the resources for an application. Throws NameNotFoundException |
| 3247 | * if the package is no longer installed. |
| 3248 | * |
| 3249 | * @param app Information about the desired application. |
| 3250 | * |
| 3251 | * @return Returns the application's Resources. |
| 3252 | * @throws NameNotFoundException Thrown if the resources for the given |
| 3253 | * application could not be loaded (most likely because it was uninstalled). |
| 3254 | */ |
| 3255 | public abstract Resources getResourcesForApplication(ApplicationInfo app) |
| 3256 | throws NameNotFoundException; |
| 3257 | |
| 3258 | /** |
| 3259 | * Retrieve the resources associated with an application. Given the full |
| 3260 | * package name of an application, retrieves the information about it and |
| 3261 | * calls getResources() to return its application's resources. If the |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 3262 | * appPackageName cannot be found, NameNotFoundException is thrown. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3263 | * |
| 3264 | * @param appPackageName Package name of the application whose resources |
| 3265 | * are to be retrieved. |
| 3266 | * |
| 3267 | * @return Returns the application's Resources. |
| 3268 | * @throws NameNotFoundException Thrown if the resources for the given |
| 3269 | * application could not be loaded. |
| 3270 | * |
| 3271 | * @see #getResourcesForApplication(ApplicationInfo) |
| 3272 | */ |
| 3273 | public abstract Resources getResourcesForApplication(String appPackageName) |
| 3274 | throws NameNotFoundException; |
| 3275 | |
Amith Yamasani | 98edc95 | 2012-09-25 14:09:27 -0700 | [diff] [blame] | 3276 | /** @hide */ |
| 3277 | public abstract Resources getResourcesForApplicationAsUser(String appPackageName, int userId) |
| 3278 | throws NameNotFoundException; |
| 3279 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3280 | /** |
| 3281 | * Retrieve overall information about an application package defined |
| 3282 | * in a package archive file |
| 3283 | * |
| 3284 | * @param archiveFilePath The path to the archive file |
| 3285 | * @param flags Additional option flags. Use any combination of |
| 3286 | * {@link #GET_ACTIVITIES}, |
| 3287 | * {@link #GET_GIDS}, |
| 3288 | * {@link #GET_CONFIGURATIONS}, |
| 3289 | * {@link #GET_INSTRUMENTATION}, |
| 3290 | * {@link #GET_PERMISSIONS}, |
| 3291 | * {@link #GET_PROVIDERS}, |
| 3292 | * {@link #GET_RECEIVERS}, |
| 3293 | * {@link #GET_SERVICES}, |
| 3294 | * {@link #GET_SIGNATURES}, to modify the data returned. |
| 3295 | * |
| 3296 | * @return Returns the information about the package. Returns |
| 3297 | * null if the package could not be successfully parsed. |
| 3298 | * |
| 3299 | * @see #GET_ACTIVITIES |
| 3300 | * @see #GET_GIDS |
| 3301 | * @see #GET_CONFIGURATIONS |
| 3302 | * @see #GET_INSTRUMENTATION |
| 3303 | * @see #GET_PERMISSIONS |
| 3304 | * @see #GET_PROVIDERS |
| 3305 | * @see #GET_RECEIVERS |
| 3306 | * @see #GET_SERVICES |
| 3307 | * @see #GET_SIGNATURES |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3308 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3309 | */ |
| 3310 | public PackageInfo getPackageArchiveInfo(String archiveFilePath, int flags) { |
Jeff Sharkey | 275e085 | 2014-06-17 18:18:49 -0700 | [diff] [blame] | 3311 | final PackageParser parser = new PackageParser(); |
| 3312 | final File apkFile = new File(archiveFilePath); |
Jeff Sharkey | c4858a2 | 2014-06-16 10:51:20 -0700 | [diff] [blame] | 3313 | try { |
Jeff Sharkey | 275e085 | 2014-06-17 18:18:49 -0700 | [diff] [blame] | 3314 | PackageParser.Package pkg = parser.parseMonolithicPackage(apkFile, 0); |
Jeff Sharkey | c4858a2 | 2014-06-16 10:51:20 -0700 | [diff] [blame] | 3315 | if ((flags & GET_SIGNATURES) != 0) { |
Jeff Sharkey | 275e085 | 2014-06-17 18:18:49 -0700 | [diff] [blame] | 3316 | parser.collectCertificates(pkg, 0); |
Jeff Sharkey | 032f2b2 | 2014-06-19 15:48:47 -0700 | [diff] [blame] | 3317 | parser.collectManifestDigest(pkg); |
Jeff Sharkey | c4858a2 | 2014-06-16 10:51:20 -0700 | [diff] [blame] | 3318 | } |
| 3319 | PackageUserState state = new PackageUserState(); |
| 3320 | return PackageParser.generatePackageInfo(pkg, null, flags, 0, 0, null, state); |
| 3321 | } catch (PackageParserException e) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3322 | return null; |
| 3323 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3324 | } |
| 3325 | |
| 3326 | /** |
Jeff Sharkey | bb58067 | 2014-07-10 12:10:25 -0700 | [diff] [blame] | 3327 | * @hide Install a package. Since this may take a little while, the result |
| 3328 | * will be posted back to the given observer. An installation will |
| 3329 | * fail if the calling context lacks the |
| 3330 | * {@link android.Manifest.permission#INSTALL_PACKAGES} permission, if |
| 3331 | * the package named in the package file's manifest is already |
| 3332 | * installed, or if there's no space available on the device. |
| 3333 | * @param packageURI The location of the package file to install. This can |
| 3334 | * be a 'file:' or a 'content:' URI. |
| 3335 | * @param observer An observer callback to get notified when the package |
| 3336 | * installation is complete. |
| 3337 | * {@link IPackageInstallObserver#packageInstalled(String, int)} |
| 3338 | * will be called when that happens. This parameter must not be |
| 3339 | * null. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 3340 | * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK}, |
Jeff Sharkey | bb58067 | 2014-07-10 12:10:25 -0700 | [diff] [blame] | 3341 | * {@link #INSTALL_REPLACE_EXISTING}, |
| 3342 | * {@link #INSTALL_ALLOW_TEST}. |
| 3343 | * @param installerPackageName Optional package name of the application that |
| 3344 | * is performing the installation. This identifies which market |
| 3345 | * the package came from. |
| 3346 | * @deprecated Use {@link #installPackage(Uri, PackageInstallObserver, int, |
| 3347 | * String)} instead. This method will continue to be supported |
| 3348 | * but the older observer interface will not get additional |
| 3349 | * failure details. |
Jacek Surazski | 65e1317 | 2009-04-28 15:26:38 +0200 | [diff] [blame] | 3350 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 3351 | // @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3352 | public abstract void installPackage( |
Jacek Surazski | 65e1317 | 2009-04-28 15:26:38 +0200 | [diff] [blame] | 3353 | Uri packageURI, IPackageInstallObserver observer, int flags, |
| 3354 | String installerPackageName); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3355 | |
| 3356 | /** |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 3357 | * Similar to |
| 3358 | * {@link #installPackage(Uri, IPackageInstallObserver, int, String)} but |
| 3359 | * with an extra verification file provided. |
| 3360 | * |
| 3361 | * @param packageURI The location of the package file to install. This can |
| 3362 | * be a 'file:' or a 'content:' URI. |
| 3363 | * @param observer An observer callback to get notified when the package |
| 3364 | * installation is complete. |
| 3365 | * {@link IPackageInstallObserver#packageInstalled(String, int)} |
Jeff Sharkey | bb58067 | 2014-07-10 12:10:25 -0700 | [diff] [blame] | 3366 | * will be called when that happens. This parameter must not be |
| 3367 | * null. |
Christopher Tate | ab8a501 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 3368 | * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK}, |
Jeff Sharkey | bb58067 | 2014-07-10 12:10:25 -0700 | [diff] [blame] | 3369 | * {@link #INSTALL_REPLACE_EXISTING}, |
| 3370 | * {@link #INSTALL_ALLOW_TEST}. |
Christopher Tate | ab8a501 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 3371 | * @param installerPackageName Optional package name of the application that |
| 3372 | * is performing the installation. This identifies which market |
| 3373 | * the package came from. |
| 3374 | * @param verificationURI The location of the supplementary verification |
| 3375 | * file. This can be a 'file:' or a 'content:' URI. May be |
| 3376 | * {@code null}. |
| 3377 | * @param manifestDigest an object that holds the digest of the package |
| 3378 | * which can be used to verify ownership. May be {@code null}. |
| 3379 | * @param encryptionParams if the package to be installed is encrypted, |
| 3380 | * these parameters describing the encryption and authentication |
| 3381 | * used. May be {@code null}. |
| 3382 | * @hide |
Jeff Sharkey | bb58067 | 2014-07-10 12:10:25 -0700 | [diff] [blame] | 3383 | * @deprecated Use {@link #installPackageWithVerification(Uri, |
| 3384 | * PackageInstallObserver, int, String, Uri, ManifestDigest, |
| 3385 | * ContainerEncryptionParams)} instead. This method will |
| 3386 | * continue to be supported but the older observer interface |
| 3387 | * will not get additional failure details. |
Christopher Tate | ab8a501 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 3388 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 3389 | // @SystemApi |
Christopher Tate | ab8a501 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 3390 | public abstract void installPackageWithVerification(Uri packageURI, |
| 3391 | IPackageInstallObserver observer, int flags, String installerPackageName, |
| 3392 | Uri verificationURI, ManifestDigest manifestDigest, |
| 3393 | ContainerEncryptionParams encryptionParams); |
| 3394 | |
| 3395 | /** |
| 3396 | * Similar to |
| 3397 | * {@link #installPackage(Uri, IPackageInstallObserver, int, String)} but |
| 3398 | * with an extra verification information provided. |
| 3399 | * |
| 3400 | * @param packageURI The location of the package file to install. This can |
| 3401 | * be a 'file:' or a 'content:' URI. |
| 3402 | * @param observer An observer callback to get notified when the package |
| 3403 | * installation is complete. |
| 3404 | * {@link IPackageInstallObserver#packageInstalled(String, int)} |
Jeff Sharkey | bb58067 | 2014-07-10 12:10:25 -0700 | [diff] [blame] | 3405 | * will be called when that happens. This parameter must not be |
| 3406 | * null. |
Christopher Tate | ab8a501 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 3407 | * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK}, |
Jeff Sharkey | bb58067 | 2014-07-10 12:10:25 -0700 | [diff] [blame] | 3408 | * {@link #INSTALL_REPLACE_EXISTING}, |
| 3409 | * {@link #INSTALL_ALLOW_TEST}. |
Christopher Tate | f1977b4 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 3410 | * @param installerPackageName Optional package name of the application that |
| 3411 | * is performing the installation. This identifies which market |
| 3412 | * the package came from. |
| 3413 | * @param verificationParams an object that holds signal information to |
| 3414 | * assist verification. May be {@code null}. |
| 3415 | * @param encryptionParams if the package to be installed is encrypted, |
| 3416 | * these parameters describing the encryption and authentication |
| 3417 | * used. May be {@code null}. |
Christopher Tate | f1977b4 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 3418 | * @hide |
| 3419 | * @deprecated Use {@link #installPackageWithVerificationAndEncryption(Uri, |
Jeff Sharkey | bb58067 | 2014-07-10 12:10:25 -0700 | [diff] [blame] | 3420 | * PackageInstallObserver, int, String, VerificationParams, |
| 3421 | * ContainerEncryptionParams)} instead. This method will |
| 3422 | * continue to be supported but the older observer interface |
| 3423 | * will not get additional failure details. |
Christopher Tate | f1977b4 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 3424 | */ |
| 3425 | @Deprecated |
| 3426 | public abstract void installPackageWithVerificationAndEncryption(Uri packageURI, |
| 3427 | IPackageInstallObserver observer, int flags, String installerPackageName, |
| 3428 | VerificationParams verificationParams, |
| 3429 | ContainerEncryptionParams encryptionParams); |
| 3430 | |
| 3431 | // Package-install variants that take the new, expanded form of observer interface. |
| 3432 | // Note that these *also* take the original observer type and will redundantly |
| 3433 | // report the same information to that observer if supplied; but it is not required. |
| 3434 | |
| 3435 | /** |
| 3436 | * @hide |
| 3437 | * |
| 3438 | * Install a package. Since this may take a little while, the result will |
| 3439 | * be posted back to the given observer. An installation will fail if the calling context |
| 3440 | * lacks the {@link android.Manifest.permission#INSTALL_PACKAGES} permission, if the |
| 3441 | * package named in the package file's manifest is already installed, or if there's no space |
| 3442 | * available on the device. |
| 3443 | * |
| 3444 | * @param packageURI The location of the package file to install. This can be a 'file:' or a |
| 3445 | * 'content:' URI. |
| 3446 | * @param observer An observer callback to get notified when the package installation is |
| 3447 | * complete. {@link PackageInstallObserver#packageInstalled(String, Bundle, int)} will be |
| 3448 | * called when that happens. This parameter must not be null. |
| 3449 | * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK}, |
| 3450 | * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}. |
| 3451 | * @param installerPackageName Optional package name of the application that is performing the |
| 3452 | * installation. This identifies which market the package came from. |
| 3453 | */ |
| 3454 | public abstract void installPackage( |
| 3455 | Uri packageURI, PackageInstallObserver observer, |
| 3456 | int flags, String installerPackageName); |
| 3457 | |
| 3458 | /** |
| 3459 | * Similar to |
| 3460 | * {@link #installPackage(Uri, IPackageInstallObserver, int, String)} but |
| 3461 | * with an extra verification file provided. |
| 3462 | * |
| 3463 | * @param packageURI The location of the package file to install. This can |
| 3464 | * be a 'file:' or a 'content:' URI. |
| 3465 | * @param observer An observer callback to get notified when the package installation is |
| 3466 | * complete. {@link PackageInstallObserver#packageInstalled(String, Bundle, int)} will be |
| 3467 | * called when that happens. This parameter must not be null. |
| 3468 | * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK}, |
| 3469 | * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}. |
| 3470 | * @param installerPackageName Optional package name of the application that |
| 3471 | * is performing the installation. This identifies which market |
| 3472 | * the package came from. |
| 3473 | * @param verificationURI The location of the supplementary verification |
| 3474 | * file. This can be a 'file:' or a 'content:' URI. May be |
| 3475 | * {@code null}. |
| 3476 | * @param manifestDigest an object that holds the digest of the package |
| 3477 | * which can be used to verify ownership. May be {@code null}. |
| 3478 | * @param encryptionParams if the package to be installed is encrypted, |
| 3479 | * these parameters describing the encryption and authentication |
| 3480 | * used. May be {@code null}. |
| 3481 | * @hide |
| 3482 | */ |
| 3483 | public abstract void installPackageWithVerification(Uri packageURI, |
| 3484 | PackageInstallObserver observer, int flags, String installerPackageName, |
| 3485 | Uri verificationURI, ManifestDigest manifestDigest, |
| 3486 | ContainerEncryptionParams encryptionParams); |
| 3487 | |
| 3488 | /** |
| 3489 | * Similar to |
| 3490 | * {@link #installPackage(Uri, IPackageInstallObserver, int, String)} but |
| 3491 | * with an extra verification information provided. |
| 3492 | * |
| 3493 | * @param packageURI The location of the package file to install. This can |
| 3494 | * be a 'file:' or a 'content:' URI. |
| 3495 | * @param observer An observer callback to get notified when the package installation is |
| 3496 | * complete. {@link PackageInstallObserver#packageInstalled(String, Bundle, int)} will be |
| 3497 | * called when that happens. This parameter must not be null. |
| 3498 | * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK}, |
| 3499 | * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}. |
Christopher Tate | ab8a501 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 3500 | * @param installerPackageName Optional package name of the application that |
| 3501 | * is performing the installation. This identifies which market |
| 3502 | * the package came from. |
| 3503 | * @param verificationParams an object that holds signal information to |
| 3504 | * assist verification. May be {@code null}. |
| 3505 | * @param encryptionParams if the package to be installed is encrypted, |
| 3506 | * these parameters describing the encryption and authentication |
| 3507 | * used. May be {@code null}. |
| 3508 | * |
| 3509 | * @hide |
Christopher Tate | ab8a501 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 3510 | */ |
Christopher Tate | ab8a501 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 3511 | public abstract void installPackageWithVerificationAndEncryption(Uri packageURI, |
Christopher Tate | f1977b4 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 3512 | PackageInstallObserver observer, int flags, String installerPackageName, |
| 3513 | VerificationParams verificationParams, ContainerEncryptionParams encryptionParams); |
Christopher Tate | ab8a501 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 3514 | |
rich cannings | 706e8ba | 2012-08-20 13:20:14 -0700 | [diff] [blame] | 3515 | /** |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 3516 | * If there is already an application with the given package name installed |
| 3517 | * on the system for other users, also install it for the calling user. |
| 3518 | * @hide |
| 3519 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 3520 | // @SystemApi |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 3521 | public abstract int installExistingPackage(String packageName) |
| 3522 | throws NameNotFoundException; |
| 3523 | |
| 3524 | /** |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 3525 | * Allows a package listening to the |
| 3526 | * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification |
Kenny Root | 3a9b5fb | 2011-09-20 14:15:38 -0700 | [diff] [blame] | 3527 | * broadcast} to respond to the package manager. The response must include |
| 3528 | * the {@code verificationCode} which is one of |
| 3529 | * {@link PackageManager#VERIFICATION_ALLOW} or |
| 3530 | * {@link PackageManager#VERIFICATION_REJECT}. |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 3531 | * |
| 3532 | * @param id pending package identifier as passed via the |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 3533 | * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra. |
Kenny Root | 3a9b5fb | 2011-09-20 14:15:38 -0700 | [diff] [blame] | 3534 | * @param verificationCode either {@link PackageManager#VERIFICATION_ALLOW} |
| 3535 | * or {@link PackageManager#VERIFICATION_REJECT}. |
rich cannings | 7e67151 | 2012-08-27 14:44:16 -0700 | [diff] [blame] | 3536 | * @throws SecurityException if the caller does not have the |
Dianne Hackborn | 8832c18 | 2012-09-17 17:20:24 -0700 | [diff] [blame] | 3537 | * PACKAGE_VERIFICATION_AGENT permission. |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 3538 | */ |
Kenny Root | 3a9b5fb | 2011-09-20 14:15:38 -0700 | [diff] [blame] | 3539 | public abstract void verifyPendingInstall(int id, int verificationCode); |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 3540 | |
| 3541 | /** |
rich cannings | d9ef3e5 | 2012-08-22 14:28:05 -0700 | [diff] [blame] | 3542 | * Allows a package listening to the |
| 3543 | * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification |
| 3544 | * broadcast} to extend the default timeout for a response and declare what |
| 3545 | * action to perform after the timeout occurs. The response must include |
| 3546 | * the {@code verificationCodeAtTimeout} which is one of |
| 3547 | * {@link PackageManager#VERIFICATION_ALLOW} or |
| 3548 | * {@link PackageManager#VERIFICATION_REJECT}. |
| 3549 | * |
| 3550 | * This method may only be called once per package id. Additional calls |
| 3551 | * will have no effect. |
| 3552 | * |
| 3553 | * @param id pending package identifier as passed via the |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 3554 | * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra. |
rich cannings | d9ef3e5 | 2012-08-22 14:28:05 -0700 | [diff] [blame] | 3555 | * @param verificationCodeAtTimeout either |
| 3556 | * {@link PackageManager#VERIFICATION_ALLOW} or |
rich cannings | d1b5cfc | 2012-08-29 14:49:51 -0700 | [diff] [blame] | 3557 | * {@link PackageManager#VERIFICATION_REJECT}. If |
| 3558 | * {@code verificationCodeAtTimeout} is neither |
| 3559 | * {@link PackageManager#VERIFICATION_ALLOW} or |
| 3560 | * {@link PackageManager#VERIFICATION_REJECT}, then |
| 3561 | * {@code verificationCodeAtTimeout} will default to |
rich cannings | d9ef3e5 | 2012-08-22 14:28:05 -0700 | [diff] [blame] | 3562 | * {@link PackageManager#VERIFICATION_REJECT}. |
| 3563 | * @param millisecondsToDelay the amount of time requested for the timeout. |
| 3564 | * Must be positive and less than |
rich cannings | d1b5cfc | 2012-08-29 14:49:51 -0700 | [diff] [blame] | 3565 | * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}. If |
| 3566 | * {@code millisecondsToDelay} is out of bounds, |
| 3567 | * {@code millisecondsToDelay} will be set to the closest in |
| 3568 | * bounds value; namely, 0 or |
rich cannings | d9ef3e5 | 2012-08-22 14:28:05 -0700 | [diff] [blame] | 3569 | * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}. |
rich cannings | 7e67151 | 2012-08-27 14:44:16 -0700 | [diff] [blame] | 3570 | * @throws SecurityException if the caller does not have the |
Dianne Hackborn | 8832c18 | 2012-09-17 17:20:24 -0700 | [diff] [blame] | 3571 | * PACKAGE_VERIFICATION_AGENT permission. |
rich cannings | d9ef3e5 | 2012-08-22 14:28:05 -0700 | [diff] [blame] | 3572 | */ |
| 3573 | public abstract void extendVerificationTimeout(int id, |
| 3574 | int verificationCodeAtTimeout, long millisecondsToDelay); |
| 3575 | |
| 3576 | /** |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 3577 | * Allows a package listening to the |
| 3578 | * {@link Intent#ACTION_INTENT_FILTER_NEEDS_VERIFICATION intent filter verification |
| 3579 | * broadcast} to respond to the package manager. The response must include |
| 3580 | * the {@code verificationCode} which is one of |
| 3581 | * {@link PackageManager#INTENT_FILTER_VERIFICATION_SUCCESS} or |
| 3582 | * {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}. |
| 3583 | * |
| 3584 | * @param verificationId pending package identifier as passed via the |
| 3585 | * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra. |
| 3586 | * @param verificationCode either {@link PackageManager#INTENT_FILTER_VERIFICATION_SUCCESS} |
| 3587 | * or {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}. |
| 3588 | * @param outFailedDomains a list of failed domains if the verificationCode is |
| 3589 | * {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}, otherwise null; |
| 3590 | * @throws SecurityException if the caller does not have the |
| 3591 | * INTENT_FILTER_VERIFICATION_AGENT permission. |
| 3592 | * |
| 3593 | * @hide |
| 3594 | */ |
| 3595 | public abstract void verifyIntentFilter(int verificationId, int verificationCode, |
| 3596 | List<String> outFailedDomains); |
| 3597 | |
| 3598 | /** |
| 3599 | * Get the status of a Domain Verification Result for an IntentFilter. This is |
| 3600 | * related to the {@link android.content.IntentFilter#setAutoVerify(boolean)} and |
| 3601 | * {@link android.content.IntentFilter#getAutoVerify()} |
| 3602 | * |
| 3603 | * This is used by the ResolverActivity to change the status depending on what the User select |
| 3604 | * in the Disambiguation Dialog and also used by the Settings App for changing the default App |
| 3605 | * for a domain. |
| 3606 | * |
| 3607 | * @param packageName The package name of the Activity associated with the IntentFilter. |
| 3608 | * @param userId The user id. |
| 3609 | * |
| 3610 | * @return The status to set to. This can be |
| 3611 | * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK} or |
| 3612 | * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS} or |
| 3613 | * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER} or |
| 3614 | * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED} |
| 3615 | * |
| 3616 | * @hide |
| 3617 | */ |
| 3618 | public abstract int getIntentVerificationStatus(String packageName, int userId); |
| 3619 | |
| 3620 | /** |
| 3621 | * Allow to change the status of a Intent Verification status for all IntentFilter of an App. |
| 3622 | * This is related to the {@link android.content.IntentFilter#setAutoVerify(boolean)} and |
| 3623 | * {@link android.content.IntentFilter#getAutoVerify()} |
| 3624 | * |
| 3625 | * This is used by the ResolverActivity to change the status depending on what the User select |
| 3626 | * in the Disambiguation Dialog and also used by the Settings App for changing the default App |
| 3627 | * for a domain. |
| 3628 | * |
| 3629 | * @param packageName The package name of the Activity associated with the IntentFilter. |
| 3630 | * @param status The status to set to. This can be |
| 3631 | * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK} or |
| 3632 | * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS} or |
| 3633 | * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER} |
| 3634 | * @param userId The user id. |
| 3635 | * |
| 3636 | * @return true if the status has been set. False otherwise. |
| 3637 | * |
| 3638 | * @hide |
| 3639 | */ |
| 3640 | public abstract boolean updateIntentVerificationStatus(String packageName, int status, |
| 3641 | int userId); |
| 3642 | |
| 3643 | /** |
| 3644 | * Get the list of IntentFilterVerificationInfo for a specific package and User. |
| 3645 | * |
| 3646 | * @param packageName the package name. When this parameter is set to a non null value, |
| 3647 | * the results will be filtered by the package name provided. |
| 3648 | * Otherwise, there will be no filtering and it will return a list |
Fabrice Di Meglio | 0788595 | 2015-04-06 19:41:28 -0700 | [diff] [blame] | 3649 | * corresponding for all packages |
| 3650 | * |
| 3651 | * @return a list of IntentFilterVerificationInfo for a specific package. |
| 3652 | * |
| 3653 | * @hide |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 3654 | */ |
| 3655 | public abstract List<IntentFilterVerificationInfo> getIntentFilterVerifications( |
| 3656 | String packageName); |
| 3657 | |
| 3658 | /** |
Fabrice Di Meglio | 0788595 | 2015-04-06 19:41:28 -0700 | [diff] [blame] | 3659 | * Get the list of IntentFilter for a specific package. |
| 3660 | * |
| 3661 | * @param packageName the package name. This parameter is set to a non null value, |
| 3662 | * the list will contain all the IntentFilter for that package. |
| 3663 | * Otherwise, the list will be empty. |
| 3664 | * |
| 3665 | * @return a list of IntentFilter for a specific package. |
| 3666 | * |
| 3667 | * @hide |
| 3668 | */ |
| 3669 | public abstract List<IntentFilter> getAllIntentFilters(String packageName); |
| 3670 | |
| 3671 | /** |
Fabrice Di Meglio | 6227172 | 2015-04-10 17:24:02 -0700 | [diff] [blame] | 3672 | * Get the default Browser package name for a specific user. |
| 3673 | * |
| 3674 | * @param userId The user id. |
| 3675 | * |
| 3676 | * @return the package name of the default Browser for the specified user. If the user id passed |
| 3677 | * is -1 (all users) it will return a null value. |
| 3678 | * |
| 3679 | * @hide |
| 3680 | */ |
| 3681 | public abstract String getDefaultBrowserPackageName(int userId); |
| 3682 | |
| 3683 | /** |
| 3684 | * Set the default Browser package name for a specific user. |
| 3685 | * |
| 3686 | * @param packageName The package name of the default Browser. |
| 3687 | * @param userId The user id. |
| 3688 | * |
| 3689 | * @return true if the default Browser for the specified user has been set, |
| 3690 | * otherwise return false. If the user id passed is -1 (all users) this call will not |
| 3691 | * do anything and just return false. |
| 3692 | * |
| 3693 | * @hide |
| 3694 | */ |
| 3695 | public abstract boolean setDefaultBrowserPackageName(String packageName, int userId); |
| 3696 | |
| 3697 | /** |
Dianne Hackborn | 880119b | 2010-11-18 22:26:40 -0800 | [diff] [blame] | 3698 | * Change the installer associated with a given package. There are limitations |
| 3699 | * on how the installer package can be changed; in particular: |
| 3700 | * <ul> |
| 3701 | * <li> A SecurityException will be thrown if <var>installerPackageName</var> |
| 3702 | * is not signed with the same certificate as the calling application. |
| 3703 | * <li> A SecurityException will be thrown if <var>targetPackage</var> already |
| 3704 | * has an installer package, and that installer package is not signed with |
| 3705 | * the same certificate as the calling application. |
| 3706 | * </ul> |
| 3707 | * |
| 3708 | * @param targetPackage The installed package whose installer will be changed. |
| 3709 | * @param installerPackageName The package name of the new installer. May be |
| 3710 | * null to clear the association. |
| 3711 | */ |
| 3712 | public abstract void setInstallerPackageName(String targetPackage, |
| 3713 | String installerPackageName); |
| 3714 | |
| 3715 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3716 | * Attempts to delete a package. Since this may take a little while, the result will |
| 3717 | * be posted back to the given observer. A deletion will fail if the calling context |
| 3718 | * lacks the {@link android.Manifest.permission#DELETE_PACKAGES} permission, if the |
| 3719 | * named package cannot be found, or if the named package is a "system package". |
| 3720 | * (TODO: include pointer to documentation on "system packages") |
| 3721 | * |
| 3722 | * @param packageName The name of the package to delete |
| 3723 | * @param observer An observer callback to get notified when the package deletion is |
| 3724 | * complete. {@link android.content.pm.IPackageDeleteObserver#packageDeleted(boolean)} will be |
| 3725 | * called when that happens. observer may be null to indicate that no callback is desired. |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 3726 | * @param flags - possible values: {@link #DELETE_KEEP_DATA}, |
| 3727 | * {@link #DELETE_ALL_USERS}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3728 | * |
| 3729 | * @hide |
| 3730 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 3731 | // @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3732 | public abstract void deletePackage( |
| 3733 | String packageName, IPackageDeleteObserver observer, int flags); |
Jacek Surazski | 65e1317 | 2009-04-28 15:26:38 +0200 | [diff] [blame] | 3734 | |
| 3735 | /** |
| 3736 | * Retrieve the package name of the application that installed a package. This identifies |
| 3737 | * which market the package came from. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3738 | * |
Jacek Surazski | 65e1317 | 2009-04-28 15:26:38 +0200 | [diff] [blame] | 3739 | * @param packageName The name of the package to query |
| 3740 | */ |
| 3741 | public abstract String getInstallerPackageName(String packageName); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3742 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3743 | /** |
| 3744 | * Attempts to clear the user data directory of an application. |
| 3745 | * Since this may take a little while, the result will |
| 3746 | * be posted back to the given observer. A deletion will fail if the |
| 3747 | * named package cannot be found, or if the named package is a "system package". |
| 3748 | * |
| 3749 | * @param packageName The name of the package |
| 3750 | * @param observer An observer callback to get notified when the operation is finished |
| 3751 | * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)} |
| 3752 | * will be called when that happens. observer may be null to indicate that |
| 3753 | * no callback is desired. |
| 3754 | * |
| 3755 | * @hide |
| 3756 | */ |
| 3757 | public abstract void clearApplicationUserData(String packageName, |
| 3758 | IPackageDataObserver observer); |
| 3759 | /** |
| 3760 | * Attempts to delete the cache files associated with an application. |
| 3761 | * Since this may take a little while, the result will |
| 3762 | * be posted back to the given observer. A deletion will fail if the calling context |
| 3763 | * lacks the {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the |
| 3764 | * named package cannot be found, or if the named package is a "system package". |
| 3765 | * |
| 3766 | * @param packageName The name of the package to delete |
| 3767 | * @param observer An observer callback to get notified when the cache file deletion |
| 3768 | * is complete. |
| 3769 | * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)} |
| 3770 | * will be called when that happens. observer may be null to indicate that |
| 3771 | * no callback is desired. |
| 3772 | * |
| 3773 | * @hide |
| 3774 | */ |
| 3775 | public abstract void deleteApplicationCacheFiles(String packageName, |
| 3776 | IPackageDataObserver observer); |
| 3777 | |
| 3778 | /** |
| 3779 | * Free storage by deleting LRU sorted list of cache files across |
| 3780 | * all applications. If the currently available free storage |
| 3781 | * on the device is greater than or equal to the requested |
| 3782 | * free storage, no cache files are cleared. If the currently |
| 3783 | * available storage on the device is less than the requested |
| 3784 | * free storage, some or all of the cache files across |
| 3785 | * all applications are deleted (based on last accessed time) |
| 3786 | * to increase the free storage space on the device to |
| 3787 | * the requested value. There is no guarantee that clearing all |
| 3788 | * the cache files from all applications will clear up |
| 3789 | * enough storage to achieve the desired value. |
| 3790 | * @param freeStorageSize The number of bytes of storage to be |
| 3791 | * freed by the system. Say if freeStorageSize is XX, |
| 3792 | * and the current free storage is YY, |
| 3793 | * if XX is less than YY, just return. if not free XX-YY number |
| 3794 | * of bytes if possible. |
| 3795 | * @param observer call back used to notify when |
| 3796 | * the operation is completed |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3797 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3798 | * @hide |
| 3799 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 3800 | // @SystemApi |
Jeff Sharkey | 529f91f | 2015-04-18 20:23:13 -0700 | [diff] [blame] | 3801 | public void freeStorageAndNotify(long freeStorageSize, IPackageDataObserver observer) { |
| 3802 | freeStorageAndNotify(null, freeStorageSize, observer); |
| 3803 | } |
| 3804 | |
| 3805 | /** {@hide} */ |
| 3806 | public abstract void freeStorageAndNotify(String volumeUuid, long freeStorageSize, |
| 3807 | IPackageDataObserver observer); |
Suchi Amalapurapu | 1ccac75 | 2009-06-12 10:09:58 -0700 | [diff] [blame] | 3808 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3809 | /** |
| 3810 | * Free storage by deleting LRU sorted list of cache files across |
| 3811 | * all applications. If the currently available free storage |
| 3812 | * on the device is greater than or equal to the requested |
| 3813 | * free storage, no cache files are cleared. If the currently |
| 3814 | * available storage on the device is less than the requested |
| 3815 | * free storage, some or all of the cache files across |
| 3816 | * all applications are deleted (based on last accessed time) |
| 3817 | * to increase the free storage space on the device to |
| 3818 | * the requested value. There is no guarantee that clearing all |
| 3819 | * the cache files from all applications will clear up |
| 3820 | * enough storage to achieve the desired value. |
| 3821 | * @param freeStorageSize The number of bytes of storage to be |
| 3822 | * freed by the system. Say if freeStorageSize is XX, |
| 3823 | * and the current free storage is YY, |
| 3824 | * if XX is less than YY, just return. if not free XX-YY number |
| 3825 | * of bytes if possible. |
Suchi Amalapurapu | 1ccac75 | 2009-06-12 10:09:58 -0700 | [diff] [blame] | 3826 | * @param pi IntentSender call back used to |
| 3827 | * notify when the operation is completed.May be null |
| 3828 | * to indicate that no call back is desired. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3829 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3830 | * @hide |
| 3831 | */ |
Jeff Sharkey | 529f91f | 2015-04-18 20:23:13 -0700 | [diff] [blame] | 3832 | public void freeStorage(long freeStorageSize, IntentSender pi) { |
| 3833 | freeStorage(null, freeStorageSize, pi); |
| 3834 | } |
| 3835 | |
| 3836 | /** {@hide} */ |
| 3837 | public abstract void freeStorage(String volumeUuid, long freeStorageSize, IntentSender pi); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3838 | |
| 3839 | /** |
| 3840 | * Retrieve the size information for a package. |
| 3841 | * Since this may take a little while, the result will |
| 3842 | * be posted back to the given observer. The calling context |
| 3843 | * should have the {@link android.Manifest.permission#GET_PACKAGE_SIZE} permission. |
| 3844 | * |
| 3845 | * @param packageName The name of the package whose size information is to be retrieved |
Dianne Hackborn | 0c38049 | 2012-08-20 17:23:30 -0700 | [diff] [blame] | 3846 | * @param userHandle The user whose size information should be retrieved. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3847 | * @param observer An observer callback to get notified when the operation |
| 3848 | * is complete. |
| 3849 | * {@link android.content.pm.IPackageStatsObserver#onGetStatsCompleted(PackageStats, boolean)} |
| 3850 | * The observer's callback is invoked with a PackageStats object(containing the |
| 3851 | * code, data and cache sizes of the package) and a boolean value representing |
| 3852 | * the status of the operation. observer may be null to indicate that |
| 3853 | * no callback is desired. |
| 3854 | * |
| 3855 | * @hide |
| 3856 | */ |
Dianne Hackborn | 0c38049 | 2012-08-20 17:23:30 -0700 | [diff] [blame] | 3857 | public abstract void getPackageSizeInfo(String packageName, int userHandle, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3858 | IPackageStatsObserver observer); |
| 3859 | |
| 3860 | /** |
Dianne Hackborn | 0c38049 | 2012-08-20 17:23:30 -0700 | [diff] [blame] | 3861 | * Like {@link #getPackageSizeInfo(String, int, IPackageStatsObserver)}, but |
| 3862 | * returns the size for the calling user. |
| 3863 | * |
| 3864 | * @hide |
| 3865 | */ |
| 3866 | public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) { |
| 3867 | getPackageSizeInfo(packageName, UserHandle.myUserId(), observer); |
| 3868 | } |
| 3869 | |
| 3870 | /** |
Dianne Hackborn | a7ca0e5 | 2009-12-01 14:31:55 -0800 | [diff] [blame] | 3871 | * @deprecated This function no longer does anything; it was an old |
kmccormick | ac66b85 | 2013-03-28 15:17:15 -0700 | [diff] [blame] | 3872 | * approach to managing preferred activities, which has been superseded |
| 3873 | * by (and conflicts with) the modern activity-based preferences. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3874 | */ |
Dianne Hackborn | a7ca0e5 | 2009-12-01 14:31:55 -0800 | [diff] [blame] | 3875 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3876 | public abstract void addPackageToPreferred(String packageName); |
| 3877 | |
| 3878 | /** |
Dianne Hackborn | a7ca0e5 | 2009-12-01 14:31:55 -0800 | [diff] [blame] | 3879 | * @deprecated This function no longer does anything; it was an old |
kmccormick | ac66b85 | 2013-03-28 15:17:15 -0700 | [diff] [blame] | 3880 | * approach to managing preferred activities, which has been superseded |
| 3881 | * by (and conflicts with) the modern activity-based preferences. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3882 | */ |
Dianne Hackborn | a7ca0e5 | 2009-12-01 14:31:55 -0800 | [diff] [blame] | 3883 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3884 | public abstract void removePackageFromPreferred(String packageName); |
| 3885 | |
| 3886 | /** |
| 3887 | * Retrieve the list of all currently configured preferred packages. The |
| 3888 | * first package on the list is the most preferred, the last is the |
| 3889 | * least preferred. |
| 3890 | * |
| 3891 | * @param flags Additional option flags. Use any combination of |
| 3892 | * {@link #GET_ACTIVITIES}, |
| 3893 | * {@link #GET_GIDS}, |
| 3894 | * {@link #GET_CONFIGURATIONS}, |
| 3895 | * {@link #GET_INSTRUMENTATION}, |
| 3896 | * {@link #GET_PERMISSIONS}, |
| 3897 | * {@link #GET_PROVIDERS}, |
| 3898 | * {@link #GET_RECEIVERS}, |
| 3899 | * {@link #GET_SERVICES}, |
| 3900 | * {@link #GET_SIGNATURES}, to modify the data returned. |
| 3901 | * |
| 3902 | * @return Returns a list of PackageInfo objects describing each |
| 3903 | * preferred application, in order of preference. |
| 3904 | * |
| 3905 | * @see #GET_ACTIVITIES |
| 3906 | * @see #GET_GIDS |
| 3907 | * @see #GET_CONFIGURATIONS |
| 3908 | * @see #GET_INSTRUMENTATION |
| 3909 | * @see #GET_PERMISSIONS |
| 3910 | * @see #GET_PROVIDERS |
| 3911 | * @see #GET_RECEIVERS |
| 3912 | * @see #GET_SERVICES |
| 3913 | * @see #GET_SIGNATURES |
| 3914 | */ |
| 3915 | public abstract List<PackageInfo> getPreferredPackages(int flags); |
| 3916 | |
| 3917 | /** |
Dianne Hackborn | 2ee89ea | 2010-03-10 18:27:09 -0800 | [diff] [blame] | 3918 | * @deprecated This is a protected API that should not have been available |
| 3919 | * to third party applications. It is the platform's responsibility for |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 3920 | * assigning preferred activities and this cannot be directly modified. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3921 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3922 | * Add a new preferred activity mapping to the system. This will be used |
| 3923 | * to automatically select the given activity component when |
| 3924 | * {@link Context#startActivity(Intent) Context.startActivity()} finds |
| 3925 | * multiple matching activities and also matches the given filter. |
| 3926 | * |
| 3927 | * @param filter The set of intents under which this activity will be |
| 3928 | * made preferred. |
| 3929 | * @param match The IntentFilter match category that this preference |
| 3930 | * applies to. |
| 3931 | * @param set The set of activities that the user was picking from when |
| 3932 | * this preference was made. |
| 3933 | * @param activity The component name of the activity that is to be |
| 3934 | * preferred. |
| 3935 | */ |
Dianne Hackborn | 2ee89ea | 2010-03-10 18:27:09 -0800 | [diff] [blame] | 3936 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3937 | public abstract void addPreferredActivity(IntentFilter filter, int match, |
| 3938 | ComponentName[] set, ComponentName activity); |
| 3939 | |
| 3940 | /** |
Amith Yamasani | a3f133a | 2012-08-09 17:11:28 -0700 | [diff] [blame] | 3941 | * Same as {@link #addPreferredActivity(IntentFilter, int, |
| 3942 | ComponentName[], ComponentName)}, but with a specific userId to apply the preference |
| 3943 | to. |
| 3944 | * @hide |
| 3945 | */ |
| 3946 | public void addPreferredActivity(IntentFilter filter, int match, |
| 3947 | ComponentName[] set, ComponentName activity, int userId) { |
| 3948 | throw new RuntimeException("Not implemented. Must override in a subclass."); |
| 3949 | } |
| 3950 | |
| 3951 | /** |
Dianne Hackborn | 2ee89ea | 2010-03-10 18:27:09 -0800 | [diff] [blame] | 3952 | * @deprecated This is a protected API that should not have been available |
| 3953 | * to third party applications. It is the platform's responsibility for |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 3954 | * assigning preferred activities and this cannot be directly modified. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3955 | * |
Satish Sampath | 8dbe612 | 2009-06-02 23:35:54 +0100 | [diff] [blame] | 3956 | * Replaces an existing preferred activity mapping to the system, and if that were not present |
| 3957 | * adds a new preferred activity. This will be used |
| 3958 | * to automatically select the given activity component when |
| 3959 | * {@link Context#startActivity(Intent) Context.startActivity()} finds |
| 3960 | * multiple matching activities and also matches the given filter. |
| 3961 | * |
| 3962 | * @param filter The set of intents under which this activity will be |
| 3963 | * made preferred. |
| 3964 | * @param match The IntentFilter match category that this preference |
| 3965 | * applies to. |
| 3966 | * @param set The set of activities that the user was picking from when |
| 3967 | * this preference was made. |
| 3968 | * @param activity The component name of the activity that is to be |
| 3969 | * preferred. |
| 3970 | * @hide |
| 3971 | */ |
Dianne Hackborn | 2ee89ea | 2010-03-10 18:27:09 -0800 | [diff] [blame] | 3972 | @Deprecated |
Satish Sampath | 8dbe612 | 2009-06-02 23:35:54 +0100 | [diff] [blame] | 3973 | public abstract void replacePreferredActivity(IntentFilter filter, int match, |
| 3974 | ComponentName[] set, ComponentName activity); |
| 3975 | |
| 3976 | /** |
Amith Yamasani | 41c1ded | 2014-08-05 11:15:05 -0700 | [diff] [blame] | 3977 | * @hide |
| 3978 | */ |
| 3979 | @Deprecated |
| 3980 | public void replacePreferredActivityAsUser(IntentFilter filter, int match, |
| 3981 | ComponentName[] set, ComponentName activity, int userId) { |
| 3982 | throw new RuntimeException("Not implemented. Must override in a subclass."); |
| 3983 | } |
| 3984 | |
| 3985 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3986 | * Remove all preferred activity mappings, previously added with |
| 3987 | * {@link #addPreferredActivity}, from the |
| 3988 | * system whose activities are implemented in the given package name. |
Dianne Hackborn | 2ee89ea | 2010-03-10 18:27:09 -0800 | [diff] [blame] | 3989 | * An application can only clear its own package(s). |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3990 | * |
| 3991 | * @param packageName The name of the package whose preferred activity |
| 3992 | * mappings are to be removed. |
| 3993 | */ |
| 3994 | public abstract void clearPackagePreferredActivities(String packageName); |
| 3995 | |
| 3996 | /** |
| 3997 | * Retrieve all preferred activities, previously added with |
| 3998 | * {@link #addPreferredActivity}, that are |
| 3999 | * currently registered with the system. |
| 4000 | * |
John Spurlock | 38e6425 | 2015-03-18 12:09:32 -0400 | [diff] [blame] | 4001 | * @param outFilters A required list in which to place the filters of all of the |
| 4002 | * preferred activities. |
| 4003 | * @param outActivities A required list in which to place the component names of |
| 4004 | * all of the preferred activities. |
| 4005 | * @param packageName An optional package in which you would like to limit |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4006 | * the list. If null, all activities will be returned; if non-null, only |
| 4007 | * those activities in the given package are returned. |
| 4008 | * |
| 4009 | * @return Returns the total number of registered preferred activities |
| 4010 | * (the number of distinct IntentFilter records, not the number of unique |
| 4011 | * activity components) that were found. |
| 4012 | */ |
John Spurlock | 38e6425 | 2015-03-18 12:09:32 -0400 | [diff] [blame] | 4013 | public abstract int getPreferredActivities(@NonNull List<IntentFilter> outFilters, |
| 4014 | @NonNull List<ComponentName> outActivities, String packageName); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4015 | |
| 4016 | /** |
Christopher Tate | a2a0850d | 2013-09-05 16:38:58 -0700 | [diff] [blame] | 4017 | * Ask for the set of available 'home' activities and the current explicit |
| 4018 | * default, if any. |
| 4019 | * @hide |
| 4020 | */ |
| 4021 | public abstract ComponentName getHomeActivities(List<ResolveInfo> outActivities); |
| 4022 | |
| 4023 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4024 | * Set the enabled setting for a package component (activity, receiver, service, provider). |
| 4025 | * This setting will override any enabled state which may have been set by the component in its |
| 4026 | * manifest. |
| 4027 | * |
| 4028 | * @param componentName The component to enable |
| 4029 | * @param newState The new enabled state for the component. The legal values for this state |
| 4030 | * are: |
| 4031 | * {@link #COMPONENT_ENABLED_STATE_ENABLED}, |
| 4032 | * {@link #COMPONENT_ENABLED_STATE_DISABLED} |
| 4033 | * and |
| 4034 | * {@link #COMPONENT_ENABLED_STATE_DEFAULT} |
| 4035 | * The last one removes the setting, thereby restoring the component's state to |
| 4036 | * whatever was set in it's manifest (or enabled, by default). |
| 4037 | * @param flags Optional behavior flags: {@link #DONT_KILL_APP} or 0. |
| 4038 | */ |
| 4039 | public abstract void setComponentEnabledSetting(ComponentName componentName, |
| 4040 | int newState, int flags); |
| 4041 | |
| 4042 | |
| 4043 | /** |
Amaury Medeiros | dde2426 | 2014-06-03 20:06:41 -0300 | [diff] [blame] | 4044 | * Return the enabled setting for a package component (activity, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4045 | * receiver, service, provider). This returns the last value set by |
| 4046 | * {@link #setComponentEnabledSetting(ComponentName, int, int)}; in most |
| 4047 | * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since |
| 4048 | * the value originally specified in the manifest has not been modified. |
| 4049 | * |
| 4050 | * @param componentName The component to retrieve. |
| 4051 | * @return Returns the current enabled state for the component. May |
| 4052 | * be one of {@link #COMPONENT_ENABLED_STATE_ENABLED}, |
| 4053 | * {@link #COMPONENT_ENABLED_STATE_DISABLED}, or |
| 4054 | * {@link #COMPONENT_ENABLED_STATE_DEFAULT}. The last one means the |
| 4055 | * component's enabled state is based on the original information in |
| 4056 | * the manifest as found in {@link ComponentInfo}. |
| 4057 | */ |
| 4058 | public abstract int getComponentEnabledSetting(ComponentName componentName); |
| 4059 | |
| 4060 | /** |
| 4061 | * Set the enabled setting for an application |
| 4062 | * This setting will override any enabled state which may have been set by the application in |
| 4063 | * its manifest. It also overrides the enabled state set in the manifest for any of the |
| 4064 | * application's components. It does not override any enabled state set by |
| 4065 | * {@link #setComponentEnabledSetting} for any of the application's components. |
| 4066 | * |
| 4067 | * @param packageName The package name of the application to enable |
| 4068 | * @param newState The new enabled state for the component. The legal values for this state |
| 4069 | * are: |
| 4070 | * {@link #COMPONENT_ENABLED_STATE_ENABLED}, |
| 4071 | * {@link #COMPONENT_ENABLED_STATE_DISABLED} |
| 4072 | * and |
| 4073 | * {@link #COMPONENT_ENABLED_STATE_DEFAULT} |
| 4074 | * The last one removes the setting, thereby restoring the applications's state to |
| 4075 | * whatever was set in its manifest (or enabled, by default). |
| 4076 | * @param flags Optional behavior flags: {@link #DONT_KILL_APP} or 0. |
| 4077 | */ |
| 4078 | public abstract void setApplicationEnabledSetting(String packageName, |
| 4079 | int newState, int flags); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 4080 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4081 | /** |
Amaury Medeiros | dde2426 | 2014-06-03 20:06:41 -0300 | [diff] [blame] | 4082 | * Return the enabled setting for an application. This returns |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4083 | * the last value set by |
| 4084 | * {@link #setApplicationEnabledSetting(String, int, int)}; in most |
| 4085 | * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since |
| 4086 | * the value originally specified in the manifest has not been modified. |
| 4087 | * |
Amaury Medeiros | dde2426 | 2014-06-03 20:06:41 -0300 | [diff] [blame] | 4088 | * @param packageName The package name of the application to retrieve. |
| 4089 | * @return Returns the current enabled state for the application. May |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4090 | * be one of {@link #COMPONENT_ENABLED_STATE_ENABLED}, |
| 4091 | * {@link #COMPONENT_ENABLED_STATE_DISABLED}, or |
| 4092 | * {@link #COMPONENT_ENABLED_STATE_DEFAULT}. The last one means the |
| 4093 | * application's enabled state is based on the original information in |
| 4094 | * the manifest as found in {@link ComponentInfo}. |
Mathew Inwood | 1b9f8d9 | 2011-09-26 13:23:56 +0100 | [diff] [blame] | 4095 | * @throws IllegalArgumentException if the named package does not exist. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4096 | */ |
| 4097 | public abstract int getApplicationEnabledSetting(String packageName); |
| 4098 | |
| 4099 | /** |
Amith Yamasani | e5bcff6 | 2014-07-19 15:44:09 -0700 | [diff] [blame] | 4100 | * Puts the package in a hidden state, which is almost like an uninstalled state, |
Amith Yamasani | 655d0e2 | 2013-06-12 14:19:10 -0700 | [diff] [blame] | 4101 | * making the package unavailable, but it doesn't remove the data or the actual |
Amith Yamasani | e5bcff6 | 2014-07-19 15:44:09 -0700 | [diff] [blame] | 4102 | * package file. Application can be unhidden by either resetting the hidden state |
| 4103 | * or by installing it, such as with {@link #installExistingPackage(String)} |
Amith Yamasani | 655d0e2 | 2013-06-12 14:19:10 -0700 | [diff] [blame] | 4104 | * @hide |
| 4105 | */ |
Amith Yamasani | e5bcff6 | 2014-07-19 15:44:09 -0700 | [diff] [blame] | 4106 | public abstract boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden, |
Amith Yamasani | 655d0e2 | 2013-06-12 14:19:10 -0700 | [diff] [blame] | 4107 | UserHandle userHandle); |
| 4108 | |
| 4109 | /** |
Amith Yamasani | e5bcff6 | 2014-07-19 15:44:09 -0700 | [diff] [blame] | 4110 | * Returns the hidden state of a package. |
| 4111 | * @see #setApplicationHiddenSettingAsUser(String, boolean, UserHandle) |
Amith Yamasani | 655d0e2 | 2013-06-12 14:19:10 -0700 | [diff] [blame] | 4112 | * @hide |
| 4113 | */ |
Amith Yamasani | e5bcff6 | 2014-07-19 15:44:09 -0700 | [diff] [blame] | 4114 | public abstract boolean getApplicationHiddenSettingAsUser(String packageName, |
Amith Yamasani | 655d0e2 | 2013-06-12 14:19:10 -0700 | [diff] [blame] | 4115 | UserHandle userHandle); |
| 4116 | |
| 4117 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4118 | * Return whether the device has been booted into safe mode. |
| 4119 | */ |
| 4120 | public abstract boolean isSafeMode(); |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 4121 | |
| 4122 | /** |
dcashman | 9d2f441 | 2014-06-09 09:27:54 -0700 | [diff] [blame] | 4123 | * Return the {@link KeySet} associated with the String alias for this |
| 4124 | * application. |
| 4125 | * |
| 4126 | * @param alias The alias for a given {@link KeySet} as defined in the |
| 4127 | * application's AndroidManifest.xml. |
dcashman | c6f2249 | 2014-08-14 09:54:51 -0700 | [diff] [blame] | 4128 | * @hide |
dcashman | 9d2f441 | 2014-06-09 09:27:54 -0700 | [diff] [blame] | 4129 | */ |
| 4130 | public abstract KeySet getKeySetByAlias(String packageName, String alias); |
| 4131 | |
Ihab Awad | 1ec6888 | 2014-09-12 11:09:01 -0700 | [diff] [blame] | 4132 | /** Return the signing {@link KeySet} for this application. |
dcashman | c6f2249 | 2014-08-14 09:54:51 -0700 | [diff] [blame] | 4133 | * @hide |
| 4134 | */ |
dcashman | 9d2f441 | 2014-06-09 09:27:54 -0700 | [diff] [blame] | 4135 | public abstract KeySet getSigningKeySet(String packageName); |
| 4136 | |
| 4137 | /** |
| 4138 | * Return whether the package denoted by packageName has been signed by all |
| 4139 | * of the keys specified by the {@link KeySet} ks. This will return true if |
| 4140 | * the package has been signed by additional keys (a superset) as well. |
| 4141 | * Compare to {@link #isSignedByExactly(String packageName, KeySet ks)}. |
dcashman | c6f2249 | 2014-08-14 09:54:51 -0700 | [diff] [blame] | 4142 | * @hide |
dcashman | 9d2f441 | 2014-06-09 09:27:54 -0700 | [diff] [blame] | 4143 | */ |
| 4144 | public abstract boolean isSignedBy(String packageName, KeySet ks); |
| 4145 | |
| 4146 | /** |
| 4147 | * Return whether the package denoted by packageName has been signed by all |
| 4148 | * of, and only, the keys specified by the {@link KeySet} ks. Compare to |
| 4149 | * {@link #isSignedBy(String packageName, KeySet ks)}. |
dcashman | c6f2249 | 2014-08-14 09:54:51 -0700 | [diff] [blame] | 4150 | * @hide |
dcashman | 9d2f441 | 2014-06-09 09:27:54 -0700 | [diff] [blame] | 4151 | */ |
| 4152 | public abstract boolean isSignedByExactly(String packageName, KeySet ks); |
| 4153 | |
| 4154 | /** |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 4155 | * Attempts to move package resources from internal to external media or vice versa. |
| 4156 | * Since this may take a little while, the result will |
| 4157 | * be posted back to the given observer. This call may fail if the calling context |
| 4158 | * lacks the {@link android.Manifest.permission#MOVE_PACKAGE} permission, if the |
| 4159 | * named package cannot be found, or if the named package is a "system package". |
| 4160 | * |
| 4161 | * @param packageName The name of the package to delete |
| 4162 | * @param observer An observer callback to get notified when the package move is |
| 4163 | * complete. {@link android.content.pm.IPackageMoveObserver#packageMoved(boolean)} will be |
| 4164 | * called when that happens. observer may be null to indicate that no callback is desired. |
| 4165 | * @param flags To indicate install location {@link #MOVE_INTERNAL} or |
| 4166 | * {@link #MOVE_EXTERNAL_MEDIA} |
| 4167 | * |
| 4168 | * @hide |
| 4169 | */ |
Jeff Sharkey | b2b9ab8 | 2015-04-05 21:10:42 -0700 | [diff] [blame] | 4170 | @Deprecated |
| 4171 | public abstract void movePackage(String packageName, IPackageMoveObserver observer, int flags); |
| 4172 | |
| 4173 | /** {@hide} */ |
| 4174 | public abstract void movePackageAndData(String packageName, String volumeUuid, |
| 4175 | IPackageMoveObserver observer); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 4176 | |
Jeff Sharkey | e2d45be | 2015-04-15 17:14:12 -0700 | [diff] [blame] | 4177 | /** {@hide} */ |
| 4178 | public abstract @Nullable VolumeInfo getApplicationCurrentVolume(ApplicationInfo app); |
| 4179 | |
| 4180 | /** {@hide} */ |
| 4181 | public abstract @NonNull List<VolumeInfo> getApplicationCandidateVolumes(ApplicationInfo app); |
| 4182 | |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 4183 | /** |
Amith Yamasani | 1359360 | 2012-03-22 16:16:17 -0700 | [diff] [blame] | 4184 | * Returns the device identity that verifiers can use to associate their scheme to a particular |
| 4185 | * device. This should not be used by anything other than a package verifier. |
Aravind Akella | 068b0c0 | 2013-10-12 17:39:15 -0700 | [diff] [blame] | 4186 | * |
Kenny Root | 0aaa0d9 | 2011-09-12 16:42:55 -0700 | [diff] [blame] | 4187 | * @return identity that uniquely identifies current device |
| 4188 | * @hide |
| 4189 | */ |
| 4190 | public abstract VerifierDeviceIdentity getVerifierDeviceIdentity(); |
Amith Yamasani | 742a671 | 2011-05-04 14:49:28 -0700 | [diff] [blame] | 4191 | |
Jeff Sharkey | 6c833e0 | 2014-07-14 22:44:30 -0700 | [diff] [blame] | 4192 | /** |
Jeff Hao | 9f60c08 | 2014-10-28 18:51:07 -0700 | [diff] [blame] | 4193 | * Returns true if the device is upgrading, such as first boot after OTA. |
| 4194 | * |
| 4195 | * @hide |
| 4196 | */ |
| 4197 | public abstract boolean isUpgrade(); |
| 4198 | |
| 4199 | /** |
Jeff Sharkey | 6c833e0 | 2014-07-14 22:44:30 -0700 | [diff] [blame] | 4200 | * Return interface that offers the ability to install, upgrade, and remove |
| 4201 | * applications on the device. |
| 4202 | */ |
Jeff Sharkey | 16c8e3f | 2014-07-24 17:08:17 -0700 | [diff] [blame] | 4203 | public abstract @NonNull PackageInstaller getPackageInstaller(); |
Jeff Sharkey | 3a44f3f | 2014-04-28 17:36:31 -0700 | [diff] [blame] | 4204 | |
Amith Yamasani | 742a671 | 2011-05-04 14:49:28 -0700 | [diff] [blame] | 4205 | /** |
Jeff Sharkey | b9f3674 | 2015-04-08 21:02:14 -0700 | [diff] [blame] | 4206 | * Returns the data directory for a particular package and user. |
| 4207 | * |
Amith Yamasani | 742a671 | 2011-05-04 14:49:28 -0700 | [diff] [blame] | 4208 | * @hide |
| 4209 | */ |
Jeff Sharkey | b9f3674 | 2015-04-08 21:02:14 -0700 | [diff] [blame] | 4210 | public static File getDataDirForUser(String volumeUuid, String packageName, int userId) { |
Amith Yamasani | 742a671 | 2011-05-04 14:49:28 -0700 | [diff] [blame] | 4211 | // TODO: This should be shared with Installer's knowledge of user directory |
Jeff Sharkey | b9f3674 | 2015-04-08 21:02:14 -0700 | [diff] [blame] | 4212 | final File base; |
| 4213 | if (TextUtils.isEmpty(volumeUuid)) { |
| 4214 | base = Environment.getDataDirectory(); |
| 4215 | } else { |
| 4216 | base = new File("/mnt/expand/" + volumeUuid); |
| 4217 | } |
| 4218 | return new File(base, "user/" + userId + "/" + packageName); |
Amith Yamasani | 742a671 | 2011-05-04 14:49:28 -0700 | [diff] [blame] | 4219 | } |
Nicolas Prevot | c79586e | 2014-05-06 12:47:57 +0100 | [diff] [blame] | 4220 | |
| 4221 | /** |
Nicolas Prevot | 8194899 | 2014-05-16 18:25:26 +0100 | [diff] [blame] | 4222 | * Adds a {@link CrossProfileIntentFilter}. After calling this method all intents sent from the |
| 4223 | * user with id sourceUserId can also be be resolved by activities in the user with id |
| 4224 | * targetUserId if they match the specified intent filter. |
Nicolas Prevot | 3f7777f | 2014-07-24 15:58:39 +0100 | [diff] [blame] | 4225 | * @param filter The {@link IntentFilter} the intent has to match |
| 4226 | * @param sourceUserId The source user id. |
| 4227 | * @param targetUserId The target user id. |
| 4228 | * @param flags The only possible value is {@link SKIP_CURRENT_PROFILE} |
Nicolas Prevot | c79586e | 2014-05-06 12:47:57 +0100 | [diff] [blame] | 4229 | * @hide |
| 4230 | */ |
Nicolas Prevot | 63798c5 | 2014-05-27 13:22:38 +0100 | [diff] [blame] | 4231 | public abstract void addCrossProfileIntentFilter(IntentFilter filter, int sourceUserId, |
| 4232 | int targetUserId, int flags); |
Nicolas Prevot | c79586e | 2014-05-06 12:47:57 +0100 | [diff] [blame] | 4233 | |
| 4234 | /** |
Nicolas Prevot | 63798c5 | 2014-05-27 13:22:38 +0100 | [diff] [blame] | 4235 | * Clearing {@link CrossProfileIntentFilter}s which have the specified user as their |
Nicolas Prevot | 3f7777f | 2014-07-24 15:58:39 +0100 | [diff] [blame] | 4236 | * source, and have been set by the app calling this method. |
| 4237 | * @param sourceUserId The source user id. |
Nicolas Prevot | c79586e | 2014-05-06 12:47:57 +0100 | [diff] [blame] | 4238 | * @hide |
| 4239 | */ |
Nicolas Prevot | 8194899 | 2014-05-16 18:25:26 +0100 | [diff] [blame] | 4240 | public abstract void clearCrossProfileIntentFilters(int sourceUserId); |
Alexandra Gherghina | 6e2ae25 | 2014-06-12 16:03:58 +0100 | [diff] [blame] | 4241 | |
| 4242 | /** |
Nicolas Prevot | 88cc346 | 2014-05-14 14:51:48 +0100 | [diff] [blame] | 4243 | * @hide |
| 4244 | */ |
Nicolas Prevot | 7f7b0c7 | 2014-06-23 15:59:38 +0100 | [diff] [blame] | 4245 | public abstract Drawable loadItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo); |
Jeff Sharkey | 6c833e0 | 2014-07-14 22:44:30 -0700 | [diff] [blame] | 4246 | |
Benjamin Franz | ec2d48b | 2014-10-01 15:38:43 +0100 | [diff] [blame] | 4247 | /** |
| 4248 | * @hide |
| 4249 | */ |
| 4250 | public abstract Drawable loadUnbadgedItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo); |
| 4251 | |
Jeff Sharkey | 6c833e0 | 2014-07-14 22:44:30 -0700 | [diff] [blame] | 4252 | /** {@hide} */ |
| 4253 | public abstract boolean isPackageAvailable(String packageName); |
Jeff Sharkey | 16c8e3f | 2014-07-24 17:08:17 -0700 | [diff] [blame] | 4254 | |
| 4255 | /** {@hide} */ |
Jeff Sharkey | a090743 | 2014-08-15 10:23:11 -0700 | [diff] [blame] | 4256 | public static String installStatusToString(int status, String msg) { |
| 4257 | final String str = installStatusToString(status); |
| 4258 | if (msg != null) { |
| 4259 | return str + ": " + msg; |
| 4260 | } else { |
| 4261 | return str; |
| 4262 | } |
| 4263 | } |
| 4264 | |
| 4265 | /** {@hide} */ |
Jeff Sharkey | 16c8e3f | 2014-07-24 17:08:17 -0700 | [diff] [blame] | 4266 | public static String installStatusToString(int status) { |
| 4267 | switch (status) { |
| 4268 | case INSTALL_SUCCEEDED: return "INSTALL_SUCCEEDED"; |
| 4269 | case INSTALL_FAILED_ALREADY_EXISTS: return "INSTALL_FAILED_ALREADY_EXISTS"; |
| 4270 | case INSTALL_FAILED_INVALID_APK: return "INSTALL_FAILED_INVALID_APK"; |
| 4271 | case INSTALL_FAILED_INVALID_URI: return "INSTALL_FAILED_INVALID_URI"; |
| 4272 | case INSTALL_FAILED_INSUFFICIENT_STORAGE: return "INSTALL_FAILED_INSUFFICIENT_STORAGE"; |
| 4273 | case INSTALL_FAILED_DUPLICATE_PACKAGE: return "INSTALL_FAILED_DUPLICATE_PACKAGE"; |
| 4274 | case INSTALL_FAILED_NO_SHARED_USER: return "INSTALL_FAILED_NO_SHARED_USER"; |
| 4275 | case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return "INSTALL_FAILED_UPDATE_INCOMPATIBLE"; |
| 4276 | case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return "INSTALL_FAILED_SHARED_USER_INCOMPATIBLE"; |
| 4277 | case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return "INSTALL_FAILED_MISSING_SHARED_LIBRARY"; |
| 4278 | case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return "INSTALL_FAILED_REPLACE_COULDNT_DELETE"; |
| 4279 | case INSTALL_FAILED_DEXOPT: return "INSTALL_FAILED_DEXOPT"; |
| 4280 | case INSTALL_FAILED_OLDER_SDK: return "INSTALL_FAILED_OLDER_SDK"; |
| 4281 | case INSTALL_FAILED_CONFLICTING_PROVIDER: return "INSTALL_FAILED_CONFLICTING_PROVIDER"; |
| 4282 | case INSTALL_FAILED_NEWER_SDK: return "INSTALL_FAILED_NEWER_SDK"; |
| 4283 | case INSTALL_FAILED_TEST_ONLY: return "INSTALL_FAILED_TEST_ONLY"; |
| 4284 | case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return "INSTALL_FAILED_CPU_ABI_INCOMPATIBLE"; |
| 4285 | case INSTALL_FAILED_MISSING_FEATURE: return "INSTALL_FAILED_MISSING_FEATURE"; |
| 4286 | case INSTALL_FAILED_CONTAINER_ERROR: return "INSTALL_FAILED_CONTAINER_ERROR"; |
| 4287 | case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return "INSTALL_FAILED_INVALID_INSTALL_LOCATION"; |
| 4288 | case INSTALL_FAILED_MEDIA_UNAVAILABLE: return "INSTALL_FAILED_MEDIA_UNAVAILABLE"; |
| 4289 | case INSTALL_FAILED_VERIFICATION_TIMEOUT: return "INSTALL_FAILED_VERIFICATION_TIMEOUT"; |
| 4290 | case INSTALL_FAILED_VERIFICATION_FAILURE: return "INSTALL_FAILED_VERIFICATION_FAILURE"; |
| 4291 | case INSTALL_FAILED_PACKAGE_CHANGED: return "INSTALL_FAILED_PACKAGE_CHANGED"; |
| 4292 | case INSTALL_FAILED_UID_CHANGED: return "INSTALL_FAILED_UID_CHANGED"; |
| 4293 | case INSTALL_FAILED_VERSION_DOWNGRADE: return "INSTALL_FAILED_VERSION_DOWNGRADE"; |
| 4294 | case INSTALL_PARSE_FAILED_NOT_APK: return "INSTALL_PARSE_FAILED_NOT_APK"; |
| 4295 | case INSTALL_PARSE_FAILED_BAD_MANIFEST: return "INSTALL_PARSE_FAILED_BAD_MANIFEST"; |
| 4296 | case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return "INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION"; |
| 4297 | case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return "INSTALL_PARSE_FAILED_NO_CERTIFICATES"; |
| 4298 | case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return "INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES"; |
| 4299 | case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return "INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING"; |
| 4300 | case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return "INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME"; |
| 4301 | case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return "INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID"; |
| 4302 | case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return "INSTALL_PARSE_FAILED_MANIFEST_MALFORMED"; |
| 4303 | case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return "INSTALL_PARSE_FAILED_MANIFEST_EMPTY"; |
| 4304 | case INSTALL_FAILED_INTERNAL_ERROR: return "INSTALL_FAILED_INTERNAL_ERROR"; |
| 4305 | case INSTALL_FAILED_USER_RESTRICTED: return "INSTALL_FAILED_USER_RESTRICTED"; |
| 4306 | case INSTALL_FAILED_DUPLICATE_PERMISSION: return "INSTALL_FAILED_DUPLICATE_PERMISSION"; |
| 4307 | case INSTALL_FAILED_NO_MATCHING_ABIS: return "INSTALL_FAILED_NO_MATCHING_ABIS"; |
Jeff Sharkey | f060095 | 2014-08-07 17:31:53 -0700 | [diff] [blame] | 4308 | case INSTALL_FAILED_ABORTED: return "INSTALL_FAILED_ABORTED"; |
Jeff Sharkey | 16c8e3f | 2014-07-24 17:08:17 -0700 | [diff] [blame] | 4309 | default: return Integer.toString(status); |
| 4310 | } |
| 4311 | } |
| 4312 | |
| 4313 | /** {@hide} */ |
Jeff Sharkey | a090743 | 2014-08-15 10:23:11 -0700 | [diff] [blame] | 4314 | public static int installStatusToPublicStatus(int status) { |
Jeff Sharkey | 16c8e3f | 2014-07-24 17:08:17 -0700 | [diff] [blame] | 4315 | switch (status) { |
Jeff Sharkey | a090743 | 2014-08-15 10:23:11 -0700 | [diff] [blame] | 4316 | case INSTALL_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS; |
| 4317 | case INSTALL_FAILED_ALREADY_EXISTS: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 4318 | case INSTALL_FAILED_INVALID_APK: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 4319 | case INSTALL_FAILED_INVALID_URI: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 4320 | case INSTALL_FAILED_INSUFFICIENT_STORAGE: return PackageInstaller.STATUS_FAILURE_STORAGE; |
| 4321 | case INSTALL_FAILED_DUPLICATE_PACKAGE: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 4322 | case INSTALL_FAILED_NO_SHARED_USER: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 4323 | case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 4324 | case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 4325 | case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; |
| 4326 | case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 4327 | case INSTALL_FAILED_DEXOPT: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 4328 | case INSTALL_FAILED_OLDER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; |
| 4329 | case INSTALL_FAILED_CONFLICTING_PROVIDER: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 4330 | case INSTALL_FAILED_NEWER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; |
| 4331 | case INSTALL_FAILED_TEST_ONLY: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 4332 | case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; |
| 4333 | case INSTALL_FAILED_MISSING_FEATURE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; |
| 4334 | case INSTALL_FAILED_CONTAINER_ERROR: return PackageInstaller.STATUS_FAILURE_STORAGE; |
| 4335 | case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return PackageInstaller.STATUS_FAILURE_STORAGE; |
| 4336 | case INSTALL_FAILED_MEDIA_UNAVAILABLE: return PackageInstaller.STATUS_FAILURE_STORAGE; |
| 4337 | case INSTALL_FAILED_VERIFICATION_TIMEOUT: return PackageInstaller.STATUS_FAILURE_ABORTED; |
| 4338 | case INSTALL_FAILED_VERIFICATION_FAILURE: return PackageInstaller.STATUS_FAILURE_ABORTED; |
| 4339 | case INSTALL_FAILED_PACKAGE_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 4340 | case INSTALL_FAILED_UID_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 4341 | case INSTALL_FAILED_VERSION_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 4342 | case INSTALL_PARSE_FAILED_NOT_APK: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 4343 | case INSTALL_PARSE_FAILED_BAD_MANIFEST: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 4344 | case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 4345 | case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 4346 | case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 4347 | case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 4348 | case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 4349 | case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 4350 | case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 4351 | case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 4352 | case INSTALL_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE; |
| 4353 | case INSTALL_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; |
| 4354 | case INSTALL_FAILED_DUPLICATE_PERMISSION: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 4355 | case INSTALL_FAILED_NO_MATCHING_ABIS: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; |
| 4356 | case INSTALL_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED; |
| 4357 | default: return PackageInstaller.STATUS_FAILURE; |
| 4358 | } |
| 4359 | } |
| 4360 | |
| 4361 | /** {@hide} */ |
| 4362 | public static String deleteStatusToString(int status, String msg) { |
| 4363 | final String str = deleteStatusToString(status); |
| 4364 | if (msg != null) { |
| 4365 | return str + ": " + msg; |
| 4366 | } else { |
| 4367 | return str; |
Jeff Sharkey | 16c8e3f | 2014-07-24 17:08:17 -0700 | [diff] [blame] | 4368 | } |
| 4369 | } |
| 4370 | |
| 4371 | /** {@hide} */ |
| 4372 | public static String deleteStatusToString(int status) { |
| 4373 | switch (status) { |
| 4374 | case DELETE_SUCCEEDED: return "DELETE_SUCCEEDED"; |
| 4375 | case DELETE_FAILED_INTERNAL_ERROR: return "DELETE_FAILED_INTERNAL_ERROR"; |
| 4376 | case DELETE_FAILED_DEVICE_POLICY_MANAGER: return "DELETE_FAILED_DEVICE_POLICY_MANAGER"; |
| 4377 | case DELETE_FAILED_USER_RESTRICTED: return "DELETE_FAILED_USER_RESTRICTED"; |
| 4378 | case DELETE_FAILED_OWNER_BLOCKED: return "DELETE_FAILED_OWNER_BLOCKED"; |
Jeff Sharkey | f060095 | 2014-08-07 17:31:53 -0700 | [diff] [blame] | 4379 | case DELETE_FAILED_ABORTED: return "DELETE_FAILED_ABORTED"; |
Jeff Sharkey | 16c8e3f | 2014-07-24 17:08:17 -0700 | [diff] [blame] | 4380 | default: return Integer.toString(status); |
| 4381 | } |
| 4382 | } |
Jeff Sharkey | f060095 | 2014-08-07 17:31:53 -0700 | [diff] [blame] | 4383 | |
| 4384 | /** {@hide} */ |
Jeff Sharkey | a090743 | 2014-08-15 10:23:11 -0700 | [diff] [blame] | 4385 | public static int deleteStatusToPublicStatus(int status) { |
Jeff Sharkey | f060095 | 2014-08-07 17:31:53 -0700 | [diff] [blame] | 4386 | switch (status) { |
Jeff Sharkey | a090743 | 2014-08-15 10:23:11 -0700 | [diff] [blame] | 4387 | case DELETE_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS; |
| 4388 | case DELETE_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE; |
| 4389 | case DELETE_FAILED_DEVICE_POLICY_MANAGER: return PackageInstaller.STATUS_FAILURE_BLOCKED; |
| 4390 | case DELETE_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_BLOCKED; |
| 4391 | case DELETE_FAILED_OWNER_BLOCKED: return PackageInstaller.STATUS_FAILURE_BLOCKED; |
| 4392 | case DELETE_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED; |
| 4393 | default: return PackageInstaller.STATUS_FAILURE; |
Jeff Sharkey | f060095 | 2014-08-07 17:31:53 -0700 | [diff] [blame] | 4394 | } |
| 4395 | } |
Jeff Sharkey | 6c0b9da | 2014-08-07 22:07:11 -0700 | [diff] [blame] | 4396 | |
| 4397 | /** {@hide} */ |
| 4398 | public static class LegacyPackageInstallObserver extends PackageInstallObserver { |
| 4399 | private final IPackageInstallObserver mLegacy; |
| 4400 | |
| 4401 | public LegacyPackageInstallObserver(IPackageInstallObserver legacy) { |
| 4402 | mLegacy = legacy; |
| 4403 | } |
| 4404 | |
| 4405 | @Override |
| 4406 | public void onPackageInstalled(String basePackageName, int returnCode, String msg, |
| 4407 | Bundle extras) { |
| 4408 | if (mLegacy == null) return; |
| 4409 | try { |
| 4410 | mLegacy.packageInstalled(basePackageName, returnCode); |
| 4411 | } catch (RemoteException ignored) { |
| 4412 | } |
| 4413 | } |
| 4414 | } |
| 4415 | |
| 4416 | /** {@hide} */ |
| 4417 | public static class LegacyPackageDeleteObserver extends PackageDeleteObserver { |
| 4418 | private final IPackageDeleteObserver mLegacy; |
| 4419 | |
| 4420 | public LegacyPackageDeleteObserver(IPackageDeleteObserver legacy) { |
| 4421 | mLegacy = legacy; |
| 4422 | } |
| 4423 | |
| 4424 | @Override |
| 4425 | public void onPackageDeleted(String basePackageName, int returnCode, String msg) { |
| 4426 | if (mLegacy == null) return; |
| 4427 | try { |
| 4428 | mLegacy.packageDeleted(basePackageName, returnCode); |
| 4429 | } catch (RemoteException ignored) { |
| 4430 | } |
| 4431 | } |
| 4432 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4433 | } |