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 | |
Svetoslav | f7c06eb | 2015-06-10 18:43:22 -0700 | [diff] [blame] | 19 | import android.Manifest; |
Tor Norbye | 1c2bf03 | 2015-03-02 10:57:08 -0800 | [diff] [blame] | 20 | import android.annotation.CheckResult; |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 21 | import android.annotation.DrawableRes; |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 22 | import android.annotation.IntDef; |
Todd Kennedy | 9106c64 | 2017-02-08 14:16:53 -0800 | [diff] [blame] | 23 | import android.annotation.IntRange; |
Jeff Sharkey | 16c8e3f | 2014-07-24 17:08:17 -0700 | [diff] [blame] | 24 | import android.annotation.NonNull; |
Jeff Sharkey | e2d45be | 2015-04-15 17:14:12 -0700 | [diff] [blame] | 25 | import android.annotation.Nullable; |
Svetoslav | f7c06eb | 2015-06-10 18:43:22 -0700 | [diff] [blame] | 26 | import android.annotation.RequiresPermission; |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 27 | import android.annotation.SdkConstant; |
| 28 | import android.annotation.SdkConstant.SdkConstantType; |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 29 | import android.annotation.StringRes; |
Jeff Sharkey | bb58067 | 2014-07-10 12:10:25 -0700 | [diff] [blame] | 30 | import android.annotation.SystemApi; |
Jeff Sharkey | a73b8fd | 2016-01-06 17:02:08 -0700 | [diff] [blame] | 31 | import android.annotation.TestApi; |
Jeff Sharkey | bd94022 | 2016-01-08 11:07:13 -0700 | [diff] [blame] | 32 | import android.annotation.UserIdInt; |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 33 | import android.annotation.XmlRes; |
Dianne Hackborn | 2a103f1 | 2017-08-08 15:50:31 -0700 | [diff] [blame] | 34 | import android.app.ActivityManager; |
Jeff Sharkey | 6c0b9da | 2014-08-07 22:07:11 -0700 | [diff] [blame] | 35 | import android.app.PackageDeleteObserver; |
Christopher Tate | f1977b4 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 36 | import android.app.PackageInstallObserver; |
Amith Yamasani | 1d65327 | 2014-09-11 17:56:05 -0700 | [diff] [blame] | 37 | import android.app.admin.DevicePolicyManager; |
Jeff Sharkey | 60f95aa | 2017-03-08 13:57:15 -0700 | [diff] [blame] | 38 | import android.app.usage.StorageStatsManager; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 39 | import android.content.ComponentName; |
| 40 | import android.content.Context; |
| 41 | import android.content.Intent; |
| 42 | import android.content.IntentFilter; |
Suchi Amalapurapu | 1ccac75 | 2009-06-12 10:09:58 -0700 | [diff] [blame] | 43 | import android.content.IntentSender; |
Jeff Sharkey | c4858a2 | 2014-06-16 10:51:20 -0700 | [diff] [blame] | 44 | import android.content.pm.PackageParser.PackageParserException; |
Calin Juravle | 45f8b29 | 2017-11-07 18:49:43 -0800 | [diff] [blame] | 45 | import android.content.pm.dex.ArtManager; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 46 | import android.content.res.Resources; |
| 47 | import android.content.res.XmlResourceParser; |
Svetoslav | c7d62f0 | 2014-09-04 15:39:54 -0700 | [diff] [blame] | 48 | import android.graphics.Rect; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 49 | import android.graphics.drawable.Drawable; |
Peter Qiu | 3d615e4 | 2017-08-07 20:13:32 +0000 | [diff] [blame] | 50 | import android.net.wifi.WifiManager; |
Jeff Sharkey | 6f4b2a3 | 2017-03-21 14:13:41 -0600 | [diff] [blame] | 51 | import android.os.Build; |
Jeff Sharkey | bb58067 | 2014-07-10 12:10:25 -0700 | [diff] [blame] | 52 | import android.os.Bundle; |
Jeff Sharkey | 620b32b | 2015-04-23 19:36:02 -0700 | [diff] [blame] | 53 | import android.os.Handler; |
Jeff Sharkey | 6c0b9da | 2014-08-07 22:07:11 -0700 | [diff] [blame] | 54 | import android.os.RemoteException; |
Dianne Hackborn | 0c38049 | 2012-08-20 17:23:30 -0700 | [diff] [blame] | 55 | import android.os.UserHandle; |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 56 | import android.os.UserManager; |
Jeff Sharkey | 683bcd3 | 2017-03-18 17:54:51 -0600 | [diff] [blame] | 57 | import android.os.storage.StorageManager; |
Jeff Sharkey | b2b9ab8 | 2015-04-05 21:10:42 -0700 | [diff] [blame] | 58 | import android.os.storage.VolumeInfo; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 59 | import android.util.AndroidException; |
Jeff Sharkey | bd94022 | 2016-01-08 11:07:13 -0700 | [diff] [blame] | 60 | import android.util.Log; |
Jeff Sharkey | b2b9ab8 | 2015-04-05 21:10:42 -0700 | [diff] [blame] | 61 | |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 62 | import com.android.internal.util.ArrayUtils; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 63 | |
Jeff Sharkey | 6f4b2a3 | 2017-03-21 14:13:41 -0600 | [diff] [blame] | 64 | import dalvik.system.VMRuntime; |
| 65 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 66 | import java.io.File; |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 67 | import java.lang.annotation.Retention; |
| 68 | import java.lang.annotation.RetentionPolicy; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 69 | import java.util.List; |
| 70 | |
| 71 | /** |
| 72 | * Class for retrieving various kinds of information related to the application |
| 73 | * packages that are currently installed on the device. |
| 74 | * |
| 75 | * You can find this class through {@link Context#getPackageManager}. |
| 76 | */ |
| 77 | public abstract class PackageManager { |
Jeff Sharkey | bd94022 | 2016-01-08 11:07:13 -0700 | [diff] [blame] | 78 | private static final String TAG = "PackageManager"; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 79 | |
Jeff Sharkey | e469713 | 2016-02-06 19:46:15 -0700 | [diff] [blame] | 80 | /** {@hide} */ |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 81 | public static final boolean APPLY_DEFAULT_TO_DEVICE_PROTECTED_STORAGE = true; |
Jeff Sharkey | e469713 | 2016-02-06 19:46:15 -0700 | [diff] [blame] | 82 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 83 | /** |
| 84 | * This exception is thrown when a given package, application, or component |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 85 | * name cannot be found. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 86 | */ |
| 87 | public static class NameNotFoundException extends AndroidException { |
| 88 | public NameNotFoundException() { |
| 89 | } |
| 90 | |
| 91 | public NameNotFoundException(String name) { |
| 92 | super(name); |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | /** |
Svetoslav | f7c06eb | 2015-06-10 18:43:22 -0700 | [diff] [blame] | 97 | * Listener for changes in permissions granted to a UID. |
| 98 | * |
| 99 | * @hide |
| 100 | */ |
| 101 | @SystemApi |
| 102 | public interface OnPermissionsChangedListener { |
| 103 | |
| 104 | /** |
| 105 | * Called when the permissions for a UID change. |
| 106 | * @param uid The UID with a change. |
| 107 | */ |
| 108 | public void onPermissionsChanged(int uid); |
| 109 | } |
| 110 | |
| 111 | /** |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 112 | * As a guiding principle: |
| 113 | * <p> |
| 114 | * {@code GET_} flags are used to request additional data that may have been |
| 115 | * elided to save wire space. |
| 116 | * <p> |
| 117 | * {@code MATCH_} flags are used to include components or packages that |
| 118 | * would have otherwise been omitted from a result set by current system |
| 119 | * state. |
| 120 | */ |
| 121 | |
| 122 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 123 | @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = { |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 124 | GET_ACTIVITIES, |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 125 | GET_CONFIGURATIONS, |
| 126 | GET_GIDS, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 127 | GET_INSTRUMENTATION, |
| 128 | GET_INTENT_FILTERS, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 129 | GET_META_DATA, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 130 | GET_PERMISSIONS, |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 131 | GET_PROVIDERS, |
| 132 | GET_RECEIVERS, |
| 133 | GET_SERVICES, |
| 134 | GET_SHARED_LIBRARY_FILES, |
| 135 | GET_SIGNATURES, |
Daniel Cashman | 5cdda34 | 2018-01-19 07:22:52 -0800 | [diff] [blame] | 136 | GET_SIGNING_CERTIFICATES, |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 137 | GET_URI_PERMISSION_PATTERNS, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 138 | MATCH_UNINSTALLED_PACKAGES, |
| 139 | MATCH_DISABLED_COMPONENTS, |
| 140 | MATCH_DISABLED_UNTIL_USED_COMPONENTS, |
Jeff Sharkey | c5967e9 | 2016-01-07 18:50:29 -0700 | [diff] [blame] | 141 | MATCH_SYSTEM_ONLY, |
Todd Kennedy | d6ee0ba | 2016-03-31 15:11:11 -0700 | [diff] [blame] | 142 | MATCH_FACTORY_ONLY, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 143 | MATCH_DEBUG_TRIAGED_MISSING, |
Todd Kennedy | 9c9fdf2 | 2017-03-06 10:58:27 -0800 | [diff] [blame] | 144 | MATCH_INSTANT, |
Todd Kennedy | 1f397f4 | 2016-06-28 12:14:11 -0700 | [diff] [blame] | 145 | GET_DISABLED_COMPONENTS, |
| 146 | GET_DISABLED_UNTIL_USED_COMPONENTS, |
| 147 | GET_UNINSTALLED_PACKAGES, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 148 | }) |
| 149 | @Retention(RetentionPolicy.SOURCE) |
| 150 | public @interface PackageInfoFlags {} |
| 151 | |
| 152 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 153 | @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = { |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 154 | GET_META_DATA, |
| 155 | GET_SHARED_LIBRARY_FILES, |
| 156 | MATCH_UNINSTALLED_PACKAGES, |
| 157 | MATCH_SYSTEM_ONLY, |
| 158 | MATCH_DEBUG_TRIAGED_MISSING, |
Todd Kennedy | 2452202 | 2017-03-27 16:32:20 -0700 | [diff] [blame] | 159 | MATCH_DISABLED_COMPONENTS, |
Todd Kennedy | 5a32c6c | 2016-07-07 14:29:06 -0700 | [diff] [blame] | 160 | MATCH_DISABLED_UNTIL_USED_COMPONENTS, |
Todd Kennedy | 9c9fdf2 | 2017-03-06 10:58:27 -0800 | [diff] [blame] | 161 | MATCH_INSTANT, |
Svet Ganov | 9e77977 | 2017-05-11 14:36:50 -0700 | [diff] [blame] | 162 | MATCH_STATIC_SHARED_LIBRARIES, |
Todd Kennedy | 5a32c6c | 2016-07-07 14:29:06 -0700 | [diff] [blame] | 163 | GET_DISABLED_UNTIL_USED_COMPONENTS, |
Todd Kennedy | 1f397f4 | 2016-06-28 12:14:11 -0700 | [diff] [blame] | 164 | GET_UNINSTALLED_PACKAGES, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 165 | }) |
| 166 | @Retention(RetentionPolicy.SOURCE) |
| 167 | public @interface ApplicationInfoFlags {} |
| 168 | |
| 169 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 170 | @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = { |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 171 | GET_META_DATA, |
| 172 | GET_SHARED_LIBRARY_FILES, |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 173 | MATCH_ALL, |
| 174 | MATCH_DEBUG_TRIAGED_MISSING, |
| 175 | MATCH_DEFAULT_ONLY, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 176 | MATCH_DISABLED_COMPONENTS, |
| 177 | MATCH_DISABLED_UNTIL_USED_COMPONENTS, |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 178 | MATCH_DIRECT_BOOT_AWARE, |
| 179 | MATCH_DIRECT_BOOT_UNAWARE, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 180 | MATCH_SYSTEM_ONLY, |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 181 | MATCH_UNINSTALLED_PACKAGES, |
Todd Kennedy | 9c9fdf2 | 2017-03-06 10:58:27 -0800 | [diff] [blame] | 182 | MATCH_INSTANT, |
Svet Ganov | 9e77977 | 2017-05-11 14:36:50 -0700 | [diff] [blame] | 183 | MATCH_STATIC_SHARED_LIBRARIES, |
Todd Kennedy | 1f397f4 | 2016-06-28 12:14:11 -0700 | [diff] [blame] | 184 | GET_DISABLED_COMPONENTS, |
| 185 | GET_DISABLED_UNTIL_USED_COMPONENTS, |
| 186 | GET_UNINSTALLED_PACKAGES, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 187 | }) |
| 188 | @Retention(RetentionPolicy.SOURCE) |
| 189 | public @interface ComponentInfoFlags {} |
| 190 | |
| 191 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 192 | @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = { |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 193 | GET_META_DATA, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 194 | GET_RESOLVED_FILTER, |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 195 | GET_SHARED_LIBRARY_FILES, |
| 196 | MATCH_ALL, |
| 197 | MATCH_DEBUG_TRIAGED_MISSING, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 198 | MATCH_DISABLED_COMPONENTS, |
| 199 | MATCH_DISABLED_UNTIL_USED_COMPONENTS, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 200 | MATCH_DEFAULT_ONLY, |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 201 | MATCH_DIRECT_BOOT_AWARE, |
| 202 | MATCH_DIRECT_BOOT_UNAWARE, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 203 | MATCH_SYSTEM_ONLY, |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 204 | MATCH_UNINSTALLED_PACKAGES, |
Todd Kennedy | 9c9fdf2 | 2017-03-06 10:58:27 -0800 | [diff] [blame] | 205 | MATCH_INSTANT, |
Todd Kennedy | 1f397f4 | 2016-06-28 12:14:11 -0700 | [diff] [blame] | 206 | GET_DISABLED_COMPONENTS, |
| 207 | GET_DISABLED_UNTIL_USED_COMPONENTS, |
| 208 | GET_UNINSTALLED_PACKAGES, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 209 | }) |
| 210 | @Retention(RetentionPolicy.SOURCE) |
| 211 | public @interface ResolveInfoFlags {} |
| 212 | |
| 213 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 214 | @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = { |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 215 | GET_META_DATA, |
| 216 | }) |
| 217 | @Retention(RetentionPolicy.SOURCE) |
| 218 | public @interface PermissionInfoFlags {} |
| 219 | |
| 220 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 221 | @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = { |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 222 | GET_META_DATA, |
| 223 | }) |
| 224 | @Retention(RetentionPolicy.SOURCE) |
| 225 | public @interface PermissionGroupInfoFlags {} |
| 226 | |
| 227 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 228 | @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = { |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 229 | GET_META_DATA, |
| 230 | }) |
| 231 | @Retention(RetentionPolicy.SOURCE) |
| 232 | public @interface InstrumentationInfoFlags {} |
| 233 | |
| 234 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 235 | * {@link PackageInfo} flag: return information about |
| 236 | * activities in the package in {@link PackageInfo#activities}. |
| 237 | */ |
| 238 | public static final int GET_ACTIVITIES = 0x00000001; |
| 239 | |
| 240 | /** |
| 241 | * {@link PackageInfo} flag: return information about |
| 242 | * intent receivers in the package in |
| 243 | * {@link PackageInfo#receivers}. |
| 244 | */ |
| 245 | public static final int GET_RECEIVERS = 0x00000002; |
| 246 | |
| 247 | /** |
| 248 | * {@link PackageInfo} flag: return information about |
| 249 | * services in the package in {@link PackageInfo#services}. |
| 250 | */ |
| 251 | public static final int GET_SERVICES = 0x00000004; |
| 252 | |
| 253 | /** |
| 254 | * {@link PackageInfo} flag: return information about |
| 255 | * content providers in the package in |
| 256 | * {@link PackageInfo#providers}. |
| 257 | */ |
| 258 | public static final int GET_PROVIDERS = 0x00000008; |
| 259 | |
| 260 | /** |
| 261 | * {@link PackageInfo} flag: return information about |
| 262 | * instrumentation in the package in |
| 263 | * {@link PackageInfo#instrumentation}. |
| 264 | */ |
| 265 | public static final int GET_INSTRUMENTATION = 0x00000010; |
| 266 | |
| 267 | /** |
| 268 | * {@link PackageInfo} flag: return information about the |
| 269 | * intent filters supported by the activity. |
| 270 | */ |
| 271 | public static final int GET_INTENT_FILTERS = 0x00000020; |
| 272 | |
| 273 | /** |
| 274 | * {@link PackageInfo} flag: return information about the |
| 275 | * signatures included in the package. |
Daniel Cashman | 5cdda34 | 2018-01-19 07:22:52 -0800 | [diff] [blame] | 276 | * |
| 277 | * @deprecated use {@code GET_SIGNING_CERTIFICATES} instead |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 278 | */ |
Daniel Cashman | 5cdda34 | 2018-01-19 07:22:52 -0800 | [diff] [blame] | 279 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 280 | public static final int GET_SIGNATURES = 0x00000040; |
| 281 | |
| 282 | /** |
| 283 | * {@link ResolveInfo} flag: return the IntentFilter that |
| 284 | * was matched for a particular ResolveInfo in |
| 285 | * {@link ResolveInfo#filter}. |
| 286 | */ |
| 287 | public static final int GET_RESOLVED_FILTER = 0x00000040; |
| 288 | |
| 289 | /** |
| 290 | * {@link ComponentInfo} flag: return the {@link ComponentInfo#metaData} |
| 291 | * data {@link android.os.Bundle}s that are associated with a component. |
| 292 | * This applies for any API returning a ComponentInfo subclass. |
| 293 | */ |
| 294 | public static final int GET_META_DATA = 0x00000080; |
| 295 | |
| 296 | /** |
| 297 | * {@link PackageInfo} flag: return the |
| 298 | * {@link PackageInfo#gids group ids} that are associated with an |
| 299 | * application. |
Ken Wakasa | f76a50c | 2012-03-09 19:56:35 +0900 | [diff] [blame] | 300 | * 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] | 301 | * directly or nested inside of another. |
| 302 | */ |
| 303 | public static final int GET_GIDS = 0x00000100; |
| 304 | |
| 305 | /** |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 306 | * @deprecated replaced with {@link #MATCH_DISABLED_COMPONENTS} |
| 307 | */ |
| 308 | @Deprecated |
| 309 | public static final int GET_DISABLED_COMPONENTS = 0x00000200; |
| 310 | |
| 311 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 312 | * {@link PackageInfo} flag: include disabled components in the returned info. |
| 313 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 314 | public static final int MATCH_DISABLED_COMPONENTS = 0x00000200; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 315 | |
| 316 | /** |
| 317 | * {@link ApplicationInfo} flag: return the |
| 318 | * {@link ApplicationInfo#sharedLibraryFiles paths to the shared libraries} |
| 319 | * that are associated with an application. |
| 320 | * This applies for any API returning an ApplicationInfo class, either |
| 321 | * directly or nested inside of another. |
| 322 | */ |
| 323 | public static final int GET_SHARED_LIBRARY_FILES = 0x00000400; |
| 324 | |
| 325 | /** |
| 326 | * {@link ProviderInfo} flag: return the |
| 327 | * {@link ProviderInfo#uriPermissionPatterns URI permission patterns} |
| 328 | * that are associated with a content provider. |
Ken Wakasa | f76a50c | 2012-03-09 19:56:35 +0900 | [diff] [blame] | 329 | * 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] | 330 | * directly or nested inside of another. |
| 331 | */ |
| 332 | public static final int GET_URI_PERMISSION_PATTERNS = 0x00000800; |
| 333 | /** |
| 334 | * {@link PackageInfo} flag: return information about |
| 335 | * permissions in the package in |
| 336 | * {@link PackageInfo#permissions}. |
| 337 | */ |
| 338 | public static final int GET_PERMISSIONS = 0x00001000; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 339 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 340 | /** |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 341 | * @deprecated replaced with {@link #MATCH_UNINSTALLED_PACKAGES} |
| 342 | */ |
| 343 | @Deprecated |
| 344 | public static final int GET_UNINSTALLED_PACKAGES = 0x00002000; |
| 345 | |
| 346 | /** |
Kenny Root | 685f490 | 2011-11-03 10:13:29 -0700 | [diff] [blame] | 347 | * Flag parameter to retrieve some information about all applications (even |
| 348 | * uninstalled ones) which have data directories. This state could have |
| 349 | * resulted if applications have been deleted with flag |
| 350 | * {@code DONT_DELETE_DATA} with a possibility of being replaced or |
| 351 | * reinstalled in future. |
| 352 | * <p> |
| 353 | * Note: this flag may cause less information about currently installed |
| 354 | * applications to be returned. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 355 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 356 | public static final int MATCH_UNINSTALLED_PACKAGES = 0x00002000; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 357 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 358 | /** |
| 359 | * {@link PackageInfo} flag: return information about |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 360 | * hardware preferences in |
Adam Lesinski | d3edfde | 2014-08-08 17:32:44 -0700 | [diff] [blame] | 361 | * {@link PackageInfo#configPreferences PackageInfo.configPreferences}, |
| 362 | * and requested features in {@link PackageInfo#reqFeatures} and |
| 363 | * {@link PackageInfo#featureGroups}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 364 | */ |
| 365 | public static final int GET_CONFIGURATIONS = 0x00004000; |
| 366 | |
| 367 | /** |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 368 | * @deprecated replaced with {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}. |
| 369 | */ |
| 370 | @Deprecated |
| 371 | public static final int GET_DISABLED_UNTIL_USED_COMPONENTS = 0x00008000; |
| 372 | |
| 373 | /** |
Dianne Hackborn | fd7aded | 2013-01-22 17:10:23 -0800 | [diff] [blame] | 374 | * {@link PackageInfo} flag: include disabled components which are in |
| 375 | * that state only because of {@link #COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED} |
| 376 | * in the returned info. Note that if you set this flag, applications |
| 377 | * that are in this disabled state will be reported as enabled. |
| 378 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 379 | public static final int MATCH_DISABLED_UNTIL_USED_COMPONENTS = 0x00008000; |
Dianne Hackborn | fd7aded | 2013-01-22 17:10:23 -0800 | [diff] [blame] | 380 | |
| 381 | /** |
Dianne Hackborn | 1655be4 | 2009-05-08 14:29:01 -0700 | [diff] [blame] | 382 | * Resolution and querying flag: if set, only filters that support the |
| 383 | * {@link android.content.Intent#CATEGORY_DEFAULT} will be considered for |
| 384 | * matching. This is a synonym for including the CATEGORY_DEFAULT in your |
| 385 | * supplied Intent. |
| 386 | */ |
Fabrice Di Meglio | 9f7e39f | 2015-04-10 20:40:16 -0700 | [diff] [blame] | 387 | public static final int MATCH_DEFAULT_ONLY = 0x00010000; |
| 388 | |
| 389 | /** |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 390 | * Querying flag: if set and if the platform is doing any filtering of the |
| 391 | * results, then the filtering will not happen. This is a synonym for saying |
| 392 | * that all results should be returned. |
| 393 | * <p> |
| 394 | * <em>This flag should be used with extreme care.</em> |
Fabrice Di Meglio | 9f7e39f | 2015-04-10 20:40:16 -0700 | [diff] [blame] | 395 | */ |
| 396 | public static final int MATCH_ALL = 0x00020000; |
Dianne Hackborn | 1655be4 | 2009-05-08 14:29:01 -0700 | [diff] [blame] | 397 | |
Nicolas Prevot | 63798c5 | 2014-05-27 13:22:38 +0100 | [diff] [blame] | 398 | /** |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 399 | * Querying flag: match components which are direct boot <em>unaware</em> in |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 400 | * the returned info, regardless of the current user state. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 401 | * <p> |
| 402 | * When neither {@link #MATCH_DIRECT_BOOT_AWARE} nor |
| 403 | * {@link #MATCH_DIRECT_BOOT_UNAWARE} are specified, the default behavior is |
| 404 | * to match only runnable components based on the user state. For example, |
| 405 | * when a user is started but credentials have not been presented yet, the |
| 406 | * user is running "locked" and only {@link #MATCH_DIRECT_BOOT_AWARE} |
| 407 | * components are returned. Once the user credentials have been presented, |
| 408 | * the user is running "unlocked" and both {@link #MATCH_DIRECT_BOOT_AWARE} |
| 409 | * and {@link #MATCH_DIRECT_BOOT_UNAWARE} components are returned. |
| 410 | * |
| 411 | * @see UserManager#isUserUnlocked() |
Jeff Sharkey | e17ac15 | 2015-11-06 22:40:29 -0800 | [diff] [blame] | 412 | */ |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 413 | public static final int MATCH_DIRECT_BOOT_UNAWARE = 0x00040000; |
| 414 | |
| 415 | /** |
| 416 | * Querying flag: match components which are direct boot <em>aware</em> in |
| 417 | * the returned info, regardless of the current user state. |
| 418 | * <p> |
| 419 | * When neither {@link #MATCH_DIRECT_BOOT_AWARE} nor |
| 420 | * {@link #MATCH_DIRECT_BOOT_UNAWARE} are specified, the default behavior is |
| 421 | * to match only runnable components based on the user state. For example, |
| 422 | * when a user is started but credentials have not been presented yet, the |
| 423 | * user is running "locked" and only {@link #MATCH_DIRECT_BOOT_AWARE} |
| 424 | * components are returned. Once the user credentials have been presented, |
| 425 | * the user is running "unlocked" and both {@link #MATCH_DIRECT_BOOT_AWARE} |
| 426 | * and {@link #MATCH_DIRECT_BOOT_UNAWARE} components are returned. |
| 427 | * |
| 428 | * @see UserManager#isUserUnlocked() |
| 429 | */ |
| 430 | public static final int MATCH_DIRECT_BOOT_AWARE = 0x00080000; |
| 431 | |
Jeff Sharkey | 2a9e3f8 | 2015-12-18 10:57:58 -0700 | [diff] [blame] | 432 | /** |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 433 | * Querying flag: include only components from applications that are marked |
| 434 | * with {@link ApplicationInfo#FLAG_SYSTEM}. |
Jeff Sharkey | 5217cac | 2015-12-20 15:34:01 -0700 | [diff] [blame] | 435 | */ |
| 436 | public static final int MATCH_SYSTEM_ONLY = 0x00100000; |
| 437 | |
| 438 | /** |
Todd Kennedy | d6ee0ba | 2016-03-31 15:11:11 -0700 | [diff] [blame] | 439 | * Internal {@link PackageInfo} flag: include only components on the system image. |
| 440 | * This will not return information on any unbundled update to system components. |
| 441 | * @hide |
| 442 | */ |
Todd Kennedy | 4908496 | 2017-03-27 16:20:37 -0700 | [diff] [blame] | 443 | @SystemApi |
Fyodor Kupolov | e569804 | 2018-01-26 14:24:37 -0800 | [diff] [blame] | 444 | @TestApi |
Todd Kennedy | d6ee0ba | 2016-03-31 15:11:11 -0700 | [diff] [blame] | 445 | public static final int MATCH_FACTORY_ONLY = 0x00200000; |
| 446 | |
| 447 | /** |
Amith Yamasani | 0d1fd8d | 2016-10-12 14:21:51 -0700 | [diff] [blame] | 448 | * Allows querying of packages installed for any user, not just the specific one. This flag |
Amith Yamasani | 475f9a3 | 2016-12-08 09:46:15 -0800 | [diff] [blame] | 449 | * is only meant for use by apps that have INTERACT_ACROSS_USERS permission. |
Amith Yamasani | 0d1fd8d | 2016-10-12 14:21:51 -0700 | [diff] [blame] | 450 | * @hide |
| 451 | */ |
Amith Yamasani | 475f9a3 | 2016-12-08 09:46:15 -0800 | [diff] [blame] | 452 | @SystemApi |
Amith Yamasani | 0d1fd8d | 2016-10-12 14:21:51 -0700 | [diff] [blame] | 453 | public static final int MATCH_ANY_USER = 0x00400000; |
| 454 | |
| 455 | /** |
| 456 | * Combination of MATCH_ANY_USER and MATCH_UNINSTALLED_PACKAGES to mean any known |
| 457 | * package. |
| 458 | * @hide |
| 459 | */ |
| 460 | public static final int MATCH_KNOWN_PACKAGES = MATCH_UNINSTALLED_PACKAGES | MATCH_ANY_USER; |
| 461 | |
| 462 | /** |
Todd Kennedy | 7bc3a70 | 2016-12-08 14:54:48 -0800 | [diff] [blame] | 463 | * Internal {@link PackageInfo} flag: include components that are part of an |
Todd Kennedy | be0b889 | 2017-02-15 14:13:52 -0800 | [diff] [blame] | 464 | * instant app. By default, instant app components are not matched. |
Todd Kennedy | 7bc3a70 | 2016-12-08 14:54:48 -0800 | [diff] [blame] | 465 | * @hide |
| 466 | */ |
Todd Kennedy | 9c9fdf2 | 2017-03-06 10:58:27 -0800 | [diff] [blame] | 467 | @SystemApi |
Todd Kennedy | be0b889 | 2017-02-15 14:13:52 -0800 | [diff] [blame] | 468 | public static final int MATCH_INSTANT = 0x00800000; |
Todd Kennedy | 7bc3a70 | 2016-12-08 14:54:48 -0800 | [diff] [blame] | 469 | |
| 470 | /** |
| 471 | * Internal {@link PackageInfo} flag: include only components that are exposed to |
Todd Kennedy | c05f5d1 | 2017-04-25 11:11:40 -0700 | [diff] [blame] | 472 | * instant apps. Matched components may have been either explicitly or implicitly |
| 473 | * exposed. |
Todd Kennedy | 7bc3a70 | 2016-12-08 14:54:48 -0800 | [diff] [blame] | 474 | * @hide |
| 475 | */ |
Todd Kennedy | be0b889 | 2017-02-15 14:13:52 -0800 | [diff] [blame] | 476 | public static final int MATCH_VISIBLE_TO_INSTANT_APP_ONLY = 0x01000000; |
Todd Kennedy | 7bc3a70 | 2016-12-08 14:54:48 -0800 | [diff] [blame] | 477 | |
| 478 | /** |
Todd Kennedy | c05f5d1 | 2017-04-25 11:11:40 -0700 | [diff] [blame] | 479 | * Internal {@link PackageInfo} flag: include only components that have been |
| 480 | * explicitly exposed to instant apps. |
| 481 | * @hide |
| 482 | */ |
| 483 | public static final int MATCH_EXPLICITLY_VISIBLE_ONLY = 0x02000000; |
| 484 | |
| 485 | /** |
Svet Ganov | 9e77977 | 2017-05-11 14:36:50 -0700 | [diff] [blame] | 486 | * Internal {@link PackageInfo} flag: include static shared libraries. |
| 487 | * Apps that depend on static shared libs can always access the version |
| 488 | * of the lib they depend on. System/shell/root can access all shared |
| 489 | * libs regardless of dependency but need to explicitly ask for them |
| 490 | * via this flag. |
| 491 | * @hide |
| 492 | */ |
| 493 | public static final int MATCH_STATIC_SHARED_LIBRARIES = 0x04000000; |
| 494 | |
| 495 | /** |
Daniel Cashman | 5cdda34 | 2018-01-19 07:22:52 -0800 | [diff] [blame] | 496 | * {@link PackageInfo} flag: return the signing certificates associated with |
| 497 | * this package. Each entry is a signing certificate that the package |
| 498 | * has proven it is authorized to use, usually a past signing certificate from |
| 499 | * which it has rotated. |
| 500 | */ |
| 501 | public static final int GET_SIGNING_CERTIFICATES = 0x08000000; |
| 502 | |
| 503 | /** |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 504 | * Internal flag used to indicate that a system component has done their |
| 505 | * homework and verified that they correctly handle packages and components |
| 506 | * that come and go over time. In particular: |
| 507 | * <ul> |
| 508 | * <li>Apps installed on external storage, which will appear to be |
| 509 | * uninstalled while the the device is ejected. |
| 510 | * <li>Apps with encryption unaware components, which will appear to not |
| 511 | * exist while the device is locked. |
| 512 | * </ul> |
Jeff Sharkey | e17ac15 | 2015-11-06 22:40:29 -0800 | [diff] [blame] | 513 | * |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 514 | * @see #MATCH_UNINSTALLED_PACKAGES |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 515 | * @see #MATCH_DIRECT_BOOT_AWARE |
| 516 | * @see #MATCH_DIRECT_BOOT_UNAWARE |
Jeff Sharkey | e17ac15 | 2015-11-06 22:40:29 -0800 | [diff] [blame] | 517 | * @hide |
| 518 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 519 | public static final int MATCH_DEBUG_TRIAGED_MISSING = 0x10000000; |
Jeff Sharkey | e17ac15 | 2015-11-06 22:40:29 -0800 | [diff] [blame] | 520 | |
| 521 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 522 | * Flag for {@link #addCrossProfileIntentFilter}: if this flag is set: when |
| 523 | * resolving an intent that matches the {@code CrossProfileIntentFilter}, |
| 524 | * the current profile will be skipped. Only activities in the target user |
| 525 | * can respond to the intent. |
| 526 | * |
Nicolas Prevot | 63798c5 | 2014-05-27 13:22:38 +0100 | [diff] [blame] | 527 | * @hide |
| 528 | */ |
| 529 | public static final int SKIP_CURRENT_PROFILE = 0x00000002; |
| 530 | |
Tony Mak | 807e01c | 2015-12-01 20:19:03 +0000 | [diff] [blame] | 531 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 532 | * Flag for {@link #addCrossProfileIntentFilter}: if this flag is set: |
Tony Mak | 807e01c | 2015-12-01 20:19:03 +0000 | [diff] [blame] | 533 | * activities in the other profiles can respond to the intent only if no activity with |
| 534 | * non-negative priority in current profile can respond to the intent. |
| 535 | * @hide |
| 536 | */ |
| 537 | public static final int ONLY_IF_NO_MATCH_FOUND = 0x00000004; |
| 538 | |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 539 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 540 | @IntDef(prefix = { "PERMISSION_" }, value = { |
| 541 | PERMISSION_GRANTED, |
| 542 | PERMISSION_DENIED |
| 543 | }) |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 544 | @Retention(RetentionPolicy.SOURCE) |
| 545 | public @interface PermissionResult {} |
| 546 | |
Dianne Hackborn | 1655be4 | 2009-05-08 14:29:01 -0700 | [diff] [blame] | 547 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 548 | * Permission check result: this is returned by {@link #checkPermission} |
| 549 | * if the permission has been granted to the given package. |
| 550 | */ |
| 551 | public static final int PERMISSION_GRANTED = 0; |
| 552 | |
| 553 | /** |
| 554 | * Permission check result: this is returned by {@link #checkPermission} |
| 555 | * if the permission has not been granted to the given package. |
| 556 | */ |
| 557 | public static final int PERMISSION_DENIED = -1; |
| 558 | |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 559 | /** @hide */ |
| 560 | @IntDef(prefix = { "SIGNATURE_" }, value = { |
| 561 | SIGNATURE_MATCH, |
| 562 | SIGNATURE_NEITHER_SIGNED, |
| 563 | SIGNATURE_FIRST_NOT_SIGNED, |
| 564 | SIGNATURE_SECOND_NOT_SIGNED, |
| 565 | SIGNATURE_NO_MATCH, |
| 566 | SIGNATURE_UNKNOWN_PACKAGE, |
| 567 | }) |
| 568 | @Retention(RetentionPolicy.SOURCE) |
| 569 | public @interface SignatureResult {} |
| 570 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 571 | /** |
| 572 | * Signature check result: this is returned by {@link #checkSignatures} |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 573 | * if all signatures on the two packages match. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 574 | */ |
| 575 | public static final int SIGNATURE_MATCH = 0; |
| 576 | |
| 577 | /** |
| 578 | * Signature check result: this is returned by {@link #checkSignatures} |
| 579 | * if neither of the two packages is signed. |
| 580 | */ |
| 581 | public static final int SIGNATURE_NEITHER_SIGNED = 1; |
| 582 | |
| 583 | /** |
| 584 | * Signature check result: this is returned by {@link #checkSignatures} |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 585 | * 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] | 586 | */ |
| 587 | public static final int SIGNATURE_FIRST_NOT_SIGNED = -1; |
| 588 | |
| 589 | /** |
| 590 | * Signature check result: this is returned by {@link #checkSignatures} |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 591 | * 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] | 592 | */ |
| 593 | public static final int SIGNATURE_SECOND_NOT_SIGNED = -2; |
| 594 | |
| 595 | /** |
| 596 | * Signature check result: this is returned by {@link #checkSignatures} |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 597 | * if not all signatures on both packages match. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 598 | */ |
| 599 | public static final int SIGNATURE_NO_MATCH = -3; |
| 600 | |
| 601 | /** |
| 602 | * Signature check result: this is returned by {@link #checkSignatures} |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 603 | * if either of the packages are not valid. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 604 | */ |
| 605 | public static final int SIGNATURE_UNKNOWN_PACKAGE = -4; |
| 606 | |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 607 | /** @hide */ |
| 608 | @IntDef(prefix = { "COMPONENT_ENABLED_STATE_" }, value = { |
| 609 | COMPONENT_ENABLED_STATE_DEFAULT, |
| 610 | COMPONENT_ENABLED_STATE_ENABLED, |
| 611 | COMPONENT_ENABLED_STATE_DISABLED, |
| 612 | COMPONENT_ENABLED_STATE_DISABLED_USER, |
| 613 | COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED, |
| 614 | }) |
| 615 | @Retention(RetentionPolicy.SOURCE) |
| 616 | public @interface EnabledState {} |
| 617 | |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 618 | /** |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 619 | * Flag for {@link #setApplicationEnabledSetting(String, int, int)} and |
| 620 | * {@link #setComponentEnabledSetting(ComponentName, int, int)}: This |
| 621 | * component or application is in its default enabled state (as specified in |
| 622 | * its manifest). |
| 623 | * <p> |
| 624 | * Explicitly setting the component state to this value restores it's |
| 625 | * enabled state to whatever is set in the manifest. |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 626 | */ |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 627 | public static final int COMPONENT_ENABLED_STATE_DEFAULT = 0; |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 628 | |
| 629 | /** |
| 630 | * Flag for {@link #setApplicationEnabledSetting(String, int, int)} |
| 631 | * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This |
| 632 | * component or application has been explictily enabled, regardless of |
| 633 | * what it has specified in its manifest. |
| 634 | */ |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 635 | public static final int COMPONENT_ENABLED_STATE_ENABLED = 1; |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 636 | |
| 637 | /** |
| 638 | * Flag for {@link #setApplicationEnabledSetting(String, int, int)} |
| 639 | * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This |
| 640 | * component or application has been explicitly disabled, regardless of |
| 641 | * what it has specified in its manifest. |
| 642 | */ |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 643 | public static final int COMPONENT_ENABLED_STATE_DISABLED = 2; |
| 644 | |
| 645 | /** |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 646 | * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: The |
| 647 | * user has explicitly disabled the application, regardless of what it has |
| 648 | * specified in its manifest. Because this is due to the user's request, |
| 649 | * they may re-enable it if desired through the appropriate system UI. This |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 650 | * option currently <strong>cannot</strong> be used with |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 651 | * {@link #setComponentEnabledSetting(ComponentName, int, int)}. |
| 652 | */ |
| 653 | public static final int COMPONENT_ENABLED_STATE_DISABLED_USER = 3; |
| 654 | |
| 655 | /** |
Dianne Hackborn | fd7aded | 2013-01-22 17:10:23 -0800 | [diff] [blame] | 656 | * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: This |
| 657 | * application should be considered, until the point where the user actually |
| 658 | * wants to use it. This means that it will not normally show up to the user |
| 659 | * (such as in the launcher), but various parts of the user interface can |
| 660 | * use {@link #GET_DISABLED_UNTIL_USED_COMPONENTS} to still see it and allow |
| 661 | * the user to select it (as for example an IME, device admin, etc). Such code, |
| 662 | * once the user has selected the app, should at that point also make it enabled. |
| 663 | * This option currently <strong>can not</strong> be used with |
| 664 | * {@link #setComponentEnabledSetting(ComponentName, int, int)}. |
| 665 | */ |
| 666 | public static final int COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED = 4; |
| 667 | |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 668 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 669 | @IntDef(flag = true, prefix = { "INSTALL_" }, value = { |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 670 | INSTALL_FORWARD_LOCK, |
| 671 | INSTALL_REPLACE_EXISTING, |
| 672 | INSTALL_ALLOW_TEST, |
| 673 | INSTALL_EXTERNAL, |
| 674 | INSTALL_INTERNAL, |
| 675 | INSTALL_FROM_ADB, |
| 676 | INSTALL_ALL_USERS, |
| 677 | INSTALL_ALLOW_DOWNGRADE, |
| 678 | INSTALL_GRANT_RUNTIME_PERMISSIONS, |
| 679 | INSTALL_FORCE_VOLUME_UUID, |
| 680 | INSTALL_FORCE_PERMISSION_PROMPT, |
Todd Kennedy | be0b889 | 2017-02-15 14:13:52 -0800 | [diff] [blame] | 681 | INSTALL_INSTANT_APP, |
Todd Kennedy | 39bfee5 | 2016-02-24 10:28:21 -0800 | [diff] [blame] | 682 | INSTALL_DONT_KILL_APP, |
Jeff Sharkey | 683bcd3 | 2017-03-18 17:54:51 -0600 | [diff] [blame] | 683 | INSTALL_FORCE_SDK, |
| 684 | INSTALL_FULL_APP, |
| 685 | INSTALL_ALLOCATE_AGGRESSIVE, |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 686 | }) |
| 687 | @Retention(RetentionPolicy.SOURCE) |
| 688 | public @interface InstallFlags {} |
| 689 | |
Dianne Hackborn | fd7aded | 2013-01-22 17:10:23 -0800 | [diff] [blame] | 690 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 691 | * Flag parameter for {@link #installPackage} to indicate that this package |
| 692 | * should be installed as forward locked, i.e. only the app itself should |
| 693 | * have access to its code and non-resource assets. |
| 694 | * |
Jeff Sharkey | 8c61e39 | 2017-02-24 09:22:48 -0700 | [diff] [blame] | 695 | * @deprecated new installs into ASEC containers are no longer supported. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 696 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 697 | */ |
Jeff Sharkey | 8c61e39 | 2017-02-24 09:22:48 -0700 | [diff] [blame] | 698 | @Deprecated |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 699 | public static final int INSTALL_FORWARD_LOCK = 0x00000001; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 700 | |
| 701 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 702 | * Flag parameter for {@link #installPackage} to indicate that you want to |
| 703 | * replace an already installed package, if one exists. |
| 704 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 705 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 706 | */ |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 707 | public static final int INSTALL_REPLACE_EXISTING = 0x00000002; |
| 708 | |
| 709 | /** |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 710 | * Flag parameter for {@link #installPackage} to indicate that you want to |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 711 | * allow test packages (those that have set android:testOnly in their |
| 712 | * manifest) to be installed. |
| 713 | * @hide |
| 714 | */ |
| 715 | public static final int INSTALL_ALLOW_TEST = 0x00000004; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 716 | |
| 717 | /** |
Jeff Sharkey | b2b9ab8 | 2015-04-05 21:10:42 -0700 | [diff] [blame] | 718 | * Flag parameter for {@link #installPackage} to indicate that this package |
| 719 | * must be installed to an ASEC on a {@link VolumeInfo#TYPE_PUBLIC}. |
| 720 | * |
Jeff Sharkey | 8c61e39 | 2017-02-24 09:22:48 -0700 | [diff] [blame] | 721 | * @deprecated new installs into ASEC containers are no longer supported; |
| 722 | * use adoptable storage instead. |
Suchi Amalapurapu | af8e9f4 | 2010-01-12 10:17:28 -0800 | [diff] [blame] | 723 | * @hide |
| 724 | */ |
Jeff Sharkey | 8c61e39 | 2017-02-24 09:22:48 -0700 | [diff] [blame] | 725 | @Deprecated |
Suchi Amalapurapu | 5b993ce | 2010-02-12 09:43:29 -0800 | [diff] [blame] | 726 | public static final int INSTALL_EXTERNAL = 0x00000008; |
Oscar Montemayor | 539d3c4 | 2010-01-29 15:27:00 -0800 | [diff] [blame] | 727 | |
| 728 | /** |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 729 | * Flag parameter for {@link #installPackage} to indicate that this package |
Jeff Sharkey | b2b9ab8 | 2015-04-05 21:10:42 -0700 | [diff] [blame] | 730 | * must be installed to internal storage. |
| 731 | * |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 732 | * @hide |
| 733 | */ |
| 734 | public static final int INSTALL_INTERNAL = 0x00000010; |
| 735 | |
| 736 | /** |
| 737 | * Flag parameter for {@link #installPackage} to indicate that this install |
| 738 | * was initiated via ADB. |
| 739 | * |
| 740 | * @hide |
| 741 | */ |
| 742 | public static final int INSTALL_FROM_ADB = 0x00000020; |
Suchi Amalapurapu | 14b6abd | 2010-03-17 08:37:04 -0700 | [diff] [blame] | 743 | |
| 744 | /** |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 745 | * Flag parameter for {@link #installPackage} to indicate that this install |
| 746 | * should immediately be visible to all users. |
| 747 | * |
| 748 | * @hide |
| 749 | */ |
| 750 | public static final int INSTALL_ALL_USERS = 0x00000040; |
| 751 | |
| 752 | /** |
| 753 | * Flag parameter for {@link #installPackage} to indicate that it is okay |
| 754 | * to install an update to an app where the newly installed app has a lower |
Alex Klyubin | 921dd75 | 2016-02-24 13:21:41 -0800 | [diff] [blame] | 755 | * version code than the currently installed app. This is permitted only if |
| 756 | * the currently installed app is marked debuggable. |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 757 | * |
| 758 | * @hide |
| 759 | */ |
| 760 | public static final int INSTALL_ALLOW_DOWNGRADE = 0x00000080; |
| 761 | |
| 762 | /** |
Svet Ganov | 95c1ade | 2015-03-19 09:38:52 -0700 | [diff] [blame] | 763 | * Flag parameter for {@link #installPackage} to indicate that all runtime |
| 764 | * permissions should be granted to the package. If {@link #INSTALL_ALL_USERS} |
| 765 | * is set the runtime permissions will be granted to all users, otherwise |
| 766 | * only to the owner. |
| 767 | * |
| 768 | * @hide |
| 769 | */ |
| 770 | public static final int INSTALL_GRANT_RUNTIME_PERMISSIONS = 0x00000100; |
| 771 | |
Jeff Sharkey | ab23409 | 2015-06-09 21:42:22 -0700 | [diff] [blame] | 772 | /** {@hide} */ |
| 773 | public static final int INSTALL_FORCE_VOLUME_UUID = 0x00000200; |
| 774 | |
Svet Ganov | 95c1ade | 2015-03-19 09:38:52 -0700 | [diff] [blame] | 775 | /** |
Todd Kennedy | a1d12cf | 2015-09-29 15:43:00 -0700 | [diff] [blame] | 776 | * Flag parameter for {@link #installPackage} to indicate that we always want to force |
| 777 | * the prompt for permission approval. This overrides any special behaviour for internal |
| 778 | * components. |
| 779 | * |
| 780 | * @hide |
| 781 | */ |
| 782 | public static final int INSTALL_FORCE_PERMISSION_PROMPT = 0x00000400; |
| 783 | |
| 784 | /** |
Todd Kennedy | 27c24fb | 2015-09-17 16:49:25 -0700 | [diff] [blame] | 785 | * Flag parameter for {@link #installPackage} to indicate that this package is |
Todd Kennedy | 2699f06 | 2015-11-20 13:07:17 -0800 | [diff] [blame] | 786 | * to be installed as a lightweight "ephemeral" app. |
| 787 | * |
| 788 | * @hide |
| 789 | */ |
Todd Kennedy | be0b889 | 2017-02-15 14:13:52 -0800 | [diff] [blame] | 790 | public static final int INSTALL_INSTANT_APP = 0x00000800; |
| 791 | |
| 792 | /** |
Todd Kennedy | 39bfee5 | 2016-02-24 10:28:21 -0800 | [diff] [blame] | 793 | * Flag parameter for {@link #installPackage} to indicate that this package contains |
| 794 | * a feature split to an existing application and the existing application should not |
| 795 | * be killed during the installation process. |
| 796 | * |
| 797 | * @hide |
| 798 | */ |
| 799 | public static final int INSTALL_DONT_KILL_APP = 0x00001000; |
| 800 | |
| 801 | /** |
Todd Kennedy | b107271 | 2016-04-26 15:41:20 -0700 | [diff] [blame] | 802 | * Flag parameter for {@link #installPackage} to indicate that this package is an |
Patrick Baumann | ccb20b8 | 2018-01-08 13:22:46 -0800 | [diff] [blame] | 803 | * upgrade to a package that refers to the SDK via release letter or is targeting an SDK via |
| 804 | * release letter that the current build does not support. |
Todd Kennedy | b107271 | 2016-04-26 15:41:20 -0700 | [diff] [blame] | 805 | * |
| 806 | * @hide |
| 807 | */ |
| 808 | public static final int INSTALL_FORCE_SDK = 0x00002000; |
| 809 | |
| 810 | /** |
Jeff Sharkey | 683bcd3 | 2017-03-18 17:54:51 -0600 | [diff] [blame] | 811 | * Flag parameter for {@link #installPackage} to indicate that this package is |
| 812 | * to be installed as a heavy weight app. This is fundamentally the opposite of |
| 813 | * {@link #INSTALL_INSTANT_APP}. |
| 814 | * |
| 815 | * @hide |
| 816 | */ |
| 817 | public static final int INSTALL_FULL_APP = 0x00004000; |
| 818 | |
| 819 | /** |
| 820 | * Flag parameter for {@link #installPackage} to indicate that this package |
| 821 | * is critical to system health or security, meaning the system should use |
| 822 | * {@link StorageManager#FLAG_ALLOCATE_AGGRESSIVE} internally. |
| 823 | * |
| 824 | * @hide |
| 825 | */ |
| 826 | public static final int INSTALL_ALLOCATE_AGGRESSIVE = 0x00008000; |
| 827 | |
Todd Kennedy | 78a7250 | 2017-07-19 12:49:30 -0700 | [diff] [blame] | 828 | /** |
| 829 | * Flag parameter for {@link #installPackage} to indicate that this package |
| 830 | * is a virtual preload. |
| 831 | * |
| 832 | * @hide |
| 833 | */ |
| 834 | public static final int INSTALL_VIRTUAL_PRELOAD = 0x00010000; |
| 835 | |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 836 | /** @hide */ |
| 837 | @IntDef(flag = true, prefix = { "DONT_KILL_APP" }, value = { |
| 838 | DONT_KILL_APP |
| 839 | }) |
| 840 | @Retention(RetentionPolicy.SOURCE) |
| 841 | public @interface EnabledFlags {} |
| 842 | |
Jeff Sharkey | 683bcd3 | 2017-03-18 17:54:51 -0600 | [diff] [blame] | 843 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 844 | * Flag parameter for |
| 845 | * {@link #setComponentEnabledSetting(android.content.ComponentName, int, int)} to indicate |
| 846 | * that you don't want to kill the app containing the component. Be careful when you set this |
| 847 | * since changing component states can make the containing application's behavior unpredictable. |
| 848 | */ |
| 849 | public static final int DONT_KILL_APP = 0x00000001; |
| 850 | |
Bartosz Fabianowski | a34f53f | 2017-01-11 18:08:47 +0100 | [diff] [blame] | 851 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 852 | @IntDef(prefix = { "INSTALL_REASON_" }, value = { |
| 853 | INSTALL_REASON_UNKNOWN, |
| 854 | INSTALL_REASON_POLICY, |
| 855 | INSTALL_REASON_DEVICE_RESTORE, |
| 856 | INSTALL_REASON_DEVICE_SETUP, |
| 857 | INSTALL_REASON_USER |
| 858 | }) |
Bartosz Fabianowski | a34f53f | 2017-01-11 18:08:47 +0100 | [diff] [blame] | 859 | @Retention(RetentionPolicy.SOURCE) |
| 860 | public @interface InstallReason {} |
| 861 | |
| 862 | /** |
| 863 | * Code indicating that the reason for installing this package is unknown. |
| 864 | */ |
| 865 | public static final int INSTALL_REASON_UNKNOWN = 0; |
| 866 | |
| 867 | /** |
| 868 | * Code indicating that this package was installed due to enterprise policy. |
| 869 | */ |
| 870 | public static final int INSTALL_REASON_POLICY = 1; |
| 871 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 872 | /** |
Sunny Goyal | 80af6a2 | 2017-03-02 08:32:33 -0800 | [diff] [blame] | 873 | * Code indicating that this package was installed as part of restoring from another device. |
| 874 | */ |
| 875 | public static final int INSTALL_REASON_DEVICE_RESTORE = 2; |
| 876 | |
| 877 | /** |
| 878 | * Code indicating that this package was installed as part of device setup. |
| 879 | */ |
| 880 | public static final int INSTALL_REASON_DEVICE_SETUP = 3; |
| 881 | |
| 882 | /** |
| 883 | * Code indicating that the package installation was initiated by the user. |
| 884 | */ |
| 885 | public static final int INSTALL_REASON_USER = 4; |
| 886 | |
| 887 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 888 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 889 | * on success. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 890 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 891 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 892 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 893 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 894 | public static final int INSTALL_SUCCEEDED = 1; |
| 895 | |
| 896 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 897 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 898 | * if the package is already installed. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 899 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 900 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 901 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 902 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 903 | public static final int INSTALL_FAILED_ALREADY_EXISTS = -1; |
| 904 | |
| 905 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 906 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 907 | * if the package archive file is invalid. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 908 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 909 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 910 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 911 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 912 | public static final int INSTALL_FAILED_INVALID_APK = -2; |
| 913 | |
| 914 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 915 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 916 | * if the URI passed in is invalid. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 917 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 918 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 919 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 920 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 921 | public static final int INSTALL_FAILED_INVALID_URI = -3; |
| 922 | |
| 923 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 924 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 925 | * if the package manager service found that the device didn't have enough storage space to |
| 926 | * install the app. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 927 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 928 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 929 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 930 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 931 | public static final int INSTALL_FAILED_INSUFFICIENT_STORAGE = -4; |
| 932 | |
| 933 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 934 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 935 | * if a package is already installed with the same name. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 936 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 937 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 938 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 939 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 940 | public static final int INSTALL_FAILED_DUPLICATE_PACKAGE = -5; |
| 941 | |
| 942 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 943 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 944 | * if the requested shared user does not exist. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 945 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 946 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 947 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 948 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 949 | public static final int INSTALL_FAILED_NO_SHARED_USER = -6; |
| 950 | |
| 951 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 952 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 953 | * if a previously installed package of the same name has a different signature than the new |
| 954 | * package (and the old package's data was not removed). |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 955 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 956 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 957 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 958 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 959 | public static final int INSTALL_FAILED_UPDATE_INCOMPATIBLE = -7; |
| 960 | |
| 961 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 962 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 963 | * if the new package is requested a shared user which is already installed on the device and |
| 964 | * does not have matching signature. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 965 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 966 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 967 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 968 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 969 | public static final int INSTALL_FAILED_SHARED_USER_INCOMPATIBLE = -8; |
| 970 | |
| 971 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 972 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 973 | * if the new package uses a shared library that is not available. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 974 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 975 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 976 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 977 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 978 | public static final int INSTALL_FAILED_MISSING_SHARED_LIBRARY = -9; |
| 979 | |
| 980 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 981 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 982 | * if the new package uses a shared library that is not available. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 983 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 984 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 985 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 986 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 987 | public static final int INSTALL_FAILED_REPLACE_COULDNT_DELETE = -10; |
| 988 | |
| 989 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 990 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 991 | * if the new package failed while optimizing and validating its dex files, either because there |
| 992 | * was not enough storage or the validation failed. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 993 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 994 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 995 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 996 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 997 | public static final int INSTALL_FAILED_DEXOPT = -11; |
| 998 | |
| 999 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1000 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1001 | * if the new package failed because the current SDK version is older than that required by the |
| 1002 | * package. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1003 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1004 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1005 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1006 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1007 | public static final int INSTALL_FAILED_OLDER_SDK = -12; |
| 1008 | |
| 1009 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1010 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1011 | * if the new package failed because it contains a content provider with the same authority as a |
| 1012 | * provider already installed in the system. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1013 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1014 | * @hide |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 1015 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1016 | @SystemApi |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 1017 | public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13; |
| 1018 | |
| 1019 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1020 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1021 | * if the new package failed because the current SDK version is newer than that required by the |
| 1022 | * package. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1023 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1024 | * @hide |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 1025 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1026 | @SystemApi |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 1027 | public static final int INSTALL_FAILED_NEWER_SDK = -14; |
| 1028 | |
| 1029 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1030 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1031 | * if the new package failed because it has specified that it is a test-only package and the |
| 1032 | * caller has not supplied the {@link #INSTALL_ALLOW_TEST} flag. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1033 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1034 | * @hide |
| 1035 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1036 | @SystemApi |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1037 | public static final int INSTALL_FAILED_TEST_ONLY = -15; |
| 1038 | |
| 1039 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1040 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1041 | * if the package being installed contains native code, but none that is compatible with the |
| 1042 | * device's CPU_ABI. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1043 | * |
Dianne Hackborn | b181118 | 2009-05-21 15:45:42 -0700 | [diff] [blame] | 1044 | * @hide |
| 1045 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1046 | @SystemApi |
Dianne Hackborn | b181118 | 2009-05-21 15:45:42 -0700 | [diff] [blame] | 1047 | public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16; |
| 1048 | |
| 1049 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1050 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1051 | * if the new package uses a feature that is not available. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1052 | * |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 1053 | * @hide |
| 1054 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1055 | @SystemApi |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 1056 | public static final int INSTALL_FAILED_MISSING_FEATURE = -17; |
| 1057 | |
Suchi Amalapurapu | af8e9f4 | 2010-01-12 10:17:28 -0800 | [diff] [blame] | 1058 | // ------ Errors related to sdcard |
| 1059 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1060 | * Installation return code: this is passed in the |
| 1061 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if a secure container mount point couldn't be |
| 1062 | * accessed on external media. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1063 | * |
Suchi Amalapurapu | af8e9f4 | 2010-01-12 10:17:28 -0800 | [diff] [blame] | 1064 | * @hide |
| 1065 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1066 | @SystemApi |
Suchi Amalapurapu | af8e9f4 | 2010-01-12 10:17:28 -0800 | [diff] [blame] | 1067 | public static final int INSTALL_FAILED_CONTAINER_ERROR = -18; |
| 1068 | |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 1069 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1070 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1071 | * if the new package couldn't be installed in the specified install location. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1072 | * |
Suchi Amalapurapu | b56ae20 | 2010-02-04 22:51:07 -0800 | [diff] [blame] | 1073 | * @hide |
| 1074 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1075 | @SystemApi |
Suchi Amalapurapu | b56ae20 | 2010-02-04 22:51:07 -0800 | [diff] [blame] | 1076 | public static final int INSTALL_FAILED_INVALID_INSTALL_LOCATION = -19; |
| 1077 | |
| 1078 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1079 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1080 | * if the new package couldn't be installed in the specified install location because the media |
| 1081 | * is not available. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1082 | * |
Suchi Amalapurapu | 8a9ab24 | 2010-03-11 16:49:16 -0800 | [diff] [blame] | 1083 | * @hide |
| 1084 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1085 | @SystemApi |
Suchi Amalapurapu | 8a9ab24 | 2010-03-11 16:49:16 -0800 | [diff] [blame] | 1086 | public static final int INSTALL_FAILED_MEDIA_UNAVAILABLE = -20; |
| 1087 | |
| 1088 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1089 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1090 | * if the new package couldn't be installed because the verification timed out. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1091 | * |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 1092 | * @hide |
| 1093 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1094 | @SystemApi |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 1095 | public static final int INSTALL_FAILED_VERIFICATION_TIMEOUT = -21; |
| 1096 | |
| 1097 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1098 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1099 | * if the new package couldn't be installed because the verification did not succeed. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1100 | * |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 1101 | * @hide |
| 1102 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1103 | @SystemApi |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 1104 | public static final int INSTALL_FAILED_VERIFICATION_FAILURE = -22; |
| 1105 | |
| 1106 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1107 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1108 | * if the package changed from what the calling program expected. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1109 | * |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 1110 | * @hide |
| 1111 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1112 | @SystemApi |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 1113 | public static final int INSTALL_FAILED_PACKAGE_CHANGED = -23; |
| 1114 | |
| 1115 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1116 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1117 | * if the new package is assigned a different UID than it previously held. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1118 | * |
Dianne Hackborn | d0c5f51 | 2012-06-07 16:53:59 -0700 | [diff] [blame] | 1119 | * @hide |
| 1120 | */ |
| 1121 | public static final int INSTALL_FAILED_UID_CHANGED = -24; |
| 1122 | |
| 1123 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1124 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1125 | * if the new package has an older version code than the currently installed package. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1126 | * |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 1127 | * @hide |
| 1128 | */ |
| 1129 | public static final int INSTALL_FAILED_VERSION_DOWNGRADE = -25; |
| 1130 | |
| 1131 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1132 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1133 | * if the old package has target SDK high enough to support runtime permission and the new |
| 1134 | * package has target SDK low enough to not support runtime permissions. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1135 | * |
Svetoslav | d965370 | 2015-05-13 18:02:46 -0700 | [diff] [blame] | 1136 | * @hide |
| 1137 | */ |
| 1138 | @SystemApi |
| 1139 | public static final int INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE = -26; |
| 1140 | |
| 1141 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1142 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1143 | * if the new package attempts to downgrade the target sandbox version of the app. |
Chad Brubaker | 34573b2 | 2017-03-07 15:27:35 -0800 | [diff] [blame] | 1144 | * |
| 1145 | * @hide |
| 1146 | */ |
| 1147 | @SystemApi |
| 1148 | public static final int INSTALL_FAILED_SANDBOX_VERSION_DOWNGRADE = -27; |
| 1149 | |
| 1150 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1151 | * Installation parse return code: this is passed in the |
| 1152 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser was given a path that is not a |
| 1153 | * file, or does not end with the expected '.apk' extension. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1154 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1155 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1156 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1157 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1158 | public static final int INSTALL_PARSE_FAILED_NOT_APK = -100; |
| 1159 | |
| 1160 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1161 | * Installation parse return code: this is passed in the |
| 1162 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser was unable to retrieve the |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1163 | * AndroidManifest.xml file. |
| 1164 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1165 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1166 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1167 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1168 | public static final int INSTALL_PARSE_FAILED_BAD_MANIFEST = -101; |
| 1169 | |
| 1170 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1171 | * Installation parse return code: this is passed in the |
| 1172 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered an unexpected |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1173 | * exception. |
| 1174 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1175 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1176 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1177 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1178 | public static final int INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION = -102; |
| 1179 | |
| 1180 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1181 | * Installation parse return code: this is passed in the |
| 1182 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser did not find any certificates in |
| 1183 | * the .apk. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1184 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1185 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1186 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1187 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1188 | public static final int INSTALL_PARSE_FAILED_NO_CERTIFICATES = -103; |
| 1189 | |
| 1190 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1191 | * Installation parse return code: this is passed in the |
| 1192 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser found inconsistent certificates on |
| 1193 | * the files in the .apk. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1194 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1195 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1196 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1197 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1198 | public static final int INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES = -104; |
| 1199 | |
| 1200 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1201 | * Installation parse return code: this is passed in the |
| 1202 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered a |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1203 | * CertificateEncodingException in one of the files in the .apk. |
| 1204 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1205 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1206 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1207 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1208 | public static final int INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING = -105; |
| 1209 | |
| 1210 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1211 | * Installation parse return code: this is passed in the |
| 1212 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered a bad or missing |
| 1213 | * package name in the manifest. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1214 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1215 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1216 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1217 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1218 | public static final int INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME = -106; |
| 1219 | |
| 1220 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1221 | * Installation parse return code: tthis is passed in the |
| 1222 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered a bad shared user id |
| 1223 | * name in the manifest. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1224 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1225 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1226 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1227 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1228 | public static final int INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID = -107; |
| 1229 | |
| 1230 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1231 | * Installation parse return code: this is passed in the |
| 1232 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered some structural |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1233 | * problem in the manifest. |
| 1234 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1235 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1236 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1237 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1238 | public static final int INSTALL_PARSE_FAILED_MANIFEST_MALFORMED = -108; |
| 1239 | |
| 1240 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1241 | * Installation parse return code: this is passed in the |
| 1242 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser did not find any actionable tags |
| 1243 | * (instrumentation or application) in the manifest. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1244 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1245 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1246 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1247 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1248 | public static final int INSTALL_PARSE_FAILED_MANIFEST_EMPTY = -109; |
| 1249 | |
| 1250 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1251 | * Installation failed return code: this is passed in the |
| 1252 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package |
| 1253 | * because of system issues. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1254 | * |
Suchi Amalapurapu | 5b993ce | 2010-02-12 09:43:29 -0800 | [diff] [blame] | 1255 | * @hide |
| 1256 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1257 | @SystemApi |
Suchi Amalapurapu | 5b993ce | 2010-02-12 09:43:29 -0800 | [diff] [blame] | 1258 | public static final int INSTALL_FAILED_INTERNAL_ERROR = -110; |
| 1259 | |
| 1260 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1261 | * Installation failed return code: this is passed in the |
| 1262 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package |
| 1263 | * because the user is restricted from installing apps. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1264 | * |
Amith Yamasani | e4cf734 | 2012-12-17 11:12:09 -0800 | [diff] [blame] | 1265 | * @hide |
| 1266 | */ |
| 1267 | public static final int INSTALL_FAILED_USER_RESTRICTED = -111; |
| 1268 | |
| 1269 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1270 | * Installation failed return code: this is passed in the |
| 1271 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package |
| 1272 | * because it is attempting to define a permission that is already defined by some existing |
| 1273 | * package. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1274 | * <p> |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1275 | * The package name of the app which has already defined the permission is passed to a |
| 1276 | * {@link PackageInstallObserver}, if any, as the {@link #EXTRA_FAILURE_EXISTING_PACKAGE} string |
| 1277 | * extra; and the name of the permission being redefined is passed in the |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1278 | * {@link #EXTRA_FAILURE_EXISTING_PERMISSION} string extra. |
Christopher Tate | f1977b4 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 1279 | * |
Christopher Tate | f1977b4 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 1280 | * @hide |
| 1281 | */ |
| 1282 | public static final int INSTALL_FAILED_DUPLICATE_PERMISSION = -112; |
| 1283 | |
| 1284 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1285 | * Installation failed return code: this is passed in the |
| 1286 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package |
| 1287 | * because its packaged native code did not match any of the ABIs supported by the system. |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 1288 | * |
| 1289 | * @hide |
| 1290 | */ |
Narayan Kamath | d11f223 | 2014-04-10 10:37:17 +0100 | [diff] [blame] | 1291 | public static final int INSTALL_FAILED_NO_MATCHING_ABIS = -113; |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 1292 | |
| 1293 | /** |
| 1294 | * Internal return code for NativeLibraryHelper methods to indicate that the package |
| 1295 | * being processed did not contain any native code. This is placed here only so that |
| 1296 | * it can belong to the same value space as the other install failure codes. |
| 1297 | * |
| 1298 | * @hide |
| 1299 | */ |
Narayan Kamath | d11f223 | 2014-04-10 10:37:17 +0100 | [diff] [blame] | 1300 | public static final int NO_NATIVE_LIBRARIES = -114; |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 1301 | |
Jeff Sharkey | 7328a1b | 2014-08-07 14:01:43 -0700 | [diff] [blame] | 1302 | /** {@hide} */ |
Jeff Sharkey | f060095 | 2014-08-07 17:31:53 -0700 | [diff] [blame] | 1303 | public static final int INSTALL_FAILED_ABORTED = -115; |
Jeff Sharkey | 7328a1b | 2014-08-07 14:01:43 -0700 | [diff] [blame] | 1304 | |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 1305 | /** |
Todd Kennedy | be0b889 | 2017-02-15 14:13:52 -0800 | [diff] [blame] | 1306 | * Installation failed return code: instant app installs are incompatible with some |
Todd Kennedy | 2699f06 | 2015-11-20 13:07:17 -0800 | [diff] [blame] | 1307 | * other installation flags supplied for the operation; or other circumstances such |
Todd Kennedy | be0b889 | 2017-02-15 14:13:52 -0800 | [diff] [blame] | 1308 | * as trying to upgrade a system app via an instant app install. |
Todd Kennedy | 2699f06 | 2015-11-20 13:07:17 -0800 | [diff] [blame] | 1309 | * @hide |
| 1310 | */ |
Todd Kennedy | be0b889 | 2017-02-15 14:13:52 -0800 | [diff] [blame] | 1311 | public static final int INSTALL_FAILED_INSTANT_APP_INVALID = -116; |
Todd Kennedy | 2699f06 | 2015-11-20 13:07:17 -0800 | [diff] [blame] | 1312 | |
Calin Juravle | 3fc56c3 | 2017-12-11 18:26:13 -0800 | [diff] [blame] | 1313 | /** |
| 1314 | * Installation parse return code: this is passed in the |
| 1315 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the dex metadata file is invalid or |
| 1316 | * if there was no matching apk file for a dex metadata file. |
| 1317 | * |
| 1318 | * @hide |
| 1319 | */ |
| 1320 | public static final int INSTALL_FAILED_BAD_DEX_METADATA = -117; |
| 1321 | |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1322 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 1323 | @IntDef(flag = true, prefix = { "DELETE_" }, value = { |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1324 | DELETE_KEEP_DATA, |
| 1325 | DELETE_ALL_USERS, |
| 1326 | DELETE_SYSTEM_APP, |
Todd Kennedy | 39bfee5 | 2016-02-24 10:28:21 -0800 | [diff] [blame] | 1327 | DELETE_DONT_KILL_APP, |
Todd Kennedy | 232d29e | 2017-11-06 14:45:53 -0800 | [diff] [blame] | 1328 | DELETE_CHATTY, |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1329 | }) |
| 1330 | @Retention(RetentionPolicy.SOURCE) |
| 1331 | public @interface DeleteFlags {} |
| 1332 | |
Todd Kennedy | 2699f06 | 2015-11-20 13:07:17 -0800 | [diff] [blame] | 1333 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1334 | * Flag parameter for {@link #deletePackage} to indicate that you don't want to delete the |
| 1335 | * package's data directory. |
| 1336 | * |
| 1337 | * @hide |
| 1338 | */ |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 1339 | public static final int DELETE_KEEP_DATA = 0x00000001; |
| 1340 | |
| 1341 | /** |
| 1342 | * Flag parameter for {@link #deletePackage} to indicate that you want the |
| 1343 | * package deleted for all users. |
| 1344 | * |
| 1345 | * @hide |
| 1346 | */ |
| 1347 | public static final int DELETE_ALL_USERS = 0x00000002; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1348 | |
| 1349 | /** |
Dianne Hackborn | c895be7 | 2013-03-11 17:48:43 -0700 | [diff] [blame] | 1350 | * Flag parameter for {@link #deletePackage} to indicate that, if you are calling |
| 1351 | * uninstall on a system that has been updated, then don't do the normal process |
| 1352 | * of uninstalling the update and rolling back to the older system version (which |
| 1353 | * needs to happen for all users); instead, just mark the app as uninstalled for |
| 1354 | * the current user. |
| 1355 | * |
| 1356 | * @hide |
| 1357 | */ |
| 1358 | public static final int DELETE_SYSTEM_APP = 0x00000004; |
| 1359 | |
| 1360 | /** |
Todd Kennedy | 39bfee5 | 2016-02-24 10:28:21 -0800 | [diff] [blame] | 1361 | * Flag parameter for {@link #deletePackage} to indicate that, if you are calling |
| 1362 | * uninstall on a package that is replaced to provide new feature splits, the |
| 1363 | * existing application should not be killed during the removal process. |
| 1364 | * |
| 1365 | * @hide |
| 1366 | */ |
| 1367 | public static final int DELETE_DONT_KILL_APP = 0x00000008; |
| 1368 | |
| 1369 | /** |
Todd Kennedy | 232d29e | 2017-11-06 14:45:53 -0800 | [diff] [blame] | 1370 | * Flag parameter for {@link #deletePackage} to indicate that package deletion |
| 1371 | * should be chatty. |
| 1372 | * |
| 1373 | * @hide |
| 1374 | */ |
| 1375 | public static final int DELETE_CHATTY = 0x80000000; |
| 1376 | |
| 1377 | /** |
Kenny Root | c39bb4a | 2011-02-28 13:27:19 -0800 | [diff] [blame] | 1378 | * Return code for when package deletion succeeds. This is passed to the |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1379 | * {@link IPackageDeleteObserver} if the system succeeded in deleting the |
| 1380 | * package. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 1381 | * |
Kenny Root | c39bb4a | 2011-02-28 13:27:19 -0800 | [diff] [blame] | 1382 | * @hide |
| 1383 | */ |
| 1384 | public static final int DELETE_SUCCEEDED = 1; |
| 1385 | |
| 1386 | /** |
| 1387 | * Deletion failed return code: this is passed to the |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1388 | * {@link IPackageDeleteObserver} if the system failed to delete the package |
| 1389 | * for an unspecified reason. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 1390 | * |
Kenny Root | c39bb4a | 2011-02-28 13:27:19 -0800 | [diff] [blame] | 1391 | * @hide |
| 1392 | */ |
| 1393 | public static final int DELETE_FAILED_INTERNAL_ERROR = -1; |
| 1394 | |
| 1395 | /** |
| 1396 | * Deletion failed return code: this is passed to the |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1397 | * {@link IPackageDeleteObserver} if the system failed to delete the package |
| 1398 | * because it is the active DevicePolicy manager. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 1399 | * |
Kenny Root | c39bb4a | 2011-02-28 13:27:19 -0800 | [diff] [blame] | 1400 | * @hide |
| 1401 | */ |
| 1402 | public static final int DELETE_FAILED_DEVICE_POLICY_MANAGER = -2; |
| 1403 | |
| 1404 | /** |
Amith Yamasani | e4cf734 | 2012-12-17 11:12:09 -0800 | [diff] [blame] | 1405 | * Deletion failed return code: this is passed to the |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1406 | * {@link IPackageDeleteObserver} if the system failed to delete the package |
| 1407 | * since the user is restricted. |
Amith Yamasani | e4cf734 | 2012-12-17 11:12:09 -0800 | [diff] [blame] | 1408 | * |
| 1409 | * @hide |
| 1410 | */ |
| 1411 | public static final int DELETE_FAILED_USER_RESTRICTED = -3; |
| 1412 | |
| 1413 | /** |
Kenny Guy | 1b88da5 | 2014-07-10 16:33:49 +0100 | [diff] [blame] | 1414 | * Deletion failed return code: this is passed to the |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1415 | * {@link IPackageDeleteObserver} if the system failed to delete the package |
| 1416 | * because a profile or device owner has marked the package as |
| 1417 | * uninstallable. |
Kenny Guy | c13053b | 2014-05-29 14:17:17 +0100 | [diff] [blame] | 1418 | * |
| 1419 | * @hide |
| 1420 | */ |
Jeff Sharkey | f060095 | 2014-08-07 17:31:53 -0700 | [diff] [blame] | 1421 | public static final int DELETE_FAILED_OWNER_BLOCKED = -4; |
| 1422 | |
| 1423 | /** {@hide} */ |
| 1424 | public static final int DELETE_FAILED_ABORTED = -5; |
Kenny Guy | c13053b | 2014-05-29 14:17:17 +0100 | [diff] [blame] | 1425 | |
| 1426 | /** |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 1427 | * Deletion failed return code: this is passed to the |
| 1428 | * {@link IPackageDeleteObserver} if the system failed to delete the package |
| 1429 | * because the packge is a shared library used by other installed packages. |
| 1430 | * {@hide} */ |
| 1431 | public static final int DELETE_FAILED_USED_SHARED_LIBRARY = -6; |
| 1432 | |
| 1433 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1434 | * Return code that is passed to the {@link IPackageMoveObserver} when the |
Kenny Root | c39bb4a | 2011-02-28 13:27:19 -0800 | [diff] [blame] | 1435 | * package has been successfully moved by the system. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 1436 | * |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1437 | * @hide |
| 1438 | */ |
Jeff Sharkey | 620b32b | 2015-04-23 19:36:02 -0700 | [diff] [blame] | 1439 | public static final int MOVE_SUCCEEDED = -100; |
| 1440 | |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1441 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1442 | * Error code that is passed to the {@link IPackageMoveObserver} when the |
| 1443 | * package hasn't been successfully moved by the system because of |
| 1444 | * insufficient memory on specified media. |
| 1445 | * |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1446 | * @hide |
| 1447 | */ |
| 1448 | public static final int MOVE_FAILED_INSUFFICIENT_STORAGE = -1; |
| 1449 | |
| 1450 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1451 | * Error code that is passed to the {@link IPackageMoveObserver} if the |
| 1452 | * specified package doesn't exist. |
| 1453 | * |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1454 | * @hide |
| 1455 | */ |
| 1456 | public static final int MOVE_FAILED_DOESNT_EXIST = -2; |
| 1457 | |
| 1458 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1459 | * Error code that is passed to the {@link IPackageMoveObserver} if the |
| 1460 | * specified package cannot be moved since its a system package. |
| 1461 | * |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1462 | * @hide |
| 1463 | */ |
| 1464 | public static final int MOVE_FAILED_SYSTEM_PACKAGE = -3; |
| 1465 | |
| 1466 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1467 | * Error code that is passed to the {@link IPackageMoveObserver} if the |
| 1468 | * specified package cannot be moved since its forward locked. |
| 1469 | * |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1470 | * @hide |
| 1471 | */ |
| 1472 | public static final int MOVE_FAILED_FORWARD_LOCKED = -4; |
| 1473 | |
| 1474 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1475 | * Error code that is passed to the {@link IPackageMoveObserver} if the |
| 1476 | * specified package cannot be moved to the specified location. |
| 1477 | * |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1478 | * @hide |
| 1479 | */ |
| 1480 | public static final int MOVE_FAILED_INVALID_LOCATION = -5; |
| 1481 | |
| 1482 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1483 | * Error code that is passed to the {@link IPackageMoveObserver} if the |
| 1484 | * specified package cannot be moved to the specified location. |
| 1485 | * |
Suchi Amalapurapu | 8a9ab24 | 2010-03-11 16:49:16 -0800 | [diff] [blame] | 1486 | * @hide |
| 1487 | */ |
| 1488 | public static final int MOVE_FAILED_INTERNAL_ERROR = -6; |
| 1489 | |
| 1490 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1491 | * Error code that is passed to the {@link IPackageMoveObserver} if the |
| 1492 | * specified package already has an operation pending in the queue. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 1493 | * |
Kenny Root | deb1126 | 2010-08-02 11:36:21 -0700 | [diff] [blame] | 1494 | * @hide |
| 1495 | */ |
| 1496 | public static final int MOVE_FAILED_OPERATION_PENDING = -7; |
| 1497 | |
| 1498 | /** |
Makoto Onuki | f34db0a | 2016-02-17 11:17:15 -0800 | [diff] [blame] | 1499 | * Error code that is passed to the {@link IPackageMoveObserver} if the |
| 1500 | * specified package cannot be moved since it contains a device admin. |
| 1501 | * |
| 1502 | * @hide |
| 1503 | */ |
| 1504 | public static final int MOVE_FAILED_DEVICE_ADMIN = -8; |
| 1505 | |
| 1506 | /** |
Yao Chen | 022b8ea | 2016-12-16 11:03:28 -0800 | [diff] [blame] | 1507 | * Error code that is passed to the {@link IPackageMoveObserver} if system does not allow |
| 1508 | * non-system apps to be moved to internal storage. |
| 1509 | * |
| 1510 | * @hide |
| 1511 | */ |
| 1512 | public static final int MOVE_FAILED_3RD_PARTY_NOT_ALLOWED_ON_INTERNAL = -9; |
| 1513 | |
Jeff Sharkey | a65e649 | 2017-06-21 13:45:11 -0600 | [diff] [blame] | 1514 | /** @hide */ |
| 1515 | public static final int MOVE_FAILED_LOCKED_USER = -10; |
| 1516 | |
Yao Chen | 022b8ea | 2016-12-16 11:03:28 -0800 | [diff] [blame] | 1517 | /** |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1518 | * Flag parameter for {@link #movePackage} to indicate that |
| 1519 | * the package should be moved to internal storage if its |
| 1520 | * been installed on external media. |
| 1521 | * @hide |
| 1522 | */ |
Jeff Sharkey | 620b32b | 2015-04-23 19:36:02 -0700 | [diff] [blame] | 1523 | @Deprecated |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1524 | public static final int MOVE_INTERNAL = 0x00000001; |
| 1525 | |
| 1526 | /** |
| 1527 | * Flag parameter for {@link #movePackage} to indicate that |
| 1528 | * the package should be moved to external media. |
| 1529 | * @hide |
| 1530 | */ |
Jeff Sharkey | 620b32b | 2015-04-23 19:36:02 -0700 | [diff] [blame] | 1531 | @Deprecated |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1532 | public static final int MOVE_EXTERNAL_MEDIA = 0x00000002; |
| 1533 | |
Jeff Sharkey | 620b32b | 2015-04-23 19:36:02 -0700 | [diff] [blame] | 1534 | /** {@hide} */ |
| 1535 | public static final String EXTRA_MOVE_ID = "android.content.pm.extra.MOVE_ID"; |
| 1536 | |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1537 | /** |
Kenny Root | 05ca4c9 | 2011-09-15 10:36:25 -0700 | [diff] [blame] | 1538 | * Usable by the required verifier as the {@code verificationCode} argument |
| 1539 | * for {@link PackageManager#verifyPendingInstall} to indicate that it will |
| 1540 | * allow the installation to proceed without any of the optional verifiers |
| 1541 | * needing to vote. |
| 1542 | * |
| 1543 | * @hide |
| 1544 | */ |
| 1545 | public static final int VERIFICATION_ALLOW_WITHOUT_SUFFICIENT = 2; |
| 1546 | |
| 1547 | /** |
Kenny Root | 3a9b5fb | 2011-09-20 14:15:38 -0700 | [diff] [blame] | 1548 | * Used as the {@code verificationCode} argument for |
| 1549 | * {@link PackageManager#verifyPendingInstall} to indicate that the calling |
| 1550 | * package verifier allows the installation to proceed. |
| 1551 | */ |
| 1552 | public static final int VERIFICATION_ALLOW = 1; |
| 1553 | |
| 1554 | /** |
| 1555 | * Used as the {@code verificationCode} argument for |
| 1556 | * {@link PackageManager#verifyPendingInstall} to indicate the calling |
| 1557 | * package verifier does not vote to allow the installation to proceed. |
| 1558 | */ |
| 1559 | public static final int VERIFICATION_REJECT = -1; |
| 1560 | |
| 1561 | /** |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 1562 | * Used as the {@code verificationCode} argument for |
| 1563 | * {@link PackageManager#verifyIntentFilter} to indicate that the calling |
| 1564 | * IntentFilter Verifier confirms that the IntentFilter is verified. |
| 1565 | * |
| 1566 | * @hide |
| 1567 | */ |
Todd Kennedy | dfa93ab | 2016-03-03 15:24:33 -0800 | [diff] [blame] | 1568 | @SystemApi |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 1569 | public static final int INTENT_FILTER_VERIFICATION_SUCCESS = 1; |
| 1570 | |
| 1571 | /** |
| 1572 | * Used as the {@code verificationCode} argument for |
| 1573 | * {@link PackageManager#verifyIntentFilter} to indicate that the calling |
| 1574 | * IntentFilter Verifier confirms that the IntentFilter is NOT verified. |
| 1575 | * |
| 1576 | * @hide |
| 1577 | */ |
Todd Kennedy | dfa93ab | 2016-03-03 15:24:33 -0800 | [diff] [blame] | 1578 | @SystemApi |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 1579 | public static final int INTENT_FILTER_VERIFICATION_FAILURE = -1; |
| 1580 | |
| 1581 | /** |
| 1582 | * Internal status code to indicate that an IntentFilter verification result is not specified. |
| 1583 | * |
| 1584 | * @hide |
| 1585 | */ |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 1586 | @SystemApi |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 1587 | public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED = 0; |
| 1588 | |
| 1589 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1590 | * Used as the {@code status} argument for |
| 1591 | * {@link #updateIntentVerificationStatusAsUser} to indicate that the User |
| 1592 | * will always be prompted the Intent Disambiguation Dialog if there are two |
| 1593 | * or more Intent resolved for the IntentFilter's domain(s). |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 1594 | * |
| 1595 | * @hide |
| 1596 | */ |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 1597 | @SystemApi |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 1598 | public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK = 1; |
| 1599 | |
| 1600 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1601 | * Used as the {@code status} argument for |
| 1602 | * {@link #updateIntentVerificationStatusAsUser} to indicate that the User |
| 1603 | * will never be prompted the Intent Disambiguation Dialog if there are two |
| 1604 | * or more resolution of the Intent. The default App for the domain(s) |
| 1605 | * specified in the IntentFilter will also ALWAYS be used. |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 1606 | * |
| 1607 | * @hide |
| 1608 | */ |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 1609 | @SystemApi |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 1610 | public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS = 2; |
| 1611 | |
| 1612 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1613 | * Used as the {@code status} argument for |
| 1614 | * {@link #updateIntentVerificationStatusAsUser} to indicate that the User |
| 1615 | * may be prompted the Intent Disambiguation Dialog if there are two or more |
| 1616 | * Intent resolved. The default App for the domain(s) specified in the |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 1617 | * IntentFilter will also NEVER be presented to the User. |
| 1618 | * |
| 1619 | * @hide |
| 1620 | */ |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 1621 | @SystemApi |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 1622 | public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER = 3; |
| 1623 | |
| 1624 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1625 | * Used as the {@code status} argument for |
| 1626 | * {@link #updateIntentVerificationStatusAsUser} to indicate that this app |
| 1627 | * should always be considered as an ambiguous candidate for handling the |
| 1628 | * matching Intent even if there are other candidate apps in the "always" |
| 1629 | * state. Put another way: if there are any 'always ask' apps in a set of |
| 1630 | * more than one candidate app, then a disambiguation is *always* presented |
| 1631 | * even if there is another candidate app with the 'always' state. |
Christopher Tate | 56f0ff3 | 2015-08-13 16:29:33 -0700 | [diff] [blame] | 1632 | * |
| 1633 | * @hide |
| 1634 | */ |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 1635 | @SystemApi |
Christopher Tate | 56f0ff3 | 2015-08-13 16:29:33 -0700 | [diff] [blame] | 1636 | public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK = 4; |
| 1637 | |
| 1638 | /** |
rich cannings | d9ef3e5 | 2012-08-22 14:28:05 -0700 | [diff] [blame] | 1639 | * Can be used as the {@code millisecondsToDelay} argument for |
| 1640 | * {@link PackageManager#extendVerificationTimeout}. This is the |
| 1641 | * maximum time {@code PackageManager} waits for the verification |
| 1642 | * agent to return (in milliseconds). |
| 1643 | */ |
| 1644 | public static final long MAXIMUM_VERIFICATION_TIMEOUT = 60*60*1000; |
| 1645 | |
| 1646 | /** |
Amith Yamasani | 0b28549 | 2011-04-14 17:35:23 -0700 | [diff] [blame] | 1647 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device's |
| 1648 | * audio pipeline is low-latency, more suitable for audio applications sensitive to delays or |
| 1649 | * lag in sound input or output. |
Dan Morrill | 898e1e8 | 2010-09-26 17:28:30 -0700 | [diff] [blame] | 1650 | */ |
| 1651 | @SdkConstant(SdkConstantType.FEATURE) |
| 1652 | public static final String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency"; |
| 1653 | |
| 1654 | /** |
| 1655 | * Feature for {@link #getSystemAvailableFeatures} and |
Unsuk Jung | 50909f6 | 2014-09-02 18:25:49 -0700 | [diff] [blame] | 1656 | * {@link #hasSystemFeature}: The device includes at least one form of audio |
| 1657 | * output, such as speakers, audio jack or streaming over bluetooth |
| 1658 | */ |
| 1659 | @SdkConstant(SdkConstantType.FEATURE) |
| 1660 | public static final String FEATURE_AUDIO_OUTPUT = "android.hardware.audio.output"; |
| 1661 | |
| 1662 | /** |
Glenn Kasten | cdcb577 | 2015-05-06 15:54:49 -0700 | [diff] [blame] | 1663 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Glenn Kasten | 7587edc | 2015-10-30 17:45:52 -0700 | [diff] [blame] | 1664 | * The device has professional audio level of functionality and performance. |
Glenn Kasten | cdcb577 | 2015-05-06 15:54:49 -0700 | [diff] [blame] | 1665 | */ |
| 1666 | @SdkConstant(SdkConstantType.FEATURE) |
| 1667 | public static final String FEATURE_AUDIO_PRO = "android.hardware.audio.pro"; |
| 1668 | |
| 1669 | /** |
Unsuk Jung | 50909f6 | 2014-09-02 18:25:49 -0700 | [diff] [blame] | 1670 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1671 | * {@link #hasSystemFeature}: The device is capable of communicating with |
| 1672 | * other devices via Bluetooth. |
| 1673 | */ |
| 1674 | @SdkConstant(SdkConstantType.FEATURE) |
| 1675 | public static final String FEATURE_BLUETOOTH = "android.hardware.bluetooth"; |
| 1676 | |
| 1677 | /** |
| 1678 | * Feature for {@link #getSystemAvailableFeatures} and |
Matthew Xie | a722772 | 2013-04-18 15:25:59 -0700 | [diff] [blame] | 1679 | * {@link #hasSystemFeature}: The device is capable of communicating with |
| 1680 | * other devices via Bluetooth Low Energy radio. |
| 1681 | */ |
| 1682 | @SdkConstant(SdkConstantType.FEATURE) |
| 1683 | public static final String FEATURE_BLUETOOTH_LE = "android.hardware.bluetooth_le"; |
| 1684 | |
| 1685 | /** |
| 1686 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1687 | * {@link #hasSystemFeature}: The device has a camera facing away |
| 1688 | * from the screen. |
| 1689 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 1690 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1691 | public static final String FEATURE_CAMERA = "android.hardware.camera"; |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1692 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1693 | /** |
| 1694 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1695 | * {@link #hasSystemFeature}: The device's camera supports auto-focus. |
| 1696 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 1697 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1698 | public static final String FEATURE_CAMERA_AUTOFOCUS = "android.hardware.camera.autofocus"; |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1699 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1700 | /** |
| 1701 | * Feature for {@link #getSystemAvailableFeatures} and |
Eino-Ville Talvala | 752af83 | 2012-09-18 14:45:37 -0700 | [diff] [blame] | 1702 | * {@link #hasSystemFeature}: The device has at least one camera pointing in |
Eino-Ville Talvala | 9131da2 | 2014-05-08 11:39:53 -0700 | [diff] [blame] | 1703 | * 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] | 1704 | */ |
| 1705 | @SdkConstant(SdkConstantType.FEATURE) |
| 1706 | public static final String FEATURE_CAMERA_ANY = "android.hardware.camera.any"; |
| 1707 | |
| 1708 | /** |
| 1709 | * Feature for {@link #getSystemAvailableFeatures} and |
Eino-Ville Talvala | 9131da2 | 2014-05-08 11:39:53 -0700 | [diff] [blame] | 1710 | * {@link #hasSystemFeature}: The device can support having an external camera connected to it. |
| 1711 | * The external camera may not always be connected or available to applications to use. |
| 1712 | */ |
| 1713 | @SdkConstant(SdkConstantType.FEATURE) |
| 1714 | public static final String FEATURE_CAMERA_EXTERNAL = "android.hardware.camera.external"; |
| 1715 | |
| 1716 | /** |
| 1717 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1718 | * {@link #hasSystemFeature}: The device's camera supports flash. |
| 1719 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 1720 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1721 | public static final String FEATURE_CAMERA_FLASH = "android.hardware.camera.flash"; |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1722 | |
| 1723 | /** |
| 1724 | * Feature for {@link #getSystemAvailableFeatures} and |
Chih-Chung Chang | de1057c | 2010-06-14 19:15:00 +0800 | [diff] [blame] | 1725 | * {@link #hasSystemFeature}: The device has a front facing camera. |
| 1726 | */ |
| 1727 | @SdkConstant(SdkConstantType.FEATURE) |
| 1728 | public static final String FEATURE_CAMERA_FRONT = "android.hardware.camera.front"; |
| 1729 | |
| 1730 | /** |
Eino-Ville Talvala | 611fece | 2014-07-10 17:29:38 -0700 | [diff] [blame] | 1731 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one |
| 1732 | * of the cameras on the device supports the |
| 1733 | * {@link android.hardware.camera2.CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL full hardware} |
| 1734 | * capability level. |
| 1735 | */ |
| 1736 | @SdkConstant(SdkConstantType.FEATURE) |
| 1737 | public static final String FEATURE_CAMERA_LEVEL_FULL = "android.hardware.camera.level.full"; |
| 1738 | |
| 1739 | /** |
| 1740 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one |
| 1741 | * of the cameras on the device supports the |
| 1742 | * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR manual sensor} |
| 1743 | * capability level. |
| 1744 | */ |
| 1745 | @SdkConstant(SdkConstantType.FEATURE) |
| 1746 | public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_SENSOR = |
| 1747 | "android.hardware.camera.capability.manual_sensor"; |
| 1748 | |
| 1749 | /** |
| 1750 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one |
| 1751 | * of the cameras on the device supports the |
| 1752 | * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING manual post-processing} |
| 1753 | * capability level. |
| 1754 | */ |
| 1755 | @SdkConstant(SdkConstantType.FEATURE) |
| 1756 | public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_POST_PROCESSING = |
| 1757 | "android.hardware.camera.capability.manual_post_processing"; |
| 1758 | |
| 1759 | /** |
| 1760 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one |
| 1761 | * of the cameras on the device supports the |
| 1762 | * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_RAW RAW} |
| 1763 | * capability level. |
| 1764 | */ |
| 1765 | @SdkConstant(SdkConstantType.FEATURE) |
| 1766 | public static final String FEATURE_CAMERA_CAPABILITY_RAW = |
| 1767 | "android.hardware.camera.capability.raw"; |
| 1768 | |
| 1769 | /** |
Eino-Ville Talvala | dfa0c2a | 2018-01-10 12:01:08 -0800 | [diff] [blame] | 1770 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one |
| 1771 | * of the cameras on the device supports the |
| 1772 | * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MOTION_TRACKING |
| 1773 | * MOTION_TRACKING} capability level. |
| 1774 | */ |
| 1775 | @SdkConstant(SdkConstantType.FEATURE) |
| 1776 | public static final String FEATURE_CAMERA_AR = |
| 1777 | "android.hardware.camera.ar"; |
| 1778 | |
| 1779 | /** |
Chih-Chung Chang | de1057c | 2010-06-14 19:15:00 +0800 | [diff] [blame] | 1780 | * Feature for {@link #getSystemAvailableFeatures} and |
Alex Ray | 0c9d61f | 2013-10-03 12:17:54 -0700 | [diff] [blame] | 1781 | * {@link #hasSystemFeature}: The device is capable of communicating with |
| 1782 | * consumer IR devices. |
| 1783 | */ |
| 1784 | @SdkConstant(SdkConstantType.FEATURE) |
| 1785 | public static final String FEATURE_CONSUMER_IR = "android.hardware.consumerir"; |
| 1786 | |
Sam Lin | 90e258b | 2017-04-03 20:57:45 -0700 | [diff] [blame] | 1787 | /** {@hide} */ |
| 1788 | @SdkConstant(SdkConstantType.FEATURE) |
| 1789 | public static final String FEATURE_CTS = "android.software.cts"; |
| 1790 | |
Alex Ray | 0c9d61f | 2013-10-03 12:17:54 -0700 | [diff] [blame] | 1791 | /** |
| 1792 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1793 | * {@link #hasSystemFeature}: The device supports one or more methods of |
| 1794 | * reporting current location. |
| 1795 | */ |
| 1796 | @SdkConstant(SdkConstantType.FEATURE) |
| 1797 | public static final String FEATURE_LOCATION = "android.hardware.location"; |
| 1798 | |
| 1799 | /** |
| 1800 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1801 | * {@link #hasSystemFeature}: The device has a Global Positioning System |
| 1802 | * receiver and can report precise location. |
| 1803 | */ |
| 1804 | @SdkConstant(SdkConstantType.FEATURE) |
| 1805 | public static final String FEATURE_LOCATION_GPS = "android.hardware.location.gps"; |
| 1806 | |
| 1807 | /** |
| 1808 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1809 | * {@link #hasSystemFeature}: The device can report location with coarse |
| 1810 | * accuracy using a network-based geolocation system. |
| 1811 | */ |
| 1812 | @SdkConstant(SdkConstantType.FEATURE) |
| 1813 | public static final String FEATURE_LOCATION_NETWORK = "android.hardware.location.network"; |
| 1814 | |
| 1815 | /** |
| 1816 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | 2a103f1 | 2017-08-08 15:50:31 -0700 | [diff] [blame] | 1817 | * {@link #hasSystemFeature}: The device's |
| 1818 | * {@link ActivityManager#isLowRamDevice() ActivityManager.isLowRamDevice()} method returns |
| 1819 | * true. |
| 1820 | */ |
| 1821 | @SdkConstant(SdkConstantType.FEATURE) |
| 1822 | public static final String FEATURE_RAM_LOW = "android.hardware.ram.low"; |
| 1823 | |
| 1824 | /** |
| 1825 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1826 | * {@link #hasSystemFeature}: The device's |
| 1827 | * {@link ActivityManager#isLowRamDevice() ActivityManager.isLowRamDevice()} method returns |
| 1828 | * false. |
| 1829 | */ |
| 1830 | @SdkConstant(SdkConstantType.FEATURE) |
| 1831 | public static final String FEATURE_RAM_NORMAL = "android.hardware.ram.normal"; |
| 1832 | |
| 1833 | /** |
| 1834 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1835 | * {@link #hasSystemFeature}: The device can record audio via a |
| 1836 | * microphone. |
| 1837 | */ |
| 1838 | @SdkConstant(SdkConstantType.FEATURE) |
| 1839 | public static final String FEATURE_MICROPHONE = "android.hardware.microphone"; |
| 1840 | |
| 1841 | /** |
| 1842 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 76437d3 | 2010-09-01 11:17:20 -0700 | [diff] [blame] | 1843 | * {@link #hasSystemFeature}: The device can communicate using Near-Field |
| 1844 | * Communications (NFC). |
| 1845 | */ |
| 1846 | @SdkConstant(SdkConstantType.FEATURE) |
| 1847 | public static final String FEATURE_NFC = "android.hardware.nfc"; |
| 1848 | |
| 1849 | /** |
| 1850 | * Feature for {@link #getSystemAvailableFeatures} and |
Martijn Coenen | f4bf158 | 2013-07-22 12:01:19 -0700 | [diff] [blame] | 1851 | * {@link #hasSystemFeature}: The device supports host- |
| 1852 | * based NFC card emulation. |
Martijn Coenen | df4d1d6 | 2013-08-28 11:18:58 -0700 | [diff] [blame] | 1853 | * |
| 1854 | * TODO remove when depending apps have moved to new constant. |
| 1855 | * @hide |
| 1856 | * @deprecated |
Martijn Coenen | f4bf158 | 2013-07-22 12:01:19 -0700 | [diff] [blame] | 1857 | */ |
Jose Lima | 970417c | 2014-04-10 10:42:19 -0700 | [diff] [blame] | 1858 | @Deprecated |
Martijn Coenen | f4bf158 | 2013-07-22 12:01:19 -0700 | [diff] [blame] | 1859 | @SdkConstant(SdkConstantType.FEATURE) |
| 1860 | public static final String FEATURE_NFC_HCE = "android.hardware.nfc.hce"; |
| 1861 | |
| 1862 | /** |
| 1863 | * Feature for {@link #getSystemAvailableFeatures} and |
Martijn Coenen | df4d1d6 | 2013-08-28 11:18:58 -0700 | [diff] [blame] | 1864 | * {@link #hasSystemFeature}: The device supports host- |
| 1865 | * based NFC card emulation. |
| 1866 | */ |
| 1867 | @SdkConstant(SdkConstantType.FEATURE) |
| 1868 | public static final String FEATURE_NFC_HOST_CARD_EMULATION = "android.hardware.nfc.hce"; |
| 1869 | |
| 1870 | /** |
| 1871 | * Feature for {@link #getSystemAvailableFeatures} and |
Yoshinobu Ito | c52adfe | 2016-01-22 18:14:18 +0900 | [diff] [blame] | 1872 | * {@link #hasSystemFeature}: The device supports host- |
| 1873 | * based NFC-F card emulation. |
| 1874 | */ |
| 1875 | @SdkConstant(SdkConstantType.FEATURE) |
| 1876 | public static final String FEATURE_NFC_HOST_CARD_EMULATION_NFCF = "android.hardware.nfc.hcef"; |
| 1877 | |
| 1878 | /** |
| 1879 | * Feature for {@link #getSystemAvailableFeatures} and |
Martijn Coenen | 441d61b | 2017-04-12 13:52:40 -0700 | [diff] [blame] | 1880 | * {@link #hasSystemFeature}: The device supports any |
| 1881 | * one of the {@link #FEATURE_NFC}, {@link #FEATURE_NFC_HOST_CARD_EMULATION}, |
| 1882 | * or {@link #FEATURE_NFC_HOST_CARD_EMULATION_NFCF} features. |
| 1883 | * |
| 1884 | * @hide |
| 1885 | */ |
| 1886 | @SdkConstant(SdkConstantType.FEATURE) |
| 1887 | public static final String FEATURE_NFC_ANY = "android.hardware.nfc.any"; |
| 1888 | |
| 1889 | /** |
| 1890 | * Feature for {@link #getSystemAvailableFeatures} and |
Jesse Hall | 7f51706 | 2014-07-18 11:54:41 -0700 | [diff] [blame] | 1891 | * {@link #hasSystemFeature}: The device supports the OpenGL ES |
| 1892 | * <a href="http://www.khronos.org/registry/gles/extensions/ANDROID/ANDROID_extension_pack_es31a.txt"> |
| 1893 | * Android Extension Pack</a>. |
| 1894 | */ |
| 1895 | @SdkConstant(SdkConstantType.FEATURE) |
| 1896 | public static final String FEATURE_OPENGLES_EXTENSION_PACK = "android.hardware.opengles.aep"; |
| 1897 | |
| 1898 | /** |
| 1899 | * Feature for {@link #getSystemAvailableFeatures} and |
Jesse Hall | 39ceeb5 | 2016-03-10 09:04:26 -0800 | [diff] [blame] | 1900 | * {@link #hasSystemFeature(String, int)}: If this feature is supported, the Vulkan native API |
| 1901 | * will enumerate at least one {@code VkPhysicalDevice}, and the feature version will indicate |
| 1902 | * what level of optional hardware features limits it supports. |
Jesse Hall | f77a34f | 2016-02-04 18:41:33 -0800 | [diff] [blame] | 1903 | * <p> |
| 1904 | * Level 0 includes the base Vulkan requirements as well as: |
| 1905 | * <ul><li>{@code VkPhysicalDeviceFeatures::textureCompressionETC2}</li></ul> |
| 1906 | * <p> |
| 1907 | * Level 1 additionally includes: |
| 1908 | * <ul> |
| 1909 | * <li>{@code VkPhysicalDeviceFeatures::fullDrawIndexUint32}</li> |
| 1910 | * <li>{@code VkPhysicalDeviceFeatures::imageCubeArray}</li> |
| 1911 | * <li>{@code VkPhysicalDeviceFeatures::independentBlend}</li> |
| 1912 | * <li>{@code VkPhysicalDeviceFeatures::geometryShader}</li> |
| 1913 | * <li>{@code VkPhysicalDeviceFeatures::tessellationShader}</li> |
| 1914 | * <li>{@code VkPhysicalDeviceFeatures::sampleRateShading}</li> |
| 1915 | * <li>{@code VkPhysicalDeviceFeatures::textureCompressionASTC_LDR}</li> |
| 1916 | * <li>{@code VkPhysicalDeviceFeatures::fragmentStoresAndAtomics}</li> |
| 1917 | * <li>{@code VkPhysicalDeviceFeatures::shaderImageGatherExtended}</li> |
| 1918 | * <li>{@code VkPhysicalDeviceFeatures::shaderUniformBufferArrayDynamicIndexing}</li> |
| 1919 | * <li>{@code VkPhysicalDeviceFeatures::shaderSampledImageArrayDynamicIndexing}</li> |
| 1920 | * </ul> |
| 1921 | */ |
| 1922 | @SdkConstant(SdkConstantType.FEATURE) |
| 1923 | public static final String FEATURE_VULKAN_HARDWARE_LEVEL = "android.hardware.vulkan.level"; |
| 1924 | |
| 1925 | /** |
| 1926 | * Feature for {@link #getSystemAvailableFeatures} and |
Jesse Hall | 1cd7e93 | 2017-02-05 19:58:15 -0800 | [diff] [blame] | 1927 | * {@link #hasSystemFeature(String, int)}: If this feature is supported, the Vulkan native API |
| 1928 | * will enumerate at least one {@code VkPhysicalDevice}, and the feature version will indicate |
Jesse Hall | 54fc609 | 2017-08-22 07:19:56 -0700 | [diff] [blame] | 1929 | * what level of optional compute features that device supports beyond the Vulkan 1.0 |
| 1930 | * requirements. |
Jesse Hall | 1cd7e93 | 2017-02-05 19:58:15 -0800 | [diff] [blame] | 1931 | * <p> |
Jesse Hall | 54fc609 | 2017-08-22 07:19:56 -0700 | [diff] [blame] | 1932 | * Compute level 0 indicates: |
| 1933 | * <ul> |
| 1934 | * <li>The {@code VK_KHR_variable_pointers} extension and |
| 1935 | * {@code VkPhysicalDeviceVariablePointerFeaturesKHR::variablePointers} feature are |
| 1936 | supported.</li> |
| 1937 | * <li>{@code VkPhysicalDeviceLimits::maxPerStageDescriptorStorageBuffers} is at least 16.</li> |
| 1938 | * </ul> |
Jesse Hall | 1cd7e93 | 2017-02-05 19:58:15 -0800 | [diff] [blame] | 1939 | */ |
| 1940 | @SdkConstant(SdkConstantType.FEATURE) |
| 1941 | public static final String FEATURE_VULKAN_HARDWARE_COMPUTE = "android.hardware.vulkan.compute"; |
| 1942 | |
| 1943 | /** |
| 1944 | * Feature for {@link #getSystemAvailableFeatures} and |
Jesse Hall | 39ceeb5 | 2016-03-10 09:04:26 -0800 | [diff] [blame] | 1945 | * {@link #hasSystemFeature(String, int)}: The version of this feature indicates the highest |
Jesse Hall | f77a34f | 2016-02-04 18:41:33 -0800 | [diff] [blame] | 1946 | * {@code VkPhysicalDeviceProperties::apiVersion} supported by the physical devices that support |
| 1947 | * the hardware level indicated by {@link #FEATURE_VULKAN_HARDWARE_LEVEL}. The feature version |
| 1948 | * uses the same encoding as Vulkan version numbers: |
| 1949 | * <ul> |
| 1950 | * <li>Major version number in bits 31-22</li> |
| 1951 | * <li>Minor version number in bits 21-12</li> |
| 1952 | * <li>Patch version number in bits 11-0</li> |
| 1953 | * </ul> |
Jesse Hall | 239373f | 2018-01-26 11:35:10 +0800 | [diff] [blame] | 1954 | * A version of 1.1.0 or higher also indicates: |
| 1955 | * <ul> |
| 1956 | * <li>The {@code VK_ANDROID_external_memory_android_hardware_buffer} extension is |
| 1957 | * supported.</li> |
| 1958 | * <li>{@code SYNC_FD} external semaphore and fence handles are supported.</li> |
| 1959 | * <li>{@code VkPhysicalDeviceSamplerYcbcrConversionFeatures::samplerYcbcrConversion} is |
| 1960 | * supported.</li> |
| 1961 | * </ul> |
Jesse Hall | f77a34f | 2016-02-04 18:41:33 -0800 | [diff] [blame] | 1962 | */ |
| 1963 | @SdkConstant(SdkConstantType.FEATURE) |
| 1964 | public static final String FEATURE_VULKAN_HARDWARE_VERSION = "android.hardware.vulkan.version"; |
| 1965 | |
| 1966 | /** |
Tomasz Wasilczyk | 05392d6 | 2017-07-10 19:33:22 -0700 | [diff] [blame] | 1967 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1968 | * {@link #hasSystemFeature}: The device includes broadcast radio tuner. |
| 1969 | * @hide |
Tomasz Wasilczyk | 347192e | 2017-04-04 11:13:44 -0700 | [diff] [blame] | 1970 | */ |
Tomasz Wasilczyk | 05392d6 | 2017-07-10 19:33:22 -0700 | [diff] [blame] | 1971 | @SystemApi |
Tomasz Wasilczyk | 347192e | 2017-04-04 11:13:44 -0700 | [diff] [blame] | 1972 | @SdkConstant(SdkConstantType.FEATURE) |
Tomasz Wasilczyk | 05392d6 | 2017-07-10 19:33:22 -0700 | [diff] [blame] | 1973 | public static final String FEATURE_BROADCAST_RADIO = "android.hardware.broadcastradio"; |
Tomasz Wasilczyk | 347192e | 2017-04-04 11:13:44 -0700 | [diff] [blame] | 1974 | |
| 1975 | /** |
Jesse Hall | f77a34f | 2016-02-04 18:41:33 -0800 | [diff] [blame] | 1976 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 5744bb4 | 2010-09-01 19:18:57 -0700 | [diff] [blame] | 1977 | * {@link #hasSystemFeature}: The device includes an accelerometer. |
| 1978 | */ |
| 1979 | @SdkConstant(SdkConstantType.FEATURE) |
| 1980 | public static final String FEATURE_SENSOR_ACCELEROMETER = "android.hardware.sensor.accelerometer"; |
| 1981 | |
| 1982 | /** |
| 1983 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1984 | * {@link #hasSystemFeature}: The device includes a barometer (air |
| 1985 | * pressure sensor.) |
| 1986 | */ |
| 1987 | @SdkConstant(SdkConstantType.FEATURE) |
| 1988 | public static final String FEATURE_SENSOR_BAROMETER = "android.hardware.sensor.barometer"; |
| 1989 | |
| 1990 | /** |
| 1991 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1992 | * {@link #hasSystemFeature}: The device includes a magnetometer (compass). |
| 1993 | */ |
| 1994 | @SdkConstant(SdkConstantType.FEATURE) |
| 1995 | public static final String FEATURE_SENSOR_COMPASS = "android.hardware.sensor.compass"; |
| 1996 | |
| 1997 | /** |
| 1998 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 5744bb4 | 2010-09-01 19:18:57 -0700 | [diff] [blame] | 1999 | * {@link #hasSystemFeature}: The device includes a gyroscope. |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 2000 | */ |
| 2001 | @SdkConstant(SdkConstantType.FEATURE) |
Dan Morrill | 5744bb4 | 2010-09-01 19:18:57 -0700 | [diff] [blame] | 2002 | public static final String FEATURE_SENSOR_GYROSCOPE = "android.hardware.sensor.gyroscope"; |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 2003 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2004 | /** |
| 2005 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2006 | * {@link #hasSystemFeature}: The device includes a light sensor. |
| 2007 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 2008 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2009 | public static final String FEATURE_SENSOR_LIGHT = "android.hardware.sensor.light"; |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 2010 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2011 | /** |
| 2012 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2013 | * {@link #hasSystemFeature}: The device includes a proximity sensor. |
| 2014 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 2015 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2016 | public static final String FEATURE_SENSOR_PROXIMITY = "android.hardware.sensor.proximity"; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2017 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2018 | /** |
| 2019 | * Feature for {@link #getSystemAvailableFeatures} and |
Aravind Akella | 068b0c0 | 2013-10-12 17:39:15 -0700 | [diff] [blame] | 2020 | * {@link #hasSystemFeature}: The device includes a hardware step counter. |
| 2021 | */ |
| 2022 | @SdkConstant(SdkConstantType.FEATURE) |
| 2023 | public static final String FEATURE_SENSOR_STEP_COUNTER = "android.hardware.sensor.stepcounter"; |
| 2024 | |
| 2025 | /** |
| 2026 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2027 | * {@link #hasSystemFeature}: The device includes a hardware step detector. |
| 2028 | */ |
| 2029 | @SdkConstant(SdkConstantType.FEATURE) |
| 2030 | public static final String FEATURE_SENSOR_STEP_DETECTOR = "android.hardware.sensor.stepdetector"; |
| 2031 | |
| 2032 | /** |
| 2033 | * Feature for {@link #getSystemAvailableFeatures} and |
Vinod Krishnan | 8afb23c | 2014-04-30 11:11:39 -0700 | [diff] [blame] | 2034 | * {@link #hasSystemFeature}: The device includes a heart rate monitor. |
| 2035 | */ |
| 2036 | @SdkConstant(SdkConstantType.FEATURE) |
| 2037 | public static final String FEATURE_SENSOR_HEART_RATE = "android.hardware.sensor.heartrate"; |
| 2038 | |
| 2039 | /** |
| 2040 | * Feature for {@link #getSystemAvailableFeatures} and |
Trevor Johns | 682c24e | 2016-04-12 10:13:47 -0700 | [diff] [blame] | 2041 | * {@link #hasSystemFeature}: The heart rate sensor on this device is an Electrocardiogram. |
Vinod Krishnan | 1ab7689 | 2014-08-20 11:11:55 -0700 | [diff] [blame] | 2042 | */ |
| 2043 | @SdkConstant(SdkConstantType.FEATURE) |
| 2044 | public static final String FEATURE_SENSOR_HEART_RATE_ECG = |
| 2045 | "android.hardware.sensor.heartrate.ecg"; |
| 2046 | |
| 2047 | /** |
| 2048 | * Feature for {@link #getSystemAvailableFeatures} and |
Aravind Akella | 8b8e74b | 2014-07-09 11:52:39 -0700 | [diff] [blame] | 2049 | * {@link #hasSystemFeature}: The device includes a relative humidity sensor. |
| 2050 | */ |
| 2051 | @SdkConstant(SdkConstantType.FEATURE) |
| 2052 | public static final String FEATURE_SENSOR_RELATIVE_HUMIDITY = |
| 2053 | "android.hardware.sensor.relative_humidity"; |
| 2054 | |
| 2055 | /** |
| 2056 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2057 | * {@link #hasSystemFeature}: The device includes an ambient temperature sensor. |
| 2058 | */ |
| 2059 | @SdkConstant(SdkConstantType.FEATURE) |
| 2060 | public static final String FEATURE_SENSOR_AMBIENT_TEMPERATURE = |
| 2061 | "android.hardware.sensor.ambient_temperature"; |
| 2062 | |
| 2063 | /** |
| 2064 | * Feature for {@link #getSystemAvailableFeatures} and |
Ashutosh Joshi | eae371b | 2015-04-09 10:30:07 -0700 | [diff] [blame] | 2065 | * {@link #hasSystemFeature}: The device supports high fidelity sensor processing |
| 2066 | * capabilities. |
| 2067 | */ |
| 2068 | @SdkConstant(SdkConstantType.FEATURE) |
| 2069 | public static final String FEATURE_HIFI_SENSORS = |
| 2070 | "android.hardware.sensor.hifi_sensors"; |
| 2071 | |
| 2072 | /** |
| 2073 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2074 | * {@link #hasSystemFeature}: The device has a telephony radio with data |
| 2075 | * communication support. |
| 2076 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 2077 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2078 | public static final String FEATURE_TELEPHONY = "android.hardware.telephony"; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2079 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2080 | /** |
| 2081 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2082 | * {@link #hasSystemFeature}: The device has a CDMA telephony stack. |
| 2083 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 2084 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2085 | public static final String FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma"; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2086 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2087 | /** |
| 2088 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2089 | * {@link #hasSystemFeature}: The device has a GSM telephony stack. |
| 2090 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 2091 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2092 | public static final String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm"; |
Hung-ying Tyan | 3424c02 | 2010-08-27 18:08:19 +0800 | [diff] [blame] | 2093 | |
| 2094 | /** |
Polina Bondarenko | 80909ce | 2017-01-12 21:10:38 +0100 | [diff] [blame] | 2095 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
| 2096 | * The device supports telephony carrier restriction mechanism. |
| 2097 | * |
| 2098 | * <p>Devices declaring this feature must have an implementation of the |
| 2099 | * {@link android.telephony.TelephonyManager#getAllowedCarriers} and |
| 2100 | * {@link android.telephony.TelephonyManager#setAllowedCarriers}. |
| 2101 | * @hide |
| 2102 | */ |
| 2103 | @SystemApi |
| 2104 | @SdkConstant(SdkConstantType.FEATURE) |
| 2105 | public static final String FEATURE_TELEPHONY_CARRIERLOCK = |
| 2106 | "android.hardware.telephony.carrierlock"; |
| 2107 | |
| 2108 | /** |
Jeff Davidson | 35cda39 | 2017-02-27 09:46:00 -0800 | [diff] [blame] | 2109 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device |
| 2110 | * supports embedded subscriptions on eUICCs. |
Jiuyu Sun | d3bb4ae | 2018-02-08 16:38:26 +0000 | [diff] [blame] | 2111 | * TODO(b/35851809): Make this public. |
| 2112 | * @hide |
Jeff Davidson | 35cda39 | 2017-02-27 09:46:00 -0800 | [diff] [blame] | 2113 | */ |
| 2114 | @SdkConstant(SdkConstantType.FEATURE) |
| 2115 | public static final String FEATURE_TELEPHONY_EUICC = "android.hardware.telephony.euicc"; |
| 2116 | |
| 2117 | /** |
Hall Liu | c6703d9 | 2017-11-17 11:31:57 -0800 | [diff] [blame] | 2118 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device |
| 2119 | * supports cell-broadcast reception using the MBMS APIs. |
| 2120 | */ |
| 2121 | @SdkConstant(SdkConstantType.FEATURE) |
| 2122 | public static final String FEATURE_TELEPHONY_MBMS = "android.hardware.telephony.mbms"; |
| 2123 | |
| 2124 | /** |
Hung-ying Tyan | 3424c02 | 2010-08-27 18:08:19 +0800 | [diff] [blame] | 2125 | * Feature for {@link #getSystemAvailableFeatures} and |
Mike Lockwood | f4ca247 | 2011-02-27 11:23:25 -0800 | [diff] [blame] | 2126 | * {@link #hasSystemFeature}: The device supports connecting to USB devices |
| 2127 | * as the USB host. |
| 2128 | */ |
| 2129 | @SdkConstant(SdkConstantType.FEATURE) |
| 2130 | public static final String FEATURE_USB_HOST = "android.hardware.usb.host"; |
| 2131 | |
| 2132 | /** |
| 2133 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2134 | * {@link #hasSystemFeature}: The device supports connecting to USB accessories. |
| 2135 | */ |
| 2136 | @SdkConstant(SdkConstantType.FEATURE) |
| 2137 | public static final String FEATURE_USB_ACCESSORY = "android.hardware.usb.accessory"; |
| 2138 | |
| 2139 | /** |
| 2140 | * Feature for {@link #getSystemAvailableFeatures} and |
Hung-ying Tyan | 3424c02 | 2010-08-27 18:08:19 +0800 | [diff] [blame] | 2141 | * {@link #hasSystemFeature}: The SIP API is enabled on the device. |
| 2142 | */ |
| 2143 | @SdkConstant(SdkConstantType.FEATURE) |
| 2144 | public static final String FEATURE_SIP = "android.software.sip"; |
| 2145 | |
| 2146 | /** |
| 2147 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2148 | * {@link #hasSystemFeature}: The device supports SIP-based VOIP. |
| 2149 | */ |
| 2150 | @SdkConstant(SdkConstantType.FEATURE) |
| 2151 | public static final String FEATURE_SIP_VOIP = "android.software.sip.voip"; |
| 2152 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2153 | /** |
| 2154 | * Feature for {@link #getSystemAvailableFeatures} and |
Ihab Awad | 1ec6888 | 2014-09-12 11:09:01 -0700 | [diff] [blame] | 2155 | * {@link #hasSystemFeature}: The Connection Service API is enabled on the device. |
| 2156 | */ |
| 2157 | @SdkConstant(SdkConstantType.FEATURE) |
| 2158 | public static final String FEATURE_CONNECTION_SERVICE = "android.software.connectionservice"; |
| 2159 | |
| 2160 | /** |
| 2161 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | b0fe033 | 2010-04-05 14:43:58 -0700 | [diff] [blame] | 2162 | * {@link #hasSystemFeature}: The device's display has a touch screen. |
| 2163 | */ |
| 2164 | @SdkConstant(SdkConstantType.FEATURE) |
| 2165 | public static final String FEATURE_TOUCHSCREEN = "android.hardware.touchscreen"; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2166 | |
Dan Morrill | b0fe033 | 2010-04-05 14:43:58 -0700 | [diff] [blame] | 2167 | /** |
| 2168 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 2169 | * {@link #hasSystemFeature}: The device's touch screen supports |
| 2170 | * multitouch sufficient for basic two-finger gesture detection. |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2171 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 2172 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2173 | public static final String FEATURE_TOUCHSCREEN_MULTITOUCH = "android.hardware.touchscreen.multitouch"; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2174 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2175 | /** |
| 2176 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 2177 | * {@link #hasSystemFeature}: The device's touch screen is capable of |
| 2178 | * tracking two or more fingers fully independently. |
| 2179 | */ |
| 2180 | @SdkConstant(SdkConstantType.FEATURE) |
| 2181 | public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT = "android.hardware.touchscreen.multitouch.distinct"; |
| 2182 | |
| 2183 | /** |
| 2184 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 6993d3d | 2010-09-03 14:30:14 -0700 | [diff] [blame] | 2185 | * {@link #hasSystemFeature}: The device's touch screen is capable of |
| 2186 | * tracking a full hand of fingers fully independently -- that is, 5 or |
| 2187 | * more simultaneous independent pointers. |
| 2188 | */ |
| 2189 | @SdkConstant(SdkConstantType.FEATURE) |
| 2190 | public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND = "android.hardware.touchscreen.multitouch.jazzhand"; |
| 2191 | |
| 2192 | /** |
| 2193 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | a537687 | 2011-01-23 13:15:53 -0800 | [diff] [blame] | 2194 | * {@link #hasSystemFeature}: The device does not have a touch screen, but |
| 2195 | * does support touch emulation for basic events. For instance, the |
| 2196 | * device might use a mouse or remote control to drive a cursor, and |
| 2197 | * emulate basic touch pointer events like down, up, drag, etc. All |
| 2198 | * devices that support android.hardware.touchscreen or a sub-feature are |
| 2199 | * presumed to also support faketouch. |
| 2200 | */ |
| 2201 | @SdkConstant(SdkConstantType.FEATURE) |
| 2202 | public static final String FEATURE_FAKETOUCH = "android.hardware.faketouch"; |
| 2203 | |
| 2204 | /** |
| 2205 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | e22fe93 | 2011-06-08 20:24:29 -0700 | [diff] [blame] | 2206 | * {@link #hasSystemFeature}: The device does not have a touch screen, but |
| 2207 | * does support touch emulation for basic events that supports distinct |
| 2208 | * tracking of two or more fingers. This is an extension of |
| 2209 | * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note |
| 2210 | * that unlike a distinct multitouch screen as defined by |
| 2211 | * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT}, these kinds of input |
| 2212 | * devices will not actually provide full two-finger gestures since the |
| 2213 | * input is being transformed to cursor movement on the screen. That is, |
| 2214 | * single finger gestures will move a cursor; two-finger swipes will |
| 2215 | * result in single-finger touch events; other two-finger gestures will |
| 2216 | * result in the corresponding two-finger touch event. |
| 2217 | */ |
| 2218 | @SdkConstant(SdkConstantType.FEATURE) |
| 2219 | public static final String FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT = "android.hardware.faketouch.multitouch.distinct"; |
| 2220 | |
| 2221 | /** |
| 2222 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2223 | * {@link #hasSystemFeature}: The device does not have a touch screen, but |
| 2224 | * does support touch emulation for basic events that supports tracking |
| 2225 | * a hand of fingers (5 or more fingers) fully independently. |
| 2226 | * This is an extension of |
| 2227 | * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note |
| 2228 | * that unlike a multitouch screen as defined by |
| 2229 | * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND}, not all two finger |
| 2230 | * gestures can be detected due to the limitations described for |
| 2231 | * {@link #FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT}. |
| 2232 | */ |
| 2233 | @SdkConstant(SdkConstantType.FEATURE) |
| 2234 | public static final String FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND = "android.hardware.faketouch.multitouch.jazzhand"; |
| 2235 | |
| 2236 | /** |
| 2237 | * Feature for {@link #getSystemAvailableFeatures} and |
Jim Miller | d9b9d41 | 2015-07-22 19:51:40 -0700 | [diff] [blame] | 2238 | * {@link #hasSystemFeature}: The device has biometric hardware to detect a fingerprint. |
| 2239 | */ |
| 2240 | @SdkConstant(SdkConstantType.FEATURE) |
| 2241 | public static final String FEATURE_FINGERPRINT = "android.hardware.fingerprint"; |
| 2242 | |
| 2243 | /** |
| 2244 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | e289bff | 2011-06-13 19:33:22 -0700 | [diff] [blame] | 2245 | * {@link #hasSystemFeature}: The device supports portrait orientation |
| 2246 | * screens. For backwards compatibility, you can assume that if neither |
| 2247 | * this nor {@link #FEATURE_SCREEN_LANDSCAPE} is set then the device supports |
| 2248 | * both portrait and landscape. |
| 2249 | */ |
| 2250 | @SdkConstant(SdkConstantType.FEATURE) |
| 2251 | public static final String FEATURE_SCREEN_PORTRAIT = "android.hardware.screen.portrait"; |
| 2252 | |
| 2253 | /** |
| 2254 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2255 | * {@link #hasSystemFeature}: The device supports landscape orientation |
| 2256 | * screens. For backwards compatibility, you can assume that if neither |
| 2257 | * this nor {@link #FEATURE_SCREEN_PORTRAIT} is set then the device supports |
| 2258 | * both portrait and landscape. |
| 2259 | */ |
| 2260 | @SdkConstant(SdkConstantType.FEATURE) |
| 2261 | public static final String FEATURE_SCREEN_LANDSCAPE = "android.hardware.screen.landscape"; |
| 2262 | |
| 2263 | /** |
| 2264 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2265 | * {@link #hasSystemFeature}: The device supports live wallpapers. |
| 2266 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 2267 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2268 | public static final String FEATURE_LIVE_WALLPAPER = "android.software.live_wallpaper"; |
Oscar Montemayor | 1228d0a | 2010-01-28 12:01:44 -0800 | [diff] [blame] | 2269 | /** |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 2270 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | 119bbc3 | 2013-03-22 17:27:25 -0700 | [diff] [blame] | 2271 | * {@link #hasSystemFeature}: The device supports app widgets. |
| 2272 | */ |
| 2273 | @SdkConstant(SdkConstantType.FEATURE) |
| 2274 | public static final String FEATURE_APP_WIDGETS = "android.software.app_widgets"; |
| 2275 | |
| 2276 | /** |
Dianne Hackborn | 91097de | 2014-04-04 18:02:06 -0700 | [diff] [blame] | 2277 | * @hide |
| 2278 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2279 | * {@link #hasSystemFeature}: The device supports |
| 2280 | * {@link android.service.voice.VoiceInteractionService} and |
| 2281 | * {@link android.app.VoiceInteractor}. |
| 2282 | */ |
| 2283 | @SdkConstant(SdkConstantType.FEATURE) |
| 2284 | public static final String FEATURE_VOICE_RECOGNIZERS = "android.software.voice_recognizers"; |
| 2285 | |
| 2286 | |
| 2287 | /** |
Dianne Hackborn | 119bbc3 | 2013-03-22 17:27:25 -0700 | [diff] [blame] | 2288 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2289 | * {@link #hasSystemFeature}: The device supports a home screen that is replaceable |
| 2290 | * by third party applications. |
| 2291 | */ |
| 2292 | @SdkConstant(SdkConstantType.FEATURE) |
| 2293 | public static final String FEATURE_HOME_SCREEN = "android.software.home_screen"; |
| 2294 | |
| 2295 | /** |
| 2296 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2297 | * {@link #hasSystemFeature}: The device supports adding new input methods implemented |
| 2298 | * with the {@link android.inputmethodservice.InputMethodService} API. |
| 2299 | */ |
| 2300 | @SdkConstant(SdkConstantType.FEATURE) |
| 2301 | public static final String FEATURE_INPUT_METHODS = "android.software.input_methods"; |
| 2302 | |
| 2303 | /** |
| 2304 | * Feature for {@link #getSystemAvailableFeatures} and |
Amith Yamasani | 44a01b7 | 2013-09-16 10:44:57 -0700 | [diff] [blame] | 2305 | * {@link #hasSystemFeature}: The device supports device policy enforcement via device admins. |
| 2306 | */ |
| 2307 | @SdkConstant(SdkConstantType.FEATURE) |
| 2308 | public static final String FEATURE_DEVICE_ADMIN = "android.software.device_admin"; |
| 2309 | |
| 2310 | /** |
| 2311 | * Feature for {@link #getSystemAvailableFeatures} and |
Tim Kilbourn | f94b6a9 | 2014-03-07 15:13:48 -0800 | [diff] [blame] | 2312 | * {@link #hasSystemFeature}: The device supports leanback UI. This is |
| 2313 | * typically used in a living room television experience, but is a software |
| 2314 | * feature unlike {@link #FEATURE_TELEVISION}. Devices running with this |
| 2315 | * feature will use resources associated with the "television" UI mode. |
| 2316 | */ |
| 2317 | @SdkConstant(SdkConstantType.FEATURE) |
| 2318 | public static final String FEATURE_LEANBACK = "android.software.leanback"; |
| 2319 | |
| 2320 | /** |
| 2321 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2322 | * {@link #hasSystemFeature}: The device supports only leanback UI. Only |
| 2323 | * applications designed for this experience should be run, though this is |
| 2324 | * not enforced by the system. |
Tim Kilbourn | f94b6a9 | 2014-03-07 15:13:48 -0800 | [diff] [blame] | 2325 | */ |
| 2326 | @SdkConstant(SdkConstantType.FEATURE) |
| 2327 | public static final String FEATURE_LEANBACK_ONLY = "android.software.leanback_only"; |
| 2328 | |
| 2329 | /** |
| 2330 | * Feature for {@link #getSystemAvailableFeatures} and |
Jae Seo | cfd861e | 2014-08-27 14:02:15 -0700 | [diff] [blame] | 2331 | * {@link #hasSystemFeature}: The device supports live TV and can display |
| 2332 | * contents from TV inputs implemented with the |
| 2333 | * {@link android.media.tv.TvInputService} API. |
| 2334 | */ |
| 2335 | @SdkConstant(SdkConstantType.FEATURE) |
| 2336 | public static final String FEATURE_LIVE_TV = "android.software.live_tv"; |
| 2337 | |
| 2338 | /** |
| 2339 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 2340 | * {@link #hasSystemFeature}: The device supports WiFi (802.11) networking. |
| 2341 | */ |
| 2342 | @SdkConstant(SdkConstantType.FEATURE) |
| 2343 | public static final String FEATURE_WIFI = "android.hardware.wifi"; |
| 2344 | |
| 2345 | /** |
Irfan Sheriff | 45b8b46 | 2011-09-07 11:24:16 -0700 | [diff] [blame] | 2346 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2347 | * {@link #hasSystemFeature}: The device supports Wi-Fi Direct networking. |
| 2348 | */ |
| 2349 | @SdkConstant(SdkConstantType.FEATURE) |
| 2350 | public static final String FEATURE_WIFI_DIRECT = "android.hardware.wifi.direct"; |
| 2351 | |
| 2352 | /** |
Dianne Hackborn | 0cf2c8a | 2012-05-17 17:29:49 -0700 | [diff] [blame] | 2353 | * Feature for {@link #getSystemAvailableFeatures} and |
Etan Cohen | 0413327 | 2016-10-26 11:22:06 -0700 | [diff] [blame] | 2354 | * {@link #hasSystemFeature}: The device supports Wi-Fi Aware. |
Etan Cohen | 20d329b | 2015-09-29 13:49:02 -0700 | [diff] [blame] | 2355 | */ |
| 2356 | @SdkConstant(SdkConstantType.FEATURE) |
Etan Cohen | 0413327 | 2016-10-26 11:22:06 -0700 | [diff] [blame] | 2357 | public static final String FEATURE_WIFI_AWARE = "android.hardware.wifi.aware"; |
Etan Cohen | 20d329b | 2015-09-29 13:49:02 -0700 | [diff] [blame] | 2358 | |
| 2359 | /** |
| 2360 | * Feature for {@link #getSystemAvailableFeatures} and |
Peter Qiu | 3d615e4 | 2017-08-07 20:13:32 +0000 | [diff] [blame] | 2361 | * {@link #hasSystemFeature}: The device supports Wi-Fi Passpoint and all |
| 2362 | * Passpoint related APIs in {@link WifiManager} are supported. Refer to |
| 2363 | * {@link WifiManager#addOrUpdatePasspointConfiguration} for more info. |
Peter Qiu | b99fe31 | 2017-05-05 13:48:47 -0700 | [diff] [blame] | 2364 | */ |
| 2365 | @SdkConstant(SdkConstantType.FEATURE) |
| 2366 | public static final String FEATURE_WIFI_PASSPOINT = "android.hardware.wifi.passpoint"; |
| 2367 | |
| 2368 | /** |
| 2369 | * Feature for {@link #getSystemAvailableFeatures} and |
Etan Cohen | 692e68e | 2017-09-14 15:42:01 -0700 | [diff] [blame] | 2370 | * {@link #hasSystemFeature}: The device supports Wi-Fi RTT (IEEE 802.11mc). |
Etan Cohen | 692e68e | 2017-09-14 15:42:01 -0700 | [diff] [blame] | 2371 | */ |
| 2372 | @SdkConstant(SdkConstantType.FEATURE) |
| 2373 | public static final String FEATURE_WIFI_RTT = "android.hardware.wifi.rtt"; |
| 2374 | |
| 2375 | |
| 2376 | /** |
| 2377 | * Feature for {@link #getSystemAvailableFeatures} and |
Robert Quattlebaum | 87a7104 | 2017-05-15 15:45:20 -0700 | [diff] [blame] | 2378 | * {@link #hasSystemFeature}: The device supports LoWPAN networking. |
| 2379 | * @hide |
| 2380 | */ |
| 2381 | @SdkConstant(SdkConstantType.FEATURE) |
| 2382 | public static final String FEATURE_LOWPAN = "android.hardware.lowpan"; |
| 2383 | |
| 2384 | /** |
| 2385 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | 0cf2c8a | 2012-05-17 17:29:49 -0700 | [diff] [blame] | 2386 | * {@link #hasSystemFeature}: This is a device dedicated to showing UI |
Todd Kennedy | 7f95a00 | 2015-04-22 14:28:25 -0700 | [diff] [blame] | 2387 | * on a vehicle headunit. A headunit here is defined to be inside a |
| 2388 | * vehicle that may or may not be moving. A headunit uses either a |
| 2389 | * primary display in the center console and/or additional displays in |
| 2390 | * the instrument cluster or elsewhere in the vehicle. Headunit display(s) |
| 2391 | * have limited size and resolution. The user will likely be focused on |
| 2392 | * driving so limiting driver distraction is a primary concern. User input |
| 2393 | * can be a variety of hard buttons, touch, rotary controllers and even mouse- |
| 2394 | * like interfaces. |
| 2395 | */ |
| 2396 | @SdkConstant(SdkConstantType.FEATURE) |
| 2397 | public static final String FEATURE_AUTOMOTIVE = "android.hardware.type.automotive"; |
| 2398 | |
| 2399 | /** |
| 2400 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2401 | * {@link #hasSystemFeature}: This is a device dedicated to showing UI |
Dianne Hackborn | 0cf2c8a | 2012-05-17 17:29:49 -0700 | [diff] [blame] | 2402 | * on a television. Television here is defined to be a typical living |
| 2403 | * room television experience: displayed on a big screen, where the user |
| 2404 | * is sitting far away from it, and the dominant form of input will be |
| 2405 | * something like a DPAD, not through touch or mouse. |
Tim Kilbourn | f94b6a9 | 2014-03-07 15:13:48 -0800 | [diff] [blame] | 2406 | * @deprecated use {@link #FEATURE_LEANBACK} instead. |
Dianne Hackborn | 0cf2c8a | 2012-05-17 17:29:49 -0700 | [diff] [blame] | 2407 | */ |
Jose Lima | 970417c | 2014-04-10 10:42:19 -0700 | [diff] [blame] | 2408 | @Deprecated |
Dianne Hackborn | 0cf2c8a | 2012-05-17 17:29:49 -0700 | [diff] [blame] | 2409 | @SdkConstant(SdkConstantType.FEATURE) |
| 2410 | public static final String FEATURE_TELEVISION = "android.hardware.type.television"; |
| 2411 | |
| 2412 | /** |
Justin Koh | b5731f091c | 2014-02-13 16:06:59 -0800 | [diff] [blame] | 2413 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2414 | * {@link #hasSystemFeature}: This is a device dedicated to showing UI |
| 2415 | * on a watch. A watch here is defined to be a device worn on the body, perhaps on |
| 2416 | * the wrist. The user is very close when interacting with the device. |
| 2417 | */ |
| 2418 | @SdkConstant(SdkConstantType.FEATURE) |
| 2419 | public static final String FEATURE_WATCH = "android.hardware.type.watch"; |
| 2420 | |
| 2421 | /** |
Ralph Nathan | b8e0dee | 2017-01-24 15:24:59 -0800 | [diff] [blame] | 2422 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2423 | * {@link #hasSystemFeature}: This is a device for IoT and may not have an UI. An embedded |
| 2424 | * device is defined as a full stack Android device with or without a display and no |
| 2425 | * user-installable apps. |
| 2426 | */ |
| 2427 | @SdkConstant(SdkConstantType.FEATURE) |
| 2428 | public static final String FEATURE_EMBEDDED = "android.hardware.type.embedded"; |
| 2429 | |
| 2430 | /** |
Dennis Kempin | 7345ed5 | 2017-04-14 16:40:56 -0700 | [diff] [blame] | 2431 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2432 | * {@link #hasSystemFeature}: This is a device dedicated to be primarily used |
| 2433 | * with keyboard, mouse or touchpad. This includes traditional desktop |
| 2434 | * computers, laptops and variants such as convertibles or detachables. |
| 2435 | * Due to the larger screen, the device will most likely use the |
| 2436 | * {@link #FEATURE_FREEFORM_WINDOW_MANAGEMENT} feature as well. |
| 2437 | */ |
| 2438 | @SdkConstant(SdkConstantType.FEATURE) |
| 2439 | public static final String FEATURE_PC = "android.hardware.type.pc"; |
| 2440 | |
| 2441 | /** |
Adam Lesinski | 3d9bcb9 | 2014-02-18 14:05:14 -0800 | [diff] [blame] | 2442 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
| 2443 | * The device supports printing. |
| 2444 | */ |
| 2445 | @SdkConstant(SdkConstantType.FEATURE) |
| 2446 | public static final String FEATURE_PRINTING = "android.software.print"; |
| 2447 | |
| 2448 | /** |
| 2449 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Eugene Susla | 7c3eef2 | 2017-03-10 14:25:58 -0800 | [diff] [blame] | 2450 | * The device supports {@link android.companion.CompanionDeviceManager#associate associating} |
| 2451 | * with devices via {@link android.companion.CompanionDeviceManager}. |
| 2452 | */ |
| 2453 | @SdkConstant(SdkConstantType.FEATURE) |
| 2454 | public static final String FEATURE_COMPANION_DEVICE_SETUP |
| 2455 | = "android.software.companion_device_setup"; |
| 2456 | |
| 2457 | /** |
| 2458 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Adam Lesinski | 3d9bcb9 | 2014-02-18 14:05:14 -0800 | [diff] [blame] | 2459 | * The device can perform backup and restore operations on installed applications. |
| 2460 | */ |
| 2461 | @SdkConstant(SdkConstantType.FEATURE) |
| 2462 | public static final String FEATURE_BACKUP = "android.software.backup"; |
| 2463 | |
| 2464 | /** |
Vladislav Kaznacheev | d303b25 | 2015-10-27 17:30:58 -0700 | [diff] [blame] | 2465 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2466 | * {@link #hasSystemFeature}: The device supports freeform window management. |
| 2467 | * Windows have title bars and can be moved and resized. |
| 2468 | */ |
Filip Gruszczynski | 811dc3b | 2015-11-23 12:34:22 -0800 | [diff] [blame] | 2469 | // If this feature is present, you also need to set |
| 2470 | // com.android.internal.R.config_freeformWindowManagement to true in your configuration overlay. |
Vladislav Kaznacheev | d303b25 | 2015-10-27 17:30:58 -0700 | [diff] [blame] | 2471 | @SdkConstant(SdkConstantType.FEATURE) |
| 2472 | public static final String FEATURE_FREEFORM_WINDOW_MANAGEMENT |
| 2473 | = "android.software.freeform_window_management"; |
| 2474 | |
| 2475 | /** |
Adam Connors | 23cc04e | 2014-04-01 12:12:20 +0100 | [diff] [blame] | 2476 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Wale Ogunwale | fbe12c4 | 2015-12-06 16:23:50 -0800 | [diff] [blame] | 2477 | * The device supports picture-in-picture multi-window mode. |
| 2478 | */ |
| 2479 | @SdkConstant(SdkConstantType.FEATURE) |
| 2480 | public static final String FEATURE_PICTURE_IN_PICTURE = "android.software.picture_in_picture"; |
| 2481 | |
| 2482 | /** |
| 2483 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Andrii Kulian | 1981f5f | 2017-04-07 16:23:12 -0700 | [diff] [blame] | 2484 | * The device supports running activities on secondary displays. |
| 2485 | */ |
| 2486 | @SdkConstant(SdkConstantType.FEATURE) |
| 2487 | public static final String FEATURE_ACTIVITIES_ON_SECONDARY_DISPLAYS |
| 2488 | = "android.software.activities_on_secondary_displays"; |
| 2489 | |
| 2490 | /** |
| 2491 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Amith Yamasani | 1d65327 | 2014-09-11 17:56:05 -0700 | [diff] [blame] | 2492 | * The device supports creating secondary users and managed profiles via |
| 2493 | * {@link DevicePolicyManager}. |
Adam Connors | 23cc04e | 2014-04-01 12:12:20 +0100 | [diff] [blame] | 2494 | */ |
| 2495 | @SdkConstant(SdkConstantType.FEATURE) |
Amith Yamasani | 1d65327 | 2014-09-11 17:56:05 -0700 | [diff] [blame] | 2496 | public static final String FEATURE_MANAGED_USERS = "android.software.managed_users"; |
| 2497 | |
| 2498 | /** |
| 2499 | * @hide |
| 2500 | * TODO: Remove after dependencies updated b/17392243 |
| 2501 | */ |
| 2502 | public static final String FEATURE_MANAGED_PROFILES = "android.software.managed_users"; |
Adam Connors | 23cc04e | 2014-04-01 12:12:20 +0100 | [diff] [blame] | 2503 | |
| 2504 | /** |
Ben Murdoch | f564c7f | 2014-05-20 18:58:06 +0100 | [diff] [blame] | 2505 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Adam Connors | 19ccb5f | 2014-09-08 17:31:50 +0100 | [diff] [blame] | 2506 | * The device supports verified boot. |
| 2507 | */ |
| 2508 | @SdkConstant(SdkConstantType.FEATURE) |
| 2509 | public static final String FEATURE_VERIFIED_BOOT = "android.software.verified_boot"; |
| 2510 | |
| 2511 | /** |
| 2512 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
| 2513 | * The device supports secure removal of users. When a user is deleted the data associated |
| 2514 | * with that user is securely deleted and no longer available. |
| 2515 | */ |
| 2516 | @SdkConstant(SdkConstantType.FEATURE) |
| 2517 | public static final String FEATURE_SECURELY_REMOVES_USERS |
| 2518 | = "android.software.securely_removes_users"; |
| 2519 | |
Jeff Sharkey | b92b05b | 2016-01-28 09:50:00 -0700 | [diff] [blame] | 2520 | /** {@hide} */ |
Jeff Sharkey | 8eb783b | 2018-01-04 16:46:48 -0700 | [diff] [blame] | 2521 | @TestApi |
Jeff Sharkey | b92b05b | 2016-01-28 09:50:00 -0700 | [diff] [blame] | 2522 | @SdkConstant(SdkConstantType.FEATURE) |
| 2523 | public static final String FEATURE_FILE_BASED_ENCRYPTION |
| 2524 | = "android.software.file_based_encryption"; |
| 2525 | |
Jeff Sharkey | 8eb783b | 2018-01-04 16:46:48 -0700 | [diff] [blame] | 2526 | /** {@hide} */ |
| 2527 | @TestApi |
| 2528 | @SdkConstant(SdkConstantType.FEATURE) |
| 2529 | public static final String FEATURE_ADOPTABLE_STORAGE |
| 2530 | = "android.software.adoptable_storage"; |
| 2531 | |
Adam Connors | 19ccb5f | 2014-09-08 17:31:50 +0100 | [diff] [blame] | 2532 | /** |
| 2533 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Ben Murdoch | 422c7a5 | 2014-05-16 13:45:47 +0100 | [diff] [blame] | 2534 | * The device has a full implementation of the android.webkit.* APIs. Devices |
| 2535 | * lacking this feature will not have a functioning WebView implementation. |
| 2536 | */ |
| 2537 | @SdkConstant(SdkConstantType.FEATURE) |
| 2538 | public static final String FEATURE_WEBVIEW = "android.software.webview"; |
| 2539 | |
| 2540 | /** |
Joe LaPenna | 4bb015d | 2014-07-04 17:15:54 -0700 | [diff] [blame] | 2541 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2542 | * {@link #hasSystemFeature}: This device supports ethernet. |
Joe LaPenna | 4bb015d | 2014-07-04 17:15:54 -0700 | [diff] [blame] | 2543 | */ |
| 2544 | @SdkConstant(SdkConstantType.FEATURE) |
| 2545 | public static final String FEATURE_ETHERNET = "android.hardware.ethernet"; |
| 2546 | |
| 2547 | /** |
Yuncheol Heo | a0c4a06 | 2014-07-10 20:49:27 +0900 | [diff] [blame] | 2548 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2549 | * {@link #hasSystemFeature}: This device supports HDMI-CEC. |
| 2550 | * @hide |
| 2551 | */ |
| 2552 | @SdkConstant(SdkConstantType.FEATURE) |
| 2553 | public static final String FEATURE_HDMI_CEC = "android.hardware.hdmi.cec"; |
| 2554 | |
| 2555 | /** |
Michael Wright | 6faa675 | 2014-09-05 17:57:44 -0700 | [diff] [blame] | 2556 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
| 2557 | * The device has all of the inputs necessary to be considered a compatible game controller, or |
| 2558 | * includes a compatible game controller in the box. |
| 2559 | */ |
| 2560 | @SdkConstant(SdkConstantType.FEATURE) |
| 2561 | public static final String FEATURE_GAMEPAD = "android.hardware.gamepad"; |
| 2562 | |
Mike Lockwood | 5781cd5 | 2015-03-27 13:23:41 -0700 | [diff] [blame] | 2563 | /** |
| 2564 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
| 2565 | * The device has a full implementation of the android.media.midi.* APIs. |
| 2566 | */ |
| 2567 | @SdkConstant(SdkConstantType.FEATURE) |
| 2568 | public static final String FEATURE_MIDI = "android.software.midi"; |
Michael Wright | 6faa675 | 2014-09-05 17:57:44 -0700 | [diff] [blame] | 2569 | |
| 2570 | /** |
Ruben Brunk | dd18a0b | 2015-12-04 16:16:31 -0800 | [diff] [blame] | 2571 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Ruben Brunk | 927d345 | 2016-05-02 19:30:51 -0700 | [diff] [blame] | 2572 | * The device implements an optimized mode for virtual reality (VR) applications that handles |
| 2573 | * stereoscopic rendering of notifications, and disables most monocular system UI components |
| 2574 | * while a VR application has user focus. |
| 2575 | * Devices declaring this feature must include an application implementing a |
| 2576 | * {@link android.service.vr.VrListenerService} that can be targeted by VR applications via |
| 2577 | * {@link android.app.Activity#setVrModeEnabled}. |
Craig Donner | c6f9c85 | 2017-12-27 17:15:19 -0800 | [diff] [blame] | 2578 | * @deprecated use {@link #FEATURE_VR_MODE_HIGH_PERFORMANCE} instead. |
Ruben Brunk | dd18a0b | 2015-12-04 16:16:31 -0800 | [diff] [blame] | 2579 | */ |
Craig Donner | c6f9c85 | 2017-12-27 17:15:19 -0800 | [diff] [blame] | 2580 | @Deprecated |
Ruben Brunk | dd18a0b | 2015-12-04 16:16:31 -0800 | [diff] [blame] | 2581 | @SdkConstant(SdkConstantType.FEATURE) |
| 2582 | public static final String FEATURE_VR_MODE = "android.software.vr.mode"; |
| 2583 | |
| 2584 | /** |
Ruben Brunk | 31d80ea | 2016-01-25 20:14:08 -0800 | [diff] [blame] | 2585 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Craig Donner | c6f9c85 | 2017-12-27 17:15:19 -0800 | [diff] [blame] | 2586 | * The device implements an optimized mode for virtual reality (VR) applications that handles |
| 2587 | * stereoscopic rendering of notifications, disables most monocular system UI components |
| 2588 | * while a VR application has user focus and meets extra CDD requirements to provide a |
| 2589 | * high-quality VR experience. |
| 2590 | * Devices declaring this feature must include an application implementing a |
| 2591 | * {@link android.service.vr.VrListenerService} that can be targeted by VR applications via |
| 2592 | * {@link android.app.Activity#setVrModeEnabled}. |
| 2593 | * and must meet CDD requirements to provide a high-quality VR experience. |
Ruben Brunk | 31d80ea | 2016-01-25 20:14:08 -0800 | [diff] [blame] | 2594 | */ |
| 2595 | @SdkConstant(SdkConstantType.FEATURE) |
| 2596 | public static final String FEATURE_VR_MODE_HIGH_PERFORMANCE |
| 2597 | = "android.hardware.vr.high_performance"; |
| 2598 | |
| 2599 | /** |
Craig Donner | 279dd66 | 2017-03-15 17:10:50 -0700 | [diff] [blame] | 2600 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Svet Ganov | 43574b0 | 2017-04-12 09:25:20 -0700 | [diff] [blame] | 2601 | * The device supports autofill of user credentials, addresses, credit cards, etc |
| 2602 | * via integration with {@link android.service.autofill.AutofillService autofill |
| 2603 | * providers}. |
| 2604 | */ |
| 2605 | @SdkConstant(SdkConstantType.FEATURE) |
| 2606 | public static final String FEATURE_AUTOFILL = "android.software.autofill"; |
| 2607 | |
| 2608 | /** |
| 2609 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Craig Donner | 279dd66 | 2017-03-15 17:10:50 -0700 | [diff] [blame] | 2610 | * The device implements headtracking suitable for a VR device. |
| 2611 | */ |
| 2612 | @SdkConstant(SdkConstantType.FEATURE) |
| 2613 | public static final String FEATURE_VR_HEADTRACKING = "android.hardware.vr.headtracking"; |
| 2614 | |
| 2615 | /** |
Frank Salim | ea5e038 | 2018-01-23 22:42:29 -0800 | [diff] [blame] | 2616 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
| 2617 | * The device has a StrongBox hardware-backed Keystore. |
| 2618 | */ |
| 2619 | @SdkConstant(SdkConstantType.FEATURE) |
| 2620 | public static final String FEATURE_STRONGBOX_KEYSTORE = |
| 2621 | "android.hardware.strongbox_keystore"; |
| 2622 | |
| 2623 | /** |
Dianne Hackborn | e83cefce | 2010-02-04 17:38:14 -0800 | [diff] [blame] | 2624 | * Action to external storage service to clean out removed apps. |
| 2625 | * @hide |
| 2626 | */ |
| 2627 | public static final String ACTION_CLEAN_EXTERNAL_STORAGE |
| 2628 | = "android.content.pm.CLEAN_EXTERNAL_STORAGE"; |
Oscar Montemayor | 1228d0a | 2010-01-28 12:01:44 -0800 | [diff] [blame] | 2629 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2630 | /** |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 2631 | * Extra field name for the URI to a verification file. Passed to a package |
| 2632 | * verifier. |
| 2633 | * |
| 2634 | * @hide |
| 2635 | */ |
| 2636 | public static final String EXTRA_VERIFICATION_URI = "android.content.pm.extra.VERIFICATION_URI"; |
| 2637 | |
| 2638 | /** |
| 2639 | * Extra field name for the ID of a package pending verification. Passed to |
| 2640 | * a package verifier and is used to call back to |
Kenny Root | 3a9b5fb | 2011-09-20 14:15:38 -0700 | [diff] [blame] | 2641 | * {@link PackageManager#verifyPendingInstall(int, int)} |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 2642 | */ |
| 2643 | public static final String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID"; |
| 2644 | |
| 2645 | /** |
| 2646 | * Extra field name for the package identifier which is trying to install |
| 2647 | * the package. |
| 2648 | * |
| 2649 | * @hide |
| 2650 | */ |
| 2651 | public static final String EXTRA_VERIFICATION_INSTALLER_PACKAGE |
| 2652 | = "android.content.pm.extra.VERIFICATION_INSTALLER_PACKAGE"; |
| 2653 | |
| 2654 | /** |
| 2655 | * Extra field name for the requested install flags for a package pending |
| 2656 | * verification. Passed to a package verifier. |
| 2657 | * |
| 2658 | * @hide |
| 2659 | */ |
| 2660 | public static final String EXTRA_VERIFICATION_INSTALL_FLAGS |
| 2661 | = "android.content.pm.extra.VERIFICATION_INSTALL_FLAGS"; |
| 2662 | |
| 2663 | /** |
rich cannings | 13d428e | 2012-09-13 13:43:07 -0700 | [diff] [blame] | 2664 | * Extra field name for the uid of who is requesting to install |
| 2665 | * the package. |
| 2666 | * |
| 2667 | * @hide |
| 2668 | */ |
| 2669 | public static final String EXTRA_VERIFICATION_INSTALLER_UID |
| 2670 | = "android.content.pm.extra.VERIFICATION_INSTALLER_UID"; |
| 2671 | |
| 2672 | /** |
| 2673 | * Extra field name for the package name of a package pending verification. |
| 2674 | * |
| 2675 | * @hide |
| 2676 | */ |
| 2677 | public static final String EXTRA_VERIFICATION_PACKAGE_NAME |
| 2678 | = "android.content.pm.extra.VERIFICATION_PACKAGE_NAME"; |
| 2679 | /** |
rich cannings | d1b5cfc | 2012-08-29 14:49:51 -0700 | [diff] [blame] | 2680 | * Extra field name for the result of a verification, either |
| 2681 | * {@link #VERIFICATION_ALLOW}, or {@link #VERIFICATION_REJECT}. |
| 2682 | * Passed to package verifiers after a package is verified. |
| 2683 | */ |
| 2684 | public static final String EXTRA_VERIFICATION_RESULT |
| 2685 | = "android.content.pm.extra.VERIFICATION_RESULT"; |
| 2686 | |
| 2687 | /** |
rich cannings | 13d428e | 2012-09-13 13:43:07 -0700 | [diff] [blame] | 2688 | * Extra field name for the version code of a package pending verification. |
Dianne Hackborn | 3accca0 | 2013-09-20 09:32:11 -0700 | [diff] [blame] | 2689 | * @deprecated Use {@link #EXTRA_VERIFICATION_LONG_VERSION_CODE} instead. |
| 2690 | * @hide |
| 2691 | */ |
| 2692 | @Deprecated |
| 2693 | public static final String EXTRA_VERIFICATION_VERSION_CODE |
| 2694 | = "android.content.pm.extra.VERIFICATION_VERSION_CODE"; |
| 2695 | |
| 2696 | /** |
| 2697 | * Extra field name for the long version code of a package pending verification. |
rich cannings | 13d428e | 2012-09-13 13:43:07 -0700 | [diff] [blame] | 2698 | * |
| 2699 | * @hide |
| 2700 | */ |
Dianne Hackborn | 3accca0 | 2013-09-20 09:32:11 -0700 | [diff] [blame] | 2701 | public static final String EXTRA_VERIFICATION_LONG_VERSION_CODE = |
| 2702 | "android.content.pm.extra.VERIFICATION_LONG_VERSION_CODE"; |
rich cannings | 13d428e | 2012-09-13 13:43:07 -0700 | [diff] [blame] | 2703 | |
| 2704 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 2705 | * Extra field name for the ID of a intent filter pending verification. |
| 2706 | * Passed to an intent filter verifier and is used to call back to |
| 2707 | * {@link #verifyIntentFilter} |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 2708 | * |
| 2709 | * @hide |
| 2710 | */ |
| 2711 | public static final String EXTRA_INTENT_FILTER_VERIFICATION_ID |
| 2712 | = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_ID"; |
| 2713 | |
| 2714 | /** |
| 2715 | * Extra field name for the scheme used for an intent filter pending verification. Passed to |
| 2716 | * an intent filter verifier and is used to construct the URI to verify against. |
| 2717 | * |
| 2718 | * Usually this is "https" |
| 2719 | * |
| 2720 | * @hide |
| 2721 | */ |
| 2722 | public static final String EXTRA_INTENT_FILTER_VERIFICATION_URI_SCHEME |
| 2723 | = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_URI_SCHEME"; |
| 2724 | |
| 2725 | /** |
| 2726 | * Extra field name for the host names to be used for an intent filter pending verification. |
| 2727 | * Passed to an intent filter verifier and is used to construct the URI to verify the |
| 2728 | * intent filter. |
| 2729 | * |
| 2730 | * This is a space delimited list of hosts. |
| 2731 | * |
| 2732 | * @hide |
| 2733 | */ |
| 2734 | public static final String EXTRA_INTENT_FILTER_VERIFICATION_HOSTS |
| 2735 | = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_HOSTS"; |
| 2736 | |
| 2737 | /** |
| 2738 | * Extra field name for the package name to be used for an intent filter pending verification. |
| 2739 | * Passed to an intent filter verifier and is used to check the verification responses coming |
| 2740 | * from the hosts. Each host response will need to include the package name of APK containing |
| 2741 | * the intent filter. |
| 2742 | * |
| 2743 | * @hide |
| 2744 | */ |
| 2745 | public static final String EXTRA_INTENT_FILTER_VERIFICATION_PACKAGE_NAME |
| 2746 | = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_PACKAGE_NAME"; |
| 2747 | |
| 2748 | /** |
| 2749 | * The action used to request that the user approve a permission request |
| 2750 | * from the application. |
Nick Kralevich | 035f80d | 2013-03-27 15:20:08 -0700 | [diff] [blame] | 2751 | * |
| 2752 | * @hide |
| 2753 | */ |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 2754 | @SystemApi |
| 2755 | public static final String ACTION_REQUEST_PERMISSIONS = |
| 2756 | "android.content.pm.action.REQUEST_PERMISSIONS"; |
Nick Kralevich | 035f80d | 2013-03-27 15:20:08 -0700 | [diff] [blame] | 2757 | |
| 2758 | /** |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 2759 | * The names of the requested permissions. |
| 2760 | * <p> |
| 2761 | * <strong>Type:</strong> String[] |
| 2762 | * </p> |
| 2763 | * |
| 2764 | * @hide |
| 2765 | */ |
| 2766 | @SystemApi |
| 2767 | public static final String EXTRA_REQUEST_PERMISSIONS_NAMES = |
| 2768 | "android.content.pm.extra.REQUEST_PERMISSIONS_NAMES"; |
| 2769 | |
| 2770 | /** |
| 2771 | * The results from the permissions request. |
| 2772 | * <p> |
| 2773 | * <strong>Type:</strong> int[] of #PermissionResult |
| 2774 | * </p> |
| 2775 | * |
| 2776 | * @hide |
| 2777 | */ |
| 2778 | @SystemApi |
| 2779 | public static final String EXTRA_REQUEST_PERMISSIONS_RESULTS |
| 2780 | = "android.content.pm.extra.REQUEST_PERMISSIONS_RESULTS"; |
Nick Kralevich | 035f80d | 2013-03-27 15:20:08 -0700 | [diff] [blame] | 2781 | |
| 2782 | /** |
Jeff Sharkey | bb58067 | 2014-07-10 12:10:25 -0700 | [diff] [blame] | 2783 | * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of |
Christopher Tate | f1977b4 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 2784 | * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the package which provides |
| 2785 | * the existing definition for the permission. |
| 2786 | * @hide |
| 2787 | */ |
| 2788 | public static final String EXTRA_FAILURE_EXISTING_PACKAGE |
| 2789 | = "android.content.pm.extra.FAILURE_EXISTING_PACKAGE"; |
| 2790 | |
| 2791 | /** |
Jeff Sharkey | bb58067 | 2014-07-10 12:10:25 -0700 | [diff] [blame] | 2792 | * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of |
Christopher Tate | f1977b4 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 2793 | * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the permission that is |
| 2794 | * being redundantly defined by the package being installed. |
| 2795 | * @hide |
| 2796 | */ |
| 2797 | public static final String EXTRA_FAILURE_EXISTING_PERMISSION |
| 2798 | = "android.content.pm.extra.FAILURE_EXISTING_PERMISSION"; |
| 2799 | |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 2800 | /** |
| 2801 | * Permission flag: The permission is set in its current state |
| 2802 | * by the user and apps can still request it at runtime. |
| 2803 | * |
| 2804 | * @hide |
| 2805 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 2806 | @SystemApi |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 2807 | public static final int FLAG_PERMISSION_USER_SET = 1 << 0; |
| 2808 | |
| 2809 | /** |
| 2810 | * Permission flag: The permission is set in its current state |
| 2811 | * by the user and it is fixed, i.e. apps can no longer request |
| 2812 | * this permission. |
| 2813 | * |
| 2814 | * @hide |
| 2815 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 2816 | @SystemApi |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 2817 | public static final int FLAG_PERMISSION_USER_FIXED = 1 << 1; |
| 2818 | |
| 2819 | /** |
| 2820 | * Permission flag: The permission is set in its current state |
| 2821 | * by device policy and neither apps nor the user can change |
| 2822 | * its state. |
| 2823 | * |
| 2824 | * @hide |
| 2825 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 2826 | @SystemApi |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 2827 | public static final int FLAG_PERMISSION_POLICY_FIXED = 1 << 2; |
| 2828 | |
| 2829 | /** |
| 2830 | * Permission flag: The permission is set in a granted state but |
| 2831 | * access to resources it guards is restricted by other means to |
| 2832 | * enable revoking a permission on legacy apps that do not support |
| 2833 | * runtime permissions. If this permission is upgraded to runtime |
| 2834 | * because the app was updated to support runtime permissions, the |
| 2835 | * the permission will be revoked in the upgrade process. |
| 2836 | * |
| 2837 | * @hide |
| 2838 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 2839 | @SystemApi |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 2840 | public static final int FLAG_PERMISSION_REVOKE_ON_UPGRADE = 1 << 3; |
| 2841 | |
Svet Ganov | b3f22b4 | 2015-05-12 11:01:24 -0700 | [diff] [blame] | 2842 | /** |
| 2843 | * Permission flag: The permission is set in its current state |
| 2844 | * because the app is a component that is a part of the system. |
| 2845 | * |
| 2846 | * @hide |
| 2847 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 2848 | @SystemApi |
Svet Ganov | b3f22b4 | 2015-05-12 11:01:24 -0700 | [diff] [blame] | 2849 | public static final int FLAG_PERMISSION_SYSTEM_FIXED = 1 << 4; |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 2850 | |
Svet Ganov | 77ab6a8 | 2015-07-03 12:03:02 -0700 | [diff] [blame] | 2851 | /** |
| 2852 | * Permission flag: The permission is granted by default because it |
| 2853 | * enables app functionality that is expected to work out-of-the-box |
| 2854 | * for providing a smooth user experience. For example, the phone app |
| 2855 | * is expected to have the phone permission. |
| 2856 | * |
| 2857 | * @hide |
| 2858 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 2859 | @SystemApi |
Svet Ganov | 77ab6a8 | 2015-07-03 12:03:02 -0700 | [diff] [blame] | 2860 | public static final int FLAG_PERMISSION_GRANTED_BY_DEFAULT = 1 << 5; |
| 2861 | |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 2862 | /** |
Svet Ganov | 9c165d7 | 2015-12-01 19:52:26 -0800 | [diff] [blame] | 2863 | * Permission flag: The permission has to be reviewed before any of |
| 2864 | * the app components can run. |
| 2865 | * |
| 2866 | * @hide |
| 2867 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 2868 | @SystemApi |
Svet Ganov | 9c165d7 | 2015-12-01 19:52:26 -0800 | [diff] [blame] | 2869 | public static final int FLAG_PERMISSION_REVIEW_REQUIRED = 1 << 6; |
| 2870 | |
| 2871 | /** |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 2872 | * Mask for all permission flags. |
| 2873 | * |
| 2874 | * @hide |
| 2875 | */ |
| 2876 | @SystemApi |
Svet Ganov | b3f22b4 | 2015-05-12 11:01:24 -0700 | [diff] [blame] | 2877 | public static final int MASK_PERMISSION_FLAGS = 0xFF; |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 2878 | |
Christopher Tate | f1977b4 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 2879 | /** |
Svet Ganov | d7b1f411 | 2016-02-09 18:49:23 -0800 | [diff] [blame] | 2880 | * This is a library that contains components apps can invoke. For |
| 2881 | * example, a services for apps to bind to, or standard chooser UI, |
| 2882 | * etc. This library is versioned and backwards compatible. Clients |
| 2883 | * should check its version via {@link android.ext.services.Version |
| 2884 | * #getVersionCode()} and avoid calling APIs added in later versions. |
| 2885 | * |
| 2886 | * @hide |
| 2887 | */ |
| 2888 | public static final String SYSTEM_SHARED_LIBRARY_SERVICES = "android.ext.services"; |
| 2889 | |
| 2890 | /** |
| 2891 | * This is a library that contains components apps can dynamically |
| 2892 | * load. For example, new widgets, helper classes, etc. This library |
| 2893 | * is versioned and backwards compatible. Clients should check its |
| 2894 | * version via {@link android.ext.shared.Version#getVersionCode()} |
| 2895 | * and avoid calling APIs added in later versions. |
| 2896 | * |
| 2897 | * @hide |
| 2898 | */ |
| 2899 | public static final String SYSTEM_SHARED_LIBRARY_SHARED = "android.ext.shared"; |
| 2900 | |
| 2901 | /** |
Brian Carlstrom | ca82e61 | 2016-04-19 23:16:08 -0700 | [diff] [blame] | 2902 | * Used when starting a process for an Activity. |
| 2903 | * |
| 2904 | * @hide |
| 2905 | */ |
| 2906 | public static final int NOTIFY_PACKAGE_USE_ACTIVITY = 0; |
| 2907 | |
| 2908 | /** |
| 2909 | * Used when starting a process for a Service. |
| 2910 | * |
| 2911 | * @hide |
| 2912 | */ |
| 2913 | public static final int NOTIFY_PACKAGE_USE_SERVICE = 1; |
| 2914 | |
| 2915 | /** |
| 2916 | * Used when moving a Service to the foreground. |
| 2917 | * |
| 2918 | * @hide |
| 2919 | */ |
| 2920 | public static final int NOTIFY_PACKAGE_USE_FOREGROUND_SERVICE = 2; |
| 2921 | |
| 2922 | /** |
| 2923 | * Used when starting a process for a BroadcastReceiver. |
| 2924 | * |
| 2925 | * @hide |
| 2926 | */ |
| 2927 | public static final int NOTIFY_PACKAGE_USE_BROADCAST_RECEIVER = 3; |
| 2928 | |
| 2929 | /** |
| 2930 | * Used when starting a process for a ContentProvider. |
| 2931 | * |
| 2932 | * @hide |
| 2933 | */ |
| 2934 | public static final int NOTIFY_PACKAGE_USE_CONTENT_PROVIDER = 4; |
| 2935 | |
| 2936 | /** |
| 2937 | * Used when starting a process for a BroadcastReceiver. |
| 2938 | * |
| 2939 | * @hide |
| 2940 | */ |
| 2941 | public static final int NOTIFY_PACKAGE_USE_BACKUP = 5; |
| 2942 | |
| 2943 | /** |
| 2944 | * Used with Context.getClassLoader() across Android packages. |
| 2945 | * |
| 2946 | * @hide |
| 2947 | */ |
| 2948 | public static final int NOTIFY_PACKAGE_USE_CROSS_PACKAGE = 6; |
| 2949 | |
| 2950 | /** |
| 2951 | * Used when starting a package within a process for Instrumentation. |
| 2952 | * |
| 2953 | * @hide |
| 2954 | */ |
| 2955 | public static final int NOTIFY_PACKAGE_USE_INSTRUMENTATION = 7; |
| 2956 | |
| 2957 | /** |
| 2958 | * Total number of usage reasons. |
| 2959 | * |
| 2960 | * @hide |
| 2961 | */ |
| 2962 | public static final int NOTIFY_PACKAGE_USE_REASONS_COUNT = 8; |
| 2963 | |
| 2964 | /** |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 2965 | * Constant for specifying the highest installed package version code. |
| 2966 | */ |
| 2967 | public static final int VERSION_CODE_HIGHEST = -1; |
| 2968 | |
Jeff Sharkey | ad357d1 | 2018-02-02 13:25:31 -0700 | [diff] [blame] | 2969 | /** {@hide} */ |
| 2970 | public int getUserId() { |
| 2971 | return UserHandle.myUserId(); |
| 2972 | } |
| 2973 | |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 2974 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2975 | * Retrieve overall information about an application package that is |
| 2976 | * installed on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2977 | * |
| 2978 | * @param packageName The full name (i.e. com.google.apps.contacts) of the |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 2979 | * desired package. |
| 2980 | * @param flags Additional option flags to modify the data returned. |
| 2981 | * @return A PackageInfo object containing information about the package. If |
| 2982 | * flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the package |
| 2983 | * is not found in the list of installed applications, the package |
| 2984 | * information is retrieved from the list of uninstalled |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 2985 | * applications (which includes installed applications as well as |
| 2986 | * applications with data directory i.e. applications which had been |
| 2987 | * deleted with {@code DONT_DELETE_DATA} flag set). |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 2988 | * @throws NameNotFoundException if a package with the given name cannot be |
| 2989 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2990 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 2991 | public abstract PackageInfo getPackageInfo(String packageName, @PackageInfoFlags int flags) |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2992 | throws NameNotFoundException; |
| 2993 | |
| 2994 | /** |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 2995 | * Retrieve overall information about an application package that is |
| 2996 | * installed on the system. This method can be used for retrieving |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 2997 | * information about packages for which multiple versions can be installed |
| 2998 | * at the time. Currently only packages hosting static shared libraries can |
| 2999 | * have multiple installed versions. The method can also be used to get info |
| 3000 | * for a package that has a single version installed by passing |
| 3001 | * {@link #VERSION_CODE_HIGHEST} in the {@link VersionedPackage} |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 3002 | * constructor. |
| 3003 | * |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 3004 | * @param versionedPackage The versioned package for which to query. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3005 | * @param flags Additional option flags to modify the data returned. |
| 3006 | * @return A PackageInfo object containing information about the package. If |
| 3007 | * flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the package |
| 3008 | * is not found in the list of installed applications, the package |
| 3009 | * information is retrieved from the list of uninstalled |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 3010 | * applications (which includes installed applications as well as |
| 3011 | * applications with data directory i.e. applications which had been |
| 3012 | * deleted with {@code DONT_DELETE_DATA} flag set). |
| 3013 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3014 | * found on the system. |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 3015 | */ |
| 3016 | public abstract PackageInfo getPackageInfo(VersionedPackage versionedPackage, |
| 3017 | @PackageInfoFlags int flags) throws NameNotFoundException; |
| 3018 | |
| 3019 | /** |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 3020 | * Retrieve overall information about an application package that is |
| 3021 | * installed on the system. |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 3022 | * |
| 3023 | * @param packageName The full name (i.e. com.google.apps.contacts) of the |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3024 | * desired package. |
| 3025 | * @param flags Additional option flags to modify the data returned. |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 3026 | * @param userId The user id. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3027 | * @return A PackageInfo object containing information about the package. If |
| 3028 | * flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the package |
| 3029 | * is not found in the list of installed applications, the package |
| 3030 | * information is retrieved from the list of uninstalled |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 3031 | * applications (which includes installed applications as well as |
| 3032 | * applications with data directory i.e. applications which had been |
| 3033 | * deleted with {@code DONT_DELETE_DATA} flag set). |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3034 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3035 | * found on the system. |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 3036 | * @hide |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 3037 | */ |
| 3038 | @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS) |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3039 | public abstract PackageInfo getPackageInfoAsUser(String packageName, |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3040 | @PackageInfoFlags int flags, @UserIdInt int userId) throws NameNotFoundException; |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 3041 | |
| 3042 | /** |
Dianne Hackborn | 4709693 | 2010-02-11 15:57:09 -0800 | [diff] [blame] | 3043 | * Map from the current package names in use on the device to whatever |
| 3044 | * the current canonical name of that package is. |
| 3045 | * @param names Array of current names to be mapped. |
| 3046 | * @return Returns an array of the same size as the original, containing |
| 3047 | * the canonical name for each package. |
| 3048 | */ |
| 3049 | public abstract String[] currentToCanonicalPackageNames(String[] names); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3050 | |
Dianne Hackborn | 4709693 | 2010-02-11 15:57:09 -0800 | [diff] [blame] | 3051 | /** |
| 3052 | * Map from a packages canonical name to the current name in use on the device. |
| 3053 | * @param names Array of new names to be mapped. |
| 3054 | * @return Returns an array of the same size as the original, containing |
| 3055 | * the current name for each package. |
| 3056 | */ |
| 3057 | public abstract String[] canonicalToCurrentPackageNames(String[] names); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3058 | |
Dianne Hackborn | 4709693 | 2010-02-11 15:57:09 -0800 | [diff] [blame] | 3059 | /** |
Andrew Solovay | 5ae1335 | 2014-06-06 12:23:09 -0700 | [diff] [blame] | 3060 | * Returns a "good" intent to launch a front-door activity in a package. |
| 3061 | * This is used, for example, to implement an "open" button when browsing |
| 3062 | * through packages. The current implementation looks first for a main |
| 3063 | * activity in the category {@link Intent#CATEGORY_INFO}, and next for a |
| 3064 | * main activity in the category {@link Intent#CATEGORY_LAUNCHER}. Returns |
| 3065 | * <code>null</code> if neither are found. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3066 | * |
| 3067 | * @param packageName The name of the package to inspect. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3068 | * |
Andrew Solovay | 5ae1335 | 2014-06-06 12:23:09 -0700 | [diff] [blame] | 3069 | * @return A fully-qualified {@link Intent} that can be used to launch the |
| 3070 | * main activity in the package. Returns <code>null</code> if the package |
| 3071 | * 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] | 3072 | * recognized. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3073 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 3074 | public abstract @Nullable Intent getLaunchIntentForPackage(@NonNull String packageName); |
Mihai Preda | eae850c | 2009-05-13 10:13:48 +0200 | [diff] [blame] | 3075 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3076 | /** |
Jose Lima | 970417c | 2014-04-10 10:42:19 -0700 | [diff] [blame] | 3077 | * Return a "good" intent to launch a front-door Leanback activity in a |
| 3078 | * package, for use for example to implement an "open" button when browsing |
| 3079 | * through packages. The current implementation will look for a main |
| 3080 | * activity in the category {@link Intent#CATEGORY_LEANBACK_LAUNCHER}, or |
| 3081 | * return null if no main leanback activities are found. |
Adam Connors | 551c078 | 2014-06-05 12:13:03 +0100 | [diff] [blame] | 3082 | * |
Jose Lima | 970417c | 2014-04-10 10:42:19 -0700 | [diff] [blame] | 3083 | * @param packageName The name of the package to inspect. |
| 3084 | * @return Returns either a fully-qualified Intent that can be used to launch |
| 3085 | * the main Leanback activity in the package, or null if the package |
| 3086 | * does not contain such an activity. |
| 3087 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 3088 | public abstract @Nullable Intent getLeanbackLaunchIntentForPackage(@NonNull String packageName); |
Jose Lima | 970417c | 2014-04-10 10:42:19 -0700 | [diff] [blame] | 3089 | |
| 3090 | /** |
Roberto Perez | 7ee1a7a | 2017-12-04 17:14:33 -0800 | [diff] [blame] | 3091 | * Return a "good" intent to launch a front-door Car activity in a |
| 3092 | * package, for use for example to implement an "open" button when browsing |
| 3093 | * through packages. The current implementation will look for a main |
| 3094 | * activity in the category {@link Intent#CATEGORY_CAR_LAUNCHER}, or |
| 3095 | * return null if no main car activities are found. |
| 3096 | * |
| 3097 | * @param packageName The name of the package to inspect. |
| 3098 | * @return Returns either a fully-qualified Intent that can be used to launch |
| 3099 | * the main Car activity in the package, or null if the package |
| 3100 | * does not contain such an activity. |
| 3101 | * @hide |
| 3102 | */ |
| 3103 | public abstract @Nullable Intent getCarLaunchIntentForPackage(@NonNull String packageName); |
| 3104 | |
| 3105 | /** |
Jeff Sharkey | cf3f0a1 | 2016-03-17 19:57:58 -0600 | [diff] [blame] | 3106 | * Return an array of all of the POSIX secondary group IDs that have been |
| 3107 | * assigned to the given package. |
| 3108 | * <p> |
| 3109 | * Note that the same package may have different GIDs under different |
| 3110 | * {@link UserHandle} on the same device. |
Adam Connors | 551c078 | 2014-06-05 12:13:03 +0100 | [diff] [blame] | 3111 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3112 | * @param packageName The full name (i.e. com.google.apps.contacts) of the |
Jeff Sharkey | cf3f0a1 | 2016-03-17 19:57:58 -0600 | [diff] [blame] | 3113 | * desired package. |
| 3114 | * @return Returns an int array of the assigned GIDs, or null if there are |
Jose Lima | 970417c | 2014-04-10 10:42:19 -0700 | [diff] [blame] | 3115 | * none. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3116 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3117 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3118 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 3119 | public abstract int[] getPackageGids(@NonNull String packageName) |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3120 | throws NameNotFoundException; |
| 3121 | |
| 3122 | /** |
Jeff Sharkey | cf3f0a1 | 2016-03-17 19:57:58 -0600 | [diff] [blame] | 3123 | * Return an array of all of the POSIX secondary group IDs that have been |
| 3124 | * assigned to the given package. |
| 3125 | * <p> |
| 3126 | * Note that the same package may have different GIDs under different |
| 3127 | * {@link UserHandle} on the same device. |
Dianne Hackborn | a06de0f | 2012-12-11 16:34:47 -0800 | [diff] [blame] | 3128 | * |
| 3129 | * @param packageName The full name (i.e. com.google.apps.contacts) of the |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3130 | * desired package. |
| 3131 | * @return Returns an int array of the assigned gids, or null if there are |
| 3132 | * none. |
| 3133 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3134 | * found on the system. |
Dianne Hackborn | a06de0f | 2012-12-11 16:34:47 -0800 | [diff] [blame] | 3135 | */ |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3136 | public abstract int[] getPackageGids(String packageName, @PackageInfoFlags int flags) |
Dianne Hackborn | a06de0f | 2012-12-11 16:34:47 -0800 | [diff] [blame] | 3137 | throws NameNotFoundException; |
| 3138 | |
| 3139 | /** |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3140 | * Return the UID associated with the given package name. |
Jeff Sharkey | cf3f0a1 | 2016-03-17 19:57:58 -0600 | [diff] [blame] | 3141 | * <p> |
| 3142 | * Note that the same package will have different UIDs under different |
| 3143 | * {@link UserHandle} on the same device. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3144 | * |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3145 | * @param packageName The full name (i.e. com.google.apps.contacts) of the |
| 3146 | * desired package. |
| 3147 | * @return Returns an integer UID who owns the given package name. |
| 3148 | * @throws NameNotFoundException if a package with the given name can not be |
| 3149 | * found on the system. |
| 3150 | */ |
| 3151 | public abstract int getPackageUid(String packageName, @PackageInfoFlags int flags) |
| 3152 | throws NameNotFoundException; |
| 3153 | |
| 3154 | /** |
| 3155 | * Return the UID associated with the given package name. |
Jeff Sharkey | cf3f0a1 | 2016-03-17 19:57:58 -0600 | [diff] [blame] | 3156 | * <p> |
| 3157 | * Note that the same package will have different UIDs under different |
| 3158 | * {@link UserHandle} on the same device. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3159 | * |
| 3160 | * @param packageName The full name (i.e. com.google.apps.contacts) of the |
| 3161 | * desired package. |
| 3162 | * @param userId The user handle identifier to look up the package under. |
| 3163 | * @return Returns an integer UID who owns the given package name. |
| 3164 | * @throws NameNotFoundException if a package with the given name can not be |
| 3165 | * found on the system. |
| 3166 | * @hide |
| 3167 | */ |
| 3168 | public abstract int getPackageUidAsUser(String packageName, @UserIdInt int userId) |
| 3169 | throws NameNotFoundException; |
| 3170 | |
| 3171 | /** |
| 3172 | * Return the UID associated with the given package name. |
Jeff Sharkey | cf3f0a1 | 2016-03-17 19:57:58 -0600 | [diff] [blame] | 3173 | * <p> |
| 3174 | * Note that the same package will have different UIDs under different |
| 3175 | * {@link UserHandle} on the same device. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3176 | * |
| 3177 | * @param packageName The full name (i.e. com.google.apps.contacts) of the |
| 3178 | * desired package. |
| 3179 | * @param userId The user handle identifier to look up the package under. |
| 3180 | * @return Returns an integer UID who owns the given package name. |
| 3181 | * @throws NameNotFoundException if a package with the given name can not be |
| 3182 | * found on the system. |
| 3183 | * @hide |
| 3184 | */ |
| 3185 | public abstract int getPackageUidAsUser(String packageName, @PackageInfoFlags int flags, |
| 3186 | @UserIdInt int userId) throws NameNotFoundException; |
| 3187 | |
| 3188 | /** |
| 3189 | * Retrieve all of the information we know about a particular permission. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3190 | * |
| 3191 | * @param name The fully qualified name (i.e. com.google.permission.LOGIN) |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3192 | * of the permission you are interested in. |
| 3193 | * @param flags Additional option flags to modify the data returned. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3194 | * @return Returns a {@link PermissionInfo} containing information about the |
| 3195 | * permission. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3196 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3197 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3198 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3199 | public abstract PermissionInfo getPermissionInfo(String name, @PermissionInfoFlags int flags) |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3200 | throws NameNotFoundException; |
| 3201 | |
| 3202 | /** |
| 3203 | * Query for all of the permissions associated with a particular group. |
| 3204 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3205 | * @param group The fully qualified name (i.e. com.google.permission.LOGIN) |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3206 | * of the permission group you are interested in. Use null to |
| 3207 | * find all of the permissions not associated with a group. |
| 3208 | * @param flags Additional option flags to modify the data returned. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3209 | * @return Returns a list of {@link PermissionInfo} containing information |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3210 | * about all of the permissions in the given group. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3211 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3212 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3213 | */ |
| 3214 | public abstract List<PermissionInfo> queryPermissionsByGroup(String group, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3215 | @PermissionInfoFlags int flags) throws NameNotFoundException; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3216 | |
| 3217 | /** |
Paul Navin | 7b89a7b | 2017-01-26 23:56:08 +0000 | [diff] [blame] | 3218 | * Returns true if Permission Review Mode is enabled, false otherwise. |
| 3219 | * |
| 3220 | * @hide |
| 3221 | */ |
| 3222 | @TestApi |
| 3223 | public abstract boolean isPermissionReviewModeEnabled(); |
| 3224 | |
| 3225 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3226 | * Retrieve all of the information we know about a particular group of |
| 3227 | * permissions. |
| 3228 | * |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3229 | * @param name The fully qualified name (i.e. |
| 3230 | * com.google.permission_group.APPS) of the permission you are |
| 3231 | * interested in. |
| 3232 | * @param flags Additional option flags to modify the data returned. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3233 | * @return Returns a {@link PermissionGroupInfo} containing information |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 3234 | * about the permission. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3235 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3236 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3237 | */ |
| 3238 | public abstract PermissionGroupInfo getPermissionGroupInfo(String name, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3239 | @PermissionGroupInfoFlags int flags) throws NameNotFoundException; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3240 | |
| 3241 | /** |
| 3242 | * Retrieve all of the known permission groups in the system. |
| 3243 | * |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3244 | * @param flags Additional option flags to modify the data returned. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3245 | * @return Returns a list of {@link PermissionGroupInfo} containing |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 3246 | * information about all of the known permission groups. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3247 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3248 | public abstract List<PermissionGroupInfo> getAllPermissionGroups( |
| 3249 | @PermissionGroupInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3250 | |
| 3251 | /** |
| 3252 | * Retrieve all of the information we know about a particular |
| 3253 | * package/application. |
| 3254 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3255 | * @param packageName The full name (i.e. com.google.apps.contacts) of an |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3256 | * application. |
| 3257 | * @param flags Additional option flags to modify the data returned. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 3258 | * @return An {@link ApplicationInfo} containing information about the |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3259 | * package. If flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if |
| 3260 | * the package is not found in the list of installed applications, |
| 3261 | * the application information is retrieved from the list of |
| 3262 | * uninstalled applications (which includes installed applications |
| 3263 | * as well as applications with data directory i.e. applications |
| 3264 | * which had been deleted with {@code DONT_DELETE_DATA} flag set). |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3265 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3266 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3267 | */ |
| 3268 | public abstract ApplicationInfo getApplicationInfo(String packageName, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3269 | @ApplicationInfoFlags int flags) throws NameNotFoundException; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3270 | |
Jeff Sharkey | cd65448 | 2016-01-08 17:42:11 -0700 | [diff] [blame] | 3271 | /** {@hide} */ |
| 3272 | public abstract ApplicationInfo getApplicationInfoAsUser(String packageName, |
| 3273 | @ApplicationInfoFlags int flags, @UserIdInt int userId) throws NameNotFoundException; |
| 3274 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3275 | /** |
| 3276 | * Retrieve all of the information we know about a particular activity |
| 3277 | * class. |
| 3278 | * |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 3279 | * @param component The full component name (i.e. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 3280 | * com.google.apps.contacts/com.google.apps.contacts. |
| 3281 | * ContactsList) of an Activity class. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3282 | * @param flags Additional option flags to modify the data returned. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 3283 | * @return An {@link ActivityInfo} containing information about the |
| 3284 | * activity. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3285 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3286 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3287 | */ |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 3288 | public abstract ActivityInfo getActivityInfo(ComponentName component, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3289 | @ComponentInfoFlags int flags) throws NameNotFoundException; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3290 | |
| 3291 | /** |
| 3292 | * Retrieve all of the information we know about a particular receiver |
| 3293 | * class. |
| 3294 | * |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 3295 | * @param component The full component name (i.e. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 3296 | * com.google.apps.calendar/com.google.apps.calendar. |
| 3297 | * CalendarAlarm) of a Receiver class. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3298 | * @param flags Additional option flags to modify the data returned. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 3299 | * @return An {@link ActivityInfo} containing information about the |
| 3300 | * receiver. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3301 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3302 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3303 | */ |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 3304 | public abstract ActivityInfo getReceiverInfo(ComponentName component, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3305 | @ComponentInfoFlags int flags) throws NameNotFoundException; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3306 | |
| 3307 | /** |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 3308 | * Retrieve all of the information we know about a particular service class. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3309 | * |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 3310 | * @param component The full component name (i.e. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 3311 | * com.google.apps.media/com.google.apps.media. |
| 3312 | * BackgroundPlayback) of a Service class. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3313 | * @param flags Additional option flags to modify the data returned. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 3314 | * @return A {@link ServiceInfo} object containing information about the |
| 3315 | * service. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3316 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3317 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3318 | */ |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 3319 | public abstract ServiceInfo getServiceInfo(ComponentName component, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3320 | @ComponentInfoFlags int flags) throws NameNotFoundException; |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 3321 | |
| 3322 | /** |
| 3323 | * Retrieve all of the information we know about a particular content |
| 3324 | * provider class. |
| 3325 | * |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 3326 | * @param component The full component name (i.e. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 3327 | * com.google.providers.media/com.google.providers.media. |
| 3328 | * MediaProvider) of a ContentProvider class. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3329 | * @param flags Additional option flags to modify the data returned. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 3330 | * @return A {@link ProviderInfo} object containing information about the |
| 3331 | * provider. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3332 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3333 | * found on the system. |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 3334 | */ |
| 3335 | public abstract ProviderInfo getProviderInfo(ComponentName component, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3336 | @ComponentInfoFlags int flags) throws NameNotFoundException; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3337 | |
| 3338 | /** |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3339 | * Return a List of all packages that are installed on the device. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3340 | * |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3341 | * @param flags Additional option flags to modify the data returned. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 3342 | * @return A List of PackageInfo objects, one for each installed package, |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3343 | * containing information about the package. In the unlikely case |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 3344 | * there are no installed packages, an empty list is returned. If |
| 3345 | * flag {@code MATCH_UNINSTALLED_PACKAGES} is set, the package |
| 3346 | * information is retrieved from the list of uninstalled |
| 3347 | * applications (which includes installed applications as well as |
| 3348 | * applications with data directory i.e. applications which had been |
| 3349 | * deleted with {@code DONT_DELETE_DATA} flag set). |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3350 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3351 | public abstract List<PackageInfo> getInstalledPackages(@PackageInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3352 | |
| 3353 | /** |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3354 | * Return a List of all installed packages that are currently holding any of |
| 3355 | * the given permissions. |
Dianne Hackborn | e799175 | 2013-01-16 17:56:46 -0800 | [diff] [blame] | 3356 | * |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3357 | * @param flags Additional option flags to modify the data returned. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 3358 | * @return A List of PackageInfo objects, one for each installed package |
| 3359 | * that holds any of the permissions that were provided, containing |
| 3360 | * information about the package. If no installed packages hold any |
| 3361 | * of the permissions, an empty list is returned. If flag |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3362 | * {@code MATCH_UNINSTALLED_PACKAGES} is set, the package |
| 3363 | * information is retrieved from the list of uninstalled |
| 3364 | * applications (which includes installed applications as well as |
| 3365 | * applications with data directory i.e. applications which had been |
| 3366 | * deleted with {@code DONT_DELETE_DATA} flag set). |
Dianne Hackborn | e799175 | 2013-01-16 17:56:46 -0800 | [diff] [blame] | 3367 | */ |
| 3368 | public abstract List<PackageInfo> getPackagesHoldingPermissions( |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3369 | String[] permissions, @PackageInfoFlags int flags); |
Dianne Hackborn | e799175 | 2013-01-16 17:56:46 -0800 | [diff] [blame] | 3370 | |
| 3371 | /** |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3372 | * Return a List of all packages that are installed on the device, for a |
Jeff Sharkey | d86b8fe | 2017-06-02 17:36:26 -0600 | [diff] [blame] | 3373 | * specific user. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 3374 | * |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3375 | * @param flags Additional option flags to modify the data returned. |
Amith Yamasani | 151ec4c | 2012-09-07 19:25:16 -0700 | [diff] [blame] | 3376 | * @param userId The user for whom the installed packages are to be listed |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 3377 | * @return A List of PackageInfo objects, one for each installed package, |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3378 | * containing information about the package. In the unlikely case |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 3379 | * there are no installed packages, an empty list is returned. If |
| 3380 | * flag {@code MATCH_UNINSTALLED_PACKAGES} is set, the package |
| 3381 | * information is retrieved from the list of uninstalled |
| 3382 | * applications (which includes installed applications as well as |
| 3383 | * applications with data directory i.e. applications which had been |
| 3384 | * deleted with {@code DONT_DELETE_DATA} flag set). |
Amith Yamasani | 151ec4c | 2012-09-07 19:25:16 -0700 | [diff] [blame] | 3385 | * @hide |
| 3386 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 3387 | @SystemApi |
Jeff Sharkey | d86b8fe | 2017-06-02 17:36:26 -0600 | [diff] [blame] | 3388 | @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL) |
Jeff Sharkey | e06b4d1 | 2016-01-06 14:51:50 -0700 | [diff] [blame] | 3389 | public abstract List<PackageInfo> getInstalledPackagesAsUser(@PackageInfoFlags int flags, |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3390 | @UserIdInt int userId); |
Amith Yamasani | 151ec4c | 2012-09-07 19:25:16 -0700 | [diff] [blame] | 3391 | |
| 3392 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3393 | * Check whether a particular package has been granted a particular |
| 3394 | * permission. |
| 3395 | * |
Svet Ganov | ad3b297 | 2015-07-07 22:49:17 -0700 | [diff] [blame] | 3396 | * @param permName The name of the permission you are checking for. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3397 | * @param pkgName The name of the package you are checking against. |
| 3398 | * |
| 3399 | * @return If the package has the permission, PERMISSION_GRANTED is |
| 3400 | * returned. If it does not have the permission, PERMISSION_DENIED |
| 3401 | * is returned. |
| 3402 | * |
| 3403 | * @see #PERMISSION_GRANTED |
| 3404 | * @see #PERMISSION_DENIED |
| 3405 | */ |
Tor Norbye | 1c2bf03 | 2015-03-02 10:57:08 -0800 | [diff] [blame] | 3406 | @CheckResult |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 3407 | public abstract @PermissionResult int checkPermission(String permName, String pkgName); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3408 | |
| 3409 | /** |
Svet Ganov | ad3b297 | 2015-07-07 22:49:17 -0700 | [diff] [blame] | 3410 | * Checks whether a particular permissions has been revoked for a |
| 3411 | * package by policy. Typically the device owner or the profile owner |
| 3412 | * may apply such a policy. The user cannot grant policy revoked |
| 3413 | * permissions, hence the only way for an app to get such a permission |
| 3414 | * is by a policy change. |
| 3415 | * |
| 3416 | * @param permName The name of the permission you are checking for. |
| 3417 | * @param pkgName The name of the package you are checking against. |
| 3418 | * |
| 3419 | * @return Whether the permission is restricted by policy. |
| 3420 | */ |
| 3421 | @CheckResult |
Svet Ganov | f1b7f20 | 2015-07-29 08:33:42 -0700 | [diff] [blame] | 3422 | public abstract boolean isPermissionRevokedByPolicy(@NonNull String permName, |
| 3423 | @NonNull String pkgName); |
| 3424 | |
| 3425 | /** |
| 3426 | * Gets the package name of the component controlling runtime permissions. |
| 3427 | * |
| 3428 | * @return The package name. |
| 3429 | * |
| 3430 | * @hide |
| 3431 | */ |
Philip P. Moltmann | eb0a0ae | 2017-06-30 10:55:51 -0700 | [diff] [blame] | 3432 | @TestApi |
Svet Ganov | f1b7f20 | 2015-07-29 08:33:42 -0700 | [diff] [blame] | 3433 | public abstract String getPermissionControllerPackageName(); |
Svet Ganov | ad3b297 | 2015-07-07 22:49:17 -0700 | [diff] [blame] | 3434 | |
| 3435 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3436 | * Add a new dynamic permission to the system. For this to work, your |
| 3437 | * package must have defined a permission tree through the |
| 3438 | * {@link android.R.styleable#AndroidManifestPermissionTree |
| 3439 | * <permission-tree>} tag in its manifest. A package can only add |
| 3440 | * permissions to trees that were defined by either its own package or |
| 3441 | * another with the same user id; a permission is in a tree if it |
| 3442 | * matches the name of the permission tree + ".": for example, |
| 3443 | * "com.foo.bar" is a member of the permission tree "com.foo". |
| 3444 | * |
| 3445 | * <p>It is good to make your permission tree name descriptive, because you |
| 3446 | * are taking possession of that entire set of permission names. Thus, it |
| 3447 | * must be under a domain you control, with a suffix that will not match |
| 3448 | * any normal permissions that may be declared in any applications that |
| 3449 | * are part of that domain. |
| 3450 | * |
| 3451 | * <p>New permissions must be added before |
| 3452 | * any .apks are installed that use those permissions. Permissions you |
| 3453 | * add through this method are remembered across reboots of the device. |
| 3454 | * If the given permission already exists, the info you supply here |
| 3455 | * will be used to update it. |
| 3456 | * |
| 3457 | * @param info Description of the permission to be added. |
| 3458 | * |
| 3459 | * @return Returns true if a new permission was created, false if an |
| 3460 | * existing one was updated. |
| 3461 | * |
| 3462 | * @throws SecurityException if you are not allowed to add the |
| 3463 | * given permission name. |
| 3464 | * |
| 3465 | * @see #removePermission(String) |
| 3466 | */ |
| 3467 | public abstract boolean addPermission(PermissionInfo info); |
| 3468 | |
| 3469 | /** |
Dianne Hackborn | d7c0968 | 2010-03-30 10:42:20 -0700 | [diff] [blame] | 3470 | * Like {@link #addPermission(PermissionInfo)} but asynchronously |
| 3471 | * persists the package manager state after returning from the call, |
| 3472 | * allowing it to return quicker and batch a series of adds at the |
| 3473 | * expense of no guarantee the added permission will be retained if |
| 3474 | * the device is rebooted before it is written. |
| 3475 | */ |
| 3476 | public abstract boolean addPermissionAsync(PermissionInfo info); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3477 | |
Dianne Hackborn | d7c0968 | 2010-03-30 10:42:20 -0700 | [diff] [blame] | 3478 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3479 | * Removes a permission that was previously added with |
| 3480 | * {@link #addPermission(PermissionInfo)}. The same ownership rules apply |
| 3481 | * -- you are only allowed to remove permissions that you are allowed |
| 3482 | * to add. |
| 3483 | * |
| 3484 | * @param name The name of the permission to remove. |
| 3485 | * |
| 3486 | * @throws SecurityException if you are not allowed to remove the |
| 3487 | * given permission name. |
| 3488 | * |
| 3489 | * @see #addPermission(PermissionInfo) |
| 3490 | */ |
| 3491 | public abstract void removePermission(String name); |
| 3492 | |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3493 | /** |
| 3494 | * Permission flags set when granting or revoking a permission. |
| 3495 | * |
| 3496 | * @hide |
| 3497 | */ |
| 3498 | @SystemApi |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3499 | @IntDef(prefix = { "FLAG_PERMISSION_" }, value = { |
| 3500 | FLAG_PERMISSION_USER_SET, |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3501 | FLAG_PERMISSION_USER_FIXED, |
| 3502 | FLAG_PERMISSION_POLICY_FIXED, |
Svet Ganov | b3f22b4 | 2015-05-12 11:01:24 -0700 | [diff] [blame] | 3503 | FLAG_PERMISSION_REVOKE_ON_UPGRADE, |
Svet Ganov | 77ab6a8 | 2015-07-03 12:03:02 -0700 | [diff] [blame] | 3504 | FLAG_PERMISSION_SYSTEM_FIXED, |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3505 | FLAG_PERMISSION_GRANTED_BY_DEFAULT |
| 3506 | }) |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3507 | @Retention(RetentionPolicy.SOURCE) |
| 3508 | public @interface PermissionFlags {} |
| 3509 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3510 | /** |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3511 | * Grant a runtime permission to an application which the application does not |
| 3512 | * already have. The permission must have been requested by the application. |
| 3513 | * If the application is not allowed to hold the permission, a {@link |
Ruben Brunk | 12ab5e1 | 2016-11-10 15:27:30 -0800 | [diff] [blame] | 3514 | * java.lang.SecurityException} is thrown. If the package or permission is |
| 3515 | * invalid, a {@link java.lang.IllegalArgumentException} is thrown. |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3516 | * <p> |
| 3517 | * <strong>Note: </strong>Using this API requires holding |
Todd Kennedy | a8eb6a8 | 2016-07-28 16:35:42 -0700 | [diff] [blame] | 3518 | * android.permission.GRANT_RUNTIME_PERMISSIONS and if the user id is |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3519 | * not the current user android.permission.INTERACT_ACROSS_USERS_FULL. |
| 3520 | * </p> |
Nick Kralevich | 035f80d | 2013-03-27 15:20:08 -0700 | [diff] [blame] | 3521 | * |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3522 | * @param packageName The package to which to grant the permission. |
| 3523 | * @param permissionName The permission name to grant. |
| 3524 | * @param user The user for which to grant the permission. |
| 3525 | * |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3526 | * @see #revokeRuntimePermission(String, String, android.os.UserHandle) |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3527 | * |
| 3528 | * @hide |
Nick Kralevich | 035f80d | 2013-03-27 15:20:08 -0700 | [diff] [blame] | 3529 | */ |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3530 | @SystemApi |
Jeff Sharkey | d86b8fe | 2017-06-02 17:36:26 -0600 | [diff] [blame] | 3531 | @RequiresPermission(android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS) |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3532 | public abstract void grantRuntimePermission(@NonNull String packageName, |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3533 | @NonNull String permissionName, @NonNull UserHandle user); |
Nick Kralevich | 035f80d | 2013-03-27 15:20:08 -0700 | [diff] [blame] | 3534 | |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3535 | /** |
| 3536 | * Revoke a runtime permission that was previously granted by {@link |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3537 | * #grantRuntimePermission(String, String, android.os.UserHandle)}. The |
| 3538 | * permission must have been requested by and granted to the application. |
| 3539 | * If the application is not allowed to hold the permission, a {@link |
Ruben Brunk | 12ab5e1 | 2016-11-10 15:27:30 -0800 | [diff] [blame] | 3540 | * java.lang.SecurityException} is thrown. If the package or permission is |
| 3541 | * invalid, a {@link java.lang.IllegalArgumentException} is thrown. |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3542 | * <p> |
| 3543 | * <strong>Note: </strong>Using this API requires holding |
Todd Kennedy | a8eb6a8 | 2016-07-28 16:35:42 -0700 | [diff] [blame] | 3544 | * android.permission.REVOKE_RUNTIME_PERMISSIONS and if the user id is |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3545 | * not the current user android.permission.INTERACT_ACROSS_USERS_FULL. |
| 3546 | * </p> |
| 3547 | * |
| 3548 | * @param packageName The package from which to revoke the permission. |
| 3549 | * @param permissionName The permission name to revoke. |
| 3550 | * @param user The user for which to revoke the permission. |
| 3551 | * |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3552 | * @see #grantRuntimePermission(String, String, android.os.UserHandle) |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3553 | * |
| 3554 | * @hide |
| 3555 | */ |
| 3556 | @SystemApi |
Jeff Sharkey | d86b8fe | 2017-06-02 17:36:26 -0600 | [diff] [blame] | 3557 | @RequiresPermission(android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS) |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3558 | public abstract void revokeRuntimePermission(@NonNull String packageName, |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3559 | @NonNull String permissionName, @NonNull UserHandle user); |
| 3560 | |
| 3561 | /** |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3562 | * Gets the state flags associated with a permission. |
| 3563 | * |
| 3564 | * @param permissionName The permission for which to get the flags. |
| 3565 | * @param packageName The package name for which to get the flags. |
| 3566 | * @param user The user for which to get permission flags. |
| 3567 | * @return The permission flags. |
| 3568 | * |
| 3569 | * @hide |
| 3570 | */ |
| 3571 | @SystemApi |
Jeff Sharkey | d86b8fe | 2017-06-02 17:36:26 -0600 | [diff] [blame] | 3572 | @RequiresPermission(anyOf = { |
| 3573 | android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS, |
| 3574 | android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS |
| 3575 | }) |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3576 | public abstract @PermissionFlags int getPermissionFlags(String permissionName, |
| 3577 | String packageName, @NonNull UserHandle user); |
| 3578 | |
| 3579 | /** |
| 3580 | * Updates the flags associated with a permission by replacing the flags in |
| 3581 | * the specified mask with the provided flag values. |
| 3582 | * |
| 3583 | * @param permissionName The permission for which to update the flags. |
| 3584 | * @param packageName The package name for which to update the flags. |
| 3585 | * @param flagMask The flags which to replace. |
| 3586 | * @param flagValues The flags with which to replace. |
| 3587 | * @param user The user for which to update the permission flags. |
| 3588 | * |
| 3589 | * @hide |
| 3590 | */ |
| 3591 | @SystemApi |
Jeff Sharkey | d86b8fe | 2017-06-02 17:36:26 -0600 | [diff] [blame] | 3592 | @RequiresPermission(anyOf = { |
| 3593 | android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS, |
| 3594 | android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS |
| 3595 | }) |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3596 | public abstract void updatePermissionFlags(String permissionName, |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3597 | String packageName, @PermissionFlags int flagMask, @PermissionFlags int flagValues, |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3598 | @NonNull UserHandle user); |
| 3599 | |
| 3600 | /** |
Svetoslav | 20770dd | 2015-05-29 15:43:04 -0700 | [diff] [blame] | 3601 | * Gets whether you should show UI with rationale for requesting a permission. |
| 3602 | * You should do this only if you do not have the permission and the context in |
| 3603 | * which the permission is requested does not clearly communicate to the user |
| 3604 | * what would be the benefit from grating this permission. |
| 3605 | * |
| 3606 | * @param permission A permission your app wants to request. |
| 3607 | * @return Whether you can show permission rationale UI. |
| 3608 | * |
| 3609 | * @hide |
| 3610 | */ |
| 3611 | public abstract boolean shouldShowRequestPermissionRationale(String permission); |
| 3612 | |
| 3613 | /** |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3614 | * Returns an {@link android.content.Intent} suitable for passing to |
| 3615 | * {@link android.app.Activity#startActivityForResult(android.content.Intent, int)} |
| 3616 | * which prompts the user to grant permissions to this application. |
| 3617 | * |
| 3618 | * @throws NullPointerException if {@code permissions} is {@code null} or empty. |
| 3619 | * |
| 3620 | * @hide |
| 3621 | */ |
| 3622 | public Intent buildRequestPermissionsIntent(@NonNull String[] permissions) { |
| 3623 | if (ArrayUtils.isEmpty(permissions)) { |
Svet Ganov | f66381c | 2016-02-18 20:02:36 -0800 | [diff] [blame] | 3624 | throw new IllegalArgumentException("permission cannot be null or empty"); |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3625 | } |
| 3626 | Intent intent = new Intent(ACTION_REQUEST_PERMISSIONS); |
| 3627 | intent.putExtra(EXTRA_REQUEST_PERMISSIONS_NAMES, permissions); |
Svet Ganov | f1b7f20 | 2015-07-29 08:33:42 -0700 | [diff] [blame] | 3628 | intent.setPackage(getPermissionControllerPackageName()); |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3629 | return intent; |
Nick Kralevich | 035f80d | 2013-03-27 15:20:08 -0700 | [diff] [blame] | 3630 | } |
| 3631 | |
| 3632 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3633 | * Compare the signatures of two packages to determine if the same |
| 3634 | * signature appears in both of them. If they do contain the same |
| 3635 | * signature, then they are allowed special privileges when working |
| 3636 | * with each other: they can share the same user-id, run instrumentation |
| 3637 | * against each other, etc. |
| 3638 | * |
| 3639 | * @param pkg1 First package name whose signature will be compared. |
| 3640 | * @param pkg2 Second package name whose signature will be compared. |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 3641 | * |
| 3642 | * @return Returns an integer indicating whether all signatures on the |
| 3643 | * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if |
| 3644 | * all signatures match or < 0 if there is not a match ({@link |
| 3645 | * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}). |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3646 | * |
Dianne Hackborn | 766cbfe | 2009-08-12 18:33:39 -0700 | [diff] [blame] | 3647 | * @see #checkSignatures(int, int) |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3648 | */ |
Tor Norbye | 1c2bf03 | 2015-03-02 10:57:08 -0800 | [diff] [blame] | 3649 | @CheckResult |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 3650 | public abstract @SignatureResult int checkSignatures(String pkg1, String pkg2); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3651 | |
| 3652 | /** |
Dianne Hackborn | 766cbfe | 2009-08-12 18:33:39 -0700 | [diff] [blame] | 3653 | * Like {@link #checkSignatures(String, String)}, but takes UIDs of |
| 3654 | * the two packages to be checked. This can be useful, for example, |
| 3655 | * when doing the check in an IPC, where the UID is the only identity |
| 3656 | * available. It is functionally identical to determining the package |
| 3657 | * associated with the UIDs and checking their signatures. |
| 3658 | * |
Joe Onorato | 25660ec | 2009-08-12 22:40:37 -0700 | [diff] [blame] | 3659 | * @param uid1 First UID whose signature will be compared. |
| 3660 | * @param uid2 Second UID whose signature will be compared. |
Dianne Hackborn | 766cbfe | 2009-08-12 18:33:39 -0700 | [diff] [blame] | 3661 | * |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 3662 | * @return Returns an integer indicating whether all signatures on the |
| 3663 | * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if |
| 3664 | * all signatures match or < 0 if there is not a match ({@link |
| 3665 | * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}). |
| 3666 | * |
| 3667 | * @see #checkSignatures(String, String) |
Dianne Hackborn | 766cbfe | 2009-08-12 18:33:39 -0700 | [diff] [blame] | 3668 | */ |
Tor Norbye | 1c2bf03 | 2015-03-02 10:57:08 -0800 | [diff] [blame] | 3669 | @CheckResult |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 3670 | public abstract @SignatureResult int checkSignatures(int uid1, int uid2); |
Dianne Hackborn | 766cbfe | 2009-08-12 18:33:39 -0700 | [diff] [blame] | 3671 | |
| 3672 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3673 | * Retrieve the names of all packages that are associated with a particular |
| 3674 | * user id. In most cases, this will be a single package name, the package |
| 3675 | * that has been assigned that user id. Where there are multiple packages |
| 3676 | * sharing the same user id through the "sharedUserId" mechanism, all |
| 3677 | * packages with that id will be returned. |
| 3678 | * |
| 3679 | * @param uid The user id for which you would like to retrieve the |
| 3680 | * associated packages. |
| 3681 | * |
| 3682 | * @return Returns an array of one or more packages assigned to the user |
| 3683 | * id, or null if there are no known packages with the given id. |
| 3684 | */ |
Jeff Sharkey | 377ded0f | 2016-01-10 13:15:41 -0700 | [diff] [blame] | 3685 | public abstract @Nullable String[] getPackagesForUid(int uid); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3686 | |
| 3687 | /** |
Michal Karpinski | cb67dc9 | 2016-12-13 18:20:23 +0000 | [diff] [blame] | 3688 | * Retrieve the official name associated with a uid. This name is |
Jonathan Basseri | 7ea3a33 | 2015-05-12 19:39:22 -0700 | [diff] [blame] | 3689 | * guaranteed to never change, though it is possible for the underlying |
Michal Karpinski | cb67dc9 | 2016-12-13 18:20:23 +0000 | [diff] [blame] | 3690 | * uid to be changed. That is, if you are storing information about |
| 3691 | * uids in persistent storage, you should use the string returned |
| 3692 | * by this function instead of the raw uid. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3693 | * |
Michal Karpinski | cb67dc9 | 2016-12-13 18:20:23 +0000 | [diff] [blame] | 3694 | * @param uid The uid for which you would like to retrieve a name. |
| 3695 | * @return Returns a unique name for the given uid, or null if the |
| 3696 | * uid is not currently assigned. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3697 | */ |
Jeff Sharkey | 377ded0f | 2016-01-10 13:15:41 -0700 | [diff] [blame] | 3698 | public abstract @Nullable String getNameForUid(int uid); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3699 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3700 | /** |
Todd Kennedy | 9da8b8a7 | 2017-07-25 15:38:39 -0700 | [diff] [blame] | 3701 | * Retrieves the official names associated with each given uid. |
| 3702 | * @see #getNameForUid(int) |
| 3703 | * |
| 3704 | * @hide |
| 3705 | */ |
| 3706 | public abstract @Nullable String[] getNamesForUids(int[] uids); |
| 3707 | |
| 3708 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3709 | * Return the user id associated with a shared user name. Multiple |
| 3710 | * applications can specify a shared user name in their manifest and thus |
| 3711 | * end up using a common uid. This might be used for new applications |
| 3712 | * that use an existing shared user name and need to know the uid of the |
| 3713 | * shared user. |
| 3714 | * |
| 3715 | * @param sharedUserName The shared user name whose uid is to be retrieved. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3716 | * @return Returns the UID associated with the shared user. |
| 3717 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3718 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3719 | * @hide |
| 3720 | */ |
| 3721 | public abstract int getUidForSharedUser(String sharedUserName) |
| 3722 | throws NameNotFoundException; |
| 3723 | |
| 3724 | /** |
| 3725 | * Return a List of all application packages that are installed on the |
| 3726 | * device. If flag GET_UNINSTALLED_PACKAGES has been set, a list of all |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3727 | * applications including those deleted with {@code DONT_DELETE_DATA} |
| 3728 | * (partially installed apps with data directory) will be returned. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3729 | * |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3730 | * @param flags Additional option flags to modify the data returned. |
| 3731 | * @return A List of ApplicationInfo objects, one for each installed |
| 3732 | * application. In the unlikely case there are no installed |
| 3733 | * packages, an empty list is returned. If flag |
| 3734 | * {@code MATCH_UNINSTALLED_PACKAGES} is set, the application |
| 3735 | * information is retrieved from the list of uninstalled |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 3736 | * applications (which includes installed applications as well as |
| 3737 | * applications with data directory i.e. applications which had been |
| 3738 | * deleted with {@code DONT_DELETE_DATA} flag set). |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3739 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3740 | public abstract List<ApplicationInfo> getInstalledApplications(@ApplicationInfoFlags int flags); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3741 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3742 | /** |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3743 | * Return a List of all application packages that are installed on the |
| 3744 | * device, for a specific user. If flag GET_UNINSTALLED_PACKAGES has been |
| 3745 | * set, a list of all applications including those deleted with |
| 3746 | * {@code DONT_DELETE_DATA} (partially installed apps with data directory) |
Bartosz Fabianowski | 1133424 | 2016-11-17 20:49:16 +0100 | [diff] [blame] | 3747 | * will be returned. |
| 3748 | * |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3749 | * @param flags Additional option flags to modify the data returned. |
| 3750 | * @param userId The user for whom the installed applications are to be |
| 3751 | * listed |
| 3752 | * @return A List of ApplicationInfo objects, one for each installed |
| 3753 | * application. In the unlikely case there are no installed |
| 3754 | * packages, an empty list is returned. If flag |
| 3755 | * {@code MATCH_UNINSTALLED_PACKAGES} is set, the application |
| 3756 | * information is retrieved from the list of uninstalled |
Bartosz Fabianowski | 1133424 | 2016-11-17 20:49:16 +0100 | [diff] [blame] | 3757 | * applications (which includes installed applications as well as |
| 3758 | * applications with data directory i.e. applications which had been |
| 3759 | * deleted with {@code DONT_DELETE_DATA} flag set). |
| 3760 | * @hide |
Bartosz Fabianowski | 1133424 | 2016-11-17 20:49:16 +0100 | [diff] [blame] | 3761 | */ |
| 3762 | public abstract List<ApplicationInfo> getInstalledApplicationsAsUser( |
| 3763 | @ApplicationInfoFlags int flags, @UserIdInt int userId); |
| 3764 | |
| 3765 | /** |
Jeff Sharkey | 910e081 | 2017-04-21 16:29:27 -0600 | [diff] [blame] | 3766 | * Gets the instant applications the user recently used. |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3767 | * |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3768 | * @return The instant app list. |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3769 | * |
| 3770 | * @hide |
| 3771 | */ |
Todd Kennedy | 9c9fdf2 | 2017-03-06 10:58:27 -0800 | [diff] [blame] | 3772 | @SystemApi |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3773 | @RequiresPermission(Manifest.permission.ACCESS_INSTANT_APPS) |
| 3774 | public abstract @NonNull List<InstantAppInfo> getInstantApps(); |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3775 | |
| 3776 | /** |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3777 | * Gets the icon for an instant application. |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3778 | * |
| 3779 | * @param packageName The app package name. |
| 3780 | * |
| 3781 | * @hide |
| 3782 | */ |
Todd Kennedy | 9c9fdf2 | 2017-03-06 10:58:27 -0800 | [diff] [blame] | 3783 | @SystemApi |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3784 | @RequiresPermission(Manifest.permission.ACCESS_INSTANT_APPS) |
| 3785 | public abstract @Nullable Drawable getInstantAppIcon(String packageName); |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3786 | |
| 3787 | /** |
David Christie | 31a1655 | 2017-03-01 15:08:45 -0800 | [diff] [blame] | 3788 | * Gets whether this application is an instant app. |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3789 | * |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3790 | * @return Whether caller is an instant app. |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3791 | * |
David Christie | 31a1655 | 2017-03-01 15:08:45 -0800 | [diff] [blame] | 3792 | * @see #isInstantApp(String) |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 3793 | * @see #updateInstantAppCookie(byte[]) |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3794 | * @see #getInstantAppCookie() |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 3795 | * @see #getInstantAppCookieMaxBytes() |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3796 | */ |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3797 | public abstract boolean isInstantApp(); |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3798 | |
| 3799 | /** |
David Christie | 31a1655 | 2017-03-01 15:08:45 -0800 | [diff] [blame] | 3800 | * Gets whether the given package is an instant app. |
| 3801 | * |
| 3802 | * @param packageName The package to check |
| 3803 | * @return Whether the given package is an instant app. |
| 3804 | * |
| 3805 | * @see #isInstantApp() |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 3806 | * @see #updateInstantAppCookie(byte[]) |
David Christie | 31a1655 | 2017-03-01 15:08:45 -0800 | [diff] [blame] | 3807 | * @see #getInstantAppCookie() |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 3808 | * @see #getInstantAppCookieMaxBytes() |
| 3809 | * @see #clearInstantAppCookie() |
David Christie | 31a1655 | 2017-03-01 15:08:45 -0800 | [diff] [blame] | 3810 | */ |
| 3811 | public abstract boolean isInstantApp(String packageName); |
| 3812 | |
| 3813 | /** |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3814 | * Gets the maximum size in bytes of the cookie data an instant app |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3815 | * can store on the device. |
| 3816 | * |
| 3817 | * @return The max cookie size in bytes. |
| 3818 | * |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3819 | * @see #isInstantApp() |
David Christie | 31a1655 | 2017-03-01 15:08:45 -0800 | [diff] [blame] | 3820 | * @see #isInstantApp(String) |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 3821 | * @see #updateInstantAppCookie(byte[]) |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3822 | * @see #getInstantAppCookie() |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 3823 | * @see #clearInstantAppCookie() |
| 3824 | */ |
| 3825 | public abstract int getInstantAppCookieMaxBytes(); |
| 3826 | |
| 3827 | /** |
Daniel Cashman | 5cdda34 | 2018-01-19 07:22:52 -0800 | [diff] [blame] | 3828 | * deprecated |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 3829 | * @hide |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3830 | */ |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3831 | public abstract int getInstantAppCookieMaxSize(); |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3832 | |
| 3833 | /** |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3834 | * Gets the instant application cookie for this app. Non |
| 3835 | * instant apps and apps that were instant but were upgraded |
| 3836 | * to normal apps can still access this API. For instant apps |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 3837 | * this cookie is cached for some time after uninstall while for |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3838 | * normal apps the cookie is deleted after the app is uninstalled. |
| 3839 | * The cookie is always present while the app is installed. |
| 3840 | * |
| 3841 | * @return The cookie. |
| 3842 | * |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3843 | * @see #isInstantApp() |
David Christie | 31a1655 | 2017-03-01 15:08:45 -0800 | [diff] [blame] | 3844 | * @see #isInstantApp(String) |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 3845 | * @see #updateInstantAppCookie(byte[]) |
| 3846 | * @see #getInstantAppCookieMaxBytes() |
| 3847 | * @see #clearInstantAppCookie() |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3848 | */ |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3849 | public abstract @NonNull byte[] getInstantAppCookie(); |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3850 | |
| 3851 | /** |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 3852 | * Clears the instant application cookie for the calling app. |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3853 | * |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3854 | * @see #isInstantApp() |
David Christie | 31a1655 | 2017-03-01 15:08:45 -0800 | [diff] [blame] | 3855 | * @see #isInstantApp(String) |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 3856 | * @see #getInstantAppCookieMaxBytes() |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3857 | * @see #getInstantAppCookie() |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 3858 | * @see #clearInstantAppCookie() |
| 3859 | */ |
| 3860 | public abstract void clearInstantAppCookie(); |
| 3861 | |
| 3862 | /** |
| 3863 | * Updates the instant application cookie for the calling app. Non |
| 3864 | * instant apps and apps that were instant but were upgraded |
| 3865 | * to normal apps can still access this API. For instant apps |
| 3866 | * this cookie is cached for some time after uninstall while for |
| 3867 | * normal apps the cookie is deleted after the app is uninstalled. |
| 3868 | * The cookie is always present while the app is installed. The |
| 3869 | * cookie size is limited by {@link #getInstantAppCookieMaxBytes()}. |
| 3870 | * Passing <code>null</code> or an empty array clears the cookie. |
| 3871 | * </p> |
| 3872 | * |
| 3873 | * @param cookie The cookie data. |
| 3874 | * |
| 3875 | * @see #isInstantApp() |
| 3876 | * @see #isInstantApp(String) |
| 3877 | * @see #getInstantAppCookieMaxBytes() |
| 3878 | * @see #getInstantAppCookie() |
| 3879 | * @see #clearInstantAppCookie() |
| 3880 | * |
| 3881 | * @throws IllegalArgumentException if the array exceeds max cookie size. |
| 3882 | */ |
| 3883 | public abstract void updateInstantAppCookie(@Nullable byte[] cookie); |
| 3884 | |
| 3885 | /** |
| 3886 | * @removed |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3887 | */ |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3888 | public abstract boolean setInstantAppCookie(@Nullable byte[] cookie); |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3889 | |
| 3890 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3891 | * Get a list of shared libraries that are available on the |
| 3892 | * system. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3893 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3894 | * @return An array of shared library names that are |
| 3895 | * available on the system, or null if none are installed. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3896 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3897 | */ |
| 3898 | public abstract String[] getSystemSharedLibraryNames(); |
| 3899 | |
| 3900 | /** |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 3901 | * Get a list of shared libraries on the device. |
| 3902 | * |
| 3903 | * @param flags To filter the libraries to return. |
| 3904 | * @return The shared library list. |
| 3905 | * |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 3906 | * @see #MATCH_UNINSTALLED_PACKAGES |
| 3907 | */ |
| 3908 | public abstract @NonNull List<SharedLibraryInfo> getSharedLibraries( |
| 3909 | @InstallFlags int flags); |
| 3910 | |
| 3911 | /** |
| 3912 | * Get a list of shared libraries on the device. |
| 3913 | * |
| 3914 | * @param flags To filter the libraries to return. |
| 3915 | * @param userId The user to query for. |
| 3916 | * @return The shared library list. |
| 3917 | * |
| 3918 | * @see #MATCH_FACTORY_ONLY |
| 3919 | * @see #MATCH_KNOWN_PACKAGES |
| 3920 | * @see #MATCH_ANY_USER |
| 3921 | * @see #MATCH_UNINSTALLED_PACKAGES |
| 3922 | * |
| 3923 | * @hide |
| 3924 | */ |
| 3925 | public abstract @NonNull List<SharedLibraryInfo> getSharedLibrariesAsUser( |
| 3926 | @InstallFlags int flags, @UserIdInt int userId); |
| 3927 | |
| 3928 | /** |
Svet Ganov | d7b1f411 | 2016-02-09 18:49:23 -0800 | [diff] [blame] | 3929 | * Get the name of the package hosting the services shared library. |
| 3930 | * |
| 3931 | * @return The library host package. |
| 3932 | * |
| 3933 | * @hide |
| 3934 | */ |
Svetoslav Ganov | a9c2500 | 2016-04-13 19:25:56 -0700 | [diff] [blame] | 3935 | public abstract @NonNull String getServicesSystemSharedLibraryPackageName(); |
| 3936 | |
| 3937 | /** |
| 3938 | * Get the name of the package hosting the shared components shared library. |
| 3939 | * |
| 3940 | * @return The library host package. |
| 3941 | * |
| 3942 | * @hide |
| 3943 | */ |
| 3944 | public abstract @NonNull String getSharedSystemSharedLibraryPackageName(); |
Svet Ganov | d7b1f411 | 2016-02-09 18:49:23 -0800 | [diff] [blame] | 3945 | |
| 3946 | /** |
Todd Kennedy | 9106c64 | 2017-02-08 14:16:53 -0800 | [diff] [blame] | 3947 | * Returns the names of the packages that have been changed |
| 3948 | * [eg. added, removed or updated] since the given sequence |
| 3949 | * number. |
| 3950 | * <p>If no packages have been changed, returns <code>null</code>. |
| 3951 | * <p>The sequence number starts at <code>0</code> and is |
| 3952 | * reset every boot. |
Todd Kennedy | 8fddf9d | 2017-04-17 15:16:12 -0700 | [diff] [blame] | 3953 | * @param sequenceNumber The first sequence number for which to retrieve package changes. |
| 3954 | * @see Settings.Global#BOOT_COUNT |
Todd Kennedy | 9106c64 | 2017-02-08 14:16:53 -0800 | [diff] [blame] | 3955 | */ |
| 3956 | public abstract @Nullable ChangedPackages getChangedPackages( |
| 3957 | @IntRange(from=0) int sequenceNumber); |
| 3958 | |
| 3959 | /** |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 3960 | * Get a list of features that are available on the |
| 3961 | * system. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3962 | * |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 3963 | * @return An array of FeatureInfo classes describing the features |
| 3964 | * that are available on the system, or null if there are none(!!). |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 3965 | */ |
| 3966 | public abstract FeatureInfo[] getSystemAvailableFeatures(); |
| 3967 | |
| 3968 | /** |
Jeff Sharkey | 115d2c1 | 2016-02-15 17:25:57 -0700 | [diff] [blame] | 3969 | * Check whether the given feature name is one of the available features as |
| 3970 | * returned by {@link #getSystemAvailableFeatures()}. This tests for the |
| 3971 | * presence of <em>any</em> version of the given feature name; use |
| 3972 | * {@link #hasSystemFeature(String, int)} to check for a minimum version. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3973 | * |
Jeff Sharkey | 115d2c1 | 2016-02-15 17:25:57 -0700 | [diff] [blame] | 3974 | * @return Returns true if the devices supports the feature, else false. |
Dianne Hackborn | 039c68e | 2009-09-26 16:39:23 -0700 | [diff] [blame] | 3975 | */ |
| 3976 | public abstract boolean hasSystemFeature(String name); |
| 3977 | |
| 3978 | /** |
Jeff Sharkey | 115d2c1 | 2016-02-15 17:25:57 -0700 | [diff] [blame] | 3979 | * Check whether the given feature name and version is one of the available |
| 3980 | * features as returned by {@link #getSystemAvailableFeatures()}. Since |
| 3981 | * features are defined to always be backwards compatible, this returns true |
| 3982 | * if the available feature version is greater than or equal to the |
| 3983 | * requested version. |
| 3984 | * |
| 3985 | * @return Returns true if the devices supports the feature, else false. |
| 3986 | */ |
| 3987 | public abstract boolean hasSystemFeature(String name, int version); |
| 3988 | |
| 3989 | /** |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 3990 | * Determine the best action to perform for a given Intent. This is how |
| 3991 | * {@link Intent#resolveActivity} finds an activity if a class has not been |
| 3992 | * explicitly specified. |
| 3993 | * <p> |
| 3994 | * <em>Note:</em> if using an implicit Intent (without an explicit |
| 3995 | * ComponentName specified), be sure to consider whether to set the |
| 3996 | * {@link #MATCH_DEFAULT_ONLY} only flag. You need to do so to resolve the |
| 3997 | * activity in the same way that |
| 3998 | * {@link android.content.Context#startActivity(Intent)} and |
Dianne Hackborn | 4d023d21 | 2010-10-01 13:41:04 -0700 | [diff] [blame] | 3999 | * {@link android.content.Intent#resolveActivity(PackageManager) |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4000 | * Intent.resolveActivity(PackageManager)} do. |
| 4001 | * </p> |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 4002 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4003 | * @param intent An intent containing all of the desired specification |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4004 | * (action, data, type, category, and/or component). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4005 | * @param flags Additional option flags to modify the data returned. The |
| 4006 | * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the |
| 4007 | * resolution to only those activities that support the |
| 4008 | * {@link android.content.Intent#CATEGORY_DEFAULT}. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 4009 | * @return Returns a ResolveInfo object containing the final activity intent |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4010 | * that was determined to be the best action. Returns null if no |
Mike LeBeau | bd3f527 | 2010-02-18 19:27:17 -0800 | [diff] [blame] | 4011 | * matching activity was found. If multiple matching activities are |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 4012 | * found and there is no default set, returns a ResolveInfo object |
Mike LeBeau | bd3f527 | 2010-02-18 19:27:17 -0800 | [diff] [blame] | 4013 | * containing something else, such as the activity resolver. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4014 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4015 | public abstract ResolveInfo resolveActivity(Intent intent, @ResolveInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4016 | |
| 4017 | /** |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4018 | * Determine the best action to perform for a given Intent for a given user. |
| 4019 | * This is how {@link Intent#resolveActivity} finds an activity if a class |
| 4020 | * has not been explicitly specified. |
| 4021 | * <p> |
| 4022 | * <em>Note:</em> if using an implicit Intent (without an explicit |
| 4023 | * ComponentName specified), be sure to consider whether to set the |
| 4024 | * {@link #MATCH_DEFAULT_ONLY} only flag. You need to do so to resolve the |
| 4025 | * activity in the same way that |
| 4026 | * {@link android.content.Context#startActivity(Intent)} and |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4027 | * {@link android.content.Intent#resolveActivity(PackageManager) |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4028 | * Intent.resolveActivity(PackageManager)} do. |
| 4029 | * </p> |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4030 | * |
| 4031 | * @param intent An intent containing all of the desired specification |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4032 | * (action, data, type, category, and/or component). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4033 | * @param flags Additional option flags to modify the data returned. The |
| 4034 | * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the |
| 4035 | * resolution to only those activities that support the |
| 4036 | * {@link android.content.Intent#CATEGORY_DEFAULT}. |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4037 | * @param userId The user id. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 4038 | * @return Returns a ResolveInfo object containing the final activity intent |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4039 | * that was determined to be the best action. Returns null if no |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4040 | * matching activity was found. If multiple matching activities are |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 4041 | * found and there is no default set, returns a ResolveInfo object |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4042 | * containing something else, such as the activity resolver. |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4043 | * @hide |
| 4044 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4045 | public abstract ResolveInfo resolveActivityAsUser(Intent intent, @ResolveInfoFlags int flags, |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 4046 | @UserIdInt int userId); |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4047 | |
| 4048 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4049 | * Retrieve all activities that can be performed for the given intent. |
| 4050 | * |
| 4051 | * @param intent The desired intent as per resolveActivity(). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4052 | * @param flags Additional option flags to modify the data returned. The |
| 4053 | * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the |
| 4054 | * resolution to only those activities that support the |
| 4055 | * {@link android.content.Intent#CATEGORY_DEFAULT}. Or, set |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4056 | * {@link #MATCH_ALL} to prevent any filtering of the results. |
| 4057 | * @return Returns a List of ResolveInfo objects containing one entry for |
| 4058 | * each matching activity, ordered from best to worst. In other |
| 4059 | * words, the first item is what would be returned by |
| 4060 | * {@link #resolveActivity}. If there are no matching activities, an |
| 4061 | * empty list is returned. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4062 | */ |
| 4063 | public abstract List<ResolveInfo> queryIntentActivities(Intent intent, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4064 | @ResolveInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4065 | |
| 4066 | /** |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4067 | * Retrieve all activities that can be performed for the given intent, for a |
| 4068 | * specific user. |
Amith Yamasani | 151ec4c | 2012-09-07 19:25:16 -0700 | [diff] [blame] | 4069 | * |
| 4070 | * @param intent The desired intent as per resolveActivity(). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4071 | * @param flags Additional option flags to modify the data returned. The |
| 4072 | * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the |
| 4073 | * resolution to only those activities that support the |
| 4074 | * {@link android.content.Intent#CATEGORY_DEFAULT}. Or, set |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4075 | * {@link #MATCH_ALL} to prevent any filtering of the results. |
| 4076 | * @return Returns a List of ResolveInfo objects containing one entry for |
| 4077 | * each matching activity, ordered from best to worst. In other |
| 4078 | * words, the first item is what would be returned by |
| 4079 | * {@link #resolveActivity}. If there are no matching activities, an |
| 4080 | * empty list is returned. |
Amith Yamasani | 151ec4c | 2012-09-07 19:25:16 -0700 | [diff] [blame] | 4081 | * @hide |
| 4082 | */ |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4083 | public abstract List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent, |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 4084 | @ResolveInfoFlags int flags, @UserIdInt int userId); |
Amith Yamasani | 151ec4c | 2012-09-07 19:25:16 -0700 | [diff] [blame] | 4085 | |
| 4086 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4087 | * Retrieve a set of activities that should be presented to the user as |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4088 | * similar options. This is like {@link #queryIntentActivities}, except it |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4089 | * also allows you to supply a list of more explicit Intents that you would |
| 4090 | * like to resolve to particular options, and takes care of returning the |
| 4091 | * final ResolveInfo list in a reasonable order, with no duplicates, based |
| 4092 | * on those inputs. |
| 4093 | * |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4094 | * @param caller The class name of the activity that is making the request. |
| 4095 | * This activity will never appear in the output list. Can be |
| 4096 | * null. |
| 4097 | * @param specifics An array of Intents that should be resolved to the first |
| 4098 | * specific results. Can be null. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4099 | * @param intent The desired intent as per resolveActivity(). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4100 | * @param flags Additional option flags to modify the data returned. The |
| 4101 | * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the |
| 4102 | * resolution to only those activities that support the |
| 4103 | * {@link android.content.Intent#CATEGORY_DEFAULT}. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4104 | * @return Returns a List of ResolveInfo objects containing one entry for |
| 4105 | * each matching activity. The list is ordered first by all of the |
| 4106 | * intents resolved in <var>specifics</var> and then any additional |
| 4107 | * activities that can handle <var>intent</var> but did not get |
| 4108 | * included by one of the <var>specifics</var> intents. If there are |
| 4109 | * no matching activities, an empty list is returned. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4110 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 4111 | public abstract List<ResolveInfo> queryIntentActivityOptions(@Nullable ComponentName caller, |
| 4112 | @Nullable Intent[] specifics, Intent intent, @ResolveInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4113 | |
| 4114 | /** |
| 4115 | * Retrieve all receivers that can handle a broadcast of the given intent. |
| 4116 | * |
| 4117 | * @param intent The desired intent as per resolveActivity(). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4118 | * @param flags Additional option flags to modify the data returned. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4119 | * @return Returns a List of ResolveInfo objects containing one entry for |
| 4120 | * each matching receiver, ordered from best to worst. If there are |
| 4121 | * no matching receivers, an empty list or null is returned. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4122 | */ |
| 4123 | public abstract List<ResolveInfo> queryBroadcastReceivers(Intent intent, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4124 | @ResolveInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4125 | |
| 4126 | /** |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4127 | * Retrieve all receivers that can handle a broadcast of the given intent, |
| 4128 | * for a specific user. |
Amith Yamasani | f203aee | 2012-08-29 18:41:53 -0700 | [diff] [blame] | 4129 | * |
| 4130 | * @param intent The desired intent as per resolveActivity(). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4131 | * @param flags Additional option flags to modify the data returned. |
Fyodor Kupolov | 940e857 | 2016-01-26 12:03:51 -0800 | [diff] [blame] | 4132 | * @param userHandle UserHandle of the user being queried. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4133 | * @return Returns a List of ResolveInfo objects containing one entry for |
| 4134 | * each matching receiver, ordered from best to worst. If there are |
| 4135 | * no matching receivers, an empty list or null is returned. |
Amith Yamasani | f203aee | 2012-08-29 18:41:53 -0700 | [diff] [blame] | 4136 | * @hide |
| 4137 | */ |
Fyodor Kupolov | 940e857 | 2016-01-26 12:03:51 -0800 | [diff] [blame] | 4138 | @SystemApi |
Todd Kennedy | dbaef6d | 2017-07-24 11:28:00 -0700 | [diff] [blame] | 4139 | @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS) |
Fyodor Kupolov | 940e857 | 2016-01-26 12:03:51 -0800 | [diff] [blame] | 4140 | public List<ResolveInfo> queryBroadcastReceiversAsUser(Intent intent, |
| 4141 | @ResolveInfoFlags int flags, UserHandle userHandle) { |
| 4142 | return queryBroadcastReceiversAsUser(intent, flags, userHandle.getIdentifier()); |
| 4143 | } |
| 4144 | |
| 4145 | /** |
| 4146 | * @hide |
| 4147 | */ |
Jeff Sharkey | e06b4d1 | 2016-01-06 14:51:50 -0700 | [diff] [blame] | 4148 | public abstract List<ResolveInfo> queryBroadcastReceiversAsUser(Intent intent, |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 4149 | @ResolveInfoFlags int flags, @UserIdInt int userId); |
Amith Yamasani | f203aee | 2012-08-29 18:41:53 -0700 | [diff] [blame] | 4150 | |
Fyodor Kupolov | 940e857 | 2016-01-26 12:03:51 -0800 | [diff] [blame] | 4151 | |
Jeff Sharkey | bd94022 | 2016-01-08 11:07:13 -0700 | [diff] [blame] | 4152 | /** {@hide} */ |
| 4153 | @Deprecated |
| 4154 | public List<ResolveInfo> queryBroadcastReceivers(Intent intent, |
| 4155 | @ResolveInfoFlags int flags, @UserIdInt int userId) { |
Jeff Sharkey | 6f4b2a3 | 2017-03-21 14:13:41 -0600 | [diff] [blame] | 4156 | final String msg = "Shame on you for calling the hidden API " |
| 4157 | + "queryBroadcastReceivers(). Shame!"; |
| 4158 | if (VMRuntime.getRuntime().getTargetSdkVersion() >= Build.VERSION_CODES.O) { |
| 4159 | throw new UnsupportedOperationException(msg); |
| 4160 | } else { |
| 4161 | Log.d(TAG, msg); |
| 4162 | return queryBroadcastReceiversAsUser(intent, flags, userId); |
| 4163 | } |
Jeff Sharkey | bd94022 | 2016-01-08 11:07:13 -0700 | [diff] [blame] | 4164 | } |
| 4165 | |
Amith Yamasani | f203aee | 2012-08-29 18:41:53 -0700 | [diff] [blame] | 4166 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4167 | * Determine the best service to handle for a given Intent. |
| 4168 | * |
| 4169 | * @param intent An intent containing all of the desired specification |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4170 | * (action, data, type, category, and/or component). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4171 | * @param flags Additional option flags to modify the data returned. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 4172 | * @return Returns a ResolveInfo object containing the final service intent |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4173 | * that was determined to be the best action. Returns null if no |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4174 | * matching service was found. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4175 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4176 | public abstract ResolveInfo resolveService(Intent intent, @ResolveInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4177 | |
| 4178 | /** |
| 4179 | * Retrieve all services that can match the given intent. |
| 4180 | * |
| 4181 | * @param intent The desired intent as per resolveService(). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4182 | * @param flags Additional option flags to modify the data returned. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4183 | * @return Returns a List of ResolveInfo objects containing one entry for |
| 4184 | * each matching service, ordered from best to worst. In other |
| 4185 | * words, the first item is what would be returned by |
| 4186 | * {@link #resolveService}. If there are no matching services, an |
| 4187 | * empty list or null is returned. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4188 | */ |
| 4189 | public abstract List<ResolveInfo> queryIntentServices(Intent intent, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4190 | @ResolveInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4191 | |
| 4192 | /** |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4193 | * Retrieve all services that can match the given intent for a given user. |
| 4194 | * |
| 4195 | * @param intent The desired intent as per resolveService(). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4196 | * @param flags Additional option flags to modify the data returned. |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4197 | * @param userId The user id. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4198 | * @return Returns a List of ResolveInfo objects containing one entry for |
| 4199 | * each matching service, ordered from best to worst. In other |
| 4200 | * words, the first item is what would be returned by |
| 4201 | * {@link #resolveService}. If there are no matching services, an |
| 4202 | * empty list or null is returned. |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4203 | * @hide |
| 4204 | */ |
| 4205 | public abstract List<ResolveInfo> queryIntentServicesAsUser(Intent intent, |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 4206 | @ResolveInfoFlags int flags, @UserIdInt int userId); |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4207 | |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 4208 | /** |
| 4209 | * Retrieve all providers that can match the given intent. |
| 4210 | * |
| 4211 | * @param intent An intent containing all of the desired specification |
| 4212 | * (action, data, type, category, and/or component). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4213 | * @param flags Additional option flags to modify the data returned. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 4214 | * @param userId The user id. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4215 | * @return Returns a List of ResolveInfo objects containing one entry for |
| 4216 | * each matching provider, ordered from best to worst. If there are |
| 4217 | * no matching services, an empty list or null is returned. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 4218 | * @hide |
| 4219 | */ |
Jeff Sharkey | 85f5f81 | 2013-10-07 10:16:12 -0700 | [diff] [blame] | 4220 | public abstract List<ResolveInfo> queryIntentContentProvidersAsUser( |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 4221 | Intent intent, @ResolveInfoFlags int flags, @UserIdInt int userId); |
Jeff Sharkey | 85f5f81 | 2013-10-07 10:16:12 -0700 | [diff] [blame] | 4222 | |
| 4223 | /** |
| 4224 | * Retrieve all providers that can match the given intent. |
| 4225 | * |
| 4226 | * @param intent An intent containing all of the desired specification |
| 4227 | * (action, data, type, category, and/or component). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4228 | * @param flags Additional option flags to modify the data returned. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4229 | * @return Returns a List of ResolveInfo objects containing one entry for |
| 4230 | * each matching provider, ordered from best to worst. If there are |
| 4231 | * no matching services, an empty list or null is returned. |
Jeff Sharkey | 85f5f81 | 2013-10-07 10:16:12 -0700 | [diff] [blame] | 4232 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4233 | public abstract List<ResolveInfo> queryIntentContentProviders(Intent intent, |
| 4234 | @ResolveInfoFlags int flags); |
Jeff Sharkey | 85f5f81 | 2013-10-07 10:16:12 -0700 | [diff] [blame] | 4235 | |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4236 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4237 | * Find a single content provider by its base path name. |
| 4238 | * |
| 4239 | * @param name The name of the provider to find. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4240 | * @param flags Additional option flags to modify the data returned. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4241 | * @return A {@link ProviderInfo} object containing information about the |
| 4242 | * provider. If a provider was not found, returns null. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4243 | */ |
| 4244 | public abstract ProviderInfo resolveContentProvider(String name, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4245 | @ComponentInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4246 | |
| 4247 | /** |
Alexandra Gherghina | 0363c3e | 2014-06-23 13:34:59 +0100 | [diff] [blame] | 4248 | * Find a single content provider by its base path name. |
| 4249 | * |
| 4250 | * @param name The name of the provider to find. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4251 | * @param flags Additional option flags to modify the data returned. |
Alexandra Gherghina | 0363c3e | 2014-06-23 13:34:59 +0100 | [diff] [blame] | 4252 | * @param userId The user id. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4253 | * @return A {@link ProviderInfo} object containing information about the |
| 4254 | * provider. If a provider was not found, returns null. |
Alexandra Gherghina | 0363c3e | 2014-06-23 13:34:59 +0100 | [diff] [blame] | 4255 | * @hide |
| 4256 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4257 | public abstract ProviderInfo resolveContentProviderAsUser(String name, |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 4258 | @ComponentInfoFlags int flags, @UserIdInt int userId); |
Alexandra Gherghina | 0363c3e | 2014-06-23 13:34:59 +0100 | [diff] [blame] | 4259 | |
| 4260 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4261 | * Retrieve content provider information. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4262 | * <p> |
| 4263 | * <em>Note: unlike most other methods, an empty result set is indicated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4264 | * by a null return instead of an empty list.</em> |
| 4265 | * |
| 4266 | * @param processName If non-null, limits the returned providers to only |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4267 | * those that are hosted by the given process. If null, all |
| 4268 | * content providers are returned. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4269 | * @param uid If <var>processName</var> is non-null, this is the required |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4270 | * uid owning the requested content providers. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4271 | * @param flags Additional option flags to modify the data returned. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 4272 | * @return A list of {@link ProviderInfo} objects containing one entry for |
| 4273 | * each provider either matching <var>processName</var> or, if |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4274 | * <var>processName</var> is null, all known content providers. |
| 4275 | * <em>If there are no matching providers, null is returned.</em> |
| 4276 | */ |
| 4277 | public abstract List<ProviderInfo> queryContentProviders( |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4278 | String processName, int uid, @ComponentInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4279 | |
| 4280 | /** |
Makoto Onuki | 3275729 | 2017-02-22 14:36:59 -0800 | [diff] [blame] | 4281 | * Same as {@link #queryContentProviders}, except when {@code metaDataKey} is not null, |
| 4282 | * it only returns providers which have metadata with the {@code metaDataKey} key. |
| 4283 | * |
| 4284 | * <p>DO NOT USE the {@code metaDataKey} parameter, unless you're the contacts provider. |
| 4285 | * You really shouldn't need it. Other apps should use {@link #queryIntentContentProviders} |
| 4286 | * instead. |
| 4287 | * |
| 4288 | * <p>The {@code metaDataKey} parameter was added to allow the contacts provider to quickly |
| 4289 | * scan the GAL providers on the device. Unfortunately the discovery protocol used metadata |
| 4290 | * to mark GAL providers, rather than intent filters, so we can't use |
| 4291 | * {@link #queryIntentContentProviders} for that. |
| 4292 | * |
| 4293 | * @hide |
| 4294 | */ |
| 4295 | public List<ProviderInfo> queryContentProviders( |
| 4296 | String processName, int uid, @ComponentInfoFlags int flags, String metaDataKey) { |
| 4297 | // Provide the default implementation for mocks. |
| 4298 | return queryContentProviders(processName, uid, flags); |
| 4299 | } |
| 4300 | |
| 4301 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4302 | * Retrieve all of the information we know about a particular |
| 4303 | * instrumentation class. |
| 4304 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4305 | * @param className The full name (i.e. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4306 | * com.google.apps.contacts.InstrumentList) of an Instrumentation |
| 4307 | * class. |
| 4308 | * @param flags Additional option flags to modify the data returned. |
| 4309 | * @return An {@link InstrumentationInfo} object containing information |
| 4310 | * about the instrumentation. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 4311 | * @throws NameNotFoundException if a package with the given name cannot be |
| 4312 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4313 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4314 | public abstract InstrumentationInfo getInstrumentationInfo(ComponentName className, |
| 4315 | @InstrumentationInfoFlags int flags) throws NameNotFoundException; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4316 | |
| 4317 | /** |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4318 | * Retrieve information about available instrumentation code. May be used to |
| 4319 | * retrieve either all instrumentation code, or only the code targeting a |
| 4320 | * particular package. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4321 | * |
| 4322 | * @param targetPackage If null, all instrumentation is returned; only the |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4323 | * instrumentation targeting this package name is returned. |
| 4324 | * @param flags Additional option flags to modify the data returned. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 4325 | * @return A list of {@link InstrumentationInfo} objects containing one |
| 4326 | * entry for each matching instrumentation. If there are no |
Jesse Hall | f77a34f | 2016-02-04 18:41:33 -0800 | [diff] [blame] | 4327 | * instrumentation available, returns an empty list. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4328 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4329 | public abstract List<InstrumentationInfo> queryInstrumentation(String targetPackage, |
| 4330 | @InstrumentationInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4331 | |
| 4332 | /** |
| 4333 | * Retrieve an image from a package. This is a low-level API used by |
| 4334 | * the various package manager info structures (such as |
| 4335 | * {@link ComponentInfo} to implement retrieval of their associated |
| 4336 | * icon. |
| 4337 | * |
| 4338 | * @param packageName The name of the package that this icon is coming from. |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4339 | * Cannot be null. |
| 4340 | * @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] | 4341 | * @param appInfo Overall information about <var>packageName</var>. This |
| 4342 | * may be null, in which case the application information will be retrieved |
| 4343 | * for you if needed; if you already have this information around, it can |
| 4344 | * be much more efficient to supply it here. |
| 4345 | * |
| 4346 | * @return Returns a Drawable holding the requested image. Returns null if |
| 4347 | * an image could not be found for any reason. |
| 4348 | */ |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 4349 | public abstract Drawable getDrawable(String packageName, @DrawableRes int resid, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4350 | ApplicationInfo appInfo); |
| 4351 | |
| 4352 | /** |
| 4353 | * Retrieve the icon associated with an activity. Given the full name of |
| 4354 | * an activity, retrieves the information about it and calls |
| 4355 | * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its icon. |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4356 | * If the activity cannot be found, NameNotFoundException is thrown. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4357 | * |
| 4358 | * @param activityName Name of the activity whose icon is to be retrieved. |
| 4359 | * |
| 4360 | * @return Returns the image of the icon, or the default activity icon if |
| 4361 | * it could not be found. Does not return null. |
| 4362 | * @throws NameNotFoundException Thrown if the resources for the given |
| 4363 | * activity could not be loaded. |
| 4364 | * |
| 4365 | * @see #getActivityIcon(Intent) |
| 4366 | */ |
| 4367 | public abstract Drawable getActivityIcon(ComponentName activityName) |
| 4368 | throws NameNotFoundException; |
| 4369 | |
| 4370 | /** |
| 4371 | * Retrieve the icon associated with an Intent. If intent.getClassName() is |
| 4372 | * set, this simply returns the result of |
| 4373 | * getActivityIcon(intent.getClassName()). Otherwise it resolves the intent's |
| 4374 | * component and returns the icon associated with the resolved component. |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4375 | * 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] | 4376 | * to a component, NameNotFoundException is thrown. |
| 4377 | * |
| 4378 | * @param intent The intent for which you would like to retrieve an icon. |
| 4379 | * |
| 4380 | * @return Returns the image of the icon, or the default activity icon if |
| 4381 | * it could not be found. Does not return null. |
| 4382 | * @throws NameNotFoundException Thrown if the resources for application |
| 4383 | * matching the given intent could not be loaded. |
| 4384 | * |
| 4385 | * @see #getActivityIcon(ComponentName) |
| 4386 | */ |
| 4387 | public abstract Drawable getActivityIcon(Intent intent) |
| 4388 | throws NameNotFoundException; |
| 4389 | |
| 4390 | /** |
Jose Lima | f78e312 | 2014-03-06 12:13:15 -0800 | [diff] [blame] | 4391 | * Retrieve the banner associated with an activity. Given the full name of |
| 4392 | * an activity, retrieves the information about it and calls |
| 4393 | * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its |
| 4394 | * banner. If the activity cannot be found, NameNotFoundException is thrown. |
| 4395 | * |
| 4396 | * @param activityName Name of the activity whose banner is to be retrieved. |
| 4397 | * @return Returns the image of the banner, or null if the activity has no |
| 4398 | * banner specified. |
| 4399 | * @throws NameNotFoundException Thrown if the resources for the given |
| 4400 | * activity could not be loaded. |
| 4401 | * @see #getActivityBanner(Intent) |
| 4402 | */ |
| 4403 | public abstract Drawable getActivityBanner(ComponentName activityName) |
| 4404 | throws NameNotFoundException; |
| 4405 | |
| 4406 | /** |
| 4407 | * Retrieve the banner associated with an Intent. If intent.getClassName() |
| 4408 | * is set, this simply returns the result of |
| 4409 | * getActivityBanner(intent.getClassName()). Otherwise it resolves the |
| 4410 | * intent's component and returns the banner associated with the resolved |
| 4411 | * component. If intent.getClassName() cannot be found or the Intent cannot |
| 4412 | * be resolved to a component, NameNotFoundException is thrown. |
| 4413 | * |
| 4414 | * @param intent The intent for which you would like to retrieve a banner. |
| 4415 | * @return Returns the image of the banner, or null if the activity has no |
| 4416 | * banner specified. |
| 4417 | * @throws NameNotFoundException Thrown if the resources for application |
| 4418 | * matching the given intent could not be loaded. |
| 4419 | * @see #getActivityBanner(ComponentName) |
| 4420 | */ |
| 4421 | public abstract Drawable getActivityBanner(Intent intent) |
| 4422 | throws NameNotFoundException; |
| 4423 | |
| 4424 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4425 | * Return the generic icon for an activity that is used when no specific |
| 4426 | * icon is defined. |
Adam Connors | 23cc04e | 2014-04-01 12:12:20 +0100 | [diff] [blame] | 4427 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4428 | * @return Drawable Image of the icon. |
| 4429 | */ |
| 4430 | public abstract Drawable getDefaultActivityIcon(); |
| 4431 | |
| 4432 | /** |
| 4433 | * Retrieve the icon associated with an application. If it has not defined |
| 4434 | * an icon, the default app icon is returned. Does not return null. |
| 4435 | * |
| 4436 | * @param info Information about application being queried. |
| 4437 | * |
| 4438 | * @return Returns the image of the icon, or the default application icon |
| 4439 | * if it could not be found. |
| 4440 | * |
| 4441 | * @see #getApplicationIcon(String) |
| 4442 | */ |
| 4443 | public abstract Drawable getApplicationIcon(ApplicationInfo info); |
| 4444 | |
| 4445 | /** |
| 4446 | * Retrieve the icon associated with an application. Given the name of the |
| 4447 | * application's package, retrieves the information about it and calls |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4448 | * 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] | 4449 | * found, NameNotFoundException is thrown. |
| 4450 | * |
| 4451 | * @param packageName Name of the package whose application icon is to be |
| 4452 | * retrieved. |
| 4453 | * |
| 4454 | * @return Returns the image of the icon, or the default application icon |
| 4455 | * if it could not be found. Does not return null. |
| 4456 | * @throws NameNotFoundException Thrown if the resources for the given |
| 4457 | * application could not be loaded. |
| 4458 | * |
| 4459 | * @see #getApplicationIcon(ApplicationInfo) |
| 4460 | */ |
| 4461 | public abstract Drawable getApplicationIcon(String packageName) |
| 4462 | throws NameNotFoundException; |
| 4463 | |
| 4464 | /** |
Jose Lima | f78e312 | 2014-03-06 12:13:15 -0800 | [diff] [blame] | 4465 | * Retrieve the banner associated with an application. |
| 4466 | * |
| 4467 | * @param info Information about application being queried. |
| 4468 | * @return Returns the image of the banner or null if the application has no |
| 4469 | * banner specified. |
| 4470 | * @see #getApplicationBanner(String) |
| 4471 | */ |
| 4472 | public abstract Drawable getApplicationBanner(ApplicationInfo info); |
| 4473 | |
| 4474 | /** |
| 4475 | * Retrieve the banner associated with an application. Given the name of the |
| 4476 | * application's package, retrieves the information about it and calls |
| 4477 | * getApplicationIcon() to return its banner. If the application cannot be |
| 4478 | * found, NameNotFoundException is thrown. |
| 4479 | * |
| 4480 | * @param packageName Name of the package whose application banner is to be |
| 4481 | * retrieved. |
| 4482 | * @return Returns the image of the banner or null if the application has no |
| 4483 | * banner specified. |
| 4484 | * @throws NameNotFoundException Thrown if the resources for the given |
| 4485 | * application could not be loaded. |
| 4486 | * @see #getApplicationBanner(ApplicationInfo) |
| 4487 | */ |
| 4488 | public abstract Drawable getApplicationBanner(String packageName) |
| 4489 | throws NameNotFoundException; |
| 4490 | |
| 4491 | /** |
| 4492 | * Retrieve the logo associated with an activity. Given the full name of an |
| 4493 | * activity, retrieves the information about it and calls |
| 4494 | * {@link ComponentInfo#loadLogo ComponentInfo.loadLogo()} to return its |
| 4495 | * logo. If the activity cannot be found, NameNotFoundException is thrown. |
Adam Powell | 81cd2e9 | 2010-04-21 16:35:18 -0700 | [diff] [blame] | 4496 | * |
| 4497 | * @param activityName Name of the activity whose logo is to be retrieved. |
Jose Lima | f78e312 | 2014-03-06 12:13:15 -0800 | [diff] [blame] | 4498 | * @return Returns the image of the logo or null if the activity has no logo |
| 4499 | * specified. |
Adam Powell | 81cd2e9 | 2010-04-21 16:35:18 -0700 | [diff] [blame] | 4500 | * @throws NameNotFoundException Thrown if the resources for the given |
Jose Lima | f78e312 | 2014-03-06 12:13:15 -0800 | [diff] [blame] | 4501 | * activity could not be loaded. |
Adam Powell | 81cd2e9 | 2010-04-21 16:35:18 -0700 | [diff] [blame] | 4502 | * @see #getActivityLogo(Intent) |
| 4503 | */ |
| 4504 | public abstract Drawable getActivityLogo(ComponentName activityName) |
| 4505 | throws NameNotFoundException; |
| 4506 | |
| 4507 | /** |
| 4508 | * Retrieve the logo associated with an Intent. If intent.getClassName() is |
| 4509 | * set, this simply returns the result of |
| 4510 | * getActivityLogo(intent.getClassName()). Otherwise it resolves the intent's |
| 4511 | * component and returns the logo associated with the resolved component. |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4512 | * If intent.getClassName() cannot be found or the Intent cannot be resolved |
Adam Powell | 81cd2e9 | 2010-04-21 16:35:18 -0700 | [diff] [blame] | 4513 | * to a component, NameNotFoundException is thrown. |
| 4514 | * |
| 4515 | * @param intent The intent for which you would like to retrieve a logo. |
| 4516 | * |
| 4517 | * @return Returns the image of the logo, or null if the activity has no |
| 4518 | * logo specified. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 4519 | * |
Adam Powell | 81cd2e9 | 2010-04-21 16:35:18 -0700 | [diff] [blame] | 4520 | * @throws NameNotFoundException Thrown if the resources for application |
| 4521 | * matching the given intent could not be loaded. |
| 4522 | * |
| 4523 | * @see #getActivityLogo(ComponentName) |
| 4524 | */ |
| 4525 | public abstract Drawable getActivityLogo(Intent intent) |
| 4526 | throws NameNotFoundException; |
| 4527 | |
| 4528 | /** |
| 4529 | * Retrieve the logo associated with an application. If it has not specified |
| 4530 | * a logo, this method returns null. |
| 4531 | * |
| 4532 | * @param info Information about application being queried. |
| 4533 | * |
| 4534 | * @return Returns the image of the logo, or null if no logo is specified |
| 4535 | * by the application. |
| 4536 | * |
| 4537 | * @see #getApplicationLogo(String) |
| 4538 | */ |
| 4539 | public abstract Drawable getApplicationLogo(ApplicationInfo info); |
| 4540 | |
| 4541 | /** |
| 4542 | * Retrieve the logo associated with an application. Given the name of the |
| 4543 | * application's package, retrieves the information about it and calls |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4544 | * getApplicationLogo() to return its logo. If the application cannot be |
Adam Powell | 81cd2e9 | 2010-04-21 16:35:18 -0700 | [diff] [blame] | 4545 | * found, NameNotFoundException is thrown. |
| 4546 | * |
| 4547 | * @param packageName Name of the package whose application logo is to be |
| 4548 | * retrieved. |
| 4549 | * |
| 4550 | * @return Returns the image of the logo, or null if no application logo |
| 4551 | * has been specified. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 4552 | * |
Adam Powell | 81cd2e9 | 2010-04-21 16:35:18 -0700 | [diff] [blame] | 4553 | * @throws NameNotFoundException Thrown if the resources for the given |
| 4554 | * application could not be loaded. |
| 4555 | * |
| 4556 | * @see #getApplicationLogo(ApplicationInfo) |
| 4557 | */ |
| 4558 | public abstract Drawable getApplicationLogo(String packageName) |
| 4559 | throws NameNotFoundException; |
| 4560 | |
| 4561 | /** |
Tony Mak | 4dc008c | 2016-03-16 10:46:49 +0000 | [diff] [blame] | 4562 | * If the target user is a managed profile, then this returns a badged copy of the given icon |
| 4563 | * to be able to distinguish it from the original icon. For badging an arbitrary drawable use |
Kenny Guy | df77d71 | 2015-05-29 17:02:22 +0100 | [diff] [blame] | 4564 | * {@link #getUserBadgedDrawableForDensity( |
Svetoslav | c7d62f0 | 2014-09-04 15:39:54 -0700 | [diff] [blame] | 4565 | * android.graphics.drawable.Drawable, UserHandle, android.graphics.Rect, int)}. |
| 4566 | * <p> |
| 4567 | * If the original drawable is a BitmapDrawable and the backing bitmap is |
| 4568 | * mutable as per {@link android.graphics.Bitmap#isMutable()}, the badging |
| 4569 | * is performed in place and the original drawable is returned. |
| 4570 | * </p> |
| 4571 | * |
| 4572 | * @param icon The icon to badge. |
| 4573 | * @param user The target user. |
| 4574 | * @return A drawable that combines the original icon and a badge as |
| 4575 | * determined by the system. |
| 4576 | */ |
| 4577 | public abstract Drawable getUserBadgedIcon(Drawable icon, UserHandle user); |
| 4578 | |
| 4579 | /** |
| 4580 | * If the target user is a managed profile of the calling user or the caller |
| 4581 | * is itself a managed profile, then this returns a badged copy of the given |
| 4582 | * drawable allowing the user to distinguish it from the original drawable. |
| 4583 | * The caller can specify the location in the bounds of the drawable to be |
| 4584 | * badged where the badge should be applied as well as the density of the |
| 4585 | * badge to be used. |
| 4586 | * <p> |
| 4587 | * If the original drawable is a BitmapDrawable and the backing bitmap is |
Vadim Tryshev | 66ae66a | 2016-02-18 15:41:21 -0800 | [diff] [blame] | 4588 | * mutable as per {@link android.graphics.Bitmap#isMutable()}, the badging |
Svetoslav | c7d62f0 | 2014-09-04 15:39:54 -0700 | [diff] [blame] | 4589 | * is performed in place and the original drawable is returned. |
| 4590 | * </p> |
| 4591 | * |
| 4592 | * @param drawable The drawable to badge. |
| 4593 | * @param user The target user. |
| 4594 | * @param badgeLocation Where in the bounds of the badged drawable to place |
Vadim Tryshev | 66ae66a | 2016-02-18 15:41:21 -0800 | [diff] [blame] | 4595 | * the badge. If it's {@code null}, the badge is applied on top of the entire |
Svetoslav | c7d62f0 | 2014-09-04 15:39:54 -0700 | [diff] [blame] | 4596 | * drawable being badged. |
| 4597 | * @param badgeDensity The optional desired density for the badge as per |
Vadim Tryshev | 66ae66a | 2016-02-18 15:41:21 -0800 | [diff] [blame] | 4598 | * {@link android.util.DisplayMetrics#densityDpi}. If it's not positive, |
Svetoslav | c7d62f0 | 2014-09-04 15:39:54 -0700 | [diff] [blame] | 4599 | * the density of the display is used. |
| 4600 | * @return A drawable that combines the original drawable and a badge as |
| 4601 | * determined by the system. |
| 4602 | */ |
| 4603 | public abstract Drawable getUserBadgedDrawableForDensity(Drawable drawable, |
| 4604 | UserHandle user, Rect badgeLocation, int badgeDensity); |
| 4605 | |
| 4606 | /** |
| 4607 | * If the target user is a managed profile of the calling user or the caller |
| 4608 | * is itself a managed profile, then this returns a drawable to use as a small |
| 4609 | * icon to include in a view to distinguish it from the original icon. |
| 4610 | * |
| 4611 | * @param user The target user. |
| 4612 | * @param density The optional desired density for the badge as per |
| 4613 | * {@link android.util.DisplayMetrics#densityDpi}. If not provided |
| 4614 | * the density of the current display is used. |
| 4615 | * @return the drawable or null if no drawable is required. |
| 4616 | * @hide |
| 4617 | */ |
| 4618 | public abstract Drawable getUserBadgeForDensity(UserHandle user, int density); |
| 4619 | |
| 4620 | /** |
| 4621 | * If the target user is a managed profile of the calling user or the caller |
Selim Cinek | e6ff946 | 2016-01-15 15:07:06 -0800 | [diff] [blame] | 4622 | * is itself a managed profile, then this returns a drawable to use as a small |
| 4623 | * icon to include in a view to distinguish it from the original icon. This version |
| 4624 | * doesn't have background protection and should be used over a light background instead of |
| 4625 | * a badge. |
| 4626 | * |
| 4627 | * @param user The target user. |
| 4628 | * @param density The optional desired density for the badge as per |
| 4629 | * {@link android.util.DisplayMetrics#densityDpi}. If not provided |
| 4630 | * the density of the current display is used. |
| 4631 | * @return the drawable or null if no drawable is required. |
| 4632 | * @hide |
| 4633 | */ |
| 4634 | public abstract Drawable getUserBadgeForDensityNoBackground(UserHandle user, int density); |
| 4635 | |
| 4636 | /** |
| 4637 | * If the target user is a managed profile of the calling user or the caller |
Svetoslav | c7d62f0 | 2014-09-04 15:39:54 -0700 | [diff] [blame] | 4638 | * is itself a managed profile, then this returns a copy of the label with |
| 4639 | * badging for accessibility services like talkback. E.g. passing in "Email" |
| 4640 | * and it might return "Work Email" for Email in the work profile. |
| 4641 | * |
| 4642 | * @param label The label to change. |
| 4643 | * @param user The target user. |
| 4644 | * @return A label that combines the original label and a badge as |
| 4645 | * determined by the system. |
| 4646 | */ |
| 4647 | public abstract CharSequence getUserBadgedLabel(CharSequence label, UserHandle user); |
| 4648 | |
| 4649 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4650 | * Retrieve text from a package. This is a low-level API used by |
| 4651 | * the various package manager info structures (such as |
| 4652 | * {@link ComponentInfo} to implement retrieval of their associated |
| 4653 | * labels and other text. |
| 4654 | * |
| 4655 | * @param packageName The name of the package that this text is coming from. |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4656 | * Cannot be null. |
| 4657 | * @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] | 4658 | * @param appInfo Overall information about <var>packageName</var>. This |
| 4659 | * may be null, in which case the application information will be retrieved |
| 4660 | * for you if needed; if you already have this information around, it can |
| 4661 | * be much more efficient to supply it here. |
| 4662 | * |
| 4663 | * @return Returns a CharSequence holding the requested text. Returns null |
| 4664 | * if the text could not be found for any reason. |
| 4665 | */ |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 4666 | public abstract CharSequence getText(String packageName, @StringRes int resid, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4667 | ApplicationInfo appInfo); |
| 4668 | |
| 4669 | /** |
| 4670 | * Retrieve an XML file from a package. This is a low-level API used to |
| 4671 | * retrieve XML meta data. |
| 4672 | * |
| 4673 | * @param packageName The name of the package that this xml is coming from. |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4674 | * Cannot be null. |
| 4675 | * @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] | 4676 | * @param appInfo Overall information about <var>packageName</var>. This |
| 4677 | * may be null, in which case the application information will be retrieved |
| 4678 | * for you if needed; if you already have this information around, it can |
| 4679 | * be much more efficient to supply it here. |
| 4680 | * |
| 4681 | * @return Returns an XmlPullParser allowing you to parse out the XML |
| 4682 | * data. Returns null if the xml resource could not be found for any |
| 4683 | * reason. |
| 4684 | */ |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 4685 | public abstract XmlResourceParser getXml(String packageName, @XmlRes int resid, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4686 | ApplicationInfo appInfo); |
| 4687 | |
| 4688 | /** |
| 4689 | * Return the label to use for this application. |
| 4690 | * |
| 4691 | * @return Returns the label associated with this application, or null if |
| 4692 | * it could not be found for any reason. |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4693 | * @param info The application to get the label of. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4694 | */ |
| 4695 | public abstract CharSequence getApplicationLabel(ApplicationInfo info); |
| 4696 | |
| 4697 | /** |
| 4698 | * Retrieve the resources associated with an activity. Given the full |
| 4699 | * name of an activity, retrieves the information about it and calls |
| 4700 | * getResources() to return its application's resources. If the activity |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4701 | * cannot be found, NameNotFoundException is thrown. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4702 | * |
| 4703 | * @param activityName Name of the activity whose resources are to be |
| 4704 | * retrieved. |
| 4705 | * |
| 4706 | * @return Returns the application's Resources. |
| 4707 | * @throws NameNotFoundException Thrown if the resources for the given |
| 4708 | * application could not be loaded. |
| 4709 | * |
| 4710 | * @see #getResourcesForApplication(ApplicationInfo) |
| 4711 | */ |
| 4712 | public abstract Resources getResourcesForActivity(ComponentName activityName) |
| 4713 | throws NameNotFoundException; |
| 4714 | |
| 4715 | /** |
| 4716 | * Retrieve the resources for an application. Throws NameNotFoundException |
| 4717 | * if the package is no longer installed. |
| 4718 | * |
| 4719 | * @param app Information about the desired application. |
| 4720 | * |
| 4721 | * @return Returns the application's Resources. |
| 4722 | * @throws NameNotFoundException Thrown if the resources for the given |
| 4723 | * application could not be loaded (most likely because it was uninstalled). |
| 4724 | */ |
| 4725 | public abstract Resources getResourcesForApplication(ApplicationInfo app) |
| 4726 | throws NameNotFoundException; |
| 4727 | |
| 4728 | /** |
| 4729 | * Retrieve the resources associated with an application. Given the full |
| 4730 | * package name of an application, retrieves the information about it and |
| 4731 | * calls getResources() to return its application's resources. If the |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4732 | * appPackageName cannot be found, NameNotFoundException is thrown. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4733 | * |
| 4734 | * @param appPackageName Package name of the application whose resources |
| 4735 | * are to be retrieved. |
| 4736 | * |
| 4737 | * @return Returns the application's Resources. |
| 4738 | * @throws NameNotFoundException Thrown if the resources for the given |
| 4739 | * application could not be loaded. |
| 4740 | * |
| 4741 | * @see #getResourcesForApplication(ApplicationInfo) |
| 4742 | */ |
| 4743 | public abstract Resources getResourcesForApplication(String appPackageName) |
| 4744 | throws NameNotFoundException; |
| 4745 | |
Amith Yamasani | 98edc95 | 2012-09-25 14:09:27 -0700 | [diff] [blame] | 4746 | /** @hide */ |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 4747 | public abstract Resources getResourcesForApplicationAsUser(String appPackageName, |
| 4748 | @UserIdInt int userId) throws NameNotFoundException; |
Amith Yamasani | 98edc95 | 2012-09-25 14:09:27 -0700 | [diff] [blame] | 4749 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4750 | /** |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4751 | * Retrieve overall information about an application package defined in a |
| 4752 | * package archive file |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4753 | * |
| 4754 | * @param archiveFilePath The path to the archive file |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4755 | * @param flags Additional option flags to modify the data returned. |
| 4756 | * @return A PackageInfo object containing information about the package |
| 4757 | * archive. If the package could not be parsed, returns null. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4758 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4759 | public PackageInfo getPackageArchiveInfo(String archiveFilePath, @PackageInfoFlags int flags) { |
Jeff Sharkey | 275e085 | 2014-06-17 18:18:49 -0700 | [diff] [blame] | 4760 | final PackageParser parser = new PackageParser(); |
Dianne Hackborn | cd154e9 | 2017-02-28 17:37:35 -0800 | [diff] [blame] | 4761 | parser.setCallback(new PackageParser.CallbackImpl(this)); |
Jeff Sharkey | 275e085 | 2014-06-17 18:18:49 -0700 | [diff] [blame] | 4762 | final File apkFile = new File(archiveFilePath); |
Jeff Sharkey | c4858a2 | 2014-06-16 10:51:20 -0700 | [diff] [blame] | 4763 | try { |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4764 | if ((flags & (MATCH_DIRECT_BOOT_UNAWARE | MATCH_DIRECT_BOOT_AWARE)) != 0) { |
Jeff Sharkey | c313251 | 2016-01-12 14:06:58 -0700 | [diff] [blame] | 4765 | // Caller expressed an explicit opinion about what encryption |
| 4766 | // aware/unaware components they want to see, so fall through and |
| 4767 | // give them what they want |
| 4768 | } else { |
| 4769 | // Caller expressed no opinion, so match everything |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4770 | flags |= MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE; |
Jeff Sharkey | c313251 | 2016-01-12 14:06:58 -0700 | [diff] [blame] | 4771 | } |
| 4772 | |
Jeff Sharkey | 275e085 | 2014-06-17 18:18:49 -0700 | [diff] [blame] | 4773 | PackageParser.Package pkg = parser.parseMonolithicPackage(apkFile, 0); |
Jeff Sharkey | c4858a2 | 2014-06-16 10:51:20 -0700 | [diff] [blame] | 4774 | if ((flags & GET_SIGNATURES) != 0) { |
Victor Hsieh | 5f76124 | 2018-01-20 10:30:12 -0800 | [diff] [blame] | 4775 | PackageParser.collectCertificates(pkg, false /* skipVerify */); |
Jeff Sharkey | c4858a2 | 2014-06-16 10:51:20 -0700 | [diff] [blame] | 4776 | } |
| 4777 | PackageUserState state = new PackageUserState(); |
| 4778 | return PackageParser.generatePackageInfo(pkg, null, flags, 0, 0, null, state); |
| 4779 | } catch (PackageParserException e) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4780 | return null; |
| 4781 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4782 | } |
| 4783 | |
| 4784 | /** |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 4785 | * If there is already an application with the given package name installed |
| 4786 | * on the system for other users, also install it for the calling user. |
| 4787 | * @hide |
| 4788 | */ |
Sunny Goyal | 07f41fb | 2017-08-09 02:56:34 -0700 | [diff] [blame] | 4789 | @SystemApi |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 4790 | public abstract int installExistingPackage(String packageName) throws NameNotFoundException; |
| 4791 | |
| 4792 | /** |
| 4793 | * If there is already an application with the given package name installed |
Sunny Goyal | a31a74b | 2017-05-11 15:59:19 -0700 | [diff] [blame] | 4794 | * on the system for other users, also install it for the calling user. |
| 4795 | * @hide |
| 4796 | */ |
Sunny Goyal | 07f41fb | 2017-08-09 02:56:34 -0700 | [diff] [blame] | 4797 | @SystemApi |
Sunny Goyal | a31a74b | 2017-05-11 15:59:19 -0700 | [diff] [blame] | 4798 | public abstract int installExistingPackage(String packageName, @InstallReason int installReason) |
| 4799 | throws NameNotFoundException; |
| 4800 | |
| 4801 | /** |
| 4802 | * If there is already an application with the given package name installed |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 4803 | * on the system for other users, also install it for the specified user. |
| 4804 | * @hide |
| 4805 | */ |
| 4806 | @RequiresPermission(anyOf = { |
| 4807 | Manifest.permission.INSTALL_PACKAGES, |
| 4808 | Manifest.permission.INTERACT_ACROSS_USERS_FULL}) |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 4809 | public abstract int installExistingPackageAsUser(String packageName, @UserIdInt int userId) |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 4810 | throws NameNotFoundException; |
| 4811 | |
| 4812 | /** |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 4813 | * Allows a package listening to the |
| 4814 | * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification |
Kenny Root | 3a9b5fb | 2011-09-20 14:15:38 -0700 | [diff] [blame] | 4815 | * broadcast} to respond to the package manager. The response must include |
| 4816 | * the {@code verificationCode} which is one of |
| 4817 | * {@link PackageManager#VERIFICATION_ALLOW} or |
| 4818 | * {@link PackageManager#VERIFICATION_REJECT}. |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 4819 | * |
| 4820 | * @param id pending package identifier as passed via the |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4821 | * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra. |
Kenny Root | 3a9b5fb | 2011-09-20 14:15:38 -0700 | [diff] [blame] | 4822 | * @param verificationCode either {@link PackageManager#VERIFICATION_ALLOW} |
| 4823 | * or {@link PackageManager#VERIFICATION_REJECT}. |
rich cannings | 7e67151 | 2012-08-27 14:44:16 -0700 | [diff] [blame] | 4824 | * @throws SecurityException if the caller does not have the |
Dianne Hackborn | 8832c18 | 2012-09-17 17:20:24 -0700 | [diff] [blame] | 4825 | * PACKAGE_VERIFICATION_AGENT permission. |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 4826 | */ |
Kenny Root | 3a9b5fb | 2011-09-20 14:15:38 -0700 | [diff] [blame] | 4827 | public abstract void verifyPendingInstall(int id, int verificationCode); |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 4828 | |
| 4829 | /** |
rich cannings | d9ef3e5 | 2012-08-22 14:28:05 -0700 | [diff] [blame] | 4830 | * Allows a package listening to the |
| 4831 | * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification |
| 4832 | * broadcast} to extend the default timeout for a response and declare what |
| 4833 | * action to perform after the timeout occurs. The response must include |
| 4834 | * the {@code verificationCodeAtTimeout} which is one of |
| 4835 | * {@link PackageManager#VERIFICATION_ALLOW} or |
| 4836 | * {@link PackageManager#VERIFICATION_REJECT}. |
| 4837 | * |
| 4838 | * This method may only be called once per package id. Additional calls |
| 4839 | * will have no effect. |
| 4840 | * |
| 4841 | * @param id pending package identifier as passed via the |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4842 | * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra. |
rich cannings | d9ef3e5 | 2012-08-22 14:28:05 -0700 | [diff] [blame] | 4843 | * @param verificationCodeAtTimeout either |
| 4844 | * {@link PackageManager#VERIFICATION_ALLOW} or |
rich cannings | d1b5cfc | 2012-08-29 14:49:51 -0700 | [diff] [blame] | 4845 | * {@link PackageManager#VERIFICATION_REJECT}. If |
| 4846 | * {@code verificationCodeAtTimeout} is neither |
| 4847 | * {@link PackageManager#VERIFICATION_ALLOW} or |
| 4848 | * {@link PackageManager#VERIFICATION_REJECT}, then |
| 4849 | * {@code verificationCodeAtTimeout} will default to |
rich cannings | d9ef3e5 | 2012-08-22 14:28:05 -0700 | [diff] [blame] | 4850 | * {@link PackageManager#VERIFICATION_REJECT}. |
| 4851 | * @param millisecondsToDelay the amount of time requested for the timeout. |
| 4852 | * Must be positive and less than |
rich cannings | d1b5cfc | 2012-08-29 14:49:51 -0700 | [diff] [blame] | 4853 | * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}. If |
| 4854 | * {@code millisecondsToDelay} is out of bounds, |
| 4855 | * {@code millisecondsToDelay} will be set to the closest in |
| 4856 | * bounds value; namely, 0 or |
rich cannings | d9ef3e5 | 2012-08-22 14:28:05 -0700 | [diff] [blame] | 4857 | * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}. |
rich cannings | 7e67151 | 2012-08-27 14:44:16 -0700 | [diff] [blame] | 4858 | * @throws SecurityException if the caller does not have the |
Dianne Hackborn | 8832c18 | 2012-09-17 17:20:24 -0700 | [diff] [blame] | 4859 | * PACKAGE_VERIFICATION_AGENT permission. |
rich cannings | d9ef3e5 | 2012-08-22 14:28:05 -0700 | [diff] [blame] | 4860 | */ |
| 4861 | public abstract void extendVerificationTimeout(int id, |
| 4862 | int verificationCodeAtTimeout, long millisecondsToDelay); |
| 4863 | |
| 4864 | /** |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 4865 | * Allows a package listening to the |
Todd Kennedy | dfa93ab | 2016-03-03 15:24:33 -0800 | [diff] [blame] | 4866 | * {@link Intent#ACTION_INTENT_FILTER_NEEDS_VERIFICATION} intent filter verification |
| 4867 | * broadcast to respond to the package manager. The response must include |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 4868 | * the {@code verificationCode} which is one of |
| 4869 | * {@link PackageManager#INTENT_FILTER_VERIFICATION_SUCCESS} or |
| 4870 | * {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}. |
| 4871 | * |
| 4872 | * @param verificationId pending package identifier as passed via the |
| 4873 | * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra. |
| 4874 | * @param verificationCode either {@link PackageManager#INTENT_FILTER_VERIFICATION_SUCCESS} |
| 4875 | * or {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}. |
Todd Kennedy | dfa93ab | 2016-03-03 15:24:33 -0800 | [diff] [blame] | 4876 | * @param failedDomains a list of failed domains if the verificationCode is |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 4877 | * {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}, otherwise null; |
| 4878 | * @throws SecurityException if the caller does not have the |
| 4879 | * INTENT_FILTER_VERIFICATION_AGENT permission. |
| 4880 | * |
| 4881 | * @hide |
| 4882 | */ |
Fabrice Di Meglio | ef741da | 2015-05-12 16:31:38 -0700 | [diff] [blame] | 4883 | @SystemApi |
Jeff Sharkey | d86b8fe | 2017-06-02 17:36:26 -0600 | [diff] [blame] | 4884 | @RequiresPermission(android.Manifest.permission.INTENT_FILTER_VERIFICATION_AGENT) |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 4885 | public abstract void verifyIntentFilter(int verificationId, int verificationCode, |
Todd Kennedy | dfa93ab | 2016-03-03 15:24:33 -0800 | [diff] [blame] | 4886 | List<String> failedDomains); |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 4887 | |
| 4888 | /** |
| 4889 | * Get the status of a Domain Verification Result for an IntentFilter. This is |
| 4890 | * related to the {@link android.content.IntentFilter#setAutoVerify(boolean)} and |
| 4891 | * {@link android.content.IntentFilter#getAutoVerify()} |
| 4892 | * |
| 4893 | * This is used by the ResolverActivity to change the status depending on what the User select |
| 4894 | * in the Disambiguation Dialog and also used by the Settings App for changing the default App |
| 4895 | * for a domain. |
| 4896 | * |
| 4897 | * @param packageName The package name of the Activity associated with the IntentFilter. |
| 4898 | * @param userId The user id. |
| 4899 | * |
| 4900 | * @return The status to set to. This can be |
| 4901 | * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK} or |
| 4902 | * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS} or |
| 4903 | * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER} or |
| 4904 | * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED} |
| 4905 | * |
| 4906 | * @hide |
| 4907 | */ |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 4908 | @SystemApi |
Todd Kennedy | dbaef6d | 2017-07-24 11:28:00 -0700 | [diff] [blame] | 4909 | @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS_FULL) |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 4910 | public abstract int getIntentVerificationStatusAsUser(String packageName, @UserIdInt int userId); |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 4911 | |
| 4912 | /** |
| 4913 | * Allow to change the status of a Intent Verification status for all IntentFilter of an App. |
| 4914 | * This is related to the {@link android.content.IntentFilter#setAutoVerify(boolean)} and |
| 4915 | * {@link android.content.IntentFilter#getAutoVerify()} |
| 4916 | * |
| 4917 | * This is used by the ResolverActivity to change the status depending on what the User select |
| 4918 | * in the Disambiguation Dialog and also used by the Settings App for changing the default App |
| 4919 | * for a domain. |
| 4920 | * |
| 4921 | * @param packageName The package name of the Activity associated with the IntentFilter. |
| 4922 | * @param status The status to set to. This can be |
| 4923 | * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK} or |
| 4924 | * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS} or |
| 4925 | * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER} |
| 4926 | * @param userId The user id. |
| 4927 | * |
| 4928 | * @return true if the status has been set. False otherwise. |
| 4929 | * |
| 4930 | * @hide |
| 4931 | */ |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 4932 | @SystemApi |
Jeff Sharkey | d86b8fe | 2017-06-02 17:36:26 -0600 | [diff] [blame] | 4933 | @RequiresPermission(android.Manifest.permission.SET_PREFERRED_APPLICATIONS) |
Jeff Sharkey | e06b4d1 | 2016-01-06 14:51:50 -0700 | [diff] [blame] | 4934 | public abstract boolean updateIntentVerificationStatusAsUser(String packageName, int status, |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 4935 | @UserIdInt int userId); |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 4936 | |
| 4937 | /** |
| 4938 | * Get the list of IntentFilterVerificationInfo for a specific package and User. |
| 4939 | * |
| 4940 | * @param packageName the package name. When this parameter is set to a non null value, |
| 4941 | * the results will be filtered by the package name provided. |
| 4942 | * 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] | 4943 | * corresponding for all packages |
| 4944 | * |
| 4945 | * @return a list of IntentFilterVerificationInfo for a specific package. |
| 4946 | * |
| 4947 | * @hide |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 4948 | */ |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 4949 | @SystemApi |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 4950 | public abstract List<IntentFilterVerificationInfo> getIntentFilterVerifications( |
| 4951 | String packageName); |
| 4952 | |
| 4953 | /** |
Fabrice Di Meglio | 0788595 | 2015-04-06 19:41:28 -0700 | [diff] [blame] | 4954 | * Get the list of IntentFilter for a specific package. |
| 4955 | * |
| 4956 | * @param packageName the package name. This parameter is set to a non null value, |
| 4957 | * the list will contain all the IntentFilter for that package. |
| 4958 | * Otherwise, the list will be empty. |
| 4959 | * |
| 4960 | * @return a list of IntentFilter for a specific package. |
| 4961 | * |
| 4962 | * @hide |
| 4963 | */ |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 4964 | @SystemApi |
Fabrice Di Meglio | 0788595 | 2015-04-06 19:41:28 -0700 | [diff] [blame] | 4965 | public abstract List<IntentFilter> getAllIntentFilters(String packageName); |
| 4966 | |
| 4967 | /** |
Fabrice Di Meglio | 6227172 | 2015-04-10 17:24:02 -0700 | [diff] [blame] | 4968 | * Get the default Browser package name for a specific user. |
| 4969 | * |
| 4970 | * @param userId The user id. |
| 4971 | * |
| 4972 | * @return the package name of the default Browser for the specified user. If the user id passed |
| 4973 | * is -1 (all users) it will return a null value. |
| 4974 | * |
| 4975 | * @hide |
| 4976 | */ |
Jeff Sharkey | a73b8fd | 2016-01-06 17:02:08 -0700 | [diff] [blame] | 4977 | @TestApi |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 4978 | @SystemApi |
Todd Kennedy | dbaef6d | 2017-07-24 11:28:00 -0700 | [diff] [blame] | 4979 | @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS_FULL) |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 4980 | public abstract String getDefaultBrowserPackageNameAsUser(@UserIdInt int userId); |
Fabrice Di Meglio | 6227172 | 2015-04-10 17:24:02 -0700 | [diff] [blame] | 4981 | |
| 4982 | /** |
| 4983 | * Set the default Browser package name for a specific user. |
| 4984 | * |
| 4985 | * @param packageName The package name of the default Browser. |
| 4986 | * @param userId The user id. |
| 4987 | * |
| 4988 | * @return true if the default Browser for the specified user has been set, |
| 4989 | * otherwise return false. If the user id passed is -1 (all users) this call will not |
| 4990 | * do anything and just return false. |
| 4991 | * |
| 4992 | * @hide |
| 4993 | */ |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 4994 | @SystemApi |
Todd Kennedy | dbaef6d | 2017-07-24 11:28:00 -0700 | [diff] [blame] | 4995 | @RequiresPermission(allOf = { |
| 4996 | Manifest.permission.SET_PREFERRED_APPLICATIONS, |
| 4997 | Manifest.permission.INTERACT_ACROSS_USERS_FULL}) |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 4998 | public abstract boolean setDefaultBrowserPackageNameAsUser(String packageName, |
| 4999 | @UserIdInt int userId); |
Fabrice Di Meglio | 6227172 | 2015-04-10 17:24:02 -0700 | [diff] [blame] | 5000 | |
| 5001 | /** |
Dianne Hackborn | 880119b | 2010-11-18 22:26:40 -0800 | [diff] [blame] | 5002 | * Change the installer associated with a given package. There are limitations |
| 5003 | * on how the installer package can be changed; in particular: |
| 5004 | * <ul> |
| 5005 | * <li> A SecurityException will be thrown if <var>installerPackageName</var> |
| 5006 | * is not signed with the same certificate as the calling application. |
| 5007 | * <li> A SecurityException will be thrown if <var>targetPackage</var> already |
| 5008 | * has an installer package, and that installer package is not signed with |
| 5009 | * the same certificate as the calling application. |
| 5010 | * </ul> |
| 5011 | * |
| 5012 | * @param targetPackage The installed package whose installer will be changed. |
| 5013 | * @param installerPackageName The package name of the new installer. May be |
| 5014 | * null to clear the association. |
| 5015 | */ |
| 5016 | public abstract void setInstallerPackageName(String targetPackage, |
| 5017 | String installerPackageName); |
| 5018 | |
Todd Kennedy | ab53289 | 2017-03-08 14:19:49 -0800 | [diff] [blame] | 5019 | /** @hide */ |
| 5020 | @SystemApi |
| 5021 | @RequiresPermission(Manifest.permission.INSTALL_PACKAGES) |
| 5022 | public abstract void setUpdateAvailable(String packageName, boolean updateAvaialble); |
| 5023 | |
Dianne Hackborn | 880119b | 2010-11-18 22:26:40 -0800 | [diff] [blame] | 5024 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 5025 | * Attempts to delete a package. Since this may take a little while, the |
| 5026 | * result will be posted back to the given observer. A deletion will fail if |
| 5027 | * the calling context lacks the |
| 5028 | * {@link android.Manifest.permission#DELETE_PACKAGES} permission, if the |
| 5029 | * named package cannot be found, or if the named package is a system |
| 5030 | * package. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5031 | * |
| 5032 | * @param packageName The name of the package to delete |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 5033 | * @param observer An observer callback to get notified when the package |
| 5034 | * deletion is complete. |
| 5035 | * {@link android.content.pm.IPackageDeleteObserver#packageDeleted} |
| 5036 | * will be called when that happens. observer may be null to |
| 5037 | * indicate that no callback is desired. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5038 | * @hide |
| 5039 | */ |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 5040 | @RequiresPermission(Manifest.permission.DELETE_PACKAGES) |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 5041 | public abstract void deletePackage(String packageName, IPackageDeleteObserver observer, |
| 5042 | @DeleteFlags int flags); |
Jacek Surazski | 65e1317 | 2009-04-28 15:26:38 +0200 | [diff] [blame] | 5043 | |
| 5044 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 5045 | * Attempts to delete a package. Since this may take a little while, the |
| 5046 | * result will be posted back to the given observer. A deletion will fail if |
| 5047 | * the named package cannot be found, or if the named package is a system |
| 5048 | * package. |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 5049 | * |
| 5050 | * @param packageName The name of the package to delete |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 5051 | * @param observer An observer callback to get notified when the package |
| 5052 | * deletion is complete. |
| 5053 | * {@link android.content.pm.IPackageDeleteObserver#packageDeleted} |
| 5054 | * will be called when that happens. observer may be null to |
| 5055 | * indicate that no callback is desired. |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 5056 | * @param userId The user Id |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 5057 | * @hide |
| 5058 | */ |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 5059 | @RequiresPermission(anyOf = { |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 5060 | Manifest.permission.DELETE_PACKAGES, |
| 5061 | Manifest.permission.INTERACT_ACROSS_USERS_FULL}) |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 5062 | public abstract void deletePackageAsUser(@NonNull String packageName, |
| 5063 | IPackageDeleteObserver observer, @DeleteFlags int flags, @UserIdInt int userId); |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 5064 | |
| 5065 | /** |
Jacek Surazski | 65e1317 | 2009-04-28 15:26:38 +0200 | [diff] [blame] | 5066 | * Retrieve the package name of the application that installed a package. This identifies |
| 5067 | * which market the package came from. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 5068 | * |
Jacek Surazski | 65e1317 | 2009-04-28 15:26:38 +0200 | [diff] [blame] | 5069 | * @param packageName The name of the package to query |
| 5070 | */ |
| 5071 | public abstract String getInstallerPackageName(String packageName); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 5072 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5073 | /** |
| 5074 | * Attempts to clear the user data directory of an application. |
| 5075 | * Since this may take a little while, the result will |
| 5076 | * be posted back to the given observer. A deletion will fail if the |
| 5077 | * named package cannot be found, or if the named package is a "system package". |
| 5078 | * |
| 5079 | * @param packageName The name of the package |
| 5080 | * @param observer An observer callback to get notified when the operation is finished |
| 5081 | * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)} |
| 5082 | * will be called when that happens. observer may be null to indicate that |
| 5083 | * no callback is desired. |
| 5084 | * |
| 5085 | * @hide |
| 5086 | */ |
| 5087 | public abstract void clearApplicationUserData(String packageName, |
| 5088 | IPackageDataObserver observer); |
| 5089 | /** |
| 5090 | * Attempts to delete the cache files associated with an application. |
| 5091 | * Since this may take a little while, the result will |
| 5092 | * be posted back to the given observer. A deletion will fail if the calling context |
| 5093 | * lacks the {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the |
| 5094 | * named package cannot be found, or if the named package is a "system package". |
| 5095 | * |
| 5096 | * @param packageName The name of the package to delete |
| 5097 | * @param observer An observer callback to get notified when the cache file deletion |
| 5098 | * is complete. |
| 5099 | * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)} |
| 5100 | * will be called when that happens. observer may be null to indicate that |
| 5101 | * no callback is desired. |
| 5102 | * |
| 5103 | * @hide |
| 5104 | */ |
| 5105 | public abstract void deleteApplicationCacheFiles(String packageName, |
| 5106 | IPackageDataObserver observer); |
| 5107 | |
| 5108 | /** |
Suprabh Shukla | 78c9eb8 | 2016-04-12 15:51:35 -0700 | [diff] [blame] | 5109 | * Attempts to delete the cache files associated with an application for a given user. Since |
| 5110 | * this may take a little while, the result will be posted back to the given observer. A |
| 5111 | * deletion will fail if the calling context lacks the |
| 5112 | * {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the named package |
| 5113 | * cannot be found, or if the named package is a "system package". If {@code userId} does not |
| 5114 | * belong to the calling user, the caller must have |
| 5115 | * {@link android.Manifest.permission#INTERACT_ACROSS_USERS} permission. |
| 5116 | * |
| 5117 | * @param packageName The name of the package to delete |
| 5118 | * @param userId the user for which the cache files needs to be deleted |
| 5119 | * @param observer An observer callback to get notified when the cache file deletion is |
| 5120 | * complete. |
| 5121 | * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)} |
| 5122 | * will be called when that happens. observer may be null to indicate that no |
| 5123 | * callback is desired. |
| 5124 | * @hide |
| 5125 | */ |
| 5126 | public abstract void deleteApplicationCacheFilesAsUser(String packageName, int userId, |
| 5127 | IPackageDataObserver observer); |
| 5128 | |
| 5129 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5130 | * Free storage by deleting LRU sorted list of cache files across |
| 5131 | * all applications. If the currently available free storage |
| 5132 | * on the device is greater than or equal to the requested |
| 5133 | * free storage, no cache files are cleared. If the currently |
| 5134 | * available storage on the device is less than the requested |
| 5135 | * free storage, some or all of the cache files across |
| 5136 | * all applications are deleted (based on last accessed time) |
| 5137 | * to increase the free storage space on the device to |
| 5138 | * the requested value. There is no guarantee that clearing all |
| 5139 | * the cache files from all applications will clear up |
| 5140 | * enough storage to achieve the desired value. |
| 5141 | * @param freeStorageSize The number of bytes of storage to be |
| 5142 | * freed by the system. Say if freeStorageSize is XX, |
| 5143 | * and the current free storage is YY, |
| 5144 | * if XX is less than YY, just return. if not free XX-YY number |
| 5145 | * of bytes if possible. |
| 5146 | * @param observer call back used to notify when |
| 5147 | * the operation is completed |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 5148 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5149 | * @hide |
| 5150 | */ |
Jeff Sharkey | 529f91f | 2015-04-18 20:23:13 -0700 | [diff] [blame] | 5151 | public void freeStorageAndNotify(long freeStorageSize, IPackageDataObserver observer) { |
| 5152 | freeStorageAndNotify(null, freeStorageSize, observer); |
| 5153 | } |
| 5154 | |
| 5155 | /** {@hide} */ |
| 5156 | public abstract void freeStorageAndNotify(String volumeUuid, long freeStorageSize, |
| 5157 | IPackageDataObserver observer); |
Suchi Amalapurapu | 1ccac75 | 2009-06-12 10:09:58 -0700 | [diff] [blame] | 5158 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5159 | /** |
| 5160 | * Free storage by deleting LRU sorted list of cache files across |
| 5161 | * all applications. If the currently available free storage |
| 5162 | * on the device is greater than or equal to the requested |
| 5163 | * free storage, no cache files are cleared. If the currently |
| 5164 | * available storage on the device is less than the requested |
| 5165 | * free storage, some or all of the cache files across |
| 5166 | * all applications are deleted (based on last accessed time) |
| 5167 | * to increase the free storage space on the device to |
| 5168 | * the requested value. There is no guarantee that clearing all |
| 5169 | * the cache files from all applications will clear up |
| 5170 | * enough storage to achieve the desired value. |
| 5171 | * @param freeStorageSize The number of bytes of storage to be |
| 5172 | * freed by the system. Say if freeStorageSize is XX, |
| 5173 | * and the current free storage is YY, |
| 5174 | * if XX is less than YY, just return. if not free XX-YY number |
| 5175 | * of bytes if possible. |
Suchi Amalapurapu | 1ccac75 | 2009-06-12 10:09:58 -0700 | [diff] [blame] | 5176 | * @param pi IntentSender call back used to |
| 5177 | * notify when the operation is completed.May be null |
| 5178 | * to indicate that no call back is desired. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 5179 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5180 | * @hide |
| 5181 | */ |
Jeff Sharkey | 529f91f | 2015-04-18 20:23:13 -0700 | [diff] [blame] | 5182 | public void freeStorage(long freeStorageSize, IntentSender pi) { |
| 5183 | freeStorage(null, freeStorageSize, pi); |
| 5184 | } |
| 5185 | |
| 5186 | /** {@hide} */ |
| 5187 | 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] | 5188 | |
| 5189 | /** |
| 5190 | * Retrieve the size information for a package. |
| 5191 | * Since this may take a little while, the result will |
| 5192 | * be posted back to the given observer. The calling context |
| 5193 | * should have the {@link android.Manifest.permission#GET_PACKAGE_SIZE} permission. |
| 5194 | * |
| 5195 | * @param packageName The name of the package whose size information is to be retrieved |
Jeff Sharkey | e06b4d1 | 2016-01-06 14:51:50 -0700 | [diff] [blame] | 5196 | * @param userId The user whose size information should be retrieved. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5197 | * @param observer An observer callback to get notified when the operation |
| 5198 | * is complete. |
| 5199 | * {@link android.content.pm.IPackageStatsObserver#onGetStatsCompleted(PackageStats, boolean)} |
| 5200 | * The observer's callback is invoked with a PackageStats object(containing the |
| 5201 | * code, data and cache sizes of the package) and a boolean value representing |
| 5202 | * the status of the operation. observer may be null to indicate that |
| 5203 | * no callback is desired. |
| 5204 | * |
Jeff Sharkey | 60f95aa | 2017-03-08 13:57:15 -0700 | [diff] [blame] | 5205 | * @deprecated use {@link StorageStatsManager} instead. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5206 | * @hide |
| 5207 | */ |
Jeff Sharkey | 60f95aa | 2017-03-08 13:57:15 -0700 | [diff] [blame] | 5208 | @Deprecated |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 5209 | public abstract void getPackageSizeInfoAsUser(String packageName, @UserIdInt int userId, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5210 | IPackageStatsObserver observer); |
| 5211 | |
| 5212 | /** |
Jeff Sharkey | e06b4d1 | 2016-01-06 14:51:50 -0700 | [diff] [blame] | 5213 | * Like {@link #getPackageSizeInfoAsUser(String, int, IPackageStatsObserver)}, but |
Dianne Hackborn | 0c38049 | 2012-08-20 17:23:30 -0700 | [diff] [blame] | 5214 | * returns the size for the calling user. |
| 5215 | * |
Jeff Sharkey | 60f95aa | 2017-03-08 13:57:15 -0700 | [diff] [blame] | 5216 | * @deprecated use {@link StorageStatsManager} instead. |
Dianne Hackborn | 0c38049 | 2012-08-20 17:23:30 -0700 | [diff] [blame] | 5217 | * @hide |
| 5218 | */ |
Jeff Sharkey | 60f95aa | 2017-03-08 13:57:15 -0700 | [diff] [blame] | 5219 | @Deprecated |
Dianne Hackborn | 0c38049 | 2012-08-20 17:23:30 -0700 | [diff] [blame] | 5220 | public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) { |
Jeff Sharkey | ad357d1 | 2018-02-02 13:25:31 -0700 | [diff] [blame] | 5221 | getPackageSizeInfoAsUser(packageName, getUserId(), observer); |
Dianne Hackborn | 0c38049 | 2012-08-20 17:23:30 -0700 | [diff] [blame] | 5222 | } |
| 5223 | |
| 5224 | /** |
Dianne Hackborn | a7ca0e5 | 2009-12-01 14:31:55 -0800 | [diff] [blame] | 5225 | * @deprecated This function no longer does anything; it was an old |
kmccormick | ac66b85 | 2013-03-28 15:17:15 -0700 | [diff] [blame] | 5226 | * approach to managing preferred activities, which has been superseded |
| 5227 | * by (and conflicts with) the modern activity-based preferences. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5228 | */ |
Dianne Hackborn | a7ca0e5 | 2009-12-01 14:31:55 -0800 | [diff] [blame] | 5229 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5230 | public abstract void addPackageToPreferred(String packageName); |
| 5231 | |
| 5232 | /** |
Dianne Hackborn | a7ca0e5 | 2009-12-01 14:31:55 -0800 | [diff] [blame] | 5233 | * @deprecated This function no longer does anything; it was an old |
kmccormick | ac66b85 | 2013-03-28 15:17:15 -0700 | [diff] [blame] | 5234 | * approach to managing preferred activities, which has been superseded |
| 5235 | * by (and conflicts with) the modern activity-based preferences. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5236 | */ |
Dianne Hackborn | a7ca0e5 | 2009-12-01 14:31:55 -0800 | [diff] [blame] | 5237 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5238 | public abstract void removePackageFromPreferred(String packageName); |
| 5239 | |
| 5240 | /** |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 5241 | * Retrieve the list of all currently configured preferred packages. The |
| 5242 | * first package on the list is the most preferred, the last is the least |
| 5243 | * preferred. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5244 | * |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 5245 | * @param flags Additional option flags to modify the data returned. |
| 5246 | * @return A List of PackageInfo objects, one for each preferred |
| 5247 | * application, in order of preference. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5248 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 5249 | public abstract List<PackageInfo> getPreferredPackages(@PackageInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5250 | |
| 5251 | /** |
Dianne Hackborn | 2ee89ea | 2010-03-10 18:27:09 -0800 | [diff] [blame] | 5252 | * @deprecated This is a protected API that should not have been available |
| 5253 | * to third party applications. It is the platform's responsibility for |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 5254 | * assigning preferred activities and this cannot be directly modified. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 5255 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5256 | * Add a new preferred activity mapping to the system. This will be used |
| 5257 | * to automatically select the given activity component when |
| 5258 | * {@link Context#startActivity(Intent) Context.startActivity()} finds |
| 5259 | * multiple matching activities and also matches the given filter. |
| 5260 | * |
| 5261 | * @param filter The set of intents under which this activity will be |
| 5262 | * made preferred. |
| 5263 | * @param match The IntentFilter match category that this preference |
| 5264 | * applies to. |
| 5265 | * @param set The set of activities that the user was picking from when |
| 5266 | * this preference was made. |
| 5267 | * @param activity The component name of the activity that is to be |
| 5268 | * preferred. |
| 5269 | */ |
Dianne Hackborn | 2ee89ea | 2010-03-10 18:27:09 -0800 | [diff] [blame] | 5270 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5271 | public abstract void addPreferredActivity(IntentFilter filter, int match, |
| 5272 | ComponentName[] set, ComponentName activity); |
| 5273 | |
| 5274 | /** |
Amith Yamasani | a3f133a | 2012-08-09 17:11:28 -0700 | [diff] [blame] | 5275 | * Same as {@link #addPreferredActivity(IntentFilter, int, |
| 5276 | ComponentName[], ComponentName)}, but with a specific userId to apply the preference |
| 5277 | to. |
| 5278 | * @hide |
| 5279 | */ |
Jeff Sharkey | e06b4d1 | 2016-01-06 14:51:50 -0700 | [diff] [blame] | 5280 | public void addPreferredActivityAsUser(IntentFilter filter, int match, |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 5281 | ComponentName[] set, ComponentName activity, @UserIdInt int userId) { |
Amith Yamasani | a3f133a | 2012-08-09 17:11:28 -0700 | [diff] [blame] | 5282 | throw new RuntimeException("Not implemented. Must override in a subclass."); |
| 5283 | } |
| 5284 | |
| 5285 | /** |
Dianne Hackborn | 2ee89ea | 2010-03-10 18:27:09 -0800 | [diff] [blame] | 5286 | * @deprecated This is a protected API that should not have been available |
| 5287 | * to third party applications. It is the platform's responsibility for |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 5288 | * assigning preferred activities and this cannot be directly modified. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 5289 | * |
Satish Sampath | 8dbe612 | 2009-06-02 23:35:54 +0100 | [diff] [blame] | 5290 | * Replaces an existing preferred activity mapping to the system, and if that were not present |
| 5291 | * adds a new preferred activity. This will be used |
| 5292 | * to automatically select the given activity component when |
| 5293 | * {@link Context#startActivity(Intent) Context.startActivity()} finds |
| 5294 | * multiple matching activities and also matches the given filter. |
| 5295 | * |
| 5296 | * @param filter The set of intents under which this activity will be |
| 5297 | * made preferred. |
| 5298 | * @param match The IntentFilter match category that this preference |
| 5299 | * applies to. |
| 5300 | * @param set The set of activities that the user was picking from when |
| 5301 | * this preference was made. |
| 5302 | * @param activity The component name of the activity that is to be |
| 5303 | * preferred. |
| 5304 | * @hide |
| 5305 | */ |
Dianne Hackborn | 2ee89ea | 2010-03-10 18:27:09 -0800 | [diff] [blame] | 5306 | @Deprecated |
Satish Sampath | 8dbe612 | 2009-06-02 23:35:54 +0100 | [diff] [blame] | 5307 | public abstract void replacePreferredActivity(IntentFilter filter, int match, |
| 5308 | ComponentName[] set, ComponentName activity); |
| 5309 | |
| 5310 | /** |
Amith Yamasani | 41c1ded | 2014-08-05 11:15:05 -0700 | [diff] [blame] | 5311 | * @hide |
| 5312 | */ |
| 5313 | @Deprecated |
| 5314 | public void replacePreferredActivityAsUser(IntentFilter filter, int match, |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 5315 | ComponentName[] set, ComponentName activity, @UserIdInt int userId) { |
Amith Yamasani | 41c1ded | 2014-08-05 11:15:05 -0700 | [diff] [blame] | 5316 | throw new RuntimeException("Not implemented. Must override in a subclass."); |
| 5317 | } |
| 5318 | |
| 5319 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5320 | * Remove all preferred activity mappings, previously added with |
| 5321 | * {@link #addPreferredActivity}, from the |
| 5322 | * system whose activities are implemented in the given package name. |
Dianne Hackborn | 2ee89ea | 2010-03-10 18:27:09 -0800 | [diff] [blame] | 5323 | * An application can only clear its own package(s). |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5324 | * |
| 5325 | * @param packageName The name of the package whose preferred activity |
| 5326 | * mappings are to be removed. |
| 5327 | */ |
| 5328 | public abstract void clearPackagePreferredActivities(String packageName); |
| 5329 | |
| 5330 | /** |
| 5331 | * Retrieve all preferred activities, previously added with |
| 5332 | * {@link #addPreferredActivity}, that are |
| 5333 | * currently registered with the system. |
| 5334 | * |
John Spurlock | 38e6425 | 2015-03-18 12:09:32 -0400 | [diff] [blame] | 5335 | * @param outFilters A required list in which to place the filters of all of the |
| 5336 | * preferred activities. |
| 5337 | * @param outActivities A required list in which to place the component names of |
| 5338 | * all of the preferred activities. |
| 5339 | * @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] | 5340 | * the list. If null, all activities will be returned; if non-null, only |
| 5341 | * those activities in the given package are returned. |
| 5342 | * |
| 5343 | * @return Returns the total number of registered preferred activities |
| 5344 | * (the number of distinct IntentFilter records, not the number of unique |
| 5345 | * activity components) that were found. |
| 5346 | */ |
John Spurlock | 38e6425 | 2015-03-18 12:09:32 -0400 | [diff] [blame] | 5347 | public abstract int getPreferredActivities(@NonNull List<IntentFilter> outFilters, |
| 5348 | @NonNull List<ComponentName> outActivities, String packageName); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5349 | |
| 5350 | /** |
Christopher Tate | a2a0850d | 2013-09-05 16:38:58 -0700 | [diff] [blame] | 5351 | * Ask for the set of available 'home' activities and the current explicit |
| 5352 | * default, if any. |
| 5353 | * @hide |
| 5354 | */ |
| 5355 | public abstract ComponentName getHomeActivities(List<ResolveInfo> outActivities); |
| 5356 | |
| 5357 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5358 | * Set the enabled setting for a package component (activity, receiver, service, provider). |
| 5359 | * This setting will override any enabled state which may have been set by the component in its |
| 5360 | * manifest. |
| 5361 | * |
| 5362 | * @param componentName The component to enable |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5363 | * @param newState The new enabled state for the component. |
| 5364 | * @param flags Optional behavior flags. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5365 | */ |
| 5366 | public abstract void setComponentEnabledSetting(ComponentName componentName, |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5367 | @EnabledState int newState, @EnabledFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5368 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5369 | /** |
Amaury Medeiros | dde2426 | 2014-06-03 20:06:41 -0300 | [diff] [blame] | 5370 | * Return the enabled setting for a package component (activity, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5371 | * receiver, service, provider). This returns the last value set by |
| 5372 | * {@link #setComponentEnabledSetting(ComponentName, int, int)}; in most |
| 5373 | * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since |
| 5374 | * the value originally specified in the manifest has not been modified. |
| 5375 | * |
| 5376 | * @param componentName The component to retrieve. |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5377 | * @return Returns the current enabled state for the component. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5378 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5379 | public abstract @EnabledState int getComponentEnabledSetting( |
| 5380 | ComponentName componentName); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5381 | |
| 5382 | /** |
| 5383 | * Set the enabled setting for an application |
| 5384 | * This setting will override any enabled state which may have been set by the application in |
| 5385 | * its manifest. It also overrides the enabled state set in the manifest for any of the |
| 5386 | * application's components. It does not override any enabled state set by |
| 5387 | * {@link #setComponentEnabledSetting} for any of the application's components. |
| 5388 | * |
| 5389 | * @param packageName The package name of the application to enable |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5390 | * @param newState The new enabled state for the application. |
| 5391 | * @param flags Optional behavior flags. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5392 | */ |
| 5393 | public abstract void setApplicationEnabledSetting(String packageName, |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5394 | @EnabledState int newState, @EnabledFlags int flags); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 5395 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5396 | /** |
Amaury Medeiros | dde2426 | 2014-06-03 20:06:41 -0300 | [diff] [blame] | 5397 | * Return the enabled setting for an application. This returns |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5398 | * the last value set by |
| 5399 | * {@link #setApplicationEnabledSetting(String, int, int)}; in most |
| 5400 | * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since |
| 5401 | * the value originally specified in the manifest has not been modified. |
| 5402 | * |
Amaury Medeiros | dde2426 | 2014-06-03 20:06:41 -0300 | [diff] [blame] | 5403 | * @param packageName The package name of the application to retrieve. |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5404 | * @return Returns the current enabled state for the application. |
Mathew Inwood | 1b9f8d9 | 2011-09-26 13:23:56 +0100 | [diff] [blame] | 5405 | * @throws IllegalArgumentException if the named package does not exist. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5406 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5407 | public abstract @EnabledState int getApplicationEnabledSetting(String packageName); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5408 | |
| 5409 | /** |
Sudheer Shanka | bbb3ff2 | 2015-07-09 15:39:23 +0100 | [diff] [blame] | 5410 | * Flush the package restrictions for a given user to disk. This forces the package restrictions |
| 5411 | * like component and package enabled settings to be written to disk and avoids the delay that |
| 5412 | * is otherwise present when changing those settings. |
| 5413 | * |
| 5414 | * @param userId Ther userId of the user whose restrictions are to be flushed. |
| 5415 | * @hide |
| 5416 | */ |
| 5417 | public abstract void flushPackageRestrictionsAsUser(int userId); |
| 5418 | |
| 5419 | /** |
Amith Yamasani | e5bcff6 | 2014-07-19 15:44:09 -0700 | [diff] [blame] | 5420 | * 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] | 5421 | * 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] | 5422 | * package file. Application can be unhidden by either resetting the hidden state |
| 5423 | * or by installing it, such as with {@link #installExistingPackage(String)} |
Amith Yamasani | 655d0e2 | 2013-06-12 14:19:10 -0700 | [diff] [blame] | 5424 | * @hide |
| 5425 | */ |
Amith Yamasani | e5bcff6 | 2014-07-19 15:44:09 -0700 | [diff] [blame] | 5426 | public abstract boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden, |
Amith Yamasani | 655d0e2 | 2013-06-12 14:19:10 -0700 | [diff] [blame] | 5427 | UserHandle userHandle); |
| 5428 | |
| 5429 | /** |
Amith Yamasani | e5bcff6 | 2014-07-19 15:44:09 -0700 | [diff] [blame] | 5430 | * Returns the hidden state of a package. |
| 5431 | * @see #setApplicationHiddenSettingAsUser(String, boolean, UserHandle) |
Amith Yamasani | 655d0e2 | 2013-06-12 14:19:10 -0700 | [diff] [blame] | 5432 | * @hide |
| 5433 | */ |
Amith Yamasani | e5bcff6 | 2014-07-19 15:44:09 -0700 | [diff] [blame] | 5434 | public abstract boolean getApplicationHiddenSettingAsUser(String packageName, |
Amith Yamasani | 655d0e2 | 2013-06-12 14:19:10 -0700 | [diff] [blame] | 5435 | UserHandle userHandle); |
| 5436 | |
| 5437 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5438 | * Return whether the device has been booted into safe mode. |
| 5439 | */ |
| 5440 | public abstract boolean isSafeMode(); |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 5441 | |
| 5442 | /** |
Svetoslav | f7c06eb | 2015-06-10 18:43:22 -0700 | [diff] [blame] | 5443 | * Adds a listener for permission changes for installed packages. |
| 5444 | * |
| 5445 | * @param listener The listener to add. |
| 5446 | * |
| 5447 | * @hide |
| 5448 | */ |
| 5449 | @SystemApi |
| 5450 | @RequiresPermission(Manifest.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS) |
| 5451 | public abstract void addOnPermissionsChangeListener(OnPermissionsChangedListener listener); |
| 5452 | |
| 5453 | /** |
| 5454 | * Remvoes a listener for permission changes for installed packages. |
| 5455 | * |
| 5456 | * @param listener The listener to remove. |
| 5457 | * |
| 5458 | * @hide |
| 5459 | */ |
| 5460 | @SystemApi |
Jeff Sharkey | d86b8fe | 2017-06-02 17:36:26 -0600 | [diff] [blame] | 5461 | @RequiresPermission(Manifest.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS) |
Svetoslav | f7c06eb | 2015-06-10 18:43:22 -0700 | [diff] [blame] | 5462 | public abstract void removeOnPermissionsChangeListener(OnPermissionsChangedListener listener); |
| 5463 | |
| 5464 | /** |
dcashman | 9d2f441 | 2014-06-09 09:27:54 -0700 | [diff] [blame] | 5465 | * Return the {@link KeySet} associated with the String alias for this |
| 5466 | * application. |
| 5467 | * |
| 5468 | * @param alias The alias for a given {@link KeySet} as defined in the |
| 5469 | * application's AndroidManifest.xml. |
dcashman | c6f2249 | 2014-08-14 09:54:51 -0700 | [diff] [blame] | 5470 | * @hide |
dcashman | 9d2f441 | 2014-06-09 09:27:54 -0700 | [diff] [blame] | 5471 | */ |
| 5472 | public abstract KeySet getKeySetByAlias(String packageName, String alias); |
| 5473 | |
Ihab Awad | 1ec6888 | 2014-09-12 11:09:01 -0700 | [diff] [blame] | 5474 | /** Return the signing {@link KeySet} for this application. |
dcashman | c6f2249 | 2014-08-14 09:54:51 -0700 | [diff] [blame] | 5475 | * @hide |
| 5476 | */ |
dcashman | 9d2f441 | 2014-06-09 09:27:54 -0700 | [diff] [blame] | 5477 | public abstract KeySet getSigningKeySet(String packageName); |
| 5478 | |
| 5479 | /** |
| 5480 | * Return whether the package denoted by packageName has been signed by all |
| 5481 | * of the keys specified by the {@link KeySet} ks. This will return true if |
| 5482 | * the package has been signed by additional keys (a superset) as well. |
| 5483 | * Compare to {@link #isSignedByExactly(String packageName, KeySet ks)}. |
dcashman | c6f2249 | 2014-08-14 09:54:51 -0700 | [diff] [blame] | 5484 | * @hide |
dcashman | 9d2f441 | 2014-06-09 09:27:54 -0700 | [diff] [blame] | 5485 | */ |
| 5486 | public abstract boolean isSignedBy(String packageName, KeySet ks); |
| 5487 | |
| 5488 | /** |
| 5489 | * Return whether the package denoted by packageName has been signed by all |
| 5490 | * of, and only, the keys specified by the {@link KeySet} ks. Compare to |
| 5491 | * {@link #isSignedBy(String packageName, KeySet ks)}. |
dcashman | c6f2249 | 2014-08-14 09:54:51 -0700 | [diff] [blame] | 5492 | * @hide |
dcashman | 9d2f441 | 2014-06-09 09:27:54 -0700 | [diff] [blame] | 5493 | */ |
| 5494 | public abstract boolean isSignedByExactly(String packageName, KeySet ks); |
| 5495 | |
| 5496 | /** |
Andrei Stingaceanu | eb84b18 | 2016-01-26 18:39:55 +0000 | [diff] [blame] | 5497 | * Puts the package in a suspended state, where attempts at starting activities are denied. |
Andrei Stingaceanu | 1e28391 | 2015-11-26 15:26:28 +0000 | [diff] [blame] | 5498 | * |
Andrei Stingaceanu | eb84b18 | 2016-01-26 18:39:55 +0000 | [diff] [blame] | 5499 | * <p>It doesn't remove the data or the actual package file. The application notifications |
| 5500 | * will be hidden, the application will not show up in recents, will not be able to show |
| 5501 | * toasts or dialogs or ring the device. |
| 5502 | * |
Kenny Guy | 871f3eb | 2016-03-09 20:06:16 +0000 | [diff] [blame] | 5503 | * <p>The package must already be installed. If the package is uninstalled while suspended |
| 5504 | * the package will no longer be suspended. |
| 5505 | * |
Andrei Stingaceanu | eb84b18 | 2016-01-26 18:39:55 +0000 | [diff] [blame] | 5506 | * @param packageNames The names of the packages to set the suspended status. |
| 5507 | * @param suspended If set to {@code true} than the packages will be suspended, if set to |
| 5508 | * {@code false} the packages will be unsuspended. |
Andrei Stingaceanu | 1e28391 | 2015-11-26 15:26:28 +0000 | [diff] [blame] | 5509 | * @param userId The user id. |
| 5510 | * |
Andrei Stingaceanu | eb84b18 | 2016-01-26 18:39:55 +0000 | [diff] [blame] | 5511 | * @return an array of package names for which the suspended status is not set as requested in |
| 5512 | * this method. |
| 5513 | * |
Andrei Stingaceanu | 1e28391 | 2015-11-26 15:26:28 +0000 | [diff] [blame] | 5514 | * @hide |
| 5515 | */ |
Andrei Stingaceanu | eb84b18 | 2016-01-26 18:39:55 +0000 | [diff] [blame] | 5516 | public abstract String[] setPackagesSuspendedAsUser( |
| 5517 | String[] packageNames, boolean suspended, @UserIdInt int userId); |
Andrei Stingaceanu | 1e28391 | 2015-11-26 15:26:28 +0000 | [diff] [blame] | 5518 | |
Andrei Stingaceanu | 355b232 | 2016-02-12 16:43:51 +0000 | [diff] [blame] | 5519 | /** |
| 5520 | * @see #setPackageSuspendedAsUser(String, boolean, int) |
| 5521 | * @param packageName The name of the package to get the suspended status of. |
| 5522 | * @param userId The user id. |
| 5523 | * @return {@code true} if the package is suspended or {@code false} if the package is not |
| 5524 | * suspended or could not be found. |
| 5525 | * @hide |
| 5526 | */ |
| 5527 | public abstract boolean isPackageSuspendedForUser(String packageName, int userId); |
| 5528 | |
Jeff Sharkey | 9bc89af | 2017-01-11 11:25:50 -0700 | [diff] [blame] | 5529 | /** |
| 5530 | * Provide a hint of what the {@link ApplicationInfo#category} value should |
| 5531 | * be for the given package. |
| 5532 | * <p> |
| 5533 | * This hint can only be set by the app which installed this package, as |
| 5534 | * determined by {@link #getInstallerPackageName(String)}. |
Jeff Sharkey | 60a82cd | 2017-04-18 18:19:16 -0600 | [diff] [blame] | 5535 | * |
| 5536 | * @param packageName the package to change the category hint for. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 5537 | * @param categoryHint the category hint to set. |
Jeff Sharkey | 9bc89af | 2017-01-11 11:25:50 -0700 | [diff] [blame] | 5538 | */ |
Jeff Sharkey | 60a82cd | 2017-04-18 18:19:16 -0600 | [diff] [blame] | 5539 | public abstract void setApplicationCategoryHint(@NonNull String packageName, |
Jeff Sharkey | 9bc89af | 2017-01-11 11:25:50 -0700 | [diff] [blame] | 5540 | @ApplicationInfo.Category int categoryHint); |
| 5541 | |
Jeff Sharkey | b2b9ab8 | 2015-04-05 21:10:42 -0700 | [diff] [blame] | 5542 | /** {@hide} */ |
Jeff Sharkey | 620b32b | 2015-04-23 19:36:02 -0700 | [diff] [blame] | 5543 | public static boolean isMoveStatusFinished(int status) { |
| 5544 | return (status < 0 || status > 100); |
| 5545 | } |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 5546 | |
Jeff Sharkey | e2d45be | 2015-04-15 17:14:12 -0700 | [diff] [blame] | 5547 | /** {@hide} */ |
Jeff Sharkey | 620b32b | 2015-04-23 19:36:02 -0700 | [diff] [blame] | 5548 | public static abstract class MoveCallback { |
Jeff Sharkey | 50a0545 | 2015-04-29 11:24:52 -0700 | [diff] [blame] | 5549 | public void onCreated(int moveId, Bundle extras) {} |
| 5550 | public abstract void onStatusChanged(int moveId, int status, long estMillis); |
Jeff Sharkey | 620b32b | 2015-04-23 19:36:02 -0700 | [diff] [blame] | 5551 | } |
Jeff Sharkey | e2d45be | 2015-04-15 17:14:12 -0700 | [diff] [blame] | 5552 | |
| 5553 | /** {@hide} */ |
Jeff Sharkey | 620b32b | 2015-04-23 19:36:02 -0700 | [diff] [blame] | 5554 | public abstract int getMoveStatus(int moveId); |
| 5555 | |
| 5556 | /** {@hide} */ |
| 5557 | public abstract void registerMoveCallback(MoveCallback callback, Handler handler); |
| 5558 | /** {@hide} */ |
| 5559 | public abstract void unregisterMoveCallback(MoveCallback callback); |
| 5560 | |
| 5561 | /** {@hide} */ |
| 5562 | public abstract int movePackage(String packageName, VolumeInfo vol); |
| 5563 | /** {@hide} */ |
| 5564 | public abstract @Nullable VolumeInfo getPackageCurrentVolume(ApplicationInfo app); |
| 5565 | /** {@hide} */ |
| 5566 | public abstract @NonNull List<VolumeInfo> getPackageCandidateVolumes(ApplicationInfo app); |
| 5567 | |
| 5568 | /** {@hide} */ |
| 5569 | public abstract int movePrimaryStorage(VolumeInfo vol); |
| 5570 | /** {@hide} */ |
| 5571 | public abstract @Nullable VolumeInfo getPrimaryStorageCurrentVolume(); |
| 5572 | /** {@hide} */ |
| 5573 | public abstract @NonNull List<VolumeInfo> getPrimaryStorageCandidateVolumes(); |
Jeff Sharkey | e2d45be | 2015-04-15 17:14:12 -0700 | [diff] [blame] | 5574 | |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 5575 | /** |
Amith Yamasani | 1359360 | 2012-03-22 16:16:17 -0700 | [diff] [blame] | 5576 | * Returns the device identity that verifiers can use to associate their scheme to a particular |
| 5577 | * 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] | 5578 | * |
Kenny Root | 0aaa0d9 | 2011-09-12 16:42:55 -0700 | [diff] [blame] | 5579 | * @return identity that uniquely identifies current device |
| 5580 | * @hide |
| 5581 | */ |
| 5582 | public abstract VerifierDeviceIdentity getVerifierDeviceIdentity(); |
Amith Yamasani | 742a671 | 2011-05-04 14:49:28 -0700 | [diff] [blame] | 5583 | |
Jeff Sharkey | 6c833e0 | 2014-07-14 22:44:30 -0700 | [diff] [blame] | 5584 | /** |
Jeff Hao | 9f60c08 | 2014-10-28 18:51:07 -0700 | [diff] [blame] | 5585 | * Returns true if the device is upgrading, such as first boot after OTA. |
| 5586 | * |
| 5587 | * @hide |
| 5588 | */ |
| 5589 | public abstract boolean isUpgrade(); |
| 5590 | |
| 5591 | /** |
Jeff Sharkey | 6c833e0 | 2014-07-14 22:44:30 -0700 | [diff] [blame] | 5592 | * Return interface that offers the ability to install, upgrade, and remove |
| 5593 | * applications on the device. |
| 5594 | */ |
Jeff Sharkey | 16c8e3f | 2014-07-24 17:08:17 -0700 | [diff] [blame] | 5595 | public abstract @NonNull PackageInstaller getPackageInstaller(); |
Jeff Sharkey | 3a44f3f | 2014-04-28 17:36:31 -0700 | [diff] [blame] | 5596 | |
Amith Yamasani | 742a671 | 2011-05-04 14:49:28 -0700 | [diff] [blame] | 5597 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 5598 | * Adds a {@code CrossProfileIntentFilter}. After calling this method all |
| 5599 | * intents sent from the user with id sourceUserId can also be be resolved |
| 5600 | * by activities in the user with id targetUserId if they match the |
| 5601 | * specified intent filter. |
| 5602 | * |
Nicolas Prevot | 3f7777f | 2014-07-24 15:58:39 +0100 | [diff] [blame] | 5603 | * @param filter The {@link IntentFilter} the intent has to match |
| 5604 | * @param sourceUserId The source user id. |
| 5605 | * @param targetUserId The target user id. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 5606 | * @param flags The possible values are {@link #SKIP_CURRENT_PROFILE} and |
| 5607 | * {@link #ONLY_IF_NO_MATCH_FOUND}. |
Nicolas Prevot | c79586e | 2014-05-06 12:47:57 +0100 | [diff] [blame] | 5608 | * @hide |
| 5609 | */ |
Nicolas Prevot | 63798c5 | 2014-05-27 13:22:38 +0100 | [diff] [blame] | 5610 | public abstract void addCrossProfileIntentFilter(IntentFilter filter, int sourceUserId, |
| 5611 | int targetUserId, int flags); |
Nicolas Prevot | c79586e | 2014-05-06 12:47:57 +0100 | [diff] [blame] | 5612 | |
| 5613 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 5614 | * Clearing {@code CrossProfileIntentFilter}s which have the specified user |
| 5615 | * as their source, and have been set by the app calling this method. |
| 5616 | * |
Nicolas Prevot | 3f7777f | 2014-07-24 15:58:39 +0100 | [diff] [blame] | 5617 | * @param sourceUserId The source user id. |
Nicolas Prevot | c79586e | 2014-05-06 12:47:57 +0100 | [diff] [blame] | 5618 | * @hide |
| 5619 | */ |
Nicolas Prevot | 8194899 | 2014-05-16 18:25:26 +0100 | [diff] [blame] | 5620 | public abstract void clearCrossProfileIntentFilters(int sourceUserId); |
Alexandra Gherghina | 6e2ae25 | 2014-06-12 16:03:58 +0100 | [diff] [blame] | 5621 | |
| 5622 | /** |
Nicolas Prevot | 88cc346 | 2014-05-14 14:51:48 +0100 | [diff] [blame] | 5623 | * @hide |
| 5624 | */ |
Nicolas Prevot | 7f7b0c7 | 2014-06-23 15:59:38 +0100 | [diff] [blame] | 5625 | public abstract Drawable loadItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo); |
Jeff Sharkey | 6c833e0 | 2014-07-14 22:44:30 -0700 | [diff] [blame] | 5626 | |
Benjamin Franz | ec2d48b | 2014-10-01 15:38:43 +0100 | [diff] [blame] | 5627 | /** |
| 5628 | * @hide |
| 5629 | */ |
| 5630 | public abstract Drawable loadUnbadgedItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo); |
| 5631 | |
Jeff Sharkey | 6c833e0 | 2014-07-14 22:44:30 -0700 | [diff] [blame] | 5632 | /** {@hide} */ |
| 5633 | public abstract boolean isPackageAvailable(String packageName); |
Jeff Sharkey | 16c8e3f | 2014-07-24 17:08:17 -0700 | [diff] [blame] | 5634 | |
| 5635 | /** {@hide} */ |
Jeff Sharkey | a090743 | 2014-08-15 10:23:11 -0700 | [diff] [blame] | 5636 | public static String installStatusToString(int status, String msg) { |
| 5637 | final String str = installStatusToString(status); |
| 5638 | if (msg != null) { |
| 5639 | return str + ": " + msg; |
| 5640 | } else { |
| 5641 | return str; |
| 5642 | } |
| 5643 | } |
| 5644 | |
| 5645 | /** {@hide} */ |
Jeff Sharkey | 16c8e3f | 2014-07-24 17:08:17 -0700 | [diff] [blame] | 5646 | public static String installStatusToString(int status) { |
| 5647 | switch (status) { |
| 5648 | case INSTALL_SUCCEEDED: return "INSTALL_SUCCEEDED"; |
| 5649 | case INSTALL_FAILED_ALREADY_EXISTS: return "INSTALL_FAILED_ALREADY_EXISTS"; |
| 5650 | case INSTALL_FAILED_INVALID_APK: return "INSTALL_FAILED_INVALID_APK"; |
| 5651 | case INSTALL_FAILED_INVALID_URI: return "INSTALL_FAILED_INVALID_URI"; |
| 5652 | case INSTALL_FAILED_INSUFFICIENT_STORAGE: return "INSTALL_FAILED_INSUFFICIENT_STORAGE"; |
| 5653 | case INSTALL_FAILED_DUPLICATE_PACKAGE: return "INSTALL_FAILED_DUPLICATE_PACKAGE"; |
| 5654 | case INSTALL_FAILED_NO_SHARED_USER: return "INSTALL_FAILED_NO_SHARED_USER"; |
| 5655 | case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return "INSTALL_FAILED_UPDATE_INCOMPATIBLE"; |
| 5656 | case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return "INSTALL_FAILED_SHARED_USER_INCOMPATIBLE"; |
| 5657 | case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return "INSTALL_FAILED_MISSING_SHARED_LIBRARY"; |
| 5658 | case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return "INSTALL_FAILED_REPLACE_COULDNT_DELETE"; |
| 5659 | case INSTALL_FAILED_DEXOPT: return "INSTALL_FAILED_DEXOPT"; |
| 5660 | case INSTALL_FAILED_OLDER_SDK: return "INSTALL_FAILED_OLDER_SDK"; |
| 5661 | case INSTALL_FAILED_CONFLICTING_PROVIDER: return "INSTALL_FAILED_CONFLICTING_PROVIDER"; |
| 5662 | case INSTALL_FAILED_NEWER_SDK: return "INSTALL_FAILED_NEWER_SDK"; |
| 5663 | case INSTALL_FAILED_TEST_ONLY: return "INSTALL_FAILED_TEST_ONLY"; |
| 5664 | case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return "INSTALL_FAILED_CPU_ABI_INCOMPATIBLE"; |
| 5665 | case INSTALL_FAILED_MISSING_FEATURE: return "INSTALL_FAILED_MISSING_FEATURE"; |
| 5666 | case INSTALL_FAILED_CONTAINER_ERROR: return "INSTALL_FAILED_CONTAINER_ERROR"; |
| 5667 | case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return "INSTALL_FAILED_INVALID_INSTALL_LOCATION"; |
| 5668 | case INSTALL_FAILED_MEDIA_UNAVAILABLE: return "INSTALL_FAILED_MEDIA_UNAVAILABLE"; |
| 5669 | case INSTALL_FAILED_VERIFICATION_TIMEOUT: return "INSTALL_FAILED_VERIFICATION_TIMEOUT"; |
| 5670 | case INSTALL_FAILED_VERIFICATION_FAILURE: return "INSTALL_FAILED_VERIFICATION_FAILURE"; |
| 5671 | case INSTALL_FAILED_PACKAGE_CHANGED: return "INSTALL_FAILED_PACKAGE_CHANGED"; |
| 5672 | case INSTALL_FAILED_UID_CHANGED: return "INSTALL_FAILED_UID_CHANGED"; |
| 5673 | case INSTALL_FAILED_VERSION_DOWNGRADE: return "INSTALL_FAILED_VERSION_DOWNGRADE"; |
| 5674 | case INSTALL_PARSE_FAILED_NOT_APK: return "INSTALL_PARSE_FAILED_NOT_APK"; |
| 5675 | case INSTALL_PARSE_FAILED_BAD_MANIFEST: return "INSTALL_PARSE_FAILED_BAD_MANIFEST"; |
| 5676 | case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return "INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION"; |
| 5677 | case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return "INSTALL_PARSE_FAILED_NO_CERTIFICATES"; |
| 5678 | case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return "INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES"; |
| 5679 | case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return "INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING"; |
| 5680 | case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return "INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME"; |
| 5681 | case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return "INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID"; |
| 5682 | case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return "INSTALL_PARSE_FAILED_MANIFEST_MALFORMED"; |
| 5683 | case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return "INSTALL_PARSE_FAILED_MANIFEST_EMPTY"; |
| 5684 | case INSTALL_FAILED_INTERNAL_ERROR: return "INSTALL_FAILED_INTERNAL_ERROR"; |
| 5685 | case INSTALL_FAILED_USER_RESTRICTED: return "INSTALL_FAILED_USER_RESTRICTED"; |
| 5686 | case INSTALL_FAILED_DUPLICATE_PERMISSION: return "INSTALL_FAILED_DUPLICATE_PERMISSION"; |
| 5687 | case INSTALL_FAILED_NO_MATCHING_ABIS: return "INSTALL_FAILED_NO_MATCHING_ABIS"; |
Jeff Sharkey | f060095 | 2014-08-07 17:31:53 -0700 | [diff] [blame] | 5688 | case INSTALL_FAILED_ABORTED: return "INSTALL_FAILED_ABORTED"; |
Calin Juravle | 3fc56c3 | 2017-12-11 18:26:13 -0800 | [diff] [blame] | 5689 | case INSTALL_FAILED_BAD_DEX_METADATA: |
| 5690 | return "INSTALL_FAILED_BAD_DEX_METADATA"; |
Jeff Sharkey | 16c8e3f | 2014-07-24 17:08:17 -0700 | [diff] [blame] | 5691 | default: return Integer.toString(status); |
| 5692 | } |
| 5693 | } |
| 5694 | |
| 5695 | /** {@hide} */ |
Jeff Sharkey | a090743 | 2014-08-15 10:23:11 -0700 | [diff] [blame] | 5696 | public static int installStatusToPublicStatus(int status) { |
Jeff Sharkey | 16c8e3f | 2014-07-24 17:08:17 -0700 | [diff] [blame] | 5697 | switch (status) { |
Jeff Sharkey | a090743 | 2014-08-15 10:23:11 -0700 | [diff] [blame] | 5698 | case INSTALL_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS; |
| 5699 | case INSTALL_FAILED_ALREADY_EXISTS: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 5700 | case INSTALL_FAILED_INVALID_APK: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 5701 | case INSTALL_FAILED_INVALID_URI: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 5702 | case INSTALL_FAILED_INSUFFICIENT_STORAGE: return PackageInstaller.STATUS_FAILURE_STORAGE; |
| 5703 | case INSTALL_FAILED_DUPLICATE_PACKAGE: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 5704 | case INSTALL_FAILED_NO_SHARED_USER: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 5705 | case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 5706 | case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 5707 | case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; |
| 5708 | case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 5709 | case INSTALL_FAILED_DEXOPT: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 5710 | case INSTALL_FAILED_OLDER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; |
| 5711 | case INSTALL_FAILED_CONFLICTING_PROVIDER: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 5712 | case INSTALL_FAILED_NEWER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; |
| 5713 | case INSTALL_FAILED_TEST_ONLY: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 5714 | case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; |
| 5715 | case INSTALL_FAILED_MISSING_FEATURE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; |
| 5716 | case INSTALL_FAILED_CONTAINER_ERROR: return PackageInstaller.STATUS_FAILURE_STORAGE; |
| 5717 | case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return PackageInstaller.STATUS_FAILURE_STORAGE; |
| 5718 | case INSTALL_FAILED_MEDIA_UNAVAILABLE: return PackageInstaller.STATUS_FAILURE_STORAGE; |
| 5719 | case INSTALL_FAILED_VERIFICATION_TIMEOUT: return PackageInstaller.STATUS_FAILURE_ABORTED; |
| 5720 | case INSTALL_FAILED_VERIFICATION_FAILURE: return PackageInstaller.STATUS_FAILURE_ABORTED; |
| 5721 | case INSTALL_FAILED_PACKAGE_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 5722 | case INSTALL_FAILED_UID_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 5723 | case INSTALL_FAILED_VERSION_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID; |
Svetoslav | d965370 | 2015-05-13 18:02:46 -0700 | [diff] [blame] | 5724 | case INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID; |
Jeff Sharkey | a090743 | 2014-08-15 10:23:11 -0700 | [diff] [blame] | 5725 | case INSTALL_PARSE_FAILED_NOT_APK: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 5726 | case INSTALL_PARSE_FAILED_BAD_MANIFEST: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 5727 | case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 5728 | case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 5729 | case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 5730 | case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 5731 | case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 5732 | case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 5733 | case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 5734 | case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return PackageInstaller.STATUS_FAILURE_INVALID; |
Calin Juravle | 3fc56c3 | 2017-12-11 18:26:13 -0800 | [diff] [blame] | 5735 | case INSTALL_FAILED_BAD_DEX_METADATA: return PackageInstaller.STATUS_FAILURE_INVALID; |
Jeff Sharkey | a090743 | 2014-08-15 10:23:11 -0700 | [diff] [blame] | 5736 | case INSTALL_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE; |
| 5737 | case INSTALL_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; |
| 5738 | case INSTALL_FAILED_DUPLICATE_PERMISSION: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 5739 | case INSTALL_FAILED_NO_MATCHING_ABIS: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; |
| 5740 | case INSTALL_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED; |
| 5741 | default: return PackageInstaller.STATUS_FAILURE; |
| 5742 | } |
| 5743 | } |
| 5744 | |
| 5745 | /** {@hide} */ |
| 5746 | public static String deleteStatusToString(int status, String msg) { |
| 5747 | final String str = deleteStatusToString(status); |
| 5748 | if (msg != null) { |
| 5749 | return str + ": " + msg; |
| 5750 | } else { |
| 5751 | return str; |
Jeff Sharkey | 16c8e3f | 2014-07-24 17:08:17 -0700 | [diff] [blame] | 5752 | } |
| 5753 | } |
| 5754 | |
| 5755 | /** {@hide} */ |
| 5756 | public static String deleteStatusToString(int status) { |
| 5757 | switch (status) { |
| 5758 | case DELETE_SUCCEEDED: return "DELETE_SUCCEEDED"; |
| 5759 | case DELETE_FAILED_INTERNAL_ERROR: return "DELETE_FAILED_INTERNAL_ERROR"; |
| 5760 | case DELETE_FAILED_DEVICE_POLICY_MANAGER: return "DELETE_FAILED_DEVICE_POLICY_MANAGER"; |
| 5761 | case DELETE_FAILED_USER_RESTRICTED: return "DELETE_FAILED_USER_RESTRICTED"; |
| 5762 | case DELETE_FAILED_OWNER_BLOCKED: return "DELETE_FAILED_OWNER_BLOCKED"; |
Jeff Sharkey | f060095 | 2014-08-07 17:31:53 -0700 | [diff] [blame] | 5763 | case DELETE_FAILED_ABORTED: return "DELETE_FAILED_ABORTED"; |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 5764 | case DELETE_FAILED_USED_SHARED_LIBRARY: return "DELETE_FAILED_USED_SHARED_LIBRARY"; |
Jeff Sharkey | 16c8e3f | 2014-07-24 17:08:17 -0700 | [diff] [blame] | 5765 | default: return Integer.toString(status); |
| 5766 | } |
| 5767 | } |
Jeff Sharkey | f060095 | 2014-08-07 17:31:53 -0700 | [diff] [blame] | 5768 | |
| 5769 | /** {@hide} */ |
Jeff Sharkey | a090743 | 2014-08-15 10:23:11 -0700 | [diff] [blame] | 5770 | public static int deleteStatusToPublicStatus(int status) { |
Jeff Sharkey | f060095 | 2014-08-07 17:31:53 -0700 | [diff] [blame] | 5771 | switch (status) { |
Jeff Sharkey | a090743 | 2014-08-15 10:23:11 -0700 | [diff] [blame] | 5772 | case DELETE_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS; |
| 5773 | case DELETE_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE; |
| 5774 | case DELETE_FAILED_DEVICE_POLICY_MANAGER: return PackageInstaller.STATUS_FAILURE_BLOCKED; |
| 5775 | case DELETE_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_BLOCKED; |
| 5776 | case DELETE_FAILED_OWNER_BLOCKED: return PackageInstaller.STATUS_FAILURE_BLOCKED; |
| 5777 | case DELETE_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED; |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 5778 | case DELETE_FAILED_USED_SHARED_LIBRARY: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
Jeff Sharkey | a090743 | 2014-08-15 10:23:11 -0700 | [diff] [blame] | 5779 | default: return PackageInstaller.STATUS_FAILURE; |
Jeff Sharkey | f060095 | 2014-08-07 17:31:53 -0700 | [diff] [blame] | 5780 | } |
| 5781 | } |
Jeff Sharkey | 6c0b9da | 2014-08-07 22:07:11 -0700 | [diff] [blame] | 5782 | |
| 5783 | /** {@hide} */ |
Svet Ganov | 77ab6a8 | 2015-07-03 12:03:02 -0700 | [diff] [blame] | 5784 | public static String permissionFlagToString(int flag) { |
| 5785 | switch (flag) { |
Svetoslav | 4a5f4a2 | 2015-07-07 18:18:15 -0700 | [diff] [blame] | 5786 | case FLAG_PERMISSION_GRANTED_BY_DEFAULT: return "GRANTED_BY_DEFAULT"; |
| 5787 | case FLAG_PERMISSION_POLICY_FIXED: return "POLICY_FIXED"; |
| 5788 | case FLAG_PERMISSION_SYSTEM_FIXED: return "SYSTEM_FIXED"; |
| 5789 | case FLAG_PERMISSION_USER_SET: return "USER_SET"; |
| 5790 | case FLAG_PERMISSION_REVOKE_ON_UPGRADE: return "REVOKE_ON_UPGRADE"; |
| 5791 | case FLAG_PERMISSION_USER_FIXED: return "USER_FIXED"; |
Svet Ganov | 9c165d7 | 2015-12-01 19:52:26 -0800 | [diff] [blame] | 5792 | case FLAG_PERMISSION_REVIEW_REQUIRED: return "REVIEW_REQUIRED"; |
Svet Ganov | 77ab6a8 | 2015-07-03 12:03:02 -0700 | [diff] [blame] | 5793 | default: return Integer.toString(flag); |
| 5794 | } |
| 5795 | } |
| 5796 | |
| 5797 | /** {@hide} */ |
Jeff Sharkey | 6c0b9da | 2014-08-07 22:07:11 -0700 | [diff] [blame] | 5798 | public static class LegacyPackageDeleteObserver extends PackageDeleteObserver { |
| 5799 | private final IPackageDeleteObserver mLegacy; |
| 5800 | |
| 5801 | public LegacyPackageDeleteObserver(IPackageDeleteObserver legacy) { |
| 5802 | mLegacy = legacy; |
| 5803 | } |
| 5804 | |
| 5805 | @Override |
| 5806 | public void onPackageDeleted(String basePackageName, int returnCode, String msg) { |
| 5807 | if (mLegacy == null) return; |
| 5808 | try { |
| 5809 | mLegacy.packageDeleted(basePackageName, returnCode); |
| 5810 | } catch (RemoteException ignored) { |
| 5811 | } |
| 5812 | } |
| 5813 | } |
Bartosz Fabianowski | a34f53f | 2017-01-11 18:08:47 +0100 | [diff] [blame] | 5814 | |
| 5815 | /** |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 5816 | * Return the install reason that was recorded when a package was first |
| 5817 | * installed for a specific user. Requesting the install reason for another |
| 5818 | * user will require the permission INTERACT_ACROSS_USERS_FULL. |
Bartosz Fabianowski | a34f53f | 2017-01-11 18:08:47 +0100 | [diff] [blame] | 5819 | * |
| 5820 | * @param packageName The package for which to retrieve the install reason |
| 5821 | * @param user The user for whom to retrieve the install reason |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 5822 | * @return The install reason. If the package is not installed for the given |
| 5823 | * user, {@code INSTALL_REASON_UNKNOWN} is returned. |
Bartosz Fabianowski | a34f53f | 2017-01-11 18:08:47 +0100 | [diff] [blame] | 5824 | * @hide |
| 5825 | */ |
| 5826 | @TestApi |
| 5827 | public abstract @InstallReason int getInstallReason(String packageName, |
| 5828 | @NonNull UserHandle user); |
Suprabh Shukla | aef2513 | 2017-01-23 18:09:03 -0800 | [diff] [blame] | 5829 | |
| 5830 | /** |
| 5831 | * Checks whether the calling package is allowed to request package installs through package |
Suprabh Shukla | 5752847 | 2017-04-14 19:22:45 -0700 | [diff] [blame] | 5832 | * installer. Apps are encouraged to call this API before launching the package installer via |
Suprabh Shukla | aef2513 | 2017-01-23 18:09:03 -0800 | [diff] [blame] | 5833 | * intent {@link android.content.Intent#ACTION_INSTALL_PACKAGE}. Starting from Android O, the |
| 5834 | * user can explicitly choose what external sources they trust to install apps on the device. |
Suprabh Shukla | 5752847 | 2017-04-14 19:22:45 -0700 | [diff] [blame] | 5835 | * If this API returns false, the install request will be blocked by the package installer and |
Suprabh Shukla | aef2513 | 2017-01-23 18:09:03 -0800 | [diff] [blame] | 5836 | * a dialog will be shown to the user with an option to launch settings to change their |
| 5837 | * preference. An application must target Android O or higher and declare permission |
Suprabh Shukla | 5752847 | 2017-04-14 19:22:45 -0700 | [diff] [blame] | 5838 | * {@link android.Manifest.permission#REQUEST_INSTALL_PACKAGES} in order to use this API. |
Suprabh Shukla | aef2513 | 2017-01-23 18:09:03 -0800 | [diff] [blame] | 5839 | * |
| 5840 | * @return true if the calling package is trusted by the user to request install packages on |
| 5841 | * the device, false otherwise. |
Suprabh Shukla | 5752847 | 2017-04-14 19:22:45 -0700 | [diff] [blame] | 5842 | * @see android.content.Intent#ACTION_INSTALL_PACKAGE |
| 5843 | * @see android.provider.Settings#ACTION_MANAGE_UNKNOWN_APP_SOURCES |
Suprabh Shukla | aef2513 | 2017-01-23 18:09:03 -0800 | [diff] [blame] | 5844 | */ |
| 5845 | public abstract boolean canRequestPackageInstalls(); |
Chad Brubaker | aa49cb8 | 2017-03-24 15:53:09 -0700 | [diff] [blame] | 5846 | |
| 5847 | /** |
| 5848 | * Return the {@link ComponentName} of the activity providing Settings for the Instant App |
| 5849 | * resolver. |
| 5850 | * |
Todd Kennedy | 801e659 | 2017-04-12 14:10:12 -0700 | [diff] [blame] | 5851 | * @see {@link android.content.Intent#ACTION_INSTANT_APP_RESOLVER_SETTINGS} |
Chad Brubaker | aa49cb8 | 2017-03-24 15:53:09 -0700 | [diff] [blame] | 5852 | * @hide |
| 5853 | */ |
| 5854 | @SystemApi |
| 5855 | public abstract ComponentName getInstantAppResolverSettingsComponent(); |
Todd Kennedy | 801e659 | 2017-04-12 14:10:12 -0700 | [diff] [blame] | 5856 | |
| 5857 | /** |
| 5858 | * Return the {@link ComponentName} of the activity responsible for installing instant |
| 5859 | * applications. |
| 5860 | * |
| 5861 | * @see {@link android.content.Intent#ACTION_INSTALL_INSTANT_APP_PACKAGE} |
| 5862 | * @hide |
| 5863 | */ |
| 5864 | @SystemApi |
| 5865 | public abstract ComponentName getInstantAppInstallerComponent(); |
Chad Brubaker | 0d277a7 | 2017-04-12 16:56:53 -0700 | [diff] [blame] | 5866 | |
| 5867 | /** |
| 5868 | * Return the Android Id for a given Instant App. |
| 5869 | * |
| 5870 | * @see {@link android.provider.Settings.Secure#ANDROID_ID} |
| 5871 | * @hide |
| 5872 | */ |
| 5873 | public abstract String getInstantAppAndroidId(String packageName, @NonNull UserHandle user); |
Calin Juravle | 3d2af7f | 2017-04-19 19:56:21 -0700 | [diff] [blame] | 5874 | |
| 5875 | /** |
| 5876 | * Callback use to notify the callers of module registration that the operation |
| 5877 | * has finished. |
| 5878 | * |
| 5879 | * @hide |
| 5880 | */ |
Jeff Sharkey | 9039636 | 2017-06-12 16:26:53 -0600 | [diff] [blame] | 5881 | @SystemApi |
Calin Juravle | 3d2af7f | 2017-04-19 19:56:21 -0700 | [diff] [blame] | 5882 | public static abstract class DexModuleRegisterCallback { |
| 5883 | public abstract void onDexModuleRegistered(String dexModulePath, boolean success, |
| 5884 | String message); |
| 5885 | } |
| 5886 | |
| 5887 | /** |
| 5888 | * Register an application dex module with the package manager. |
| 5889 | * The package manager will keep track of the given module for future optimizations. |
| 5890 | * |
| 5891 | * Dex module optimizations will disable the classpath checking at runtime. The client bares |
| 5892 | * the responsibility to ensure that the static assumptions on classes in the optimized code |
| 5893 | * hold at runtime (e.g. there's no duplicate classes in the classpath). |
| 5894 | * |
| 5895 | * Note that the package manager already keeps track of dex modules loaded with |
| 5896 | * {@link dalvik.system.DexClassLoader} and {@link dalvik.system.PathClassLoader}. |
| 5897 | * This can be called for an eager registration. |
| 5898 | * |
| 5899 | * The call might take a while and the results will be posted on the main thread, using |
| 5900 | * the given callback. |
| 5901 | * |
| 5902 | * If the module is intended to be shared with other apps, make sure that the file |
| 5903 | * permissions allow for it. |
| 5904 | * If at registration time the permissions allow for others to read it, the module would |
| 5905 | * be marked as a shared module which might undergo a different optimization strategy. |
| 5906 | * (usually shared modules will generated larger optimizations artifacts, |
| 5907 | * taking more disk space). |
| 5908 | * |
| 5909 | * @param dexModulePath the absolute path of the dex module. |
| 5910 | * @param callback if not null, {@link DexModuleRegisterCallback#onDexModuleRegistered} will |
| 5911 | * be called once the registration finishes. |
| 5912 | * |
| 5913 | * @hide |
| 5914 | */ |
Jeff Sharkey | 9039636 | 2017-06-12 16:26:53 -0600 | [diff] [blame] | 5915 | @SystemApi |
Calin Juravle | 3d2af7f | 2017-04-19 19:56:21 -0700 | [diff] [blame] | 5916 | public abstract void registerDexModule(String dexModulePath, |
| 5917 | @Nullable DexModuleRegisterCallback callback); |
Calin Juravle | 45f8b29 | 2017-11-07 18:49:43 -0800 | [diff] [blame] | 5918 | |
| 5919 | /** |
| 5920 | * Returns the {@link ArtManager} associated with this package manager. |
| 5921 | * |
| 5922 | * @hide |
| 5923 | */ |
| 5924 | @SystemApi |
| 5925 | public @NonNull ArtManager getArtManager() { |
| 5926 | throw new UnsupportedOperationException("getArtManager not implemented in subclass"); |
| 5927 | } |
Ben Gruver | 1ab3d6e | 2017-12-07 13:45:08 -0800 | [diff] [blame] | 5928 | |
| 5929 | /** |
| 5930 | * Sets or clears the harmful app warning details for the given app. |
| 5931 | * |
| 5932 | * When set, any attempt to launch an activity in this package will be intercepted and a |
| 5933 | * warning dialog will be shown to the user instead, with the given warning. The user |
| 5934 | * will have the option to proceed with the activity launch, or to uninstall the application. |
| 5935 | * |
| 5936 | * @param packageName The full name of the package to warn on. |
| 5937 | * @param warning A warning string to display to the user describing the threat posed by the |
| 5938 | * application, or null to clear the warning. |
| 5939 | * |
| 5940 | * @hide |
| 5941 | */ |
| 5942 | @RequiresPermission(Manifest.permission.SET_HARMFUL_APP_WARNINGS) |
| 5943 | @SystemApi |
| 5944 | public void setHarmfulAppWarning(@NonNull String packageName, @Nullable CharSequence warning) { |
| 5945 | throw new UnsupportedOperationException("setHarmfulAppWarning not implemented in subclass"); |
| 5946 | } |
| 5947 | |
| 5948 | /** |
| 5949 | * Returns the harmful app warning string for the given app, or null if there is none set. |
| 5950 | * |
| 5951 | * @param packageName The full name of the desired package. |
| 5952 | * |
| 5953 | * @hide |
| 5954 | */ |
| 5955 | @RequiresPermission(Manifest.permission.SET_HARMFUL_APP_WARNINGS) |
| 5956 | @Nullable |
| 5957 | @SystemApi |
| 5958 | public CharSequence getHarmfulAppWarning(@NonNull String packageName) { |
| 5959 | throw new UnsupportedOperationException("getHarmfulAppWarning not implemented in subclass"); |
| 5960 | } |
Daniel Cashman | 5cdda34 | 2018-01-19 07:22:52 -0800 | [diff] [blame] | 5961 | |
| 5962 | /** @hide */ |
| 5963 | @IntDef(prefix = { "CERT_INPUT_" }, value = { |
| 5964 | CERT_INPUT_RAW_X509, |
| 5965 | CERT_INPUT_SHA256 |
| 5966 | }) |
| 5967 | @Retention(RetentionPolicy.SOURCE) |
| 5968 | public @interface CertificateInputType {} |
| 5969 | |
| 5970 | /** |
| 5971 | * Certificate input bytes: the input bytes represent an encoded X.509 Certificate which could |
| 5972 | * be generated using an {@code CertificateFactory} |
| 5973 | */ |
| 5974 | public static final int CERT_INPUT_RAW_X509 = 0; |
| 5975 | |
| 5976 | /** |
| 5977 | * Certificate input bytes: the input bytes represent the SHA256 output of an encoded X.509 |
| 5978 | * Certificate. |
| 5979 | */ |
| 5980 | public static final int CERT_INPUT_SHA256 = 1; |
| 5981 | |
| 5982 | /** |
| 5983 | * Searches the set of signing certificates by which the given package has proven to have been |
| 5984 | * signed. This should be used instead of {@code getPackageInfo} with {@code GET_SIGNATURES} |
| 5985 | * since it takes into account the possibility of signing certificate rotation, except in the |
| 5986 | * case of packages that are signed by multiple certificates, for which signing certificate |
| 5987 | * rotation is not supported. |
| 5988 | * |
| 5989 | * @param packageName package whose signing certificates to check |
| 5990 | * @param certificate signing certificate for which to search |
| 5991 | * @param type representation of the {@code certificate} |
| 5992 | * @return true if this package was or is signed by exactly the certificate {@code certificate} |
| 5993 | */ |
| 5994 | public boolean hasSigningCertificate( |
| 5995 | String packageName, byte[] certificate, @CertificateInputType int type) { |
| 5996 | throw new UnsupportedOperationException( |
| 5997 | "hasSigningCertificate not implemented in subclass"); |
| 5998 | } |
| 5999 | |
| 6000 | /** |
| 6001 | * Searches the set of signing certificates by which the given uid has proven to have been |
| 6002 | * signed. This should be used instead of {@code getPackageInfo} with {@code GET_SIGNATURES} |
| 6003 | * since it takes into account the possibility of signing certificate rotation, except in the |
| 6004 | * case of packages that are signed by multiple certificates, for which signing certificate |
| 6005 | * rotation is not supported. |
| 6006 | * |
| 6007 | * @param uid package whose signing certificates to check |
| 6008 | * @param certificate signing certificate for which to search |
| 6009 | * @param type representation of the {@code certificate} |
| 6010 | * @return true if this package was or is signed by exactly the certificate {@code certificate} |
| 6011 | */ |
| 6012 | public boolean hasSigningCertificate( |
| 6013 | int uid, byte[] certificate, @CertificateInputType int type) { |
| 6014 | throw new UnsupportedOperationException( |
| 6015 | "hasSigningCertificate not implemented in subclass"); |
| 6016 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 6017 | } |