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; |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 54 | import android.os.PersistableBundle; |
Jeff Sharkey | 6c0b9da | 2014-08-07 22:07:11 -0700 | [diff] [blame] | 55 | import android.os.RemoteException; |
Dianne Hackborn | 0c38049 | 2012-08-20 17:23:30 -0700 | [diff] [blame] | 56 | import android.os.UserHandle; |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 57 | import android.os.UserManager; |
Jeff Sharkey | 683bcd3 | 2017-03-18 17:54:51 -0600 | [diff] [blame] | 58 | import android.os.storage.StorageManager; |
Jeff Sharkey | b2b9ab8 | 2015-04-05 21:10:42 -0700 | [diff] [blame] | 59 | import android.os.storage.VolumeInfo; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 60 | import android.util.AndroidException; |
Jeff Sharkey | bd94022 | 2016-01-08 11:07:13 -0700 | [diff] [blame] | 61 | import android.util.Log; |
Jeff Sharkey | b2b9ab8 | 2015-04-05 21:10:42 -0700 | [diff] [blame] | 62 | |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 63 | import com.android.internal.util.ArrayUtils; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 64 | |
Jeff Sharkey | 6f4b2a3 | 2017-03-21 14:13:41 -0600 | [diff] [blame] | 65 | import dalvik.system.VMRuntime; |
| 66 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 67 | import java.io.File; |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 68 | import java.lang.annotation.Retention; |
| 69 | import java.lang.annotation.RetentionPolicy; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 70 | import java.util.List; |
Suprabh Shukla | 3e03ab9 | 2018-04-11 16:03:49 -0700 | [diff] [blame] | 71 | import java.util.Locale; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 72 | |
| 73 | /** |
| 74 | * Class for retrieving various kinds of information related to the application |
| 75 | * packages that are currently installed on the device. |
| 76 | * |
| 77 | * You can find this class through {@link Context#getPackageManager}. |
| 78 | */ |
| 79 | public abstract class PackageManager { |
Jeff Sharkey | bd94022 | 2016-01-08 11:07:13 -0700 | [diff] [blame] | 80 | private static final String TAG = "PackageManager"; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 81 | |
Jeff Sharkey | e469713 | 2016-02-06 19:46:15 -0700 | [diff] [blame] | 82 | /** {@hide} */ |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 83 | public static final boolean APPLY_DEFAULT_TO_DEVICE_PROTECTED_STORAGE = true; |
Jeff Sharkey | e469713 | 2016-02-06 19:46:15 -0700 | [diff] [blame] | 84 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 85 | /** |
| 86 | * This exception is thrown when a given package, application, or component |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 87 | * name cannot be found. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 88 | */ |
| 89 | public static class NameNotFoundException extends AndroidException { |
| 90 | public NameNotFoundException() { |
| 91 | } |
| 92 | |
| 93 | public NameNotFoundException(String name) { |
| 94 | super(name); |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | /** |
Svetoslav | f7c06eb | 2015-06-10 18:43:22 -0700 | [diff] [blame] | 99 | * Listener for changes in permissions granted to a UID. |
| 100 | * |
| 101 | * @hide |
| 102 | */ |
| 103 | @SystemApi |
| 104 | public interface OnPermissionsChangedListener { |
| 105 | |
| 106 | /** |
| 107 | * Called when the permissions for a UID change. |
| 108 | * @param uid The UID with a change. |
| 109 | */ |
| 110 | public void onPermissionsChanged(int uid); |
| 111 | } |
| 112 | |
| 113 | /** |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 114 | * As a guiding principle: |
| 115 | * <p> |
| 116 | * {@code GET_} flags are used to request additional data that may have been |
| 117 | * elided to save wire space. |
| 118 | * <p> |
| 119 | * {@code MATCH_} flags are used to include components or packages that |
| 120 | * would have otherwise been omitted from a result set by current system |
| 121 | * state. |
| 122 | */ |
| 123 | |
| 124 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 125 | @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = { |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 126 | GET_ACTIVITIES, |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 127 | GET_CONFIGURATIONS, |
| 128 | GET_GIDS, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 129 | GET_INSTRUMENTATION, |
| 130 | GET_INTENT_FILTERS, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 131 | GET_META_DATA, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 132 | GET_PERMISSIONS, |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 133 | GET_PROVIDERS, |
| 134 | GET_RECEIVERS, |
| 135 | GET_SERVICES, |
| 136 | GET_SHARED_LIBRARY_FILES, |
| 137 | GET_SIGNATURES, |
Daniel Cashman | 5cdda34 | 2018-01-19 07:22:52 -0800 | [diff] [blame] | 138 | GET_SIGNING_CERTIFICATES, |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 139 | GET_URI_PERMISSION_PATTERNS, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 140 | MATCH_UNINSTALLED_PACKAGES, |
| 141 | MATCH_DISABLED_COMPONENTS, |
| 142 | MATCH_DISABLED_UNTIL_USED_COMPONENTS, |
Jeff Sharkey | c5967e9 | 2016-01-07 18:50:29 -0700 | [diff] [blame] | 143 | MATCH_SYSTEM_ONLY, |
Todd Kennedy | d6ee0ba | 2016-03-31 15:11:11 -0700 | [diff] [blame] | 144 | MATCH_FACTORY_ONLY, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 145 | MATCH_DEBUG_TRIAGED_MISSING, |
Todd Kennedy | 9c9fdf2 | 2017-03-06 10:58:27 -0800 | [diff] [blame] | 146 | MATCH_INSTANT, |
Todd Kennedy | 1f397f4 | 2016-06-28 12:14:11 -0700 | [diff] [blame] | 147 | GET_DISABLED_COMPONENTS, |
| 148 | GET_DISABLED_UNTIL_USED_COMPONENTS, |
| 149 | GET_UNINSTALLED_PACKAGES, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 150 | }) |
| 151 | @Retention(RetentionPolicy.SOURCE) |
| 152 | public @interface PackageInfoFlags {} |
| 153 | |
| 154 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 155 | @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = { |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 156 | GET_META_DATA, |
| 157 | GET_SHARED_LIBRARY_FILES, |
| 158 | MATCH_UNINSTALLED_PACKAGES, |
| 159 | MATCH_SYSTEM_ONLY, |
| 160 | MATCH_DEBUG_TRIAGED_MISSING, |
Todd Kennedy | 2452202 | 2017-03-27 16:32:20 -0700 | [diff] [blame] | 161 | MATCH_DISABLED_COMPONENTS, |
Todd Kennedy | 5a32c6c | 2016-07-07 14:29:06 -0700 | [diff] [blame] | 162 | MATCH_DISABLED_UNTIL_USED_COMPONENTS, |
Todd Kennedy | 9c9fdf2 | 2017-03-06 10:58:27 -0800 | [diff] [blame] | 163 | MATCH_INSTANT, |
Svet Ganov | 9e77977 | 2017-05-11 14:36:50 -0700 | [diff] [blame] | 164 | MATCH_STATIC_SHARED_LIBRARIES, |
Todd Kennedy | 5a32c6c | 2016-07-07 14:29:06 -0700 | [diff] [blame] | 165 | GET_DISABLED_UNTIL_USED_COMPONENTS, |
Todd Kennedy | 1f397f4 | 2016-06-28 12:14:11 -0700 | [diff] [blame] | 166 | GET_UNINSTALLED_PACKAGES, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 167 | }) |
| 168 | @Retention(RetentionPolicy.SOURCE) |
| 169 | public @interface ApplicationInfoFlags {} |
| 170 | |
| 171 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 172 | @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = { |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 173 | GET_META_DATA, |
| 174 | GET_SHARED_LIBRARY_FILES, |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 175 | MATCH_ALL, |
| 176 | MATCH_DEBUG_TRIAGED_MISSING, |
| 177 | MATCH_DEFAULT_ONLY, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 178 | MATCH_DISABLED_COMPONENTS, |
| 179 | MATCH_DISABLED_UNTIL_USED_COMPONENTS, |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 180 | MATCH_DIRECT_BOOT_AWARE, |
| 181 | MATCH_DIRECT_BOOT_UNAWARE, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 182 | MATCH_SYSTEM_ONLY, |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 183 | MATCH_UNINSTALLED_PACKAGES, |
Todd Kennedy | 9c9fdf2 | 2017-03-06 10:58:27 -0800 | [diff] [blame] | 184 | MATCH_INSTANT, |
Svet Ganov | 9e77977 | 2017-05-11 14:36:50 -0700 | [diff] [blame] | 185 | MATCH_STATIC_SHARED_LIBRARIES, |
Todd Kennedy | 1f397f4 | 2016-06-28 12:14:11 -0700 | [diff] [blame] | 186 | GET_DISABLED_COMPONENTS, |
| 187 | GET_DISABLED_UNTIL_USED_COMPONENTS, |
| 188 | GET_UNINSTALLED_PACKAGES, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 189 | }) |
| 190 | @Retention(RetentionPolicy.SOURCE) |
| 191 | public @interface ComponentInfoFlags {} |
| 192 | |
| 193 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 194 | @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = { |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 195 | GET_META_DATA, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 196 | GET_RESOLVED_FILTER, |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 197 | GET_SHARED_LIBRARY_FILES, |
| 198 | MATCH_ALL, |
| 199 | MATCH_DEBUG_TRIAGED_MISSING, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 200 | MATCH_DISABLED_COMPONENTS, |
| 201 | MATCH_DISABLED_UNTIL_USED_COMPONENTS, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 202 | MATCH_DEFAULT_ONLY, |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 203 | MATCH_DIRECT_BOOT_AWARE, |
| 204 | MATCH_DIRECT_BOOT_UNAWARE, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 205 | MATCH_SYSTEM_ONLY, |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 206 | MATCH_UNINSTALLED_PACKAGES, |
Todd Kennedy | 9c9fdf2 | 2017-03-06 10:58:27 -0800 | [diff] [blame] | 207 | MATCH_INSTANT, |
Todd Kennedy | 1f397f4 | 2016-06-28 12:14:11 -0700 | [diff] [blame] | 208 | GET_DISABLED_COMPONENTS, |
| 209 | GET_DISABLED_UNTIL_USED_COMPONENTS, |
| 210 | GET_UNINSTALLED_PACKAGES, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 211 | }) |
| 212 | @Retention(RetentionPolicy.SOURCE) |
| 213 | public @interface ResolveInfoFlags {} |
| 214 | |
| 215 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 216 | @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = { |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 217 | GET_META_DATA, |
| 218 | }) |
| 219 | @Retention(RetentionPolicy.SOURCE) |
| 220 | public @interface PermissionInfoFlags {} |
| 221 | |
| 222 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 223 | @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = { |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 224 | GET_META_DATA, |
| 225 | }) |
| 226 | @Retention(RetentionPolicy.SOURCE) |
| 227 | public @interface PermissionGroupInfoFlags {} |
| 228 | |
| 229 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 230 | @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = { |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 231 | GET_META_DATA, |
| 232 | }) |
| 233 | @Retention(RetentionPolicy.SOURCE) |
| 234 | public @interface InstrumentationInfoFlags {} |
| 235 | |
| 236 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 237 | * {@link PackageInfo} flag: return information about |
| 238 | * activities in the package in {@link PackageInfo#activities}. |
| 239 | */ |
| 240 | public static final int GET_ACTIVITIES = 0x00000001; |
| 241 | |
| 242 | /** |
| 243 | * {@link PackageInfo} flag: return information about |
| 244 | * intent receivers in the package in |
| 245 | * {@link PackageInfo#receivers}. |
| 246 | */ |
| 247 | public static final int GET_RECEIVERS = 0x00000002; |
| 248 | |
| 249 | /** |
| 250 | * {@link PackageInfo} flag: return information about |
| 251 | * services in the package in {@link PackageInfo#services}. |
| 252 | */ |
| 253 | public static final int GET_SERVICES = 0x00000004; |
| 254 | |
| 255 | /** |
| 256 | * {@link PackageInfo} flag: return information about |
| 257 | * content providers in the package in |
| 258 | * {@link PackageInfo#providers}. |
| 259 | */ |
| 260 | public static final int GET_PROVIDERS = 0x00000008; |
| 261 | |
| 262 | /** |
| 263 | * {@link PackageInfo} flag: return information about |
| 264 | * instrumentation in the package in |
| 265 | * {@link PackageInfo#instrumentation}. |
| 266 | */ |
| 267 | public static final int GET_INSTRUMENTATION = 0x00000010; |
| 268 | |
| 269 | /** |
| 270 | * {@link PackageInfo} flag: return information about the |
| 271 | * intent filters supported by the activity. |
| 272 | */ |
| 273 | public static final int GET_INTENT_FILTERS = 0x00000020; |
| 274 | |
| 275 | /** |
| 276 | * {@link PackageInfo} flag: return information about the |
| 277 | * signatures included in the package. |
Daniel Cashman | 5cdda34 | 2018-01-19 07:22:52 -0800 | [diff] [blame] | 278 | * |
| 279 | * @deprecated use {@code GET_SIGNING_CERTIFICATES} instead |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 280 | */ |
Daniel Cashman | 5cdda34 | 2018-01-19 07:22:52 -0800 | [diff] [blame] | 281 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 282 | public static final int GET_SIGNATURES = 0x00000040; |
| 283 | |
| 284 | /** |
| 285 | * {@link ResolveInfo} flag: return the IntentFilter that |
| 286 | * was matched for a particular ResolveInfo in |
| 287 | * {@link ResolveInfo#filter}. |
| 288 | */ |
| 289 | public static final int GET_RESOLVED_FILTER = 0x00000040; |
| 290 | |
| 291 | /** |
| 292 | * {@link ComponentInfo} flag: return the {@link ComponentInfo#metaData} |
| 293 | * data {@link android.os.Bundle}s that are associated with a component. |
| 294 | * This applies for any API returning a ComponentInfo subclass. |
| 295 | */ |
| 296 | public static final int GET_META_DATA = 0x00000080; |
| 297 | |
| 298 | /** |
| 299 | * {@link PackageInfo} flag: return the |
| 300 | * {@link PackageInfo#gids group ids} that are associated with an |
| 301 | * application. |
Ken Wakasa | f76a50c | 2012-03-09 19:56:35 +0900 | [diff] [blame] | 302 | * 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] | 303 | * directly or nested inside of another. |
| 304 | */ |
| 305 | public static final int GET_GIDS = 0x00000100; |
| 306 | |
| 307 | /** |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 308 | * @deprecated replaced with {@link #MATCH_DISABLED_COMPONENTS} |
| 309 | */ |
| 310 | @Deprecated |
| 311 | public static final int GET_DISABLED_COMPONENTS = 0x00000200; |
| 312 | |
| 313 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 314 | * {@link PackageInfo} flag: include disabled components in the returned info. |
| 315 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 316 | public static final int MATCH_DISABLED_COMPONENTS = 0x00000200; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 317 | |
| 318 | /** |
| 319 | * {@link ApplicationInfo} flag: return the |
| 320 | * {@link ApplicationInfo#sharedLibraryFiles paths to the shared libraries} |
| 321 | * that are associated with an application. |
| 322 | * This applies for any API returning an ApplicationInfo class, either |
| 323 | * directly or nested inside of another. |
| 324 | */ |
| 325 | public static final int GET_SHARED_LIBRARY_FILES = 0x00000400; |
| 326 | |
| 327 | /** |
| 328 | * {@link ProviderInfo} flag: return the |
| 329 | * {@link ProviderInfo#uriPermissionPatterns URI permission patterns} |
| 330 | * that are associated with a content provider. |
Ken Wakasa | f76a50c | 2012-03-09 19:56:35 +0900 | [diff] [blame] | 331 | * 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] | 332 | * directly or nested inside of another. |
| 333 | */ |
| 334 | public static final int GET_URI_PERMISSION_PATTERNS = 0x00000800; |
| 335 | /** |
| 336 | * {@link PackageInfo} flag: return information about |
| 337 | * permissions in the package in |
| 338 | * {@link PackageInfo#permissions}. |
| 339 | */ |
| 340 | public static final int GET_PERMISSIONS = 0x00001000; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 341 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 342 | /** |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 343 | * @deprecated replaced with {@link #MATCH_UNINSTALLED_PACKAGES} |
| 344 | */ |
| 345 | @Deprecated |
| 346 | public static final int GET_UNINSTALLED_PACKAGES = 0x00002000; |
| 347 | |
| 348 | /** |
Kenny Root | 685f490 | 2011-11-03 10:13:29 -0700 | [diff] [blame] | 349 | * Flag parameter to retrieve some information about all applications (even |
| 350 | * uninstalled ones) which have data directories. This state could have |
| 351 | * resulted if applications have been deleted with flag |
| 352 | * {@code DONT_DELETE_DATA} with a possibility of being replaced or |
| 353 | * reinstalled in future. |
| 354 | * <p> |
| 355 | * Note: this flag may cause less information about currently installed |
| 356 | * applications to be returned. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 357 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 358 | public static final int MATCH_UNINSTALLED_PACKAGES = 0x00002000; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 359 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 360 | /** |
| 361 | * {@link PackageInfo} flag: return information about |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 362 | * hardware preferences in |
Adam Lesinski | d3edfde | 2014-08-08 17:32:44 -0700 | [diff] [blame] | 363 | * {@link PackageInfo#configPreferences PackageInfo.configPreferences}, |
| 364 | * and requested features in {@link PackageInfo#reqFeatures} and |
| 365 | * {@link PackageInfo#featureGroups}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 366 | */ |
| 367 | public static final int GET_CONFIGURATIONS = 0x00004000; |
| 368 | |
| 369 | /** |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 370 | * @deprecated replaced with {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}. |
| 371 | */ |
| 372 | @Deprecated |
| 373 | public static final int GET_DISABLED_UNTIL_USED_COMPONENTS = 0x00008000; |
| 374 | |
| 375 | /** |
Dianne Hackborn | fd7aded | 2013-01-22 17:10:23 -0800 | [diff] [blame] | 376 | * {@link PackageInfo} flag: include disabled components which are in |
| 377 | * that state only because of {@link #COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED} |
| 378 | * in the returned info. Note that if you set this flag, applications |
| 379 | * that are in this disabled state will be reported as enabled. |
| 380 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 381 | public static final int MATCH_DISABLED_UNTIL_USED_COMPONENTS = 0x00008000; |
Dianne Hackborn | fd7aded | 2013-01-22 17:10:23 -0800 | [diff] [blame] | 382 | |
| 383 | /** |
Dianne Hackborn | 1655be4 | 2009-05-08 14:29:01 -0700 | [diff] [blame] | 384 | * Resolution and querying flag: if set, only filters that support the |
| 385 | * {@link android.content.Intent#CATEGORY_DEFAULT} will be considered for |
| 386 | * matching. This is a synonym for including the CATEGORY_DEFAULT in your |
| 387 | * supplied Intent. |
| 388 | */ |
Fabrice Di Meglio | 9f7e39f | 2015-04-10 20:40:16 -0700 | [diff] [blame] | 389 | public static final int MATCH_DEFAULT_ONLY = 0x00010000; |
| 390 | |
| 391 | /** |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 392 | * Querying flag: if set and if the platform is doing any filtering of the |
| 393 | * results, then the filtering will not happen. This is a synonym for saying |
| 394 | * that all results should be returned. |
| 395 | * <p> |
| 396 | * <em>This flag should be used with extreme care.</em> |
Fabrice Di Meglio | 9f7e39f | 2015-04-10 20:40:16 -0700 | [diff] [blame] | 397 | */ |
| 398 | public static final int MATCH_ALL = 0x00020000; |
Dianne Hackborn | 1655be4 | 2009-05-08 14:29:01 -0700 | [diff] [blame] | 399 | |
Nicolas Prevot | 63798c5 | 2014-05-27 13:22:38 +0100 | [diff] [blame] | 400 | /** |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 401 | * Querying flag: match components which are direct boot <em>unaware</em> in |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 402 | * the returned info, regardless of the current user state. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 403 | * <p> |
| 404 | * When neither {@link #MATCH_DIRECT_BOOT_AWARE} nor |
| 405 | * {@link #MATCH_DIRECT_BOOT_UNAWARE} are specified, the default behavior is |
| 406 | * to match only runnable components based on the user state. For example, |
| 407 | * when a user is started but credentials have not been presented yet, the |
| 408 | * user is running "locked" and only {@link #MATCH_DIRECT_BOOT_AWARE} |
| 409 | * components are returned. Once the user credentials have been presented, |
| 410 | * the user is running "unlocked" and both {@link #MATCH_DIRECT_BOOT_AWARE} |
| 411 | * and {@link #MATCH_DIRECT_BOOT_UNAWARE} components are returned. |
| 412 | * |
| 413 | * @see UserManager#isUserUnlocked() |
Jeff Sharkey | e17ac15 | 2015-11-06 22:40:29 -0800 | [diff] [blame] | 414 | */ |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 415 | public static final int MATCH_DIRECT_BOOT_UNAWARE = 0x00040000; |
| 416 | |
| 417 | /** |
| 418 | * Querying flag: match components which are direct boot <em>aware</em> in |
| 419 | * the returned info, regardless of the current user state. |
| 420 | * <p> |
| 421 | * When neither {@link #MATCH_DIRECT_BOOT_AWARE} nor |
| 422 | * {@link #MATCH_DIRECT_BOOT_UNAWARE} are specified, the default behavior is |
| 423 | * to match only runnable components based on the user state. For example, |
| 424 | * when a user is started but credentials have not been presented yet, the |
| 425 | * user is running "locked" and only {@link #MATCH_DIRECT_BOOT_AWARE} |
| 426 | * components are returned. Once the user credentials have been presented, |
| 427 | * the user is running "unlocked" and both {@link #MATCH_DIRECT_BOOT_AWARE} |
| 428 | * and {@link #MATCH_DIRECT_BOOT_UNAWARE} components are returned. |
| 429 | * |
| 430 | * @see UserManager#isUserUnlocked() |
| 431 | */ |
| 432 | public static final int MATCH_DIRECT_BOOT_AWARE = 0x00080000; |
| 433 | |
Jeff Sharkey | 2a9e3f8 | 2015-12-18 10:57:58 -0700 | [diff] [blame] | 434 | /** |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 435 | * Querying flag: include only components from applications that are marked |
| 436 | * with {@link ApplicationInfo#FLAG_SYSTEM}. |
Jeff Sharkey | 5217cac | 2015-12-20 15:34:01 -0700 | [diff] [blame] | 437 | */ |
| 438 | public static final int MATCH_SYSTEM_ONLY = 0x00100000; |
| 439 | |
| 440 | /** |
Todd Kennedy | d6ee0ba | 2016-03-31 15:11:11 -0700 | [diff] [blame] | 441 | * Internal {@link PackageInfo} flag: include only components on the system image. |
| 442 | * This will not return information on any unbundled update to system components. |
| 443 | * @hide |
| 444 | */ |
Todd Kennedy | 4908496 | 2017-03-27 16:20:37 -0700 | [diff] [blame] | 445 | @SystemApi |
Fyodor Kupolov | e569804 | 2018-01-26 14:24:37 -0800 | [diff] [blame] | 446 | @TestApi |
Todd Kennedy | d6ee0ba | 2016-03-31 15:11:11 -0700 | [diff] [blame] | 447 | public static final int MATCH_FACTORY_ONLY = 0x00200000; |
| 448 | |
| 449 | /** |
Amith Yamasani | 0d1fd8d | 2016-10-12 14:21:51 -0700 | [diff] [blame] | 450 | * 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] | 451 | * 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] | 452 | * @hide |
| 453 | */ |
Amith Yamasani | 475f9a3 | 2016-12-08 09:46:15 -0800 | [diff] [blame] | 454 | @SystemApi |
Amith Yamasani | 0d1fd8d | 2016-10-12 14:21:51 -0700 | [diff] [blame] | 455 | public static final int MATCH_ANY_USER = 0x00400000; |
| 456 | |
| 457 | /** |
| 458 | * Combination of MATCH_ANY_USER and MATCH_UNINSTALLED_PACKAGES to mean any known |
| 459 | * package. |
| 460 | * @hide |
| 461 | */ |
Todd Kennedy | ef9acb6 | 2018-05-29 15:18:06 -0700 | [diff] [blame] | 462 | @TestApi |
Amith Yamasani | 0d1fd8d | 2016-10-12 14:21:51 -0700 | [diff] [blame] | 463 | public static final int MATCH_KNOWN_PACKAGES = MATCH_UNINSTALLED_PACKAGES | MATCH_ANY_USER; |
| 464 | |
| 465 | /** |
Todd Kennedy | 7bc3a70 | 2016-12-08 14:54:48 -0800 | [diff] [blame] | 466 | * Internal {@link PackageInfo} flag: include components that are part of an |
Todd Kennedy | be0b889 | 2017-02-15 14:13:52 -0800 | [diff] [blame] | 467 | * instant app. By default, instant app components are not matched. |
Todd Kennedy | 7bc3a70 | 2016-12-08 14:54:48 -0800 | [diff] [blame] | 468 | * @hide |
| 469 | */ |
Todd Kennedy | 9c9fdf2 | 2017-03-06 10:58:27 -0800 | [diff] [blame] | 470 | @SystemApi |
Todd Kennedy | be0b889 | 2017-02-15 14:13:52 -0800 | [diff] [blame] | 471 | public static final int MATCH_INSTANT = 0x00800000; |
Todd Kennedy | 7bc3a70 | 2016-12-08 14:54:48 -0800 | [diff] [blame] | 472 | |
| 473 | /** |
| 474 | * Internal {@link PackageInfo} flag: include only components that are exposed to |
Todd Kennedy | c05f5d1 | 2017-04-25 11:11:40 -0700 | [diff] [blame] | 475 | * instant apps. Matched components may have been either explicitly or implicitly |
| 476 | * exposed. |
Todd Kennedy | 7bc3a70 | 2016-12-08 14:54:48 -0800 | [diff] [blame] | 477 | * @hide |
| 478 | */ |
Todd Kennedy | be0b889 | 2017-02-15 14:13:52 -0800 | [diff] [blame] | 479 | public static final int MATCH_VISIBLE_TO_INSTANT_APP_ONLY = 0x01000000; |
Todd Kennedy | 7bc3a70 | 2016-12-08 14:54:48 -0800 | [diff] [blame] | 480 | |
| 481 | /** |
Todd Kennedy | c05f5d1 | 2017-04-25 11:11:40 -0700 | [diff] [blame] | 482 | * Internal {@link PackageInfo} flag: include only components that have been |
| 483 | * explicitly exposed to instant apps. |
| 484 | * @hide |
| 485 | */ |
| 486 | public static final int MATCH_EXPLICITLY_VISIBLE_ONLY = 0x02000000; |
| 487 | |
| 488 | /** |
Svet Ganov | 9e77977 | 2017-05-11 14:36:50 -0700 | [diff] [blame] | 489 | * Internal {@link PackageInfo} flag: include static shared libraries. |
| 490 | * Apps that depend on static shared libs can always access the version |
| 491 | * of the lib they depend on. System/shell/root can access all shared |
| 492 | * libs regardless of dependency but need to explicitly ask for them |
| 493 | * via this flag. |
| 494 | * @hide |
| 495 | */ |
| 496 | public static final int MATCH_STATIC_SHARED_LIBRARIES = 0x04000000; |
| 497 | |
| 498 | /** |
Daniel Cashman | 5cdda34 | 2018-01-19 07:22:52 -0800 | [diff] [blame] | 499 | * {@link PackageInfo} flag: return the signing certificates associated with |
| 500 | * this package. Each entry is a signing certificate that the package |
| 501 | * has proven it is authorized to use, usually a past signing certificate from |
| 502 | * which it has rotated. |
| 503 | */ |
| 504 | public static final int GET_SIGNING_CERTIFICATES = 0x08000000; |
| 505 | |
| 506 | /** |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 507 | * Internal flag used to indicate that a system component has done their |
| 508 | * homework and verified that they correctly handle packages and components |
| 509 | * that come and go over time. In particular: |
| 510 | * <ul> |
| 511 | * <li>Apps installed on external storage, which will appear to be |
| 512 | * uninstalled while the the device is ejected. |
| 513 | * <li>Apps with encryption unaware components, which will appear to not |
| 514 | * exist while the device is locked. |
| 515 | * </ul> |
Jeff Sharkey | e17ac15 | 2015-11-06 22:40:29 -0800 | [diff] [blame] | 516 | * |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 517 | * @see #MATCH_UNINSTALLED_PACKAGES |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 518 | * @see #MATCH_DIRECT_BOOT_AWARE |
| 519 | * @see #MATCH_DIRECT_BOOT_UNAWARE |
Jeff Sharkey | e17ac15 | 2015-11-06 22:40:29 -0800 | [diff] [blame] | 520 | * @hide |
| 521 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 522 | public static final int MATCH_DEBUG_TRIAGED_MISSING = 0x10000000; |
Jeff Sharkey | e17ac15 | 2015-11-06 22:40:29 -0800 | [diff] [blame] | 523 | |
| 524 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 525 | * Flag for {@link #addCrossProfileIntentFilter}: if this flag is set: when |
| 526 | * resolving an intent that matches the {@code CrossProfileIntentFilter}, |
| 527 | * the current profile will be skipped. Only activities in the target user |
| 528 | * can respond to the intent. |
| 529 | * |
Nicolas Prevot | 63798c5 | 2014-05-27 13:22:38 +0100 | [diff] [blame] | 530 | * @hide |
| 531 | */ |
| 532 | public static final int SKIP_CURRENT_PROFILE = 0x00000002; |
| 533 | |
Tony Mak | 807e01c | 2015-12-01 20:19:03 +0000 | [diff] [blame] | 534 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 535 | * Flag for {@link #addCrossProfileIntentFilter}: if this flag is set: |
Tony Mak | 807e01c | 2015-12-01 20:19:03 +0000 | [diff] [blame] | 536 | * activities in the other profiles can respond to the intent only if no activity with |
| 537 | * non-negative priority in current profile can respond to the intent. |
| 538 | * @hide |
| 539 | */ |
| 540 | public static final int ONLY_IF_NO_MATCH_FOUND = 0x00000004; |
| 541 | |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 542 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 543 | @IntDef(prefix = { "PERMISSION_" }, value = { |
| 544 | PERMISSION_GRANTED, |
| 545 | PERMISSION_DENIED |
| 546 | }) |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 547 | @Retention(RetentionPolicy.SOURCE) |
| 548 | public @interface PermissionResult {} |
| 549 | |
Dianne Hackborn | 1655be4 | 2009-05-08 14:29:01 -0700 | [diff] [blame] | 550 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 551 | * Permission check result: this is returned by {@link #checkPermission} |
| 552 | * if the permission has been granted to the given package. |
| 553 | */ |
| 554 | public static final int PERMISSION_GRANTED = 0; |
| 555 | |
| 556 | /** |
| 557 | * Permission check result: this is returned by {@link #checkPermission} |
| 558 | * if the permission has not been granted to the given package. |
| 559 | */ |
| 560 | public static final int PERMISSION_DENIED = -1; |
| 561 | |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 562 | /** @hide */ |
| 563 | @IntDef(prefix = { "SIGNATURE_" }, value = { |
| 564 | SIGNATURE_MATCH, |
| 565 | SIGNATURE_NEITHER_SIGNED, |
| 566 | SIGNATURE_FIRST_NOT_SIGNED, |
| 567 | SIGNATURE_SECOND_NOT_SIGNED, |
| 568 | SIGNATURE_NO_MATCH, |
| 569 | SIGNATURE_UNKNOWN_PACKAGE, |
| 570 | }) |
| 571 | @Retention(RetentionPolicy.SOURCE) |
| 572 | public @interface SignatureResult {} |
| 573 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 574 | /** |
| 575 | * Signature check result: this is returned by {@link #checkSignatures} |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 576 | * if all signatures on the two packages match. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 577 | */ |
| 578 | public static final int SIGNATURE_MATCH = 0; |
| 579 | |
| 580 | /** |
| 581 | * Signature check result: this is returned by {@link #checkSignatures} |
| 582 | * if neither of the two packages is signed. |
| 583 | */ |
| 584 | public static final int SIGNATURE_NEITHER_SIGNED = 1; |
| 585 | |
| 586 | /** |
| 587 | * Signature check result: this is returned by {@link #checkSignatures} |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 588 | * 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] | 589 | */ |
| 590 | public static final int SIGNATURE_FIRST_NOT_SIGNED = -1; |
| 591 | |
| 592 | /** |
| 593 | * Signature check result: this is returned by {@link #checkSignatures} |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 594 | * 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] | 595 | */ |
| 596 | public static final int SIGNATURE_SECOND_NOT_SIGNED = -2; |
| 597 | |
| 598 | /** |
| 599 | * Signature check result: this is returned by {@link #checkSignatures} |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 600 | * if not all signatures on both packages match. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 601 | */ |
| 602 | public static final int SIGNATURE_NO_MATCH = -3; |
| 603 | |
| 604 | /** |
| 605 | * Signature check result: this is returned by {@link #checkSignatures} |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 606 | * if either of the packages are not valid. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 607 | */ |
| 608 | public static final int SIGNATURE_UNKNOWN_PACKAGE = -4; |
| 609 | |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 610 | /** @hide */ |
| 611 | @IntDef(prefix = { "COMPONENT_ENABLED_STATE_" }, value = { |
| 612 | COMPONENT_ENABLED_STATE_DEFAULT, |
| 613 | COMPONENT_ENABLED_STATE_ENABLED, |
| 614 | COMPONENT_ENABLED_STATE_DISABLED, |
| 615 | COMPONENT_ENABLED_STATE_DISABLED_USER, |
| 616 | COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED, |
| 617 | }) |
| 618 | @Retention(RetentionPolicy.SOURCE) |
| 619 | public @interface EnabledState {} |
| 620 | |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 621 | /** |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 622 | * Flag for {@link #setApplicationEnabledSetting(String, int, int)} and |
| 623 | * {@link #setComponentEnabledSetting(ComponentName, int, int)}: This |
| 624 | * component or application is in its default enabled state (as specified in |
| 625 | * its manifest). |
| 626 | * <p> |
| 627 | * Explicitly setting the component state to this value restores it's |
| 628 | * enabled state to whatever is set in the manifest. |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 629 | */ |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 630 | public static final int COMPONENT_ENABLED_STATE_DEFAULT = 0; |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 631 | |
| 632 | /** |
| 633 | * Flag for {@link #setApplicationEnabledSetting(String, int, int)} |
| 634 | * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This |
| 635 | * component or application has been explictily enabled, regardless of |
| 636 | * what it has specified in its manifest. |
| 637 | */ |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 638 | public static final int COMPONENT_ENABLED_STATE_ENABLED = 1; |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 639 | |
| 640 | /** |
| 641 | * Flag for {@link #setApplicationEnabledSetting(String, int, int)} |
| 642 | * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This |
| 643 | * component or application has been explicitly disabled, regardless of |
| 644 | * what it has specified in its manifest. |
| 645 | */ |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 646 | public static final int COMPONENT_ENABLED_STATE_DISABLED = 2; |
| 647 | |
| 648 | /** |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 649 | * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: The |
| 650 | * user has explicitly disabled the application, regardless of what it has |
| 651 | * specified in its manifest. Because this is due to the user's request, |
| 652 | * they may re-enable it if desired through the appropriate system UI. This |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 653 | * option currently <strong>cannot</strong> be used with |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 654 | * {@link #setComponentEnabledSetting(ComponentName, int, int)}. |
| 655 | */ |
| 656 | public static final int COMPONENT_ENABLED_STATE_DISABLED_USER = 3; |
| 657 | |
| 658 | /** |
Dianne Hackborn | fd7aded | 2013-01-22 17:10:23 -0800 | [diff] [blame] | 659 | * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: This |
| 660 | * application should be considered, until the point where the user actually |
| 661 | * wants to use it. This means that it will not normally show up to the user |
| 662 | * (such as in the launcher), but various parts of the user interface can |
| 663 | * use {@link #GET_DISABLED_UNTIL_USED_COMPONENTS} to still see it and allow |
| 664 | * the user to select it (as for example an IME, device admin, etc). Such code, |
| 665 | * once the user has selected the app, should at that point also make it enabled. |
| 666 | * This option currently <strong>can not</strong> be used with |
| 667 | * {@link #setComponentEnabledSetting(ComponentName, int, int)}. |
| 668 | */ |
| 669 | public static final int COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED = 4; |
| 670 | |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 671 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 672 | @IntDef(flag = true, prefix = { "INSTALL_" }, value = { |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 673 | INSTALL_FORWARD_LOCK, |
| 674 | INSTALL_REPLACE_EXISTING, |
| 675 | INSTALL_ALLOW_TEST, |
| 676 | INSTALL_EXTERNAL, |
| 677 | INSTALL_INTERNAL, |
| 678 | INSTALL_FROM_ADB, |
| 679 | INSTALL_ALL_USERS, |
| 680 | INSTALL_ALLOW_DOWNGRADE, |
| 681 | INSTALL_GRANT_RUNTIME_PERMISSIONS, |
| 682 | INSTALL_FORCE_VOLUME_UUID, |
| 683 | INSTALL_FORCE_PERMISSION_PROMPT, |
Todd Kennedy | be0b889 | 2017-02-15 14:13:52 -0800 | [diff] [blame] | 684 | INSTALL_INSTANT_APP, |
Todd Kennedy | 39bfee5 | 2016-02-24 10:28:21 -0800 | [diff] [blame] | 685 | INSTALL_DONT_KILL_APP, |
Jeff Sharkey | 683bcd3 | 2017-03-18 17:54:51 -0600 | [diff] [blame] | 686 | INSTALL_FORCE_SDK, |
| 687 | INSTALL_FULL_APP, |
| 688 | INSTALL_ALLOCATE_AGGRESSIVE, |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 689 | }) |
| 690 | @Retention(RetentionPolicy.SOURCE) |
| 691 | public @interface InstallFlags {} |
| 692 | |
Dianne Hackborn | fd7aded | 2013-01-22 17:10:23 -0800 | [diff] [blame] | 693 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 694 | * Flag parameter for {@link #installPackage} to indicate that this package |
| 695 | * should be installed as forward locked, i.e. only the app itself should |
| 696 | * have access to its code and non-resource assets. |
| 697 | * |
Jeff Sharkey | 8c61e39 | 2017-02-24 09:22:48 -0700 | [diff] [blame] | 698 | * @deprecated new installs into ASEC containers are no longer supported. |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 699 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 700 | */ |
Jeff Sharkey | 8c61e39 | 2017-02-24 09:22:48 -0700 | [diff] [blame] | 701 | @Deprecated |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 702 | public static final int INSTALL_FORWARD_LOCK = 0x00000001; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 703 | |
| 704 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 705 | * Flag parameter for {@link #installPackage} to indicate that you want to |
| 706 | * replace an already installed package, if one exists. |
| 707 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 708 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 709 | */ |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 710 | public static final int INSTALL_REPLACE_EXISTING = 0x00000002; |
| 711 | |
| 712 | /** |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 713 | * Flag parameter for {@link #installPackage} to indicate that you want to |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 714 | * allow test packages (those that have set android:testOnly in their |
| 715 | * manifest) to be installed. |
| 716 | * @hide |
| 717 | */ |
| 718 | public static final int INSTALL_ALLOW_TEST = 0x00000004; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 719 | |
| 720 | /** |
Jeff Sharkey | b2b9ab8 | 2015-04-05 21:10:42 -0700 | [diff] [blame] | 721 | * Flag parameter for {@link #installPackage} to indicate that this package |
| 722 | * must be installed to an ASEC on a {@link VolumeInfo#TYPE_PUBLIC}. |
| 723 | * |
Jeff Sharkey | 8c61e39 | 2017-02-24 09:22:48 -0700 | [diff] [blame] | 724 | * @deprecated new installs into ASEC containers are no longer supported; |
| 725 | * use adoptable storage instead. |
Suchi Amalapurapu | af8e9f4 | 2010-01-12 10:17:28 -0800 | [diff] [blame] | 726 | * @hide |
| 727 | */ |
Jeff Sharkey | 8c61e39 | 2017-02-24 09:22:48 -0700 | [diff] [blame] | 728 | @Deprecated |
Suchi Amalapurapu | 5b993ce | 2010-02-12 09:43:29 -0800 | [diff] [blame] | 729 | public static final int INSTALL_EXTERNAL = 0x00000008; |
Oscar Montemayor | 539d3c4 | 2010-01-29 15:27:00 -0800 | [diff] [blame] | 730 | |
| 731 | /** |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 732 | * Flag parameter for {@link #installPackage} to indicate that this package |
Jeff Sharkey | b2b9ab8 | 2015-04-05 21:10:42 -0700 | [diff] [blame] | 733 | * must be installed to internal storage. |
| 734 | * |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 735 | * @hide |
| 736 | */ |
| 737 | public static final int INSTALL_INTERNAL = 0x00000010; |
| 738 | |
| 739 | /** |
| 740 | * Flag parameter for {@link #installPackage} to indicate that this install |
| 741 | * was initiated via ADB. |
| 742 | * |
| 743 | * @hide |
| 744 | */ |
| 745 | public static final int INSTALL_FROM_ADB = 0x00000020; |
Suchi Amalapurapu | 14b6abd | 2010-03-17 08:37:04 -0700 | [diff] [blame] | 746 | |
| 747 | /** |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 748 | * Flag parameter for {@link #installPackage} to indicate that this install |
| 749 | * should immediately be visible to all users. |
| 750 | * |
| 751 | * @hide |
| 752 | */ |
| 753 | public static final int INSTALL_ALL_USERS = 0x00000040; |
| 754 | |
| 755 | /** |
| 756 | * Flag parameter for {@link #installPackage} to indicate that it is okay |
| 757 | * 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] | 758 | * version code than the currently installed app. This is permitted only if |
| 759 | * the currently installed app is marked debuggable. |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 760 | * |
| 761 | * @hide |
| 762 | */ |
| 763 | public static final int INSTALL_ALLOW_DOWNGRADE = 0x00000080; |
| 764 | |
| 765 | /** |
Svet Ganov | 95c1ade | 2015-03-19 09:38:52 -0700 | [diff] [blame] | 766 | * Flag parameter for {@link #installPackage} to indicate that all runtime |
| 767 | * permissions should be granted to the package. If {@link #INSTALL_ALL_USERS} |
| 768 | * is set the runtime permissions will be granted to all users, otherwise |
| 769 | * only to the owner. |
| 770 | * |
| 771 | * @hide |
| 772 | */ |
| 773 | public static final int INSTALL_GRANT_RUNTIME_PERMISSIONS = 0x00000100; |
| 774 | |
Jeff Sharkey | ab23409 | 2015-06-09 21:42:22 -0700 | [diff] [blame] | 775 | /** {@hide} */ |
| 776 | public static final int INSTALL_FORCE_VOLUME_UUID = 0x00000200; |
| 777 | |
Svet Ganov | 95c1ade | 2015-03-19 09:38:52 -0700 | [diff] [blame] | 778 | /** |
Todd Kennedy | a1d12cf | 2015-09-29 15:43:00 -0700 | [diff] [blame] | 779 | * Flag parameter for {@link #installPackage} to indicate that we always want to force |
| 780 | * the prompt for permission approval. This overrides any special behaviour for internal |
| 781 | * components. |
| 782 | * |
| 783 | * @hide |
| 784 | */ |
| 785 | public static final int INSTALL_FORCE_PERMISSION_PROMPT = 0x00000400; |
| 786 | |
| 787 | /** |
Todd Kennedy | 27c24fb | 2015-09-17 16:49:25 -0700 | [diff] [blame] | 788 | * Flag parameter for {@link #installPackage} to indicate that this package is |
Todd Kennedy | 2699f06 | 2015-11-20 13:07:17 -0800 | [diff] [blame] | 789 | * to be installed as a lightweight "ephemeral" app. |
| 790 | * |
| 791 | * @hide |
| 792 | */ |
Todd Kennedy | be0b889 | 2017-02-15 14:13:52 -0800 | [diff] [blame] | 793 | public static final int INSTALL_INSTANT_APP = 0x00000800; |
| 794 | |
| 795 | /** |
Todd Kennedy | 39bfee5 | 2016-02-24 10:28:21 -0800 | [diff] [blame] | 796 | * Flag parameter for {@link #installPackage} to indicate that this package contains |
| 797 | * a feature split to an existing application and the existing application should not |
| 798 | * be killed during the installation process. |
| 799 | * |
| 800 | * @hide |
| 801 | */ |
| 802 | public static final int INSTALL_DONT_KILL_APP = 0x00001000; |
| 803 | |
| 804 | /** |
Todd Kennedy | b107271 | 2016-04-26 15:41:20 -0700 | [diff] [blame] | 805 | * Flag parameter for {@link #installPackage} to indicate that this package is an |
Patrick Baumann | ccb20b8 | 2018-01-08 13:22:46 -0800 | [diff] [blame] | 806 | * upgrade to a package that refers to the SDK via release letter or is targeting an SDK via |
| 807 | * release letter that the current build does not support. |
Todd Kennedy | b107271 | 2016-04-26 15:41:20 -0700 | [diff] [blame] | 808 | * |
| 809 | * @hide |
| 810 | */ |
| 811 | public static final int INSTALL_FORCE_SDK = 0x00002000; |
| 812 | |
| 813 | /** |
Jeff Sharkey | 683bcd3 | 2017-03-18 17:54:51 -0600 | [diff] [blame] | 814 | * Flag parameter for {@link #installPackage} to indicate that this package is |
| 815 | * to be installed as a heavy weight app. This is fundamentally the opposite of |
| 816 | * {@link #INSTALL_INSTANT_APP}. |
| 817 | * |
| 818 | * @hide |
| 819 | */ |
| 820 | public static final int INSTALL_FULL_APP = 0x00004000; |
| 821 | |
| 822 | /** |
| 823 | * Flag parameter for {@link #installPackage} to indicate that this package |
| 824 | * is critical to system health or security, meaning the system should use |
| 825 | * {@link StorageManager#FLAG_ALLOCATE_AGGRESSIVE} internally. |
| 826 | * |
| 827 | * @hide |
| 828 | */ |
| 829 | public static final int INSTALL_ALLOCATE_AGGRESSIVE = 0x00008000; |
| 830 | |
Todd Kennedy | 78a7250 | 2017-07-19 12:49:30 -0700 | [diff] [blame] | 831 | /** |
| 832 | * Flag parameter for {@link #installPackage} to indicate that this package |
| 833 | * is a virtual preload. |
| 834 | * |
| 835 | * @hide |
| 836 | */ |
| 837 | public static final int INSTALL_VIRTUAL_PRELOAD = 0x00010000; |
| 838 | |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 839 | /** @hide */ |
| 840 | @IntDef(flag = true, prefix = { "DONT_KILL_APP" }, value = { |
| 841 | DONT_KILL_APP |
| 842 | }) |
| 843 | @Retention(RetentionPolicy.SOURCE) |
| 844 | public @interface EnabledFlags {} |
| 845 | |
Jeff Sharkey | 683bcd3 | 2017-03-18 17:54:51 -0600 | [diff] [blame] | 846 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 847 | * Flag parameter for |
| 848 | * {@link #setComponentEnabledSetting(android.content.ComponentName, int, int)} to indicate |
| 849 | * that you don't want to kill the app containing the component. Be careful when you set this |
| 850 | * since changing component states can make the containing application's behavior unpredictable. |
| 851 | */ |
| 852 | public static final int DONT_KILL_APP = 0x00000001; |
| 853 | |
Bartosz Fabianowski | a34f53f | 2017-01-11 18:08:47 +0100 | [diff] [blame] | 854 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 855 | @IntDef(prefix = { "INSTALL_REASON_" }, value = { |
| 856 | INSTALL_REASON_UNKNOWN, |
| 857 | INSTALL_REASON_POLICY, |
| 858 | INSTALL_REASON_DEVICE_RESTORE, |
| 859 | INSTALL_REASON_DEVICE_SETUP, |
| 860 | INSTALL_REASON_USER |
| 861 | }) |
Bartosz Fabianowski | a34f53f | 2017-01-11 18:08:47 +0100 | [diff] [blame] | 862 | @Retention(RetentionPolicy.SOURCE) |
| 863 | public @interface InstallReason {} |
| 864 | |
| 865 | /** |
| 866 | * Code indicating that the reason for installing this package is unknown. |
| 867 | */ |
| 868 | public static final int INSTALL_REASON_UNKNOWN = 0; |
| 869 | |
| 870 | /** |
| 871 | * Code indicating that this package was installed due to enterprise policy. |
| 872 | */ |
| 873 | public static final int INSTALL_REASON_POLICY = 1; |
| 874 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 875 | /** |
Sunny Goyal | 80af6a2 | 2017-03-02 08:32:33 -0800 | [diff] [blame] | 876 | * Code indicating that this package was installed as part of restoring from another device. |
| 877 | */ |
| 878 | public static final int INSTALL_REASON_DEVICE_RESTORE = 2; |
| 879 | |
| 880 | /** |
| 881 | * Code indicating that this package was installed as part of device setup. |
| 882 | */ |
| 883 | public static final int INSTALL_REASON_DEVICE_SETUP = 3; |
| 884 | |
| 885 | /** |
| 886 | * Code indicating that the package installation was initiated by the user. |
| 887 | */ |
| 888 | public static final int INSTALL_REASON_USER = 4; |
| 889 | |
| 890 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 891 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 892 | * on success. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 893 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 894 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 895 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 896 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 897 | public static final int INSTALL_SUCCEEDED = 1; |
| 898 | |
| 899 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 900 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 901 | * if the package is already installed. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 902 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 903 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 904 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 905 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 906 | public static final int INSTALL_FAILED_ALREADY_EXISTS = -1; |
| 907 | |
| 908 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 909 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 910 | * if the package archive file is invalid. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 911 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 912 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 913 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 914 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 915 | public static final int INSTALL_FAILED_INVALID_APK = -2; |
| 916 | |
| 917 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 918 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 919 | * if the URI passed in is invalid. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 920 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 921 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 922 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 923 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 924 | public static final int INSTALL_FAILED_INVALID_URI = -3; |
| 925 | |
| 926 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 927 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 928 | * if the package manager service found that the device didn't have enough storage space to |
| 929 | * install the app. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 930 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 931 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 932 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 933 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 934 | public static final int INSTALL_FAILED_INSUFFICIENT_STORAGE = -4; |
| 935 | |
| 936 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 937 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 938 | * if a package is already installed with the same name. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 939 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 940 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 941 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 942 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 943 | public static final int INSTALL_FAILED_DUPLICATE_PACKAGE = -5; |
| 944 | |
| 945 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 946 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 947 | * if the requested shared user does not exist. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 948 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 949 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 950 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 951 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 952 | public static final int INSTALL_FAILED_NO_SHARED_USER = -6; |
| 953 | |
| 954 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 955 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 956 | * if a previously installed package of the same name has a different signature than the new |
| 957 | * package (and the old package's data was not removed). |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 958 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 959 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 960 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 961 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 962 | public static final int INSTALL_FAILED_UPDATE_INCOMPATIBLE = -7; |
| 963 | |
| 964 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 965 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 966 | * if the new package is requested a shared user which is already installed on the device and |
| 967 | * does not have matching signature. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 968 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 969 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 970 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 971 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 972 | public static final int INSTALL_FAILED_SHARED_USER_INCOMPATIBLE = -8; |
| 973 | |
| 974 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 975 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 976 | * if the new package uses a shared library that is not available. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 977 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 978 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 979 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 980 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 981 | public static final int INSTALL_FAILED_MISSING_SHARED_LIBRARY = -9; |
| 982 | |
| 983 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 984 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 985 | * if the new package uses a shared library that is not available. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 986 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 987 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 988 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 989 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 990 | public static final int INSTALL_FAILED_REPLACE_COULDNT_DELETE = -10; |
| 991 | |
| 992 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 993 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 994 | * if the new package failed while optimizing and validating its dex files, either because there |
| 995 | * was not enough storage or the validation failed. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 996 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 997 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 998 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 999 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1000 | public static final int INSTALL_FAILED_DEXOPT = -11; |
| 1001 | |
| 1002 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1003 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1004 | * if the new package failed because the current SDK version is older than that required by the |
| 1005 | * package. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1006 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1007 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1008 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1009 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1010 | public static final int INSTALL_FAILED_OLDER_SDK = -12; |
| 1011 | |
| 1012 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1013 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1014 | * if the new package failed because it contains a content provider with the same authority as a |
| 1015 | * provider already installed in the system. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1016 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1017 | * @hide |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 1018 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1019 | @SystemApi |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 1020 | public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13; |
| 1021 | |
| 1022 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1023 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1024 | * if the new package failed because the current SDK version is newer than that required by the |
| 1025 | * package. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1026 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1027 | * @hide |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 1028 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1029 | @SystemApi |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 1030 | public static final int INSTALL_FAILED_NEWER_SDK = -14; |
| 1031 | |
| 1032 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1033 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1034 | * if the new package failed because it has specified that it is a test-only package and the |
| 1035 | * caller has not supplied the {@link #INSTALL_ALLOW_TEST} flag. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1036 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1037 | * @hide |
| 1038 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1039 | @SystemApi |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1040 | public static final int INSTALL_FAILED_TEST_ONLY = -15; |
| 1041 | |
| 1042 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1043 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1044 | * if the package being installed contains native code, but none that is compatible with the |
| 1045 | * device's CPU_ABI. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1046 | * |
Dianne Hackborn | b181118 | 2009-05-21 15:45:42 -0700 | [diff] [blame] | 1047 | * @hide |
| 1048 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1049 | @SystemApi |
Dianne Hackborn | b181118 | 2009-05-21 15:45:42 -0700 | [diff] [blame] | 1050 | public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16; |
| 1051 | |
| 1052 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1053 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1054 | * if the new package uses a feature that is not available. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1055 | * |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 1056 | * @hide |
| 1057 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1058 | @SystemApi |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 1059 | public static final int INSTALL_FAILED_MISSING_FEATURE = -17; |
| 1060 | |
Suchi Amalapurapu | af8e9f4 | 2010-01-12 10:17:28 -0800 | [diff] [blame] | 1061 | // ------ Errors related to sdcard |
| 1062 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1063 | * Installation return code: this is passed in the |
| 1064 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if a secure container mount point couldn't be |
| 1065 | * accessed on external media. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1066 | * |
Suchi Amalapurapu | af8e9f4 | 2010-01-12 10:17:28 -0800 | [diff] [blame] | 1067 | * @hide |
| 1068 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1069 | @SystemApi |
Suchi Amalapurapu | af8e9f4 | 2010-01-12 10:17:28 -0800 | [diff] [blame] | 1070 | public static final int INSTALL_FAILED_CONTAINER_ERROR = -18; |
| 1071 | |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 1072 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1073 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1074 | * 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] | 1075 | * |
Suchi Amalapurapu | b56ae20 | 2010-02-04 22:51:07 -0800 | [diff] [blame] | 1076 | * @hide |
| 1077 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1078 | @SystemApi |
Suchi Amalapurapu | b56ae20 | 2010-02-04 22:51:07 -0800 | [diff] [blame] | 1079 | public static final int INSTALL_FAILED_INVALID_INSTALL_LOCATION = -19; |
| 1080 | |
| 1081 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1082 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1083 | * if the new package couldn't be installed in the specified install location because the media |
| 1084 | * is not available. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1085 | * |
Suchi Amalapurapu | 8a9ab24 | 2010-03-11 16:49:16 -0800 | [diff] [blame] | 1086 | * @hide |
| 1087 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1088 | @SystemApi |
Suchi Amalapurapu | 8a9ab24 | 2010-03-11 16:49:16 -0800 | [diff] [blame] | 1089 | public static final int INSTALL_FAILED_MEDIA_UNAVAILABLE = -20; |
| 1090 | |
| 1091 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1092 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1093 | * 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] | 1094 | * |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 1095 | * @hide |
| 1096 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1097 | @SystemApi |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 1098 | public static final int INSTALL_FAILED_VERIFICATION_TIMEOUT = -21; |
| 1099 | |
| 1100 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1101 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1102 | * 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] | 1103 | * |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 1104 | * @hide |
| 1105 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1106 | @SystemApi |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 1107 | public static final int INSTALL_FAILED_VERIFICATION_FAILURE = -22; |
| 1108 | |
| 1109 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1110 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1111 | * if the package changed from what the calling program expected. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1112 | * |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 1113 | * @hide |
| 1114 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1115 | @SystemApi |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 1116 | public static final int INSTALL_FAILED_PACKAGE_CHANGED = -23; |
| 1117 | |
| 1118 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1119 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1120 | * 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] | 1121 | * |
Dianne Hackborn | d0c5f51 | 2012-06-07 16:53:59 -0700 | [diff] [blame] | 1122 | * @hide |
| 1123 | */ |
| 1124 | public static final int INSTALL_FAILED_UID_CHANGED = -24; |
| 1125 | |
| 1126 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1127 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1128 | * 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] | 1129 | * |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 1130 | * @hide |
| 1131 | */ |
| 1132 | public static final int INSTALL_FAILED_VERSION_DOWNGRADE = -25; |
| 1133 | |
| 1134 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1135 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1136 | * if the old package has target SDK high enough to support runtime permission and the new |
| 1137 | * package has target SDK low enough to not support runtime permissions. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1138 | * |
Svetoslav | d965370 | 2015-05-13 18:02:46 -0700 | [diff] [blame] | 1139 | * @hide |
| 1140 | */ |
| 1141 | @SystemApi |
| 1142 | public static final int INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE = -26; |
| 1143 | |
| 1144 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1145 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1146 | * 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] | 1147 | * |
| 1148 | * @hide |
| 1149 | */ |
| 1150 | @SystemApi |
| 1151 | public static final int INSTALL_FAILED_SANDBOX_VERSION_DOWNGRADE = -27; |
| 1152 | |
| 1153 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1154 | * Installation parse return code: this is passed in the |
| 1155 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser was given a path that is not a |
| 1156 | * file, or does not end with the expected '.apk' extension. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1157 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1158 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1159 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1160 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1161 | public static final int INSTALL_PARSE_FAILED_NOT_APK = -100; |
| 1162 | |
| 1163 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1164 | * Installation parse return code: this is passed in the |
| 1165 | * {@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] | 1166 | * AndroidManifest.xml file. |
| 1167 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1168 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1169 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1170 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1171 | public static final int INSTALL_PARSE_FAILED_BAD_MANIFEST = -101; |
| 1172 | |
| 1173 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1174 | * Installation parse return code: this is passed in the |
| 1175 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered an unexpected |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1176 | * exception. |
| 1177 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1178 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1179 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1180 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1181 | public static final int INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION = -102; |
| 1182 | |
| 1183 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1184 | * Installation parse return code: this is passed in the |
| 1185 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser did not find any certificates in |
| 1186 | * the .apk. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1187 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1188 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1189 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1190 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1191 | public static final int INSTALL_PARSE_FAILED_NO_CERTIFICATES = -103; |
| 1192 | |
| 1193 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1194 | * Installation parse return code: this is passed in the |
| 1195 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser found inconsistent certificates on |
| 1196 | * the files in the .apk. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1197 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1198 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1199 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1200 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1201 | public static final int INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES = -104; |
| 1202 | |
| 1203 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1204 | * Installation parse return code: this is passed in the |
| 1205 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered a |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1206 | * CertificateEncodingException in one of the files in the .apk. |
| 1207 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1208 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1209 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1210 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1211 | public static final int INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING = -105; |
| 1212 | |
| 1213 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1214 | * Installation parse return code: this is passed in the |
| 1215 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered a bad or missing |
| 1216 | * package name in the manifest. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1217 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1218 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1219 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1220 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1221 | public static final int INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME = -106; |
| 1222 | |
| 1223 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1224 | * Installation parse return code: tthis is passed in the |
| 1225 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered a bad shared user id |
| 1226 | * name in the manifest. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1227 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1228 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1229 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1230 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1231 | public static final int INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID = -107; |
| 1232 | |
| 1233 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1234 | * Installation parse return code: this is passed in the |
| 1235 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered some structural |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1236 | * problem in the manifest. |
| 1237 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1238 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1239 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1240 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1241 | public static final int INSTALL_PARSE_FAILED_MANIFEST_MALFORMED = -108; |
| 1242 | |
| 1243 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1244 | * Installation parse return code: this is passed in the |
| 1245 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser did not find any actionable tags |
| 1246 | * (instrumentation or application) in the manifest. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1247 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1248 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1249 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1250 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1251 | public static final int INSTALL_PARSE_FAILED_MANIFEST_EMPTY = -109; |
| 1252 | |
| 1253 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1254 | * Installation failed return code: this is passed in the |
| 1255 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package |
| 1256 | * because of system issues. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1257 | * |
Suchi Amalapurapu | 5b993ce | 2010-02-12 09:43:29 -0800 | [diff] [blame] | 1258 | * @hide |
| 1259 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1260 | @SystemApi |
Suchi Amalapurapu | 5b993ce | 2010-02-12 09:43:29 -0800 | [diff] [blame] | 1261 | public static final int INSTALL_FAILED_INTERNAL_ERROR = -110; |
| 1262 | |
| 1263 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1264 | * Installation failed return code: this is passed in the |
| 1265 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package |
| 1266 | * because the user is restricted from installing apps. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1267 | * |
Amith Yamasani | e4cf734 | 2012-12-17 11:12:09 -0800 | [diff] [blame] | 1268 | * @hide |
| 1269 | */ |
| 1270 | public static final int INSTALL_FAILED_USER_RESTRICTED = -111; |
| 1271 | |
| 1272 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1273 | * Installation failed return code: this is passed in the |
| 1274 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package |
| 1275 | * because it is attempting to define a permission that is already defined by some existing |
| 1276 | * package. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1277 | * <p> |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1278 | * The package name of the app which has already defined the permission is passed to a |
| 1279 | * {@link PackageInstallObserver}, if any, as the {@link #EXTRA_FAILURE_EXISTING_PACKAGE} string |
| 1280 | * 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] | 1281 | * {@link #EXTRA_FAILURE_EXISTING_PERMISSION} string extra. |
Christopher Tate | f1977b4 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 1282 | * |
Christopher Tate | f1977b4 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 1283 | * @hide |
| 1284 | */ |
| 1285 | public static final int INSTALL_FAILED_DUPLICATE_PERMISSION = -112; |
| 1286 | |
| 1287 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1288 | * Installation failed return code: this is passed in the |
| 1289 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package |
| 1290 | * 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] | 1291 | * |
| 1292 | * @hide |
| 1293 | */ |
Narayan Kamath | d11f223 | 2014-04-10 10:37:17 +0100 | [diff] [blame] | 1294 | public static final int INSTALL_FAILED_NO_MATCHING_ABIS = -113; |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 1295 | |
| 1296 | /** |
| 1297 | * Internal return code for NativeLibraryHelper methods to indicate that the package |
| 1298 | * being processed did not contain any native code. This is placed here only so that |
| 1299 | * it can belong to the same value space as the other install failure codes. |
| 1300 | * |
| 1301 | * @hide |
| 1302 | */ |
Narayan Kamath | d11f223 | 2014-04-10 10:37:17 +0100 | [diff] [blame] | 1303 | public static final int NO_NATIVE_LIBRARIES = -114; |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 1304 | |
Jeff Sharkey | 7328a1b | 2014-08-07 14:01:43 -0700 | [diff] [blame] | 1305 | /** {@hide} */ |
Jeff Sharkey | f060095 | 2014-08-07 17:31:53 -0700 | [diff] [blame] | 1306 | public static final int INSTALL_FAILED_ABORTED = -115; |
Jeff Sharkey | 7328a1b | 2014-08-07 14:01:43 -0700 | [diff] [blame] | 1307 | |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 1308 | /** |
Todd Kennedy | be0b889 | 2017-02-15 14:13:52 -0800 | [diff] [blame] | 1309 | * Installation failed return code: instant app installs are incompatible with some |
Todd Kennedy | 2699f06 | 2015-11-20 13:07:17 -0800 | [diff] [blame] | 1310 | * other installation flags supplied for the operation; or other circumstances such |
Todd Kennedy | be0b889 | 2017-02-15 14:13:52 -0800 | [diff] [blame] | 1311 | * as trying to upgrade a system app via an instant app install. |
Todd Kennedy | 2699f06 | 2015-11-20 13:07:17 -0800 | [diff] [blame] | 1312 | * @hide |
| 1313 | */ |
Todd Kennedy | be0b889 | 2017-02-15 14:13:52 -0800 | [diff] [blame] | 1314 | public static final int INSTALL_FAILED_INSTANT_APP_INVALID = -116; |
Todd Kennedy | 2699f06 | 2015-11-20 13:07:17 -0800 | [diff] [blame] | 1315 | |
Calin Juravle | 3fc56c3 | 2017-12-11 18:26:13 -0800 | [diff] [blame] | 1316 | /** |
| 1317 | * Installation parse return code: this is passed in the |
| 1318 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the dex metadata file is invalid or |
| 1319 | * if there was no matching apk file for a dex metadata file. |
| 1320 | * |
| 1321 | * @hide |
| 1322 | */ |
| 1323 | public static final int INSTALL_FAILED_BAD_DEX_METADATA = -117; |
| 1324 | |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1325 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 1326 | @IntDef(flag = true, prefix = { "DELETE_" }, value = { |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1327 | DELETE_KEEP_DATA, |
| 1328 | DELETE_ALL_USERS, |
| 1329 | DELETE_SYSTEM_APP, |
Todd Kennedy | 39bfee5 | 2016-02-24 10:28:21 -0800 | [diff] [blame] | 1330 | DELETE_DONT_KILL_APP, |
Todd Kennedy | 232d29e | 2017-11-06 14:45:53 -0800 | [diff] [blame] | 1331 | DELETE_CHATTY, |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1332 | }) |
| 1333 | @Retention(RetentionPolicy.SOURCE) |
| 1334 | public @interface DeleteFlags {} |
| 1335 | |
Todd Kennedy | 2699f06 | 2015-11-20 13:07:17 -0800 | [diff] [blame] | 1336 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1337 | * Flag parameter for {@link #deletePackage} to indicate that you don't want to delete the |
| 1338 | * package's data directory. |
| 1339 | * |
| 1340 | * @hide |
| 1341 | */ |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 1342 | public static final int DELETE_KEEP_DATA = 0x00000001; |
| 1343 | |
| 1344 | /** |
| 1345 | * Flag parameter for {@link #deletePackage} to indicate that you want the |
| 1346 | * package deleted for all users. |
| 1347 | * |
| 1348 | * @hide |
| 1349 | */ |
| 1350 | public static final int DELETE_ALL_USERS = 0x00000002; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1351 | |
| 1352 | /** |
Dianne Hackborn | c895be7 | 2013-03-11 17:48:43 -0700 | [diff] [blame] | 1353 | * Flag parameter for {@link #deletePackage} to indicate that, if you are calling |
| 1354 | * uninstall on a system that has been updated, then don't do the normal process |
| 1355 | * of uninstalling the update and rolling back to the older system version (which |
| 1356 | * needs to happen for all users); instead, just mark the app as uninstalled for |
| 1357 | * the current user. |
| 1358 | * |
| 1359 | * @hide |
| 1360 | */ |
| 1361 | public static final int DELETE_SYSTEM_APP = 0x00000004; |
| 1362 | |
| 1363 | /** |
Todd Kennedy | 39bfee5 | 2016-02-24 10:28:21 -0800 | [diff] [blame] | 1364 | * Flag parameter for {@link #deletePackage} to indicate that, if you are calling |
| 1365 | * uninstall on a package that is replaced to provide new feature splits, the |
| 1366 | * existing application should not be killed during the removal process. |
| 1367 | * |
| 1368 | * @hide |
| 1369 | */ |
| 1370 | public static final int DELETE_DONT_KILL_APP = 0x00000008; |
| 1371 | |
| 1372 | /** |
Todd Kennedy | 232d29e | 2017-11-06 14:45:53 -0800 | [diff] [blame] | 1373 | * Flag parameter for {@link #deletePackage} to indicate that package deletion |
| 1374 | * should be chatty. |
| 1375 | * |
| 1376 | * @hide |
| 1377 | */ |
| 1378 | public static final int DELETE_CHATTY = 0x80000000; |
| 1379 | |
| 1380 | /** |
Kenny Root | c39bb4a | 2011-02-28 13:27:19 -0800 | [diff] [blame] | 1381 | * Return code for when package deletion succeeds. This is passed to the |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1382 | * {@link IPackageDeleteObserver} if the system succeeded in deleting the |
| 1383 | * package. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 1384 | * |
Kenny Root | c39bb4a | 2011-02-28 13:27:19 -0800 | [diff] [blame] | 1385 | * @hide |
| 1386 | */ |
| 1387 | public static final int DELETE_SUCCEEDED = 1; |
| 1388 | |
| 1389 | /** |
| 1390 | * Deletion failed return code: this is passed to the |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1391 | * {@link IPackageDeleteObserver} if the system failed to delete the package |
| 1392 | * for an unspecified reason. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 1393 | * |
Kenny Root | c39bb4a | 2011-02-28 13:27:19 -0800 | [diff] [blame] | 1394 | * @hide |
| 1395 | */ |
| 1396 | public static final int DELETE_FAILED_INTERNAL_ERROR = -1; |
| 1397 | |
| 1398 | /** |
| 1399 | * Deletion failed return code: this is passed to the |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1400 | * {@link IPackageDeleteObserver} if the system failed to delete the package |
| 1401 | * because it is the active DevicePolicy manager. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 1402 | * |
Kenny Root | c39bb4a | 2011-02-28 13:27:19 -0800 | [diff] [blame] | 1403 | * @hide |
| 1404 | */ |
| 1405 | public static final int DELETE_FAILED_DEVICE_POLICY_MANAGER = -2; |
| 1406 | |
| 1407 | /** |
Amith Yamasani | e4cf734 | 2012-12-17 11:12:09 -0800 | [diff] [blame] | 1408 | * Deletion failed return code: this is passed to the |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1409 | * {@link IPackageDeleteObserver} if the system failed to delete the package |
| 1410 | * since the user is restricted. |
Amith Yamasani | e4cf734 | 2012-12-17 11:12:09 -0800 | [diff] [blame] | 1411 | * |
| 1412 | * @hide |
| 1413 | */ |
| 1414 | public static final int DELETE_FAILED_USER_RESTRICTED = -3; |
| 1415 | |
| 1416 | /** |
Kenny Guy | 1b88da5 | 2014-07-10 16:33:49 +0100 | [diff] [blame] | 1417 | * Deletion failed return code: this is passed to the |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1418 | * {@link IPackageDeleteObserver} if the system failed to delete the package |
| 1419 | * because a profile or device owner has marked the package as |
| 1420 | * uninstallable. |
Kenny Guy | c13053b | 2014-05-29 14:17:17 +0100 | [diff] [blame] | 1421 | * |
| 1422 | * @hide |
| 1423 | */ |
Jeff Sharkey | f060095 | 2014-08-07 17:31:53 -0700 | [diff] [blame] | 1424 | public static final int DELETE_FAILED_OWNER_BLOCKED = -4; |
| 1425 | |
| 1426 | /** {@hide} */ |
| 1427 | public static final int DELETE_FAILED_ABORTED = -5; |
Kenny Guy | c13053b | 2014-05-29 14:17:17 +0100 | [diff] [blame] | 1428 | |
| 1429 | /** |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 1430 | * Deletion failed return code: this is passed to the |
| 1431 | * {@link IPackageDeleteObserver} if the system failed to delete the package |
| 1432 | * because the packge is a shared library used by other installed packages. |
| 1433 | * {@hide} */ |
| 1434 | public static final int DELETE_FAILED_USED_SHARED_LIBRARY = -6; |
| 1435 | |
| 1436 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1437 | * Return code that is passed to the {@link IPackageMoveObserver} when the |
Kenny Root | c39bb4a | 2011-02-28 13:27:19 -0800 | [diff] [blame] | 1438 | * package has been successfully moved by the system. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 1439 | * |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1440 | * @hide |
| 1441 | */ |
Jeff Sharkey | 620b32b | 2015-04-23 19:36:02 -0700 | [diff] [blame] | 1442 | public static final int MOVE_SUCCEEDED = -100; |
| 1443 | |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1444 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1445 | * Error code that is passed to the {@link IPackageMoveObserver} when the |
| 1446 | * package hasn't been successfully moved by the system because of |
| 1447 | * insufficient memory on specified media. |
| 1448 | * |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1449 | * @hide |
| 1450 | */ |
| 1451 | public static final int MOVE_FAILED_INSUFFICIENT_STORAGE = -1; |
| 1452 | |
| 1453 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1454 | * Error code that is passed to the {@link IPackageMoveObserver} if the |
| 1455 | * specified package doesn't exist. |
| 1456 | * |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1457 | * @hide |
| 1458 | */ |
| 1459 | public static final int MOVE_FAILED_DOESNT_EXIST = -2; |
| 1460 | |
| 1461 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1462 | * Error code that is passed to the {@link IPackageMoveObserver} if the |
| 1463 | * specified package cannot be moved since its a system package. |
| 1464 | * |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1465 | * @hide |
| 1466 | */ |
| 1467 | public static final int MOVE_FAILED_SYSTEM_PACKAGE = -3; |
| 1468 | |
| 1469 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1470 | * Error code that is passed to the {@link IPackageMoveObserver} if the |
| 1471 | * specified package cannot be moved since its forward locked. |
| 1472 | * |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1473 | * @hide |
| 1474 | */ |
| 1475 | public static final int MOVE_FAILED_FORWARD_LOCKED = -4; |
| 1476 | |
| 1477 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1478 | * Error code that is passed to the {@link IPackageMoveObserver} if the |
| 1479 | * specified package cannot be moved to the specified location. |
| 1480 | * |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1481 | * @hide |
| 1482 | */ |
| 1483 | public static final int MOVE_FAILED_INVALID_LOCATION = -5; |
| 1484 | |
| 1485 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1486 | * Error code that is passed to the {@link IPackageMoveObserver} if the |
| 1487 | * specified package cannot be moved to the specified location. |
| 1488 | * |
Suchi Amalapurapu | 8a9ab24 | 2010-03-11 16:49:16 -0800 | [diff] [blame] | 1489 | * @hide |
| 1490 | */ |
| 1491 | public static final int MOVE_FAILED_INTERNAL_ERROR = -6; |
| 1492 | |
| 1493 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1494 | * Error code that is passed to the {@link IPackageMoveObserver} if the |
| 1495 | * specified package already has an operation pending in the queue. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 1496 | * |
Kenny Root | deb1126 | 2010-08-02 11:36:21 -0700 | [diff] [blame] | 1497 | * @hide |
| 1498 | */ |
| 1499 | public static final int MOVE_FAILED_OPERATION_PENDING = -7; |
| 1500 | |
| 1501 | /** |
Makoto Onuki | f34db0a | 2016-02-17 11:17:15 -0800 | [diff] [blame] | 1502 | * Error code that is passed to the {@link IPackageMoveObserver} if the |
| 1503 | * specified package cannot be moved since it contains a device admin. |
| 1504 | * |
| 1505 | * @hide |
| 1506 | */ |
| 1507 | public static final int MOVE_FAILED_DEVICE_ADMIN = -8; |
| 1508 | |
| 1509 | /** |
Yao Chen | 022b8ea | 2016-12-16 11:03:28 -0800 | [diff] [blame] | 1510 | * Error code that is passed to the {@link IPackageMoveObserver} if system does not allow |
| 1511 | * non-system apps to be moved to internal storage. |
| 1512 | * |
| 1513 | * @hide |
| 1514 | */ |
| 1515 | public static final int MOVE_FAILED_3RD_PARTY_NOT_ALLOWED_ON_INTERNAL = -9; |
| 1516 | |
Jeff Sharkey | a65e649 | 2017-06-21 13:45:11 -0600 | [diff] [blame] | 1517 | /** @hide */ |
| 1518 | public static final int MOVE_FAILED_LOCKED_USER = -10; |
| 1519 | |
Yao Chen | 022b8ea | 2016-12-16 11:03:28 -0800 | [diff] [blame] | 1520 | /** |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1521 | * Flag parameter for {@link #movePackage} to indicate that |
| 1522 | * the package should be moved to internal storage if its |
| 1523 | * been installed on external media. |
| 1524 | * @hide |
| 1525 | */ |
Jeff Sharkey | 620b32b | 2015-04-23 19:36:02 -0700 | [diff] [blame] | 1526 | @Deprecated |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1527 | public static final int MOVE_INTERNAL = 0x00000001; |
| 1528 | |
| 1529 | /** |
| 1530 | * Flag parameter for {@link #movePackage} to indicate that |
| 1531 | * the package should be moved to external media. |
| 1532 | * @hide |
| 1533 | */ |
Jeff Sharkey | 620b32b | 2015-04-23 19:36:02 -0700 | [diff] [blame] | 1534 | @Deprecated |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1535 | public static final int MOVE_EXTERNAL_MEDIA = 0x00000002; |
| 1536 | |
Jeff Sharkey | 620b32b | 2015-04-23 19:36:02 -0700 | [diff] [blame] | 1537 | /** {@hide} */ |
| 1538 | public static final String EXTRA_MOVE_ID = "android.content.pm.extra.MOVE_ID"; |
| 1539 | |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1540 | /** |
Kenny Root | 05ca4c9 | 2011-09-15 10:36:25 -0700 | [diff] [blame] | 1541 | * Usable by the required verifier as the {@code verificationCode} argument |
| 1542 | * for {@link PackageManager#verifyPendingInstall} to indicate that it will |
| 1543 | * allow the installation to proceed without any of the optional verifiers |
| 1544 | * needing to vote. |
| 1545 | * |
| 1546 | * @hide |
| 1547 | */ |
| 1548 | public static final int VERIFICATION_ALLOW_WITHOUT_SUFFICIENT = 2; |
| 1549 | |
| 1550 | /** |
Kenny Root | 3a9b5fb | 2011-09-20 14:15:38 -0700 | [diff] [blame] | 1551 | * Used as the {@code verificationCode} argument for |
| 1552 | * {@link PackageManager#verifyPendingInstall} to indicate that the calling |
| 1553 | * package verifier allows the installation to proceed. |
| 1554 | */ |
| 1555 | public static final int VERIFICATION_ALLOW = 1; |
| 1556 | |
| 1557 | /** |
| 1558 | * Used as the {@code verificationCode} argument for |
| 1559 | * {@link PackageManager#verifyPendingInstall} to indicate the calling |
| 1560 | * package verifier does not vote to allow the installation to proceed. |
| 1561 | */ |
| 1562 | public static final int VERIFICATION_REJECT = -1; |
| 1563 | |
| 1564 | /** |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 1565 | * Used as the {@code verificationCode} argument for |
| 1566 | * {@link PackageManager#verifyIntentFilter} to indicate that the calling |
| 1567 | * IntentFilter Verifier confirms that the IntentFilter is verified. |
| 1568 | * |
| 1569 | * @hide |
| 1570 | */ |
Todd Kennedy | dfa93ab | 2016-03-03 15:24:33 -0800 | [diff] [blame] | 1571 | @SystemApi |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 1572 | public static final int INTENT_FILTER_VERIFICATION_SUCCESS = 1; |
| 1573 | |
| 1574 | /** |
| 1575 | * Used as the {@code verificationCode} argument for |
| 1576 | * {@link PackageManager#verifyIntentFilter} to indicate that the calling |
| 1577 | * IntentFilter Verifier confirms that the IntentFilter is NOT verified. |
| 1578 | * |
| 1579 | * @hide |
| 1580 | */ |
Todd Kennedy | dfa93ab | 2016-03-03 15:24:33 -0800 | [diff] [blame] | 1581 | @SystemApi |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 1582 | public static final int INTENT_FILTER_VERIFICATION_FAILURE = -1; |
| 1583 | |
| 1584 | /** |
| 1585 | * Internal status code to indicate that an IntentFilter verification result is not specified. |
| 1586 | * |
| 1587 | * @hide |
| 1588 | */ |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 1589 | @SystemApi |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 1590 | public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED = 0; |
| 1591 | |
| 1592 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1593 | * Used as the {@code status} argument for |
| 1594 | * {@link #updateIntentVerificationStatusAsUser} to indicate that the User |
| 1595 | * will always be prompted the Intent Disambiguation Dialog if there are two |
| 1596 | * or more Intent resolved for the IntentFilter's domain(s). |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 1597 | * |
| 1598 | * @hide |
| 1599 | */ |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 1600 | @SystemApi |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 1601 | public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK = 1; |
| 1602 | |
| 1603 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1604 | * Used as the {@code status} argument for |
| 1605 | * {@link #updateIntentVerificationStatusAsUser} to indicate that the User |
| 1606 | * will never be prompted the Intent Disambiguation Dialog if there are two |
| 1607 | * or more resolution of the Intent. The default App for the domain(s) |
| 1608 | * specified in the IntentFilter will also ALWAYS be used. |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 1609 | * |
| 1610 | * @hide |
| 1611 | */ |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 1612 | @SystemApi |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 1613 | public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS = 2; |
| 1614 | |
| 1615 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1616 | * Used as the {@code status} argument for |
| 1617 | * {@link #updateIntentVerificationStatusAsUser} to indicate that the User |
| 1618 | * may be prompted the Intent Disambiguation Dialog if there are two or more |
| 1619 | * 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] | 1620 | * IntentFilter will also NEVER be presented to the User. |
| 1621 | * |
| 1622 | * @hide |
| 1623 | */ |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 1624 | @SystemApi |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 1625 | public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER = 3; |
| 1626 | |
| 1627 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1628 | * Used as the {@code status} argument for |
| 1629 | * {@link #updateIntentVerificationStatusAsUser} to indicate that this app |
| 1630 | * should always be considered as an ambiguous candidate for handling the |
| 1631 | * matching Intent even if there are other candidate apps in the "always" |
| 1632 | * state. Put another way: if there are any 'always ask' apps in a set of |
| 1633 | * more than one candidate app, then a disambiguation is *always* presented |
| 1634 | * even if there is another candidate app with the 'always' state. |
Christopher Tate | 56f0ff3 | 2015-08-13 16:29:33 -0700 | [diff] [blame] | 1635 | * |
| 1636 | * @hide |
| 1637 | */ |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 1638 | @SystemApi |
Christopher Tate | 56f0ff3 | 2015-08-13 16:29:33 -0700 | [diff] [blame] | 1639 | public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK = 4; |
| 1640 | |
| 1641 | /** |
rich cannings | d9ef3e5 | 2012-08-22 14:28:05 -0700 | [diff] [blame] | 1642 | * Can be used as the {@code millisecondsToDelay} argument for |
| 1643 | * {@link PackageManager#extendVerificationTimeout}. This is the |
| 1644 | * maximum time {@code PackageManager} waits for the verification |
| 1645 | * agent to return (in milliseconds). |
| 1646 | */ |
| 1647 | public static final long MAXIMUM_VERIFICATION_TIMEOUT = 60*60*1000; |
| 1648 | |
| 1649 | /** |
Amith Yamasani | 0b28549 | 2011-04-14 17:35:23 -0700 | [diff] [blame] | 1650 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device's |
| 1651 | * audio pipeline is low-latency, more suitable for audio applications sensitive to delays or |
| 1652 | * lag in sound input or output. |
Dan Morrill | 898e1e8 | 2010-09-26 17:28:30 -0700 | [diff] [blame] | 1653 | */ |
| 1654 | @SdkConstant(SdkConstantType.FEATURE) |
| 1655 | public static final String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency"; |
| 1656 | |
| 1657 | /** |
| 1658 | * Feature for {@link #getSystemAvailableFeatures} and |
Unsuk Jung | 50909f6 | 2014-09-02 18:25:49 -0700 | [diff] [blame] | 1659 | * {@link #hasSystemFeature}: The device includes at least one form of audio |
Glenn Kasten | 0a111ad | 2018-05-16 14:11:09 -0700 | [diff] [blame] | 1660 | * output, as defined in the Android Compatibility Definition Document (CDD) |
| 1661 | * <a href="https://source.android.com/compatibility/android-cdd#7_8_audio">section 7.8 Audio</a>. |
Unsuk Jung | 50909f6 | 2014-09-02 18:25:49 -0700 | [diff] [blame] | 1662 | */ |
| 1663 | @SdkConstant(SdkConstantType.FEATURE) |
| 1664 | public static final String FEATURE_AUDIO_OUTPUT = "android.hardware.audio.output"; |
| 1665 | |
| 1666 | /** |
Glenn Kasten | cdcb577 | 2015-05-06 15:54:49 -0700 | [diff] [blame] | 1667 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Glenn Kasten | 7587edc | 2015-10-30 17:45:52 -0700 | [diff] [blame] | 1668 | * The device has professional audio level of functionality and performance. |
Glenn Kasten | cdcb577 | 2015-05-06 15:54:49 -0700 | [diff] [blame] | 1669 | */ |
| 1670 | @SdkConstant(SdkConstantType.FEATURE) |
| 1671 | public static final String FEATURE_AUDIO_PRO = "android.hardware.audio.pro"; |
| 1672 | |
| 1673 | /** |
Unsuk Jung | 50909f6 | 2014-09-02 18:25:49 -0700 | [diff] [blame] | 1674 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1675 | * {@link #hasSystemFeature}: The device is capable of communicating with |
| 1676 | * other devices via Bluetooth. |
| 1677 | */ |
| 1678 | @SdkConstant(SdkConstantType.FEATURE) |
| 1679 | public static final String FEATURE_BLUETOOTH = "android.hardware.bluetooth"; |
| 1680 | |
| 1681 | /** |
| 1682 | * Feature for {@link #getSystemAvailableFeatures} and |
Matthew Xie | a722772 | 2013-04-18 15:25:59 -0700 | [diff] [blame] | 1683 | * {@link #hasSystemFeature}: The device is capable of communicating with |
| 1684 | * other devices via Bluetooth Low Energy radio. |
| 1685 | */ |
| 1686 | @SdkConstant(SdkConstantType.FEATURE) |
| 1687 | public static final String FEATURE_BLUETOOTH_LE = "android.hardware.bluetooth_le"; |
| 1688 | |
| 1689 | /** |
| 1690 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1691 | * {@link #hasSystemFeature}: The device has a camera facing away |
| 1692 | * from the screen. |
| 1693 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 1694 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1695 | public static final String FEATURE_CAMERA = "android.hardware.camera"; |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1696 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1697 | /** |
| 1698 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1699 | * {@link #hasSystemFeature}: The device's camera supports auto-focus. |
| 1700 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 1701 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1702 | public static final String FEATURE_CAMERA_AUTOFOCUS = "android.hardware.camera.autofocus"; |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1703 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1704 | /** |
| 1705 | * Feature for {@link #getSystemAvailableFeatures} and |
Eino-Ville Talvala | 752af83 | 2012-09-18 14:45:37 -0700 | [diff] [blame] | 1706 | * {@link #hasSystemFeature}: The device has at least one camera pointing in |
Eino-Ville Talvala | 9131da2 | 2014-05-08 11:39:53 -0700 | [diff] [blame] | 1707 | * 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] | 1708 | */ |
| 1709 | @SdkConstant(SdkConstantType.FEATURE) |
| 1710 | public static final String FEATURE_CAMERA_ANY = "android.hardware.camera.any"; |
| 1711 | |
| 1712 | /** |
| 1713 | * Feature for {@link #getSystemAvailableFeatures} and |
Eino-Ville Talvala | 9131da2 | 2014-05-08 11:39:53 -0700 | [diff] [blame] | 1714 | * {@link #hasSystemFeature}: The device can support having an external camera connected to it. |
| 1715 | * The external camera may not always be connected or available to applications to use. |
| 1716 | */ |
| 1717 | @SdkConstant(SdkConstantType.FEATURE) |
| 1718 | public static final String FEATURE_CAMERA_EXTERNAL = "android.hardware.camera.external"; |
| 1719 | |
| 1720 | /** |
| 1721 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1722 | * {@link #hasSystemFeature}: The device's camera supports flash. |
| 1723 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 1724 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1725 | public static final String FEATURE_CAMERA_FLASH = "android.hardware.camera.flash"; |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1726 | |
| 1727 | /** |
| 1728 | * Feature for {@link #getSystemAvailableFeatures} and |
Chih-Chung Chang | de1057c | 2010-06-14 19:15:00 +0800 | [diff] [blame] | 1729 | * {@link #hasSystemFeature}: The device has a front facing camera. |
| 1730 | */ |
| 1731 | @SdkConstant(SdkConstantType.FEATURE) |
| 1732 | public static final String FEATURE_CAMERA_FRONT = "android.hardware.camera.front"; |
| 1733 | |
| 1734 | /** |
Eino-Ville Talvala | 611fece | 2014-07-10 17:29:38 -0700 | [diff] [blame] | 1735 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one |
| 1736 | * of the cameras on the device supports the |
| 1737 | * {@link android.hardware.camera2.CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL full hardware} |
| 1738 | * capability level. |
| 1739 | */ |
| 1740 | @SdkConstant(SdkConstantType.FEATURE) |
| 1741 | public static final String FEATURE_CAMERA_LEVEL_FULL = "android.hardware.camera.level.full"; |
| 1742 | |
| 1743 | /** |
| 1744 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one |
| 1745 | * of the cameras on the device supports the |
| 1746 | * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR manual sensor} |
| 1747 | * capability level. |
| 1748 | */ |
| 1749 | @SdkConstant(SdkConstantType.FEATURE) |
| 1750 | public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_SENSOR = |
| 1751 | "android.hardware.camera.capability.manual_sensor"; |
| 1752 | |
| 1753 | /** |
| 1754 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one |
| 1755 | * of the cameras on the device supports the |
| 1756 | * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING manual post-processing} |
| 1757 | * capability level. |
| 1758 | */ |
| 1759 | @SdkConstant(SdkConstantType.FEATURE) |
| 1760 | public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_POST_PROCESSING = |
| 1761 | "android.hardware.camera.capability.manual_post_processing"; |
| 1762 | |
| 1763 | /** |
| 1764 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one |
| 1765 | * of the cameras on the device supports the |
| 1766 | * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_RAW RAW} |
| 1767 | * capability level. |
| 1768 | */ |
| 1769 | @SdkConstant(SdkConstantType.FEATURE) |
| 1770 | public static final String FEATURE_CAMERA_CAPABILITY_RAW = |
| 1771 | "android.hardware.camera.capability.raw"; |
| 1772 | |
| 1773 | /** |
Eino-Ville Talvala | dfa0c2a | 2018-01-10 12:01:08 -0800 | [diff] [blame] | 1774 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one |
| 1775 | * of the cameras on the device supports the |
| 1776 | * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MOTION_TRACKING |
| 1777 | * MOTION_TRACKING} capability level. |
| 1778 | */ |
| 1779 | @SdkConstant(SdkConstantType.FEATURE) |
| 1780 | public static final String FEATURE_CAMERA_AR = |
| 1781 | "android.hardware.camera.ar"; |
| 1782 | |
| 1783 | /** |
Chih-Chung Chang | de1057c | 2010-06-14 19:15:00 +0800 | [diff] [blame] | 1784 | * Feature for {@link #getSystemAvailableFeatures} and |
Alex Ray | 0c9d61f | 2013-10-03 12:17:54 -0700 | [diff] [blame] | 1785 | * {@link #hasSystemFeature}: The device is capable of communicating with |
| 1786 | * consumer IR devices. |
| 1787 | */ |
| 1788 | @SdkConstant(SdkConstantType.FEATURE) |
| 1789 | public static final String FEATURE_CONSUMER_IR = "android.hardware.consumerir"; |
| 1790 | |
Sam Lin | 90e258b | 2017-04-03 20:57:45 -0700 | [diff] [blame] | 1791 | /** {@hide} */ |
| 1792 | @SdkConstant(SdkConstantType.FEATURE) |
| 1793 | public static final String FEATURE_CTS = "android.software.cts"; |
| 1794 | |
Alex Ray | 0c9d61f | 2013-10-03 12:17:54 -0700 | [diff] [blame] | 1795 | /** |
| 1796 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1797 | * {@link #hasSystemFeature}: The device supports one or more methods of |
| 1798 | * reporting current location. |
| 1799 | */ |
| 1800 | @SdkConstant(SdkConstantType.FEATURE) |
| 1801 | public static final String FEATURE_LOCATION = "android.hardware.location"; |
| 1802 | |
| 1803 | /** |
| 1804 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1805 | * {@link #hasSystemFeature}: The device has a Global Positioning System |
| 1806 | * receiver and can report precise location. |
| 1807 | */ |
| 1808 | @SdkConstant(SdkConstantType.FEATURE) |
| 1809 | public static final String FEATURE_LOCATION_GPS = "android.hardware.location.gps"; |
| 1810 | |
| 1811 | /** |
| 1812 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1813 | * {@link #hasSystemFeature}: The device can report location with coarse |
| 1814 | * accuracy using a network-based geolocation system. |
| 1815 | */ |
| 1816 | @SdkConstant(SdkConstantType.FEATURE) |
| 1817 | public static final String FEATURE_LOCATION_NETWORK = "android.hardware.location.network"; |
| 1818 | |
| 1819 | /** |
| 1820 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | 2a103f1 | 2017-08-08 15:50:31 -0700 | [diff] [blame] | 1821 | * {@link #hasSystemFeature}: The device's |
| 1822 | * {@link ActivityManager#isLowRamDevice() ActivityManager.isLowRamDevice()} method returns |
| 1823 | * true. |
| 1824 | */ |
| 1825 | @SdkConstant(SdkConstantType.FEATURE) |
| 1826 | public static final String FEATURE_RAM_LOW = "android.hardware.ram.low"; |
| 1827 | |
| 1828 | /** |
| 1829 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1830 | * {@link #hasSystemFeature}: The device's |
| 1831 | * {@link ActivityManager#isLowRamDevice() ActivityManager.isLowRamDevice()} method returns |
| 1832 | * false. |
| 1833 | */ |
| 1834 | @SdkConstant(SdkConstantType.FEATURE) |
| 1835 | public static final String FEATURE_RAM_NORMAL = "android.hardware.ram.normal"; |
| 1836 | |
| 1837 | /** |
| 1838 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1839 | * {@link #hasSystemFeature}: The device can record audio via a |
| 1840 | * microphone. |
| 1841 | */ |
| 1842 | @SdkConstant(SdkConstantType.FEATURE) |
| 1843 | public static final String FEATURE_MICROPHONE = "android.hardware.microphone"; |
| 1844 | |
| 1845 | /** |
| 1846 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 76437d3 | 2010-09-01 11:17:20 -0700 | [diff] [blame] | 1847 | * {@link #hasSystemFeature}: The device can communicate using Near-Field |
| 1848 | * Communications (NFC). |
| 1849 | */ |
| 1850 | @SdkConstant(SdkConstantType.FEATURE) |
| 1851 | public static final String FEATURE_NFC = "android.hardware.nfc"; |
| 1852 | |
| 1853 | /** |
| 1854 | * Feature for {@link #getSystemAvailableFeatures} and |
Martijn Coenen | f4bf158 | 2013-07-22 12:01:19 -0700 | [diff] [blame] | 1855 | * {@link #hasSystemFeature}: The device supports host- |
| 1856 | * based NFC card emulation. |
Martijn Coenen | df4d1d6 | 2013-08-28 11:18:58 -0700 | [diff] [blame] | 1857 | * |
| 1858 | * TODO remove when depending apps have moved to new constant. |
| 1859 | * @hide |
| 1860 | * @deprecated |
Martijn Coenen | f4bf158 | 2013-07-22 12:01:19 -0700 | [diff] [blame] | 1861 | */ |
Jose Lima | 970417c | 2014-04-10 10:42:19 -0700 | [diff] [blame] | 1862 | @Deprecated |
Martijn Coenen | f4bf158 | 2013-07-22 12:01:19 -0700 | [diff] [blame] | 1863 | @SdkConstant(SdkConstantType.FEATURE) |
| 1864 | public static final String FEATURE_NFC_HCE = "android.hardware.nfc.hce"; |
| 1865 | |
| 1866 | /** |
| 1867 | * Feature for {@link #getSystemAvailableFeatures} and |
Martijn Coenen | df4d1d6 | 2013-08-28 11:18:58 -0700 | [diff] [blame] | 1868 | * {@link #hasSystemFeature}: The device supports host- |
| 1869 | * based NFC card emulation. |
| 1870 | */ |
| 1871 | @SdkConstant(SdkConstantType.FEATURE) |
| 1872 | public static final String FEATURE_NFC_HOST_CARD_EMULATION = "android.hardware.nfc.hce"; |
| 1873 | |
| 1874 | /** |
| 1875 | * Feature for {@link #getSystemAvailableFeatures} and |
Yoshinobu Ito | c52adfe | 2016-01-22 18:14:18 +0900 | [diff] [blame] | 1876 | * {@link #hasSystemFeature}: The device supports host- |
| 1877 | * based NFC-F card emulation. |
| 1878 | */ |
| 1879 | @SdkConstant(SdkConstantType.FEATURE) |
| 1880 | public static final String FEATURE_NFC_HOST_CARD_EMULATION_NFCF = "android.hardware.nfc.hcef"; |
| 1881 | |
| 1882 | /** |
| 1883 | * Feature for {@link #getSystemAvailableFeatures} and |
Martijn Coenen | 441d61b | 2017-04-12 13:52:40 -0700 | [diff] [blame] | 1884 | * {@link #hasSystemFeature}: The device supports any |
| 1885 | * one of the {@link #FEATURE_NFC}, {@link #FEATURE_NFC_HOST_CARD_EMULATION}, |
| 1886 | * or {@link #FEATURE_NFC_HOST_CARD_EMULATION_NFCF} features. |
| 1887 | * |
| 1888 | * @hide |
| 1889 | */ |
| 1890 | @SdkConstant(SdkConstantType.FEATURE) |
| 1891 | public static final String FEATURE_NFC_ANY = "android.hardware.nfc.any"; |
| 1892 | |
| 1893 | /** |
| 1894 | * Feature for {@link #getSystemAvailableFeatures} and |
Jesse Hall | 7f51706 | 2014-07-18 11:54:41 -0700 | [diff] [blame] | 1895 | * {@link #hasSystemFeature}: The device supports the OpenGL ES |
| 1896 | * <a href="http://www.khronos.org/registry/gles/extensions/ANDROID/ANDROID_extension_pack_es31a.txt"> |
| 1897 | * Android Extension Pack</a>. |
| 1898 | */ |
| 1899 | @SdkConstant(SdkConstantType.FEATURE) |
| 1900 | public static final String FEATURE_OPENGLES_EXTENSION_PACK = "android.hardware.opengles.aep"; |
| 1901 | |
| 1902 | /** |
| 1903 | * Feature for {@link #getSystemAvailableFeatures} and |
Jesse Hall | 39ceeb5 | 2016-03-10 09:04:26 -0800 | [diff] [blame] | 1904 | * {@link #hasSystemFeature(String, int)}: If this feature is supported, the Vulkan native API |
| 1905 | * will enumerate at least one {@code VkPhysicalDevice}, and the feature version will indicate |
| 1906 | * what level of optional hardware features limits it supports. |
Jesse Hall | f77a34f | 2016-02-04 18:41:33 -0800 | [diff] [blame] | 1907 | * <p> |
| 1908 | * Level 0 includes the base Vulkan requirements as well as: |
| 1909 | * <ul><li>{@code VkPhysicalDeviceFeatures::textureCompressionETC2}</li></ul> |
| 1910 | * <p> |
| 1911 | * Level 1 additionally includes: |
| 1912 | * <ul> |
| 1913 | * <li>{@code VkPhysicalDeviceFeatures::fullDrawIndexUint32}</li> |
| 1914 | * <li>{@code VkPhysicalDeviceFeatures::imageCubeArray}</li> |
| 1915 | * <li>{@code VkPhysicalDeviceFeatures::independentBlend}</li> |
| 1916 | * <li>{@code VkPhysicalDeviceFeatures::geometryShader}</li> |
| 1917 | * <li>{@code VkPhysicalDeviceFeatures::tessellationShader}</li> |
| 1918 | * <li>{@code VkPhysicalDeviceFeatures::sampleRateShading}</li> |
| 1919 | * <li>{@code VkPhysicalDeviceFeatures::textureCompressionASTC_LDR}</li> |
| 1920 | * <li>{@code VkPhysicalDeviceFeatures::fragmentStoresAndAtomics}</li> |
| 1921 | * <li>{@code VkPhysicalDeviceFeatures::shaderImageGatherExtended}</li> |
| 1922 | * <li>{@code VkPhysicalDeviceFeatures::shaderUniformBufferArrayDynamicIndexing}</li> |
| 1923 | * <li>{@code VkPhysicalDeviceFeatures::shaderSampledImageArrayDynamicIndexing}</li> |
| 1924 | * </ul> |
| 1925 | */ |
| 1926 | @SdkConstant(SdkConstantType.FEATURE) |
| 1927 | public static final String FEATURE_VULKAN_HARDWARE_LEVEL = "android.hardware.vulkan.level"; |
| 1928 | |
| 1929 | /** |
| 1930 | * Feature for {@link #getSystemAvailableFeatures} and |
Jesse Hall | 1cd7e93 | 2017-02-05 19:58:15 -0800 | [diff] [blame] | 1931 | * {@link #hasSystemFeature(String, int)}: If this feature is supported, the Vulkan native API |
| 1932 | * 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] | 1933 | * what level of optional compute features that device supports beyond the Vulkan 1.0 |
| 1934 | * requirements. |
Jesse Hall | 1cd7e93 | 2017-02-05 19:58:15 -0800 | [diff] [blame] | 1935 | * <p> |
Jesse Hall | 54fc609 | 2017-08-22 07:19:56 -0700 | [diff] [blame] | 1936 | * Compute level 0 indicates: |
| 1937 | * <ul> |
| 1938 | * <li>The {@code VK_KHR_variable_pointers} extension and |
| 1939 | * {@code VkPhysicalDeviceVariablePointerFeaturesKHR::variablePointers} feature are |
| 1940 | supported.</li> |
| 1941 | * <li>{@code VkPhysicalDeviceLimits::maxPerStageDescriptorStorageBuffers} is at least 16.</li> |
| 1942 | * </ul> |
Jesse Hall | 1cd7e93 | 2017-02-05 19:58:15 -0800 | [diff] [blame] | 1943 | */ |
| 1944 | @SdkConstant(SdkConstantType.FEATURE) |
| 1945 | public static final String FEATURE_VULKAN_HARDWARE_COMPUTE = "android.hardware.vulkan.compute"; |
| 1946 | |
| 1947 | /** |
| 1948 | * Feature for {@link #getSystemAvailableFeatures} and |
Jesse Hall | 39ceeb5 | 2016-03-10 09:04:26 -0800 | [diff] [blame] | 1949 | * {@link #hasSystemFeature(String, int)}: The version of this feature indicates the highest |
Jesse Hall | f77a34f | 2016-02-04 18:41:33 -0800 | [diff] [blame] | 1950 | * {@code VkPhysicalDeviceProperties::apiVersion} supported by the physical devices that support |
| 1951 | * the hardware level indicated by {@link #FEATURE_VULKAN_HARDWARE_LEVEL}. The feature version |
| 1952 | * uses the same encoding as Vulkan version numbers: |
| 1953 | * <ul> |
| 1954 | * <li>Major version number in bits 31-22</li> |
| 1955 | * <li>Minor version number in bits 21-12</li> |
| 1956 | * <li>Patch version number in bits 11-0</li> |
| 1957 | * </ul> |
Jesse Hall | 239373f | 2018-01-26 11:35:10 +0800 | [diff] [blame] | 1958 | * A version of 1.1.0 or higher also indicates: |
| 1959 | * <ul> |
Jesse Hall | 239373f | 2018-01-26 11:35:10 +0800 | [diff] [blame] | 1960 | * <li>{@code SYNC_FD} external semaphore and fence handles are supported.</li> |
| 1961 | * <li>{@code VkPhysicalDeviceSamplerYcbcrConversionFeatures::samplerYcbcrConversion} is |
| 1962 | * supported.</li> |
| 1963 | * </ul> |
Jesse Hall | f77a34f | 2016-02-04 18:41:33 -0800 | [diff] [blame] | 1964 | */ |
| 1965 | @SdkConstant(SdkConstantType.FEATURE) |
| 1966 | public static final String FEATURE_VULKAN_HARDWARE_VERSION = "android.hardware.vulkan.version"; |
| 1967 | |
| 1968 | /** |
Tomasz Wasilczyk | 05392d6 | 2017-07-10 19:33:22 -0700 | [diff] [blame] | 1969 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1970 | * {@link #hasSystemFeature}: The device includes broadcast radio tuner. |
| 1971 | * @hide |
Tomasz Wasilczyk | 347192e | 2017-04-04 11:13:44 -0700 | [diff] [blame] | 1972 | */ |
Tomasz Wasilczyk | 05392d6 | 2017-07-10 19:33:22 -0700 | [diff] [blame] | 1973 | @SystemApi |
Tomasz Wasilczyk | 347192e | 2017-04-04 11:13:44 -0700 | [diff] [blame] | 1974 | @SdkConstant(SdkConstantType.FEATURE) |
Tomasz Wasilczyk | 05392d6 | 2017-07-10 19:33:22 -0700 | [diff] [blame] | 1975 | public static final String FEATURE_BROADCAST_RADIO = "android.hardware.broadcastradio"; |
Tomasz Wasilczyk | 347192e | 2017-04-04 11:13:44 -0700 | [diff] [blame] | 1976 | |
| 1977 | /** |
Jesse Hall | f77a34f | 2016-02-04 18:41:33 -0800 | [diff] [blame] | 1978 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 5744bb4 | 2010-09-01 19:18:57 -0700 | [diff] [blame] | 1979 | * {@link #hasSystemFeature}: The device includes an accelerometer. |
| 1980 | */ |
| 1981 | @SdkConstant(SdkConstantType.FEATURE) |
| 1982 | public static final String FEATURE_SENSOR_ACCELEROMETER = "android.hardware.sensor.accelerometer"; |
| 1983 | |
| 1984 | /** |
| 1985 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1986 | * {@link #hasSystemFeature}: The device includes a barometer (air |
| 1987 | * pressure sensor.) |
| 1988 | */ |
| 1989 | @SdkConstant(SdkConstantType.FEATURE) |
| 1990 | public static final String FEATURE_SENSOR_BAROMETER = "android.hardware.sensor.barometer"; |
| 1991 | |
| 1992 | /** |
| 1993 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1994 | * {@link #hasSystemFeature}: The device includes a magnetometer (compass). |
| 1995 | */ |
| 1996 | @SdkConstant(SdkConstantType.FEATURE) |
| 1997 | public static final String FEATURE_SENSOR_COMPASS = "android.hardware.sensor.compass"; |
| 1998 | |
| 1999 | /** |
| 2000 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 5744bb4 | 2010-09-01 19:18:57 -0700 | [diff] [blame] | 2001 | * {@link #hasSystemFeature}: The device includes a gyroscope. |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 2002 | */ |
| 2003 | @SdkConstant(SdkConstantType.FEATURE) |
Dan Morrill | 5744bb4 | 2010-09-01 19:18:57 -0700 | [diff] [blame] | 2004 | public static final String FEATURE_SENSOR_GYROSCOPE = "android.hardware.sensor.gyroscope"; |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 2005 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2006 | /** |
| 2007 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2008 | * {@link #hasSystemFeature}: The device includes a light sensor. |
| 2009 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 2010 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2011 | public static final String FEATURE_SENSOR_LIGHT = "android.hardware.sensor.light"; |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 2012 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2013 | /** |
| 2014 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2015 | * {@link #hasSystemFeature}: The device includes a proximity sensor. |
| 2016 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 2017 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2018 | public static final String FEATURE_SENSOR_PROXIMITY = "android.hardware.sensor.proximity"; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2019 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2020 | /** |
| 2021 | * Feature for {@link #getSystemAvailableFeatures} and |
Aravind Akella | 068b0c0 | 2013-10-12 17:39:15 -0700 | [diff] [blame] | 2022 | * {@link #hasSystemFeature}: The device includes a hardware step counter. |
| 2023 | */ |
| 2024 | @SdkConstant(SdkConstantType.FEATURE) |
| 2025 | public static final String FEATURE_SENSOR_STEP_COUNTER = "android.hardware.sensor.stepcounter"; |
| 2026 | |
| 2027 | /** |
| 2028 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2029 | * {@link #hasSystemFeature}: The device includes a hardware step detector. |
| 2030 | */ |
| 2031 | @SdkConstant(SdkConstantType.FEATURE) |
| 2032 | public static final String FEATURE_SENSOR_STEP_DETECTOR = "android.hardware.sensor.stepdetector"; |
| 2033 | |
| 2034 | /** |
| 2035 | * Feature for {@link #getSystemAvailableFeatures} and |
Vinod Krishnan | 8afb23c | 2014-04-30 11:11:39 -0700 | [diff] [blame] | 2036 | * {@link #hasSystemFeature}: The device includes a heart rate monitor. |
| 2037 | */ |
| 2038 | @SdkConstant(SdkConstantType.FEATURE) |
| 2039 | public static final String FEATURE_SENSOR_HEART_RATE = "android.hardware.sensor.heartrate"; |
| 2040 | |
| 2041 | /** |
| 2042 | * Feature for {@link #getSystemAvailableFeatures} and |
Trevor Johns | 682c24e | 2016-04-12 10:13:47 -0700 | [diff] [blame] | 2043 | * {@link #hasSystemFeature}: The heart rate sensor on this device is an Electrocardiogram. |
Vinod Krishnan | 1ab7689 | 2014-08-20 11:11:55 -0700 | [diff] [blame] | 2044 | */ |
| 2045 | @SdkConstant(SdkConstantType.FEATURE) |
| 2046 | public static final String FEATURE_SENSOR_HEART_RATE_ECG = |
| 2047 | "android.hardware.sensor.heartrate.ecg"; |
| 2048 | |
| 2049 | /** |
| 2050 | * Feature for {@link #getSystemAvailableFeatures} and |
Aravind Akella | 8b8e74b | 2014-07-09 11:52:39 -0700 | [diff] [blame] | 2051 | * {@link #hasSystemFeature}: The device includes a relative humidity sensor. |
| 2052 | */ |
| 2053 | @SdkConstant(SdkConstantType.FEATURE) |
| 2054 | public static final String FEATURE_SENSOR_RELATIVE_HUMIDITY = |
| 2055 | "android.hardware.sensor.relative_humidity"; |
| 2056 | |
| 2057 | /** |
| 2058 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2059 | * {@link #hasSystemFeature}: The device includes an ambient temperature sensor. |
| 2060 | */ |
| 2061 | @SdkConstant(SdkConstantType.FEATURE) |
| 2062 | public static final String FEATURE_SENSOR_AMBIENT_TEMPERATURE = |
| 2063 | "android.hardware.sensor.ambient_temperature"; |
| 2064 | |
| 2065 | /** |
| 2066 | * Feature for {@link #getSystemAvailableFeatures} and |
Ashutosh Joshi | eae371b | 2015-04-09 10:30:07 -0700 | [diff] [blame] | 2067 | * {@link #hasSystemFeature}: The device supports high fidelity sensor processing |
| 2068 | * capabilities. |
| 2069 | */ |
| 2070 | @SdkConstant(SdkConstantType.FEATURE) |
| 2071 | public static final String FEATURE_HIFI_SENSORS = |
| 2072 | "android.hardware.sensor.hifi_sensors"; |
| 2073 | |
| 2074 | /** |
Philip Quinn | b6bd301 | 2018-02-09 17:56:40 -0800 | [diff] [blame] | 2075 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
| 2076 | * The device supports a hardware mechanism for invoking an assist gesture. |
| 2077 | * @see android.provider.Settings.Secure#ASSIST_GESTURE_ENABLED |
| 2078 | * @hide |
| 2079 | */ |
| 2080 | @SdkConstant(SdkConstantType.FEATURE) |
| 2081 | public static final String FEATURE_ASSIST_GESTURE = "android.hardware.sensor.assist"; |
| 2082 | |
| 2083 | /** |
Ashutosh Joshi | eae371b | 2015-04-09 10:30:07 -0700 | [diff] [blame] | 2084 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2085 | * {@link #hasSystemFeature}: The device has a telephony radio with data |
| 2086 | * communication support. |
| 2087 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 2088 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2089 | public static final String FEATURE_TELEPHONY = "android.hardware.telephony"; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2090 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2091 | /** |
| 2092 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2093 | * {@link #hasSystemFeature}: The device has a CDMA telephony stack. |
| 2094 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 2095 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2096 | public static final String FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma"; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2097 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2098 | /** |
| 2099 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2100 | * {@link #hasSystemFeature}: The device has a GSM telephony stack. |
| 2101 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 2102 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2103 | public static final String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm"; |
Hung-ying Tyan | 3424c02 | 2010-08-27 18:08:19 +0800 | [diff] [blame] | 2104 | |
| 2105 | /** |
Polina Bondarenko | 80909ce | 2017-01-12 21:10:38 +0100 | [diff] [blame] | 2106 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
| 2107 | * The device supports telephony carrier restriction mechanism. |
| 2108 | * |
| 2109 | * <p>Devices declaring this feature must have an implementation of the |
| 2110 | * {@link android.telephony.TelephonyManager#getAllowedCarriers} and |
| 2111 | * {@link android.telephony.TelephonyManager#setAllowedCarriers}. |
| 2112 | * @hide |
| 2113 | */ |
| 2114 | @SystemApi |
| 2115 | @SdkConstant(SdkConstantType.FEATURE) |
| 2116 | public static final String FEATURE_TELEPHONY_CARRIERLOCK = |
| 2117 | "android.hardware.telephony.carrierlock"; |
| 2118 | |
| 2119 | /** |
Jeff Davidson | 35cda39 | 2017-02-27 09:46:00 -0800 | [diff] [blame] | 2120 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device |
| 2121 | * supports embedded subscriptions on eUICCs. |
Jeff Davidson | 35cda39 | 2017-02-27 09:46:00 -0800 | [diff] [blame] | 2122 | */ |
| 2123 | @SdkConstant(SdkConstantType.FEATURE) |
| 2124 | public static final String FEATURE_TELEPHONY_EUICC = "android.hardware.telephony.euicc"; |
| 2125 | |
| 2126 | /** |
Hall Liu | c6703d9 | 2017-11-17 11:31:57 -0800 | [diff] [blame] | 2127 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device |
| 2128 | * supports cell-broadcast reception using the MBMS APIs. |
| 2129 | */ |
| 2130 | @SdkConstant(SdkConstantType.FEATURE) |
| 2131 | public static final String FEATURE_TELEPHONY_MBMS = "android.hardware.telephony.mbms"; |
| 2132 | |
| 2133 | /** |
Hung-ying Tyan | 3424c02 | 2010-08-27 18:08:19 +0800 | [diff] [blame] | 2134 | * Feature for {@link #getSystemAvailableFeatures} and |
Mike Lockwood | f4ca247 | 2011-02-27 11:23:25 -0800 | [diff] [blame] | 2135 | * {@link #hasSystemFeature}: The device supports connecting to USB devices |
| 2136 | * as the USB host. |
| 2137 | */ |
| 2138 | @SdkConstant(SdkConstantType.FEATURE) |
| 2139 | public static final String FEATURE_USB_HOST = "android.hardware.usb.host"; |
| 2140 | |
| 2141 | /** |
| 2142 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2143 | * {@link #hasSystemFeature}: The device supports connecting to USB accessories. |
| 2144 | */ |
| 2145 | @SdkConstant(SdkConstantType.FEATURE) |
| 2146 | public static final String FEATURE_USB_ACCESSORY = "android.hardware.usb.accessory"; |
| 2147 | |
| 2148 | /** |
| 2149 | * Feature for {@link #getSystemAvailableFeatures} and |
Hung-ying Tyan | 3424c02 | 2010-08-27 18:08:19 +0800 | [diff] [blame] | 2150 | * {@link #hasSystemFeature}: The SIP API is enabled on the device. |
| 2151 | */ |
| 2152 | @SdkConstant(SdkConstantType.FEATURE) |
| 2153 | public static final String FEATURE_SIP = "android.software.sip"; |
| 2154 | |
| 2155 | /** |
| 2156 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2157 | * {@link #hasSystemFeature}: The device supports SIP-based VOIP. |
| 2158 | */ |
| 2159 | @SdkConstant(SdkConstantType.FEATURE) |
| 2160 | public static final String FEATURE_SIP_VOIP = "android.software.sip.voip"; |
| 2161 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2162 | /** |
| 2163 | * Feature for {@link #getSystemAvailableFeatures} and |
Ihab Awad | 1ec6888 | 2014-09-12 11:09:01 -0700 | [diff] [blame] | 2164 | * {@link #hasSystemFeature}: The Connection Service API is enabled on the device. |
| 2165 | */ |
| 2166 | @SdkConstant(SdkConstantType.FEATURE) |
| 2167 | public static final String FEATURE_CONNECTION_SERVICE = "android.software.connectionservice"; |
| 2168 | |
| 2169 | /** |
| 2170 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | b0fe033 | 2010-04-05 14:43:58 -0700 | [diff] [blame] | 2171 | * {@link #hasSystemFeature}: The device's display has a touch screen. |
| 2172 | */ |
| 2173 | @SdkConstant(SdkConstantType.FEATURE) |
| 2174 | public static final String FEATURE_TOUCHSCREEN = "android.hardware.touchscreen"; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2175 | |
Dan Morrill | b0fe033 | 2010-04-05 14:43:58 -0700 | [diff] [blame] | 2176 | /** |
| 2177 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 2178 | * {@link #hasSystemFeature}: The device's touch screen supports |
| 2179 | * multitouch sufficient for basic two-finger gesture detection. |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2180 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 2181 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2182 | public static final String FEATURE_TOUCHSCREEN_MULTITOUCH = "android.hardware.touchscreen.multitouch"; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2183 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2184 | /** |
| 2185 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 2186 | * {@link #hasSystemFeature}: The device's touch screen is capable of |
| 2187 | * tracking two or more fingers fully independently. |
| 2188 | */ |
| 2189 | @SdkConstant(SdkConstantType.FEATURE) |
| 2190 | public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT = "android.hardware.touchscreen.multitouch.distinct"; |
| 2191 | |
| 2192 | /** |
| 2193 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 6993d3d | 2010-09-03 14:30:14 -0700 | [diff] [blame] | 2194 | * {@link #hasSystemFeature}: The device's touch screen is capable of |
| 2195 | * tracking a full hand of fingers fully independently -- that is, 5 or |
| 2196 | * more simultaneous independent pointers. |
| 2197 | */ |
| 2198 | @SdkConstant(SdkConstantType.FEATURE) |
| 2199 | public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND = "android.hardware.touchscreen.multitouch.jazzhand"; |
| 2200 | |
| 2201 | /** |
| 2202 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | a537687 | 2011-01-23 13:15:53 -0800 | [diff] [blame] | 2203 | * {@link #hasSystemFeature}: The device does not have a touch screen, but |
| 2204 | * does support touch emulation for basic events. For instance, the |
| 2205 | * device might use a mouse or remote control to drive a cursor, and |
| 2206 | * emulate basic touch pointer events like down, up, drag, etc. All |
| 2207 | * devices that support android.hardware.touchscreen or a sub-feature are |
| 2208 | * presumed to also support faketouch. |
| 2209 | */ |
| 2210 | @SdkConstant(SdkConstantType.FEATURE) |
| 2211 | public static final String FEATURE_FAKETOUCH = "android.hardware.faketouch"; |
| 2212 | |
| 2213 | /** |
| 2214 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | e22fe93 | 2011-06-08 20:24:29 -0700 | [diff] [blame] | 2215 | * {@link #hasSystemFeature}: The device does not have a touch screen, but |
| 2216 | * does support touch emulation for basic events that supports distinct |
| 2217 | * tracking of two or more fingers. This is an extension of |
| 2218 | * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note |
| 2219 | * that unlike a distinct multitouch screen as defined by |
| 2220 | * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT}, these kinds of input |
| 2221 | * devices will not actually provide full two-finger gestures since the |
| 2222 | * input is being transformed to cursor movement on the screen. That is, |
| 2223 | * single finger gestures will move a cursor; two-finger swipes will |
| 2224 | * result in single-finger touch events; other two-finger gestures will |
| 2225 | * result in the corresponding two-finger touch event. |
| 2226 | */ |
| 2227 | @SdkConstant(SdkConstantType.FEATURE) |
| 2228 | public static final String FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT = "android.hardware.faketouch.multitouch.distinct"; |
| 2229 | |
| 2230 | /** |
| 2231 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2232 | * {@link #hasSystemFeature}: The device does not have a touch screen, but |
| 2233 | * does support touch emulation for basic events that supports tracking |
| 2234 | * a hand of fingers (5 or more fingers) fully independently. |
| 2235 | * This is an extension of |
| 2236 | * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note |
| 2237 | * that unlike a multitouch screen as defined by |
| 2238 | * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND}, not all two finger |
| 2239 | * gestures can be detected due to the limitations described for |
| 2240 | * {@link #FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT}. |
| 2241 | */ |
| 2242 | @SdkConstant(SdkConstantType.FEATURE) |
| 2243 | public static final String FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND = "android.hardware.faketouch.multitouch.jazzhand"; |
| 2244 | |
| 2245 | /** |
| 2246 | * Feature for {@link #getSystemAvailableFeatures} and |
Jim Miller | d9b9d41 | 2015-07-22 19:51:40 -0700 | [diff] [blame] | 2247 | * {@link #hasSystemFeature}: The device has biometric hardware to detect a fingerprint. |
| 2248 | */ |
| 2249 | @SdkConstant(SdkConstantType.FEATURE) |
| 2250 | public static final String FEATURE_FINGERPRINT = "android.hardware.fingerprint"; |
| 2251 | |
| 2252 | /** |
| 2253 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | e289bff | 2011-06-13 19:33:22 -0700 | [diff] [blame] | 2254 | * {@link #hasSystemFeature}: The device supports portrait orientation |
| 2255 | * screens. For backwards compatibility, you can assume that if neither |
| 2256 | * this nor {@link #FEATURE_SCREEN_LANDSCAPE} is set then the device supports |
| 2257 | * both portrait and landscape. |
| 2258 | */ |
| 2259 | @SdkConstant(SdkConstantType.FEATURE) |
| 2260 | public static final String FEATURE_SCREEN_PORTRAIT = "android.hardware.screen.portrait"; |
| 2261 | |
| 2262 | /** |
| 2263 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2264 | * {@link #hasSystemFeature}: The device supports landscape orientation |
| 2265 | * screens. For backwards compatibility, you can assume that if neither |
| 2266 | * this nor {@link #FEATURE_SCREEN_PORTRAIT} is set then the device supports |
| 2267 | * both portrait and landscape. |
| 2268 | */ |
| 2269 | @SdkConstant(SdkConstantType.FEATURE) |
| 2270 | public static final String FEATURE_SCREEN_LANDSCAPE = "android.hardware.screen.landscape"; |
| 2271 | |
| 2272 | /** |
| 2273 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2274 | * {@link #hasSystemFeature}: The device supports live wallpapers. |
| 2275 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 2276 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2277 | public static final String FEATURE_LIVE_WALLPAPER = "android.software.live_wallpaper"; |
Oscar Montemayor | 1228d0a | 2010-01-28 12:01:44 -0800 | [diff] [blame] | 2278 | /** |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 2279 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | 119bbc3 | 2013-03-22 17:27:25 -0700 | [diff] [blame] | 2280 | * {@link #hasSystemFeature}: The device supports app widgets. |
| 2281 | */ |
| 2282 | @SdkConstant(SdkConstantType.FEATURE) |
| 2283 | public static final String FEATURE_APP_WIDGETS = "android.software.app_widgets"; |
Dianne Hackborn | c8e4fad | 2018-05-04 11:31:09 -0700 | [diff] [blame] | 2284 | /** |
| 2285 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2286 | * {@link #hasSystemFeature}: The device supports the |
| 2287 | * {@link android.R.attr#cantSaveState} API. |
| 2288 | */ |
| 2289 | @SdkConstant(SdkConstantType.FEATURE) |
| 2290 | public static final String FEATURE_CANT_SAVE_STATE = "android.software.cant_save_state"; |
Dianne Hackborn | 119bbc3 | 2013-03-22 17:27:25 -0700 | [diff] [blame] | 2291 | |
| 2292 | /** |
Dianne Hackborn | 91097de | 2014-04-04 18:02:06 -0700 | [diff] [blame] | 2293 | * @hide |
| 2294 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2295 | * {@link #hasSystemFeature}: The device supports |
| 2296 | * {@link android.service.voice.VoiceInteractionService} and |
| 2297 | * {@link android.app.VoiceInteractor}. |
| 2298 | */ |
| 2299 | @SdkConstant(SdkConstantType.FEATURE) |
| 2300 | public static final String FEATURE_VOICE_RECOGNIZERS = "android.software.voice_recognizers"; |
| 2301 | |
| 2302 | |
| 2303 | /** |
Dianne Hackborn | 119bbc3 | 2013-03-22 17:27:25 -0700 | [diff] [blame] | 2304 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2305 | * {@link #hasSystemFeature}: The device supports a home screen that is replaceable |
| 2306 | * by third party applications. |
| 2307 | */ |
| 2308 | @SdkConstant(SdkConstantType.FEATURE) |
| 2309 | public static final String FEATURE_HOME_SCREEN = "android.software.home_screen"; |
| 2310 | |
| 2311 | /** |
| 2312 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2313 | * {@link #hasSystemFeature}: The device supports adding new input methods implemented |
| 2314 | * with the {@link android.inputmethodservice.InputMethodService} API. |
| 2315 | */ |
| 2316 | @SdkConstant(SdkConstantType.FEATURE) |
| 2317 | public static final String FEATURE_INPUT_METHODS = "android.software.input_methods"; |
| 2318 | |
| 2319 | /** |
| 2320 | * Feature for {@link #getSystemAvailableFeatures} and |
Amith Yamasani | 44a01b7 | 2013-09-16 10:44:57 -0700 | [diff] [blame] | 2321 | * {@link #hasSystemFeature}: The device supports device policy enforcement via device admins. |
| 2322 | */ |
| 2323 | @SdkConstant(SdkConstantType.FEATURE) |
| 2324 | public static final String FEATURE_DEVICE_ADMIN = "android.software.device_admin"; |
| 2325 | |
| 2326 | /** |
| 2327 | * Feature for {@link #getSystemAvailableFeatures} and |
Tim Kilbourn | f94b6a9 | 2014-03-07 15:13:48 -0800 | [diff] [blame] | 2328 | * {@link #hasSystemFeature}: The device supports leanback UI. This is |
| 2329 | * typically used in a living room television experience, but is a software |
| 2330 | * feature unlike {@link #FEATURE_TELEVISION}. Devices running with this |
| 2331 | * feature will use resources associated with the "television" UI mode. |
| 2332 | */ |
| 2333 | @SdkConstant(SdkConstantType.FEATURE) |
| 2334 | public static final String FEATURE_LEANBACK = "android.software.leanback"; |
| 2335 | |
| 2336 | /** |
| 2337 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2338 | * {@link #hasSystemFeature}: The device supports only leanback UI. Only |
| 2339 | * applications designed for this experience should be run, though this is |
| 2340 | * not enforced by the system. |
Tim Kilbourn | f94b6a9 | 2014-03-07 15:13:48 -0800 | [diff] [blame] | 2341 | */ |
| 2342 | @SdkConstant(SdkConstantType.FEATURE) |
| 2343 | public static final String FEATURE_LEANBACK_ONLY = "android.software.leanback_only"; |
| 2344 | |
| 2345 | /** |
| 2346 | * Feature for {@link #getSystemAvailableFeatures} and |
Jae Seo | cfd861e | 2014-08-27 14:02:15 -0700 | [diff] [blame] | 2347 | * {@link #hasSystemFeature}: The device supports live TV and can display |
| 2348 | * contents from TV inputs implemented with the |
| 2349 | * {@link android.media.tv.TvInputService} API. |
| 2350 | */ |
| 2351 | @SdkConstant(SdkConstantType.FEATURE) |
| 2352 | public static final String FEATURE_LIVE_TV = "android.software.live_tv"; |
| 2353 | |
| 2354 | /** |
| 2355 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 2356 | * {@link #hasSystemFeature}: The device supports WiFi (802.11) networking. |
| 2357 | */ |
| 2358 | @SdkConstant(SdkConstantType.FEATURE) |
| 2359 | public static final String FEATURE_WIFI = "android.hardware.wifi"; |
| 2360 | |
| 2361 | /** |
Irfan Sheriff | 45b8b46 | 2011-09-07 11:24:16 -0700 | [diff] [blame] | 2362 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2363 | * {@link #hasSystemFeature}: The device supports Wi-Fi Direct networking. |
| 2364 | */ |
| 2365 | @SdkConstant(SdkConstantType.FEATURE) |
| 2366 | public static final String FEATURE_WIFI_DIRECT = "android.hardware.wifi.direct"; |
| 2367 | |
| 2368 | /** |
Dianne Hackborn | 0cf2c8a | 2012-05-17 17:29:49 -0700 | [diff] [blame] | 2369 | * Feature for {@link #getSystemAvailableFeatures} and |
Etan Cohen | 0413327 | 2016-10-26 11:22:06 -0700 | [diff] [blame] | 2370 | * {@link #hasSystemFeature}: The device supports Wi-Fi Aware. |
Etan Cohen | 20d329b | 2015-09-29 13:49:02 -0700 | [diff] [blame] | 2371 | */ |
| 2372 | @SdkConstant(SdkConstantType.FEATURE) |
Etan Cohen | 0413327 | 2016-10-26 11:22:06 -0700 | [diff] [blame] | 2373 | public static final String FEATURE_WIFI_AWARE = "android.hardware.wifi.aware"; |
Etan Cohen | 20d329b | 2015-09-29 13:49:02 -0700 | [diff] [blame] | 2374 | |
| 2375 | /** |
| 2376 | * Feature for {@link #getSystemAvailableFeatures} and |
Peter Qiu | 3d615e4 | 2017-08-07 20:13:32 +0000 | [diff] [blame] | 2377 | * {@link #hasSystemFeature}: The device supports Wi-Fi Passpoint and all |
| 2378 | * Passpoint related APIs in {@link WifiManager} are supported. Refer to |
| 2379 | * {@link WifiManager#addOrUpdatePasspointConfiguration} for more info. |
Peter Qiu | b99fe31 | 2017-05-05 13:48:47 -0700 | [diff] [blame] | 2380 | */ |
| 2381 | @SdkConstant(SdkConstantType.FEATURE) |
| 2382 | public static final String FEATURE_WIFI_PASSPOINT = "android.hardware.wifi.passpoint"; |
| 2383 | |
| 2384 | /** |
| 2385 | * Feature for {@link #getSystemAvailableFeatures} and |
Etan Cohen | 692e68e | 2017-09-14 15:42:01 -0700 | [diff] [blame] | 2386 | * {@link #hasSystemFeature}: The device supports Wi-Fi RTT (IEEE 802.11mc). |
Etan Cohen | 692e68e | 2017-09-14 15:42:01 -0700 | [diff] [blame] | 2387 | */ |
| 2388 | @SdkConstant(SdkConstantType.FEATURE) |
| 2389 | public static final String FEATURE_WIFI_RTT = "android.hardware.wifi.rtt"; |
| 2390 | |
| 2391 | |
| 2392 | /** |
| 2393 | * Feature for {@link #getSystemAvailableFeatures} and |
Robert Quattlebaum | 87a7104 | 2017-05-15 15:45:20 -0700 | [diff] [blame] | 2394 | * {@link #hasSystemFeature}: The device supports LoWPAN networking. |
| 2395 | * @hide |
| 2396 | */ |
| 2397 | @SdkConstant(SdkConstantType.FEATURE) |
| 2398 | public static final String FEATURE_LOWPAN = "android.hardware.lowpan"; |
| 2399 | |
| 2400 | /** |
| 2401 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | 0cf2c8a | 2012-05-17 17:29:49 -0700 | [diff] [blame] | 2402 | * {@link #hasSystemFeature}: This is a device dedicated to showing UI |
Todd Kennedy | 7f95a00 | 2015-04-22 14:28:25 -0700 | [diff] [blame] | 2403 | * on a vehicle headunit. A headunit here is defined to be inside a |
| 2404 | * vehicle that may or may not be moving. A headunit uses either a |
| 2405 | * primary display in the center console and/or additional displays in |
| 2406 | * the instrument cluster or elsewhere in the vehicle. Headunit display(s) |
| 2407 | * have limited size and resolution. The user will likely be focused on |
| 2408 | * driving so limiting driver distraction is a primary concern. User input |
| 2409 | * can be a variety of hard buttons, touch, rotary controllers and even mouse- |
| 2410 | * like interfaces. |
| 2411 | */ |
| 2412 | @SdkConstant(SdkConstantType.FEATURE) |
| 2413 | public static final String FEATURE_AUTOMOTIVE = "android.hardware.type.automotive"; |
| 2414 | |
| 2415 | /** |
| 2416 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2417 | * {@link #hasSystemFeature}: This is a device dedicated to showing UI |
Dianne Hackborn | 0cf2c8a | 2012-05-17 17:29:49 -0700 | [diff] [blame] | 2418 | * on a television. Television here is defined to be a typical living |
| 2419 | * room television experience: displayed on a big screen, where the user |
| 2420 | * is sitting far away from it, and the dominant form of input will be |
| 2421 | * something like a DPAD, not through touch or mouse. |
Tim Kilbourn | f94b6a9 | 2014-03-07 15:13:48 -0800 | [diff] [blame] | 2422 | * @deprecated use {@link #FEATURE_LEANBACK} instead. |
Dianne Hackborn | 0cf2c8a | 2012-05-17 17:29:49 -0700 | [diff] [blame] | 2423 | */ |
Jose Lima | 970417c | 2014-04-10 10:42:19 -0700 | [diff] [blame] | 2424 | @Deprecated |
Dianne Hackborn | 0cf2c8a | 2012-05-17 17:29:49 -0700 | [diff] [blame] | 2425 | @SdkConstant(SdkConstantType.FEATURE) |
| 2426 | public static final String FEATURE_TELEVISION = "android.hardware.type.television"; |
| 2427 | |
| 2428 | /** |
Justin Koh | b5731f091c | 2014-02-13 16:06:59 -0800 | [diff] [blame] | 2429 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2430 | * {@link #hasSystemFeature}: This is a device dedicated to showing UI |
| 2431 | * on a watch. A watch here is defined to be a device worn on the body, perhaps on |
| 2432 | * the wrist. The user is very close when interacting with the device. |
| 2433 | */ |
| 2434 | @SdkConstant(SdkConstantType.FEATURE) |
| 2435 | public static final String FEATURE_WATCH = "android.hardware.type.watch"; |
| 2436 | |
| 2437 | /** |
Ralph Nathan | b8e0dee | 2017-01-24 15:24:59 -0800 | [diff] [blame] | 2438 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2439 | * {@link #hasSystemFeature}: This is a device for IoT and may not have an UI. An embedded |
| 2440 | * device is defined as a full stack Android device with or without a display and no |
| 2441 | * user-installable apps. |
| 2442 | */ |
| 2443 | @SdkConstant(SdkConstantType.FEATURE) |
| 2444 | public static final String FEATURE_EMBEDDED = "android.hardware.type.embedded"; |
| 2445 | |
| 2446 | /** |
Dennis Kempin | 7345ed5 | 2017-04-14 16:40:56 -0700 | [diff] [blame] | 2447 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2448 | * {@link #hasSystemFeature}: This is a device dedicated to be primarily used |
| 2449 | * with keyboard, mouse or touchpad. This includes traditional desktop |
| 2450 | * computers, laptops and variants such as convertibles or detachables. |
| 2451 | * Due to the larger screen, the device will most likely use the |
| 2452 | * {@link #FEATURE_FREEFORM_WINDOW_MANAGEMENT} feature as well. |
| 2453 | */ |
| 2454 | @SdkConstant(SdkConstantType.FEATURE) |
| 2455 | public static final String FEATURE_PC = "android.hardware.type.pc"; |
| 2456 | |
| 2457 | /** |
Adam Lesinski | 3d9bcb9 | 2014-02-18 14:05:14 -0800 | [diff] [blame] | 2458 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
| 2459 | * The device supports printing. |
| 2460 | */ |
| 2461 | @SdkConstant(SdkConstantType.FEATURE) |
| 2462 | public static final String FEATURE_PRINTING = "android.software.print"; |
| 2463 | |
| 2464 | /** |
| 2465 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Eugene Susla | 7c3eef2 | 2017-03-10 14:25:58 -0800 | [diff] [blame] | 2466 | * The device supports {@link android.companion.CompanionDeviceManager#associate associating} |
| 2467 | * with devices via {@link android.companion.CompanionDeviceManager}. |
| 2468 | */ |
| 2469 | @SdkConstant(SdkConstantType.FEATURE) |
| 2470 | public static final String FEATURE_COMPANION_DEVICE_SETUP |
| 2471 | = "android.software.companion_device_setup"; |
| 2472 | |
| 2473 | /** |
| 2474 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Adam Lesinski | 3d9bcb9 | 2014-02-18 14:05:14 -0800 | [diff] [blame] | 2475 | * The device can perform backup and restore operations on installed applications. |
| 2476 | */ |
| 2477 | @SdkConstant(SdkConstantType.FEATURE) |
| 2478 | public static final String FEATURE_BACKUP = "android.software.backup"; |
| 2479 | |
| 2480 | /** |
Vladislav Kaznacheev | d303b25 | 2015-10-27 17:30:58 -0700 | [diff] [blame] | 2481 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2482 | * {@link #hasSystemFeature}: The device supports freeform window management. |
| 2483 | * Windows have title bars and can be moved and resized. |
| 2484 | */ |
Filip Gruszczynski | 811dc3b | 2015-11-23 12:34:22 -0800 | [diff] [blame] | 2485 | // If this feature is present, you also need to set |
| 2486 | // com.android.internal.R.config_freeformWindowManagement to true in your configuration overlay. |
Vladislav Kaznacheev | d303b25 | 2015-10-27 17:30:58 -0700 | [diff] [blame] | 2487 | @SdkConstant(SdkConstantType.FEATURE) |
| 2488 | public static final String FEATURE_FREEFORM_WINDOW_MANAGEMENT |
| 2489 | = "android.software.freeform_window_management"; |
| 2490 | |
| 2491 | /** |
Adam Connors | 23cc04e | 2014-04-01 12:12:20 +0100 | [diff] [blame] | 2492 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Wale Ogunwale | fbe12c4 | 2015-12-06 16:23:50 -0800 | [diff] [blame] | 2493 | * The device supports picture-in-picture multi-window mode. |
| 2494 | */ |
| 2495 | @SdkConstant(SdkConstantType.FEATURE) |
| 2496 | public static final String FEATURE_PICTURE_IN_PICTURE = "android.software.picture_in_picture"; |
| 2497 | |
| 2498 | /** |
| 2499 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Andrii Kulian | 1981f5f | 2017-04-07 16:23:12 -0700 | [diff] [blame] | 2500 | * The device supports running activities on secondary displays. |
| 2501 | */ |
| 2502 | @SdkConstant(SdkConstantType.FEATURE) |
| 2503 | public static final String FEATURE_ACTIVITIES_ON_SECONDARY_DISPLAYS |
| 2504 | = "android.software.activities_on_secondary_displays"; |
| 2505 | |
| 2506 | /** |
| 2507 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Amith Yamasani | 1d65327 | 2014-09-11 17:56:05 -0700 | [diff] [blame] | 2508 | * The device supports creating secondary users and managed profiles via |
| 2509 | * {@link DevicePolicyManager}. |
Adam Connors | 23cc04e | 2014-04-01 12:12:20 +0100 | [diff] [blame] | 2510 | */ |
| 2511 | @SdkConstant(SdkConstantType.FEATURE) |
Amith Yamasani | 1d65327 | 2014-09-11 17:56:05 -0700 | [diff] [blame] | 2512 | public static final String FEATURE_MANAGED_USERS = "android.software.managed_users"; |
| 2513 | |
| 2514 | /** |
| 2515 | * @hide |
| 2516 | * TODO: Remove after dependencies updated b/17392243 |
| 2517 | */ |
| 2518 | public static final String FEATURE_MANAGED_PROFILES = "android.software.managed_users"; |
Adam Connors | 23cc04e | 2014-04-01 12:12:20 +0100 | [diff] [blame] | 2519 | |
| 2520 | /** |
Ben Murdoch | f564c7f | 2014-05-20 18:58:06 +0100 | [diff] [blame] | 2521 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Adam Connors | 19ccb5f | 2014-09-08 17:31:50 +0100 | [diff] [blame] | 2522 | * The device supports verified boot. |
| 2523 | */ |
| 2524 | @SdkConstant(SdkConstantType.FEATURE) |
| 2525 | public static final String FEATURE_VERIFIED_BOOT = "android.software.verified_boot"; |
| 2526 | |
| 2527 | /** |
| 2528 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
| 2529 | * The device supports secure removal of users. When a user is deleted the data associated |
| 2530 | * with that user is securely deleted and no longer available. |
| 2531 | */ |
| 2532 | @SdkConstant(SdkConstantType.FEATURE) |
| 2533 | public static final String FEATURE_SECURELY_REMOVES_USERS |
| 2534 | = "android.software.securely_removes_users"; |
| 2535 | |
Jeff Sharkey | b92b05b | 2016-01-28 09:50:00 -0700 | [diff] [blame] | 2536 | /** {@hide} */ |
Jeff Sharkey | 8eb783b | 2018-01-04 16:46:48 -0700 | [diff] [blame] | 2537 | @TestApi |
Jeff Sharkey | b92b05b | 2016-01-28 09:50:00 -0700 | [diff] [blame] | 2538 | @SdkConstant(SdkConstantType.FEATURE) |
| 2539 | public static final String FEATURE_FILE_BASED_ENCRYPTION |
| 2540 | = "android.software.file_based_encryption"; |
| 2541 | |
Jeff Sharkey | 8eb783b | 2018-01-04 16:46:48 -0700 | [diff] [blame] | 2542 | /** {@hide} */ |
| 2543 | @TestApi |
| 2544 | @SdkConstant(SdkConstantType.FEATURE) |
| 2545 | public static final String FEATURE_ADOPTABLE_STORAGE |
| 2546 | = "android.software.adoptable_storage"; |
| 2547 | |
Adam Connors | 19ccb5f | 2014-09-08 17:31:50 +0100 | [diff] [blame] | 2548 | /** |
| 2549 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Ben Murdoch | 422c7a5 | 2014-05-16 13:45:47 +0100 | [diff] [blame] | 2550 | * The device has a full implementation of the android.webkit.* APIs. Devices |
| 2551 | * lacking this feature will not have a functioning WebView implementation. |
| 2552 | */ |
| 2553 | @SdkConstant(SdkConstantType.FEATURE) |
| 2554 | public static final String FEATURE_WEBVIEW = "android.software.webview"; |
| 2555 | |
| 2556 | /** |
Joe LaPenna | 4bb015d | 2014-07-04 17:15:54 -0700 | [diff] [blame] | 2557 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2558 | * {@link #hasSystemFeature}: This device supports ethernet. |
Joe LaPenna | 4bb015d | 2014-07-04 17:15:54 -0700 | [diff] [blame] | 2559 | */ |
| 2560 | @SdkConstant(SdkConstantType.FEATURE) |
| 2561 | public static final String FEATURE_ETHERNET = "android.hardware.ethernet"; |
| 2562 | |
| 2563 | /** |
Yuncheol Heo | a0c4a06 | 2014-07-10 20:49:27 +0900 | [diff] [blame] | 2564 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2565 | * {@link #hasSystemFeature}: This device supports HDMI-CEC. |
| 2566 | * @hide |
| 2567 | */ |
| 2568 | @SdkConstant(SdkConstantType.FEATURE) |
| 2569 | public static final String FEATURE_HDMI_CEC = "android.hardware.hdmi.cec"; |
| 2570 | |
| 2571 | /** |
Michael Wright | 6faa675 | 2014-09-05 17:57:44 -0700 | [diff] [blame] | 2572 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
| 2573 | * The device has all of the inputs necessary to be considered a compatible game controller, or |
| 2574 | * includes a compatible game controller in the box. |
| 2575 | */ |
| 2576 | @SdkConstant(SdkConstantType.FEATURE) |
| 2577 | public static final String FEATURE_GAMEPAD = "android.hardware.gamepad"; |
| 2578 | |
Mike Lockwood | 5781cd5 | 2015-03-27 13:23:41 -0700 | [diff] [blame] | 2579 | /** |
| 2580 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
| 2581 | * The device has a full implementation of the android.media.midi.* APIs. |
| 2582 | */ |
| 2583 | @SdkConstant(SdkConstantType.FEATURE) |
| 2584 | public static final String FEATURE_MIDI = "android.software.midi"; |
Michael Wright | 6faa675 | 2014-09-05 17:57:44 -0700 | [diff] [blame] | 2585 | |
| 2586 | /** |
Ruben Brunk | dd18a0b | 2015-12-04 16:16:31 -0800 | [diff] [blame] | 2587 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Ruben Brunk | 927d345 | 2016-05-02 19:30:51 -0700 | [diff] [blame] | 2588 | * The device implements an optimized mode for virtual reality (VR) applications that handles |
| 2589 | * stereoscopic rendering of notifications, and disables most monocular system UI components |
| 2590 | * while a VR application has user focus. |
| 2591 | * Devices declaring this feature must include an application implementing a |
| 2592 | * {@link android.service.vr.VrListenerService} that can be targeted by VR applications via |
| 2593 | * {@link android.app.Activity#setVrModeEnabled}. |
Craig Donner | c6f9c85 | 2017-12-27 17:15:19 -0800 | [diff] [blame] | 2594 | * @deprecated use {@link #FEATURE_VR_MODE_HIGH_PERFORMANCE} instead. |
Ruben Brunk | dd18a0b | 2015-12-04 16:16:31 -0800 | [diff] [blame] | 2595 | */ |
Craig Donner | c6f9c85 | 2017-12-27 17:15:19 -0800 | [diff] [blame] | 2596 | @Deprecated |
Ruben Brunk | dd18a0b | 2015-12-04 16:16:31 -0800 | [diff] [blame] | 2597 | @SdkConstant(SdkConstantType.FEATURE) |
| 2598 | public static final String FEATURE_VR_MODE = "android.software.vr.mode"; |
| 2599 | |
| 2600 | /** |
Ruben Brunk | 31d80ea | 2016-01-25 20:14:08 -0800 | [diff] [blame] | 2601 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Craig Donner | c6f9c85 | 2017-12-27 17:15:19 -0800 | [diff] [blame] | 2602 | * The device implements an optimized mode for virtual reality (VR) applications that handles |
| 2603 | * stereoscopic rendering of notifications, disables most monocular system UI components |
| 2604 | * while a VR application has user focus and meets extra CDD requirements to provide a |
| 2605 | * high-quality VR experience. |
| 2606 | * Devices declaring this feature must include an application implementing a |
| 2607 | * {@link android.service.vr.VrListenerService} that can be targeted by VR applications via |
| 2608 | * {@link android.app.Activity#setVrModeEnabled}. |
| 2609 | * and must meet CDD requirements to provide a high-quality VR experience. |
Ruben Brunk | 31d80ea | 2016-01-25 20:14:08 -0800 | [diff] [blame] | 2610 | */ |
| 2611 | @SdkConstant(SdkConstantType.FEATURE) |
| 2612 | public static final String FEATURE_VR_MODE_HIGH_PERFORMANCE |
| 2613 | = "android.hardware.vr.high_performance"; |
| 2614 | |
| 2615 | /** |
Craig Donner | 279dd66 | 2017-03-15 17:10:50 -0700 | [diff] [blame] | 2616 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Svet Ganov | 43574b0 | 2017-04-12 09:25:20 -0700 | [diff] [blame] | 2617 | * The device supports autofill of user credentials, addresses, credit cards, etc |
| 2618 | * via integration with {@link android.service.autofill.AutofillService autofill |
| 2619 | * providers}. |
| 2620 | */ |
| 2621 | @SdkConstant(SdkConstantType.FEATURE) |
| 2622 | public static final String FEATURE_AUTOFILL = "android.software.autofill"; |
| 2623 | |
| 2624 | /** |
| 2625 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Craig Donner | 279dd66 | 2017-03-15 17:10:50 -0700 | [diff] [blame] | 2626 | * The device implements headtracking suitable for a VR device. |
| 2627 | */ |
| 2628 | @SdkConstant(SdkConstantType.FEATURE) |
| 2629 | public static final String FEATURE_VR_HEADTRACKING = "android.hardware.vr.headtracking"; |
| 2630 | |
| 2631 | /** |
Frank Salim | ea5e038 | 2018-01-23 22:42:29 -0800 | [diff] [blame] | 2632 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
| 2633 | * The device has a StrongBox hardware-backed Keystore. |
| 2634 | */ |
| 2635 | @SdkConstant(SdkConstantType.FEATURE) |
| 2636 | public static final String FEATURE_STRONGBOX_KEYSTORE = |
| 2637 | "android.hardware.strongbox_keystore"; |
| 2638 | |
| 2639 | /** |
Eran Messeri | adaf68c | 2018-03-27 19:34:03 +0100 | [diff] [blame] | 2640 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
| 2641 | * The device has a Keymaster implementation that supports Device ID attestation. |
| 2642 | * |
| 2643 | * @see DevicePolicyManager#isDeviceIdAttestationSupported |
| 2644 | * @hide |
| 2645 | */ |
| 2646 | @SdkConstant(SdkConstantType.FEATURE) |
| 2647 | public static final String FEATURE_DEVICE_ID_ATTESTATION = |
| 2648 | "android.software.device_id_attestation"; |
| 2649 | |
| 2650 | /** |
Dianne Hackborn | e83cefce | 2010-02-04 17:38:14 -0800 | [diff] [blame] | 2651 | * Action to external storage service to clean out removed apps. |
| 2652 | * @hide |
| 2653 | */ |
| 2654 | public static final String ACTION_CLEAN_EXTERNAL_STORAGE |
| 2655 | = "android.content.pm.CLEAN_EXTERNAL_STORAGE"; |
Oscar Montemayor | 1228d0a | 2010-01-28 12:01:44 -0800 | [diff] [blame] | 2656 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2657 | /** |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 2658 | * Extra field name for the URI to a verification file. Passed to a package |
| 2659 | * verifier. |
| 2660 | * |
| 2661 | * @hide |
| 2662 | */ |
| 2663 | public static final String EXTRA_VERIFICATION_URI = "android.content.pm.extra.VERIFICATION_URI"; |
| 2664 | |
| 2665 | /** |
| 2666 | * Extra field name for the ID of a package pending verification. Passed to |
| 2667 | * a package verifier and is used to call back to |
Kenny Root | 3a9b5fb | 2011-09-20 14:15:38 -0700 | [diff] [blame] | 2668 | * {@link PackageManager#verifyPendingInstall(int, int)} |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 2669 | */ |
| 2670 | public static final String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID"; |
| 2671 | |
| 2672 | /** |
| 2673 | * Extra field name for the package identifier which is trying to install |
| 2674 | * the package. |
| 2675 | * |
| 2676 | * @hide |
| 2677 | */ |
| 2678 | public static final String EXTRA_VERIFICATION_INSTALLER_PACKAGE |
| 2679 | = "android.content.pm.extra.VERIFICATION_INSTALLER_PACKAGE"; |
| 2680 | |
| 2681 | /** |
| 2682 | * Extra field name for the requested install flags for a package pending |
| 2683 | * verification. Passed to a package verifier. |
| 2684 | * |
| 2685 | * @hide |
| 2686 | */ |
| 2687 | public static final String EXTRA_VERIFICATION_INSTALL_FLAGS |
| 2688 | = "android.content.pm.extra.VERIFICATION_INSTALL_FLAGS"; |
| 2689 | |
| 2690 | /** |
rich cannings | 13d428e | 2012-09-13 13:43:07 -0700 | [diff] [blame] | 2691 | * Extra field name for the uid of who is requesting to install |
| 2692 | * the package. |
| 2693 | * |
| 2694 | * @hide |
| 2695 | */ |
| 2696 | public static final String EXTRA_VERIFICATION_INSTALLER_UID |
| 2697 | = "android.content.pm.extra.VERIFICATION_INSTALLER_UID"; |
| 2698 | |
| 2699 | /** |
| 2700 | * Extra field name for the package name of a package pending verification. |
| 2701 | * |
| 2702 | * @hide |
| 2703 | */ |
| 2704 | public static final String EXTRA_VERIFICATION_PACKAGE_NAME |
| 2705 | = "android.content.pm.extra.VERIFICATION_PACKAGE_NAME"; |
| 2706 | /** |
rich cannings | d1b5cfc | 2012-08-29 14:49:51 -0700 | [diff] [blame] | 2707 | * Extra field name for the result of a verification, either |
| 2708 | * {@link #VERIFICATION_ALLOW}, or {@link #VERIFICATION_REJECT}. |
| 2709 | * Passed to package verifiers after a package is verified. |
| 2710 | */ |
| 2711 | public static final String EXTRA_VERIFICATION_RESULT |
| 2712 | = "android.content.pm.extra.VERIFICATION_RESULT"; |
| 2713 | |
| 2714 | /** |
rich cannings | 13d428e | 2012-09-13 13:43:07 -0700 | [diff] [blame] | 2715 | * Extra field name for the version code of a package pending verification. |
Dianne Hackborn | 3accca0 | 2013-09-20 09:32:11 -0700 | [diff] [blame] | 2716 | * @deprecated Use {@link #EXTRA_VERIFICATION_LONG_VERSION_CODE} instead. |
| 2717 | * @hide |
| 2718 | */ |
| 2719 | @Deprecated |
| 2720 | public static final String EXTRA_VERIFICATION_VERSION_CODE |
| 2721 | = "android.content.pm.extra.VERIFICATION_VERSION_CODE"; |
| 2722 | |
| 2723 | /** |
| 2724 | * 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] | 2725 | * |
| 2726 | * @hide |
| 2727 | */ |
Dianne Hackborn | 3accca0 | 2013-09-20 09:32:11 -0700 | [diff] [blame] | 2728 | public static final String EXTRA_VERIFICATION_LONG_VERSION_CODE = |
| 2729 | "android.content.pm.extra.VERIFICATION_LONG_VERSION_CODE"; |
rich cannings | 13d428e | 2012-09-13 13:43:07 -0700 | [diff] [blame] | 2730 | |
| 2731 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 2732 | * Extra field name for the ID of a intent filter pending verification. |
| 2733 | * Passed to an intent filter verifier and is used to call back to |
| 2734 | * {@link #verifyIntentFilter} |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 2735 | * |
| 2736 | * @hide |
| 2737 | */ |
| 2738 | public static final String EXTRA_INTENT_FILTER_VERIFICATION_ID |
| 2739 | = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_ID"; |
| 2740 | |
| 2741 | /** |
| 2742 | * Extra field name for the scheme used for an intent filter pending verification. Passed to |
| 2743 | * an intent filter verifier and is used to construct the URI to verify against. |
| 2744 | * |
| 2745 | * Usually this is "https" |
| 2746 | * |
| 2747 | * @hide |
| 2748 | */ |
| 2749 | public static final String EXTRA_INTENT_FILTER_VERIFICATION_URI_SCHEME |
| 2750 | = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_URI_SCHEME"; |
| 2751 | |
| 2752 | /** |
| 2753 | * Extra field name for the host names to be used for an intent filter pending verification. |
| 2754 | * Passed to an intent filter verifier and is used to construct the URI to verify the |
| 2755 | * intent filter. |
| 2756 | * |
| 2757 | * This is a space delimited list of hosts. |
| 2758 | * |
| 2759 | * @hide |
| 2760 | */ |
| 2761 | public static final String EXTRA_INTENT_FILTER_VERIFICATION_HOSTS |
| 2762 | = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_HOSTS"; |
| 2763 | |
| 2764 | /** |
| 2765 | * Extra field name for the package name to be used for an intent filter pending verification. |
| 2766 | * Passed to an intent filter verifier and is used to check the verification responses coming |
| 2767 | * from the hosts. Each host response will need to include the package name of APK containing |
| 2768 | * the intent filter. |
| 2769 | * |
| 2770 | * @hide |
| 2771 | */ |
| 2772 | public static final String EXTRA_INTENT_FILTER_VERIFICATION_PACKAGE_NAME |
| 2773 | = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_PACKAGE_NAME"; |
| 2774 | |
| 2775 | /** |
| 2776 | * The action used to request that the user approve a permission request |
| 2777 | * from the application. |
Nick Kralevich | 035f80d | 2013-03-27 15:20:08 -0700 | [diff] [blame] | 2778 | * |
| 2779 | * @hide |
| 2780 | */ |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 2781 | @SystemApi |
| 2782 | public static final String ACTION_REQUEST_PERMISSIONS = |
| 2783 | "android.content.pm.action.REQUEST_PERMISSIONS"; |
Nick Kralevich | 035f80d | 2013-03-27 15:20:08 -0700 | [diff] [blame] | 2784 | |
| 2785 | /** |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 2786 | * The names of the requested permissions. |
| 2787 | * <p> |
| 2788 | * <strong>Type:</strong> String[] |
| 2789 | * </p> |
| 2790 | * |
| 2791 | * @hide |
| 2792 | */ |
| 2793 | @SystemApi |
| 2794 | public static final String EXTRA_REQUEST_PERMISSIONS_NAMES = |
| 2795 | "android.content.pm.extra.REQUEST_PERMISSIONS_NAMES"; |
| 2796 | |
| 2797 | /** |
| 2798 | * The results from the permissions request. |
| 2799 | * <p> |
| 2800 | * <strong>Type:</strong> int[] of #PermissionResult |
| 2801 | * </p> |
| 2802 | * |
| 2803 | * @hide |
| 2804 | */ |
| 2805 | @SystemApi |
| 2806 | public static final String EXTRA_REQUEST_PERMISSIONS_RESULTS |
| 2807 | = "android.content.pm.extra.REQUEST_PERMISSIONS_RESULTS"; |
Nick Kralevich | 035f80d | 2013-03-27 15:20:08 -0700 | [diff] [blame] | 2808 | |
| 2809 | /** |
Jeff Sharkey | bb58067 | 2014-07-10 12:10:25 -0700 | [diff] [blame] | 2810 | * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of |
Christopher Tate | f1977b4 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 2811 | * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the package which provides |
| 2812 | * the existing definition for the permission. |
| 2813 | * @hide |
| 2814 | */ |
| 2815 | public static final String EXTRA_FAILURE_EXISTING_PACKAGE |
| 2816 | = "android.content.pm.extra.FAILURE_EXISTING_PACKAGE"; |
| 2817 | |
| 2818 | /** |
Jeff Sharkey | bb58067 | 2014-07-10 12:10:25 -0700 | [diff] [blame] | 2819 | * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of |
Christopher Tate | f1977b4 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 2820 | * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the permission that is |
| 2821 | * being redundantly defined by the package being installed. |
| 2822 | * @hide |
| 2823 | */ |
| 2824 | public static final String EXTRA_FAILURE_EXISTING_PERMISSION |
| 2825 | = "android.content.pm.extra.FAILURE_EXISTING_PERMISSION"; |
| 2826 | |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 2827 | /** |
| 2828 | * Permission flag: The permission is set in its current state |
| 2829 | * by the user and apps can still request it at runtime. |
| 2830 | * |
| 2831 | * @hide |
| 2832 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 2833 | @SystemApi |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 2834 | public static final int FLAG_PERMISSION_USER_SET = 1 << 0; |
| 2835 | |
| 2836 | /** |
| 2837 | * Permission flag: The permission is set in its current state |
| 2838 | * by the user and it is fixed, i.e. apps can no longer request |
| 2839 | * this permission. |
| 2840 | * |
| 2841 | * @hide |
| 2842 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 2843 | @SystemApi |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 2844 | public static final int FLAG_PERMISSION_USER_FIXED = 1 << 1; |
| 2845 | |
| 2846 | /** |
| 2847 | * Permission flag: The permission is set in its current state |
| 2848 | * by device policy and neither apps nor the user can change |
| 2849 | * its state. |
| 2850 | * |
| 2851 | * @hide |
| 2852 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 2853 | @SystemApi |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 2854 | public static final int FLAG_PERMISSION_POLICY_FIXED = 1 << 2; |
| 2855 | |
| 2856 | /** |
| 2857 | * Permission flag: The permission is set in a granted state but |
| 2858 | * access to resources it guards is restricted by other means to |
| 2859 | * enable revoking a permission on legacy apps that do not support |
| 2860 | * runtime permissions. If this permission is upgraded to runtime |
| 2861 | * because the app was updated to support runtime permissions, the |
| 2862 | * the permission will be revoked in the upgrade process. |
| 2863 | * |
| 2864 | * @hide |
| 2865 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 2866 | @SystemApi |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 2867 | public static final int FLAG_PERMISSION_REVOKE_ON_UPGRADE = 1 << 3; |
| 2868 | |
Svet Ganov | b3f22b4 | 2015-05-12 11:01:24 -0700 | [diff] [blame] | 2869 | /** |
| 2870 | * Permission flag: The permission is set in its current state |
| 2871 | * because the app is a component that is a part of the system. |
| 2872 | * |
| 2873 | * @hide |
| 2874 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 2875 | @SystemApi |
Svet Ganov | b3f22b4 | 2015-05-12 11:01:24 -0700 | [diff] [blame] | 2876 | public static final int FLAG_PERMISSION_SYSTEM_FIXED = 1 << 4; |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 2877 | |
Svet Ganov | 77ab6a8 | 2015-07-03 12:03:02 -0700 | [diff] [blame] | 2878 | /** |
| 2879 | * Permission flag: The permission is granted by default because it |
| 2880 | * enables app functionality that is expected to work out-of-the-box |
| 2881 | * for providing a smooth user experience. For example, the phone app |
| 2882 | * is expected to have the phone permission. |
| 2883 | * |
| 2884 | * @hide |
| 2885 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 2886 | @SystemApi |
Svet Ganov | 77ab6a8 | 2015-07-03 12:03:02 -0700 | [diff] [blame] | 2887 | public static final int FLAG_PERMISSION_GRANTED_BY_DEFAULT = 1 << 5; |
| 2888 | |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 2889 | /** |
Svet Ganov | 9c165d7 | 2015-12-01 19:52:26 -0800 | [diff] [blame] | 2890 | * Permission flag: The permission has to be reviewed before any of |
| 2891 | * the app components can run. |
| 2892 | * |
| 2893 | * @hide |
| 2894 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 2895 | @SystemApi |
Svet Ganov | 9c165d7 | 2015-12-01 19:52:26 -0800 | [diff] [blame] | 2896 | public static final int FLAG_PERMISSION_REVIEW_REQUIRED = 1 << 6; |
| 2897 | |
| 2898 | /** |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 2899 | * Mask for all permission flags. |
| 2900 | * |
| 2901 | * @hide |
| 2902 | */ |
| 2903 | @SystemApi |
Svet Ganov | b3f22b4 | 2015-05-12 11:01:24 -0700 | [diff] [blame] | 2904 | public static final int MASK_PERMISSION_FLAGS = 0xFF; |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 2905 | |
Christopher Tate | f1977b4 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 2906 | /** |
Svet Ganov | d7b1f411 | 2016-02-09 18:49:23 -0800 | [diff] [blame] | 2907 | * This is a library that contains components apps can invoke. For |
| 2908 | * example, a services for apps to bind to, or standard chooser UI, |
| 2909 | * etc. This library is versioned and backwards compatible. Clients |
| 2910 | * should check its version via {@link android.ext.services.Version |
| 2911 | * #getVersionCode()} and avoid calling APIs added in later versions. |
| 2912 | * |
| 2913 | * @hide |
| 2914 | */ |
| 2915 | public static final String SYSTEM_SHARED_LIBRARY_SERVICES = "android.ext.services"; |
| 2916 | |
| 2917 | /** |
| 2918 | * This is a library that contains components apps can dynamically |
| 2919 | * load. For example, new widgets, helper classes, etc. This library |
| 2920 | * is versioned and backwards compatible. Clients should check its |
| 2921 | * version via {@link android.ext.shared.Version#getVersionCode()} |
| 2922 | * and avoid calling APIs added in later versions. |
| 2923 | * |
| 2924 | * @hide |
| 2925 | */ |
| 2926 | public static final String SYSTEM_SHARED_LIBRARY_SHARED = "android.ext.shared"; |
| 2927 | |
| 2928 | /** |
Brian Carlstrom | ca82e61 | 2016-04-19 23:16:08 -0700 | [diff] [blame] | 2929 | * Used when starting a process for an Activity. |
| 2930 | * |
| 2931 | * @hide |
| 2932 | */ |
| 2933 | public static final int NOTIFY_PACKAGE_USE_ACTIVITY = 0; |
| 2934 | |
| 2935 | /** |
| 2936 | * Used when starting a process for a Service. |
| 2937 | * |
| 2938 | * @hide |
| 2939 | */ |
| 2940 | public static final int NOTIFY_PACKAGE_USE_SERVICE = 1; |
| 2941 | |
| 2942 | /** |
| 2943 | * Used when moving a Service to the foreground. |
| 2944 | * |
| 2945 | * @hide |
| 2946 | */ |
| 2947 | public static final int NOTIFY_PACKAGE_USE_FOREGROUND_SERVICE = 2; |
| 2948 | |
| 2949 | /** |
| 2950 | * Used when starting a process for a BroadcastReceiver. |
| 2951 | * |
| 2952 | * @hide |
| 2953 | */ |
| 2954 | public static final int NOTIFY_PACKAGE_USE_BROADCAST_RECEIVER = 3; |
| 2955 | |
| 2956 | /** |
| 2957 | * Used when starting a process for a ContentProvider. |
| 2958 | * |
| 2959 | * @hide |
| 2960 | */ |
| 2961 | public static final int NOTIFY_PACKAGE_USE_CONTENT_PROVIDER = 4; |
| 2962 | |
| 2963 | /** |
| 2964 | * Used when starting a process for a BroadcastReceiver. |
| 2965 | * |
| 2966 | * @hide |
| 2967 | */ |
| 2968 | public static final int NOTIFY_PACKAGE_USE_BACKUP = 5; |
| 2969 | |
| 2970 | /** |
| 2971 | * Used with Context.getClassLoader() across Android packages. |
| 2972 | * |
| 2973 | * @hide |
| 2974 | */ |
| 2975 | public static final int NOTIFY_PACKAGE_USE_CROSS_PACKAGE = 6; |
| 2976 | |
| 2977 | /** |
| 2978 | * Used when starting a package within a process for Instrumentation. |
| 2979 | * |
| 2980 | * @hide |
| 2981 | */ |
| 2982 | public static final int NOTIFY_PACKAGE_USE_INSTRUMENTATION = 7; |
| 2983 | |
| 2984 | /** |
| 2985 | * Total number of usage reasons. |
| 2986 | * |
| 2987 | * @hide |
| 2988 | */ |
| 2989 | public static final int NOTIFY_PACKAGE_USE_REASONS_COUNT = 8; |
| 2990 | |
| 2991 | /** |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 2992 | * Constant for specifying the highest installed package version code. |
| 2993 | */ |
| 2994 | public static final int VERSION_CODE_HIGHEST = -1; |
| 2995 | |
Jeff Sharkey | ad357d1 | 2018-02-02 13:25:31 -0700 | [diff] [blame] | 2996 | /** {@hide} */ |
| 2997 | public int getUserId() { |
| 2998 | return UserHandle.myUserId(); |
| 2999 | } |
| 3000 | |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 3001 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3002 | * Retrieve overall information about an application package that is |
| 3003 | * installed on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3004 | * |
| 3005 | * @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] | 3006 | * desired package. |
| 3007 | * @param flags Additional option flags to modify the data returned. |
| 3008 | * @return A PackageInfo object containing information about the package. If |
| 3009 | * flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the package |
| 3010 | * is not found in the list of installed applications, the package |
| 3011 | * information is retrieved from the list of uninstalled |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 3012 | * applications (which includes installed applications as well as |
| 3013 | * applications with data directory i.e. applications which had been |
| 3014 | * deleted with {@code DONT_DELETE_DATA} flag set). |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3015 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3016 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3017 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3018 | public abstract PackageInfo getPackageInfo(String packageName, @PackageInfoFlags int flags) |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3019 | throws NameNotFoundException; |
| 3020 | |
| 3021 | /** |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 3022 | * Retrieve overall information about an application package that is |
| 3023 | * installed on the system. This method can be used for retrieving |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3024 | * information about packages for which multiple versions can be installed |
| 3025 | * at the time. Currently only packages hosting static shared libraries can |
| 3026 | * have multiple installed versions. The method can also be used to get info |
| 3027 | * for a package that has a single version installed by passing |
| 3028 | * {@link #VERSION_CODE_HIGHEST} in the {@link VersionedPackage} |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 3029 | * constructor. |
| 3030 | * |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 3031 | * @param versionedPackage The versioned package for which to query. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3032 | * @param flags Additional option flags to modify the data returned. |
| 3033 | * @return A PackageInfo object containing information about the package. If |
| 3034 | * flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the package |
| 3035 | * is not found in the list of installed applications, the package |
| 3036 | * information is retrieved from the list of uninstalled |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 3037 | * applications (which includes installed applications as well as |
| 3038 | * applications with data directory i.e. applications which had been |
| 3039 | * deleted with {@code DONT_DELETE_DATA} flag set). |
| 3040 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3041 | * found on the system. |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 3042 | */ |
| 3043 | public abstract PackageInfo getPackageInfo(VersionedPackage versionedPackage, |
| 3044 | @PackageInfoFlags int flags) throws NameNotFoundException; |
| 3045 | |
| 3046 | /** |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 3047 | * Retrieve overall information about an application package that is |
| 3048 | * installed on the system. |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 3049 | * |
| 3050 | * @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] | 3051 | * desired package. |
| 3052 | * @param flags Additional option flags to modify the data returned. |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 3053 | * @param userId The user id. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3054 | * @return A PackageInfo object containing information about the package. If |
| 3055 | * flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the package |
| 3056 | * is not found in the list of installed applications, the package |
| 3057 | * information is retrieved from the list of uninstalled |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 3058 | * applications (which includes installed applications as well as |
| 3059 | * applications with data directory i.e. applications which had been |
| 3060 | * deleted with {@code DONT_DELETE_DATA} flag set). |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3061 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3062 | * found on the system. |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 3063 | * @hide |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 3064 | */ |
| 3065 | @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS) |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3066 | public abstract PackageInfo getPackageInfoAsUser(String packageName, |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3067 | @PackageInfoFlags int flags, @UserIdInt int userId) throws NameNotFoundException; |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 3068 | |
| 3069 | /** |
Dianne Hackborn | 4709693 | 2010-02-11 15:57:09 -0800 | [diff] [blame] | 3070 | * Map from the current package names in use on the device to whatever |
| 3071 | * the current canonical name of that package is. |
| 3072 | * @param names Array of current names to be mapped. |
| 3073 | * @return Returns an array of the same size as the original, containing |
| 3074 | * the canonical name for each package. |
| 3075 | */ |
| 3076 | public abstract String[] currentToCanonicalPackageNames(String[] names); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3077 | |
Dianne Hackborn | 4709693 | 2010-02-11 15:57:09 -0800 | [diff] [blame] | 3078 | /** |
| 3079 | * Map from a packages canonical name to the current name in use on the device. |
| 3080 | * @param names Array of new names to be mapped. |
| 3081 | * @return Returns an array of the same size as the original, containing |
| 3082 | * the current name for each package. |
| 3083 | */ |
| 3084 | public abstract String[] canonicalToCurrentPackageNames(String[] names); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3085 | |
Dianne Hackborn | 4709693 | 2010-02-11 15:57:09 -0800 | [diff] [blame] | 3086 | /** |
Andrew Solovay | 5ae1335 | 2014-06-06 12:23:09 -0700 | [diff] [blame] | 3087 | * Returns a "good" intent to launch a front-door activity in a package. |
| 3088 | * This is used, for example, to implement an "open" button when browsing |
| 3089 | * through packages. The current implementation looks first for a main |
| 3090 | * activity in the category {@link Intent#CATEGORY_INFO}, and next for a |
| 3091 | * main activity in the category {@link Intent#CATEGORY_LAUNCHER}. Returns |
| 3092 | * <code>null</code> if neither are found. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3093 | * |
| 3094 | * @param packageName The name of the package to inspect. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3095 | * |
Andrew Solovay | 5ae1335 | 2014-06-06 12:23:09 -0700 | [diff] [blame] | 3096 | * @return A fully-qualified {@link Intent} that can be used to launch the |
| 3097 | * main activity in the package. Returns <code>null</code> if the package |
| 3098 | * 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] | 3099 | * recognized. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3100 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 3101 | public abstract @Nullable Intent getLaunchIntentForPackage(@NonNull String packageName); |
Mihai Preda | eae850c | 2009-05-13 10:13:48 +0200 | [diff] [blame] | 3102 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3103 | /** |
Jose Lima | 970417c | 2014-04-10 10:42:19 -0700 | [diff] [blame] | 3104 | * Return a "good" intent to launch a front-door Leanback activity in a |
| 3105 | * package, for use for example to implement an "open" button when browsing |
| 3106 | * through packages. The current implementation will look for a main |
| 3107 | * activity in the category {@link Intent#CATEGORY_LEANBACK_LAUNCHER}, or |
| 3108 | * return null if no main leanback activities are found. |
Adam Connors | 551c078 | 2014-06-05 12:13:03 +0100 | [diff] [blame] | 3109 | * |
Jose Lima | 970417c | 2014-04-10 10:42:19 -0700 | [diff] [blame] | 3110 | * @param packageName The name of the package to inspect. |
| 3111 | * @return Returns either a fully-qualified Intent that can be used to launch |
| 3112 | * the main Leanback activity in the package, or null if the package |
| 3113 | * does not contain such an activity. |
| 3114 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 3115 | public abstract @Nullable Intent getLeanbackLaunchIntentForPackage(@NonNull String packageName); |
Jose Lima | 970417c | 2014-04-10 10:42:19 -0700 | [diff] [blame] | 3116 | |
| 3117 | /** |
Roberto Perez | 7ee1a7a | 2017-12-04 17:14:33 -0800 | [diff] [blame] | 3118 | * Return a "good" intent to launch a front-door Car activity in a |
| 3119 | * package, for use for example to implement an "open" button when browsing |
| 3120 | * through packages. The current implementation will look for a main |
| 3121 | * activity in the category {@link Intent#CATEGORY_CAR_LAUNCHER}, or |
| 3122 | * return null if no main car activities are found. |
| 3123 | * |
| 3124 | * @param packageName The name of the package to inspect. |
| 3125 | * @return Returns either a fully-qualified Intent that can be used to launch |
| 3126 | * the main Car activity in the package, or null if the package |
| 3127 | * does not contain such an activity. |
| 3128 | * @hide |
| 3129 | */ |
| 3130 | public abstract @Nullable Intent getCarLaunchIntentForPackage(@NonNull String packageName); |
| 3131 | |
| 3132 | /** |
Jeff Sharkey | cf3f0a1 | 2016-03-17 19:57:58 -0600 | [diff] [blame] | 3133 | * Return an array of all of the POSIX secondary group IDs that have been |
| 3134 | * assigned to the given package. |
| 3135 | * <p> |
| 3136 | * Note that the same package may have different GIDs under different |
| 3137 | * {@link UserHandle} on the same device. |
Adam Connors | 551c078 | 2014-06-05 12:13:03 +0100 | [diff] [blame] | 3138 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3139 | * @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] | 3140 | * desired package. |
| 3141 | * @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] | 3142 | * none. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3143 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3144 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3145 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 3146 | public abstract int[] getPackageGids(@NonNull String packageName) |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3147 | throws NameNotFoundException; |
| 3148 | |
| 3149 | /** |
Jeff Sharkey | cf3f0a1 | 2016-03-17 19:57:58 -0600 | [diff] [blame] | 3150 | * Return an array of all of the POSIX secondary group IDs that have been |
| 3151 | * assigned to the given package. |
| 3152 | * <p> |
| 3153 | * Note that the same package may have different GIDs under different |
| 3154 | * {@link UserHandle} on the same device. |
Dianne Hackborn | a06de0f | 2012-12-11 16:34:47 -0800 | [diff] [blame] | 3155 | * |
| 3156 | * @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] | 3157 | * desired package. |
| 3158 | * @return Returns an int array of the assigned gids, or null if there are |
| 3159 | * none. |
| 3160 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3161 | * found on the system. |
Dianne Hackborn | a06de0f | 2012-12-11 16:34:47 -0800 | [diff] [blame] | 3162 | */ |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3163 | public abstract int[] getPackageGids(String packageName, @PackageInfoFlags int flags) |
Dianne Hackborn | a06de0f | 2012-12-11 16:34:47 -0800 | [diff] [blame] | 3164 | throws NameNotFoundException; |
| 3165 | |
| 3166 | /** |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3167 | * Return the UID associated with the given package name. |
Jeff Sharkey | cf3f0a1 | 2016-03-17 19:57:58 -0600 | [diff] [blame] | 3168 | * <p> |
| 3169 | * Note that the same package will have different UIDs under different |
| 3170 | * {@link UserHandle} on the same device. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3171 | * |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3172 | * @param packageName The full name (i.e. com.google.apps.contacts) of the |
| 3173 | * desired package. |
| 3174 | * @return Returns an integer UID who owns the given package name. |
| 3175 | * @throws NameNotFoundException if a package with the given name can not be |
| 3176 | * found on the system. |
| 3177 | */ |
| 3178 | public abstract int getPackageUid(String packageName, @PackageInfoFlags int flags) |
| 3179 | throws NameNotFoundException; |
| 3180 | |
| 3181 | /** |
| 3182 | * Return the UID associated with the given package name. |
Jeff Sharkey | cf3f0a1 | 2016-03-17 19:57:58 -0600 | [diff] [blame] | 3183 | * <p> |
| 3184 | * Note that the same package will have different UIDs under different |
| 3185 | * {@link UserHandle} on the same device. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3186 | * |
| 3187 | * @param packageName The full name (i.e. com.google.apps.contacts) of the |
| 3188 | * desired package. |
| 3189 | * @param userId The user handle identifier to look up the package under. |
| 3190 | * @return Returns an integer UID who owns the given package name. |
| 3191 | * @throws NameNotFoundException if a package with the given name can not be |
| 3192 | * found on the system. |
| 3193 | * @hide |
| 3194 | */ |
| 3195 | public abstract int getPackageUidAsUser(String packageName, @UserIdInt int userId) |
| 3196 | throws NameNotFoundException; |
| 3197 | |
| 3198 | /** |
| 3199 | * Return the UID associated with the given package name. |
Jeff Sharkey | cf3f0a1 | 2016-03-17 19:57:58 -0600 | [diff] [blame] | 3200 | * <p> |
| 3201 | * Note that the same package will have different UIDs under different |
| 3202 | * {@link UserHandle} on the same device. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3203 | * |
| 3204 | * @param packageName The full name (i.e. com.google.apps.contacts) of the |
| 3205 | * desired package. |
| 3206 | * @param userId The user handle identifier to look up the package under. |
| 3207 | * @return Returns an integer UID who owns the given package name. |
| 3208 | * @throws NameNotFoundException if a package with the given name can not be |
| 3209 | * found on the system. |
| 3210 | * @hide |
| 3211 | */ |
| 3212 | public abstract int getPackageUidAsUser(String packageName, @PackageInfoFlags int flags, |
| 3213 | @UserIdInt int userId) throws NameNotFoundException; |
| 3214 | |
| 3215 | /** |
| 3216 | * 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] | 3217 | * |
| 3218 | * @param name The fully qualified name (i.e. com.google.permission.LOGIN) |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3219 | * of the permission you are interested in. |
| 3220 | * @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] | 3221 | * @return Returns a {@link PermissionInfo} containing information about the |
| 3222 | * permission. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3223 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3224 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3225 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3226 | public abstract PermissionInfo getPermissionInfo(String name, @PermissionInfoFlags int flags) |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3227 | throws NameNotFoundException; |
| 3228 | |
| 3229 | /** |
| 3230 | * Query for all of the permissions associated with a particular group. |
| 3231 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3232 | * @param group The fully qualified name (i.e. com.google.permission.LOGIN) |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3233 | * of the permission group you are interested in. Use null to |
| 3234 | * find all of the permissions not associated with a group. |
| 3235 | * @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] | 3236 | * @return Returns a list of {@link PermissionInfo} containing information |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3237 | * about all of the permissions in the given group. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3238 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3239 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3240 | */ |
| 3241 | public abstract List<PermissionInfo> queryPermissionsByGroup(String group, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3242 | @PermissionInfoFlags int flags) throws NameNotFoundException; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3243 | |
| 3244 | /** |
Paul Navin | 7b89a7b | 2017-01-26 23:56:08 +0000 | [diff] [blame] | 3245 | * Returns true if Permission Review Mode is enabled, false otherwise. |
| 3246 | * |
| 3247 | * @hide |
| 3248 | */ |
| 3249 | @TestApi |
| 3250 | public abstract boolean isPermissionReviewModeEnabled(); |
| 3251 | |
| 3252 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3253 | * Retrieve all of the information we know about a particular group of |
| 3254 | * permissions. |
| 3255 | * |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3256 | * @param name The fully qualified name (i.e. |
| 3257 | * com.google.permission_group.APPS) of the permission you are |
| 3258 | * interested in. |
| 3259 | * @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] | 3260 | * @return Returns a {@link PermissionGroupInfo} containing information |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 3261 | * about the permission. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3262 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3263 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3264 | */ |
| 3265 | public abstract PermissionGroupInfo getPermissionGroupInfo(String name, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3266 | @PermissionGroupInfoFlags int flags) throws NameNotFoundException; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3267 | |
| 3268 | /** |
| 3269 | * Retrieve all of the known permission groups in the system. |
| 3270 | * |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3271 | * @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] | 3272 | * @return Returns a list of {@link PermissionGroupInfo} containing |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 3273 | * information about all of the known permission groups. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3274 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3275 | public abstract List<PermissionGroupInfo> getAllPermissionGroups( |
| 3276 | @PermissionGroupInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3277 | |
| 3278 | /** |
| 3279 | * Retrieve all of the information we know about a particular |
| 3280 | * package/application. |
| 3281 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3282 | * @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] | 3283 | * application. |
| 3284 | * @param flags Additional option flags to modify the data returned. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 3285 | * @return An {@link ApplicationInfo} containing information about the |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3286 | * package. If flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if |
| 3287 | * the package is not found in the list of installed applications, |
| 3288 | * the application information is retrieved from the list of |
| 3289 | * uninstalled applications (which includes installed applications |
| 3290 | * as well as applications with data directory i.e. applications |
| 3291 | * which had been deleted with {@code DONT_DELETE_DATA} flag set). |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3292 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3293 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3294 | */ |
| 3295 | public abstract ApplicationInfo getApplicationInfo(String packageName, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3296 | @ApplicationInfoFlags int flags) throws NameNotFoundException; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3297 | |
Jeff Sharkey | cd65448 | 2016-01-08 17:42:11 -0700 | [diff] [blame] | 3298 | /** {@hide} */ |
| 3299 | public abstract ApplicationInfo getApplicationInfoAsUser(String packageName, |
| 3300 | @ApplicationInfoFlags int flags, @UserIdInt int userId) throws NameNotFoundException; |
| 3301 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3302 | /** |
| 3303 | * Retrieve all of the information we know about a particular activity |
| 3304 | * class. |
| 3305 | * |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 3306 | * @param component The full component name (i.e. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 3307 | * com.google.apps.contacts/com.google.apps.contacts. |
| 3308 | * ContactsList) of an Activity class. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3309 | * @param flags Additional option flags to modify the data returned. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 3310 | * @return An {@link ActivityInfo} containing information about the |
| 3311 | * activity. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3312 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3313 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3314 | */ |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 3315 | public abstract ActivityInfo getActivityInfo(ComponentName component, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3316 | @ComponentInfoFlags int flags) throws NameNotFoundException; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3317 | |
| 3318 | /** |
| 3319 | * Retrieve all of the information we know about a particular receiver |
| 3320 | * class. |
| 3321 | * |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 3322 | * @param component The full component name (i.e. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 3323 | * com.google.apps.calendar/com.google.apps.calendar. |
| 3324 | * CalendarAlarm) of a Receiver class. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3325 | * @param flags Additional option flags to modify the data returned. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 3326 | * @return An {@link ActivityInfo} containing information about the |
| 3327 | * receiver. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3328 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3329 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3330 | */ |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 3331 | public abstract ActivityInfo getReceiverInfo(ComponentName component, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3332 | @ComponentInfoFlags int flags) throws NameNotFoundException; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3333 | |
| 3334 | /** |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 3335 | * 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] | 3336 | * |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 3337 | * @param component The full component name (i.e. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 3338 | * com.google.apps.media/com.google.apps.media. |
| 3339 | * BackgroundPlayback) of a Service class. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3340 | * @param flags Additional option flags to modify the data returned. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 3341 | * @return A {@link ServiceInfo} object containing information about the |
| 3342 | * service. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3343 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3344 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3345 | */ |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 3346 | public abstract ServiceInfo getServiceInfo(ComponentName component, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3347 | @ComponentInfoFlags int flags) throws NameNotFoundException; |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 3348 | |
| 3349 | /** |
| 3350 | * Retrieve all of the information we know about a particular content |
| 3351 | * provider class. |
| 3352 | * |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 3353 | * @param component The full component name (i.e. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 3354 | * com.google.providers.media/com.google.providers.media. |
| 3355 | * MediaProvider) of a ContentProvider class. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3356 | * @param flags Additional option flags to modify the data returned. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 3357 | * @return A {@link ProviderInfo} object containing information about the |
| 3358 | * provider. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3359 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3360 | * found on the system. |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 3361 | */ |
| 3362 | public abstract ProviderInfo getProviderInfo(ComponentName component, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3363 | @ComponentInfoFlags int flags) throws NameNotFoundException; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3364 | |
| 3365 | /** |
Ricky Wai | 9964f70 | 2018-04-12 17:01:20 +0100 | [diff] [blame] | 3366 | * Return a List of all packages that are installed for the current user. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3367 | * |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3368 | * @param flags Additional option flags to modify the data returned. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 3369 | * @return A List of PackageInfo objects, one for each installed package, |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3370 | * containing information about the package. In the unlikely case |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 3371 | * there are no installed packages, an empty list is returned. If |
| 3372 | * flag {@code MATCH_UNINSTALLED_PACKAGES} is set, the package |
| 3373 | * information is retrieved from the list of uninstalled |
| 3374 | * applications (which includes installed applications as well as |
| 3375 | * applications with data directory i.e. applications which had been |
| 3376 | * deleted with {@code DONT_DELETE_DATA} flag set). |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3377 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3378 | public abstract List<PackageInfo> getInstalledPackages(@PackageInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3379 | |
| 3380 | /** |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3381 | * Return a List of all installed packages that are currently holding any of |
| 3382 | * the given permissions. |
Dianne Hackborn | e799175 | 2013-01-16 17:56:46 -0800 | [diff] [blame] | 3383 | * |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3384 | * @param flags Additional option flags to modify the data returned. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 3385 | * @return A List of PackageInfo objects, one for each installed package |
| 3386 | * that holds any of the permissions that were provided, containing |
| 3387 | * information about the package. If no installed packages hold any |
| 3388 | * of the permissions, an empty list is returned. If flag |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3389 | * {@code MATCH_UNINSTALLED_PACKAGES} is set, the package |
| 3390 | * information is retrieved from the list of uninstalled |
| 3391 | * applications (which includes installed applications as well as |
| 3392 | * applications with data directory i.e. applications which had been |
| 3393 | * deleted with {@code DONT_DELETE_DATA} flag set). |
Dianne Hackborn | e799175 | 2013-01-16 17:56:46 -0800 | [diff] [blame] | 3394 | */ |
| 3395 | public abstract List<PackageInfo> getPackagesHoldingPermissions( |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3396 | String[] permissions, @PackageInfoFlags int flags); |
Dianne Hackborn | e799175 | 2013-01-16 17:56:46 -0800 | [diff] [blame] | 3397 | |
| 3398 | /** |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3399 | * 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] | 3400 | * specific user. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 3401 | * |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3402 | * @param flags Additional option flags to modify the data returned. |
Amith Yamasani | 151ec4c | 2012-09-07 19:25:16 -0700 | [diff] [blame] | 3403 | * @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] | 3404 | * @return A List of PackageInfo objects, one for each installed package, |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3405 | * containing information about the package. In the unlikely case |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 3406 | * there are no installed packages, an empty list is returned. If |
| 3407 | * flag {@code MATCH_UNINSTALLED_PACKAGES} is set, the package |
| 3408 | * information is retrieved from the list of uninstalled |
| 3409 | * applications (which includes installed applications as well as |
| 3410 | * applications with data directory i.e. applications which had been |
| 3411 | * deleted with {@code DONT_DELETE_DATA} flag set). |
Amith Yamasani | 151ec4c | 2012-09-07 19:25:16 -0700 | [diff] [blame] | 3412 | * @hide |
| 3413 | */ |
Todd Kennedy | ef9acb6 | 2018-05-29 15:18:06 -0700 | [diff] [blame] | 3414 | @TestApi |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 3415 | @SystemApi |
Jeff Sharkey | d86b8fe | 2017-06-02 17:36:26 -0600 | [diff] [blame] | 3416 | @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL) |
Jeff Sharkey | e06b4d1 | 2016-01-06 14:51:50 -0700 | [diff] [blame] | 3417 | public abstract List<PackageInfo> getInstalledPackagesAsUser(@PackageInfoFlags int flags, |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3418 | @UserIdInt int userId); |
Amith Yamasani | 151ec4c | 2012-09-07 19:25:16 -0700 | [diff] [blame] | 3419 | |
| 3420 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3421 | * Check whether a particular package has been granted a particular |
| 3422 | * permission. |
| 3423 | * |
Svet Ganov | ad3b297 | 2015-07-07 22:49:17 -0700 | [diff] [blame] | 3424 | * @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] | 3425 | * @param pkgName The name of the package you are checking against. |
| 3426 | * |
| 3427 | * @return If the package has the permission, PERMISSION_GRANTED is |
| 3428 | * returned. If it does not have the permission, PERMISSION_DENIED |
| 3429 | * is returned. |
| 3430 | * |
| 3431 | * @see #PERMISSION_GRANTED |
| 3432 | * @see #PERMISSION_DENIED |
| 3433 | */ |
Tor Norbye | 1c2bf03 | 2015-03-02 10:57:08 -0800 | [diff] [blame] | 3434 | @CheckResult |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 3435 | public abstract @PermissionResult int checkPermission(String permName, String pkgName); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3436 | |
| 3437 | /** |
Svet Ganov | ad3b297 | 2015-07-07 22:49:17 -0700 | [diff] [blame] | 3438 | * Checks whether a particular permissions has been revoked for a |
| 3439 | * package by policy. Typically the device owner or the profile owner |
| 3440 | * may apply such a policy. The user cannot grant policy revoked |
| 3441 | * permissions, hence the only way for an app to get such a permission |
| 3442 | * is by a policy change. |
| 3443 | * |
| 3444 | * @param permName The name of the permission you are checking for. |
| 3445 | * @param pkgName The name of the package you are checking against. |
| 3446 | * |
| 3447 | * @return Whether the permission is restricted by policy. |
| 3448 | */ |
| 3449 | @CheckResult |
Svet Ganov | f1b7f20 | 2015-07-29 08:33:42 -0700 | [diff] [blame] | 3450 | public abstract boolean isPermissionRevokedByPolicy(@NonNull String permName, |
| 3451 | @NonNull String pkgName); |
| 3452 | |
| 3453 | /** |
| 3454 | * Gets the package name of the component controlling runtime permissions. |
| 3455 | * |
| 3456 | * @return The package name. |
| 3457 | * |
| 3458 | * @hide |
| 3459 | */ |
Philip P. Moltmann | eb0a0ae | 2017-06-30 10:55:51 -0700 | [diff] [blame] | 3460 | @TestApi |
Svet Ganov | f1b7f20 | 2015-07-29 08:33:42 -0700 | [diff] [blame] | 3461 | public abstract String getPermissionControllerPackageName(); |
Svet Ganov | ad3b297 | 2015-07-07 22:49:17 -0700 | [diff] [blame] | 3462 | |
| 3463 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3464 | * Add a new dynamic permission to the system. For this to work, your |
| 3465 | * package must have defined a permission tree through the |
| 3466 | * {@link android.R.styleable#AndroidManifestPermissionTree |
| 3467 | * <permission-tree>} tag in its manifest. A package can only add |
| 3468 | * permissions to trees that were defined by either its own package or |
| 3469 | * another with the same user id; a permission is in a tree if it |
| 3470 | * matches the name of the permission tree + ".": for example, |
| 3471 | * "com.foo.bar" is a member of the permission tree "com.foo". |
| 3472 | * |
| 3473 | * <p>It is good to make your permission tree name descriptive, because you |
| 3474 | * are taking possession of that entire set of permission names. Thus, it |
| 3475 | * must be under a domain you control, with a suffix that will not match |
| 3476 | * any normal permissions that may be declared in any applications that |
| 3477 | * are part of that domain. |
| 3478 | * |
| 3479 | * <p>New permissions must be added before |
| 3480 | * any .apks are installed that use those permissions. Permissions you |
| 3481 | * add through this method are remembered across reboots of the device. |
| 3482 | * If the given permission already exists, the info you supply here |
| 3483 | * will be used to update it. |
| 3484 | * |
| 3485 | * @param info Description of the permission to be added. |
| 3486 | * |
| 3487 | * @return Returns true if a new permission was created, false if an |
| 3488 | * existing one was updated. |
| 3489 | * |
| 3490 | * @throws SecurityException if you are not allowed to add the |
| 3491 | * given permission name. |
| 3492 | * |
| 3493 | * @see #removePermission(String) |
| 3494 | */ |
| 3495 | public abstract boolean addPermission(PermissionInfo info); |
| 3496 | |
| 3497 | /** |
Dianne Hackborn | d7c0968 | 2010-03-30 10:42:20 -0700 | [diff] [blame] | 3498 | * Like {@link #addPermission(PermissionInfo)} but asynchronously |
| 3499 | * persists the package manager state after returning from the call, |
| 3500 | * allowing it to return quicker and batch a series of adds at the |
| 3501 | * expense of no guarantee the added permission will be retained if |
| 3502 | * the device is rebooted before it is written. |
| 3503 | */ |
| 3504 | public abstract boolean addPermissionAsync(PermissionInfo info); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3505 | |
Dianne Hackborn | d7c0968 | 2010-03-30 10:42:20 -0700 | [diff] [blame] | 3506 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3507 | * Removes a permission that was previously added with |
| 3508 | * {@link #addPermission(PermissionInfo)}. The same ownership rules apply |
| 3509 | * -- you are only allowed to remove permissions that you are allowed |
| 3510 | * to add. |
| 3511 | * |
| 3512 | * @param name The name of the permission to remove. |
| 3513 | * |
| 3514 | * @throws SecurityException if you are not allowed to remove the |
| 3515 | * given permission name. |
| 3516 | * |
| 3517 | * @see #addPermission(PermissionInfo) |
| 3518 | */ |
| 3519 | public abstract void removePermission(String name); |
| 3520 | |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3521 | /** |
| 3522 | * Permission flags set when granting or revoking a permission. |
| 3523 | * |
| 3524 | * @hide |
| 3525 | */ |
| 3526 | @SystemApi |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3527 | @IntDef(prefix = { "FLAG_PERMISSION_" }, value = { |
| 3528 | FLAG_PERMISSION_USER_SET, |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3529 | FLAG_PERMISSION_USER_FIXED, |
| 3530 | FLAG_PERMISSION_POLICY_FIXED, |
Svet Ganov | b3f22b4 | 2015-05-12 11:01:24 -0700 | [diff] [blame] | 3531 | FLAG_PERMISSION_REVOKE_ON_UPGRADE, |
Svet Ganov | 77ab6a8 | 2015-07-03 12:03:02 -0700 | [diff] [blame] | 3532 | FLAG_PERMISSION_SYSTEM_FIXED, |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3533 | FLAG_PERMISSION_GRANTED_BY_DEFAULT |
| 3534 | }) |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3535 | @Retention(RetentionPolicy.SOURCE) |
| 3536 | public @interface PermissionFlags {} |
| 3537 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3538 | /** |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3539 | * Grant a runtime permission to an application which the application does not |
| 3540 | * already have. The permission must have been requested by the application. |
| 3541 | * If the application is not allowed to hold the permission, a {@link |
Ruben Brunk | 12ab5e1 | 2016-11-10 15:27:30 -0800 | [diff] [blame] | 3542 | * java.lang.SecurityException} is thrown. If the package or permission is |
| 3543 | * invalid, a {@link java.lang.IllegalArgumentException} is thrown. |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3544 | * <p> |
| 3545 | * <strong>Note: </strong>Using this API requires holding |
Todd Kennedy | a8eb6a8 | 2016-07-28 16:35:42 -0700 | [diff] [blame] | 3546 | * android.permission.GRANT_RUNTIME_PERMISSIONS and if the user id is |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3547 | * not the current user android.permission.INTERACT_ACROSS_USERS_FULL. |
| 3548 | * </p> |
Nick Kralevich | 035f80d | 2013-03-27 15:20:08 -0700 | [diff] [blame] | 3549 | * |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3550 | * @param packageName The package to which to grant the permission. |
| 3551 | * @param permissionName The permission name to grant. |
| 3552 | * @param user The user for which to grant the permission. |
| 3553 | * |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3554 | * @see #revokeRuntimePermission(String, String, android.os.UserHandle) |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3555 | * |
| 3556 | * @hide |
Nick Kralevich | 035f80d | 2013-03-27 15:20:08 -0700 | [diff] [blame] | 3557 | */ |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3558 | @SystemApi |
Jeff Sharkey | d86b8fe | 2017-06-02 17:36:26 -0600 | [diff] [blame] | 3559 | @RequiresPermission(android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS) |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3560 | public abstract void grantRuntimePermission(@NonNull String packageName, |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3561 | @NonNull String permissionName, @NonNull UserHandle user); |
Nick Kralevich | 035f80d | 2013-03-27 15:20:08 -0700 | [diff] [blame] | 3562 | |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3563 | /** |
| 3564 | * Revoke a runtime permission that was previously granted by {@link |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3565 | * #grantRuntimePermission(String, String, android.os.UserHandle)}. The |
| 3566 | * permission must have been requested by and granted to the application. |
| 3567 | * If the application is not allowed to hold the permission, a {@link |
Ruben Brunk | 12ab5e1 | 2016-11-10 15:27:30 -0800 | [diff] [blame] | 3568 | * java.lang.SecurityException} is thrown. If the package or permission is |
| 3569 | * invalid, a {@link java.lang.IllegalArgumentException} is thrown. |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3570 | * <p> |
| 3571 | * <strong>Note: </strong>Using this API requires holding |
Todd Kennedy | a8eb6a8 | 2016-07-28 16:35:42 -0700 | [diff] [blame] | 3572 | * android.permission.REVOKE_RUNTIME_PERMISSIONS and if the user id is |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3573 | * not the current user android.permission.INTERACT_ACROSS_USERS_FULL. |
| 3574 | * </p> |
| 3575 | * |
| 3576 | * @param packageName The package from which to revoke the permission. |
| 3577 | * @param permissionName The permission name to revoke. |
| 3578 | * @param user The user for which to revoke the permission. |
| 3579 | * |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3580 | * @see #grantRuntimePermission(String, String, android.os.UserHandle) |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3581 | * |
| 3582 | * @hide |
| 3583 | */ |
| 3584 | @SystemApi |
Jeff Sharkey | d86b8fe | 2017-06-02 17:36:26 -0600 | [diff] [blame] | 3585 | @RequiresPermission(android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS) |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3586 | public abstract void revokeRuntimePermission(@NonNull String packageName, |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3587 | @NonNull String permissionName, @NonNull UserHandle user); |
| 3588 | |
| 3589 | /** |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3590 | * Gets the state flags associated with a permission. |
| 3591 | * |
| 3592 | * @param permissionName The permission for which to get the flags. |
| 3593 | * @param packageName The package name for which to get the flags. |
| 3594 | * @param user The user for which to get permission flags. |
| 3595 | * @return The permission flags. |
| 3596 | * |
| 3597 | * @hide |
| 3598 | */ |
| 3599 | @SystemApi |
Jeff Sharkey | d86b8fe | 2017-06-02 17:36:26 -0600 | [diff] [blame] | 3600 | @RequiresPermission(anyOf = { |
| 3601 | android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS, |
| 3602 | android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS |
| 3603 | }) |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3604 | public abstract @PermissionFlags int getPermissionFlags(String permissionName, |
| 3605 | String packageName, @NonNull UserHandle user); |
| 3606 | |
| 3607 | /** |
| 3608 | * Updates the flags associated with a permission by replacing the flags in |
| 3609 | * the specified mask with the provided flag values. |
| 3610 | * |
| 3611 | * @param permissionName The permission for which to update the flags. |
| 3612 | * @param packageName The package name for which to update the flags. |
| 3613 | * @param flagMask The flags which to replace. |
| 3614 | * @param flagValues The flags with which to replace. |
| 3615 | * @param user The user for which to update the permission flags. |
| 3616 | * |
| 3617 | * @hide |
| 3618 | */ |
| 3619 | @SystemApi |
Jeff Sharkey | d86b8fe | 2017-06-02 17:36:26 -0600 | [diff] [blame] | 3620 | @RequiresPermission(anyOf = { |
| 3621 | android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS, |
| 3622 | android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS |
| 3623 | }) |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3624 | public abstract void updatePermissionFlags(String permissionName, |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3625 | String packageName, @PermissionFlags int flagMask, @PermissionFlags int flagValues, |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3626 | @NonNull UserHandle user); |
| 3627 | |
| 3628 | /** |
Svetoslav | 20770dd | 2015-05-29 15:43:04 -0700 | [diff] [blame] | 3629 | * Gets whether you should show UI with rationale for requesting a permission. |
| 3630 | * You should do this only if you do not have the permission and the context in |
| 3631 | * which the permission is requested does not clearly communicate to the user |
| 3632 | * what would be the benefit from grating this permission. |
| 3633 | * |
| 3634 | * @param permission A permission your app wants to request. |
| 3635 | * @return Whether you can show permission rationale UI. |
| 3636 | * |
| 3637 | * @hide |
| 3638 | */ |
| 3639 | public abstract boolean shouldShowRequestPermissionRationale(String permission); |
| 3640 | |
| 3641 | /** |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3642 | * Returns an {@link android.content.Intent} suitable for passing to |
| 3643 | * {@link android.app.Activity#startActivityForResult(android.content.Intent, int)} |
| 3644 | * which prompts the user to grant permissions to this application. |
| 3645 | * |
| 3646 | * @throws NullPointerException if {@code permissions} is {@code null} or empty. |
| 3647 | * |
| 3648 | * @hide |
| 3649 | */ |
| 3650 | public Intent buildRequestPermissionsIntent(@NonNull String[] permissions) { |
| 3651 | if (ArrayUtils.isEmpty(permissions)) { |
Svet Ganov | f66381c | 2016-02-18 20:02:36 -0800 | [diff] [blame] | 3652 | throw new IllegalArgumentException("permission cannot be null or empty"); |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3653 | } |
| 3654 | Intent intent = new Intent(ACTION_REQUEST_PERMISSIONS); |
| 3655 | intent.putExtra(EXTRA_REQUEST_PERMISSIONS_NAMES, permissions); |
Svet Ganov | f1b7f20 | 2015-07-29 08:33:42 -0700 | [diff] [blame] | 3656 | intent.setPackage(getPermissionControllerPackageName()); |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3657 | return intent; |
Nick Kralevich | 035f80d | 2013-03-27 15:20:08 -0700 | [diff] [blame] | 3658 | } |
| 3659 | |
| 3660 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3661 | * Compare the signatures of two packages to determine if the same |
| 3662 | * signature appears in both of them. If they do contain the same |
| 3663 | * signature, then they are allowed special privileges when working |
| 3664 | * with each other: they can share the same user-id, run instrumentation |
| 3665 | * against each other, etc. |
| 3666 | * |
| 3667 | * @param pkg1 First package name whose signature will be compared. |
| 3668 | * @param pkg2 Second package name whose signature will be compared. |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 3669 | * |
| 3670 | * @return Returns an integer indicating whether all signatures on the |
| 3671 | * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if |
| 3672 | * all signatures match or < 0 if there is not a match ({@link |
| 3673 | * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}). |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3674 | * |
Dianne Hackborn | 766cbfe | 2009-08-12 18:33:39 -0700 | [diff] [blame] | 3675 | * @see #checkSignatures(int, int) |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3676 | */ |
Tor Norbye | 1c2bf03 | 2015-03-02 10:57:08 -0800 | [diff] [blame] | 3677 | @CheckResult |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 3678 | public abstract @SignatureResult int checkSignatures(String pkg1, String pkg2); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3679 | |
| 3680 | /** |
Dianne Hackborn | 766cbfe | 2009-08-12 18:33:39 -0700 | [diff] [blame] | 3681 | * Like {@link #checkSignatures(String, String)}, but takes UIDs of |
| 3682 | * the two packages to be checked. This can be useful, for example, |
| 3683 | * when doing the check in an IPC, where the UID is the only identity |
| 3684 | * available. It is functionally identical to determining the package |
| 3685 | * associated with the UIDs and checking their signatures. |
| 3686 | * |
Joe Onorato | 25660ec | 2009-08-12 22:40:37 -0700 | [diff] [blame] | 3687 | * @param uid1 First UID whose signature will be compared. |
| 3688 | * @param uid2 Second UID whose signature will be compared. |
Dianne Hackborn | 766cbfe | 2009-08-12 18:33:39 -0700 | [diff] [blame] | 3689 | * |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 3690 | * @return Returns an integer indicating whether all signatures on the |
| 3691 | * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if |
| 3692 | * all signatures match or < 0 if there is not a match ({@link |
| 3693 | * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}). |
| 3694 | * |
| 3695 | * @see #checkSignatures(String, String) |
Dianne Hackborn | 766cbfe | 2009-08-12 18:33:39 -0700 | [diff] [blame] | 3696 | */ |
Tor Norbye | 1c2bf03 | 2015-03-02 10:57:08 -0800 | [diff] [blame] | 3697 | @CheckResult |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 3698 | public abstract @SignatureResult int checkSignatures(int uid1, int uid2); |
Dianne Hackborn | 766cbfe | 2009-08-12 18:33:39 -0700 | [diff] [blame] | 3699 | |
| 3700 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3701 | * Retrieve the names of all packages that are associated with a particular |
| 3702 | * user id. In most cases, this will be a single package name, the package |
| 3703 | * that has been assigned that user id. Where there are multiple packages |
| 3704 | * sharing the same user id through the "sharedUserId" mechanism, all |
| 3705 | * packages with that id will be returned. |
| 3706 | * |
| 3707 | * @param uid The user id for which you would like to retrieve the |
| 3708 | * associated packages. |
| 3709 | * |
| 3710 | * @return Returns an array of one or more packages assigned to the user |
| 3711 | * id, or null if there are no known packages with the given id. |
| 3712 | */ |
Jeff Sharkey | 377ded0f | 2016-01-10 13:15:41 -0700 | [diff] [blame] | 3713 | public abstract @Nullable String[] getPackagesForUid(int uid); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3714 | |
| 3715 | /** |
Michal Karpinski | cb67dc9 | 2016-12-13 18:20:23 +0000 | [diff] [blame] | 3716 | * Retrieve the official name associated with a uid. This name is |
Jonathan Basseri | 7ea3a33 | 2015-05-12 19:39:22 -0700 | [diff] [blame] | 3717 | * guaranteed to never change, though it is possible for the underlying |
Michal Karpinski | cb67dc9 | 2016-12-13 18:20:23 +0000 | [diff] [blame] | 3718 | * uid to be changed. That is, if you are storing information about |
| 3719 | * uids in persistent storage, you should use the string returned |
| 3720 | * by this function instead of the raw uid. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3721 | * |
Michal Karpinski | cb67dc9 | 2016-12-13 18:20:23 +0000 | [diff] [blame] | 3722 | * @param uid The uid for which you would like to retrieve a name. |
| 3723 | * @return Returns a unique name for the given uid, or null if the |
| 3724 | * uid is not currently assigned. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3725 | */ |
Jeff Sharkey | 377ded0f | 2016-01-10 13:15:41 -0700 | [diff] [blame] | 3726 | public abstract @Nullable String getNameForUid(int uid); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3727 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3728 | /** |
Todd Kennedy | 9da8b8a7 | 2017-07-25 15:38:39 -0700 | [diff] [blame] | 3729 | * Retrieves the official names associated with each given uid. |
| 3730 | * @see #getNameForUid(int) |
| 3731 | * |
| 3732 | * @hide |
| 3733 | */ |
Philip P. Moltmann | abeb04e | 2018-03-26 10:15:23 -0700 | [diff] [blame] | 3734 | @TestApi |
Todd Kennedy | 9da8b8a7 | 2017-07-25 15:38:39 -0700 | [diff] [blame] | 3735 | public abstract @Nullable String[] getNamesForUids(int[] uids); |
| 3736 | |
| 3737 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3738 | * Return the user id associated with a shared user name. Multiple |
| 3739 | * applications can specify a shared user name in their manifest and thus |
| 3740 | * end up using a common uid. This might be used for new applications |
| 3741 | * that use an existing shared user name and need to know the uid of the |
| 3742 | * shared user. |
| 3743 | * |
| 3744 | * @param sharedUserName The shared user name whose uid is to be retrieved. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3745 | * @return Returns the UID associated with the shared user. |
| 3746 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3747 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3748 | * @hide |
| 3749 | */ |
| 3750 | public abstract int getUidForSharedUser(String sharedUserName) |
| 3751 | throws NameNotFoundException; |
| 3752 | |
| 3753 | /** |
Ricky Wai | 9964f70 | 2018-04-12 17:01:20 +0100 | [diff] [blame] | 3754 | * Return a List of all application packages that are installed for the |
| 3755 | * current user. If flag GET_UNINSTALLED_PACKAGES has been set, a list of all |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3756 | * applications including those deleted with {@code DONT_DELETE_DATA} |
| 3757 | * (partially installed apps with data directory) will be returned. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3758 | * |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3759 | * @param flags Additional option flags to modify the data returned. |
| 3760 | * @return A List of ApplicationInfo objects, one for each installed |
| 3761 | * application. In the unlikely case there are no installed |
| 3762 | * packages, an empty list is returned. If flag |
| 3763 | * {@code MATCH_UNINSTALLED_PACKAGES} is set, the application |
| 3764 | * information is retrieved from the list of uninstalled |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 3765 | * applications (which includes installed applications as well as |
| 3766 | * applications with data directory i.e. applications which had been |
| 3767 | * deleted with {@code DONT_DELETE_DATA} flag set). |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3768 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3769 | public abstract List<ApplicationInfo> getInstalledApplications(@ApplicationInfoFlags int flags); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3770 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3771 | /** |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3772 | * Return a List of all application packages that are installed on the |
| 3773 | * device, for a specific user. If flag GET_UNINSTALLED_PACKAGES has been |
| 3774 | * set, a list of all applications including those deleted with |
| 3775 | * {@code DONT_DELETE_DATA} (partially installed apps with data directory) |
Bartosz Fabianowski | 1133424 | 2016-11-17 20:49:16 +0100 | [diff] [blame] | 3776 | * will be returned. |
| 3777 | * |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3778 | * @param flags Additional option flags to modify the data returned. |
| 3779 | * @param userId The user for whom the installed applications are to be |
| 3780 | * listed |
| 3781 | * @return A List of ApplicationInfo objects, one for each installed |
| 3782 | * application. In the unlikely case there are no installed |
| 3783 | * packages, an empty list is returned. If flag |
| 3784 | * {@code MATCH_UNINSTALLED_PACKAGES} is set, the application |
| 3785 | * information is retrieved from the list of uninstalled |
Bartosz Fabianowski | 1133424 | 2016-11-17 20:49:16 +0100 | [diff] [blame] | 3786 | * applications (which includes installed applications as well as |
| 3787 | * applications with data directory i.e. applications which had been |
| 3788 | * deleted with {@code DONT_DELETE_DATA} flag set). |
| 3789 | * @hide |
Bartosz Fabianowski | 1133424 | 2016-11-17 20:49:16 +0100 | [diff] [blame] | 3790 | */ |
Hongming Jin | 83e1626 | 2018-05-18 10:47:57 -0700 | [diff] [blame] | 3791 | @TestApi |
Bartosz Fabianowski | 1133424 | 2016-11-17 20:49:16 +0100 | [diff] [blame] | 3792 | public abstract List<ApplicationInfo> getInstalledApplicationsAsUser( |
| 3793 | @ApplicationInfoFlags int flags, @UserIdInt int userId); |
| 3794 | |
| 3795 | /** |
Jeff Sharkey | 910e081 | 2017-04-21 16:29:27 -0600 | [diff] [blame] | 3796 | * Gets the instant applications the user recently used. |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3797 | * |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3798 | * @return The instant app list. |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3799 | * |
| 3800 | * @hide |
| 3801 | */ |
Todd Kennedy | 9c9fdf2 | 2017-03-06 10:58:27 -0800 | [diff] [blame] | 3802 | @SystemApi |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3803 | @RequiresPermission(Manifest.permission.ACCESS_INSTANT_APPS) |
| 3804 | public abstract @NonNull List<InstantAppInfo> getInstantApps(); |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3805 | |
| 3806 | /** |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3807 | * Gets the icon for an instant application. |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3808 | * |
| 3809 | * @param packageName The app package name. |
| 3810 | * |
| 3811 | * @hide |
| 3812 | */ |
Todd Kennedy | 9c9fdf2 | 2017-03-06 10:58:27 -0800 | [diff] [blame] | 3813 | @SystemApi |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3814 | @RequiresPermission(Manifest.permission.ACCESS_INSTANT_APPS) |
| 3815 | public abstract @Nullable Drawable getInstantAppIcon(String packageName); |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3816 | |
| 3817 | /** |
David Christie | 31a1655 | 2017-03-01 15:08:45 -0800 | [diff] [blame] | 3818 | * Gets whether this application is an instant app. |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3819 | * |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3820 | * @return Whether caller is an instant app. |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3821 | * |
David Christie | 31a1655 | 2017-03-01 15:08:45 -0800 | [diff] [blame] | 3822 | * @see #isInstantApp(String) |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 3823 | * @see #updateInstantAppCookie(byte[]) |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3824 | * @see #getInstantAppCookie() |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 3825 | * @see #getInstantAppCookieMaxBytes() |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3826 | */ |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3827 | public abstract boolean isInstantApp(); |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3828 | |
| 3829 | /** |
David Christie | 31a1655 | 2017-03-01 15:08:45 -0800 | [diff] [blame] | 3830 | * Gets whether the given package is an instant app. |
| 3831 | * |
| 3832 | * @param packageName The package to check |
| 3833 | * @return Whether the given package is an instant app. |
| 3834 | * |
| 3835 | * @see #isInstantApp() |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 3836 | * @see #updateInstantAppCookie(byte[]) |
David Christie | 31a1655 | 2017-03-01 15:08:45 -0800 | [diff] [blame] | 3837 | * @see #getInstantAppCookie() |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 3838 | * @see #getInstantAppCookieMaxBytes() |
| 3839 | * @see #clearInstantAppCookie() |
David Christie | 31a1655 | 2017-03-01 15:08:45 -0800 | [diff] [blame] | 3840 | */ |
| 3841 | public abstract boolean isInstantApp(String packageName); |
| 3842 | |
| 3843 | /** |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3844 | * 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] | 3845 | * can store on the device. |
| 3846 | * |
| 3847 | * @return The max cookie size in bytes. |
| 3848 | * |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3849 | * @see #isInstantApp() |
David Christie | 31a1655 | 2017-03-01 15:08:45 -0800 | [diff] [blame] | 3850 | * @see #isInstantApp(String) |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 3851 | * @see #updateInstantAppCookie(byte[]) |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3852 | * @see #getInstantAppCookie() |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 3853 | * @see #clearInstantAppCookie() |
| 3854 | */ |
| 3855 | public abstract int getInstantAppCookieMaxBytes(); |
| 3856 | |
| 3857 | /** |
Daniel Cashman | 5cdda34 | 2018-01-19 07:22:52 -0800 | [diff] [blame] | 3858 | * deprecated |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 3859 | * @hide |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3860 | */ |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3861 | public abstract int getInstantAppCookieMaxSize(); |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3862 | |
| 3863 | /** |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3864 | * Gets the instant application cookie for this app. Non |
| 3865 | * instant apps and apps that were instant but were upgraded |
| 3866 | * to normal apps can still access this API. For instant apps |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 3867 | * this cookie is cached for some time after uninstall while for |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3868 | * normal apps the cookie is deleted after the app is uninstalled. |
| 3869 | * The cookie is always present while the app is installed. |
| 3870 | * |
| 3871 | * @return The cookie. |
| 3872 | * |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3873 | * @see #isInstantApp() |
David Christie | 31a1655 | 2017-03-01 15:08:45 -0800 | [diff] [blame] | 3874 | * @see #isInstantApp(String) |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 3875 | * @see #updateInstantAppCookie(byte[]) |
| 3876 | * @see #getInstantAppCookieMaxBytes() |
| 3877 | * @see #clearInstantAppCookie() |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3878 | */ |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3879 | public abstract @NonNull byte[] getInstantAppCookie(); |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3880 | |
| 3881 | /** |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 3882 | * Clears the instant application cookie for the calling app. |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3883 | * |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3884 | * @see #isInstantApp() |
David Christie | 31a1655 | 2017-03-01 15:08:45 -0800 | [diff] [blame] | 3885 | * @see #isInstantApp(String) |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 3886 | * @see #getInstantAppCookieMaxBytes() |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3887 | * @see #getInstantAppCookie() |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 3888 | * @see #clearInstantAppCookie() |
| 3889 | */ |
| 3890 | public abstract void clearInstantAppCookie(); |
| 3891 | |
| 3892 | /** |
| 3893 | * Updates the instant application cookie for the calling app. Non |
| 3894 | * instant apps and apps that were instant but were upgraded |
| 3895 | * to normal apps can still access this API. For instant apps |
| 3896 | * this cookie is cached for some time after uninstall while for |
| 3897 | * normal apps the cookie is deleted after the app is uninstalled. |
| 3898 | * The cookie is always present while the app is installed. The |
| 3899 | * cookie size is limited by {@link #getInstantAppCookieMaxBytes()}. |
| 3900 | * Passing <code>null</code> or an empty array clears the cookie. |
| 3901 | * </p> |
| 3902 | * |
| 3903 | * @param cookie The cookie data. |
| 3904 | * |
| 3905 | * @see #isInstantApp() |
| 3906 | * @see #isInstantApp(String) |
| 3907 | * @see #getInstantAppCookieMaxBytes() |
| 3908 | * @see #getInstantAppCookie() |
| 3909 | * @see #clearInstantAppCookie() |
| 3910 | * |
| 3911 | * @throws IllegalArgumentException if the array exceeds max cookie size. |
| 3912 | */ |
| 3913 | public abstract void updateInstantAppCookie(@Nullable byte[] cookie); |
| 3914 | |
| 3915 | /** |
| 3916 | * @removed |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3917 | */ |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 3918 | public abstract boolean setInstantAppCookie(@Nullable byte[] cookie); |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 3919 | |
| 3920 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3921 | * Get a list of shared libraries that are available on the |
| 3922 | * system. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3923 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3924 | * @return An array of shared library names that are |
| 3925 | * available on the system, or null if none are installed. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3926 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3927 | */ |
| 3928 | public abstract String[] getSystemSharedLibraryNames(); |
| 3929 | |
| 3930 | /** |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 3931 | * Get a list of shared libraries on the device. |
| 3932 | * |
| 3933 | * @param flags To filter the libraries to return. |
| 3934 | * @return The shared library list. |
| 3935 | * |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 3936 | * @see #MATCH_UNINSTALLED_PACKAGES |
| 3937 | */ |
| 3938 | public abstract @NonNull List<SharedLibraryInfo> getSharedLibraries( |
| 3939 | @InstallFlags int flags); |
| 3940 | |
| 3941 | /** |
| 3942 | * Get a list of shared libraries on the device. |
| 3943 | * |
| 3944 | * @param flags To filter the libraries to return. |
| 3945 | * @param userId The user to query for. |
| 3946 | * @return The shared library list. |
| 3947 | * |
| 3948 | * @see #MATCH_FACTORY_ONLY |
| 3949 | * @see #MATCH_KNOWN_PACKAGES |
| 3950 | * @see #MATCH_ANY_USER |
| 3951 | * @see #MATCH_UNINSTALLED_PACKAGES |
| 3952 | * |
| 3953 | * @hide |
| 3954 | */ |
| 3955 | public abstract @NonNull List<SharedLibraryInfo> getSharedLibrariesAsUser( |
| 3956 | @InstallFlags int flags, @UserIdInt int userId); |
| 3957 | |
| 3958 | /** |
Svet Ganov | d7b1f411 | 2016-02-09 18:49:23 -0800 | [diff] [blame] | 3959 | * Get the name of the package hosting the services shared library. |
| 3960 | * |
| 3961 | * @return The library host package. |
| 3962 | * |
| 3963 | * @hide |
| 3964 | */ |
Philip P. Moltmann | f80809f | 2018-04-04 11:20:44 -0700 | [diff] [blame] | 3965 | @TestApi |
Svetoslav Ganov | a9c2500 | 2016-04-13 19:25:56 -0700 | [diff] [blame] | 3966 | public abstract @NonNull String getServicesSystemSharedLibraryPackageName(); |
| 3967 | |
| 3968 | /** |
| 3969 | * Get the name of the package hosting the shared components shared library. |
| 3970 | * |
| 3971 | * @return The library host package. |
| 3972 | * |
| 3973 | * @hide |
| 3974 | */ |
Philip P. Moltmann | f80809f | 2018-04-04 11:20:44 -0700 | [diff] [blame] | 3975 | @TestApi |
Svetoslav Ganov | a9c2500 | 2016-04-13 19:25:56 -0700 | [diff] [blame] | 3976 | public abstract @NonNull String getSharedSystemSharedLibraryPackageName(); |
Svet Ganov | d7b1f411 | 2016-02-09 18:49:23 -0800 | [diff] [blame] | 3977 | |
| 3978 | /** |
Todd Kennedy | 9106c64 | 2017-02-08 14:16:53 -0800 | [diff] [blame] | 3979 | * Returns the names of the packages that have been changed |
| 3980 | * [eg. added, removed or updated] since the given sequence |
| 3981 | * number. |
| 3982 | * <p>If no packages have been changed, returns <code>null</code>. |
| 3983 | * <p>The sequence number starts at <code>0</code> and is |
| 3984 | * reset every boot. |
Todd Kennedy | 8fddf9d | 2017-04-17 15:16:12 -0700 | [diff] [blame] | 3985 | * @param sequenceNumber The first sequence number for which to retrieve package changes. |
| 3986 | * @see Settings.Global#BOOT_COUNT |
Todd Kennedy | 9106c64 | 2017-02-08 14:16:53 -0800 | [diff] [blame] | 3987 | */ |
| 3988 | public abstract @Nullable ChangedPackages getChangedPackages( |
| 3989 | @IntRange(from=0) int sequenceNumber); |
| 3990 | |
| 3991 | /** |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 3992 | * Get a list of features that are available on the |
| 3993 | * system. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3994 | * |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 3995 | * @return An array of FeatureInfo classes describing the features |
| 3996 | * that are available on the system, or null if there are none(!!). |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 3997 | */ |
| 3998 | public abstract FeatureInfo[] getSystemAvailableFeatures(); |
| 3999 | |
| 4000 | /** |
Jeff Sharkey | 115d2c1 | 2016-02-15 17:25:57 -0700 | [diff] [blame] | 4001 | * Check whether the given feature name is one of the available features as |
| 4002 | * returned by {@link #getSystemAvailableFeatures()}. This tests for the |
| 4003 | * presence of <em>any</em> version of the given feature name; use |
| 4004 | * {@link #hasSystemFeature(String, int)} to check for a minimum version. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 4005 | * |
Jeff Sharkey | 115d2c1 | 2016-02-15 17:25:57 -0700 | [diff] [blame] | 4006 | * @return Returns true if the devices supports the feature, else false. |
Dianne Hackborn | 039c68e | 2009-09-26 16:39:23 -0700 | [diff] [blame] | 4007 | */ |
| 4008 | public abstract boolean hasSystemFeature(String name); |
| 4009 | |
| 4010 | /** |
Jeff Sharkey | 115d2c1 | 2016-02-15 17:25:57 -0700 | [diff] [blame] | 4011 | * Check whether the given feature name and version is one of the available |
| 4012 | * features as returned by {@link #getSystemAvailableFeatures()}. Since |
| 4013 | * features are defined to always be backwards compatible, this returns true |
| 4014 | * if the available feature version is greater than or equal to the |
| 4015 | * requested version. |
| 4016 | * |
| 4017 | * @return Returns true if the devices supports the feature, else false. |
| 4018 | */ |
| 4019 | public abstract boolean hasSystemFeature(String name, int version); |
| 4020 | |
| 4021 | /** |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4022 | * Determine the best action to perform for a given Intent. This is how |
| 4023 | * {@link Intent#resolveActivity} finds an activity if a class has not been |
| 4024 | * explicitly specified. |
| 4025 | * <p> |
| 4026 | * <em>Note:</em> if using an implicit Intent (without an explicit |
| 4027 | * ComponentName specified), be sure to consider whether to set the |
| 4028 | * {@link #MATCH_DEFAULT_ONLY} only flag. You need to do so to resolve the |
| 4029 | * activity in the same way that |
| 4030 | * {@link android.content.Context#startActivity(Intent)} and |
Dianne Hackborn | 4d023d21 | 2010-10-01 13:41:04 -0700 | [diff] [blame] | 4031 | * {@link android.content.Intent#resolveActivity(PackageManager) |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4032 | * Intent.resolveActivity(PackageManager)} do. |
| 4033 | * </p> |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 4034 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4035 | * @param intent An intent containing all of the desired specification |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4036 | * (action, data, type, category, and/or component). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4037 | * @param flags Additional option flags to modify the data returned. The |
| 4038 | * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the |
| 4039 | * resolution to only those activities that support the |
| 4040 | * {@link android.content.Intent#CATEGORY_DEFAULT}. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 4041 | * @return Returns a ResolveInfo object containing the final activity intent |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4042 | * that was determined to be the best action. Returns null if no |
Mike LeBeau | bd3f527 | 2010-02-18 19:27:17 -0800 | [diff] [blame] | 4043 | * matching activity was found. If multiple matching activities are |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 4044 | * found and there is no default set, returns a ResolveInfo object |
Mike LeBeau | bd3f527 | 2010-02-18 19:27:17 -0800 | [diff] [blame] | 4045 | * containing something else, such as the activity resolver. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4046 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4047 | public abstract ResolveInfo resolveActivity(Intent intent, @ResolveInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4048 | |
| 4049 | /** |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4050 | * Determine the best action to perform for a given Intent for a given user. |
| 4051 | * This is how {@link Intent#resolveActivity} finds an activity if a class |
| 4052 | * has not been explicitly specified. |
| 4053 | * <p> |
| 4054 | * <em>Note:</em> if using an implicit Intent (without an explicit |
| 4055 | * ComponentName specified), be sure to consider whether to set the |
| 4056 | * {@link #MATCH_DEFAULT_ONLY} only flag. You need to do so to resolve the |
| 4057 | * activity in the same way that |
| 4058 | * {@link android.content.Context#startActivity(Intent)} and |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4059 | * {@link android.content.Intent#resolveActivity(PackageManager) |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4060 | * Intent.resolveActivity(PackageManager)} do. |
| 4061 | * </p> |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4062 | * |
| 4063 | * @param intent An intent containing all of the desired specification |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4064 | * (action, data, type, category, and/or component). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4065 | * @param flags Additional option flags to modify the data returned. The |
| 4066 | * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the |
| 4067 | * resolution to only those activities that support the |
| 4068 | * {@link android.content.Intent#CATEGORY_DEFAULT}. |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4069 | * @param userId The user id. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 4070 | * @return Returns a ResolveInfo object containing the final activity intent |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4071 | * that was determined to be the best action. Returns null if no |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4072 | * matching activity was found. If multiple matching activities are |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 4073 | * found and there is no default set, returns a ResolveInfo object |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4074 | * containing something else, such as the activity resolver. |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4075 | * @hide |
| 4076 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4077 | public abstract ResolveInfo resolveActivityAsUser(Intent intent, @ResolveInfoFlags int flags, |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 4078 | @UserIdInt int userId); |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4079 | |
| 4080 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4081 | * Retrieve all activities that can be performed for the given intent. |
| 4082 | * |
| 4083 | * @param intent The desired intent as per resolveActivity(). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4084 | * @param flags Additional option flags to modify the data returned. The |
| 4085 | * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the |
| 4086 | * resolution to only those activities that support the |
| 4087 | * {@link android.content.Intent#CATEGORY_DEFAULT}. Or, set |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4088 | * {@link #MATCH_ALL} to prevent any filtering of the results. |
| 4089 | * @return Returns a List of ResolveInfo objects containing one entry for |
| 4090 | * each matching activity, ordered from best to worst. In other |
| 4091 | * words, the first item is what would be returned by |
| 4092 | * {@link #resolveActivity}. If there are no matching activities, an |
| 4093 | * empty list is returned. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4094 | */ |
| 4095 | public abstract List<ResolveInfo> queryIntentActivities(Intent intent, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4096 | @ResolveInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4097 | |
| 4098 | /** |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4099 | * Retrieve all activities that can be performed for the given intent, for a |
| 4100 | * specific user. |
Amith Yamasani | 151ec4c | 2012-09-07 19:25:16 -0700 | [diff] [blame] | 4101 | * |
| 4102 | * @param intent The desired intent as per resolveActivity(). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4103 | * @param flags Additional option flags to modify the data returned. The |
| 4104 | * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the |
| 4105 | * resolution to only those activities that support the |
| 4106 | * {@link android.content.Intent#CATEGORY_DEFAULT}. Or, set |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4107 | * {@link #MATCH_ALL} to prevent any filtering of the results. |
| 4108 | * @return Returns a List of ResolveInfo objects containing one entry for |
| 4109 | * each matching activity, ordered from best to worst. In other |
| 4110 | * words, the first item is what would be returned by |
| 4111 | * {@link #resolveActivity}. If there are no matching activities, an |
| 4112 | * empty list is returned. |
Amith Yamasani | 151ec4c | 2012-09-07 19:25:16 -0700 | [diff] [blame] | 4113 | * @hide |
| 4114 | */ |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4115 | public abstract List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent, |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 4116 | @ResolveInfoFlags int flags, @UserIdInt int userId); |
Amith Yamasani | 151ec4c | 2012-09-07 19:25:16 -0700 | [diff] [blame] | 4117 | |
| 4118 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4119 | * 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] | 4120 | * similar options. This is like {@link #queryIntentActivities}, except it |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4121 | * also allows you to supply a list of more explicit Intents that you would |
| 4122 | * like to resolve to particular options, and takes care of returning the |
| 4123 | * final ResolveInfo list in a reasonable order, with no duplicates, based |
| 4124 | * on those inputs. |
| 4125 | * |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4126 | * @param caller The class name of the activity that is making the request. |
| 4127 | * This activity will never appear in the output list. Can be |
| 4128 | * null. |
| 4129 | * @param specifics An array of Intents that should be resolved to the first |
| 4130 | * specific results. Can be null. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4131 | * @param intent The desired intent as per resolveActivity(). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4132 | * @param flags Additional option flags to modify the data returned. The |
| 4133 | * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the |
| 4134 | * resolution to only those activities that support the |
| 4135 | * {@link android.content.Intent#CATEGORY_DEFAULT}. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4136 | * @return Returns a List of ResolveInfo objects containing one entry for |
| 4137 | * each matching activity. The list is ordered first by all of the |
| 4138 | * intents resolved in <var>specifics</var> and then any additional |
| 4139 | * activities that can handle <var>intent</var> but did not get |
| 4140 | * included by one of the <var>specifics</var> intents. If there are |
| 4141 | * no matching activities, an empty list is returned. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4142 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 4143 | public abstract List<ResolveInfo> queryIntentActivityOptions(@Nullable ComponentName caller, |
| 4144 | @Nullable Intent[] specifics, Intent intent, @ResolveInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4145 | |
| 4146 | /** |
| 4147 | * Retrieve all receivers that can handle a broadcast of the given intent. |
| 4148 | * |
| 4149 | * @param intent The desired intent as per resolveActivity(). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4150 | * @param flags Additional option flags to modify the data returned. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4151 | * @return Returns a List of ResolveInfo objects containing one entry for |
| 4152 | * each matching receiver, ordered from best to worst. If there are |
| 4153 | * 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] | 4154 | */ |
| 4155 | public abstract List<ResolveInfo> queryBroadcastReceivers(Intent intent, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4156 | @ResolveInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4157 | |
| 4158 | /** |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4159 | * Retrieve all receivers that can handle a broadcast of the given intent, |
| 4160 | * for a specific user. |
Amith Yamasani | f203aee | 2012-08-29 18:41:53 -0700 | [diff] [blame] | 4161 | * |
| 4162 | * @param intent The desired intent as per resolveActivity(). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4163 | * @param flags Additional option flags to modify the data returned. |
Fyodor Kupolov | 940e857 | 2016-01-26 12:03:51 -0800 | [diff] [blame] | 4164 | * @param userHandle UserHandle of the user being queried. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4165 | * @return Returns a List of ResolveInfo objects containing one entry for |
| 4166 | * each matching receiver, ordered from best to worst. If there are |
| 4167 | * no matching receivers, an empty list or null is returned. |
Amith Yamasani | f203aee | 2012-08-29 18:41:53 -0700 | [diff] [blame] | 4168 | * @hide |
| 4169 | */ |
Fyodor Kupolov | 940e857 | 2016-01-26 12:03:51 -0800 | [diff] [blame] | 4170 | @SystemApi |
Todd Kennedy | dbaef6d | 2017-07-24 11:28:00 -0700 | [diff] [blame] | 4171 | @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS) |
Fyodor Kupolov | 940e857 | 2016-01-26 12:03:51 -0800 | [diff] [blame] | 4172 | public List<ResolveInfo> queryBroadcastReceiversAsUser(Intent intent, |
| 4173 | @ResolveInfoFlags int flags, UserHandle userHandle) { |
| 4174 | return queryBroadcastReceiversAsUser(intent, flags, userHandle.getIdentifier()); |
| 4175 | } |
| 4176 | |
| 4177 | /** |
| 4178 | * @hide |
| 4179 | */ |
Jeff Sharkey | e06b4d1 | 2016-01-06 14:51:50 -0700 | [diff] [blame] | 4180 | public abstract List<ResolveInfo> queryBroadcastReceiversAsUser(Intent intent, |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 4181 | @ResolveInfoFlags int flags, @UserIdInt int userId); |
Amith Yamasani | f203aee | 2012-08-29 18:41:53 -0700 | [diff] [blame] | 4182 | |
Fyodor Kupolov | 940e857 | 2016-01-26 12:03:51 -0800 | [diff] [blame] | 4183 | |
Jeff Sharkey | bd94022 | 2016-01-08 11:07:13 -0700 | [diff] [blame] | 4184 | /** {@hide} */ |
| 4185 | @Deprecated |
| 4186 | public List<ResolveInfo> queryBroadcastReceivers(Intent intent, |
| 4187 | @ResolveInfoFlags int flags, @UserIdInt int userId) { |
Jeff Sharkey | 6f4b2a3 | 2017-03-21 14:13:41 -0600 | [diff] [blame] | 4188 | final String msg = "Shame on you for calling the hidden API " |
| 4189 | + "queryBroadcastReceivers(). Shame!"; |
| 4190 | if (VMRuntime.getRuntime().getTargetSdkVersion() >= Build.VERSION_CODES.O) { |
| 4191 | throw new UnsupportedOperationException(msg); |
| 4192 | } else { |
| 4193 | Log.d(TAG, msg); |
| 4194 | return queryBroadcastReceiversAsUser(intent, flags, userId); |
| 4195 | } |
Jeff Sharkey | bd94022 | 2016-01-08 11:07:13 -0700 | [diff] [blame] | 4196 | } |
| 4197 | |
Amith Yamasani | f203aee | 2012-08-29 18:41:53 -0700 | [diff] [blame] | 4198 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4199 | * Determine the best service to handle for a given Intent. |
| 4200 | * |
| 4201 | * @param intent An intent containing all of the desired specification |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4202 | * (action, data, type, category, and/or component). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4203 | * @param flags Additional option flags to modify the data returned. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 4204 | * @return Returns a ResolveInfo object containing the final service intent |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4205 | * 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] | 4206 | * matching service was found. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4207 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4208 | public abstract ResolveInfo resolveService(Intent intent, @ResolveInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4209 | |
| 4210 | /** |
Philip P. Moltmann | 18e3eb8 | 2018-03-09 16:55:55 -0800 | [diff] [blame] | 4211 | * @hide |
| 4212 | */ |
| 4213 | public abstract ResolveInfo resolveServiceAsUser(Intent intent, @ResolveInfoFlags int flags, |
| 4214 | @UserIdInt int userId); |
| 4215 | |
| 4216 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4217 | * Retrieve all services that can match the given intent. |
| 4218 | * |
| 4219 | * @param intent The desired intent as per resolveService(). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4220 | * @param flags Additional option flags to modify the data returned. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4221 | * @return Returns a List of ResolveInfo objects containing one entry for |
| 4222 | * each matching service, ordered from best to worst. In other |
| 4223 | * words, the first item is what would be returned by |
| 4224 | * {@link #resolveService}. If there are no matching services, an |
| 4225 | * empty list or null is returned. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4226 | */ |
| 4227 | public abstract List<ResolveInfo> queryIntentServices(Intent intent, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4228 | @ResolveInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4229 | |
| 4230 | /** |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4231 | * Retrieve all services that can match the given intent for a given user. |
| 4232 | * |
| 4233 | * @param intent The desired intent as per resolveService(). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4234 | * @param flags Additional option flags to modify the data returned. |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4235 | * @param userId The user id. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4236 | * @return Returns a List of ResolveInfo objects containing one entry for |
| 4237 | * each matching service, ordered from best to worst. In other |
| 4238 | * words, the first item is what would be returned by |
| 4239 | * {@link #resolveService}. If there are no matching services, an |
| 4240 | * empty list or null is returned. |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4241 | * @hide |
| 4242 | */ |
| 4243 | public abstract List<ResolveInfo> queryIntentServicesAsUser(Intent intent, |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 4244 | @ResolveInfoFlags int flags, @UserIdInt int userId); |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4245 | |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 4246 | /** |
| 4247 | * Retrieve all providers that can match the given intent. |
| 4248 | * |
| 4249 | * @param intent An intent containing all of the desired specification |
| 4250 | * (action, data, type, category, and/or component). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4251 | * @param flags Additional option flags to modify the data returned. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 4252 | * @param userId The user id. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4253 | * @return Returns a List of ResolveInfo objects containing one entry for |
| 4254 | * each matching provider, ordered from best to worst. If there are |
| 4255 | * no matching services, an empty list or null is returned. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 4256 | * @hide |
| 4257 | */ |
Jeff Sharkey | 85f5f81 | 2013-10-07 10:16:12 -0700 | [diff] [blame] | 4258 | public abstract List<ResolveInfo> queryIntentContentProvidersAsUser( |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 4259 | Intent intent, @ResolveInfoFlags int flags, @UserIdInt int userId); |
Jeff Sharkey | 85f5f81 | 2013-10-07 10:16:12 -0700 | [diff] [blame] | 4260 | |
| 4261 | /** |
| 4262 | * Retrieve all providers that can match the given intent. |
| 4263 | * |
| 4264 | * @param intent An intent containing all of the desired specification |
| 4265 | * (action, data, type, category, and/or component). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4266 | * @param flags Additional option flags to modify the data returned. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4267 | * @return Returns a List of ResolveInfo objects containing one entry for |
| 4268 | * each matching provider, ordered from best to worst. If there are |
| 4269 | * no matching services, an empty list or null is returned. |
Jeff Sharkey | 85f5f81 | 2013-10-07 10:16:12 -0700 | [diff] [blame] | 4270 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4271 | public abstract List<ResolveInfo> queryIntentContentProviders(Intent intent, |
| 4272 | @ResolveInfoFlags int flags); |
Jeff Sharkey | 85f5f81 | 2013-10-07 10:16:12 -0700 | [diff] [blame] | 4273 | |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4274 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4275 | * Find a single content provider by its base path name. |
| 4276 | * |
| 4277 | * @param name The name of the provider to find. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4278 | * @param flags Additional option flags to modify the data returned. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4279 | * @return A {@link ProviderInfo} object containing information about the |
| 4280 | * provider. If a provider was not found, returns null. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4281 | */ |
| 4282 | public abstract ProviderInfo resolveContentProvider(String name, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4283 | @ComponentInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4284 | |
| 4285 | /** |
Alexandra Gherghina | 0363c3e | 2014-06-23 13:34:59 +0100 | [diff] [blame] | 4286 | * Find a single content provider by its base path name. |
| 4287 | * |
| 4288 | * @param name The name of the provider to find. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4289 | * @param flags Additional option flags to modify the data returned. |
Alexandra Gherghina | 0363c3e | 2014-06-23 13:34:59 +0100 | [diff] [blame] | 4290 | * @param userId The user id. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4291 | * @return A {@link ProviderInfo} object containing information about the |
| 4292 | * provider. If a provider was not found, returns null. |
Alexandra Gherghina | 0363c3e | 2014-06-23 13:34:59 +0100 | [diff] [blame] | 4293 | * @hide |
| 4294 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4295 | public abstract ProviderInfo resolveContentProviderAsUser(String name, |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 4296 | @ComponentInfoFlags int flags, @UserIdInt int userId); |
Alexandra Gherghina | 0363c3e | 2014-06-23 13:34:59 +0100 | [diff] [blame] | 4297 | |
| 4298 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4299 | * Retrieve content provider information. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4300 | * <p> |
| 4301 | * <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] | 4302 | * by a null return instead of an empty list.</em> |
| 4303 | * |
| 4304 | * @param processName If non-null, limits the returned providers to only |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4305 | * those that are hosted by the given process. If null, all |
| 4306 | * content providers are returned. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4307 | * @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] | 4308 | * uid owning the requested content providers. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4309 | * @param flags Additional option flags to modify the data returned. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 4310 | * @return A list of {@link ProviderInfo} objects containing one entry for |
| 4311 | * each provider either matching <var>processName</var> or, if |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4312 | * <var>processName</var> is null, all known content providers. |
| 4313 | * <em>If there are no matching providers, null is returned.</em> |
| 4314 | */ |
| 4315 | public abstract List<ProviderInfo> queryContentProviders( |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4316 | String processName, int uid, @ComponentInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4317 | |
| 4318 | /** |
Makoto Onuki | 3275729 | 2017-02-22 14:36:59 -0800 | [diff] [blame] | 4319 | * Same as {@link #queryContentProviders}, except when {@code metaDataKey} is not null, |
| 4320 | * it only returns providers which have metadata with the {@code metaDataKey} key. |
| 4321 | * |
| 4322 | * <p>DO NOT USE the {@code metaDataKey} parameter, unless you're the contacts provider. |
| 4323 | * You really shouldn't need it. Other apps should use {@link #queryIntentContentProviders} |
| 4324 | * instead. |
| 4325 | * |
| 4326 | * <p>The {@code metaDataKey} parameter was added to allow the contacts provider to quickly |
| 4327 | * scan the GAL providers on the device. Unfortunately the discovery protocol used metadata |
| 4328 | * to mark GAL providers, rather than intent filters, so we can't use |
| 4329 | * {@link #queryIntentContentProviders} for that. |
| 4330 | * |
| 4331 | * @hide |
| 4332 | */ |
| 4333 | public List<ProviderInfo> queryContentProviders( |
| 4334 | String processName, int uid, @ComponentInfoFlags int flags, String metaDataKey) { |
| 4335 | // Provide the default implementation for mocks. |
| 4336 | return queryContentProviders(processName, uid, flags); |
| 4337 | } |
| 4338 | |
| 4339 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4340 | * Retrieve all of the information we know about a particular |
| 4341 | * instrumentation class. |
| 4342 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4343 | * @param className The full name (i.e. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4344 | * com.google.apps.contacts.InstrumentList) of an Instrumentation |
| 4345 | * class. |
| 4346 | * @param flags Additional option flags to modify the data returned. |
| 4347 | * @return An {@link InstrumentationInfo} object containing information |
| 4348 | * about the instrumentation. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 4349 | * @throws NameNotFoundException if a package with the given name cannot be |
| 4350 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4351 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4352 | public abstract InstrumentationInfo getInstrumentationInfo(ComponentName className, |
| 4353 | @InstrumentationInfoFlags int flags) throws NameNotFoundException; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4354 | |
| 4355 | /** |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4356 | * Retrieve information about available instrumentation code. May be used to |
| 4357 | * retrieve either all instrumentation code, or only the code targeting a |
| 4358 | * particular package. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4359 | * |
| 4360 | * @param targetPackage If null, all instrumentation is returned; only the |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4361 | * instrumentation targeting this package name is returned. |
| 4362 | * @param flags Additional option flags to modify the data returned. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 4363 | * @return A list of {@link InstrumentationInfo} objects containing one |
| 4364 | * entry for each matching instrumentation. If there are no |
Jesse Hall | f77a34f | 2016-02-04 18:41:33 -0800 | [diff] [blame] | 4365 | * instrumentation available, returns an empty list. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4366 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4367 | public abstract List<InstrumentationInfo> queryInstrumentation(String targetPackage, |
| 4368 | @InstrumentationInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4369 | |
| 4370 | /** |
| 4371 | * Retrieve an image from a package. This is a low-level API used by |
| 4372 | * the various package manager info structures (such as |
| 4373 | * {@link ComponentInfo} to implement retrieval of their associated |
| 4374 | * icon. |
| 4375 | * |
| 4376 | * @param packageName The name of the package that this icon is coming from. |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4377 | * Cannot be null. |
| 4378 | * @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] | 4379 | * @param appInfo Overall information about <var>packageName</var>. This |
| 4380 | * may be null, in which case the application information will be retrieved |
| 4381 | * for you if needed; if you already have this information around, it can |
| 4382 | * be much more efficient to supply it here. |
| 4383 | * |
| 4384 | * @return Returns a Drawable holding the requested image. Returns null if |
| 4385 | * an image could not be found for any reason. |
| 4386 | */ |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 4387 | public abstract Drawable getDrawable(String packageName, @DrawableRes int resid, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4388 | ApplicationInfo appInfo); |
| 4389 | |
| 4390 | /** |
| 4391 | * Retrieve the icon 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 icon. |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4394 | * If the activity cannot be found, NameNotFoundException is thrown. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4395 | * |
| 4396 | * @param activityName Name of the activity whose icon is to be retrieved. |
| 4397 | * |
| 4398 | * @return Returns the image of the icon, or the default activity icon if |
| 4399 | * it could not be found. Does not return null. |
| 4400 | * @throws NameNotFoundException Thrown if the resources for the given |
| 4401 | * activity could not be loaded. |
| 4402 | * |
| 4403 | * @see #getActivityIcon(Intent) |
| 4404 | */ |
| 4405 | public abstract Drawable getActivityIcon(ComponentName activityName) |
| 4406 | throws NameNotFoundException; |
| 4407 | |
| 4408 | /** |
| 4409 | * Retrieve the icon associated with an Intent. If intent.getClassName() is |
| 4410 | * set, this simply returns the result of |
| 4411 | * getActivityIcon(intent.getClassName()). Otherwise it resolves the intent's |
| 4412 | * component and returns the icon associated with the resolved component. |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4413 | * 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] | 4414 | * to a component, NameNotFoundException is thrown. |
| 4415 | * |
| 4416 | * @param intent The intent for which you would like to retrieve an icon. |
| 4417 | * |
| 4418 | * @return Returns the image of the icon, or the default activity icon if |
| 4419 | * it could not be found. Does not return null. |
| 4420 | * @throws NameNotFoundException Thrown if the resources for application |
| 4421 | * matching the given intent could not be loaded. |
| 4422 | * |
| 4423 | * @see #getActivityIcon(ComponentName) |
| 4424 | */ |
| 4425 | public abstract Drawable getActivityIcon(Intent intent) |
| 4426 | throws NameNotFoundException; |
| 4427 | |
| 4428 | /** |
Jose Lima | f78e312 | 2014-03-06 12:13:15 -0800 | [diff] [blame] | 4429 | * Retrieve the banner associated with an activity. Given the full name of |
| 4430 | * an activity, retrieves the information about it and calls |
| 4431 | * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its |
| 4432 | * banner. If the activity cannot be found, NameNotFoundException is thrown. |
| 4433 | * |
| 4434 | * @param activityName Name of the activity whose banner is to be retrieved. |
| 4435 | * @return Returns the image of the banner, or null if the activity has no |
| 4436 | * banner specified. |
| 4437 | * @throws NameNotFoundException Thrown if the resources for the given |
| 4438 | * activity could not be loaded. |
| 4439 | * @see #getActivityBanner(Intent) |
| 4440 | */ |
| 4441 | public abstract Drawable getActivityBanner(ComponentName activityName) |
| 4442 | throws NameNotFoundException; |
| 4443 | |
| 4444 | /** |
| 4445 | * Retrieve the banner associated with an Intent. If intent.getClassName() |
| 4446 | * is set, this simply returns the result of |
| 4447 | * getActivityBanner(intent.getClassName()). Otherwise it resolves the |
| 4448 | * intent's component and returns the banner associated with the resolved |
| 4449 | * component. If intent.getClassName() cannot be found or the Intent cannot |
| 4450 | * be resolved to a component, NameNotFoundException is thrown. |
| 4451 | * |
| 4452 | * @param intent The intent for which you would like to retrieve a banner. |
| 4453 | * @return Returns the image of the banner, or null if the activity has no |
| 4454 | * banner specified. |
| 4455 | * @throws NameNotFoundException Thrown if the resources for application |
| 4456 | * matching the given intent could not be loaded. |
| 4457 | * @see #getActivityBanner(ComponentName) |
| 4458 | */ |
| 4459 | public abstract Drawable getActivityBanner(Intent intent) |
| 4460 | throws NameNotFoundException; |
| 4461 | |
| 4462 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4463 | * Return the generic icon for an activity that is used when no specific |
| 4464 | * icon is defined. |
Adam Connors | 23cc04e | 2014-04-01 12:12:20 +0100 | [diff] [blame] | 4465 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4466 | * @return Drawable Image of the icon. |
| 4467 | */ |
| 4468 | public abstract Drawable getDefaultActivityIcon(); |
| 4469 | |
| 4470 | /** |
| 4471 | * Retrieve the icon associated with an application. If it has not defined |
| 4472 | * an icon, the default app icon is returned. Does not return null. |
| 4473 | * |
| 4474 | * @param info Information about application being queried. |
| 4475 | * |
| 4476 | * @return Returns the image of the icon, or the default application icon |
| 4477 | * if it could not be found. |
| 4478 | * |
| 4479 | * @see #getApplicationIcon(String) |
| 4480 | */ |
| 4481 | public abstract Drawable getApplicationIcon(ApplicationInfo info); |
| 4482 | |
| 4483 | /** |
| 4484 | * Retrieve the icon associated with an application. Given the name of the |
| 4485 | * application's package, retrieves the information about it and calls |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4486 | * 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] | 4487 | * found, NameNotFoundException is thrown. |
| 4488 | * |
| 4489 | * @param packageName Name of the package whose application icon is to be |
| 4490 | * retrieved. |
| 4491 | * |
| 4492 | * @return Returns the image of the icon, or the default application icon |
| 4493 | * if it could not be found. Does not return null. |
| 4494 | * @throws NameNotFoundException Thrown if the resources for the given |
| 4495 | * application could not be loaded. |
| 4496 | * |
| 4497 | * @see #getApplicationIcon(ApplicationInfo) |
| 4498 | */ |
| 4499 | public abstract Drawable getApplicationIcon(String packageName) |
| 4500 | throws NameNotFoundException; |
| 4501 | |
| 4502 | /** |
Jose Lima | f78e312 | 2014-03-06 12:13:15 -0800 | [diff] [blame] | 4503 | * Retrieve the banner associated with an application. |
| 4504 | * |
| 4505 | * @param info Information about application being queried. |
| 4506 | * @return Returns the image of the banner or null if the application has no |
| 4507 | * banner specified. |
| 4508 | * @see #getApplicationBanner(String) |
| 4509 | */ |
| 4510 | public abstract Drawable getApplicationBanner(ApplicationInfo info); |
| 4511 | |
| 4512 | /** |
| 4513 | * Retrieve the banner associated with an application. Given the name of the |
| 4514 | * application's package, retrieves the information about it and calls |
| 4515 | * getApplicationIcon() to return its banner. If the application cannot be |
| 4516 | * found, NameNotFoundException is thrown. |
| 4517 | * |
| 4518 | * @param packageName Name of the package whose application banner is to be |
| 4519 | * retrieved. |
| 4520 | * @return Returns the image of the banner or null if the application has no |
| 4521 | * banner specified. |
| 4522 | * @throws NameNotFoundException Thrown if the resources for the given |
| 4523 | * application could not be loaded. |
| 4524 | * @see #getApplicationBanner(ApplicationInfo) |
| 4525 | */ |
| 4526 | public abstract Drawable getApplicationBanner(String packageName) |
| 4527 | throws NameNotFoundException; |
| 4528 | |
| 4529 | /** |
| 4530 | * Retrieve the logo associated with an activity. Given the full name of an |
| 4531 | * activity, retrieves the information about it and calls |
| 4532 | * {@link ComponentInfo#loadLogo ComponentInfo.loadLogo()} to return its |
| 4533 | * logo. If the activity cannot be found, NameNotFoundException is thrown. |
Adam Powell | 81cd2e9 | 2010-04-21 16:35:18 -0700 | [diff] [blame] | 4534 | * |
| 4535 | * @param activityName Name of the activity whose logo is to be retrieved. |
Jose Lima | f78e312 | 2014-03-06 12:13:15 -0800 | [diff] [blame] | 4536 | * @return Returns the image of the logo or null if the activity has no logo |
| 4537 | * specified. |
Adam Powell | 81cd2e9 | 2010-04-21 16:35:18 -0700 | [diff] [blame] | 4538 | * @throws NameNotFoundException Thrown if the resources for the given |
Jose Lima | f78e312 | 2014-03-06 12:13:15 -0800 | [diff] [blame] | 4539 | * activity could not be loaded. |
Adam Powell | 81cd2e9 | 2010-04-21 16:35:18 -0700 | [diff] [blame] | 4540 | * @see #getActivityLogo(Intent) |
| 4541 | */ |
| 4542 | public abstract Drawable getActivityLogo(ComponentName activityName) |
| 4543 | throws NameNotFoundException; |
| 4544 | |
| 4545 | /** |
| 4546 | * Retrieve the logo associated with an Intent. If intent.getClassName() is |
| 4547 | * set, this simply returns the result of |
| 4548 | * getActivityLogo(intent.getClassName()). Otherwise it resolves the intent's |
| 4549 | * component and returns the logo associated with the resolved component. |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4550 | * If intent.getClassName() cannot be found or the Intent cannot be resolved |
Adam Powell | 81cd2e9 | 2010-04-21 16:35:18 -0700 | [diff] [blame] | 4551 | * to a component, NameNotFoundException is thrown. |
| 4552 | * |
| 4553 | * @param intent The intent for which you would like to retrieve a logo. |
| 4554 | * |
| 4555 | * @return Returns the image of the logo, or null if the activity has no |
| 4556 | * logo specified. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 4557 | * |
Adam Powell | 81cd2e9 | 2010-04-21 16:35:18 -0700 | [diff] [blame] | 4558 | * @throws NameNotFoundException Thrown if the resources for application |
| 4559 | * matching the given intent could not be loaded. |
| 4560 | * |
| 4561 | * @see #getActivityLogo(ComponentName) |
| 4562 | */ |
| 4563 | public abstract Drawable getActivityLogo(Intent intent) |
| 4564 | throws NameNotFoundException; |
| 4565 | |
| 4566 | /** |
| 4567 | * Retrieve the logo associated with an application. If it has not specified |
| 4568 | * a logo, this method returns null. |
| 4569 | * |
| 4570 | * @param info Information about application being queried. |
| 4571 | * |
| 4572 | * @return Returns the image of the logo, or null if no logo is specified |
| 4573 | * by the application. |
| 4574 | * |
| 4575 | * @see #getApplicationLogo(String) |
| 4576 | */ |
| 4577 | public abstract Drawable getApplicationLogo(ApplicationInfo info); |
| 4578 | |
| 4579 | /** |
| 4580 | * Retrieve the logo associated with an application. Given the name of the |
| 4581 | * application's package, retrieves the information about it and calls |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4582 | * getApplicationLogo() to return its logo. If the application cannot be |
Adam Powell | 81cd2e9 | 2010-04-21 16:35:18 -0700 | [diff] [blame] | 4583 | * found, NameNotFoundException is thrown. |
| 4584 | * |
| 4585 | * @param packageName Name of the package whose application logo is to be |
| 4586 | * retrieved. |
| 4587 | * |
| 4588 | * @return Returns the image of the logo, or null if no application logo |
| 4589 | * has been specified. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 4590 | * |
Adam Powell | 81cd2e9 | 2010-04-21 16:35:18 -0700 | [diff] [blame] | 4591 | * @throws NameNotFoundException Thrown if the resources for the given |
| 4592 | * application could not be loaded. |
| 4593 | * |
| 4594 | * @see #getApplicationLogo(ApplicationInfo) |
| 4595 | */ |
| 4596 | public abstract Drawable getApplicationLogo(String packageName) |
| 4597 | throws NameNotFoundException; |
| 4598 | |
| 4599 | /** |
Tony Mak | 4dc008c | 2016-03-16 10:46:49 +0000 | [diff] [blame] | 4600 | * If the target user is a managed profile, then this returns a badged copy of the given icon |
| 4601 | * 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] | 4602 | * {@link #getUserBadgedDrawableForDensity( |
Svetoslav | c7d62f0 | 2014-09-04 15:39:54 -0700 | [diff] [blame] | 4603 | * android.graphics.drawable.Drawable, UserHandle, android.graphics.Rect, int)}. |
| 4604 | * <p> |
| 4605 | * If the original drawable is a BitmapDrawable and the backing bitmap is |
| 4606 | * mutable as per {@link android.graphics.Bitmap#isMutable()}, the badging |
| 4607 | * is performed in place and the original drawable is returned. |
| 4608 | * </p> |
| 4609 | * |
| 4610 | * @param icon The icon to badge. |
| 4611 | * @param user The target user. |
| 4612 | * @return A drawable that combines the original icon and a badge as |
| 4613 | * determined by the system. |
| 4614 | */ |
| 4615 | public abstract Drawable getUserBadgedIcon(Drawable icon, UserHandle user); |
| 4616 | |
| 4617 | /** |
| 4618 | * If the target user is a managed profile of the calling user or the caller |
| 4619 | * is itself a managed profile, then this returns a badged copy of the given |
| 4620 | * drawable allowing the user to distinguish it from the original drawable. |
| 4621 | * The caller can specify the location in the bounds of the drawable to be |
| 4622 | * badged where the badge should be applied as well as the density of the |
| 4623 | * badge to be used. |
| 4624 | * <p> |
| 4625 | * If the original drawable is a BitmapDrawable and the backing bitmap is |
Vadim Tryshev | 66ae66a | 2016-02-18 15:41:21 -0800 | [diff] [blame] | 4626 | * mutable as per {@link android.graphics.Bitmap#isMutable()}, the badging |
Svetoslav | c7d62f0 | 2014-09-04 15:39:54 -0700 | [diff] [blame] | 4627 | * is performed in place and the original drawable is returned. |
| 4628 | * </p> |
| 4629 | * |
| 4630 | * @param drawable The drawable to badge. |
| 4631 | * @param user The target user. |
| 4632 | * @param badgeLocation Where in the bounds of the badged drawable to place |
Vadim Tryshev | 66ae66a | 2016-02-18 15:41:21 -0800 | [diff] [blame] | 4633 | * 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] | 4634 | * drawable being badged. |
| 4635 | * @param badgeDensity The optional desired density for the badge as per |
Vadim Tryshev | 66ae66a | 2016-02-18 15:41:21 -0800 | [diff] [blame] | 4636 | * {@link android.util.DisplayMetrics#densityDpi}. If it's not positive, |
Svetoslav | c7d62f0 | 2014-09-04 15:39:54 -0700 | [diff] [blame] | 4637 | * the density of the display is used. |
| 4638 | * @return A drawable that combines the original drawable and a badge as |
| 4639 | * determined by the system. |
| 4640 | */ |
| 4641 | public abstract Drawable getUserBadgedDrawableForDensity(Drawable drawable, |
| 4642 | UserHandle user, Rect badgeLocation, int badgeDensity); |
| 4643 | |
| 4644 | /** |
| 4645 | * If the target user is a managed profile of the calling user or the caller |
| 4646 | * is itself a managed profile, then this returns a drawable to use as a small |
| 4647 | * icon to include in a view to distinguish it from the original icon. |
| 4648 | * |
| 4649 | * @param user The target user. |
| 4650 | * @param density The optional desired density for the badge as per |
| 4651 | * {@link android.util.DisplayMetrics#densityDpi}. If not provided |
| 4652 | * the density of the current display is used. |
| 4653 | * @return the drawable or null if no drawable is required. |
| 4654 | * @hide |
| 4655 | */ |
| 4656 | public abstract Drawable getUserBadgeForDensity(UserHandle user, int density); |
| 4657 | |
| 4658 | /** |
| 4659 | * 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] | 4660 | * is itself a managed profile, then this returns a drawable to use as a small |
| 4661 | * icon to include in a view to distinguish it from the original icon. This version |
| 4662 | * doesn't have background protection and should be used over a light background instead of |
| 4663 | * a badge. |
| 4664 | * |
| 4665 | * @param user The target user. |
| 4666 | * @param density The optional desired density for the badge as per |
| 4667 | * {@link android.util.DisplayMetrics#densityDpi}. If not provided |
| 4668 | * the density of the current display is used. |
| 4669 | * @return the drawable or null if no drawable is required. |
| 4670 | * @hide |
| 4671 | */ |
| 4672 | public abstract Drawable getUserBadgeForDensityNoBackground(UserHandle user, int density); |
| 4673 | |
| 4674 | /** |
| 4675 | * 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] | 4676 | * is itself a managed profile, then this returns a copy of the label with |
| 4677 | * badging for accessibility services like talkback. E.g. passing in "Email" |
| 4678 | * and it might return "Work Email" for Email in the work profile. |
| 4679 | * |
| 4680 | * @param label The label to change. |
| 4681 | * @param user The target user. |
| 4682 | * @return A label that combines the original label and a badge as |
| 4683 | * determined by the system. |
| 4684 | */ |
| 4685 | public abstract CharSequence getUserBadgedLabel(CharSequence label, UserHandle user); |
| 4686 | |
| 4687 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4688 | * Retrieve text from a package. This is a low-level API used by |
| 4689 | * the various package manager info structures (such as |
| 4690 | * {@link ComponentInfo} to implement retrieval of their associated |
| 4691 | * labels and other text. |
| 4692 | * |
| 4693 | * @param packageName The name of the package that this text is coming from. |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4694 | * Cannot be null. |
| 4695 | * @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] | 4696 | * @param appInfo Overall information about <var>packageName</var>. This |
| 4697 | * may be null, in which case the application information will be retrieved |
| 4698 | * for you if needed; if you already have this information around, it can |
| 4699 | * be much more efficient to supply it here. |
| 4700 | * |
| 4701 | * @return Returns a CharSequence holding the requested text. Returns null |
| 4702 | * if the text could not be found for any reason. |
| 4703 | */ |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 4704 | public abstract CharSequence getText(String packageName, @StringRes int resid, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4705 | ApplicationInfo appInfo); |
| 4706 | |
| 4707 | /** |
| 4708 | * Retrieve an XML file from a package. This is a low-level API used to |
| 4709 | * retrieve XML meta data. |
| 4710 | * |
| 4711 | * @param packageName The name of the package that this xml is coming from. |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4712 | * Cannot be null. |
| 4713 | * @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] | 4714 | * @param appInfo Overall information about <var>packageName</var>. This |
| 4715 | * may be null, in which case the application information will be retrieved |
| 4716 | * for you if needed; if you already have this information around, it can |
| 4717 | * be much more efficient to supply it here. |
| 4718 | * |
| 4719 | * @return Returns an XmlPullParser allowing you to parse out the XML |
| 4720 | * data. Returns null if the xml resource could not be found for any |
| 4721 | * reason. |
| 4722 | */ |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 4723 | public abstract XmlResourceParser getXml(String packageName, @XmlRes int resid, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4724 | ApplicationInfo appInfo); |
| 4725 | |
| 4726 | /** |
| 4727 | * Return the label to use for this application. |
| 4728 | * |
| 4729 | * @return Returns the label associated with this application, or null if |
| 4730 | * it could not be found for any reason. |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4731 | * @param info The application to get the label of. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4732 | */ |
| 4733 | public abstract CharSequence getApplicationLabel(ApplicationInfo info); |
| 4734 | |
| 4735 | /** |
| 4736 | * Retrieve the resources associated with an activity. Given the full |
| 4737 | * name of an activity, retrieves the information about it and calls |
| 4738 | * getResources() to return its application's resources. If the activity |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4739 | * cannot be found, NameNotFoundException is thrown. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4740 | * |
| 4741 | * @param activityName Name of the activity whose resources are to be |
| 4742 | * retrieved. |
| 4743 | * |
| 4744 | * @return Returns the application's Resources. |
| 4745 | * @throws NameNotFoundException Thrown if the resources for the given |
| 4746 | * application could not be loaded. |
| 4747 | * |
| 4748 | * @see #getResourcesForApplication(ApplicationInfo) |
| 4749 | */ |
| 4750 | public abstract Resources getResourcesForActivity(ComponentName activityName) |
| 4751 | throws NameNotFoundException; |
| 4752 | |
| 4753 | /** |
| 4754 | * Retrieve the resources for an application. Throws NameNotFoundException |
| 4755 | * if the package is no longer installed. |
| 4756 | * |
| 4757 | * @param app Information about the desired application. |
| 4758 | * |
| 4759 | * @return Returns the application's Resources. |
| 4760 | * @throws NameNotFoundException Thrown if the resources for the given |
| 4761 | * application could not be loaded (most likely because it was uninstalled). |
| 4762 | */ |
| 4763 | public abstract Resources getResourcesForApplication(ApplicationInfo app) |
| 4764 | throws NameNotFoundException; |
| 4765 | |
| 4766 | /** |
| 4767 | * Retrieve the resources associated with an application. Given the full |
| 4768 | * package name of an application, retrieves the information about it and |
| 4769 | * calls getResources() to return its application's resources. If the |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4770 | * appPackageName cannot be found, NameNotFoundException is thrown. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4771 | * |
| 4772 | * @param appPackageName Package name of the application whose resources |
| 4773 | * are to be retrieved. |
| 4774 | * |
| 4775 | * @return Returns the application's Resources. |
| 4776 | * @throws NameNotFoundException Thrown if the resources for the given |
| 4777 | * application could not be loaded. |
| 4778 | * |
| 4779 | * @see #getResourcesForApplication(ApplicationInfo) |
| 4780 | */ |
| 4781 | public abstract Resources getResourcesForApplication(String appPackageName) |
| 4782 | throws NameNotFoundException; |
| 4783 | |
Amith Yamasani | 98edc95 | 2012-09-25 14:09:27 -0700 | [diff] [blame] | 4784 | /** @hide */ |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 4785 | public abstract Resources getResourcesForApplicationAsUser(String appPackageName, |
| 4786 | @UserIdInt int userId) throws NameNotFoundException; |
Amith Yamasani | 98edc95 | 2012-09-25 14:09:27 -0700 | [diff] [blame] | 4787 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4788 | /** |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4789 | * Retrieve overall information about an application package defined in a |
| 4790 | * package archive file |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4791 | * |
| 4792 | * @param archiveFilePath The path to the archive file |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4793 | * @param flags Additional option flags to modify the data returned. |
| 4794 | * @return A PackageInfo object containing information about the package |
| 4795 | * 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] | 4796 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4797 | public PackageInfo getPackageArchiveInfo(String archiveFilePath, @PackageInfoFlags int flags) { |
Jeff Sharkey | 275e085 | 2014-06-17 18:18:49 -0700 | [diff] [blame] | 4798 | final PackageParser parser = new PackageParser(); |
Dianne Hackborn | cd154e9 | 2017-02-28 17:37:35 -0800 | [diff] [blame] | 4799 | parser.setCallback(new PackageParser.CallbackImpl(this)); |
Jeff Sharkey | 275e085 | 2014-06-17 18:18:49 -0700 | [diff] [blame] | 4800 | final File apkFile = new File(archiveFilePath); |
Jeff Sharkey | c4858a2 | 2014-06-16 10:51:20 -0700 | [diff] [blame] | 4801 | try { |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4802 | if ((flags & (MATCH_DIRECT_BOOT_UNAWARE | MATCH_DIRECT_BOOT_AWARE)) != 0) { |
Jeff Sharkey | c313251 | 2016-01-12 14:06:58 -0700 | [diff] [blame] | 4803 | // Caller expressed an explicit opinion about what encryption |
| 4804 | // aware/unaware components they want to see, so fall through and |
| 4805 | // give them what they want |
| 4806 | } else { |
| 4807 | // Caller expressed no opinion, so match everything |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4808 | flags |= MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE; |
Jeff Sharkey | c313251 | 2016-01-12 14:06:58 -0700 | [diff] [blame] | 4809 | } |
| 4810 | |
Jeff Sharkey | 275e085 | 2014-06-17 18:18:49 -0700 | [diff] [blame] | 4811 | PackageParser.Package pkg = parser.parseMonolithicPackage(apkFile, 0); |
Jeff Sharkey | c4858a2 | 2014-06-16 10:51:20 -0700 | [diff] [blame] | 4812 | if ((flags & GET_SIGNATURES) != 0) { |
Victor Hsieh | 5f76124 | 2018-01-20 10:30:12 -0800 | [diff] [blame] | 4813 | PackageParser.collectCertificates(pkg, false /* skipVerify */); |
Jeff Sharkey | c4858a2 | 2014-06-16 10:51:20 -0700 | [diff] [blame] | 4814 | } |
| 4815 | PackageUserState state = new PackageUserState(); |
| 4816 | return PackageParser.generatePackageInfo(pkg, null, flags, 0, 0, null, state); |
| 4817 | } catch (PackageParserException e) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4818 | return null; |
| 4819 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4820 | } |
| 4821 | |
| 4822 | /** |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 4823 | * If there is already an application with the given package name installed |
| 4824 | * on the system for other users, also install it for the calling user. |
| 4825 | * @hide |
| 4826 | */ |
Sunny Goyal | 07f41fb | 2017-08-09 02:56:34 -0700 | [diff] [blame] | 4827 | @SystemApi |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 4828 | public abstract int installExistingPackage(String packageName) throws NameNotFoundException; |
| 4829 | |
| 4830 | /** |
| 4831 | * If there is already an application with the given package name installed |
Sunny Goyal | a31a74b | 2017-05-11 15:59:19 -0700 | [diff] [blame] | 4832 | * on the system for other users, also install it for the calling user. |
| 4833 | * @hide |
| 4834 | */ |
Sunny Goyal | 07f41fb | 2017-08-09 02:56:34 -0700 | [diff] [blame] | 4835 | @SystemApi |
Sunny Goyal | a31a74b | 2017-05-11 15:59:19 -0700 | [diff] [blame] | 4836 | public abstract int installExistingPackage(String packageName, @InstallReason int installReason) |
| 4837 | throws NameNotFoundException; |
| 4838 | |
| 4839 | /** |
| 4840 | * If there is already an application with the given package name installed |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 4841 | * on the system for other users, also install it for the specified user. |
| 4842 | * @hide |
| 4843 | */ |
Sanry Huang | afef5da | 2018-06-06 17:34:34 +0000 | [diff] [blame] | 4844 | @RequiresPermission(anyOf = { |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 4845 | Manifest.permission.INSTALL_PACKAGES, |
| 4846 | Manifest.permission.INTERACT_ACROSS_USERS_FULL}) |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 4847 | public abstract int installExistingPackageAsUser(String packageName, @UserIdInt int userId) |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 4848 | throws NameNotFoundException; |
| 4849 | |
| 4850 | /** |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 4851 | * Allows a package listening to the |
| 4852 | * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification |
Kenny Root | 3a9b5fb | 2011-09-20 14:15:38 -0700 | [diff] [blame] | 4853 | * broadcast} to respond to the package manager. The response must include |
| 4854 | * the {@code verificationCode} which is one of |
| 4855 | * {@link PackageManager#VERIFICATION_ALLOW} or |
| 4856 | * {@link PackageManager#VERIFICATION_REJECT}. |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 4857 | * |
| 4858 | * @param id pending package identifier as passed via the |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4859 | * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra. |
Kenny Root | 3a9b5fb | 2011-09-20 14:15:38 -0700 | [diff] [blame] | 4860 | * @param verificationCode either {@link PackageManager#VERIFICATION_ALLOW} |
| 4861 | * or {@link PackageManager#VERIFICATION_REJECT}. |
rich cannings | 7e67151 | 2012-08-27 14:44:16 -0700 | [diff] [blame] | 4862 | * @throws SecurityException if the caller does not have the |
Dianne Hackborn | 8832c18 | 2012-09-17 17:20:24 -0700 | [diff] [blame] | 4863 | * PACKAGE_VERIFICATION_AGENT permission. |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 4864 | */ |
Kenny Root | 3a9b5fb | 2011-09-20 14:15:38 -0700 | [diff] [blame] | 4865 | public abstract void verifyPendingInstall(int id, int verificationCode); |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 4866 | |
| 4867 | /** |
rich cannings | d9ef3e5 | 2012-08-22 14:28:05 -0700 | [diff] [blame] | 4868 | * Allows a package listening to the |
| 4869 | * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification |
| 4870 | * broadcast} to extend the default timeout for a response and declare what |
| 4871 | * action to perform after the timeout occurs. The response must include |
| 4872 | * the {@code verificationCodeAtTimeout} which is one of |
| 4873 | * {@link PackageManager#VERIFICATION_ALLOW} or |
| 4874 | * {@link PackageManager#VERIFICATION_REJECT}. |
| 4875 | * |
| 4876 | * This method may only be called once per package id. Additional calls |
| 4877 | * will have no effect. |
| 4878 | * |
| 4879 | * @param id pending package identifier as passed via the |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4880 | * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra. |
rich cannings | d9ef3e5 | 2012-08-22 14:28:05 -0700 | [diff] [blame] | 4881 | * @param verificationCodeAtTimeout either |
| 4882 | * {@link PackageManager#VERIFICATION_ALLOW} or |
rich cannings | d1b5cfc | 2012-08-29 14:49:51 -0700 | [diff] [blame] | 4883 | * {@link PackageManager#VERIFICATION_REJECT}. If |
| 4884 | * {@code verificationCodeAtTimeout} is neither |
| 4885 | * {@link PackageManager#VERIFICATION_ALLOW} or |
| 4886 | * {@link PackageManager#VERIFICATION_REJECT}, then |
| 4887 | * {@code verificationCodeAtTimeout} will default to |
rich cannings | d9ef3e5 | 2012-08-22 14:28:05 -0700 | [diff] [blame] | 4888 | * {@link PackageManager#VERIFICATION_REJECT}. |
| 4889 | * @param millisecondsToDelay the amount of time requested for the timeout. |
| 4890 | * Must be positive and less than |
rich cannings | d1b5cfc | 2012-08-29 14:49:51 -0700 | [diff] [blame] | 4891 | * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}. If |
| 4892 | * {@code millisecondsToDelay} is out of bounds, |
| 4893 | * {@code millisecondsToDelay} will be set to the closest in |
| 4894 | * bounds value; namely, 0 or |
rich cannings | d9ef3e5 | 2012-08-22 14:28:05 -0700 | [diff] [blame] | 4895 | * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}. |
rich cannings | 7e67151 | 2012-08-27 14:44:16 -0700 | [diff] [blame] | 4896 | * @throws SecurityException if the caller does not have the |
Dianne Hackborn | 8832c18 | 2012-09-17 17:20:24 -0700 | [diff] [blame] | 4897 | * PACKAGE_VERIFICATION_AGENT permission. |
rich cannings | d9ef3e5 | 2012-08-22 14:28:05 -0700 | [diff] [blame] | 4898 | */ |
| 4899 | public abstract void extendVerificationTimeout(int id, |
| 4900 | int verificationCodeAtTimeout, long millisecondsToDelay); |
| 4901 | |
| 4902 | /** |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 4903 | * Allows a package listening to the |
Todd Kennedy | dfa93ab | 2016-03-03 15:24:33 -0800 | [diff] [blame] | 4904 | * {@link Intent#ACTION_INTENT_FILTER_NEEDS_VERIFICATION} intent filter verification |
| 4905 | * broadcast to respond to the package manager. The response must include |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 4906 | * the {@code verificationCode} which is one of |
| 4907 | * {@link PackageManager#INTENT_FILTER_VERIFICATION_SUCCESS} or |
| 4908 | * {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}. |
| 4909 | * |
| 4910 | * @param verificationId pending package identifier as passed via the |
| 4911 | * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra. |
| 4912 | * @param verificationCode either {@link PackageManager#INTENT_FILTER_VERIFICATION_SUCCESS} |
| 4913 | * or {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}. |
Todd Kennedy | dfa93ab | 2016-03-03 15:24:33 -0800 | [diff] [blame] | 4914 | * @param failedDomains a list of failed domains if the verificationCode is |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 4915 | * {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}, otherwise null; |
| 4916 | * @throws SecurityException if the caller does not have the |
| 4917 | * INTENT_FILTER_VERIFICATION_AGENT permission. |
| 4918 | * |
| 4919 | * @hide |
| 4920 | */ |
Fabrice Di Meglio | ef741da | 2015-05-12 16:31:38 -0700 | [diff] [blame] | 4921 | @SystemApi |
Jeff Sharkey | d86b8fe | 2017-06-02 17:36:26 -0600 | [diff] [blame] | 4922 | @RequiresPermission(android.Manifest.permission.INTENT_FILTER_VERIFICATION_AGENT) |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 4923 | public abstract void verifyIntentFilter(int verificationId, int verificationCode, |
Todd Kennedy | dfa93ab | 2016-03-03 15:24:33 -0800 | [diff] [blame] | 4924 | List<String> failedDomains); |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 4925 | |
| 4926 | /** |
| 4927 | * Get the status of a Domain Verification Result for an IntentFilter. This is |
| 4928 | * related to the {@link android.content.IntentFilter#setAutoVerify(boolean)} and |
| 4929 | * {@link android.content.IntentFilter#getAutoVerify()} |
| 4930 | * |
| 4931 | * This is used by the ResolverActivity to change the status depending on what the User select |
| 4932 | * in the Disambiguation Dialog and also used by the Settings App for changing the default App |
| 4933 | * for a domain. |
| 4934 | * |
| 4935 | * @param packageName The package name of the Activity associated with the IntentFilter. |
| 4936 | * @param userId The user id. |
| 4937 | * |
| 4938 | * @return The status to set to. This can be |
| 4939 | * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK} or |
| 4940 | * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS} or |
| 4941 | * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER} or |
| 4942 | * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED} |
| 4943 | * |
| 4944 | * @hide |
| 4945 | */ |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 4946 | @SystemApi |
Todd Kennedy | dbaef6d | 2017-07-24 11:28:00 -0700 | [diff] [blame] | 4947 | @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS_FULL) |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 4948 | public abstract int getIntentVerificationStatusAsUser(String packageName, @UserIdInt int userId); |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 4949 | |
| 4950 | /** |
| 4951 | * Allow to change the status of a Intent Verification status for all IntentFilter of an App. |
| 4952 | * This is related to the {@link android.content.IntentFilter#setAutoVerify(boolean)} and |
| 4953 | * {@link android.content.IntentFilter#getAutoVerify()} |
| 4954 | * |
| 4955 | * This is used by the ResolverActivity to change the status depending on what the User select |
| 4956 | * in the Disambiguation Dialog and also used by the Settings App for changing the default App |
| 4957 | * for a domain. |
| 4958 | * |
| 4959 | * @param packageName The package name of the Activity associated with the IntentFilter. |
| 4960 | * @param status The status to set to. This can be |
| 4961 | * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK} or |
| 4962 | * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS} or |
| 4963 | * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER} |
| 4964 | * @param userId The user id. |
| 4965 | * |
| 4966 | * @return true if the status has been set. False otherwise. |
| 4967 | * |
| 4968 | * @hide |
| 4969 | */ |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 4970 | @SystemApi |
Jeff Sharkey | d86b8fe | 2017-06-02 17:36:26 -0600 | [diff] [blame] | 4971 | @RequiresPermission(android.Manifest.permission.SET_PREFERRED_APPLICATIONS) |
Jeff Sharkey | e06b4d1 | 2016-01-06 14:51:50 -0700 | [diff] [blame] | 4972 | public abstract boolean updateIntentVerificationStatusAsUser(String packageName, int status, |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 4973 | @UserIdInt int userId); |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 4974 | |
| 4975 | /** |
| 4976 | * Get the list of IntentFilterVerificationInfo for a specific package and User. |
| 4977 | * |
| 4978 | * @param packageName the package name. When this parameter is set to a non null value, |
| 4979 | * the results will be filtered by the package name provided. |
| 4980 | * 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] | 4981 | * corresponding for all packages |
| 4982 | * |
| 4983 | * @return a list of IntentFilterVerificationInfo for a specific package. |
| 4984 | * |
| 4985 | * @hide |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 4986 | */ |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 4987 | @SystemApi |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 4988 | public abstract List<IntentFilterVerificationInfo> getIntentFilterVerifications( |
| 4989 | String packageName); |
| 4990 | |
| 4991 | /** |
Fabrice Di Meglio | 0788595 | 2015-04-06 19:41:28 -0700 | [diff] [blame] | 4992 | * Get the list of IntentFilter for a specific package. |
| 4993 | * |
| 4994 | * @param packageName the package name. This parameter is set to a non null value, |
| 4995 | * the list will contain all the IntentFilter for that package. |
| 4996 | * Otherwise, the list will be empty. |
| 4997 | * |
| 4998 | * @return a list of IntentFilter for a specific package. |
| 4999 | * |
| 5000 | * @hide |
| 5001 | */ |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 5002 | @SystemApi |
Fabrice Di Meglio | 0788595 | 2015-04-06 19:41:28 -0700 | [diff] [blame] | 5003 | public abstract List<IntentFilter> getAllIntentFilters(String packageName); |
| 5004 | |
| 5005 | /** |
Fabrice Di Meglio | 6227172 | 2015-04-10 17:24:02 -0700 | [diff] [blame] | 5006 | * Get the default Browser package name for a specific user. |
| 5007 | * |
| 5008 | * @param userId The user id. |
| 5009 | * |
| 5010 | * @return the package name of the default Browser for the specified user. If the user id passed |
| 5011 | * is -1 (all users) it will return a null value. |
| 5012 | * |
| 5013 | * @hide |
| 5014 | */ |
Jeff Sharkey | a73b8fd | 2016-01-06 17:02:08 -0700 | [diff] [blame] | 5015 | @TestApi |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 5016 | @SystemApi |
Todd Kennedy | dbaef6d | 2017-07-24 11:28:00 -0700 | [diff] [blame] | 5017 | @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS_FULL) |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 5018 | public abstract String getDefaultBrowserPackageNameAsUser(@UserIdInt int userId); |
Fabrice Di Meglio | 6227172 | 2015-04-10 17:24:02 -0700 | [diff] [blame] | 5019 | |
| 5020 | /** |
| 5021 | * Set the default Browser package name for a specific user. |
| 5022 | * |
| 5023 | * @param packageName The package name of the default Browser. |
| 5024 | * @param userId The user id. |
| 5025 | * |
| 5026 | * @return true if the default Browser for the specified user has been set, |
| 5027 | * otherwise return false. If the user id passed is -1 (all users) this call will not |
| 5028 | * do anything and just return false. |
| 5029 | * |
| 5030 | * @hide |
| 5031 | */ |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 5032 | @SystemApi |
Todd Kennedy | dbaef6d | 2017-07-24 11:28:00 -0700 | [diff] [blame] | 5033 | @RequiresPermission(allOf = { |
| 5034 | Manifest.permission.SET_PREFERRED_APPLICATIONS, |
| 5035 | Manifest.permission.INTERACT_ACROSS_USERS_FULL}) |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 5036 | public abstract boolean setDefaultBrowserPackageNameAsUser(String packageName, |
| 5037 | @UserIdInt int userId); |
Fabrice Di Meglio | 6227172 | 2015-04-10 17:24:02 -0700 | [diff] [blame] | 5038 | |
| 5039 | /** |
Dianne Hackborn | 880119b | 2010-11-18 22:26:40 -0800 | [diff] [blame] | 5040 | * Change the installer associated with a given package. There are limitations |
| 5041 | * on how the installer package can be changed; in particular: |
| 5042 | * <ul> |
| 5043 | * <li> A SecurityException will be thrown if <var>installerPackageName</var> |
| 5044 | * is not signed with the same certificate as the calling application. |
| 5045 | * <li> A SecurityException will be thrown if <var>targetPackage</var> already |
| 5046 | * has an installer package, and that installer package is not signed with |
| 5047 | * the same certificate as the calling application. |
| 5048 | * </ul> |
| 5049 | * |
| 5050 | * @param targetPackage The installed package whose installer will be changed. |
| 5051 | * @param installerPackageName The package name of the new installer. May be |
| 5052 | * null to clear the association. |
| 5053 | */ |
| 5054 | public abstract void setInstallerPackageName(String targetPackage, |
| 5055 | String installerPackageName); |
| 5056 | |
Todd Kennedy | ab53289 | 2017-03-08 14:19:49 -0800 | [diff] [blame] | 5057 | /** @hide */ |
| 5058 | @SystemApi |
| 5059 | @RequiresPermission(Manifest.permission.INSTALL_PACKAGES) |
| 5060 | public abstract void setUpdateAvailable(String packageName, boolean updateAvaialble); |
| 5061 | |
Dianne Hackborn | 880119b | 2010-11-18 22:26:40 -0800 | [diff] [blame] | 5062 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 5063 | * Attempts to delete a package. Since this may take a little while, the |
| 5064 | * result will be posted back to the given observer. A deletion will fail if |
| 5065 | * the calling context lacks the |
| 5066 | * {@link android.Manifest.permission#DELETE_PACKAGES} permission, if the |
| 5067 | * named package cannot be found, or if the named package is a system |
| 5068 | * package. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5069 | * |
| 5070 | * @param packageName The name of the package to delete |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 5071 | * @param observer An observer callback to get notified when the package |
| 5072 | * deletion is complete. |
| 5073 | * {@link android.content.pm.IPackageDeleteObserver#packageDeleted} |
| 5074 | * will be called when that happens. observer may be null to |
| 5075 | * indicate that no callback is desired. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5076 | * @hide |
| 5077 | */ |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 5078 | @RequiresPermission(Manifest.permission.DELETE_PACKAGES) |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 5079 | public abstract void deletePackage(String packageName, IPackageDeleteObserver observer, |
| 5080 | @DeleteFlags int flags); |
Jacek Surazski | 65e1317 | 2009-04-28 15:26:38 +0200 | [diff] [blame] | 5081 | |
| 5082 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 5083 | * Attempts to delete a package. Since this may take a little while, the |
| 5084 | * result will be posted back to the given observer. A deletion will fail if |
| 5085 | * the named package cannot be found, or if the named package is a system |
| 5086 | * package. |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 5087 | * |
| 5088 | * @param packageName The name of the package to delete |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 5089 | * @param observer An observer callback to get notified when the package |
| 5090 | * deletion is complete. |
| 5091 | * {@link android.content.pm.IPackageDeleteObserver#packageDeleted} |
| 5092 | * will be called when that happens. observer may be null to |
| 5093 | * indicate that no callback is desired. |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 5094 | * @param userId The user Id |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 5095 | * @hide |
| 5096 | */ |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 5097 | @RequiresPermission(anyOf = { |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 5098 | Manifest.permission.DELETE_PACKAGES, |
| 5099 | Manifest.permission.INTERACT_ACROSS_USERS_FULL}) |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 5100 | public abstract void deletePackageAsUser(@NonNull String packageName, |
| 5101 | IPackageDeleteObserver observer, @DeleteFlags int flags, @UserIdInt int userId); |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 5102 | |
| 5103 | /** |
Jacek Surazski | 65e1317 | 2009-04-28 15:26:38 +0200 | [diff] [blame] | 5104 | * Retrieve the package name of the application that installed a package. This identifies |
| 5105 | * which market the package came from. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 5106 | * |
Jacek Surazski | 65e1317 | 2009-04-28 15:26:38 +0200 | [diff] [blame] | 5107 | * @param packageName The name of the package to query |
Todd Kennedy | 9db6563 | 2018-02-13 11:12:35 -0800 | [diff] [blame] | 5108 | * @throws IllegalArgumentException if the given package name is not installed |
Jacek Surazski | 65e1317 | 2009-04-28 15:26:38 +0200 | [diff] [blame] | 5109 | */ |
| 5110 | public abstract String getInstallerPackageName(String packageName); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 5111 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5112 | /** |
| 5113 | * Attempts to clear the user data directory of an application. |
| 5114 | * Since this may take a little while, the result will |
| 5115 | * be posted back to the given observer. A deletion will fail if the |
| 5116 | * named package cannot be found, or if the named package is a "system package". |
| 5117 | * |
| 5118 | * @param packageName The name of the package |
| 5119 | * @param observer An observer callback to get notified when the operation is finished |
| 5120 | * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)} |
| 5121 | * will be called when that happens. observer may be null to indicate that |
| 5122 | * no callback is desired. |
| 5123 | * |
| 5124 | * @hide |
| 5125 | */ |
| 5126 | public abstract void clearApplicationUserData(String packageName, |
| 5127 | IPackageDataObserver observer); |
| 5128 | /** |
| 5129 | * Attempts to delete the cache files associated with an application. |
| 5130 | * Since this may take a little while, the result will |
| 5131 | * be posted back to the given observer. A deletion will fail if the calling context |
| 5132 | * lacks the {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the |
| 5133 | * named package cannot be found, or if the named package is a "system package". |
| 5134 | * |
| 5135 | * @param packageName The name of the package to delete |
| 5136 | * @param observer An observer callback to get notified when the cache file deletion |
| 5137 | * is complete. |
| 5138 | * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)} |
| 5139 | * will be called when that happens. observer may be null to indicate that |
| 5140 | * no callback is desired. |
| 5141 | * |
| 5142 | * @hide |
| 5143 | */ |
| 5144 | public abstract void deleteApplicationCacheFiles(String packageName, |
| 5145 | IPackageDataObserver observer); |
| 5146 | |
| 5147 | /** |
Suprabh Shukla | 78c9eb8 | 2016-04-12 15:51:35 -0700 | [diff] [blame] | 5148 | * Attempts to delete the cache files associated with an application for a given user. Since |
| 5149 | * this may take a little while, the result will be posted back to the given observer. A |
| 5150 | * deletion will fail if the calling context lacks the |
| 5151 | * {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the named package |
| 5152 | * cannot be found, or if the named package is a "system package". If {@code userId} does not |
| 5153 | * belong to the calling user, the caller must have |
| 5154 | * {@link android.Manifest.permission#INTERACT_ACROSS_USERS} permission. |
| 5155 | * |
| 5156 | * @param packageName The name of the package to delete |
| 5157 | * @param userId the user for which the cache files needs to be deleted |
| 5158 | * @param observer An observer callback to get notified when the cache file deletion is |
| 5159 | * complete. |
| 5160 | * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)} |
| 5161 | * will be called when that happens. observer may be null to indicate that no |
| 5162 | * callback is desired. |
| 5163 | * @hide |
| 5164 | */ |
| 5165 | public abstract void deleteApplicationCacheFilesAsUser(String packageName, int userId, |
| 5166 | IPackageDataObserver observer); |
| 5167 | |
| 5168 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5169 | * Free storage by deleting LRU sorted list of cache files across |
| 5170 | * all applications. If the currently available free storage |
| 5171 | * on the device is greater than or equal to the requested |
| 5172 | * free storage, no cache files are cleared. If the currently |
| 5173 | * available storage on the device is less than the requested |
| 5174 | * free storage, some or all of the cache files across |
| 5175 | * all applications are deleted (based on last accessed time) |
| 5176 | * to increase the free storage space on the device to |
| 5177 | * the requested value. There is no guarantee that clearing all |
| 5178 | * the cache files from all applications will clear up |
| 5179 | * enough storage to achieve the desired value. |
| 5180 | * @param freeStorageSize The number of bytes of storage to be |
| 5181 | * freed by the system. Say if freeStorageSize is XX, |
| 5182 | * and the current free storage is YY, |
| 5183 | * if XX is less than YY, just return. if not free XX-YY number |
| 5184 | * of bytes if possible. |
| 5185 | * @param observer call back used to notify when |
| 5186 | * the operation is completed |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 5187 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5188 | * @hide |
| 5189 | */ |
Jeff Sharkey | 529f91f | 2015-04-18 20:23:13 -0700 | [diff] [blame] | 5190 | public void freeStorageAndNotify(long freeStorageSize, IPackageDataObserver observer) { |
| 5191 | freeStorageAndNotify(null, freeStorageSize, observer); |
| 5192 | } |
| 5193 | |
| 5194 | /** {@hide} */ |
| 5195 | public abstract void freeStorageAndNotify(String volumeUuid, long freeStorageSize, |
| 5196 | IPackageDataObserver observer); |
Suchi Amalapurapu | 1ccac75 | 2009-06-12 10:09:58 -0700 | [diff] [blame] | 5197 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5198 | /** |
| 5199 | * Free storage by deleting LRU sorted list of cache files across |
| 5200 | * all applications. If the currently available free storage |
| 5201 | * on the device is greater than or equal to the requested |
| 5202 | * free storage, no cache files are cleared. If the currently |
| 5203 | * available storage on the device is less than the requested |
| 5204 | * free storage, some or all of the cache files across |
| 5205 | * all applications are deleted (based on last accessed time) |
| 5206 | * to increase the free storage space on the device to |
| 5207 | * the requested value. There is no guarantee that clearing all |
| 5208 | * the cache files from all applications will clear up |
| 5209 | * enough storage to achieve the desired value. |
| 5210 | * @param freeStorageSize The number of bytes of storage to be |
| 5211 | * freed by the system. Say if freeStorageSize is XX, |
| 5212 | * and the current free storage is YY, |
| 5213 | * if XX is less than YY, just return. if not free XX-YY number |
| 5214 | * of bytes if possible. |
Suchi Amalapurapu | 1ccac75 | 2009-06-12 10:09:58 -0700 | [diff] [blame] | 5215 | * @param pi IntentSender call back used to |
| 5216 | * notify when the operation is completed.May be null |
| 5217 | * to indicate that no call back is desired. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 5218 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5219 | * @hide |
| 5220 | */ |
Jeff Sharkey | 529f91f | 2015-04-18 20:23:13 -0700 | [diff] [blame] | 5221 | public void freeStorage(long freeStorageSize, IntentSender pi) { |
| 5222 | freeStorage(null, freeStorageSize, pi); |
| 5223 | } |
| 5224 | |
| 5225 | /** {@hide} */ |
| 5226 | 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] | 5227 | |
| 5228 | /** |
| 5229 | * Retrieve the size information for a package. |
| 5230 | * Since this may take a little while, the result will |
| 5231 | * be posted back to the given observer. The calling context |
| 5232 | * should have the {@link android.Manifest.permission#GET_PACKAGE_SIZE} permission. |
| 5233 | * |
| 5234 | * @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] | 5235 | * @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] | 5236 | * @param observer An observer callback to get notified when the operation |
| 5237 | * is complete. |
| 5238 | * {@link android.content.pm.IPackageStatsObserver#onGetStatsCompleted(PackageStats, boolean)} |
| 5239 | * The observer's callback is invoked with a PackageStats object(containing the |
| 5240 | * code, data and cache sizes of the package) and a boolean value representing |
| 5241 | * the status of the operation. observer may be null to indicate that |
| 5242 | * no callback is desired. |
| 5243 | * |
Jeff Sharkey | 60f95aa | 2017-03-08 13:57:15 -0700 | [diff] [blame] | 5244 | * @deprecated use {@link StorageStatsManager} instead. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5245 | * @hide |
| 5246 | */ |
Jeff Sharkey | 60f95aa | 2017-03-08 13:57:15 -0700 | [diff] [blame] | 5247 | @Deprecated |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 5248 | public abstract void getPackageSizeInfoAsUser(String packageName, @UserIdInt int userId, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5249 | IPackageStatsObserver observer); |
| 5250 | |
| 5251 | /** |
Jeff Sharkey | e06b4d1 | 2016-01-06 14:51:50 -0700 | [diff] [blame] | 5252 | * Like {@link #getPackageSizeInfoAsUser(String, int, IPackageStatsObserver)}, but |
Dianne Hackborn | 0c38049 | 2012-08-20 17:23:30 -0700 | [diff] [blame] | 5253 | * returns the size for the calling user. |
| 5254 | * |
Jeff Sharkey | 60f95aa | 2017-03-08 13:57:15 -0700 | [diff] [blame] | 5255 | * @deprecated use {@link StorageStatsManager} instead. |
Dianne Hackborn | 0c38049 | 2012-08-20 17:23:30 -0700 | [diff] [blame] | 5256 | * @hide |
| 5257 | */ |
Jeff Sharkey | 60f95aa | 2017-03-08 13:57:15 -0700 | [diff] [blame] | 5258 | @Deprecated |
Dianne Hackborn | 0c38049 | 2012-08-20 17:23:30 -0700 | [diff] [blame] | 5259 | public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) { |
Jeff Sharkey | ad357d1 | 2018-02-02 13:25:31 -0700 | [diff] [blame] | 5260 | getPackageSizeInfoAsUser(packageName, getUserId(), observer); |
Dianne Hackborn | 0c38049 | 2012-08-20 17:23:30 -0700 | [diff] [blame] | 5261 | } |
| 5262 | |
| 5263 | /** |
Dianne Hackborn | a7ca0e5 | 2009-12-01 14:31:55 -0800 | [diff] [blame] | 5264 | * @deprecated This function no longer does anything; it was an old |
kmccormick | ac66b85 | 2013-03-28 15:17:15 -0700 | [diff] [blame] | 5265 | * approach to managing preferred activities, which has been superseded |
| 5266 | * by (and conflicts with) the modern activity-based preferences. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5267 | */ |
Dianne Hackborn | a7ca0e5 | 2009-12-01 14:31:55 -0800 | [diff] [blame] | 5268 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5269 | public abstract void addPackageToPreferred(String packageName); |
| 5270 | |
| 5271 | /** |
Dianne Hackborn | a7ca0e5 | 2009-12-01 14:31:55 -0800 | [diff] [blame] | 5272 | * @deprecated This function no longer does anything; it was an old |
kmccormick | ac66b85 | 2013-03-28 15:17:15 -0700 | [diff] [blame] | 5273 | * approach to managing preferred activities, which has been superseded |
| 5274 | * by (and conflicts with) the modern activity-based preferences. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5275 | */ |
Dianne Hackborn | a7ca0e5 | 2009-12-01 14:31:55 -0800 | [diff] [blame] | 5276 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5277 | public abstract void removePackageFromPreferred(String packageName); |
| 5278 | |
| 5279 | /** |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 5280 | * Retrieve the list of all currently configured preferred packages. The |
| 5281 | * first package on the list is the most preferred, the last is the least |
| 5282 | * preferred. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5283 | * |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 5284 | * @param flags Additional option flags to modify the data returned. |
| 5285 | * @return A List of PackageInfo objects, one for each preferred |
| 5286 | * application, in order of preference. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5287 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 5288 | public abstract List<PackageInfo> getPreferredPackages(@PackageInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5289 | |
| 5290 | /** |
Dianne Hackborn | 2ee89ea | 2010-03-10 18:27:09 -0800 | [diff] [blame] | 5291 | * @deprecated This is a protected API that should not have been available |
| 5292 | * to third party applications. It is the platform's responsibility for |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 5293 | * assigning preferred activities and this cannot be directly modified. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 5294 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5295 | * Add a new preferred activity mapping to the system. This will be used |
| 5296 | * to automatically select the given activity component when |
| 5297 | * {@link Context#startActivity(Intent) Context.startActivity()} finds |
| 5298 | * multiple matching activities and also matches the given filter. |
| 5299 | * |
| 5300 | * @param filter The set of intents under which this activity will be |
| 5301 | * made preferred. |
| 5302 | * @param match The IntentFilter match category that this preference |
| 5303 | * applies to. |
| 5304 | * @param set The set of activities that the user was picking from when |
| 5305 | * this preference was made. |
| 5306 | * @param activity The component name of the activity that is to be |
| 5307 | * preferred. |
| 5308 | */ |
Dianne Hackborn | 2ee89ea | 2010-03-10 18:27:09 -0800 | [diff] [blame] | 5309 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5310 | public abstract void addPreferredActivity(IntentFilter filter, int match, |
| 5311 | ComponentName[] set, ComponentName activity); |
| 5312 | |
| 5313 | /** |
Amith Yamasani | a3f133a | 2012-08-09 17:11:28 -0700 | [diff] [blame] | 5314 | * Same as {@link #addPreferredActivity(IntentFilter, int, |
| 5315 | ComponentName[], ComponentName)}, but with a specific userId to apply the preference |
| 5316 | to. |
| 5317 | * @hide |
| 5318 | */ |
Jeff Sharkey | e06b4d1 | 2016-01-06 14:51:50 -0700 | [diff] [blame] | 5319 | public void addPreferredActivityAsUser(IntentFilter filter, int match, |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 5320 | ComponentName[] set, ComponentName activity, @UserIdInt int userId) { |
Amith Yamasani | a3f133a | 2012-08-09 17:11:28 -0700 | [diff] [blame] | 5321 | throw new RuntimeException("Not implemented. Must override in a subclass."); |
| 5322 | } |
| 5323 | |
| 5324 | /** |
Dianne Hackborn | 2ee89ea | 2010-03-10 18:27:09 -0800 | [diff] [blame] | 5325 | * @deprecated This is a protected API that should not have been available |
| 5326 | * to third party applications. It is the platform's responsibility for |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 5327 | * assigning preferred activities and this cannot be directly modified. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 5328 | * |
Satish Sampath | 8dbe612 | 2009-06-02 23:35:54 +0100 | [diff] [blame] | 5329 | * Replaces an existing preferred activity mapping to the system, and if that were not present |
| 5330 | * adds a new preferred activity. This will be used |
| 5331 | * to automatically select the given activity component when |
| 5332 | * {@link Context#startActivity(Intent) Context.startActivity()} finds |
| 5333 | * multiple matching activities and also matches the given filter. |
| 5334 | * |
| 5335 | * @param filter The set of intents under which this activity will be |
| 5336 | * made preferred. |
| 5337 | * @param match The IntentFilter match category that this preference |
| 5338 | * applies to. |
| 5339 | * @param set The set of activities that the user was picking from when |
| 5340 | * this preference was made. |
| 5341 | * @param activity The component name of the activity that is to be |
| 5342 | * preferred. |
| 5343 | * @hide |
| 5344 | */ |
Dianne Hackborn | 2ee89ea | 2010-03-10 18:27:09 -0800 | [diff] [blame] | 5345 | @Deprecated |
Satish Sampath | 8dbe612 | 2009-06-02 23:35:54 +0100 | [diff] [blame] | 5346 | public abstract void replacePreferredActivity(IntentFilter filter, int match, |
| 5347 | ComponentName[] set, ComponentName activity); |
| 5348 | |
| 5349 | /** |
Amith Yamasani | 41c1ded | 2014-08-05 11:15:05 -0700 | [diff] [blame] | 5350 | * @hide |
| 5351 | */ |
| 5352 | @Deprecated |
| 5353 | public void replacePreferredActivityAsUser(IntentFilter filter, int match, |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 5354 | ComponentName[] set, ComponentName activity, @UserIdInt int userId) { |
Amith Yamasani | 41c1ded | 2014-08-05 11:15:05 -0700 | [diff] [blame] | 5355 | throw new RuntimeException("Not implemented. Must override in a subclass."); |
| 5356 | } |
| 5357 | |
| 5358 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5359 | * Remove all preferred activity mappings, previously added with |
| 5360 | * {@link #addPreferredActivity}, from the |
| 5361 | * system whose activities are implemented in the given package name. |
Dianne Hackborn | 2ee89ea | 2010-03-10 18:27:09 -0800 | [diff] [blame] | 5362 | * An application can only clear its own package(s). |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5363 | * |
| 5364 | * @param packageName The name of the package whose preferred activity |
| 5365 | * mappings are to be removed. |
| 5366 | */ |
| 5367 | public abstract void clearPackagePreferredActivities(String packageName); |
| 5368 | |
| 5369 | /** |
| 5370 | * Retrieve all preferred activities, previously added with |
| 5371 | * {@link #addPreferredActivity}, that are |
| 5372 | * currently registered with the system. |
| 5373 | * |
John Spurlock | 38e6425 | 2015-03-18 12:09:32 -0400 | [diff] [blame] | 5374 | * @param outFilters A required list in which to place the filters of all of the |
| 5375 | * preferred activities. |
| 5376 | * @param outActivities A required list in which to place the component names of |
| 5377 | * all of the preferred activities. |
| 5378 | * @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] | 5379 | * the list. If null, all activities will be returned; if non-null, only |
| 5380 | * those activities in the given package are returned. |
| 5381 | * |
| 5382 | * @return Returns the total number of registered preferred activities |
| 5383 | * (the number of distinct IntentFilter records, not the number of unique |
| 5384 | * activity components) that were found. |
| 5385 | */ |
John Spurlock | 38e6425 | 2015-03-18 12:09:32 -0400 | [diff] [blame] | 5386 | public abstract int getPreferredActivities(@NonNull List<IntentFilter> outFilters, |
| 5387 | @NonNull List<ComponentName> outActivities, String packageName); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5388 | |
| 5389 | /** |
Christopher Tate | a2a0850d | 2013-09-05 16:38:58 -0700 | [diff] [blame] | 5390 | * Ask for the set of available 'home' activities and the current explicit |
| 5391 | * default, if any. |
| 5392 | * @hide |
| 5393 | */ |
| 5394 | public abstract ComponentName getHomeActivities(List<ResolveInfo> outActivities); |
| 5395 | |
| 5396 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5397 | * Set the enabled setting for a package component (activity, receiver, service, provider). |
| 5398 | * This setting will override any enabled state which may have been set by the component in its |
| 5399 | * manifest. |
| 5400 | * |
| 5401 | * @param componentName The component to enable |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5402 | * @param newState The new enabled state for the component. |
| 5403 | * @param flags Optional behavior flags. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5404 | */ |
| 5405 | public abstract void setComponentEnabledSetting(ComponentName componentName, |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5406 | @EnabledState int newState, @EnabledFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5407 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5408 | /** |
Amaury Medeiros | dde2426 | 2014-06-03 20:06:41 -0300 | [diff] [blame] | 5409 | * Return the enabled setting for a package component (activity, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5410 | * receiver, service, provider). This returns the last value set by |
| 5411 | * {@link #setComponentEnabledSetting(ComponentName, int, int)}; in most |
| 5412 | * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since |
| 5413 | * the value originally specified in the manifest has not been modified. |
| 5414 | * |
| 5415 | * @param componentName The component to retrieve. |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5416 | * @return Returns the current enabled state for the component. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5417 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5418 | public abstract @EnabledState int getComponentEnabledSetting( |
| 5419 | ComponentName componentName); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5420 | |
| 5421 | /** |
| 5422 | * Set the enabled setting for an application |
| 5423 | * This setting will override any enabled state which may have been set by the application in |
| 5424 | * its manifest. It also overrides the enabled state set in the manifest for any of the |
| 5425 | * application's components. It does not override any enabled state set by |
| 5426 | * {@link #setComponentEnabledSetting} for any of the application's components. |
| 5427 | * |
| 5428 | * @param packageName The package name of the application to enable |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5429 | * @param newState The new enabled state for the application. |
| 5430 | * @param flags Optional behavior flags. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5431 | */ |
| 5432 | public abstract void setApplicationEnabledSetting(String packageName, |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5433 | @EnabledState int newState, @EnabledFlags int flags); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 5434 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5435 | /** |
Amaury Medeiros | dde2426 | 2014-06-03 20:06:41 -0300 | [diff] [blame] | 5436 | * Return the enabled setting for an application. This returns |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5437 | * the last value set by |
| 5438 | * {@link #setApplicationEnabledSetting(String, int, int)}; in most |
| 5439 | * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since |
| 5440 | * the value originally specified in the manifest has not been modified. |
| 5441 | * |
Amaury Medeiros | dde2426 | 2014-06-03 20:06:41 -0300 | [diff] [blame] | 5442 | * @param packageName The package name of the application to retrieve. |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5443 | * @return Returns the current enabled state for the application. |
Mathew Inwood | 1b9f8d9 | 2011-09-26 13:23:56 +0100 | [diff] [blame] | 5444 | * @throws IllegalArgumentException if the named package does not exist. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5445 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5446 | public abstract @EnabledState int getApplicationEnabledSetting(String packageName); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5447 | |
| 5448 | /** |
Sudheer Shanka | bbb3ff2 | 2015-07-09 15:39:23 +0100 | [diff] [blame] | 5449 | * Flush the package restrictions for a given user to disk. This forces the package restrictions |
| 5450 | * like component and package enabled settings to be written to disk and avoids the delay that |
| 5451 | * is otherwise present when changing those settings. |
| 5452 | * |
| 5453 | * @param userId Ther userId of the user whose restrictions are to be flushed. |
| 5454 | * @hide |
| 5455 | */ |
| 5456 | public abstract void flushPackageRestrictionsAsUser(int userId); |
| 5457 | |
| 5458 | /** |
Amith Yamasani | e5bcff6 | 2014-07-19 15:44:09 -0700 | [diff] [blame] | 5459 | * 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] | 5460 | * 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] | 5461 | * package file. Application can be unhidden by either resetting the hidden state |
| 5462 | * or by installing it, such as with {@link #installExistingPackage(String)} |
Amith Yamasani | 655d0e2 | 2013-06-12 14:19:10 -0700 | [diff] [blame] | 5463 | * @hide |
| 5464 | */ |
Amith Yamasani | e5bcff6 | 2014-07-19 15:44:09 -0700 | [diff] [blame] | 5465 | public abstract boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden, |
Amith Yamasani | 655d0e2 | 2013-06-12 14:19:10 -0700 | [diff] [blame] | 5466 | UserHandle userHandle); |
| 5467 | |
| 5468 | /** |
Amith Yamasani | e5bcff6 | 2014-07-19 15:44:09 -0700 | [diff] [blame] | 5469 | * Returns the hidden state of a package. |
| 5470 | * @see #setApplicationHiddenSettingAsUser(String, boolean, UserHandle) |
Amith Yamasani | 655d0e2 | 2013-06-12 14:19:10 -0700 | [diff] [blame] | 5471 | * @hide |
| 5472 | */ |
Amith Yamasani | e5bcff6 | 2014-07-19 15:44:09 -0700 | [diff] [blame] | 5473 | public abstract boolean getApplicationHiddenSettingAsUser(String packageName, |
Amith Yamasani | 655d0e2 | 2013-06-12 14:19:10 -0700 | [diff] [blame] | 5474 | UserHandle userHandle); |
| 5475 | |
| 5476 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5477 | * Return whether the device has been booted into safe mode. |
| 5478 | */ |
| 5479 | public abstract boolean isSafeMode(); |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 5480 | |
| 5481 | /** |
Svetoslav | f7c06eb | 2015-06-10 18:43:22 -0700 | [diff] [blame] | 5482 | * Adds a listener for permission changes for installed packages. |
| 5483 | * |
| 5484 | * @param listener The listener to add. |
| 5485 | * |
| 5486 | * @hide |
| 5487 | */ |
| 5488 | @SystemApi |
| 5489 | @RequiresPermission(Manifest.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS) |
| 5490 | public abstract void addOnPermissionsChangeListener(OnPermissionsChangedListener listener); |
| 5491 | |
| 5492 | /** |
| 5493 | * Remvoes a listener for permission changes for installed packages. |
| 5494 | * |
| 5495 | * @param listener The listener to remove. |
| 5496 | * |
| 5497 | * @hide |
| 5498 | */ |
| 5499 | @SystemApi |
Jeff Sharkey | d86b8fe | 2017-06-02 17:36:26 -0600 | [diff] [blame] | 5500 | @RequiresPermission(Manifest.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS) |
Svetoslav | f7c06eb | 2015-06-10 18:43:22 -0700 | [diff] [blame] | 5501 | public abstract void removeOnPermissionsChangeListener(OnPermissionsChangedListener listener); |
| 5502 | |
| 5503 | /** |
dcashman | 9d2f441 | 2014-06-09 09:27:54 -0700 | [diff] [blame] | 5504 | * Return the {@link KeySet} associated with the String alias for this |
| 5505 | * application. |
| 5506 | * |
| 5507 | * @param alias The alias for a given {@link KeySet} as defined in the |
| 5508 | * application's AndroidManifest.xml. |
dcashman | c6f2249 | 2014-08-14 09:54:51 -0700 | [diff] [blame] | 5509 | * @hide |
dcashman | 9d2f441 | 2014-06-09 09:27:54 -0700 | [diff] [blame] | 5510 | */ |
| 5511 | public abstract KeySet getKeySetByAlias(String packageName, String alias); |
| 5512 | |
Ihab Awad | 1ec6888 | 2014-09-12 11:09:01 -0700 | [diff] [blame] | 5513 | /** Return the signing {@link KeySet} for this application. |
dcashman | c6f2249 | 2014-08-14 09:54:51 -0700 | [diff] [blame] | 5514 | * @hide |
| 5515 | */ |
dcashman | 9d2f441 | 2014-06-09 09:27:54 -0700 | [diff] [blame] | 5516 | public abstract KeySet getSigningKeySet(String packageName); |
| 5517 | |
| 5518 | /** |
| 5519 | * Return whether the package denoted by packageName has been signed by all |
| 5520 | * of the keys specified by the {@link KeySet} ks. This will return true if |
| 5521 | * the package has been signed by additional keys (a superset) as well. |
| 5522 | * Compare to {@link #isSignedByExactly(String packageName, KeySet ks)}. |
dcashman | c6f2249 | 2014-08-14 09:54:51 -0700 | [diff] [blame] | 5523 | * @hide |
dcashman | 9d2f441 | 2014-06-09 09:27:54 -0700 | [diff] [blame] | 5524 | */ |
| 5525 | public abstract boolean isSignedBy(String packageName, KeySet ks); |
| 5526 | |
| 5527 | /** |
| 5528 | * Return whether the package denoted by packageName has been signed by all |
| 5529 | * of, and only, the keys specified by the {@link KeySet} ks. Compare to |
| 5530 | * {@link #isSignedBy(String packageName, KeySet ks)}. |
dcashman | c6f2249 | 2014-08-14 09:54:51 -0700 | [diff] [blame] | 5531 | * @hide |
dcashman | 9d2f441 | 2014-06-09 09:27:54 -0700 | [diff] [blame] | 5532 | */ |
| 5533 | public abstract boolean isSignedByExactly(String packageName, KeySet ks); |
| 5534 | |
| 5535 | /** |
Andrei Stingaceanu | eb84b18 | 2016-01-26 18:39:55 +0000 | [diff] [blame] | 5536 | * 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] | 5537 | * |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 5538 | * <p>It doesn't remove the data or the actual package file. The application's notifications |
Suprabh Shukla | 2fd43ba | 2018-03-22 16:57:49 -0700 | [diff] [blame] | 5539 | * will be hidden, any of its started activities will be stopped and it will not be able to |
Suprabh Shukla | 3e03ab9 | 2018-04-11 16:03:49 -0700 | [diff] [blame] | 5540 | * show toasts or system alert windows or ring the device. |
| 5541 | * |
| 5542 | * <p>When the user tries to launch a suspended app, a system dialog with the given |
| 5543 | * {@code dialogMessage} will be shown instead. Since the message is supplied to the system as |
| 5544 | * a {@link String}, the caller needs to take care of localization as needed. |
| 5545 | * The dialog message can optionally contain a placeholder for the name of the suspended app. |
| 5546 | * The system uses {@link String#format(Locale, String, Object...) String.format} to insert the |
| 5547 | * app name into the message, so an example format string could be {@code "The app %1$s is |
| 5548 | * currently suspended"}. This makes it easier for callers to provide a single message which |
| 5549 | * works for all the packages being suspended in a single call. |
Andrei Stingaceanu | eb84b18 | 2016-01-26 18:39:55 +0000 | [diff] [blame] | 5550 | * |
Kenny Guy | 871f3eb | 2016-03-09 20:06:16 +0000 | [diff] [blame] | 5551 | * <p>The package must already be installed. If the package is uninstalled while suspended |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 5552 | * the package will no longer be suspended. </p> |
| 5553 | * |
| 5554 | * <p>Optionally, the suspending app can provide extra information in the form of |
| 5555 | * {@link PersistableBundle} objects to be shared with the apps being suspended and the |
Suprabh Shukla | 3e03ab9 | 2018-04-11 16:03:49 -0700 | [diff] [blame] | 5556 | * launcher to support customization that they might need to handle the suspended state. |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 5557 | * |
| 5558 | * <p>The caller must hold {@link Manifest.permission#SUSPEND_APPS} or |
| 5559 | * {@link Manifest.permission#MANAGE_USERS} to use this api.</p> |
Kenny Guy | 871f3eb | 2016-03-09 20:06:16 +0000 | [diff] [blame] | 5560 | * |
Andrei Stingaceanu | eb84b18 | 2016-01-26 18:39:55 +0000 | [diff] [blame] | 5561 | * @param packageNames The names of the packages to set the suspended status. |
| 5562 | * @param suspended If set to {@code true} than the packages will be suspended, if set to |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 5563 | * {@code false}, the packages will be unsuspended. |
| 5564 | * @param appExtras An optional {@link PersistableBundle} that the suspending app can provide |
| 5565 | * which will be shared with the apps being suspended. Ignored if |
| 5566 | * {@code suspended} is false. |
| 5567 | * @param launcherExtras An optional {@link PersistableBundle} that the suspending app can |
| 5568 | * provide which will be shared with the launcher. Ignored if |
| 5569 | * {@code suspended} is false. |
| 5570 | * @param dialogMessage The message to be displayed to the user, when they try to launch a |
| 5571 | * suspended app. |
Andrei Stingaceanu | 1e28391 | 2015-11-26 15:26:28 +0000 | [diff] [blame] | 5572 | * |
Suprabh Shukla | 3e03ab9 | 2018-04-11 16:03:49 -0700 | [diff] [blame] | 5573 | * @return an array of package names for which the suspended status could not be set as |
| 5574 | * requested in this method. |
Andrei Stingaceanu | eb84b18 | 2016-01-26 18:39:55 +0000 | [diff] [blame] | 5575 | * |
Andrei Stingaceanu | 1e28391 | 2015-11-26 15:26:28 +0000 | [diff] [blame] | 5576 | * @hide |
| 5577 | */ |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 5578 | @SystemApi |
Suprabh Shukla | 14405c9 | 2018-05-16 20:41:00 -0700 | [diff] [blame] | 5579 | @RequiresPermission(Manifest.permission.SUSPEND_APPS) |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 5580 | public String[] setPackagesSuspended(String[] packageNames, boolean suspended, |
| 5581 | @Nullable PersistableBundle appExtras, @Nullable PersistableBundle launcherExtras, |
| 5582 | String dialogMessage) { |
| 5583 | throw new UnsupportedOperationException("setPackagesSuspended not implemented"); |
| 5584 | } |
Andrei Stingaceanu | 1e28391 | 2015-11-26 15:26:28 +0000 | [diff] [blame] | 5585 | |
Andrei Stingaceanu | 355b232 | 2016-02-12 16:43:51 +0000 | [diff] [blame] | 5586 | /** |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 5587 | * @see #setPackagesSuspended(String[], boolean, PersistableBundle, PersistableBundle, String) |
Andrei Stingaceanu | 355b232 | 2016-02-12 16:43:51 +0000 | [diff] [blame] | 5588 | * @param packageName The name of the package to get the suspended status of. |
| 5589 | * @param userId The user id. |
| 5590 | * @return {@code true} if the package is suspended or {@code false} if the package is not |
Suprabh Shukla | 96212bc | 2018-04-10 15:04:51 -0700 | [diff] [blame] | 5591 | * suspended. |
| 5592 | * @throws IllegalArgumentException if the package was not found. |
Andrei Stingaceanu | 355b232 | 2016-02-12 16:43:51 +0000 | [diff] [blame] | 5593 | * @hide |
| 5594 | */ |
| 5595 | public abstract boolean isPackageSuspendedForUser(String packageName, int userId); |
| 5596 | |
Jeff Sharkey | 9bc89af | 2017-01-11 11:25:50 -0700 | [diff] [blame] | 5597 | /** |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 5598 | * Query if an app is currently suspended. |
| 5599 | * |
| 5600 | * @return {@code true} if the given package is suspended, {@code false} otherwise |
Suprabh Shukla | 96212bc | 2018-04-10 15:04:51 -0700 | [diff] [blame] | 5601 | * @throws NameNotFoundException if the package could not be found. |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 5602 | * |
| 5603 | * @see #setPackagesSuspended(String[], boolean, PersistableBundle, PersistableBundle, String) |
| 5604 | * @hide |
| 5605 | */ |
| 5606 | @SystemApi |
Suprabh Shukla | 96212bc | 2018-04-10 15:04:51 -0700 | [diff] [blame] | 5607 | public boolean isPackageSuspended(String packageName) throws NameNotFoundException { |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 5608 | throw new UnsupportedOperationException("isPackageSuspended not implemented"); |
| 5609 | } |
| 5610 | |
| 5611 | /** |
Suprabh Shukla | 2fd43ba | 2018-03-22 16:57:49 -0700 | [diff] [blame] | 5612 | * Apps can query this to know if they have been suspended. A system app with the permission |
| 5613 | * {@code android.permission.SUSPEND_APPS} can put any app on the device into a suspended state. |
| 5614 | * |
| 5615 | * <p>While in this state, the application's notifications will be hidden, any of its started |
| 5616 | * activities will be stopped and it will not be able to show toasts or dialogs or ring the |
| 5617 | * device. When the user tries to launch a suspended app, the system will, instead, show a |
| 5618 | * dialog to the user informing them that they cannot use this app while it is suspended. |
| 5619 | * |
| 5620 | * <p>When an app is put into this state, the broadcast action |
| 5621 | * {@link Intent#ACTION_MY_PACKAGE_SUSPENDED} will be delivered to any of its broadcast |
| 5622 | * receivers that included this action in their intent-filters, <em>including manifest |
| 5623 | * receivers.</em> Similarly, a broadcast action {@link Intent#ACTION_MY_PACKAGE_UNSUSPENDED} |
| 5624 | * is delivered when a previously suspended app is taken out of this state. |
| 5625 | * </p> |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 5626 | * |
| 5627 | * @return {@code true} if the calling package has been suspended, {@code false} otherwise. |
| 5628 | * |
| 5629 | * @see #getSuspendedPackageAppExtras() |
Suprabh Shukla | 2fd43ba | 2018-03-22 16:57:49 -0700 | [diff] [blame] | 5630 | * @see Intent#ACTION_MY_PACKAGE_SUSPENDED |
| 5631 | * @see Intent#ACTION_MY_PACKAGE_UNSUSPENDED |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 5632 | */ |
| 5633 | public boolean isPackageSuspended() { |
| 5634 | throw new UnsupportedOperationException("isPackageSuspended not implemented"); |
| 5635 | } |
| 5636 | |
| 5637 | /** |
Suprabh Shukla | 96212bc | 2018-04-10 15:04:51 -0700 | [diff] [blame] | 5638 | * Returns a {@link Bundle} of extras that was meant to be sent to the calling app when it was |
| 5639 | * suspended. An app with the permission {@code android.permission.SUSPEND_APPS} can supply this |
| 5640 | * to the system at the time of suspending an app. |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 5641 | * |
Suprabh Shukla | 96212bc | 2018-04-10 15:04:51 -0700 | [diff] [blame] | 5642 | * <p>This is the same {@link Bundle} that is sent along with the broadcast |
| 5643 | * {@link Intent#ACTION_MY_PACKAGE_SUSPENDED}, whenever the app is suspended. The contents of |
| 5644 | * this {@link Bundle} are a contract between the suspended app and the suspending app. |
| 5645 | * |
| 5646 | * <p>Note: These extras are optional, so if no extras were supplied to the system, this method |
| 5647 | * will return {@code null}, even when the calling app has been suspended. |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 5648 | * |
Suprabh Shukla | 2fd43ba | 2018-03-22 16:57:49 -0700 | [diff] [blame] | 5649 | * @return A {@link Bundle} containing the extras for the app, or {@code null} if the |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 5650 | * package is not currently suspended. |
Suprabh Shukla | 2fd43ba | 2018-03-22 16:57:49 -0700 | [diff] [blame] | 5651 | * |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 5652 | * @see #isPackageSuspended() |
Suprabh Shukla | 2fd43ba | 2018-03-22 16:57:49 -0700 | [diff] [blame] | 5653 | * @see Intent#ACTION_MY_PACKAGE_UNSUSPENDED |
| 5654 | * @see Intent#ACTION_MY_PACKAGE_SUSPENDED |
Suprabh Shukla | 96212bc | 2018-04-10 15:04:51 -0700 | [diff] [blame] | 5655 | * @see Intent#EXTRA_SUSPENDED_PACKAGE_EXTRAS |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 5656 | */ |
Suprabh Shukla | 2fd43ba | 2018-03-22 16:57:49 -0700 | [diff] [blame] | 5657 | public @Nullable Bundle getSuspendedPackageAppExtras() { |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 5658 | throw new UnsupportedOperationException("getSuspendedPackageAppExtras not implemented"); |
| 5659 | } |
| 5660 | |
| 5661 | /** |
Jeff Sharkey | 9bc89af | 2017-01-11 11:25:50 -0700 | [diff] [blame] | 5662 | * Provide a hint of what the {@link ApplicationInfo#category} value should |
| 5663 | * be for the given package. |
| 5664 | * <p> |
| 5665 | * This hint can only be set by the app which installed this package, as |
| 5666 | * determined by {@link #getInstallerPackageName(String)}. |
Jeff Sharkey | 60a82cd | 2017-04-18 18:19:16 -0600 | [diff] [blame] | 5667 | * |
| 5668 | * @param packageName the package to change the category hint for. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 5669 | * @param categoryHint the category hint to set. |
Jeff Sharkey | 9bc89af | 2017-01-11 11:25:50 -0700 | [diff] [blame] | 5670 | */ |
Jeff Sharkey | 60a82cd | 2017-04-18 18:19:16 -0600 | [diff] [blame] | 5671 | public abstract void setApplicationCategoryHint(@NonNull String packageName, |
Jeff Sharkey | 9bc89af | 2017-01-11 11:25:50 -0700 | [diff] [blame] | 5672 | @ApplicationInfo.Category int categoryHint); |
| 5673 | |
Jeff Sharkey | b2b9ab8 | 2015-04-05 21:10:42 -0700 | [diff] [blame] | 5674 | /** {@hide} */ |
Jeff Sharkey | 620b32b | 2015-04-23 19:36:02 -0700 | [diff] [blame] | 5675 | public static boolean isMoveStatusFinished(int status) { |
| 5676 | return (status < 0 || status > 100); |
| 5677 | } |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 5678 | |
Jeff Sharkey | e2d45be | 2015-04-15 17:14:12 -0700 | [diff] [blame] | 5679 | /** {@hide} */ |
Jeff Sharkey | 620b32b | 2015-04-23 19:36:02 -0700 | [diff] [blame] | 5680 | public static abstract class MoveCallback { |
Jeff Sharkey | 50a0545 | 2015-04-29 11:24:52 -0700 | [diff] [blame] | 5681 | public void onCreated(int moveId, Bundle extras) {} |
| 5682 | public abstract void onStatusChanged(int moveId, int status, long estMillis); |
Jeff Sharkey | 620b32b | 2015-04-23 19:36:02 -0700 | [diff] [blame] | 5683 | } |
Jeff Sharkey | e2d45be | 2015-04-15 17:14:12 -0700 | [diff] [blame] | 5684 | |
| 5685 | /** {@hide} */ |
Jeff Sharkey | 620b32b | 2015-04-23 19:36:02 -0700 | [diff] [blame] | 5686 | public abstract int getMoveStatus(int moveId); |
| 5687 | |
| 5688 | /** {@hide} */ |
| 5689 | public abstract void registerMoveCallback(MoveCallback callback, Handler handler); |
| 5690 | /** {@hide} */ |
| 5691 | public abstract void unregisterMoveCallback(MoveCallback callback); |
| 5692 | |
| 5693 | /** {@hide} */ |
| 5694 | public abstract int movePackage(String packageName, VolumeInfo vol); |
| 5695 | /** {@hide} */ |
| 5696 | public abstract @Nullable VolumeInfo getPackageCurrentVolume(ApplicationInfo app); |
| 5697 | /** {@hide} */ |
| 5698 | public abstract @NonNull List<VolumeInfo> getPackageCandidateVolumes(ApplicationInfo app); |
| 5699 | |
| 5700 | /** {@hide} */ |
| 5701 | public abstract int movePrimaryStorage(VolumeInfo vol); |
| 5702 | /** {@hide} */ |
| 5703 | public abstract @Nullable VolumeInfo getPrimaryStorageCurrentVolume(); |
| 5704 | /** {@hide} */ |
| 5705 | public abstract @NonNull List<VolumeInfo> getPrimaryStorageCandidateVolumes(); |
Jeff Sharkey | e2d45be | 2015-04-15 17:14:12 -0700 | [diff] [blame] | 5706 | |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 5707 | /** |
Amith Yamasani | 1359360 | 2012-03-22 16:16:17 -0700 | [diff] [blame] | 5708 | * Returns the device identity that verifiers can use to associate their scheme to a particular |
| 5709 | * 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] | 5710 | * |
Kenny Root | 0aaa0d9 | 2011-09-12 16:42:55 -0700 | [diff] [blame] | 5711 | * @return identity that uniquely identifies current device |
| 5712 | * @hide |
| 5713 | */ |
| 5714 | public abstract VerifierDeviceIdentity getVerifierDeviceIdentity(); |
Amith Yamasani | 742a671 | 2011-05-04 14:49:28 -0700 | [diff] [blame] | 5715 | |
Jeff Sharkey | 6c833e0 | 2014-07-14 22:44:30 -0700 | [diff] [blame] | 5716 | /** |
Jeff Hao | 9f60c08 | 2014-10-28 18:51:07 -0700 | [diff] [blame] | 5717 | * Returns true if the device is upgrading, such as first boot after OTA. |
| 5718 | * |
| 5719 | * @hide |
| 5720 | */ |
| 5721 | public abstract boolean isUpgrade(); |
| 5722 | |
| 5723 | /** |
Jeff Sharkey | 6c833e0 | 2014-07-14 22:44:30 -0700 | [diff] [blame] | 5724 | * Return interface that offers the ability to install, upgrade, and remove |
| 5725 | * applications on the device. |
| 5726 | */ |
Jeff Sharkey | 16c8e3f | 2014-07-24 17:08:17 -0700 | [diff] [blame] | 5727 | public abstract @NonNull PackageInstaller getPackageInstaller(); |
Jeff Sharkey | 3a44f3f | 2014-04-28 17:36:31 -0700 | [diff] [blame] | 5728 | |
Amith Yamasani | 742a671 | 2011-05-04 14:49:28 -0700 | [diff] [blame] | 5729 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 5730 | * Adds a {@code CrossProfileIntentFilter}. After calling this method all |
| 5731 | * intents sent from the user with id sourceUserId can also be be resolved |
| 5732 | * by activities in the user with id targetUserId if they match the |
| 5733 | * specified intent filter. |
| 5734 | * |
Nicolas Prevot | 3f7777f | 2014-07-24 15:58:39 +0100 | [diff] [blame] | 5735 | * @param filter The {@link IntentFilter} the intent has to match |
| 5736 | * @param sourceUserId The source user id. |
| 5737 | * @param targetUserId The target user id. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 5738 | * @param flags The possible values are {@link #SKIP_CURRENT_PROFILE} and |
| 5739 | * {@link #ONLY_IF_NO_MATCH_FOUND}. |
Nicolas Prevot | c79586e | 2014-05-06 12:47:57 +0100 | [diff] [blame] | 5740 | * @hide |
| 5741 | */ |
Nicolas Prevot | 63798c5 | 2014-05-27 13:22:38 +0100 | [diff] [blame] | 5742 | public abstract void addCrossProfileIntentFilter(IntentFilter filter, int sourceUserId, |
| 5743 | int targetUserId, int flags); |
Nicolas Prevot | c79586e | 2014-05-06 12:47:57 +0100 | [diff] [blame] | 5744 | |
| 5745 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 5746 | * Clearing {@code CrossProfileIntentFilter}s which have the specified user |
| 5747 | * as their source, and have been set by the app calling this method. |
| 5748 | * |
Nicolas Prevot | 3f7777f | 2014-07-24 15:58:39 +0100 | [diff] [blame] | 5749 | * @param sourceUserId The source user id. |
Nicolas Prevot | c79586e | 2014-05-06 12:47:57 +0100 | [diff] [blame] | 5750 | * @hide |
| 5751 | */ |
Nicolas Prevot | 8194899 | 2014-05-16 18:25:26 +0100 | [diff] [blame] | 5752 | public abstract void clearCrossProfileIntentFilters(int sourceUserId); |
Alexandra Gherghina | 6e2ae25 | 2014-06-12 16:03:58 +0100 | [diff] [blame] | 5753 | |
| 5754 | /** |
Nicolas Prevot | 88cc346 | 2014-05-14 14:51:48 +0100 | [diff] [blame] | 5755 | * @hide |
| 5756 | */ |
Nicolas Prevot | 7f7b0c7 | 2014-06-23 15:59:38 +0100 | [diff] [blame] | 5757 | public abstract Drawable loadItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo); |
Jeff Sharkey | 6c833e0 | 2014-07-14 22:44:30 -0700 | [diff] [blame] | 5758 | |
Benjamin Franz | ec2d48b | 2014-10-01 15:38:43 +0100 | [diff] [blame] | 5759 | /** |
| 5760 | * @hide |
| 5761 | */ |
| 5762 | public abstract Drawable loadUnbadgedItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo); |
| 5763 | |
Jeff Sharkey | 6c833e0 | 2014-07-14 22:44:30 -0700 | [diff] [blame] | 5764 | /** {@hide} */ |
| 5765 | public abstract boolean isPackageAvailable(String packageName); |
Jeff Sharkey | 16c8e3f | 2014-07-24 17:08:17 -0700 | [diff] [blame] | 5766 | |
| 5767 | /** {@hide} */ |
Jeff Sharkey | a090743 | 2014-08-15 10:23:11 -0700 | [diff] [blame] | 5768 | public static String installStatusToString(int status, String msg) { |
| 5769 | final String str = installStatusToString(status); |
| 5770 | if (msg != null) { |
| 5771 | return str + ": " + msg; |
| 5772 | } else { |
| 5773 | return str; |
| 5774 | } |
| 5775 | } |
| 5776 | |
| 5777 | /** {@hide} */ |
Jeff Sharkey | 16c8e3f | 2014-07-24 17:08:17 -0700 | [diff] [blame] | 5778 | public static String installStatusToString(int status) { |
| 5779 | switch (status) { |
| 5780 | case INSTALL_SUCCEEDED: return "INSTALL_SUCCEEDED"; |
| 5781 | case INSTALL_FAILED_ALREADY_EXISTS: return "INSTALL_FAILED_ALREADY_EXISTS"; |
| 5782 | case INSTALL_FAILED_INVALID_APK: return "INSTALL_FAILED_INVALID_APK"; |
| 5783 | case INSTALL_FAILED_INVALID_URI: return "INSTALL_FAILED_INVALID_URI"; |
| 5784 | case INSTALL_FAILED_INSUFFICIENT_STORAGE: return "INSTALL_FAILED_INSUFFICIENT_STORAGE"; |
| 5785 | case INSTALL_FAILED_DUPLICATE_PACKAGE: return "INSTALL_FAILED_DUPLICATE_PACKAGE"; |
| 5786 | case INSTALL_FAILED_NO_SHARED_USER: return "INSTALL_FAILED_NO_SHARED_USER"; |
| 5787 | case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return "INSTALL_FAILED_UPDATE_INCOMPATIBLE"; |
| 5788 | case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return "INSTALL_FAILED_SHARED_USER_INCOMPATIBLE"; |
| 5789 | case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return "INSTALL_FAILED_MISSING_SHARED_LIBRARY"; |
| 5790 | case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return "INSTALL_FAILED_REPLACE_COULDNT_DELETE"; |
| 5791 | case INSTALL_FAILED_DEXOPT: return "INSTALL_FAILED_DEXOPT"; |
| 5792 | case INSTALL_FAILED_OLDER_SDK: return "INSTALL_FAILED_OLDER_SDK"; |
| 5793 | case INSTALL_FAILED_CONFLICTING_PROVIDER: return "INSTALL_FAILED_CONFLICTING_PROVIDER"; |
| 5794 | case INSTALL_FAILED_NEWER_SDK: return "INSTALL_FAILED_NEWER_SDK"; |
| 5795 | case INSTALL_FAILED_TEST_ONLY: return "INSTALL_FAILED_TEST_ONLY"; |
| 5796 | case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return "INSTALL_FAILED_CPU_ABI_INCOMPATIBLE"; |
| 5797 | case INSTALL_FAILED_MISSING_FEATURE: return "INSTALL_FAILED_MISSING_FEATURE"; |
| 5798 | case INSTALL_FAILED_CONTAINER_ERROR: return "INSTALL_FAILED_CONTAINER_ERROR"; |
| 5799 | case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return "INSTALL_FAILED_INVALID_INSTALL_LOCATION"; |
| 5800 | case INSTALL_FAILED_MEDIA_UNAVAILABLE: return "INSTALL_FAILED_MEDIA_UNAVAILABLE"; |
| 5801 | case INSTALL_FAILED_VERIFICATION_TIMEOUT: return "INSTALL_FAILED_VERIFICATION_TIMEOUT"; |
| 5802 | case INSTALL_FAILED_VERIFICATION_FAILURE: return "INSTALL_FAILED_VERIFICATION_FAILURE"; |
| 5803 | case INSTALL_FAILED_PACKAGE_CHANGED: return "INSTALL_FAILED_PACKAGE_CHANGED"; |
| 5804 | case INSTALL_FAILED_UID_CHANGED: return "INSTALL_FAILED_UID_CHANGED"; |
| 5805 | case INSTALL_FAILED_VERSION_DOWNGRADE: return "INSTALL_FAILED_VERSION_DOWNGRADE"; |
| 5806 | case INSTALL_PARSE_FAILED_NOT_APK: return "INSTALL_PARSE_FAILED_NOT_APK"; |
| 5807 | case INSTALL_PARSE_FAILED_BAD_MANIFEST: return "INSTALL_PARSE_FAILED_BAD_MANIFEST"; |
| 5808 | case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return "INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION"; |
| 5809 | case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return "INSTALL_PARSE_FAILED_NO_CERTIFICATES"; |
| 5810 | case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return "INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES"; |
| 5811 | case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return "INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING"; |
| 5812 | case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return "INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME"; |
| 5813 | case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return "INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID"; |
| 5814 | case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return "INSTALL_PARSE_FAILED_MANIFEST_MALFORMED"; |
| 5815 | case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return "INSTALL_PARSE_FAILED_MANIFEST_EMPTY"; |
| 5816 | case INSTALL_FAILED_INTERNAL_ERROR: return "INSTALL_FAILED_INTERNAL_ERROR"; |
| 5817 | case INSTALL_FAILED_USER_RESTRICTED: return "INSTALL_FAILED_USER_RESTRICTED"; |
| 5818 | case INSTALL_FAILED_DUPLICATE_PERMISSION: return "INSTALL_FAILED_DUPLICATE_PERMISSION"; |
| 5819 | case INSTALL_FAILED_NO_MATCHING_ABIS: return "INSTALL_FAILED_NO_MATCHING_ABIS"; |
Jeff Sharkey | f060095 | 2014-08-07 17:31:53 -0700 | [diff] [blame] | 5820 | case INSTALL_FAILED_ABORTED: return "INSTALL_FAILED_ABORTED"; |
Calin Juravle | 3fc56c3 | 2017-12-11 18:26:13 -0800 | [diff] [blame] | 5821 | case INSTALL_FAILED_BAD_DEX_METADATA: |
| 5822 | return "INSTALL_FAILED_BAD_DEX_METADATA"; |
Jeff Sharkey | 16c8e3f | 2014-07-24 17:08:17 -0700 | [diff] [blame] | 5823 | default: return Integer.toString(status); |
| 5824 | } |
| 5825 | } |
| 5826 | |
| 5827 | /** {@hide} */ |
Jeff Sharkey | a090743 | 2014-08-15 10:23:11 -0700 | [diff] [blame] | 5828 | public static int installStatusToPublicStatus(int status) { |
Jeff Sharkey | 16c8e3f | 2014-07-24 17:08:17 -0700 | [diff] [blame] | 5829 | switch (status) { |
Jeff Sharkey | a090743 | 2014-08-15 10:23:11 -0700 | [diff] [blame] | 5830 | case INSTALL_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS; |
| 5831 | case INSTALL_FAILED_ALREADY_EXISTS: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 5832 | case INSTALL_FAILED_INVALID_APK: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 5833 | case INSTALL_FAILED_INVALID_URI: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 5834 | case INSTALL_FAILED_INSUFFICIENT_STORAGE: return PackageInstaller.STATUS_FAILURE_STORAGE; |
| 5835 | case INSTALL_FAILED_DUPLICATE_PACKAGE: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 5836 | case INSTALL_FAILED_NO_SHARED_USER: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 5837 | case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 5838 | case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 5839 | case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; |
| 5840 | case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 5841 | case INSTALL_FAILED_DEXOPT: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 5842 | case INSTALL_FAILED_OLDER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; |
| 5843 | case INSTALL_FAILED_CONFLICTING_PROVIDER: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 5844 | case INSTALL_FAILED_NEWER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; |
| 5845 | case INSTALL_FAILED_TEST_ONLY: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 5846 | case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; |
| 5847 | case INSTALL_FAILED_MISSING_FEATURE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; |
| 5848 | case INSTALL_FAILED_CONTAINER_ERROR: return PackageInstaller.STATUS_FAILURE_STORAGE; |
| 5849 | case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return PackageInstaller.STATUS_FAILURE_STORAGE; |
| 5850 | case INSTALL_FAILED_MEDIA_UNAVAILABLE: return PackageInstaller.STATUS_FAILURE_STORAGE; |
| 5851 | case INSTALL_FAILED_VERIFICATION_TIMEOUT: return PackageInstaller.STATUS_FAILURE_ABORTED; |
| 5852 | case INSTALL_FAILED_VERIFICATION_FAILURE: return PackageInstaller.STATUS_FAILURE_ABORTED; |
| 5853 | case INSTALL_FAILED_PACKAGE_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 5854 | case INSTALL_FAILED_UID_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 5855 | case INSTALL_FAILED_VERSION_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID; |
Svetoslav | d965370 | 2015-05-13 18:02:46 -0700 | [diff] [blame] | 5856 | case INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID; |
Jeff Sharkey | a090743 | 2014-08-15 10:23:11 -0700 | [diff] [blame] | 5857 | case INSTALL_PARSE_FAILED_NOT_APK: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 5858 | case INSTALL_PARSE_FAILED_BAD_MANIFEST: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 5859 | case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 5860 | case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 5861 | case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 5862 | case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 5863 | case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 5864 | case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 5865 | case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 5866 | case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return PackageInstaller.STATUS_FAILURE_INVALID; |
Calin Juravle | 3fc56c3 | 2017-12-11 18:26:13 -0800 | [diff] [blame] | 5867 | case INSTALL_FAILED_BAD_DEX_METADATA: return PackageInstaller.STATUS_FAILURE_INVALID; |
Jeff Sharkey | a090743 | 2014-08-15 10:23:11 -0700 | [diff] [blame] | 5868 | case INSTALL_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE; |
| 5869 | case INSTALL_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; |
| 5870 | case INSTALL_FAILED_DUPLICATE_PERMISSION: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 5871 | case INSTALL_FAILED_NO_MATCHING_ABIS: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; |
| 5872 | case INSTALL_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED; |
| 5873 | default: return PackageInstaller.STATUS_FAILURE; |
| 5874 | } |
| 5875 | } |
| 5876 | |
| 5877 | /** {@hide} */ |
| 5878 | public static String deleteStatusToString(int status, String msg) { |
| 5879 | final String str = deleteStatusToString(status); |
| 5880 | if (msg != null) { |
| 5881 | return str + ": " + msg; |
| 5882 | } else { |
| 5883 | return str; |
Jeff Sharkey | 16c8e3f | 2014-07-24 17:08:17 -0700 | [diff] [blame] | 5884 | } |
| 5885 | } |
| 5886 | |
| 5887 | /** {@hide} */ |
| 5888 | public static String deleteStatusToString(int status) { |
| 5889 | switch (status) { |
| 5890 | case DELETE_SUCCEEDED: return "DELETE_SUCCEEDED"; |
| 5891 | case DELETE_FAILED_INTERNAL_ERROR: return "DELETE_FAILED_INTERNAL_ERROR"; |
| 5892 | case DELETE_FAILED_DEVICE_POLICY_MANAGER: return "DELETE_FAILED_DEVICE_POLICY_MANAGER"; |
| 5893 | case DELETE_FAILED_USER_RESTRICTED: return "DELETE_FAILED_USER_RESTRICTED"; |
| 5894 | case DELETE_FAILED_OWNER_BLOCKED: return "DELETE_FAILED_OWNER_BLOCKED"; |
Jeff Sharkey | f060095 | 2014-08-07 17:31:53 -0700 | [diff] [blame] | 5895 | case DELETE_FAILED_ABORTED: return "DELETE_FAILED_ABORTED"; |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 5896 | case DELETE_FAILED_USED_SHARED_LIBRARY: return "DELETE_FAILED_USED_SHARED_LIBRARY"; |
Jeff Sharkey | 16c8e3f | 2014-07-24 17:08:17 -0700 | [diff] [blame] | 5897 | default: return Integer.toString(status); |
| 5898 | } |
| 5899 | } |
Jeff Sharkey | f060095 | 2014-08-07 17:31:53 -0700 | [diff] [blame] | 5900 | |
| 5901 | /** {@hide} */ |
Jeff Sharkey | a090743 | 2014-08-15 10:23:11 -0700 | [diff] [blame] | 5902 | public static int deleteStatusToPublicStatus(int status) { |
Jeff Sharkey | f060095 | 2014-08-07 17:31:53 -0700 | [diff] [blame] | 5903 | switch (status) { |
Jeff Sharkey | a090743 | 2014-08-15 10:23:11 -0700 | [diff] [blame] | 5904 | case DELETE_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS; |
| 5905 | case DELETE_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE; |
| 5906 | case DELETE_FAILED_DEVICE_POLICY_MANAGER: return PackageInstaller.STATUS_FAILURE_BLOCKED; |
| 5907 | case DELETE_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_BLOCKED; |
| 5908 | case DELETE_FAILED_OWNER_BLOCKED: return PackageInstaller.STATUS_FAILURE_BLOCKED; |
| 5909 | case DELETE_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED; |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 5910 | case DELETE_FAILED_USED_SHARED_LIBRARY: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
Jeff Sharkey | a090743 | 2014-08-15 10:23:11 -0700 | [diff] [blame] | 5911 | default: return PackageInstaller.STATUS_FAILURE; |
Jeff Sharkey | f060095 | 2014-08-07 17:31:53 -0700 | [diff] [blame] | 5912 | } |
| 5913 | } |
Jeff Sharkey | 6c0b9da | 2014-08-07 22:07:11 -0700 | [diff] [blame] | 5914 | |
| 5915 | /** {@hide} */ |
Svet Ganov | 77ab6a8 | 2015-07-03 12:03:02 -0700 | [diff] [blame] | 5916 | public static String permissionFlagToString(int flag) { |
| 5917 | switch (flag) { |
Svetoslav | 4a5f4a2 | 2015-07-07 18:18:15 -0700 | [diff] [blame] | 5918 | case FLAG_PERMISSION_GRANTED_BY_DEFAULT: return "GRANTED_BY_DEFAULT"; |
| 5919 | case FLAG_PERMISSION_POLICY_FIXED: return "POLICY_FIXED"; |
| 5920 | case FLAG_PERMISSION_SYSTEM_FIXED: return "SYSTEM_FIXED"; |
| 5921 | case FLAG_PERMISSION_USER_SET: return "USER_SET"; |
| 5922 | case FLAG_PERMISSION_REVOKE_ON_UPGRADE: return "REVOKE_ON_UPGRADE"; |
| 5923 | case FLAG_PERMISSION_USER_FIXED: return "USER_FIXED"; |
Svet Ganov | 9c165d7 | 2015-12-01 19:52:26 -0800 | [diff] [blame] | 5924 | case FLAG_PERMISSION_REVIEW_REQUIRED: return "REVIEW_REQUIRED"; |
Svet Ganov | 77ab6a8 | 2015-07-03 12:03:02 -0700 | [diff] [blame] | 5925 | default: return Integer.toString(flag); |
| 5926 | } |
| 5927 | } |
| 5928 | |
| 5929 | /** {@hide} */ |
Jeff Sharkey | 6c0b9da | 2014-08-07 22:07:11 -0700 | [diff] [blame] | 5930 | public static class LegacyPackageDeleteObserver extends PackageDeleteObserver { |
| 5931 | private final IPackageDeleteObserver mLegacy; |
| 5932 | |
| 5933 | public LegacyPackageDeleteObserver(IPackageDeleteObserver legacy) { |
| 5934 | mLegacy = legacy; |
| 5935 | } |
| 5936 | |
| 5937 | @Override |
| 5938 | public void onPackageDeleted(String basePackageName, int returnCode, String msg) { |
| 5939 | if (mLegacy == null) return; |
| 5940 | try { |
| 5941 | mLegacy.packageDeleted(basePackageName, returnCode); |
| 5942 | } catch (RemoteException ignored) { |
| 5943 | } |
| 5944 | } |
| 5945 | } |
Bartosz Fabianowski | a34f53f | 2017-01-11 18:08:47 +0100 | [diff] [blame] | 5946 | |
| 5947 | /** |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 5948 | * Return the install reason that was recorded when a package was first |
| 5949 | * installed for a specific user. Requesting the install reason for another |
| 5950 | * user will require the permission INTERACT_ACROSS_USERS_FULL. |
Bartosz Fabianowski | a34f53f | 2017-01-11 18:08:47 +0100 | [diff] [blame] | 5951 | * |
| 5952 | * @param packageName The package for which to retrieve the install reason |
| 5953 | * @param user The user for whom to retrieve the install reason |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 5954 | * @return The install reason. If the package is not installed for the given |
| 5955 | * user, {@code INSTALL_REASON_UNKNOWN} is returned. |
Bartosz Fabianowski | a34f53f | 2017-01-11 18:08:47 +0100 | [diff] [blame] | 5956 | * @hide |
| 5957 | */ |
| 5958 | @TestApi |
| 5959 | public abstract @InstallReason int getInstallReason(String packageName, |
| 5960 | @NonNull UserHandle user); |
Suprabh Shukla | aef2513 | 2017-01-23 18:09:03 -0800 | [diff] [blame] | 5961 | |
| 5962 | /** |
| 5963 | * 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] | 5964 | * 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] | 5965 | * intent {@link android.content.Intent#ACTION_INSTALL_PACKAGE}. Starting from Android O, the |
| 5966 | * 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] | 5967 | * 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] | 5968 | * a dialog will be shown to the user with an option to launch settings to change their |
| 5969 | * preference. An application must target Android O or higher and declare permission |
Suprabh Shukla | 5752847 | 2017-04-14 19:22:45 -0700 | [diff] [blame] | 5970 | * {@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] | 5971 | * |
| 5972 | * @return true if the calling package is trusted by the user to request install packages on |
| 5973 | * the device, false otherwise. |
Suprabh Shukla | 5752847 | 2017-04-14 19:22:45 -0700 | [diff] [blame] | 5974 | * @see android.content.Intent#ACTION_INSTALL_PACKAGE |
| 5975 | * @see android.provider.Settings#ACTION_MANAGE_UNKNOWN_APP_SOURCES |
Suprabh Shukla | aef2513 | 2017-01-23 18:09:03 -0800 | [diff] [blame] | 5976 | */ |
| 5977 | public abstract boolean canRequestPackageInstalls(); |
Chad Brubaker | aa49cb8 | 2017-03-24 15:53:09 -0700 | [diff] [blame] | 5978 | |
| 5979 | /** |
| 5980 | * Return the {@link ComponentName} of the activity providing Settings for the Instant App |
| 5981 | * resolver. |
| 5982 | * |
Todd Kennedy | 801e659 | 2017-04-12 14:10:12 -0700 | [diff] [blame] | 5983 | * @see {@link android.content.Intent#ACTION_INSTANT_APP_RESOLVER_SETTINGS} |
Chad Brubaker | aa49cb8 | 2017-03-24 15:53:09 -0700 | [diff] [blame] | 5984 | * @hide |
| 5985 | */ |
| 5986 | @SystemApi |
| 5987 | public abstract ComponentName getInstantAppResolverSettingsComponent(); |
Todd Kennedy | 801e659 | 2017-04-12 14:10:12 -0700 | [diff] [blame] | 5988 | |
| 5989 | /** |
| 5990 | * Return the {@link ComponentName} of the activity responsible for installing instant |
| 5991 | * applications. |
| 5992 | * |
| 5993 | * @see {@link android.content.Intent#ACTION_INSTALL_INSTANT_APP_PACKAGE} |
| 5994 | * @hide |
| 5995 | */ |
| 5996 | @SystemApi |
| 5997 | public abstract ComponentName getInstantAppInstallerComponent(); |
Chad Brubaker | 0d277a7 | 2017-04-12 16:56:53 -0700 | [diff] [blame] | 5998 | |
| 5999 | /** |
| 6000 | * Return the Android Id for a given Instant App. |
| 6001 | * |
| 6002 | * @see {@link android.provider.Settings.Secure#ANDROID_ID} |
| 6003 | * @hide |
| 6004 | */ |
| 6005 | public abstract String getInstantAppAndroidId(String packageName, @NonNull UserHandle user); |
Calin Juravle | 3d2af7f | 2017-04-19 19:56:21 -0700 | [diff] [blame] | 6006 | |
| 6007 | /** |
| 6008 | * Callback use to notify the callers of module registration that the operation |
| 6009 | * has finished. |
| 6010 | * |
| 6011 | * @hide |
| 6012 | */ |
Jeff Sharkey | 9039636 | 2017-06-12 16:26:53 -0600 | [diff] [blame] | 6013 | @SystemApi |
Calin Juravle | 3d2af7f | 2017-04-19 19:56:21 -0700 | [diff] [blame] | 6014 | public static abstract class DexModuleRegisterCallback { |
| 6015 | public abstract void onDexModuleRegistered(String dexModulePath, boolean success, |
| 6016 | String message); |
| 6017 | } |
| 6018 | |
| 6019 | /** |
| 6020 | * Register an application dex module with the package manager. |
| 6021 | * The package manager will keep track of the given module for future optimizations. |
| 6022 | * |
| 6023 | * Dex module optimizations will disable the classpath checking at runtime. The client bares |
| 6024 | * the responsibility to ensure that the static assumptions on classes in the optimized code |
| 6025 | * hold at runtime (e.g. there's no duplicate classes in the classpath). |
| 6026 | * |
| 6027 | * Note that the package manager already keeps track of dex modules loaded with |
| 6028 | * {@link dalvik.system.DexClassLoader} and {@link dalvik.system.PathClassLoader}. |
| 6029 | * This can be called for an eager registration. |
| 6030 | * |
| 6031 | * The call might take a while and the results will be posted on the main thread, using |
| 6032 | * the given callback. |
| 6033 | * |
| 6034 | * If the module is intended to be shared with other apps, make sure that the file |
| 6035 | * permissions allow for it. |
| 6036 | * If at registration time the permissions allow for others to read it, the module would |
| 6037 | * be marked as a shared module which might undergo a different optimization strategy. |
| 6038 | * (usually shared modules will generated larger optimizations artifacts, |
| 6039 | * taking more disk space). |
| 6040 | * |
| 6041 | * @param dexModulePath the absolute path of the dex module. |
| 6042 | * @param callback if not null, {@link DexModuleRegisterCallback#onDexModuleRegistered} will |
| 6043 | * be called once the registration finishes. |
| 6044 | * |
| 6045 | * @hide |
| 6046 | */ |
Jeff Sharkey | 9039636 | 2017-06-12 16:26:53 -0600 | [diff] [blame] | 6047 | @SystemApi |
Calin Juravle | 3d2af7f | 2017-04-19 19:56:21 -0700 | [diff] [blame] | 6048 | public abstract void registerDexModule(String dexModulePath, |
| 6049 | @Nullable DexModuleRegisterCallback callback); |
Calin Juravle | 45f8b29 | 2017-11-07 18:49:43 -0800 | [diff] [blame] | 6050 | |
| 6051 | /** |
| 6052 | * Returns the {@link ArtManager} associated with this package manager. |
| 6053 | * |
| 6054 | * @hide |
| 6055 | */ |
| 6056 | @SystemApi |
| 6057 | public @NonNull ArtManager getArtManager() { |
| 6058 | throw new UnsupportedOperationException("getArtManager not implemented in subclass"); |
| 6059 | } |
Ben Gruver | 1ab3d6e | 2017-12-07 13:45:08 -0800 | [diff] [blame] | 6060 | |
| 6061 | /** |
| 6062 | * Sets or clears the harmful app warning details for the given app. |
| 6063 | * |
| 6064 | * When set, any attempt to launch an activity in this package will be intercepted and a |
| 6065 | * warning dialog will be shown to the user instead, with the given warning. The user |
| 6066 | * will have the option to proceed with the activity launch, or to uninstall the application. |
| 6067 | * |
| 6068 | * @param packageName The full name of the package to warn on. |
| 6069 | * @param warning A warning string to display to the user describing the threat posed by the |
| 6070 | * application, or null to clear the warning. |
| 6071 | * |
| 6072 | * @hide |
| 6073 | */ |
| 6074 | @RequiresPermission(Manifest.permission.SET_HARMFUL_APP_WARNINGS) |
| 6075 | @SystemApi |
| 6076 | public void setHarmfulAppWarning(@NonNull String packageName, @Nullable CharSequence warning) { |
| 6077 | throw new UnsupportedOperationException("setHarmfulAppWarning not implemented in subclass"); |
| 6078 | } |
| 6079 | |
| 6080 | /** |
| 6081 | * Returns the harmful app warning string for the given app, or null if there is none set. |
| 6082 | * |
| 6083 | * @param packageName The full name of the desired package. |
| 6084 | * |
| 6085 | * @hide |
| 6086 | */ |
| 6087 | @RequiresPermission(Manifest.permission.SET_HARMFUL_APP_WARNINGS) |
| 6088 | @Nullable |
| 6089 | @SystemApi |
| 6090 | public CharSequence getHarmfulAppWarning(@NonNull String packageName) { |
| 6091 | throw new UnsupportedOperationException("getHarmfulAppWarning not implemented in subclass"); |
| 6092 | } |
Daniel Cashman | 5cdda34 | 2018-01-19 07:22:52 -0800 | [diff] [blame] | 6093 | |
| 6094 | /** @hide */ |
| 6095 | @IntDef(prefix = { "CERT_INPUT_" }, value = { |
| 6096 | CERT_INPUT_RAW_X509, |
| 6097 | CERT_INPUT_SHA256 |
| 6098 | }) |
| 6099 | @Retention(RetentionPolicy.SOURCE) |
| 6100 | public @interface CertificateInputType {} |
| 6101 | |
| 6102 | /** |
| 6103 | * Certificate input bytes: the input bytes represent an encoded X.509 Certificate which could |
| 6104 | * be generated using an {@code CertificateFactory} |
| 6105 | */ |
| 6106 | public static final int CERT_INPUT_RAW_X509 = 0; |
| 6107 | |
| 6108 | /** |
| 6109 | * Certificate input bytes: the input bytes represent the SHA256 output of an encoded X.509 |
| 6110 | * Certificate. |
| 6111 | */ |
| 6112 | public static final int CERT_INPUT_SHA256 = 1; |
| 6113 | |
| 6114 | /** |
| 6115 | * Searches the set of signing certificates by which the given package has proven to have been |
| 6116 | * signed. This should be used instead of {@code getPackageInfo} with {@code GET_SIGNATURES} |
| 6117 | * since it takes into account the possibility of signing certificate rotation, except in the |
| 6118 | * case of packages that are signed by multiple certificates, for which signing certificate |
Daniel Cashman | bd8ce38 | 2018-04-02 16:59:19 -0700 | [diff] [blame] | 6119 | * rotation is not supported. This method is analogous to using {@code getPackageInfo} with |
| 6120 | * {@code GET_SIGNING_CERTIFICATES} and then searching through the resulting {@code |
Dan Cashman | e942b91 | 2018-04-16 14:41:24 -0700 | [diff] [blame] | 6121 | * signingInfo} field to see if the desired certificate is present. |
Daniel Cashman | 5cdda34 | 2018-01-19 07:22:52 -0800 | [diff] [blame] | 6122 | * |
| 6123 | * @param packageName package whose signing certificates to check |
| 6124 | * @param certificate signing certificate for which to search |
| 6125 | * @param type representation of the {@code certificate} |
| 6126 | * @return true if this package was or is signed by exactly the certificate {@code certificate} |
| 6127 | */ |
| 6128 | public boolean hasSigningCertificate( |
| 6129 | String packageName, byte[] certificate, @CertificateInputType int type) { |
| 6130 | throw new UnsupportedOperationException( |
| 6131 | "hasSigningCertificate not implemented in subclass"); |
| 6132 | } |
| 6133 | |
| 6134 | /** |
Daniel Cashman | bd8ce38 | 2018-04-02 16:59:19 -0700 | [diff] [blame] | 6135 | * Searches the set of signing certificates by which the package(s) for the given uid has proven |
| 6136 | * to have been signed. For multiple packages sharing the same uid, this will return the |
| 6137 | * signing certificates found in the signing history of the "newest" package, where "newest" |
| 6138 | * indicates the package with the newest signing certificate in the shared uid group. This |
| 6139 | * method should be used instead of {@code getPackageInfo} with {@code GET_SIGNATURES} |
Daniel Cashman | 5cdda34 | 2018-01-19 07:22:52 -0800 | [diff] [blame] | 6140 | * since it takes into account the possibility of signing certificate rotation, except in the |
| 6141 | * case of packages that are signed by multiple certificates, for which signing certificate |
Daniel Cashman | bd8ce38 | 2018-04-02 16:59:19 -0700 | [diff] [blame] | 6142 | * rotation is not supported. This method is analogous to using {@code getPackagesForUid} |
| 6143 | * followed by {@code getPackageInfo} with {@code GET_SIGNING_CERTIFICATES}, selecting the |
| 6144 | * {@code PackageInfo} of the newest-signed bpackage , and finally searching through the |
Dan Cashman | e942b91 | 2018-04-16 14:41:24 -0700 | [diff] [blame] | 6145 | * resulting {@code signingInfo} field to see if the desired certificate is there. |
Daniel Cashman | 5cdda34 | 2018-01-19 07:22:52 -0800 | [diff] [blame] | 6146 | * |
Daniel Cashman | bd8ce38 | 2018-04-02 16:59:19 -0700 | [diff] [blame] | 6147 | * @param uid uid whose signing certificates to check |
Daniel Cashman | 5cdda34 | 2018-01-19 07:22:52 -0800 | [diff] [blame] | 6148 | * @param certificate signing certificate for which to search |
| 6149 | * @param type representation of the {@code certificate} |
| 6150 | * @return true if this package was or is signed by exactly the certificate {@code certificate} |
| 6151 | */ |
| 6152 | public boolean hasSigningCertificate( |
| 6153 | int uid, byte[] certificate, @CertificateInputType int type) { |
| 6154 | throw new UnsupportedOperationException( |
| 6155 | "hasSigningCertificate not implemented in subclass"); |
| 6156 | } |
Makoto Onuki | 700feef | 2018-02-15 10:59:41 -0800 | [diff] [blame] | 6157 | |
| 6158 | /** |
| 6159 | * @return the system defined text classifier package name, or null if there's none. |
| 6160 | * |
| 6161 | * @hide |
| 6162 | */ |
| 6163 | public String getSystemTextClassifierPackageName() { |
| 6164 | throw new UnsupportedOperationException( |
| 6165 | "getSystemTextClassifierPackageName not implemented in subclass"); |
| 6166 | } |
Benjamin Franz | 7cc9a81 | 2018-03-22 10:11:29 +0000 | [diff] [blame] | 6167 | |
| 6168 | /** |
| 6169 | * @return whether a given package's state is protected, e.g. package cannot be disabled, |
| 6170 | * suspended, hidden or force stopped. |
| 6171 | * |
| 6172 | * @hide |
| 6173 | */ |
| 6174 | public boolean isPackageStateProtected(String packageName, int userId) { |
| 6175 | throw new UnsupportedOperationException( |
| 6176 | "isPackageStateProtected not implemented in subclass"); |
| 6177 | } |
| 6178 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 6179 | } |