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; |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 32 | import android.annotation.UnsupportedAppUsage; |
Jeff Sharkey | bd94022 | 2016-01-08 11:07:13 -0700 | [diff] [blame] | 33 | import android.annotation.UserIdInt; |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 34 | import android.annotation.XmlRes; |
Dianne Hackborn | 2a103f1 | 2017-08-08 15:50:31 -0700 | [diff] [blame] | 35 | import android.app.ActivityManager; |
Ricky Wai | 92cd006 | 2019-02-14 20:23:22 +0000 | [diff] [blame] | 36 | import android.app.AppDetailsActivity; |
Jeff Sharkey | 6c0b9da | 2014-08-07 22:07:11 -0700 | [diff] [blame] | 37 | import android.app.PackageDeleteObserver; |
Christopher Tate | f1977b4 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 38 | import android.app.PackageInstallObserver; |
Amith Yamasani | 1d65327 | 2014-09-11 17:56:05 -0700 | [diff] [blame] | 39 | import android.app.admin.DevicePolicyManager; |
Jeff Sharkey | 60f95aa | 2017-03-08 13:57:15 -0700 | [diff] [blame] | 40 | import android.app.usage.StorageStatsManager; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 41 | import android.content.ComponentName; |
| 42 | import android.content.Context; |
| 43 | import android.content.Intent; |
| 44 | import android.content.IntentFilter; |
Suchi Amalapurapu | 1ccac75 | 2009-06-12 10:09:58 -0700 | [diff] [blame] | 45 | import android.content.IntentSender; |
Jeff Sharkey | c4858a2 | 2014-06-16 10:51:20 -0700 | [diff] [blame] | 46 | import android.content.pm.PackageParser.PackageParserException; |
Calin Juravle | 45f8b29 | 2017-11-07 18:49:43 -0800 | [diff] [blame] | 47 | import android.content.pm.dex.ArtManager; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 48 | import android.content.res.Resources; |
| 49 | import android.content.res.XmlResourceParser; |
Svetoslav | c7d62f0 | 2014-09-04 15:39:54 -0700 | [diff] [blame] | 50 | import android.graphics.Rect; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 51 | import android.graphics.drawable.Drawable; |
Peter Qiu | 3d615e4 | 2017-08-07 20:13:32 +0000 | [diff] [blame] | 52 | import android.net.wifi.WifiManager; |
Jeff Sharkey | 6f4b2a3 | 2017-03-21 14:13:41 -0600 | [diff] [blame] | 53 | import android.os.Build; |
Jeff Sharkey | bb58067 | 2014-07-10 12:10:25 -0700 | [diff] [blame] | 54 | import android.os.Bundle; |
Jeff Sharkey | 620b32b | 2015-04-23 19:36:02 -0700 | [diff] [blame] | 55 | import android.os.Handler; |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 56 | import android.os.PersistableBundle; |
Jeff Sharkey | 6c0b9da | 2014-08-07 22:07:11 -0700 | [diff] [blame] | 57 | import android.os.RemoteException; |
Dianne Hackborn | 0c38049 | 2012-08-20 17:23:30 -0700 | [diff] [blame] | 58 | import android.os.UserHandle; |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 59 | import android.os.UserManager; |
Jeff Sharkey | 683bcd3 | 2017-03-18 17:54:51 -0600 | [diff] [blame] | 60 | import android.os.storage.StorageManager; |
Jeff Sharkey | b2b9ab8 | 2015-04-05 21:10:42 -0700 | [diff] [blame] | 61 | import android.os.storage.VolumeInfo; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 62 | import android.util.AndroidException; |
Jeff Sharkey | bd94022 | 2016-01-08 11:07:13 -0700 | [diff] [blame] | 63 | import android.util.Log; |
Jeff Sharkey | b2b9ab8 | 2015-04-05 21:10:42 -0700 | [diff] [blame] | 64 | |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 65 | import com.android.internal.util.ArrayUtils; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 66 | |
Jeff Sharkey | 6f4b2a3 | 2017-03-21 14:13:41 -0600 | [diff] [blame] | 67 | import dalvik.system.VMRuntime; |
| 68 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 69 | import java.io.File; |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 70 | import java.lang.annotation.Retention; |
| 71 | import java.lang.annotation.RetentionPolicy; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 72 | import java.util.List; |
Suprabh Shukla | 3e03ab9 | 2018-04-11 16:03:49 -0700 | [diff] [blame] | 73 | import java.util.Locale; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 74 | |
| 75 | /** |
| 76 | * Class for retrieving various kinds of information related to the application |
| 77 | * packages that are currently installed on the device. |
| 78 | * |
| 79 | * You can find this class through {@link Context#getPackageManager}. |
| 80 | */ |
| 81 | public abstract class PackageManager { |
Jeff Sharkey | bd94022 | 2016-01-08 11:07:13 -0700 | [diff] [blame] | 82 | private static final String TAG = "PackageManager"; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 83 | |
Jeff Sharkey | e469713 | 2016-02-06 19:46:15 -0700 | [diff] [blame] | 84 | /** {@hide} */ |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 85 | public static final boolean APPLY_DEFAULT_TO_DEVICE_PROTECTED_STORAGE = true; |
Jeff Sharkey | e469713 | 2016-02-06 19:46:15 -0700 | [diff] [blame] | 86 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 87 | /** |
| 88 | * This exception is thrown when a given package, application, or component |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 89 | * name cannot be found. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 90 | */ |
| 91 | public static class NameNotFoundException extends AndroidException { |
| 92 | public NameNotFoundException() { |
| 93 | } |
| 94 | |
| 95 | public NameNotFoundException(String name) { |
| 96 | super(name); |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | /** |
Svetoslav | f7c06eb | 2015-06-10 18:43:22 -0700 | [diff] [blame] | 101 | * Listener for changes in permissions granted to a UID. |
| 102 | * |
| 103 | * @hide |
| 104 | */ |
| 105 | @SystemApi |
| 106 | public interface OnPermissionsChangedListener { |
| 107 | |
| 108 | /** |
| 109 | * Called when the permissions for a UID change. |
| 110 | * @param uid The UID with a change. |
| 111 | */ |
| 112 | public void onPermissionsChanged(int uid); |
| 113 | } |
| 114 | |
| 115 | /** |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 116 | * As a guiding principle: |
| 117 | * <p> |
| 118 | * {@code GET_} flags are used to request additional data that may have been |
| 119 | * elided to save wire space. |
| 120 | * <p> |
| 121 | * {@code MATCH_} flags are used to include components or packages that |
| 122 | * would have otherwise been omitted from a result set by current system |
| 123 | * state. |
| 124 | */ |
| 125 | |
| 126 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 127 | @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = { |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 128 | GET_ACTIVITIES, |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 129 | GET_CONFIGURATIONS, |
| 130 | GET_GIDS, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 131 | GET_INSTRUMENTATION, |
| 132 | GET_INTENT_FILTERS, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 133 | GET_META_DATA, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 134 | GET_PERMISSIONS, |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 135 | GET_PROVIDERS, |
| 136 | GET_RECEIVERS, |
| 137 | GET_SERVICES, |
| 138 | GET_SHARED_LIBRARY_FILES, |
| 139 | GET_SIGNATURES, |
Daniel Cashman | 5cdda34 | 2018-01-19 07:22:52 -0800 | [diff] [blame] | 140 | GET_SIGNING_CERTIFICATES, |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 141 | GET_URI_PERMISSION_PATTERNS, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 142 | MATCH_UNINSTALLED_PACKAGES, |
| 143 | MATCH_DISABLED_COMPONENTS, |
| 144 | MATCH_DISABLED_UNTIL_USED_COMPONENTS, |
Jeff Sharkey | c5967e9 | 2016-01-07 18:50:29 -0700 | [diff] [blame] | 145 | MATCH_SYSTEM_ONLY, |
Todd Kennedy | d6ee0ba | 2016-03-31 15:11:11 -0700 | [diff] [blame] | 146 | MATCH_FACTORY_ONLY, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 147 | MATCH_DEBUG_TRIAGED_MISSING, |
Todd Kennedy | 9c9fdf2 | 2017-03-06 10:58:27 -0800 | [diff] [blame] | 148 | MATCH_INSTANT, |
Dario Freni | cb7a68d | 2018-10-18 11:49:50 +0100 | [diff] [blame] | 149 | MATCH_APEX, |
Todd Kennedy | 1f397f4 | 2016-06-28 12:14:11 -0700 | [diff] [blame] | 150 | GET_DISABLED_COMPONENTS, |
| 151 | GET_DISABLED_UNTIL_USED_COMPONENTS, |
| 152 | GET_UNINSTALLED_PACKAGES, |
Rhed Jao | cd47c26 | 2018-06-13 11:16:16 +0800 | [diff] [blame] | 153 | MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 154 | }) |
| 155 | @Retention(RetentionPolicy.SOURCE) |
| 156 | public @interface PackageInfoFlags {} |
| 157 | |
| 158 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 159 | @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = { |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 160 | GET_META_DATA, |
| 161 | GET_SHARED_LIBRARY_FILES, |
| 162 | MATCH_UNINSTALLED_PACKAGES, |
| 163 | MATCH_SYSTEM_ONLY, |
| 164 | MATCH_DEBUG_TRIAGED_MISSING, |
Todd Kennedy | 2452202 | 2017-03-27 16:32:20 -0700 | [diff] [blame] | 165 | MATCH_DISABLED_COMPONENTS, |
Todd Kennedy | 5a32c6c | 2016-07-07 14:29:06 -0700 | [diff] [blame] | 166 | MATCH_DISABLED_UNTIL_USED_COMPONENTS, |
Todd Kennedy | 9c9fdf2 | 2017-03-06 10:58:27 -0800 | [diff] [blame] | 167 | MATCH_INSTANT, |
Svet Ganov | 9e77977 | 2017-05-11 14:36:50 -0700 | [diff] [blame] | 168 | MATCH_STATIC_SHARED_LIBRARIES, |
Todd Kennedy | 5a32c6c | 2016-07-07 14:29:06 -0700 | [diff] [blame] | 169 | GET_DISABLED_UNTIL_USED_COMPONENTS, |
Todd Kennedy | 1f397f4 | 2016-06-28 12:14:11 -0700 | [diff] [blame] | 170 | GET_UNINSTALLED_PACKAGES, |
Rhed Jao | cd47c26 | 2018-06-13 11:16:16 +0800 | [diff] [blame] | 171 | MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 172 | }) |
| 173 | @Retention(RetentionPolicy.SOURCE) |
| 174 | public @interface ApplicationInfoFlags {} |
| 175 | |
| 176 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 177 | @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = { |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 178 | GET_META_DATA, |
| 179 | GET_SHARED_LIBRARY_FILES, |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 180 | MATCH_ALL, |
| 181 | MATCH_DEBUG_TRIAGED_MISSING, |
| 182 | MATCH_DEFAULT_ONLY, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 183 | MATCH_DISABLED_COMPONENTS, |
| 184 | MATCH_DISABLED_UNTIL_USED_COMPONENTS, |
Jeff Sharkey | c59a5e7 | 2018-06-21 19:14:58 -0600 | [diff] [blame] | 185 | MATCH_DIRECT_BOOT_AUTO, |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 186 | MATCH_DIRECT_BOOT_AWARE, |
| 187 | MATCH_DIRECT_BOOT_UNAWARE, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 188 | MATCH_SYSTEM_ONLY, |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 189 | MATCH_UNINSTALLED_PACKAGES, |
Todd Kennedy | 9c9fdf2 | 2017-03-06 10:58:27 -0800 | [diff] [blame] | 190 | MATCH_INSTANT, |
Svet Ganov | 9e77977 | 2017-05-11 14:36:50 -0700 | [diff] [blame] | 191 | MATCH_STATIC_SHARED_LIBRARIES, |
Todd Kennedy | 1f397f4 | 2016-06-28 12:14:11 -0700 | [diff] [blame] | 192 | GET_DISABLED_COMPONENTS, |
| 193 | GET_DISABLED_UNTIL_USED_COMPONENTS, |
| 194 | GET_UNINSTALLED_PACKAGES, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 195 | }) |
| 196 | @Retention(RetentionPolicy.SOURCE) |
| 197 | public @interface ComponentInfoFlags {} |
| 198 | |
| 199 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 200 | @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = { |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 201 | GET_META_DATA, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 202 | GET_RESOLVED_FILTER, |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 203 | GET_SHARED_LIBRARY_FILES, |
| 204 | MATCH_ALL, |
| 205 | MATCH_DEBUG_TRIAGED_MISSING, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 206 | MATCH_DISABLED_COMPONENTS, |
| 207 | MATCH_DISABLED_UNTIL_USED_COMPONENTS, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 208 | MATCH_DEFAULT_ONLY, |
Jeff Sharkey | c59a5e7 | 2018-06-21 19:14:58 -0600 | [diff] [blame] | 209 | MATCH_DIRECT_BOOT_AUTO, |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 210 | MATCH_DIRECT_BOOT_AWARE, |
| 211 | MATCH_DIRECT_BOOT_UNAWARE, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 212 | MATCH_SYSTEM_ONLY, |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 213 | MATCH_UNINSTALLED_PACKAGES, |
Todd Kennedy | 9c9fdf2 | 2017-03-06 10:58:27 -0800 | [diff] [blame] | 214 | MATCH_INSTANT, |
Todd Kennedy | 1f397f4 | 2016-06-28 12:14:11 -0700 | [diff] [blame] | 215 | GET_DISABLED_COMPONENTS, |
| 216 | GET_DISABLED_UNTIL_USED_COMPONENTS, |
| 217 | GET_UNINSTALLED_PACKAGES, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 218 | }) |
| 219 | @Retention(RetentionPolicy.SOURCE) |
| 220 | public @interface ResolveInfoFlags {} |
| 221 | |
| 222 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 223 | @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = { |
Todd Kennedy | 3dbf83a | 2018-11-13 13:29:16 -0800 | [diff] [blame] | 224 | }) |
| 225 | @Retention(RetentionPolicy.SOURCE) |
| 226 | public @interface ModuleInfoFlags {} |
| 227 | |
| 228 | /** @hide */ |
| 229 | @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = { |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 230 | GET_META_DATA, |
| 231 | }) |
| 232 | @Retention(RetentionPolicy.SOURCE) |
| 233 | public @interface PermissionInfoFlags {} |
| 234 | |
| 235 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 236 | @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = { |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 237 | GET_META_DATA, |
| 238 | }) |
| 239 | @Retention(RetentionPolicy.SOURCE) |
| 240 | public @interface PermissionGroupInfoFlags {} |
| 241 | |
| 242 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 243 | @IntDef(flag = true, prefix = { "GET_", "MATCH_" }, value = { |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 244 | GET_META_DATA, |
| 245 | }) |
| 246 | @Retention(RetentionPolicy.SOURCE) |
| 247 | public @interface InstrumentationInfoFlags {} |
| 248 | |
| 249 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 250 | * {@link PackageInfo} flag: return information about |
| 251 | * activities in the package in {@link PackageInfo#activities}. |
| 252 | */ |
| 253 | public static final int GET_ACTIVITIES = 0x00000001; |
| 254 | |
| 255 | /** |
| 256 | * {@link PackageInfo} flag: return information about |
| 257 | * intent receivers in the package in |
| 258 | * {@link PackageInfo#receivers}. |
| 259 | */ |
| 260 | public static final int GET_RECEIVERS = 0x00000002; |
| 261 | |
| 262 | /** |
| 263 | * {@link PackageInfo} flag: return information about |
| 264 | * services in the package in {@link PackageInfo#services}. |
| 265 | */ |
| 266 | public static final int GET_SERVICES = 0x00000004; |
| 267 | |
| 268 | /** |
| 269 | * {@link PackageInfo} flag: return information about |
| 270 | * content providers in the package in |
| 271 | * {@link PackageInfo#providers}. |
| 272 | */ |
| 273 | public static final int GET_PROVIDERS = 0x00000008; |
| 274 | |
| 275 | /** |
| 276 | * {@link PackageInfo} flag: return information about |
| 277 | * instrumentation in the package in |
| 278 | * {@link PackageInfo#instrumentation}. |
| 279 | */ |
| 280 | public static final int GET_INSTRUMENTATION = 0x00000010; |
| 281 | |
| 282 | /** |
| 283 | * {@link PackageInfo} flag: return information about the |
| 284 | * intent filters supported by the activity. |
| 285 | */ |
| 286 | public static final int GET_INTENT_FILTERS = 0x00000020; |
| 287 | |
| 288 | /** |
| 289 | * {@link PackageInfo} flag: return information about the |
| 290 | * signatures included in the package. |
Daniel Cashman | 5cdda34 | 2018-01-19 07:22:52 -0800 | [diff] [blame] | 291 | * |
| 292 | * @deprecated use {@code GET_SIGNING_CERTIFICATES} instead |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 293 | */ |
Daniel Cashman | 5cdda34 | 2018-01-19 07:22:52 -0800 | [diff] [blame] | 294 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 295 | public static final int GET_SIGNATURES = 0x00000040; |
| 296 | |
| 297 | /** |
| 298 | * {@link ResolveInfo} flag: return the IntentFilter that |
| 299 | * was matched for a particular ResolveInfo in |
| 300 | * {@link ResolveInfo#filter}. |
| 301 | */ |
| 302 | public static final int GET_RESOLVED_FILTER = 0x00000040; |
| 303 | |
| 304 | /** |
| 305 | * {@link ComponentInfo} flag: return the {@link ComponentInfo#metaData} |
| 306 | * data {@link android.os.Bundle}s that are associated with a component. |
| 307 | * This applies for any API returning a ComponentInfo subclass. |
| 308 | */ |
| 309 | public static final int GET_META_DATA = 0x00000080; |
| 310 | |
| 311 | /** |
| 312 | * {@link PackageInfo} flag: return the |
| 313 | * {@link PackageInfo#gids group ids} that are associated with an |
| 314 | * application. |
Ken Wakasa | f76a50c | 2012-03-09 19:56:35 +0900 | [diff] [blame] | 315 | * 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] | 316 | * directly or nested inside of another. |
| 317 | */ |
| 318 | public static final int GET_GIDS = 0x00000100; |
| 319 | |
| 320 | /** |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 321 | * @deprecated replaced with {@link #MATCH_DISABLED_COMPONENTS} |
| 322 | */ |
| 323 | @Deprecated |
| 324 | public static final int GET_DISABLED_COMPONENTS = 0x00000200; |
| 325 | |
| 326 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 327 | * {@link PackageInfo} flag: include disabled components in the returned info. |
| 328 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 329 | public static final int MATCH_DISABLED_COMPONENTS = 0x00000200; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 330 | |
| 331 | /** |
| 332 | * {@link ApplicationInfo} flag: return the |
| 333 | * {@link ApplicationInfo#sharedLibraryFiles paths to the shared libraries} |
| 334 | * that are associated with an application. |
| 335 | * This applies for any API returning an ApplicationInfo class, either |
| 336 | * directly or nested inside of another. |
| 337 | */ |
| 338 | public static final int GET_SHARED_LIBRARY_FILES = 0x00000400; |
| 339 | |
| 340 | /** |
| 341 | * {@link ProviderInfo} flag: return the |
| 342 | * {@link ProviderInfo#uriPermissionPatterns URI permission patterns} |
| 343 | * that are associated with a content provider. |
Ken Wakasa | f76a50c | 2012-03-09 19:56:35 +0900 | [diff] [blame] | 344 | * 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] | 345 | * directly or nested inside of another. |
| 346 | */ |
| 347 | public static final int GET_URI_PERMISSION_PATTERNS = 0x00000800; |
| 348 | /** |
| 349 | * {@link PackageInfo} flag: return information about |
| 350 | * permissions in the package in |
| 351 | * {@link PackageInfo#permissions}. |
| 352 | */ |
| 353 | public static final int GET_PERMISSIONS = 0x00001000; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 354 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 355 | /** |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 356 | * @deprecated replaced with {@link #MATCH_UNINSTALLED_PACKAGES} |
| 357 | */ |
| 358 | @Deprecated |
| 359 | public static final int GET_UNINSTALLED_PACKAGES = 0x00002000; |
| 360 | |
| 361 | /** |
Kenny Root | 685f490 | 2011-11-03 10:13:29 -0700 | [diff] [blame] | 362 | * Flag parameter to retrieve some information about all applications (even |
| 363 | * uninstalled ones) which have data directories. This state could have |
| 364 | * resulted if applications have been deleted with flag |
| 365 | * {@code DONT_DELETE_DATA} with a possibility of being replaced or |
| 366 | * reinstalled in future. |
| 367 | * <p> |
| 368 | * Note: this flag may cause less information about currently installed |
| 369 | * applications to be returned. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 370 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 371 | public static final int MATCH_UNINSTALLED_PACKAGES = 0x00002000; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 372 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 373 | /** |
| 374 | * {@link PackageInfo} flag: return information about |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 375 | * hardware preferences in |
Adam Lesinski | d3edfde | 2014-08-08 17:32:44 -0700 | [diff] [blame] | 376 | * {@link PackageInfo#configPreferences PackageInfo.configPreferences}, |
| 377 | * and requested features in {@link PackageInfo#reqFeatures} and |
| 378 | * {@link PackageInfo#featureGroups}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 379 | */ |
| 380 | public static final int GET_CONFIGURATIONS = 0x00004000; |
| 381 | |
| 382 | /** |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 383 | * @deprecated replaced with {@link #MATCH_DISABLED_UNTIL_USED_COMPONENTS}. |
| 384 | */ |
| 385 | @Deprecated |
| 386 | public static final int GET_DISABLED_UNTIL_USED_COMPONENTS = 0x00008000; |
| 387 | |
| 388 | /** |
Dianne Hackborn | fd7aded | 2013-01-22 17:10:23 -0800 | [diff] [blame] | 389 | * {@link PackageInfo} flag: include disabled components which are in |
| 390 | * that state only because of {@link #COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED} |
| 391 | * in the returned info. Note that if you set this flag, applications |
| 392 | * that are in this disabled state will be reported as enabled. |
| 393 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 394 | public static final int MATCH_DISABLED_UNTIL_USED_COMPONENTS = 0x00008000; |
Dianne Hackborn | fd7aded | 2013-01-22 17:10:23 -0800 | [diff] [blame] | 395 | |
| 396 | /** |
Dianne Hackborn | 1655be4 | 2009-05-08 14:29:01 -0700 | [diff] [blame] | 397 | * Resolution and querying flag: if set, only filters that support the |
| 398 | * {@link android.content.Intent#CATEGORY_DEFAULT} will be considered for |
| 399 | * matching. This is a synonym for including the CATEGORY_DEFAULT in your |
| 400 | * supplied Intent. |
| 401 | */ |
Fabrice Di Meglio | 9f7e39f | 2015-04-10 20:40:16 -0700 | [diff] [blame] | 402 | public static final int MATCH_DEFAULT_ONLY = 0x00010000; |
| 403 | |
| 404 | /** |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 405 | * Querying flag: if set and if the platform is doing any filtering of the |
| 406 | * results, then the filtering will not happen. This is a synonym for saying |
| 407 | * that all results should be returned. |
| 408 | * <p> |
| 409 | * <em>This flag should be used with extreme care.</em> |
Fabrice Di Meglio | 9f7e39f | 2015-04-10 20:40:16 -0700 | [diff] [blame] | 410 | */ |
| 411 | public static final int MATCH_ALL = 0x00020000; |
Dianne Hackborn | 1655be4 | 2009-05-08 14:29:01 -0700 | [diff] [blame] | 412 | |
Nicolas Prevot | 63798c5 | 2014-05-27 13:22:38 +0100 | [diff] [blame] | 413 | /** |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 414 | * Querying flag: match components which are direct boot <em>unaware</em> in |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 415 | * the returned info, regardless of the current user state. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 416 | * <p> |
| 417 | * When neither {@link #MATCH_DIRECT_BOOT_AWARE} nor |
| 418 | * {@link #MATCH_DIRECT_BOOT_UNAWARE} are specified, the default behavior is |
| 419 | * to match only runnable components based on the user state. For example, |
| 420 | * when a user is started but credentials have not been presented yet, the |
| 421 | * user is running "locked" and only {@link #MATCH_DIRECT_BOOT_AWARE} |
| 422 | * components are returned. Once the user credentials have been presented, |
| 423 | * the user is running "unlocked" and both {@link #MATCH_DIRECT_BOOT_AWARE} |
| 424 | * and {@link #MATCH_DIRECT_BOOT_UNAWARE} components are returned. |
| 425 | * |
| 426 | * @see UserManager#isUserUnlocked() |
Jeff Sharkey | e17ac15 | 2015-11-06 22:40:29 -0800 | [diff] [blame] | 427 | */ |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 428 | public static final int MATCH_DIRECT_BOOT_UNAWARE = 0x00040000; |
| 429 | |
| 430 | /** |
| 431 | * Querying flag: match components which are direct boot <em>aware</em> in |
| 432 | * the returned info, regardless of the current user state. |
| 433 | * <p> |
| 434 | * When neither {@link #MATCH_DIRECT_BOOT_AWARE} nor |
| 435 | * {@link #MATCH_DIRECT_BOOT_UNAWARE} are specified, the default behavior is |
| 436 | * to match only runnable components based on the user state. For example, |
| 437 | * when a user is started but credentials have not been presented yet, the |
| 438 | * user is running "locked" and only {@link #MATCH_DIRECT_BOOT_AWARE} |
| 439 | * components are returned. Once the user credentials have been presented, |
| 440 | * the user is running "unlocked" and both {@link #MATCH_DIRECT_BOOT_AWARE} |
| 441 | * and {@link #MATCH_DIRECT_BOOT_UNAWARE} components are returned. |
| 442 | * |
| 443 | * @see UserManager#isUserUnlocked() |
| 444 | */ |
| 445 | public static final int MATCH_DIRECT_BOOT_AWARE = 0x00080000; |
| 446 | |
Jeff Sharkey | 2a9e3f8 | 2015-12-18 10:57:58 -0700 | [diff] [blame] | 447 | /** |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 448 | * Querying flag: include only components from applications that are marked |
| 449 | * with {@link ApplicationInfo#FLAG_SYSTEM}. |
Jeff Sharkey | 5217cac | 2015-12-20 15:34:01 -0700 | [diff] [blame] | 450 | */ |
| 451 | public static final int MATCH_SYSTEM_ONLY = 0x00100000; |
| 452 | |
| 453 | /** |
Todd Kennedy | d6ee0ba | 2016-03-31 15:11:11 -0700 | [diff] [blame] | 454 | * Internal {@link PackageInfo} flag: include only components on the system image. |
| 455 | * This will not return information on any unbundled update to system components. |
| 456 | * @hide |
| 457 | */ |
Todd Kennedy | 4908496 | 2017-03-27 16:20:37 -0700 | [diff] [blame] | 458 | @SystemApi |
Fyodor Kupolov | e569804 | 2018-01-26 14:24:37 -0800 | [diff] [blame] | 459 | @TestApi |
Todd Kennedy | d6ee0ba | 2016-03-31 15:11:11 -0700 | [diff] [blame] | 460 | public static final int MATCH_FACTORY_ONLY = 0x00200000; |
| 461 | |
| 462 | /** |
Amith Yamasani | 0d1fd8d | 2016-10-12 14:21:51 -0700 | [diff] [blame] | 463 | * 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] | 464 | * 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] | 465 | * @hide |
| 466 | */ |
Amith Yamasani | 475f9a3 | 2016-12-08 09:46:15 -0800 | [diff] [blame] | 467 | @SystemApi |
Amith Yamasani | 0d1fd8d | 2016-10-12 14:21:51 -0700 | [diff] [blame] | 468 | public static final int MATCH_ANY_USER = 0x00400000; |
| 469 | |
| 470 | /** |
| 471 | * Combination of MATCH_ANY_USER and MATCH_UNINSTALLED_PACKAGES to mean any known |
| 472 | * package. |
| 473 | * @hide |
| 474 | */ |
Todd Kennedy | ef9acb6 | 2018-05-29 15:18:06 -0700 | [diff] [blame] | 475 | @TestApi |
Amith Yamasani | 0d1fd8d | 2016-10-12 14:21:51 -0700 | [diff] [blame] | 476 | public static final int MATCH_KNOWN_PACKAGES = MATCH_UNINSTALLED_PACKAGES | MATCH_ANY_USER; |
| 477 | |
| 478 | /** |
Todd Kennedy | 7bc3a70 | 2016-12-08 14:54:48 -0800 | [diff] [blame] | 479 | * Internal {@link PackageInfo} flag: include components that are part of an |
Todd Kennedy | be0b889 | 2017-02-15 14:13:52 -0800 | [diff] [blame] | 480 | * instant app. By default, instant app components are not matched. |
Todd Kennedy | 7bc3a70 | 2016-12-08 14:54:48 -0800 | [diff] [blame] | 481 | * @hide |
| 482 | */ |
Todd Kennedy | 9c9fdf2 | 2017-03-06 10:58:27 -0800 | [diff] [blame] | 483 | @SystemApi |
Todd Kennedy | be0b889 | 2017-02-15 14:13:52 -0800 | [diff] [blame] | 484 | public static final int MATCH_INSTANT = 0x00800000; |
Todd Kennedy | 7bc3a70 | 2016-12-08 14:54:48 -0800 | [diff] [blame] | 485 | |
| 486 | /** |
| 487 | * Internal {@link PackageInfo} flag: include only components that are exposed to |
Todd Kennedy | c05f5d1 | 2017-04-25 11:11:40 -0700 | [diff] [blame] | 488 | * instant apps. Matched components may have been either explicitly or implicitly |
| 489 | * exposed. |
Todd Kennedy | 7bc3a70 | 2016-12-08 14:54:48 -0800 | [diff] [blame] | 490 | * @hide |
| 491 | */ |
Todd Kennedy | be0b889 | 2017-02-15 14:13:52 -0800 | [diff] [blame] | 492 | public static final int MATCH_VISIBLE_TO_INSTANT_APP_ONLY = 0x01000000; |
Todd Kennedy | 7bc3a70 | 2016-12-08 14:54:48 -0800 | [diff] [blame] | 493 | |
| 494 | /** |
Todd Kennedy | c05f5d1 | 2017-04-25 11:11:40 -0700 | [diff] [blame] | 495 | * Internal {@link PackageInfo} flag: include only components that have been |
| 496 | * explicitly exposed to instant apps. |
| 497 | * @hide |
| 498 | */ |
| 499 | public static final int MATCH_EXPLICITLY_VISIBLE_ONLY = 0x02000000; |
| 500 | |
| 501 | /** |
Svet Ganov | 9e77977 | 2017-05-11 14:36:50 -0700 | [diff] [blame] | 502 | * Internal {@link PackageInfo} flag: include static shared libraries. |
| 503 | * Apps that depend on static shared libs can always access the version |
| 504 | * of the lib they depend on. System/shell/root can access all shared |
| 505 | * libs regardless of dependency but need to explicitly ask for them |
| 506 | * via this flag. |
| 507 | * @hide |
| 508 | */ |
| 509 | public static final int MATCH_STATIC_SHARED_LIBRARIES = 0x04000000; |
| 510 | |
| 511 | /** |
Daniel Cashman | 5cdda34 | 2018-01-19 07:22:52 -0800 | [diff] [blame] | 512 | * {@link PackageInfo} flag: return the signing certificates associated with |
| 513 | * this package. Each entry is a signing certificate that the package |
| 514 | * has proven it is authorized to use, usually a past signing certificate from |
| 515 | * which it has rotated. |
| 516 | */ |
| 517 | public static final int GET_SIGNING_CERTIFICATES = 0x08000000; |
| 518 | |
| 519 | /** |
Jeff Sharkey | c59a5e7 | 2018-06-21 19:14:58 -0600 | [diff] [blame] | 520 | * Querying flag: automatically match components based on their Direct Boot |
| 521 | * awareness and the current user state. |
| 522 | * <p> |
| 523 | * Since the default behavior is to automatically apply the current user |
| 524 | * state, this is effectively a sentinel value that doesn't change the |
| 525 | * output of any queries based on its presence or absence. |
| 526 | * <p> |
| 527 | * Instead, this value can be useful in conjunction with |
| 528 | * {@link android.os.StrictMode.VmPolicy.Builder#detectImplicitDirectBoot()} |
| 529 | * to detect when a caller is relying on implicit automatic matching, |
| 530 | * instead of confirming the explicit behavior they want, using a |
| 531 | * combination of these flags: |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 532 | * <ul> |
Jeff Sharkey | c59a5e7 | 2018-06-21 19:14:58 -0600 | [diff] [blame] | 533 | * <li>{@link #MATCH_DIRECT_BOOT_AWARE} |
| 534 | * <li>{@link #MATCH_DIRECT_BOOT_UNAWARE} |
| 535 | * <li>{@link #MATCH_DIRECT_BOOT_AUTO} |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 536 | * </ul> |
Jeff Sharkey | e17ac15 | 2015-11-06 22:40:29 -0800 | [diff] [blame] | 537 | */ |
Jeff Sharkey | c59a5e7 | 2018-06-21 19:14:58 -0600 | [diff] [blame] | 538 | public static final int MATCH_DIRECT_BOOT_AUTO = 0x10000000; |
| 539 | |
| 540 | /** @hide */ |
| 541 | @Deprecated |
| 542 | public static final int MATCH_DEBUG_TRIAGED_MISSING = MATCH_DIRECT_BOOT_AUTO; |
Jeff Sharkey | e17ac15 | 2015-11-06 22:40:29 -0800 | [diff] [blame] | 543 | |
| 544 | /** |
Rhed Jao | cd47c26 | 2018-06-13 11:16:16 +0800 | [diff] [blame] | 545 | * Internal flag used to indicate that a package is a hidden system app. |
| 546 | * @hide |
| 547 | */ |
| 548 | public static final int MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS = 0x20000000; |
| 549 | |
| 550 | /** |
Dario Freni | cb7a68d | 2018-10-18 11:49:50 +0100 | [diff] [blame] | 551 | * {@link PackageInfo} flag: include APEX packages that are currently |
| 552 | * installed. In APEX terminology, this corresponds to packages that are |
| 553 | * currently active, i.e. mounted and available to other processes of the OS. |
| 554 | * In particular, this flag alone will not match APEX files that are staged |
| 555 | * for activation at next reboot. |
Dario Freni | cb7a68d | 2018-10-18 11:49:50 +0100 | [diff] [blame] | 556 | */ |
| 557 | public static final int MATCH_APEX = 0x40000000; |
| 558 | |
| 559 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 560 | * Flag for {@link #addCrossProfileIntentFilter}: if this flag is set: when |
| 561 | * resolving an intent that matches the {@code CrossProfileIntentFilter}, |
| 562 | * the current profile will be skipped. Only activities in the target user |
| 563 | * can respond to the intent. |
| 564 | * |
Nicolas Prevot | 63798c5 | 2014-05-27 13:22:38 +0100 | [diff] [blame] | 565 | * @hide |
| 566 | */ |
| 567 | public static final int SKIP_CURRENT_PROFILE = 0x00000002; |
| 568 | |
Tony Mak | 807e01c | 2015-12-01 20:19:03 +0000 | [diff] [blame] | 569 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 570 | * Flag for {@link #addCrossProfileIntentFilter}: if this flag is set: |
Tony Mak | 807e01c | 2015-12-01 20:19:03 +0000 | [diff] [blame] | 571 | * activities in the other profiles can respond to the intent only if no activity with |
| 572 | * non-negative priority in current profile can respond to the intent. |
| 573 | * @hide |
| 574 | */ |
| 575 | public static final int ONLY_IF_NO_MATCH_FOUND = 0x00000004; |
| 576 | |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 577 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 578 | @IntDef(prefix = { "PERMISSION_" }, value = { |
| 579 | PERMISSION_GRANTED, |
| 580 | PERMISSION_DENIED |
| 581 | }) |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 582 | @Retention(RetentionPolicy.SOURCE) |
| 583 | public @interface PermissionResult {} |
| 584 | |
Dianne Hackborn | 1655be4 | 2009-05-08 14:29:01 -0700 | [diff] [blame] | 585 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 586 | * Permission check result: this is returned by {@link #checkPermission} |
| 587 | * if the permission has been granted to the given package. |
| 588 | */ |
| 589 | public static final int PERMISSION_GRANTED = 0; |
| 590 | |
| 591 | /** |
| 592 | * Permission check result: this is returned by {@link #checkPermission} |
| 593 | * if the permission has not been granted to the given package. |
| 594 | */ |
| 595 | public static final int PERMISSION_DENIED = -1; |
| 596 | |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 597 | /** @hide */ |
| 598 | @IntDef(prefix = { "SIGNATURE_" }, value = { |
| 599 | SIGNATURE_MATCH, |
| 600 | SIGNATURE_NEITHER_SIGNED, |
| 601 | SIGNATURE_FIRST_NOT_SIGNED, |
| 602 | SIGNATURE_SECOND_NOT_SIGNED, |
| 603 | SIGNATURE_NO_MATCH, |
| 604 | SIGNATURE_UNKNOWN_PACKAGE, |
| 605 | }) |
| 606 | @Retention(RetentionPolicy.SOURCE) |
| 607 | public @interface SignatureResult {} |
| 608 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 609 | /** |
| 610 | * Signature check result: this is returned by {@link #checkSignatures} |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 611 | * if all signatures on the two packages match. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 612 | */ |
| 613 | public static final int SIGNATURE_MATCH = 0; |
| 614 | |
| 615 | /** |
| 616 | * Signature check result: this is returned by {@link #checkSignatures} |
| 617 | * if neither of the two packages is signed. |
| 618 | */ |
| 619 | public static final int SIGNATURE_NEITHER_SIGNED = 1; |
| 620 | |
| 621 | /** |
| 622 | * Signature check result: this is returned by {@link #checkSignatures} |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 623 | * 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] | 624 | */ |
| 625 | public static final int SIGNATURE_FIRST_NOT_SIGNED = -1; |
| 626 | |
| 627 | /** |
| 628 | * Signature check result: this is returned by {@link #checkSignatures} |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 629 | * 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] | 630 | */ |
| 631 | public static final int SIGNATURE_SECOND_NOT_SIGNED = -2; |
| 632 | |
| 633 | /** |
| 634 | * Signature check result: this is returned by {@link #checkSignatures} |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 635 | * if not all signatures on both packages match. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 636 | */ |
| 637 | public static final int SIGNATURE_NO_MATCH = -3; |
| 638 | |
| 639 | /** |
| 640 | * Signature check result: this is returned by {@link #checkSignatures} |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 641 | * if either of the packages are not valid. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 642 | */ |
| 643 | public static final int SIGNATURE_UNKNOWN_PACKAGE = -4; |
| 644 | |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 645 | /** @hide */ |
| 646 | @IntDef(prefix = { "COMPONENT_ENABLED_STATE_" }, value = { |
| 647 | COMPONENT_ENABLED_STATE_DEFAULT, |
| 648 | COMPONENT_ENABLED_STATE_ENABLED, |
| 649 | COMPONENT_ENABLED_STATE_DISABLED, |
| 650 | COMPONENT_ENABLED_STATE_DISABLED_USER, |
| 651 | COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED, |
| 652 | }) |
| 653 | @Retention(RetentionPolicy.SOURCE) |
| 654 | public @interface EnabledState {} |
| 655 | |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 656 | /** |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 657 | * Flag for {@link #setApplicationEnabledSetting(String, int, int)} and |
| 658 | * {@link #setComponentEnabledSetting(ComponentName, int, int)}: This |
| 659 | * component or application is in its default enabled state (as specified in |
| 660 | * its manifest). |
| 661 | * <p> |
| 662 | * Explicitly setting the component state to this value restores it's |
| 663 | * enabled state to whatever is set in the manifest. |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 664 | */ |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 665 | public static final int COMPONENT_ENABLED_STATE_DEFAULT = 0; |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 666 | |
| 667 | /** |
| 668 | * Flag for {@link #setApplicationEnabledSetting(String, int, int)} |
| 669 | * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This |
| 670 | * component or application has been explictily enabled, regardless of |
| 671 | * what it has specified in its manifest. |
| 672 | */ |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 673 | public static final int COMPONENT_ENABLED_STATE_ENABLED = 1; |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 674 | |
| 675 | /** |
| 676 | * Flag for {@link #setApplicationEnabledSetting(String, int, int)} |
| 677 | * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This |
| 678 | * component or application has been explicitly disabled, regardless of |
| 679 | * what it has specified in its manifest. |
| 680 | */ |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 681 | public static final int COMPONENT_ENABLED_STATE_DISABLED = 2; |
| 682 | |
| 683 | /** |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 684 | * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: The |
| 685 | * user has explicitly disabled the application, regardless of what it has |
| 686 | * specified in its manifest. Because this is due to the user's request, |
| 687 | * they may re-enable it if desired through the appropriate system UI. This |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 688 | * option currently <strong>cannot</strong> be used with |
Dianne Hackborn | 0ac3031 | 2011-06-17 14:49:23 -0700 | [diff] [blame] | 689 | * {@link #setComponentEnabledSetting(ComponentName, int, int)}. |
| 690 | */ |
| 691 | public static final int COMPONENT_ENABLED_STATE_DISABLED_USER = 3; |
| 692 | |
| 693 | /** |
Dianne Hackborn | fd7aded | 2013-01-22 17:10:23 -0800 | [diff] [blame] | 694 | * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: This |
| 695 | * application should be considered, until the point where the user actually |
| 696 | * wants to use it. This means that it will not normally show up to the user |
| 697 | * (such as in the launcher), but various parts of the user interface can |
| 698 | * use {@link #GET_DISABLED_UNTIL_USED_COMPONENTS} to still see it and allow |
| 699 | * the user to select it (as for example an IME, device admin, etc). Such code, |
| 700 | * once the user has selected the app, should at that point also make it enabled. |
| 701 | * This option currently <strong>can not</strong> be used with |
| 702 | * {@link #setComponentEnabledSetting(ComponentName, int, int)}. |
| 703 | */ |
| 704 | public static final int COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED = 4; |
| 705 | |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 706 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 707 | @IntDef(flag = true, prefix = { "INSTALL_" }, value = { |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 708 | INSTALL_REPLACE_EXISTING, |
| 709 | INSTALL_ALLOW_TEST, |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 710 | INSTALL_INTERNAL, |
| 711 | INSTALL_FROM_ADB, |
| 712 | INSTALL_ALL_USERS, |
| 713 | INSTALL_ALLOW_DOWNGRADE, |
| 714 | INSTALL_GRANT_RUNTIME_PERMISSIONS, |
| 715 | INSTALL_FORCE_VOLUME_UUID, |
| 716 | INSTALL_FORCE_PERMISSION_PROMPT, |
Todd Kennedy | be0b889 | 2017-02-15 14:13:52 -0800 | [diff] [blame] | 717 | INSTALL_INSTANT_APP, |
Todd Kennedy | 39bfee5 | 2016-02-24 10:28:21 -0800 | [diff] [blame] | 718 | INSTALL_DONT_KILL_APP, |
Jeff Sharkey | 683bcd3 | 2017-03-18 17:54:51 -0600 | [diff] [blame] | 719 | INSTALL_FULL_APP, |
| 720 | INSTALL_ALLOCATE_AGGRESSIVE, |
Richard Uhler | b29f145 | 2018-09-12 16:38:15 +0100 | [diff] [blame] | 721 | INSTALL_VIRTUAL_PRELOAD, |
| 722 | INSTALL_APEX, |
| 723 | INSTALL_ENABLE_ROLLBACK, |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 724 | }) |
| 725 | @Retention(RetentionPolicy.SOURCE) |
| 726 | public @interface InstallFlags {} |
| 727 | |
Dianne Hackborn | fd7aded | 2013-01-22 17:10:23 -0800 | [diff] [blame] | 728 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 729 | * Flag parameter for {@link #installPackage} to indicate that you want to |
| 730 | * replace an already installed package, if one exists. |
| 731 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 732 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 733 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 734 | @UnsupportedAppUsage |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 735 | public static final int INSTALL_REPLACE_EXISTING = 0x00000002; |
| 736 | |
| 737 | /** |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 738 | * Flag parameter for {@link #installPackage} to indicate that you want to |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 739 | * allow test packages (those that have set android:testOnly in their |
| 740 | * manifest) to be installed. |
| 741 | * @hide |
| 742 | */ |
| 743 | public static final int INSTALL_ALLOW_TEST = 0x00000004; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 744 | |
| 745 | /** |
Jeff Sharkey | b2b9ab8 | 2015-04-05 21:10:42 -0700 | [diff] [blame] | 746 | * Flag parameter for {@link #installPackage} to indicate that this package |
Jeff Sharkey | b2b9ab8 | 2015-04-05 21:10:42 -0700 | [diff] [blame] | 747 | * must be installed to internal storage. |
| 748 | * |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 749 | * @hide |
| 750 | */ |
| 751 | public static final int INSTALL_INTERNAL = 0x00000010; |
| 752 | |
| 753 | /** |
| 754 | * Flag parameter for {@link #installPackage} to indicate that this install |
| 755 | * was initiated via ADB. |
| 756 | * |
| 757 | * @hide |
| 758 | */ |
| 759 | public static final int INSTALL_FROM_ADB = 0x00000020; |
Suchi Amalapurapu | 14b6abd | 2010-03-17 08:37:04 -0700 | [diff] [blame] | 760 | |
| 761 | /** |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 762 | * Flag parameter for {@link #installPackage} to indicate that this install |
| 763 | * should immediately be visible to all users. |
| 764 | * |
| 765 | * @hide |
| 766 | */ |
| 767 | public static final int INSTALL_ALL_USERS = 0x00000040; |
| 768 | |
| 769 | /** |
| 770 | * Flag parameter for {@link #installPackage} to indicate that it is okay |
| 771 | * 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] | 772 | * version code than the currently installed app. This is permitted only if |
| 773 | * the currently installed app is marked debuggable. |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 774 | * |
| 775 | * @hide |
| 776 | */ |
| 777 | public static final int INSTALL_ALLOW_DOWNGRADE = 0x00000080; |
| 778 | |
| 779 | /** |
Svet Ganov | 95c1ade | 2015-03-19 09:38:52 -0700 | [diff] [blame] | 780 | * Flag parameter for {@link #installPackage} to indicate that all runtime |
| 781 | * permissions should be granted to the package. If {@link #INSTALL_ALL_USERS} |
| 782 | * is set the runtime permissions will be granted to all users, otherwise |
| 783 | * only to the owner. |
| 784 | * |
| 785 | * @hide |
| 786 | */ |
| 787 | public static final int INSTALL_GRANT_RUNTIME_PERMISSIONS = 0x00000100; |
| 788 | |
Jeff Sharkey | ab23409 | 2015-06-09 21:42:22 -0700 | [diff] [blame] | 789 | /** {@hide} */ |
| 790 | public static final int INSTALL_FORCE_VOLUME_UUID = 0x00000200; |
| 791 | |
Svet Ganov | 95c1ade | 2015-03-19 09:38:52 -0700 | [diff] [blame] | 792 | /** |
Todd Kennedy | a1d12cf | 2015-09-29 15:43:00 -0700 | [diff] [blame] | 793 | * Flag parameter for {@link #installPackage} to indicate that we always want to force |
| 794 | * the prompt for permission approval. This overrides any special behaviour for internal |
| 795 | * components. |
| 796 | * |
| 797 | * @hide |
| 798 | */ |
| 799 | public static final int INSTALL_FORCE_PERMISSION_PROMPT = 0x00000400; |
| 800 | |
| 801 | /** |
Todd Kennedy | 27c24fb | 2015-09-17 16:49:25 -0700 | [diff] [blame] | 802 | * Flag parameter for {@link #installPackage} to indicate that this package is |
Todd Kennedy | 2699f06 | 2015-11-20 13:07:17 -0800 | [diff] [blame] | 803 | * to be installed as a lightweight "ephemeral" app. |
| 804 | * |
| 805 | * @hide |
| 806 | */ |
Todd Kennedy | be0b889 | 2017-02-15 14:13:52 -0800 | [diff] [blame] | 807 | public static final int INSTALL_INSTANT_APP = 0x00000800; |
| 808 | |
| 809 | /** |
Todd Kennedy | 39bfee5 | 2016-02-24 10:28:21 -0800 | [diff] [blame] | 810 | * Flag parameter for {@link #installPackage} to indicate that this package contains |
| 811 | * a feature split to an existing application and the existing application should not |
| 812 | * be killed during the installation process. |
| 813 | * |
| 814 | * @hide |
| 815 | */ |
| 816 | public static final int INSTALL_DONT_KILL_APP = 0x00001000; |
| 817 | |
| 818 | /** |
Jeff Sharkey | 683bcd3 | 2017-03-18 17:54:51 -0600 | [diff] [blame] | 819 | * Flag parameter for {@link #installPackage} to indicate that this package is |
| 820 | * to be installed as a heavy weight app. This is fundamentally the opposite of |
| 821 | * {@link #INSTALL_INSTANT_APP}. |
| 822 | * |
| 823 | * @hide |
| 824 | */ |
| 825 | public static final int INSTALL_FULL_APP = 0x00004000; |
| 826 | |
| 827 | /** |
| 828 | * Flag parameter for {@link #installPackage} to indicate that this package |
| 829 | * is critical to system health or security, meaning the system should use |
| 830 | * {@link StorageManager#FLAG_ALLOCATE_AGGRESSIVE} internally. |
| 831 | * |
| 832 | * @hide |
| 833 | */ |
| 834 | public static final int INSTALL_ALLOCATE_AGGRESSIVE = 0x00008000; |
| 835 | |
Todd Kennedy | 78a7250 | 2017-07-19 12:49:30 -0700 | [diff] [blame] | 836 | /** |
| 837 | * Flag parameter for {@link #installPackage} to indicate that this package |
| 838 | * is a virtual preload. |
| 839 | * |
| 840 | * @hide |
| 841 | */ |
| 842 | public static final int INSTALL_VIRTUAL_PRELOAD = 0x00010000; |
| 843 | |
Dario Freni | d8bf22e | 2018-08-31 14:18:04 +0100 | [diff] [blame] | 844 | /** |
| 845 | * Flag parameter for {@link #installPackage} to indicate that this package |
| 846 | * is an APEX package |
| 847 | * |
| 848 | * @hide |
| 849 | */ |
| 850 | public static final int INSTALL_APEX = 0x00020000; |
| 851 | |
Richard Uhler | b29f145 | 2018-09-12 16:38:15 +0100 | [diff] [blame] | 852 | /** |
| 853 | * Flag parameter for {@link #installPackage} to indicate that rollback |
| 854 | * should be enabled for this install. |
| 855 | * |
| 856 | * @hide |
| 857 | */ |
| 858 | public static final int INSTALL_ENABLE_ROLLBACK = 0x00040000; |
| 859 | |
Dario Freni | 49c3fa7 | 2019-02-04 12:07:25 +0000 | [diff] [blame] | 860 | /** |
| 861 | * Flag parameter for {@link #installPackage} to indicate that package verification should be |
| 862 | * disabled for this package. |
| 863 | * |
| 864 | * @hide |
| 865 | */ |
| 866 | public static final int INSTALL_DISABLE_VERIFICATION = 0x00080000; |
| 867 | |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 868 | /** @hide */ |
| 869 | @IntDef(flag = true, prefix = { "DONT_KILL_APP" }, value = { |
| 870 | DONT_KILL_APP |
| 871 | }) |
| 872 | @Retention(RetentionPolicy.SOURCE) |
| 873 | public @interface EnabledFlags {} |
| 874 | |
Jeff Sharkey | 683bcd3 | 2017-03-18 17:54:51 -0600 | [diff] [blame] | 875 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 876 | * Flag parameter for |
| 877 | * {@link #setComponentEnabledSetting(android.content.ComponentName, int, int)} to indicate |
| 878 | * that you don't want to kill the app containing the component. Be careful when you set this |
| 879 | * since changing component states can make the containing application's behavior unpredictable. |
| 880 | */ |
| 881 | public static final int DONT_KILL_APP = 0x00000001; |
| 882 | |
Bartosz Fabianowski | a34f53f | 2017-01-11 18:08:47 +0100 | [diff] [blame] | 883 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 884 | @IntDef(prefix = { "INSTALL_REASON_" }, value = { |
| 885 | INSTALL_REASON_UNKNOWN, |
| 886 | INSTALL_REASON_POLICY, |
| 887 | INSTALL_REASON_DEVICE_RESTORE, |
| 888 | INSTALL_REASON_DEVICE_SETUP, |
| 889 | INSTALL_REASON_USER |
| 890 | }) |
Bartosz Fabianowski | a34f53f | 2017-01-11 18:08:47 +0100 | [diff] [blame] | 891 | @Retention(RetentionPolicy.SOURCE) |
| 892 | public @interface InstallReason {} |
| 893 | |
| 894 | /** |
| 895 | * Code indicating that the reason for installing this package is unknown. |
| 896 | */ |
| 897 | public static final int INSTALL_REASON_UNKNOWN = 0; |
| 898 | |
| 899 | /** |
| 900 | * Code indicating that this package was installed due to enterprise policy. |
| 901 | */ |
| 902 | public static final int INSTALL_REASON_POLICY = 1; |
| 903 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 904 | /** |
Sunny Goyal | 80af6a2 | 2017-03-02 08:32:33 -0800 | [diff] [blame] | 905 | * Code indicating that this package was installed as part of restoring from another device. |
| 906 | */ |
| 907 | public static final int INSTALL_REASON_DEVICE_RESTORE = 2; |
| 908 | |
| 909 | /** |
| 910 | * Code indicating that this package was installed as part of device setup. |
| 911 | */ |
| 912 | public static final int INSTALL_REASON_DEVICE_SETUP = 3; |
| 913 | |
| 914 | /** |
| 915 | * Code indicating that the package installation was initiated by the user. |
| 916 | */ |
| 917 | public static final int INSTALL_REASON_USER = 4; |
| 918 | |
| 919 | /** |
Patrick Baumann | 0aff9b1 | 2018-11-08 14:05:08 +0000 | [diff] [blame] | 920 | * @hide |
| 921 | */ |
| 922 | public static final int INSTALL_UNKNOWN = 0; |
| 923 | |
| 924 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 925 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 926 | * on success. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 927 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 928 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 929 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 930 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 931 | public static final int INSTALL_SUCCEEDED = 1; |
| 932 | |
| 933 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 934 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 935 | * if the package is already installed. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 936 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 937 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 938 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 939 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 940 | public static final int INSTALL_FAILED_ALREADY_EXISTS = -1; |
| 941 | |
| 942 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 943 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 944 | * if the package archive file is invalid. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 945 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 946 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 947 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 948 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 949 | public static final int INSTALL_FAILED_INVALID_APK = -2; |
| 950 | |
| 951 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 952 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 953 | * if the URI passed in is invalid. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 954 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 955 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 956 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 957 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 958 | public static final int INSTALL_FAILED_INVALID_URI = -3; |
| 959 | |
| 960 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 961 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 962 | * if the package manager service found that the device didn't have enough storage space to |
| 963 | * install the app. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 964 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 965 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 966 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 967 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 968 | public static final int INSTALL_FAILED_INSUFFICIENT_STORAGE = -4; |
| 969 | |
| 970 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 971 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 972 | * if a package is already installed with the same name. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 973 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 974 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 975 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 976 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 977 | public static final int INSTALL_FAILED_DUPLICATE_PACKAGE = -5; |
| 978 | |
| 979 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 980 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 981 | * if the requested shared user does not exist. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 982 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 983 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 984 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 985 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 986 | public static final int INSTALL_FAILED_NO_SHARED_USER = -6; |
| 987 | |
| 988 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 989 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 990 | * if a previously installed package of the same name has a different signature than the new |
| 991 | * package (and the old package's data was not removed). |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 992 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 993 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 994 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 995 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 996 | public static final int INSTALL_FAILED_UPDATE_INCOMPATIBLE = -7; |
| 997 | |
| 998 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 999 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1000 | * if the new package is requested a shared user which is already installed on the device and |
| 1001 | * does not have matching signature. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1002 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1003 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1004 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1005 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1006 | public static final int INSTALL_FAILED_SHARED_USER_INCOMPATIBLE = -8; |
| 1007 | |
| 1008 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1009 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1010 | * if the new package uses a shared library that is not available. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1011 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1012 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1013 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1014 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1015 | public static final int INSTALL_FAILED_MISSING_SHARED_LIBRARY = -9; |
| 1016 | |
| 1017 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1018 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1019 | * if the new package uses a shared library that is not available. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1020 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1021 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1022 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1023 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1024 | public static final int INSTALL_FAILED_REPLACE_COULDNT_DELETE = -10; |
| 1025 | |
| 1026 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1027 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1028 | * if the new package failed while optimizing and validating its dex files, either because there |
| 1029 | * was not enough storage or the validation failed. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1030 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1031 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1032 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1033 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1034 | public static final int INSTALL_FAILED_DEXOPT = -11; |
| 1035 | |
| 1036 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1037 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1038 | * if the new package failed because the current SDK version is older than that required by the |
| 1039 | * package. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1040 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1041 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1042 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1043 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1044 | public static final int INSTALL_FAILED_OLDER_SDK = -12; |
| 1045 | |
| 1046 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1047 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1048 | * if the new package failed because it contains a content provider with the same authority as a |
| 1049 | * provider already installed in the system. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1050 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1051 | * @hide |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 1052 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1053 | @SystemApi |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 1054 | public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13; |
| 1055 | |
| 1056 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1057 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1058 | * if the new package failed because the current SDK version is newer than that required by the |
| 1059 | * package. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1060 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1061 | * @hide |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 1062 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1063 | @SystemApi |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 1064 | public static final int INSTALL_FAILED_NEWER_SDK = -14; |
| 1065 | |
| 1066 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1067 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1068 | * if the new package failed because it has specified that it is a test-only package and the |
| 1069 | * caller has not supplied the {@link #INSTALL_ALLOW_TEST} flag. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1070 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1071 | * @hide |
| 1072 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1073 | @SystemApi |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1074 | public static final int INSTALL_FAILED_TEST_ONLY = -15; |
| 1075 | |
| 1076 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1077 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1078 | * if the package being installed contains native code, but none that is compatible with the |
| 1079 | * device's CPU_ABI. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1080 | * |
Dianne Hackborn | b181118 | 2009-05-21 15:45:42 -0700 | [diff] [blame] | 1081 | * @hide |
| 1082 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1083 | @SystemApi |
Dianne Hackborn | b181118 | 2009-05-21 15:45:42 -0700 | [diff] [blame] | 1084 | public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16; |
| 1085 | |
| 1086 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1087 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1088 | * if the new package uses a feature that is not available. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1089 | * |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 1090 | * @hide |
| 1091 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1092 | @SystemApi |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 1093 | public static final int INSTALL_FAILED_MISSING_FEATURE = -17; |
| 1094 | |
Suchi Amalapurapu | af8e9f4 | 2010-01-12 10:17:28 -0800 | [diff] [blame] | 1095 | // ------ Errors related to sdcard |
| 1096 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1097 | * Installation return code: this is passed in the |
| 1098 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if a secure container mount point couldn't be |
| 1099 | * accessed on external media. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1100 | * |
Suchi Amalapurapu | af8e9f4 | 2010-01-12 10:17:28 -0800 | [diff] [blame] | 1101 | * @hide |
| 1102 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1103 | @SystemApi |
Suchi Amalapurapu | af8e9f4 | 2010-01-12 10:17:28 -0800 | [diff] [blame] | 1104 | public static final int INSTALL_FAILED_CONTAINER_ERROR = -18; |
| 1105 | |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 1106 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1107 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1108 | * if the new package couldn't be installed in the specified install location. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1109 | * |
Suchi Amalapurapu | b56ae20 | 2010-02-04 22:51:07 -0800 | [diff] [blame] | 1110 | * @hide |
| 1111 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1112 | @SystemApi |
Suchi Amalapurapu | b56ae20 | 2010-02-04 22:51:07 -0800 | [diff] [blame] | 1113 | public static final int INSTALL_FAILED_INVALID_INSTALL_LOCATION = -19; |
| 1114 | |
| 1115 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1116 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1117 | * if the new package couldn't be installed in the specified install location because the media |
| 1118 | * is not available. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1119 | * |
Suchi Amalapurapu | 8a9ab24 | 2010-03-11 16:49:16 -0800 | [diff] [blame] | 1120 | * @hide |
| 1121 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1122 | @SystemApi |
Suchi Amalapurapu | 8a9ab24 | 2010-03-11 16:49:16 -0800 | [diff] [blame] | 1123 | public static final int INSTALL_FAILED_MEDIA_UNAVAILABLE = -20; |
| 1124 | |
| 1125 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1126 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1127 | * 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] | 1128 | * |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 1129 | * @hide |
| 1130 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1131 | @SystemApi |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 1132 | public static final int INSTALL_FAILED_VERIFICATION_TIMEOUT = -21; |
| 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 new package couldn't be installed because the verification did not succeed. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1137 | * |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 1138 | * @hide |
| 1139 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1140 | @SystemApi |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 1141 | public static final int INSTALL_FAILED_VERIFICATION_FAILURE = -22; |
| 1142 | |
| 1143 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1144 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1145 | * if the package changed from what the calling program expected. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1146 | * |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 1147 | * @hide |
| 1148 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1149 | @SystemApi |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 1150 | public static final int INSTALL_FAILED_PACKAGE_CHANGED = -23; |
| 1151 | |
| 1152 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1153 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1154 | * 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] | 1155 | * |
Dianne Hackborn | d0c5f51 | 2012-06-07 16:53:59 -0700 | [diff] [blame] | 1156 | * @hide |
| 1157 | */ |
| 1158 | public static final int INSTALL_FAILED_UID_CHANGED = -24; |
| 1159 | |
| 1160 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1161 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1162 | * 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] | 1163 | * |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 1164 | * @hide |
| 1165 | */ |
| 1166 | public static final int INSTALL_FAILED_VERSION_DOWNGRADE = -25; |
| 1167 | |
| 1168 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1169 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1170 | * if the old package has target SDK high enough to support runtime permission and the new |
| 1171 | * package has target SDK low enough to not support runtime permissions. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1172 | * |
Svetoslav | d965370 | 2015-05-13 18:02:46 -0700 | [diff] [blame] | 1173 | * @hide |
| 1174 | */ |
| 1175 | @SystemApi |
| 1176 | public static final int INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE = -26; |
| 1177 | |
| 1178 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1179 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1180 | * 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] | 1181 | * |
| 1182 | * @hide |
| 1183 | */ |
| 1184 | @SystemApi |
| 1185 | public static final int INSTALL_FAILED_SANDBOX_VERSION_DOWNGRADE = -27; |
| 1186 | |
| 1187 | /** |
Todd Kennedy | 29cfa27 | 2018-09-26 10:25:24 -0700 | [diff] [blame] | 1188 | * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS} |
| 1189 | * if the new package requires at least one split and it was not provided. |
| 1190 | * |
| 1191 | * @hide |
| 1192 | */ |
| 1193 | public static final int INSTALL_FAILED_MISSING_SPLIT = -28; |
| 1194 | |
| 1195 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1196 | * Installation parse return code: this is passed in the |
| 1197 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser was given a path that is not a |
| 1198 | * file, or does not end with the expected '.apk' extension. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1199 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1200 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1201 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1202 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1203 | public static final int INSTALL_PARSE_FAILED_NOT_APK = -100; |
| 1204 | |
| 1205 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1206 | * Installation parse return code: this is passed in the |
| 1207 | * {@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] | 1208 | * AndroidManifest.xml file. |
| 1209 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1210 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1211 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1212 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1213 | public static final int INSTALL_PARSE_FAILED_BAD_MANIFEST = -101; |
| 1214 | |
| 1215 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1216 | * Installation parse return code: this is passed in the |
| 1217 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered an unexpected |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1218 | * exception. |
| 1219 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1220 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1221 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1222 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1223 | public static final int INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION = -102; |
| 1224 | |
| 1225 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1226 | * Installation parse return code: this is passed in the |
| 1227 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser did not find any certificates in |
| 1228 | * the .apk. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1229 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1230 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1231 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1232 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1233 | public static final int INSTALL_PARSE_FAILED_NO_CERTIFICATES = -103; |
| 1234 | |
| 1235 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1236 | * Installation parse return code: this is passed in the |
| 1237 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser found inconsistent certificates on |
| 1238 | * the files in the .apk. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1239 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1240 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1241 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1242 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1243 | public static final int INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES = -104; |
| 1244 | |
| 1245 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1246 | * Installation parse return code: this is passed in the |
| 1247 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered a |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1248 | * CertificateEncodingException in one of the files in the .apk. |
| 1249 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1250 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1251 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1252 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1253 | public static final int INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING = -105; |
| 1254 | |
| 1255 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1256 | * Installation parse return code: this is passed in the |
| 1257 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered a bad or missing |
| 1258 | * package name in the manifest. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1259 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1260 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1261 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1262 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1263 | public static final int INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME = -106; |
| 1264 | |
| 1265 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1266 | * Installation parse return code: tthis is passed in the |
| 1267 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered a bad shared user id |
| 1268 | * name in the manifest. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1269 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1270 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1271 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1272 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1273 | public static final int INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID = -107; |
| 1274 | |
| 1275 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1276 | * Installation parse return code: this is passed in the |
| 1277 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered some structural |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1278 | * problem in the manifest. |
| 1279 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1280 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1281 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1282 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1283 | public static final int INSTALL_PARSE_FAILED_MANIFEST_MALFORMED = -108; |
| 1284 | |
| 1285 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1286 | * Installation parse return code: this is passed in the |
| 1287 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser did not find any actionable tags |
| 1288 | * (instrumentation or application) in the manifest. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1289 | * |
Dianne Hackborn | ade3eca | 2009-05-11 18:54:45 -0700 | [diff] [blame] | 1290 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1291 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1292 | @SystemApi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1293 | public static final int INSTALL_PARSE_FAILED_MANIFEST_EMPTY = -109; |
| 1294 | |
| 1295 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1296 | * Installation failed return code: this is passed in the |
| 1297 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package |
| 1298 | * because of system issues. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1299 | * |
Suchi Amalapurapu | 5b993ce | 2010-02-12 09:43:29 -0800 | [diff] [blame] | 1300 | * @hide |
| 1301 | */ |
Jeff Brown | d5a5b5a | 2014-06-05 17:14:39 -0700 | [diff] [blame] | 1302 | @SystemApi |
Suchi Amalapurapu | 5b993ce | 2010-02-12 09:43:29 -0800 | [diff] [blame] | 1303 | public static final int INSTALL_FAILED_INTERNAL_ERROR = -110; |
| 1304 | |
| 1305 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1306 | * Installation failed return code: this is passed in the |
| 1307 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package |
| 1308 | * because the user is restricted from installing apps. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1309 | * |
Amith Yamasani | e4cf734 | 2012-12-17 11:12:09 -0800 | [diff] [blame] | 1310 | * @hide |
| 1311 | */ |
| 1312 | public static final int INSTALL_FAILED_USER_RESTRICTED = -111; |
| 1313 | |
| 1314 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1315 | * Installation failed return code: this is passed in the |
| 1316 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package |
| 1317 | * because it is attempting to define a permission that is already defined by some existing |
| 1318 | * package. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1319 | * <p> |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1320 | * The package name of the app which has already defined the permission is passed to a |
| 1321 | * {@link PackageInstallObserver}, if any, as the {@link #EXTRA_FAILURE_EXISTING_PACKAGE} string |
| 1322 | * 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] | 1323 | * {@link #EXTRA_FAILURE_EXISTING_PERMISSION} string extra. |
Christopher Tate | f1977b4 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 1324 | * |
Christopher Tate | f1977b4 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 1325 | * @hide |
| 1326 | */ |
| 1327 | public static final int INSTALL_FAILED_DUPLICATE_PERMISSION = -112; |
| 1328 | |
| 1329 | /** |
Philip P. Moltmann | b13f153 | 2017-11-14 08:34:06 -0800 | [diff] [blame] | 1330 | * Installation failed return code: this is passed in the |
| 1331 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package |
| 1332 | * 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] | 1333 | * |
| 1334 | * @hide |
| 1335 | */ |
Narayan Kamath | d11f223 | 2014-04-10 10:37:17 +0100 | [diff] [blame] | 1336 | public static final int INSTALL_FAILED_NO_MATCHING_ABIS = -113; |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 1337 | |
| 1338 | /** |
| 1339 | * Internal return code for NativeLibraryHelper methods to indicate that the package |
| 1340 | * being processed did not contain any native code. This is placed here only so that |
| 1341 | * it can belong to the same value space as the other install failure codes. |
| 1342 | * |
| 1343 | * @hide |
| 1344 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 1345 | @UnsupportedAppUsage |
Narayan Kamath | d11f223 | 2014-04-10 10:37:17 +0100 | [diff] [blame] | 1346 | public static final int NO_NATIVE_LIBRARIES = -114; |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 1347 | |
Jeff Sharkey | 7328a1b | 2014-08-07 14:01:43 -0700 | [diff] [blame] | 1348 | /** {@hide} */ |
Jeff Sharkey | f060095 | 2014-08-07 17:31:53 -0700 | [diff] [blame] | 1349 | public static final int INSTALL_FAILED_ABORTED = -115; |
Jeff Sharkey | 7328a1b | 2014-08-07 14:01:43 -0700 | [diff] [blame] | 1350 | |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 1351 | /** |
Todd Kennedy | be0b889 | 2017-02-15 14:13:52 -0800 | [diff] [blame] | 1352 | * Installation failed return code: instant app installs are incompatible with some |
Todd Kennedy | 2699f06 | 2015-11-20 13:07:17 -0800 | [diff] [blame] | 1353 | * other installation flags supplied for the operation; or other circumstances such |
Todd Kennedy | be0b889 | 2017-02-15 14:13:52 -0800 | [diff] [blame] | 1354 | * as trying to upgrade a system app via an instant app install. |
Todd Kennedy | 2699f06 | 2015-11-20 13:07:17 -0800 | [diff] [blame] | 1355 | * @hide |
| 1356 | */ |
Todd Kennedy | be0b889 | 2017-02-15 14:13:52 -0800 | [diff] [blame] | 1357 | public static final int INSTALL_FAILED_INSTANT_APP_INVALID = -116; |
Todd Kennedy | 2699f06 | 2015-11-20 13:07:17 -0800 | [diff] [blame] | 1358 | |
Calin Juravle | 3fc56c3 | 2017-12-11 18:26:13 -0800 | [diff] [blame] | 1359 | /** |
| 1360 | * Installation parse return code: this is passed in the |
| 1361 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the dex metadata file is invalid or |
| 1362 | * if there was no matching apk file for a dex metadata file. |
| 1363 | * |
| 1364 | * @hide |
| 1365 | */ |
| 1366 | public static final int INSTALL_FAILED_BAD_DEX_METADATA = -117; |
| 1367 | |
Victor Hsieh | c0cd748 | 2018-10-04 10:10:54 -0700 | [diff] [blame] | 1368 | /** |
| 1369 | * Installation parse return code: this is passed in the |
| 1370 | * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if there is any signature problem. |
| 1371 | * |
| 1372 | * @hide |
| 1373 | */ |
| 1374 | public static final int INSTALL_FAILED_BAD_SIGNATURE = -118; |
| 1375 | |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1376 | /** @hide */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 1377 | @IntDef(flag = true, prefix = { "DELETE_" }, value = { |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1378 | DELETE_KEEP_DATA, |
| 1379 | DELETE_ALL_USERS, |
| 1380 | DELETE_SYSTEM_APP, |
Todd Kennedy | 39bfee5 | 2016-02-24 10:28:21 -0800 | [diff] [blame] | 1381 | DELETE_DONT_KILL_APP, |
Todd Kennedy | 232d29e | 2017-11-06 14:45:53 -0800 | [diff] [blame] | 1382 | DELETE_CHATTY, |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1383 | }) |
| 1384 | @Retention(RetentionPolicy.SOURCE) |
| 1385 | public @interface DeleteFlags {} |
| 1386 | |
Todd Kennedy | 2699f06 | 2015-11-20 13:07:17 -0800 | [diff] [blame] | 1387 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1388 | * Flag parameter for {@link #deletePackage} to indicate that you don't want to delete the |
| 1389 | * package's data directory. |
| 1390 | * |
| 1391 | * @hide |
| 1392 | */ |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 1393 | public static final int DELETE_KEEP_DATA = 0x00000001; |
| 1394 | |
| 1395 | /** |
| 1396 | * Flag parameter for {@link #deletePackage} to indicate that you want the |
| 1397 | * package deleted for all users. |
| 1398 | * |
| 1399 | * @hide |
| 1400 | */ |
| 1401 | public static final int DELETE_ALL_USERS = 0x00000002; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1402 | |
| 1403 | /** |
Dianne Hackborn | c895be7 | 2013-03-11 17:48:43 -0700 | [diff] [blame] | 1404 | * Flag parameter for {@link #deletePackage} to indicate that, if you are calling |
| 1405 | * uninstall on a system that has been updated, then don't do the normal process |
| 1406 | * of uninstalling the update and rolling back to the older system version (which |
| 1407 | * needs to happen for all users); instead, just mark the app as uninstalled for |
| 1408 | * the current user. |
| 1409 | * |
| 1410 | * @hide |
| 1411 | */ |
| 1412 | public static final int DELETE_SYSTEM_APP = 0x00000004; |
| 1413 | |
| 1414 | /** |
Todd Kennedy | 39bfee5 | 2016-02-24 10:28:21 -0800 | [diff] [blame] | 1415 | * Flag parameter for {@link #deletePackage} to indicate that, if you are calling |
| 1416 | * uninstall on a package that is replaced to provide new feature splits, the |
| 1417 | * existing application should not be killed during the removal process. |
| 1418 | * |
| 1419 | * @hide |
| 1420 | */ |
| 1421 | public static final int DELETE_DONT_KILL_APP = 0x00000008; |
| 1422 | |
| 1423 | /** |
Jeff Sharkey | dc50d4c | 2018-12-10 18:28:56 -0700 | [diff] [blame] | 1424 | * Flag parameter for {@link #deletePackage} to indicate that any |
| 1425 | * contributed media should also be deleted during this uninstall. The |
| 1426 | * meaning of "contributed" means it won't automatically be deleted when the |
| 1427 | * app is uninstalled. |
| 1428 | * |
| 1429 | * @hide |
| 1430 | */ |
| 1431 | public static final int DELETE_CONTRIBUTED_MEDIA = 0x00000010; |
| 1432 | |
| 1433 | /** |
Todd Kennedy | 232d29e | 2017-11-06 14:45:53 -0800 | [diff] [blame] | 1434 | * Flag parameter for {@link #deletePackage} to indicate that package deletion |
| 1435 | * should be chatty. |
| 1436 | * |
| 1437 | * @hide |
| 1438 | */ |
| 1439 | public static final int DELETE_CHATTY = 0x80000000; |
| 1440 | |
| 1441 | /** |
Kenny Root | c39bb4a | 2011-02-28 13:27:19 -0800 | [diff] [blame] | 1442 | * Return code for when package deletion succeeds. This is passed to the |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1443 | * {@link IPackageDeleteObserver} if the system succeeded in deleting the |
| 1444 | * package. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 1445 | * |
Kenny Root | c39bb4a | 2011-02-28 13:27:19 -0800 | [diff] [blame] | 1446 | * @hide |
| 1447 | */ |
| 1448 | public static final int DELETE_SUCCEEDED = 1; |
| 1449 | |
| 1450 | /** |
| 1451 | * Deletion failed return code: this is passed to the |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1452 | * {@link IPackageDeleteObserver} if the system failed to delete the package |
| 1453 | * for an unspecified reason. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 1454 | * |
Kenny Root | c39bb4a | 2011-02-28 13:27:19 -0800 | [diff] [blame] | 1455 | * @hide |
| 1456 | */ |
| 1457 | public static final int DELETE_FAILED_INTERNAL_ERROR = -1; |
| 1458 | |
| 1459 | /** |
| 1460 | * Deletion failed return code: this is passed to the |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1461 | * {@link IPackageDeleteObserver} if the system failed to delete the package |
| 1462 | * because it is the active DevicePolicy manager. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 1463 | * |
Kenny Root | c39bb4a | 2011-02-28 13:27:19 -0800 | [diff] [blame] | 1464 | * @hide |
| 1465 | */ |
| 1466 | public static final int DELETE_FAILED_DEVICE_POLICY_MANAGER = -2; |
| 1467 | |
| 1468 | /** |
Amith Yamasani | e4cf734 | 2012-12-17 11:12:09 -0800 | [diff] [blame] | 1469 | * Deletion failed return code: this is passed to the |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1470 | * {@link IPackageDeleteObserver} if the system failed to delete the package |
| 1471 | * since the user is restricted. |
Amith Yamasani | e4cf734 | 2012-12-17 11:12:09 -0800 | [diff] [blame] | 1472 | * |
| 1473 | * @hide |
| 1474 | */ |
| 1475 | public static final int DELETE_FAILED_USER_RESTRICTED = -3; |
| 1476 | |
| 1477 | /** |
Kenny Guy | 1b88da5 | 2014-07-10 16:33:49 +0100 | [diff] [blame] | 1478 | * Deletion failed return code: this is passed to the |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1479 | * {@link IPackageDeleteObserver} if the system failed to delete the package |
| 1480 | * because a profile or device owner has marked the package as |
| 1481 | * uninstallable. |
Kenny Guy | c13053b | 2014-05-29 14:17:17 +0100 | [diff] [blame] | 1482 | * |
| 1483 | * @hide |
| 1484 | */ |
Jeff Sharkey | f060095 | 2014-08-07 17:31:53 -0700 | [diff] [blame] | 1485 | public static final int DELETE_FAILED_OWNER_BLOCKED = -4; |
| 1486 | |
| 1487 | /** {@hide} */ |
| 1488 | public static final int DELETE_FAILED_ABORTED = -5; |
Kenny Guy | c13053b | 2014-05-29 14:17:17 +0100 | [diff] [blame] | 1489 | |
| 1490 | /** |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 1491 | * Deletion failed return code: this is passed to the |
| 1492 | * {@link IPackageDeleteObserver} if the system failed to delete the package |
| 1493 | * because the packge is a shared library used by other installed packages. |
| 1494 | * {@hide} */ |
| 1495 | public static final int DELETE_FAILED_USED_SHARED_LIBRARY = -6; |
| 1496 | |
| 1497 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1498 | * Return code that is passed to the {@link IPackageMoveObserver} when the |
Kenny Root | c39bb4a | 2011-02-28 13:27:19 -0800 | [diff] [blame] | 1499 | * package has been successfully moved by the system. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 1500 | * |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1501 | * @hide |
| 1502 | */ |
Jeff Sharkey | 620b32b | 2015-04-23 19:36:02 -0700 | [diff] [blame] | 1503 | public static final int MOVE_SUCCEEDED = -100; |
| 1504 | |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1505 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1506 | * Error code that is passed to the {@link IPackageMoveObserver} when the |
| 1507 | * package hasn't been successfully moved by the system because of |
| 1508 | * insufficient memory on specified media. |
| 1509 | * |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1510 | * @hide |
| 1511 | */ |
| 1512 | public static final int MOVE_FAILED_INSUFFICIENT_STORAGE = -1; |
| 1513 | |
| 1514 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1515 | * Error code that is passed to the {@link IPackageMoveObserver} if the |
| 1516 | * specified package doesn't exist. |
| 1517 | * |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1518 | * @hide |
| 1519 | */ |
| 1520 | public static final int MOVE_FAILED_DOESNT_EXIST = -2; |
| 1521 | |
| 1522 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1523 | * Error code that is passed to the {@link IPackageMoveObserver} if the |
| 1524 | * specified package cannot be moved since its a system package. |
| 1525 | * |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1526 | * @hide |
| 1527 | */ |
| 1528 | public static final int MOVE_FAILED_SYSTEM_PACKAGE = -3; |
| 1529 | |
| 1530 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1531 | * Error code that is passed to the {@link IPackageMoveObserver} if the |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1532 | * specified package cannot be moved to the specified location. |
| 1533 | * |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1534 | * @hide |
| 1535 | */ |
| 1536 | public static final int MOVE_FAILED_INVALID_LOCATION = -5; |
| 1537 | |
| 1538 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1539 | * Error code that is passed to the {@link IPackageMoveObserver} if the |
| 1540 | * specified package cannot be moved to the specified location. |
| 1541 | * |
Suchi Amalapurapu | 8a9ab24 | 2010-03-11 16:49:16 -0800 | [diff] [blame] | 1542 | * @hide |
| 1543 | */ |
| 1544 | public static final int MOVE_FAILED_INTERNAL_ERROR = -6; |
| 1545 | |
| 1546 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1547 | * Error code that is passed to the {@link IPackageMoveObserver} if the |
| 1548 | * specified package already has an operation pending in the queue. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 1549 | * |
Kenny Root | deb1126 | 2010-08-02 11:36:21 -0700 | [diff] [blame] | 1550 | * @hide |
| 1551 | */ |
| 1552 | public static final int MOVE_FAILED_OPERATION_PENDING = -7; |
| 1553 | |
| 1554 | /** |
Makoto Onuki | f34db0a | 2016-02-17 11:17:15 -0800 | [diff] [blame] | 1555 | * Error code that is passed to the {@link IPackageMoveObserver} if the |
| 1556 | * specified package cannot be moved since it contains a device admin. |
| 1557 | * |
| 1558 | * @hide |
| 1559 | */ |
| 1560 | public static final int MOVE_FAILED_DEVICE_ADMIN = -8; |
| 1561 | |
| 1562 | /** |
Yao Chen | 022b8ea | 2016-12-16 11:03:28 -0800 | [diff] [blame] | 1563 | * Error code that is passed to the {@link IPackageMoveObserver} if system does not allow |
| 1564 | * non-system apps to be moved to internal storage. |
| 1565 | * |
| 1566 | * @hide |
| 1567 | */ |
| 1568 | public static final int MOVE_FAILED_3RD_PARTY_NOT_ALLOWED_ON_INTERNAL = -9; |
| 1569 | |
Jeff Sharkey | a65e649 | 2017-06-21 13:45:11 -0600 | [diff] [blame] | 1570 | /** @hide */ |
| 1571 | public static final int MOVE_FAILED_LOCKED_USER = -10; |
| 1572 | |
Yao Chen | 022b8ea | 2016-12-16 11:03:28 -0800 | [diff] [blame] | 1573 | /** |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1574 | * Flag parameter for {@link #movePackage} to indicate that |
| 1575 | * the package should be moved to internal storage if its |
| 1576 | * been installed on external media. |
| 1577 | * @hide |
| 1578 | */ |
Jeff Sharkey | 620b32b | 2015-04-23 19:36:02 -0700 | [diff] [blame] | 1579 | @Deprecated |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 1580 | @UnsupportedAppUsage |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1581 | public static final int MOVE_INTERNAL = 0x00000001; |
| 1582 | |
| 1583 | /** |
| 1584 | * Flag parameter for {@link #movePackage} to indicate that |
| 1585 | * the package should be moved to external media. |
| 1586 | * @hide |
| 1587 | */ |
Jeff Sharkey | 620b32b | 2015-04-23 19:36:02 -0700 | [diff] [blame] | 1588 | @Deprecated |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 1589 | @UnsupportedAppUsage |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1590 | public static final int MOVE_EXTERNAL_MEDIA = 0x00000002; |
| 1591 | |
Jeff Sharkey | 620b32b | 2015-04-23 19:36:02 -0700 | [diff] [blame] | 1592 | /** {@hide} */ |
| 1593 | public static final String EXTRA_MOVE_ID = "android.content.pm.extra.MOVE_ID"; |
| 1594 | |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 1595 | /** |
Kenny Root | 05ca4c9 | 2011-09-15 10:36:25 -0700 | [diff] [blame] | 1596 | * Usable by the required verifier as the {@code verificationCode} argument |
| 1597 | * for {@link PackageManager#verifyPendingInstall} to indicate that it will |
| 1598 | * allow the installation to proceed without any of the optional verifiers |
| 1599 | * needing to vote. |
| 1600 | * |
| 1601 | * @hide |
| 1602 | */ |
| 1603 | public static final int VERIFICATION_ALLOW_WITHOUT_SUFFICIENT = 2; |
| 1604 | |
| 1605 | /** |
Kenny Root | 3a9b5fb | 2011-09-20 14:15:38 -0700 | [diff] [blame] | 1606 | * Used as the {@code verificationCode} argument for |
| 1607 | * {@link PackageManager#verifyPendingInstall} to indicate that the calling |
| 1608 | * package verifier allows the installation to proceed. |
| 1609 | */ |
| 1610 | public static final int VERIFICATION_ALLOW = 1; |
| 1611 | |
| 1612 | /** |
| 1613 | * Used as the {@code verificationCode} argument for |
| 1614 | * {@link PackageManager#verifyPendingInstall} to indicate the calling |
| 1615 | * package verifier does not vote to allow the installation to proceed. |
| 1616 | */ |
| 1617 | public static final int VERIFICATION_REJECT = -1; |
| 1618 | |
| 1619 | /** |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 1620 | * Used as the {@code verificationCode} argument for |
| 1621 | * {@link PackageManager#verifyIntentFilter} to indicate that the calling |
| 1622 | * IntentFilter Verifier confirms that the IntentFilter is verified. |
| 1623 | * |
| 1624 | * @hide |
| 1625 | */ |
Todd Kennedy | dfa93ab | 2016-03-03 15:24:33 -0800 | [diff] [blame] | 1626 | @SystemApi |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 1627 | public static final int INTENT_FILTER_VERIFICATION_SUCCESS = 1; |
| 1628 | |
| 1629 | /** |
| 1630 | * Used as the {@code verificationCode} argument for |
| 1631 | * {@link PackageManager#verifyIntentFilter} to indicate that the calling |
| 1632 | * IntentFilter Verifier confirms that the IntentFilter is NOT verified. |
| 1633 | * |
| 1634 | * @hide |
| 1635 | */ |
Todd Kennedy | dfa93ab | 2016-03-03 15:24:33 -0800 | [diff] [blame] | 1636 | @SystemApi |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 1637 | public static final int INTENT_FILTER_VERIFICATION_FAILURE = -1; |
| 1638 | |
| 1639 | /** |
| 1640 | * Internal status code to indicate that an IntentFilter verification result is not specified. |
| 1641 | * |
| 1642 | * @hide |
| 1643 | */ |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 1644 | @SystemApi |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 1645 | public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED = 0; |
| 1646 | |
| 1647 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1648 | * Used as the {@code status} argument for |
| 1649 | * {@link #updateIntentVerificationStatusAsUser} to indicate that the User |
| 1650 | * will always be prompted the Intent Disambiguation Dialog if there are two |
| 1651 | * or more Intent resolved for the IntentFilter's domain(s). |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 1652 | * |
| 1653 | * @hide |
| 1654 | */ |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 1655 | @SystemApi |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 1656 | public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK = 1; |
| 1657 | |
| 1658 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1659 | * Used as the {@code status} argument for |
| 1660 | * {@link #updateIntentVerificationStatusAsUser} to indicate that the User |
| 1661 | * will never be prompted the Intent Disambiguation Dialog if there are two |
| 1662 | * or more resolution of the Intent. The default App for the domain(s) |
| 1663 | * specified in the IntentFilter will also ALWAYS be used. |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 1664 | * |
| 1665 | * @hide |
| 1666 | */ |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 1667 | @SystemApi |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 1668 | public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS = 2; |
| 1669 | |
| 1670 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1671 | * Used as the {@code status} argument for |
| 1672 | * {@link #updateIntentVerificationStatusAsUser} to indicate that the User |
| 1673 | * may be prompted the Intent Disambiguation Dialog if there are two or more |
| 1674 | * 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] | 1675 | * IntentFilter will also NEVER be presented to the User. |
| 1676 | * |
| 1677 | * @hide |
| 1678 | */ |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 1679 | @SystemApi |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 1680 | public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER = 3; |
| 1681 | |
| 1682 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 1683 | * Used as the {@code status} argument for |
| 1684 | * {@link #updateIntentVerificationStatusAsUser} to indicate that this app |
| 1685 | * should always be considered as an ambiguous candidate for handling the |
| 1686 | * matching Intent even if there are other candidate apps in the "always" |
| 1687 | * state. Put another way: if there are any 'always ask' apps in a set of |
| 1688 | * more than one candidate app, then a disambiguation is *always* presented |
| 1689 | * even if there is another candidate app with the 'always' state. |
Christopher Tate | 56f0ff3 | 2015-08-13 16:29:33 -0700 | [diff] [blame] | 1690 | * |
| 1691 | * @hide |
| 1692 | */ |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 1693 | @SystemApi |
Christopher Tate | 56f0ff3 | 2015-08-13 16:29:33 -0700 | [diff] [blame] | 1694 | public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK = 4; |
| 1695 | |
| 1696 | /** |
rich cannings | d9ef3e5 | 2012-08-22 14:28:05 -0700 | [diff] [blame] | 1697 | * Can be used as the {@code millisecondsToDelay} argument for |
| 1698 | * {@link PackageManager#extendVerificationTimeout}. This is the |
| 1699 | * maximum time {@code PackageManager} waits for the verification |
| 1700 | * agent to return (in milliseconds). |
| 1701 | */ |
| 1702 | public static final long MAXIMUM_VERIFICATION_TIMEOUT = 60*60*1000; |
| 1703 | |
| 1704 | /** |
Amith Yamasani | 0b28549 | 2011-04-14 17:35:23 -0700 | [diff] [blame] | 1705 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device's |
| 1706 | * audio pipeline is low-latency, more suitable for audio applications sensitive to delays or |
| 1707 | * lag in sound input or output. |
Dan Morrill | 898e1e8 | 2010-09-26 17:28:30 -0700 | [diff] [blame] | 1708 | */ |
| 1709 | @SdkConstant(SdkConstantType.FEATURE) |
| 1710 | public static final String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency"; |
| 1711 | |
| 1712 | /** |
| 1713 | * Feature for {@link #getSystemAvailableFeatures} and |
Unsuk Jung | 50909f6 | 2014-09-02 18:25:49 -0700 | [diff] [blame] | 1714 | * {@link #hasSystemFeature}: The device includes at least one form of audio |
Glenn Kasten | 0a111ad | 2018-05-16 14:11:09 -0700 | [diff] [blame] | 1715 | * output, as defined in the Android Compatibility Definition Document (CDD) |
| 1716 | * <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] | 1717 | */ |
| 1718 | @SdkConstant(SdkConstantType.FEATURE) |
| 1719 | public static final String FEATURE_AUDIO_OUTPUT = "android.hardware.audio.output"; |
| 1720 | |
| 1721 | /** |
Glenn Kasten | cdcb577 | 2015-05-06 15:54:49 -0700 | [diff] [blame] | 1722 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Glenn Kasten | 7587edc | 2015-10-30 17:45:52 -0700 | [diff] [blame] | 1723 | * The device has professional audio level of functionality and performance. |
Glenn Kasten | cdcb577 | 2015-05-06 15:54:49 -0700 | [diff] [blame] | 1724 | */ |
| 1725 | @SdkConstant(SdkConstantType.FEATURE) |
| 1726 | public static final String FEATURE_AUDIO_PRO = "android.hardware.audio.pro"; |
| 1727 | |
| 1728 | /** |
Unsuk Jung | 50909f6 | 2014-09-02 18:25:49 -0700 | [diff] [blame] | 1729 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1730 | * {@link #hasSystemFeature}: The device is capable of communicating with |
| 1731 | * other devices via Bluetooth. |
| 1732 | */ |
| 1733 | @SdkConstant(SdkConstantType.FEATURE) |
| 1734 | public static final String FEATURE_BLUETOOTH = "android.hardware.bluetooth"; |
| 1735 | |
| 1736 | /** |
| 1737 | * Feature for {@link #getSystemAvailableFeatures} and |
Matthew Xie | a722772 | 2013-04-18 15:25:59 -0700 | [diff] [blame] | 1738 | * {@link #hasSystemFeature}: The device is capable of communicating with |
| 1739 | * other devices via Bluetooth Low Energy radio. |
| 1740 | */ |
| 1741 | @SdkConstant(SdkConstantType.FEATURE) |
| 1742 | public static final String FEATURE_BLUETOOTH_LE = "android.hardware.bluetooth_le"; |
| 1743 | |
| 1744 | /** |
| 1745 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1746 | * {@link #hasSystemFeature}: The device has a camera facing away |
| 1747 | * from the screen. |
| 1748 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 1749 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1750 | public static final String FEATURE_CAMERA = "android.hardware.camera"; |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1751 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1752 | /** |
| 1753 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1754 | * {@link #hasSystemFeature}: The device's camera supports auto-focus. |
| 1755 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 1756 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1757 | public static final String FEATURE_CAMERA_AUTOFOCUS = "android.hardware.camera.autofocus"; |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1758 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1759 | /** |
| 1760 | * Feature for {@link #getSystemAvailableFeatures} and |
Eino-Ville Talvala | 752af83 | 2012-09-18 14:45:37 -0700 | [diff] [blame] | 1761 | * {@link #hasSystemFeature}: The device has at least one camera pointing in |
Eino-Ville Talvala | 9131da2 | 2014-05-08 11:39:53 -0700 | [diff] [blame] | 1762 | * 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] | 1763 | */ |
| 1764 | @SdkConstant(SdkConstantType.FEATURE) |
| 1765 | public static final String FEATURE_CAMERA_ANY = "android.hardware.camera.any"; |
| 1766 | |
| 1767 | /** |
| 1768 | * Feature for {@link #getSystemAvailableFeatures} and |
Eino-Ville Talvala | 9131da2 | 2014-05-08 11:39:53 -0700 | [diff] [blame] | 1769 | * {@link #hasSystemFeature}: The device can support having an external camera connected to it. |
| 1770 | * The external camera may not always be connected or available to applications to use. |
| 1771 | */ |
| 1772 | @SdkConstant(SdkConstantType.FEATURE) |
| 1773 | public static final String FEATURE_CAMERA_EXTERNAL = "android.hardware.camera.external"; |
| 1774 | |
| 1775 | /** |
| 1776 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1777 | * {@link #hasSystemFeature}: The device's camera supports flash. |
| 1778 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 1779 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 1780 | public static final String FEATURE_CAMERA_FLASH = "android.hardware.camera.flash"; |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1781 | |
| 1782 | /** |
| 1783 | * Feature for {@link #getSystemAvailableFeatures} and |
Chih-Chung Chang | de1057c | 2010-06-14 19:15:00 +0800 | [diff] [blame] | 1784 | * {@link #hasSystemFeature}: The device has a front facing camera. |
| 1785 | */ |
| 1786 | @SdkConstant(SdkConstantType.FEATURE) |
| 1787 | public static final String FEATURE_CAMERA_FRONT = "android.hardware.camera.front"; |
| 1788 | |
| 1789 | /** |
Eino-Ville Talvala | 611fece | 2014-07-10 17:29:38 -0700 | [diff] [blame] | 1790 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one |
| 1791 | * of the cameras on the device supports the |
| 1792 | * {@link android.hardware.camera2.CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL full hardware} |
| 1793 | * capability level. |
| 1794 | */ |
| 1795 | @SdkConstant(SdkConstantType.FEATURE) |
| 1796 | public static final String FEATURE_CAMERA_LEVEL_FULL = "android.hardware.camera.level.full"; |
| 1797 | |
| 1798 | /** |
| 1799 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one |
| 1800 | * of the cameras on the device supports the |
| 1801 | * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR manual sensor} |
| 1802 | * capability level. |
| 1803 | */ |
| 1804 | @SdkConstant(SdkConstantType.FEATURE) |
| 1805 | public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_SENSOR = |
| 1806 | "android.hardware.camera.capability.manual_sensor"; |
| 1807 | |
| 1808 | /** |
| 1809 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one |
| 1810 | * of the cameras on the device supports the |
| 1811 | * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING manual post-processing} |
| 1812 | * capability level. |
| 1813 | */ |
| 1814 | @SdkConstant(SdkConstantType.FEATURE) |
| 1815 | public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_POST_PROCESSING = |
| 1816 | "android.hardware.camera.capability.manual_post_processing"; |
| 1817 | |
| 1818 | /** |
| 1819 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one |
| 1820 | * of the cameras on the device supports the |
| 1821 | * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_RAW RAW} |
| 1822 | * capability level. |
| 1823 | */ |
| 1824 | @SdkConstant(SdkConstantType.FEATURE) |
| 1825 | public static final String FEATURE_CAMERA_CAPABILITY_RAW = |
| 1826 | "android.hardware.camera.capability.raw"; |
| 1827 | |
| 1828 | /** |
Eino-Ville Talvala | dfa0c2a | 2018-01-10 12:01:08 -0800 | [diff] [blame] | 1829 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one |
| 1830 | * of the cameras on the device supports the |
| 1831 | * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MOTION_TRACKING |
| 1832 | * MOTION_TRACKING} capability level. |
| 1833 | */ |
| 1834 | @SdkConstant(SdkConstantType.FEATURE) |
| 1835 | public static final String FEATURE_CAMERA_AR = |
| 1836 | "android.hardware.camera.ar"; |
| 1837 | |
| 1838 | /** |
Chih-Chung Chang | de1057c | 2010-06-14 19:15:00 +0800 | [diff] [blame] | 1839 | * Feature for {@link #getSystemAvailableFeatures} and |
Alex Ray | 0c9d61f | 2013-10-03 12:17:54 -0700 | [diff] [blame] | 1840 | * {@link #hasSystemFeature}: The device is capable of communicating with |
| 1841 | * consumer IR devices. |
| 1842 | */ |
| 1843 | @SdkConstant(SdkConstantType.FEATURE) |
| 1844 | public static final String FEATURE_CONSUMER_IR = "android.hardware.consumerir"; |
| 1845 | |
Sam Lin | 90e258b | 2017-04-03 20:57:45 -0700 | [diff] [blame] | 1846 | /** {@hide} */ |
| 1847 | @SdkConstant(SdkConstantType.FEATURE) |
| 1848 | public static final String FEATURE_CTS = "android.software.cts"; |
| 1849 | |
Alex Ray | 0c9d61f | 2013-10-03 12:17:54 -0700 | [diff] [blame] | 1850 | /** |
| 1851 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1852 | * {@link #hasSystemFeature}: The device supports one or more methods of |
| 1853 | * reporting current location. |
| 1854 | */ |
| 1855 | @SdkConstant(SdkConstantType.FEATURE) |
| 1856 | public static final String FEATURE_LOCATION = "android.hardware.location"; |
| 1857 | |
| 1858 | /** |
| 1859 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1860 | * {@link #hasSystemFeature}: The device has a Global Positioning System |
| 1861 | * receiver and can report precise location. |
| 1862 | */ |
| 1863 | @SdkConstant(SdkConstantType.FEATURE) |
| 1864 | public static final String FEATURE_LOCATION_GPS = "android.hardware.location.gps"; |
| 1865 | |
| 1866 | /** |
| 1867 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1868 | * {@link #hasSystemFeature}: The device can report location with coarse |
| 1869 | * accuracy using a network-based geolocation system. |
| 1870 | */ |
| 1871 | @SdkConstant(SdkConstantType.FEATURE) |
| 1872 | public static final String FEATURE_LOCATION_NETWORK = "android.hardware.location.network"; |
| 1873 | |
| 1874 | /** |
| 1875 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | 2a103f1 | 2017-08-08 15:50:31 -0700 | [diff] [blame] | 1876 | * {@link #hasSystemFeature}: The device's |
| 1877 | * {@link ActivityManager#isLowRamDevice() ActivityManager.isLowRamDevice()} method returns |
| 1878 | * true. |
| 1879 | */ |
| 1880 | @SdkConstant(SdkConstantType.FEATURE) |
| 1881 | public static final String FEATURE_RAM_LOW = "android.hardware.ram.low"; |
| 1882 | |
| 1883 | /** |
| 1884 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1885 | * {@link #hasSystemFeature}: The device's |
| 1886 | * {@link ActivityManager#isLowRamDevice() ActivityManager.isLowRamDevice()} method returns |
| 1887 | * false. |
| 1888 | */ |
| 1889 | @SdkConstant(SdkConstantType.FEATURE) |
| 1890 | public static final String FEATURE_RAM_NORMAL = "android.hardware.ram.normal"; |
| 1891 | |
| 1892 | /** |
| 1893 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 1894 | * {@link #hasSystemFeature}: The device can record audio via a |
| 1895 | * microphone. |
| 1896 | */ |
| 1897 | @SdkConstant(SdkConstantType.FEATURE) |
| 1898 | public static final String FEATURE_MICROPHONE = "android.hardware.microphone"; |
| 1899 | |
| 1900 | /** |
| 1901 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 76437d3 | 2010-09-01 11:17:20 -0700 | [diff] [blame] | 1902 | * {@link #hasSystemFeature}: The device can communicate using Near-Field |
| 1903 | * Communications (NFC). |
| 1904 | */ |
| 1905 | @SdkConstant(SdkConstantType.FEATURE) |
| 1906 | public static final String FEATURE_NFC = "android.hardware.nfc"; |
| 1907 | |
| 1908 | /** |
| 1909 | * Feature for {@link #getSystemAvailableFeatures} and |
Martijn Coenen | f4bf158 | 2013-07-22 12:01:19 -0700 | [diff] [blame] | 1910 | * {@link #hasSystemFeature}: The device supports host- |
| 1911 | * based NFC card emulation. |
Martijn Coenen | df4d1d6 | 2013-08-28 11:18:58 -0700 | [diff] [blame] | 1912 | * |
| 1913 | * TODO remove when depending apps have moved to new constant. |
| 1914 | * @hide |
| 1915 | * @deprecated |
Martijn Coenen | f4bf158 | 2013-07-22 12:01:19 -0700 | [diff] [blame] | 1916 | */ |
Jose Lima | 970417c | 2014-04-10 10:42:19 -0700 | [diff] [blame] | 1917 | @Deprecated |
Martijn Coenen | f4bf158 | 2013-07-22 12:01:19 -0700 | [diff] [blame] | 1918 | @SdkConstant(SdkConstantType.FEATURE) |
| 1919 | public static final String FEATURE_NFC_HCE = "android.hardware.nfc.hce"; |
| 1920 | |
| 1921 | /** |
| 1922 | * Feature for {@link #getSystemAvailableFeatures} and |
Martijn Coenen | df4d1d6 | 2013-08-28 11:18:58 -0700 | [diff] [blame] | 1923 | * {@link #hasSystemFeature}: The device supports host- |
| 1924 | * based NFC card emulation. |
| 1925 | */ |
| 1926 | @SdkConstant(SdkConstantType.FEATURE) |
| 1927 | public static final String FEATURE_NFC_HOST_CARD_EMULATION = "android.hardware.nfc.hce"; |
| 1928 | |
| 1929 | /** |
| 1930 | * Feature for {@link #getSystemAvailableFeatures} and |
Yoshinobu Ito | c52adfe | 2016-01-22 18:14:18 +0900 | [diff] [blame] | 1931 | * {@link #hasSystemFeature}: The device supports host- |
| 1932 | * based NFC-F card emulation. |
| 1933 | */ |
| 1934 | @SdkConstant(SdkConstantType.FEATURE) |
| 1935 | public static final String FEATURE_NFC_HOST_CARD_EMULATION_NFCF = "android.hardware.nfc.hcef"; |
| 1936 | |
| 1937 | /** |
| 1938 | * Feature for {@link #getSystemAvailableFeatures} and |
Ruchi Kandoi | ebf267a | 2018-10-16 17:29:16 -0700 | [diff] [blame] | 1939 | * {@link #hasSystemFeature}: The device supports uicc- |
| 1940 | * based NFC card emulation. |
| 1941 | */ |
| 1942 | @SdkConstant(SdkConstantType.FEATURE) |
| 1943 | public static final String FEATURE_NFC_OFF_HOST_CARD_EMULATION_UICC = |
| 1944 | "android.hardware.nfc.uicc"; |
| 1945 | |
| 1946 | /** |
| 1947 | * Feature for {@link #getSystemAvailableFeatures} and |
| 1948 | * {@link #hasSystemFeature}: The device supports eSE- |
| 1949 | * based NFC card emulation. |
| 1950 | */ |
| 1951 | @SdkConstant(SdkConstantType.FEATURE) |
| 1952 | public static final String FEATURE_NFC_OFF_HOST_CARD_EMULATION_ESE = "android.hardware.nfc.ese"; |
| 1953 | |
| 1954 | /** |
| 1955 | * Feature for {@link #getSystemAvailableFeatures} and |
Ruchi Kandoi | 96fe50b | 2018-10-23 14:40:29 -0700 | [diff] [blame] | 1956 | * {@link #hasSystemFeature}: The Beam API is enabled on the device. |
| 1957 | */ |
| 1958 | @SdkConstant(SdkConstantType.FEATURE) |
| 1959 | public static final String FEATURE_NFC_BEAM = "android.sofware.nfc.beam"; |
| 1960 | |
| 1961 | /** |
| 1962 | * Feature for {@link #getSystemAvailableFeatures} and |
Martijn Coenen | 441d61b | 2017-04-12 13:52:40 -0700 | [diff] [blame] | 1963 | * {@link #hasSystemFeature}: The device supports any |
| 1964 | * one of the {@link #FEATURE_NFC}, {@link #FEATURE_NFC_HOST_CARD_EMULATION}, |
| 1965 | * or {@link #FEATURE_NFC_HOST_CARD_EMULATION_NFCF} features. |
| 1966 | * |
| 1967 | * @hide |
| 1968 | */ |
| 1969 | @SdkConstant(SdkConstantType.FEATURE) |
| 1970 | public static final String FEATURE_NFC_ANY = "android.hardware.nfc.any"; |
| 1971 | |
| 1972 | /** |
| 1973 | * Feature for {@link #getSystemAvailableFeatures} and |
Jesse Hall | 7f51706 | 2014-07-18 11:54:41 -0700 | [diff] [blame] | 1974 | * {@link #hasSystemFeature}: The device supports the OpenGL ES |
| 1975 | * <a href="http://www.khronos.org/registry/gles/extensions/ANDROID/ANDROID_extension_pack_es31a.txt"> |
| 1976 | * Android Extension Pack</a>. |
| 1977 | */ |
| 1978 | @SdkConstant(SdkConstantType.FEATURE) |
| 1979 | public static final String FEATURE_OPENGLES_EXTENSION_PACK = "android.hardware.opengles.aep"; |
| 1980 | |
| 1981 | /** |
| 1982 | * Feature for {@link #getSystemAvailableFeatures} and |
Jesse Hall | 39ceeb5 | 2016-03-10 09:04:26 -0800 | [diff] [blame] | 1983 | * {@link #hasSystemFeature(String, int)}: If this feature is supported, the Vulkan native API |
| 1984 | * will enumerate at least one {@code VkPhysicalDevice}, and the feature version will indicate |
| 1985 | * what level of optional hardware features limits it supports. |
Jesse Hall | f77a34f | 2016-02-04 18:41:33 -0800 | [diff] [blame] | 1986 | * <p> |
| 1987 | * Level 0 includes the base Vulkan requirements as well as: |
| 1988 | * <ul><li>{@code VkPhysicalDeviceFeatures::textureCompressionETC2}</li></ul> |
| 1989 | * <p> |
| 1990 | * Level 1 additionally includes: |
| 1991 | * <ul> |
| 1992 | * <li>{@code VkPhysicalDeviceFeatures::fullDrawIndexUint32}</li> |
| 1993 | * <li>{@code VkPhysicalDeviceFeatures::imageCubeArray}</li> |
| 1994 | * <li>{@code VkPhysicalDeviceFeatures::independentBlend}</li> |
| 1995 | * <li>{@code VkPhysicalDeviceFeatures::geometryShader}</li> |
| 1996 | * <li>{@code VkPhysicalDeviceFeatures::tessellationShader}</li> |
| 1997 | * <li>{@code VkPhysicalDeviceFeatures::sampleRateShading}</li> |
| 1998 | * <li>{@code VkPhysicalDeviceFeatures::textureCompressionASTC_LDR}</li> |
| 1999 | * <li>{@code VkPhysicalDeviceFeatures::fragmentStoresAndAtomics}</li> |
| 2000 | * <li>{@code VkPhysicalDeviceFeatures::shaderImageGatherExtended}</li> |
| 2001 | * <li>{@code VkPhysicalDeviceFeatures::shaderUniformBufferArrayDynamicIndexing}</li> |
| 2002 | * <li>{@code VkPhysicalDeviceFeatures::shaderSampledImageArrayDynamicIndexing}</li> |
| 2003 | * </ul> |
| 2004 | */ |
| 2005 | @SdkConstant(SdkConstantType.FEATURE) |
| 2006 | public static final String FEATURE_VULKAN_HARDWARE_LEVEL = "android.hardware.vulkan.level"; |
| 2007 | |
| 2008 | /** |
| 2009 | * Feature for {@link #getSystemAvailableFeatures} and |
Jesse Hall | 1cd7e93 | 2017-02-05 19:58:15 -0800 | [diff] [blame] | 2010 | * {@link #hasSystemFeature(String, int)}: If this feature is supported, the Vulkan native API |
| 2011 | * 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] | 2012 | * what level of optional compute features that device supports beyond the Vulkan 1.0 |
| 2013 | * requirements. |
Jesse Hall | 1cd7e93 | 2017-02-05 19:58:15 -0800 | [diff] [blame] | 2014 | * <p> |
Jesse Hall | 54fc609 | 2017-08-22 07:19:56 -0700 | [diff] [blame] | 2015 | * Compute level 0 indicates: |
| 2016 | * <ul> |
| 2017 | * <li>The {@code VK_KHR_variable_pointers} extension and |
| 2018 | * {@code VkPhysicalDeviceVariablePointerFeaturesKHR::variablePointers} feature are |
| 2019 | supported.</li> |
| 2020 | * <li>{@code VkPhysicalDeviceLimits::maxPerStageDescriptorStorageBuffers} is at least 16.</li> |
| 2021 | * </ul> |
Jesse Hall | 1cd7e93 | 2017-02-05 19:58:15 -0800 | [diff] [blame] | 2022 | */ |
| 2023 | @SdkConstant(SdkConstantType.FEATURE) |
| 2024 | public static final String FEATURE_VULKAN_HARDWARE_COMPUTE = "android.hardware.vulkan.compute"; |
| 2025 | |
| 2026 | /** |
| 2027 | * Feature for {@link #getSystemAvailableFeatures} and |
Jesse Hall | 39ceeb5 | 2016-03-10 09:04:26 -0800 | [diff] [blame] | 2028 | * {@link #hasSystemFeature(String, int)}: The version of this feature indicates the highest |
Jesse Hall | f77a34f | 2016-02-04 18:41:33 -0800 | [diff] [blame] | 2029 | * {@code VkPhysicalDeviceProperties::apiVersion} supported by the physical devices that support |
| 2030 | * the hardware level indicated by {@link #FEATURE_VULKAN_HARDWARE_LEVEL}. The feature version |
| 2031 | * uses the same encoding as Vulkan version numbers: |
| 2032 | * <ul> |
| 2033 | * <li>Major version number in bits 31-22</li> |
| 2034 | * <li>Minor version number in bits 21-12</li> |
| 2035 | * <li>Patch version number in bits 11-0</li> |
| 2036 | * </ul> |
Jesse Hall | 239373f | 2018-01-26 11:35:10 +0800 | [diff] [blame] | 2037 | * A version of 1.1.0 or higher also indicates: |
| 2038 | * <ul> |
Yiwei Zhang | 58f9c48 | 2018-07-31 17:55:43 -0700 | [diff] [blame] | 2039 | * <li>The {@code VK_ANDROID_external_memory_android_hardware_buffer} extension is |
| 2040 | * supported.</li> |
Jesse Hall | 239373f | 2018-01-26 11:35:10 +0800 | [diff] [blame] | 2041 | * <li>{@code SYNC_FD} external semaphore and fence handles are supported.</li> |
| 2042 | * <li>{@code VkPhysicalDeviceSamplerYcbcrConversionFeatures::samplerYcbcrConversion} is |
| 2043 | * supported.</li> |
| 2044 | * </ul> |
Jesse Hall | f77a34f | 2016-02-04 18:41:33 -0800 | [diff] [blame] | 2045 | */ |
| 2046 | @SdkConstant(SdkConstantType.FEATURE) |
| 2047 | public static final String FEATURE_VULKAN_HARDWARE_VERSION = "android.hardware.vulkan.version"; |
| 2048 | |
| 2049 | /** |
Tomasz Wasilczyk | 05392d6 | 2017-07-10 19:33:22 -0700 | [diff] [blame] | 2050 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2051 | * {@link #hasSystemFeature}: The device includes broadcast radio tuner. |
| 2052 | * @hide |
Tomasz Wasilczyk | 347192e | 2017-04-04 11:13:44 -0700 | [diff] [blame] | 2053 | */ |
Tomasz Wasilczyk | 05392d6 | 2017-07-10 19:33:22 -0700 | [diff] [blame] | 2054 | @SystemApi |
Tomasz Wasilczyk | 347192e | 2017-04-04 11:13:44 -0700 | [diff] [blame] | 2055 | @SdkConstant(SdkConstantType.FEATURE) |
Tomasz Wasilczyk | 05392d6 | 2017-07-10 19:33:22 -0700 | [diff] [blame] | 2056 | public static final String FEATURE_BROADCAST_RADIO = "android.hardware.broadcastradio"; |
Tomasz Wasilczyk | 347192e | 2017-04-04 11:13:44 -0700 | [diff] [blame] | 2057 | |
| 2058 | /** |
Jesse Hall | f77a34f | 2016-02-04 18:41:33 -0800 | [diff] [blame] | 2059 | * Feature for {@link #getSystemAvailableFeatures} and |
Lenka Trochtova | 66c492a | 2018-12-06 11:29:21 +0100 | [diff] [blame] | 2060 | * {@link #hasSystemFeature}: The device has a secure implementation of keyguard, meaning the |
| 2061 | * device supports PIN, pattern and password as defined in Android CDD |
| 2062 | */ |
| 2063 | @SdkConstant(SdkConstantType.FEATURE) |
| 2064 | public static final String FEATURE_SECURE_LOCK_SCREEN = "android.software.secure_lock_screen"; |
| 2065 | |
| 2066 | /** |
| 2067 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 5744bb4 | 2010-09-01 19:18:57 -0700 | [diff] [blame] | 2068 | * {@link #hasSystemFeature}: The device includes an accelerometer. |
| 2069 | */ |
| 2070 | @SdkConstant(SdkConstantType.FEATURE) |
| 2071 | public static final String FEATURE_SENSOR_ACCELEROMETER = "android.hardware.sensor.accelerometer"; |
| 2072 | |
| 2073 | /** |
| 2074 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2075 | * {@link #hasSystemFeature}: The device includes a barometer (air |
| 2076 | * pressure sensor.) |
| 2077 | */ |
| 2078 | @SdkConstant(SdkConstantType.FEATURE) |
| 2079 | public static final String FEATURE_SENSOR_BAROMETER = "android.hardware.sensor.barometer"; |
| 2080 | |
| 2081 | /** |
| 2082 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 2083 | * {@link #hasSystemFeature}: The device includes a magnetometer (compass). |
| 2084 | */ |
| 2085 | @SdkConstant(SdkConstantType.FEATURE) |
| 2086 | public static final String FEATURE_SENSOR_COMPASS = "android.hardware.sensor.compass"; |
| 2087 | |
| 2088 | /** |
| 2089 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 5744bb4 | 2010-09-01 19:18:57 -0700 | [diff] [blame] | 2090 | * {@link #hasSystemFeature}: The device includes a gyroscope. |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 2091 | */ |
| 2092 | @SdkConstant(SdkConstantType.FEATURE) |
Dan Morrill | 5744bb4 | 2010-09-01 19:18:57 -0700 | [diff] [blame] | 2093 | public static final String FEATURE_SENSOR_GYROSCOPE = "android.hardware.sensor.gyroscope"; |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 2094 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2095 | /** |
| 2096 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2097 | * {@link #hasSystemFeature}: The device includes a light sensor. |
| 2098 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 2099 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2100 | public static final String FEATURE_SENSOR_LIGHT = "android.hardware.sensor.light"; |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 2101 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2102 | /** |
| 2103 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2104 | * {@link #hasSystemFeature}: The device includes a proximity sensor. |
| 2105 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 2106 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2107 | public static final String FEATURE_SENSOR_PROXIMITY = "android.hardware.sensor.proximity"; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2108 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2109 | /** |
| 2110 | * Feature for {@link #getSystemAvailableFeatures} and |
Aravind Akella | 068b0c0 | 2013-10-12 17:39:15 -0700 | [diff] [blame] | 2111 | * {@link #hasSystemFeature}: The device includes a hardware step counter. |
| 2112 | */ |
| 2113 | @SdkConstant(SdkConstantType.FEATURE) |
| 2114 | public static final String FEATURE_SENSOR_STEP_COUNTER = "android.hardware.sensor.stepcounter"; |
| 2115 | |
| 2116 | /** |
| 2117 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2118 | * {@link #hasSystemFeature}: The device includes a hardware step detector. |
| 2119 | */ |
| 2120 | @SdkConstant(SdkConstantType.FEATURE) |
| 2121 | public static final String FEATURE_SENSOR_STEP_DETECTOR = "android.hardware.sensor.stepdetector"; |
| 2122 | |
| 2123 | /** |
| 2124 | * Feature for {@link #getSystemAvailableFeatures} and |
Vinod Krishnan | 8afb23c | 2014-04-30 11:11:39 -0700 | [diff] [blame] | 2125 | * {@link #hasSystemFeature}: The device includes a heart rate monitor. |
| 2126 | */ |
| 2127 | @SdkConstant(SdkConstantType.FEATURE) |
| 2128 | public static final String FEATURE_SENSOR_HEART_RATE = "android.hardware.sensor.heartrate"; |
| 2129 | |
| 2130 | /** |
| 2131 | * Feature for {@link #getSystemAvailableFeatures} and |
Trevor Johns | 682c24e | 2016-04-12 10:13:47 -0700 | [diff] [blame] | 2132 | * {@link #hasSystemFeature}: The heart rate sensor on this device is an Electrocardiogram. |
Vinod Krishnan | 1ab7689 | 2014-08-20 11:11:55 -0700 | [diff] [blame] | 2133 | */ |
| 2134 | @SdkConstant(SdkConstantType.FEATURE) |
| 2135 | public static final String FEATURE_SENSOR_HEART_RATE_ECG = |
| 2136 | "android.hardware.sensor.heartrate.ecg"; |
| 2137 | |
| 2138 | /** |
| 2139 | * Feature for {@link #getSystemAvailableFeatures} and |
Aravind Akella | 8b8e74b | 2014-07-09 11:52:39 -0700 | [diff] [blame] | 2140 | * {@link #hasSystemFeature}: The device includes a relative humidity sensor. |
| 2141 | */ |
| 2142 | @SdkConstant(SdkConstantType.FEATURE) |
| 2143 | public static final String FEATURE_SENSOR_RELATIVE_HUMIDITY = |
| 2144 | "android.hardware.sensor.relative_humidity"; |
| 2145 | |
| 2146 | /** |
| 2147 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2148 | * {@link #hasSystemFeature}: The device includes an ambient temperature sensor. |
| 2149 | */ |
| 2150 | @SdkConstant(SdkConstantType.FEATURE) |
| 2151 | public static final String FEATURE_SENSOR_AMBIENT_TEMPERATURE = |
| 2152 | "android.hardware.sensor.ambient_temperature"; |
| 2153 | |
| 2154 | /** |
| 2155 | * Feature for {@link #getSystemAvailableFeatures} and |
Ashutosh Joshi | eae371b | 2015-04-09 10:30:07 -0700 | [diff] [blame] | 2156 | * {@link #hasSystemFeature}: The device supports high fidelity sensor processing |
| 2157 | * capabilities. |
| 2158 | */ |
| 2159 | @SdkConstant(SdkConstantType.FEATURE) |
| 2160 | public static final String FEATURE_HIFI_SENSORS = |
| 2161 | "android.hardware.sensor.hifi_sensors"; |
| 2162 | |
| 2163 | /** |
Philip Quinn | b6bd301 | 2018-02-09 17:56:40 -0800 | [diff] [blame] | 2164 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
| 2165 | * The device supports a hardware mechanism for invoking an assist gesture. |
| 2166 | * @see android.provider.Settings.Secure#ASSIST_GESTURE_ENABLED |
| 2167 | * @hide |
| 2168 | */ |
| 2169 | @SdkConstant(SdkConstantType.FEATURE) |
| 2170 | public static final String FEATURE_ASSIST_GESTURE = "android.hardware.sensor.assist"; |
| 2171 | |
| 2172 | /** |
Ashutosh Joshi | eae371b | 2015-04-09 10:30:07 -0700 | [diff] [blame] | 2173 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2174 | * {@link #hasSystemFeature}: The device has a telephony radio with data |
| 2175 | * communication support. |
| 2176 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 2177 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2178 | public static final String FEATURE_TELEPHONY = "android.hardware.telephony"; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2179 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2180 | /** |
| 2181 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2182 | * {@link #hasSystemFeature}: The device has a CDMA telephony stack. |
| 2183 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 2184 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2185 | public static final String FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma"; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2186 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2187 | /** |
| 2188 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2189 | * {@link #hasSystemFeature}: The device has a GSM telephony stack. |
| 2190 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 2191 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2192 | public static final String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm"; |
Hung-ying Tyan | 3424c02 | 2010-08-27 18:08:19 +0800 | [diff] [blame] | 2193 | |
| 2194 | /** |
Polina Bondarenko | 80909ce | 2017-01-12 21:10:38 +0100 | [diff] [blame] | 2195 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
| 2196 | * The device supports telephony carrier restriction mechanism. |
| 2197 | * |
| 2198 | * <p>Devices declaring this feature must have an implementation of the |
| 2199 | * {@link android.telephony.TelephonyManager#getAllowedCarriers} and |
| 2200 | * {@link android.telephony.TelephonyManager#setAllowedCarriers}. |
| 2201 | * @hide |
| 2202 | */ |
| 2203 | @SystemApi |
| 2204 | @SdkConstant(SdkConstantType.FEATURE) |
| 2205 | public static final String FEATURE_TELEPHONY_CARRIERLOCK = |
| 2206 | "android.hardware.telephony.carrierlock"; |
| 2207 | |
| 2208 | /** |
Jeff Davidson | 35cda39 | 2017-02-27 09:46:00 -0800 | [diff] [blame] | 2209 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device |
| 2210 | * supports embedded subscriptions on eUICCs. |
Jeff Davidson | 35cda39 | 2017-02-27 09:46:00 -0800 | [diff] [blame] | 2211 | */ |
| 2212 | @SdkConstant(SdkConstantType.FEATURE) |
| 2213 | public static final String FEATURE_TELEPHONY_EUICC = "android.hardware.telephony.euicc"; |
| 2214 | |
| 2215 | /** |
Hall Liu | c6703d9 | 2017-11-17 11:31:57 -0800 | [diff] [blame] | 2216 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device |
| 2217 | * supports cell-broadcast reception using the MBMS APIs. |
| 2218 | */ |
| 2219 | @SdkConstant(SdkConstantType.FEATURE) |
| 2220 | public static final String FEATURE_TELEPHONY_MBMS = "android.hardware.telephony.mbms"; |
| 2221 | |
| 2222 | /** |
Brad Ebinger | 4e65f80 | 2019-01-23 15:01:54 -0800 | [diff] [blame] | 2223 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device |
| 2224 | * supports attaching to IMS implementations using the ImsService API in telephony. |
| 2225 | */ |
| 2226 | @SdkConstant(SdkConstantType.FEATURE) |
| 2227 | public static final String FEATURE_TELEPHONY_IMS = "android.hardware.telephony.ims"; |
| 2228 | |
| 2229 | /** |
Hung-ying Tyan | 3424c02 | 2010-08-27 18:08:19 +0800 | [diff] [blame] | 2230 | * Feature for {@link #getSystemAvailableFeatures} and |
Mike Lockwood | f4ca247 | 2011-02-27 11:23:25 -0800 | [diff] [blame] | 2231 | * {@link #hasSystemFeature}: The device supports connecting to USB devices |
| 2232 | * as the USB host. |
| 2233 | */ |
| 2234 | @SdkConstant(SdkConstantType.FEATURE) |
| 2235 | public static final String FEATURE_USB_HOST = "android.hardware.usb.host"; |
| 2236 | |
| 2237 | /** |
| 2238 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2239 | * {@link #hasSystemFeature}: The device supports connecting to USB accessories. |
| 2240 | */ |
| 2241 | @SdkConstant(SdkConstantType.FEATURE) |
| 2242 | public static final String FEATURE_USB_ACCESSORY = "android.hardware.usb.accessory"; |
| 2243 | |
| 2244 | /** |
| 2245 | * Feature for {@link #getSystemAvailableFeatures} and |
Hung-ying Tyan | 3424c02 | 2010-08-27 18:08:19 +0800 | [diff] [blame] | 2246 | * {@link #hasSystemFeature}: The SIP API is enabled on the device. |
| 2247 | */ |
| 2248 | @SdkConstant(SdkConstantType.FEATURE) |
| 2249 | public static final String FEATURE_SIP = "android.software.sip"; |
| 2250 | |
| 2251 | /** |
| 2252 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2253 | * {@link #hasSystemFeature}: The device supports SIP-based VOIP. |
| 2254 | */ |
| 2255 | @SdkConstant(SdkConstantType.FEATURE) |
| 2256 | public static final String FEATURE_SIP_VOIP = "android.software.sip.voip"; |
| 2257 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2258 | /** |
| 2259 | * Feature for {@link #getSystemAvailableFeatures} and |
Ihab Awad | 1ec6888 | 2014-09-12 11:09:01 -0700 | [diff] [blame] | 2260 | * {@link #hasSystemFeature}: The Connection Service API is enabled on the device. |
| 2261 | */ |
| 2262 | @SdkConstant(SdkConstantType.FEATURE) |
| 2263 | public static final String FEATURE_CONNECTION_SERVICE = "android.software.connectionservice"; |
| 2264 | |
| 2265 | /** |
| 2266 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | b0fe033 | 2010-04-05 14:43:58 -0700 | [diff] [blame] | 2267 | * {@link #hasSystemFeature}: The device's display has a touch screen. |
| 2268 | */ |
| 2269 | @SdkConstant(SdkConstantType.FEATURE) |
| 2270 | public static final String FEATURE_TOUCHSCREEN = "android.hardware.touchscreen"; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2271 | |
Dan Morrill | b0fe033 | 2010-04-05 14:43:58 -0700 | [diff] [blame] | 2272 | /** |
| 2273 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 2274 | * {@link #hasSystemFeature}: The device's touch screen supports |
| 2275 | * multitouch sufficient for basic two-finger gesture detection. |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2276 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 2277 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2278 | public static final String FEATURE_TOUCHSCREEN_MULTITOUCH = "android.hardware.touchscreen.multitouch"; |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 2279 | |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2280 | /** |
| 2281 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 2282 | * {@link #hasSystemFeature}: The device's touch screen is capable of |
| 2283 | * tracking two or more fingers fully independently. |
| 2284 | */ |
| 2285 | @SdkConstant(SdkConstantType.FEATURE) |
| 2286 | public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT = "android.hardware.touchscreen.multitouch.distinct"; |
| 2287 | |
| 2288 | /** |
| 2289 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 6993d3d | 2010-09-03 14:30:14 -0700 | [diff] [blame] | 2290 | * {@link #hasSystemFeature}: The device's touch screen is capable of |
| 2291 | * tracking a full hand of fingers fully independently -- that is, 5 or |
| 2292 | * more simultaneous independent pointers. |
| 2293 | */ |
| 2294 | @SdkConstant(SdkConstantType.FEATURE) |
| 2295 | public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND = "android.hardware.touchscreen.multitouch.jazzhand"; |
| 2296 | |
| 2297 | /** |
| 2298 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | a537687 | 2011-01-23 13:15:53 -0800 | [diff] [blame] | 2299 | * {@link #hasSystemFeature}: The device does not have a touch screen, but |
| 2300 | * does support touch emulation for basic events. For instance, the |
| 2301 | * device might use a mouse or remote control to drive a cursor, and |
| 2302 | * emulate basic touch pointer events like down, up, drag, etc. All |
| 2303 | * devices that support android.hardware.touchscreen or a sub-feature are |
| 2304 | * presumed to also support faketouch. |
| 2305 | */ |
| 2306 | @SdkConstant(SdkConstantType.FEATURE) |
| 2307 | public static final String FEATURE_FAKETOUCH = "android.hardware.faketouch"; |
| 2308 | |
| 2309 | /** |
| 2310 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | e22fe93 | 2011-06-08 20:24:29 -0700 | [diff] [blame] | 2311 | * {@link #hasSystemFeature}: The device does not have a touch screen, but |
| 2312 | * does support touch emulation for basic events that supports distinct |
| 2313 | * tracking of two or more fingers. This is an extension of |
| 2314 | * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note |
| 2315 | * that unlike a distinct multitouch screen as defined by |
| 2316 | * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT}, these kinds of input |
| 2317 | * devices will not actually provide full two-finger gestures since the |
| 2318 | * input is being transformed to cursor movement on the screen. That is, |
| 2319 | * single finger gestures will move a cursor; two-finger swipes will |
| 2320 | * result in single-finger touch events; other two-finger gestures will |
| 2321 | * result in the corresponding two-finger touch event. |
| 2322 | */ |
| 2323 | @SdkConstant(SdkConstantType.FEATURE) |
| 2324 | public static final String FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT = "android.hardware.faketouch.multitouch.distinct"; |
| 2325 | |
| 2326 | /** |
| 2327 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2328 | * {@link #hasSystemFeature}: The device does not have a touch screen, but |
| 2329 | * does support touch emulation for basic events that supports tracking |
| 2330 | * a hand of fingers (5 or more fingers) fully independently. |
| 2331 | * This is an extension of |
| 2332 | * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note |
| 2333 | * that unlike a multitouch screen as defined by |
| 2334 | * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND}, not all two finger |
| 2335 | * gestures can be detected due to the limitations described for |
| 2336 | * {@link #FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT}. |
| 2337 | */ |
| 2338 | @SdkConstant(SdkConstantType.FEATURE) |
| 2339 | public static final String FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND = "android.hardware.faketouch.multitouch.jazzhand"; |
| 2340 | |
| 2341 | /** |
| 2342 | * Feature for {@link #getSystemAvailableFeatures} and |
Jim Miller | d9b9d41 | 2015-07-22 19:51:40 -0700 | [diff] [blame] | 2343 | * {@link #hasSystemFeature}: The device has biometric hardware to detect a fingerprint. |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 2344 | */ |
Jim Miller | d9b9d41 | 2015-07-22 19:51:40 -0700 | [diff] [blame] | 2345 | @SdkConstant(SdkConstantType.FEATURE) |
Kevin Chyn | 59c2da71 | 2019-01-22 10:35:56 -0800 | [diff] [blame] | 2346 | public static final String FEATURE_FINGERPRINT = "android.hardware.fingerprint"; |
Jim Miller | d9b9d41 | 2015-07-22 19:51:40 -0700 | [diff] [blame] | 2347 | |
| 2348 | /** |
| 2349 | * Feature for {@link #getSystemAvailableFeatures} and |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 2350 | * {@link #hasSystemFeature}: The device has biometric hardware to perform face authentication. |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 2351 | */ |
| 2352 | @SdkConstant(SdkConstantType.FEATURE) |
Kevin Chyn | 5c5603d | 2018-12-13 18:06:10 -0800 | [diff] [blame] | 2353 | public static final String FEATURE_FACE = "android.hardware.biometrics.face"; |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 2354 | |
| 2355 | /** |
| 2356 | * Feature for {@link #getSystemAvailableFeatures} and |
Kevin Chyn | a24e9fd | 2018-08-27 12:39:17 -0700 | [diff] [blame] | 2357 | * {@link #hasSystemFeature}: The device has biometric hardware to perform iris authentication. |
Kevin Chyn | a24e9fd | 2018-08-27 12:39:17 -0700 | [diff] [blame] | 2358 | */ |
| 2359 | @SdkConstant(SdkConstantType.FEATURE) |
Kevin Chyn | 5c5603d | 2018-12-13 18:06:10 -0800 | [diff] [blame] | 2360 | public static final String FEATURE_IRIS = "android.hardware.biometrics.iris"; |
Kevin Chyn | a24e9fd | 2018-08-27 12:39:17 -0700 | [diff] [blame] | 2361 | |
| 2362 | /** |
| 2363 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | e289bff | 2011-06-13 19:33:22 -0700 | [diff] [blame] | 2364 | * {@link #hasSystemFeature}: The device supports portrait orientation |
| 2365 | * screens. For backwards compatibility, you can assume that if neither |
| 2366 | * this nor {@link #FEATURE_SCREEN_LANDSCAPE} is set then the device supports |
| 2367 | * both portrait and landscape. |
| 2368 | */ |
| 2369 | @SdkConstant(SdkConstantType.FEATURE) |
| 2370 | public static final String FEATURE_SCREEN_PORTRAIT = "android.hardware.screen.portrait"; |
| 2371 | |
| 2372 | /** |
| 2373 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2374 | * {@link #hasSystemFeature}: The device supports landscape orientation |
| 2375 | * screens. For backwards compatibility, you can assume that if neither |
| 2376 | * this nor {@link #FEATURE_SCREEN_PORTRAIT} is set then the device supports |
| 2377 | * both portrait and landscape. |
| 2378 | */ |
| 2379 | @SdkConstant(SdkConstantType.FEATURE) |
| 2380 | public static final String FEATURE_SCREEN_LANDSCAPE = "android.hardware.screen.landscape"; |
| 2381 | |
| 2382 | /** |
| 2383 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2384 | * {@link #hasSystemFeature}: The device supports live wallpapers. |
| 2385 | */ |
Xavier Ducrohet | 3274b9b | 2009-12-14 17:52:20 -0800 | [diff] [blame] | 2386 | @SdkConstant(SdkConstantType.FEATURE) |
Dianne Hackborn | 08ee42c | 2009-11-19 17:08:01 -0800 | [diff] [blame] | 2387 | public static final String FEATURE_LIVE_WALLPAPER = "android.software.live_wallpaper"; |
Oscar Montemayor | 1228d0a | 2010-01-28 12:01:44 -0800 | [diff] [blame] | 2388 | /** |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 2389 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | 119bbc3 | 2013-03-22 17:27:25 -0700 | [diff] [blame] | 2390 | * {@link #hasSystemFeature}: The device supports app widgets. |
| 2391 | */ |
| 2392 | @SdkConstant(SdkConstantType.FEATURE) |
| 2393 | public static final String FEATURE_APP_WIDGETS = "android.software.app_widgets"; |
Dianne Hackborn | c8e4fad | 2018-05-04 11:31:09 -0700 | [diff] [blame] | 2394 | /** |
| 2395 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2396 | * {@link #hasSystemFeature}: The device supports the |
| 2397 | * {@link android.R.attr#cantSaveState} API. |
| 2398 | */ |
| 2399 | @SdkConstant(SdkConstantType.FEATURE) |
| 2400 | 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] | 2401 | |
| 2402 | /** |
Dianne Hackborn | 91097de | 2014-04-04 18:02:06 -0700 | [diff] [blame] | 2403 | * @hide |
| 2404 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2405 | * {@link #hasSystemFeature}: The device supports |
| 2406 | * {@link android.service.voice.VoiceInteractionService} and |
| 2407 | * {@link android.app.VoiceInteractor}. |
| 2408 | */ |
| 2409 | @SdkConstant(SdkConstantType.FEATURE) |
| 2410 | public static final String FEATURE_VOICE_RECOGNIZERS = "android.software.voice_recognizers"; |
| 2411 | |
| 2412 | |
| 2413 | /** |
Dianne Hackborn | 119bbc3 | 2013-03-22 17:27:25 -0700 | [diff] [blame] | 2414 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2415 | * {@link #hasSystemFeature}: The device supports a home screen that is replaceable |
| 2416 | * by third party applications. |
| 2417 | */ |
| 2418 | @SdkConstant(SdkConstantType.FEATURE) |
| 2419 | public static final String FEATURE_HOME_SCREEN = "android.software.home_screen"; |
| 2420 | |
| 2421 | /** |
| 2422 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2423 | * {@link #hasSystemFeature}: The device supports adding new input methods implemented |
| 2424 | * with the {@link android.inputmethodservice.InputMethodService} API. |
| 2425 | */ |
| 2426 | @SdkConstant(SdkConstantType.FEATURE) |
| 2427 | public static final String FEATURE_INPUT_METHODS = "android.software.input_methods"; |
| 2428 | |
| 2429 | /** |
| 2430 | * Feature for {@link #getSystemAvailableFeatures} and |
Amith Yamasani | 44a01b7 | 2013-09-16 10:44:57 -0700 | [diff] [blame] | 2431 | * {@link #hasSystemFeature}: The device supports device policy enforcement via device admins. |
| 2432 | */ |
| 2433 | @SdkConstant(SdkConstantType.FEATURE) |
| 2434 | public static final String FEATURE_DEVICE_ADMIN = "android.software.device_admin"; |
| 2435 | |
| 2436 | /** |
| 2437 | * Feature for {@link #getSystemAvailableFeatures} and |
Tim Kilbourn | f94b6a9 | 2014-03-07 15:13:48 -0800 | [diff] [blame] | 2438 | * {@link #hasSystemFeature}: The device supports leanback UI. This is |
| 2439 | * typically used in a living room television experience, but is a software |
| 2440 | * feature unlike {@link #FEATURE_TELEVISION}. Devices running with this |
| 2441 | * feature will use resources associated with the "television" UI mode. |
| 2442 | */ |
| 2443 | @SdkConstant(SdkConstantType.FEATURE) |
| 2444 | public static final String FEATURE_LEANBACK = "android.software.leanback"; |
| 2445 | |
| 2446 | /** |
| 2447 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2448 | * {@link #hasSystemFeature}: The device supports only leanback UI. Only |
| 2449 | * applications designed for this experience should be run, though this is |
| 2450 | * not enforced by the system. |
Tim Kilbourn | f94b6a9 | 2014-03-07 15:13:48 -0800 | [diff] [blame] | 2451 | */ |
| 2452 | @SdkConstant(SdkConstantType.FEATURE) |
| 2453 | public static final String FEATURE_LEANBACK_ONLY = "android.software.leanback_only"; |
| 2454 | |
| 2455 | /** |
| 2456 | * Feature for {@link #getSystemAvailableFeatures} and |
Jae Seo | cfd861e | 2014-08-27 14:02:15 -0700 | [diff] [blame] | 2457 | * {@link #hasSystemFeature}: The device supports live TV and can display |
| 2458 | * contents from TV inputs implemented with the |
| 2459 | * {@link android.media.tv.TvInputService} API. |
| 2460 | */ |
| 2461 | @SdkConstant(SdkConstantType.FEATURE) |
| 2462 | public static final String FEATURE_LIVE_TV = "android.software.live_tv"; |
| 2463 | |
| 2464 | /** |
| 2465 | * Feature for {@link #getSystemAvailableFeatures} and |
Dan Morrill | 50ab63f | 2010-03-05 16:16:19 -0800 | [diff] [blame] | 2466 | * {@link #hasSystemFeature}: The device supports WiFi (802.11) networking. |
| 2467 | */ |
| 2468 | @SdkConstant(SdkConstantType.FEATURE) |
| 2469 | public static final String FEATURE_WIFI = "android.hardware.wifi"; |
| 2470 | |
| 2471 | /** |
Irfan Sheriff | 45b8b46 | 2011-09-07 11:24:16 -0700 | [diff] [blame] | 2472 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2473 | * {@link #hasSystemFeature}: The device supports Wi-Fi Direct networking. |
| 2474 | */ |
| 2475 | @SdkConstant(SdkConstantType.FEATURE) |
| 2476 | public static final String FEATURE_WIFI_DIRECT = "android.hardware.wifi.direct"; |
| 2477 | |
| 2478 | /** |
Dianne Hackborn | 0cf2c8a | 2012-05-17 17:29:49 -0700 | [diff] [blame] | 2479 | * Feature for {@link #getSystemAvailableFeatures} and |
Etan Cohen | 0413327 | 2016-10-26 11:22:06 -0700 | [diff] [blame] | 2480 | * {@link #hasSystemFeature}: The device supports Wi-Fi Aware. |
Etan Cohen | 20d329b | 2015-09-29 13:49:02 -0700 | [diff] [blame] | 2481 | */ |
| 2482 | @SdkConstant(SdkConstantType.FEATURE) |
Etan Cohen | 0413327 | 2016-10-26 11:22:06 -0700 | [diff] [blame] | 2483 | public static final String FEATURE_WIFI_AWARE = "android.hardware.wifi.aware"; |
Etan Cohen | 20d329b | 2015-09-29 13:49:02 -0700 | [diff] [blame] | 2484 | |
| 2485 | /** |
| 2486 | * Feature for {@link #getSystemAvailableFeatures} and |
Peter Qiu | 3d615e4 | 2017-08-07 20:13:32 +0000 | [diff] [blame] | 2487 | * {@link #hasSystemFeature}: The device supports Wi-Fi Passpoint and all |
| 2488 | * Passpoint related APIs in {@link WifiManager} are supported. Refer to |
| 2489 | * {@link WifiManager#addOrUpdatePasspointConfiguration} for more info. |
Peter Qiu | b99fe31 | 2017-05-05 13:48:47 -0700 | [diff] [blame] | 2490 | */ |
| 2491 | @SdkConstant(SdkConstantType.FEATURE) |
| 2492 | public static final String FEATURE_WIFI_PASSPOINT = "android.hardware.wifi.passpoint"; |
| 2493 | |
| 2494 | /** |
| 2495 | * Feature for {@link #getSystemAvailableFeatures} and |
Etan Cohen | 692e68e | 2017-09-14 15:42:01 -0700 | [diff] [blame] | 2496 | * {@link #hasSystemFeature}: The device supports Wi-Fi RTT (IEEE 802.11mc). |
Etan Cohen | 692e68e | 2017-09-14 15:42:01 -0700 | [diff] [blame] | 2497 | */ |
| 2498 | @SdkConstant(SdkConstantType.FEATURE) |
| 2499 | public static final String FEATURE_WIFI_RTT = "android.hardware.wifi.rtt"; |
| 2500 | |
| 2501 | |
| 2502 | /** |
| 2503 | * Feature for {@link #getSystemAvailableFeatures} and |
Robert Quattlebaum | 87a7104 | 2017-05-15 15:45:20 -0700 | [diff] [blame] | 2504 | * {@link #hasSystemFeature}: The device supports LoWPAN networking. |
| 2505 | * @hide |
| 2506 | */ |
| 2507 | @SdkConstant(SdkConstantType.FEATURE) |
| 2508 | public static final String FEATURE_LOWPAN = "android.hardware.lowpan"; |
| 2509 | |
| 2510 | /** |
| 2511 | * Feature for {@link #getSystemAvailableFeatures} and |
Dianne Hackborn | 0cf2c8a | 2012-05-17 17:29:49 -0700 | [diff] [blame] | 2512 | * {@link #hasSystemFeature}: This is a device dedicated to showing UI |
Todd Kennedy | 7f95a00 | 2015-04-22 14:28:25 -0700 | [diff] [blame] | 2513 | * on a vehicle headunit. A headunit here is defined to be inside a |
| 2514 | * vehicle that may or may not be moving. A headunit uses either a |
| 2515 | * primary display in the center console and/or additional displays in |
| 2516 | * the instrument cluster or elsewhere in the vehicle. Headunit display(s) |
| 2517 | * have limited size and resolution. The user will likely be focused on |
| 2518 | * driving so limiting driver distraction is a primary concern. User input |
| 2519 | * can be a variety of hard buttons, touch, rotary controllers and even mouse- |
| 2520 | * like interfaces. |
| 2521 | */ |
| 2522 | @SdkConstant(SdkConstantType.FEATURE) |
| 2523 | public static final String FEATURE_AUTOMOTIVE = "android.hardware.type.automotive"; |
| 2524 | |
| 2525 | /** |
| 2526 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2527 | * {@link #hasSystemFeature}: This is a device dedicated to showing UI |
Dianne Hackborn | 0cf2c8a | 2012-05-17 17:29:49 -0700 | [diff] [blame] | 2528 | * on a television. Television here is defined to be a typical living |
| 2529 | * room television experience: displayed on a big screen, where the user |
| 2530 | * is sitting far away from it, and the dominant form of input will be |
| 2531 | * something like a DPAD, not through touch or mouse. |
Tim Kilbourn | f94b6a9 | 2014-03-07 15:13:48 -0800 | [diff] [blame] | 2532 | * @deprecated use {@link #FEATURE_LEANBACK} instead. |
Dianne Hackborn | 0cf2c8a | 2012-05-17 17:29:49 -0700 | [diff] [blame] | 2533 | */ |
Jose Lima | 970417c | 2014-04-10 10:42:19 -0700 | [diff] [blame] | 2534 | @Deprecated |
Dianne Hackborn | 0cf2c8a | 2012-05-17 17:29:49 -0700 | [diff] [blame] | 2535 | @SdkConstant(SdkConstantType.FEATURE) |
| 2536 | public static final String FEATURE_TELEVISION = "android.hardware.type.television"; |
| 2537 | |
| 2538 | /** |
Justin Koh | b5731f091c | 2014-02-13 16:06:59 -0800 | [diff] [blame] | 2539 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2540 | * {@link #hasSystemFeature}: This is a device dedicated to showing UI |
| 2541 | * on a watch. A watch here is defined to be a device worn on the body, perhaps on |
| 2542 | * the wrist. The user is very close when interacting with the device. |
| 2543 | */ |
| 2544 | @SdkConstant(SdkConstantType.FEATURE) |
| 2545 | public static final String FEATURE_WATCH = "android.hardware.type.watch"; |
| 2546 | |
| 2547 | /** |
Ralph Nathan | b8e0dee | 2017-01-24 15:24:59 -0800 | [diff] [blame] | 2548 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2549 | * {@link #hasSystemFeature}: This is a device for IoT and may not have an UI. An embedded |
| 2550 | * device is defined as a full stack Android device with or without a display and no |
| 2551 | * user-installable apps. |
| 2552 | */ |
| 2553 | @SdkConstant(SdkConstantType.FEATURE) |
| 2554 | public static final String FEATURE_EMBEDDED = "android.hardware.type.embedded"; |
| 2555 | |
| 2556 | /** |
Dennis Kempin | 7345ed5 | 2017-04-14 16:40:56 -0700 | [diff] [blame] | 2557 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2558 | * {@link #hasSystemFeature}: This is a device dedicated to be primarily used |
| 2559 | * with keyboard, mouse or touchpad. This includes traditional desktop |
| 2560 | * computers, laptops and variants such as convertibles or detachables. |
| 2561 | * Due to the larger screen, the device will most likely use the |
| 2562 | * {@link #FEATURE_FREEFORM_WINDOW_MANAGEMENT} feature as well. |
| 2563 | */ |
| 2564 | @SdkConstant(SdkConstantType.FEATURE) |
| 2565 | public static final String FEATURE_PC = "android.hardware.type.pc"; |
| 2566 | |
| 2567 | /** |
Sam Lin | 821f43a | 2019-02-13 19:15:32 -0800 | [diff] [blame] | 2568 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2569 | * {@link #hasSystemFeature}: This is a foldable device. Properties such as |
| 2570 | * the display size may change in response to being folded. |
| 2571 | */ |
| 2572 | @SdkConstant(SdkConstantType.FEATURE) |
| 2573 | public static final String FEATURE_FOLDABLE = "android.hardware.type.foldable"; |
| 2574 | |
| 2575 | /** |
Adam Lesinski | 3d9bcb9 | 2014-02-18 14:05:14 -0800 | [diff] [blame] | 2576 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
| 2577 | * The device supports printing. |
| 2578 | */ |
| 2579 | @SdkConstant(SdkConstantType.FEATURE) |
| 2580 | public static final String FEATURE_PRINTING = "android.software.print"; |
| 2581 | |
| 2582 | /** |
| 2583 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Eugene Susla | 7c3eef2 | 2017-03-10 14:25:58 -0800 | [diff] [blame] | 2584 | * The device supports {@link android.companion.CompanionDeviceManager#associate associating} |
| 2585 | * with devices via {@link android.companion.CompanionDeviceManager}. |
| 2586 | */ |
| 2587 | @SdkConstant(SdkConstantType.FEATURE) |
| 2588 | public static final String FEATURE_COMPANION_DEVICE_SETUP |
| 2589 | = "android.software.companion_device_setup"; |
| 2590 | |
| 2591 | /** |
| 2592 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Adam Lesinski | 3d9bcb9 | 2014-02-18 14:05:14 -0800 | [diff] [blame] | 2593 | * The device can perform backup and restore operations on installed applications. |
| 2594 | */ |
| 2595 | @SdkConstant(SdkConstantType.FEATURE) |
| 2596 | public static final String FEATURE_BACKUP = "android.software.backup"; |
| 2597 | |
| 2598 | /** |
Vladislav Kaznacheev | d303b25 | 2015-10-27 17:30:58 -0700 | [diff] [blame] | 2599 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2600 | * {@link #hasSystemFeature}: The device supports freeform window management. |
| 2601 | * Windows have title bars and can be moved and resized. |
| 2602 | */ |
Filip Gruszczynski | 811dc3b | 2015-11-23 12:34:22 -0800 | [diff] [blame] | 2603 | // If this feature is present, you also need to set |
| 2604 | // com.android.internal.R.config_freeformWindowManagement to true in your configuration overlay. |
Vladislav Kaznacheev | d303b25 | 2015-10-27 17:30:58 -0700 | [diff] [blame] | 2605 | @SdkConstant(SdkConstantType.FEATURE) |
| 2606 | public static final String FEATURE_FREEFORM_WINDOW_MANAGEMENT |
| 2607 | = "android.software.freeform_window_management"; |
| 2608 | |
| 2609 | /** |
Adam Connors | 23cc04e | 2014-04-01 12:12:20 +0100 | [diff] [blame] | 2610 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Wale Ogunwale | fbe12c4 | 2015-12-06 16:23:50 -0800 | [diff] [blame] | 2611 | * The device supports picture-in-picture multi-window mode. |
| 2612 | */ |
| 2613 | @SdkConstant(SdkConstantType.FEATURE) |
| 2614 | public static final String FEATURE_PICTURE_IN_PICTURE = "android.software.picture_in_picture"; |
| 2615 | |
| 2616 | /** |
| 2617 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Andrii Kulian | 1981f5f | 2017-04-07 16:23:12 -0700 | [diff] [blame] | 2618 | * The device supports running activities on secondary displays. |
| 2619 | */ |
| 2620 | @SdkConstant(SdkConstantType.FEATURE) |
| 2621 | public static final String FEATURE_ACTIVITIES_ON_SECONDARY_DISPLAYS |
| 2622 | = "android.software.activities_on_secondary_displays"; |
| 2623 | |
| 2624 | /** |
| 2625 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Amith Yamasani | 1d65327 | 2014-09-11 17:56:05 -0700 | [diff] [blame] | 2626 | * The device supports creating secondary users and managed profiles via |
| 2627 | * {@link DevicePolicyManager}. |
Adam Connors | 23cc04e | 2014-04-01 12:12:20 +0100 | [diff] [blame] | 2628 | */ |
| 2629 | @SdkConstant(SdkConstantType.FEATURE) |
Amith Yamasani | 1d65327 | 2014-09-11 17:56:05 -0700 | [diff] [blame] | 2630 | public static final String FEATURE_MANAGED_USERS = "android.software.managed_users"; |
| 2631 | |
| 2632 | /** |
| 2633 | * @hide |
| 2634 | * TODO: Remove after dependencies updated b/17392243 |
| 2635 | */ |
| 2636 | public static final String FEATURE_MANAGED_PROFILES = "android.software.managed_users"; |
Adam Connors | 23cc04e | 2014-04-01 12:12:20 +0100 | [diff] [blame] | 2637 | |
| 2638 | /** |
Ben Murdoch | f564c7f | 2014-05-20 18:58:06 +0100 | [diff] [blame] | 2639 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Adam Connors | 19ccb5f | 2014-09-08 17:31:50 +0100 | [diff] [blame] | 2640 | * The device supports verified boot. |
| 2641 | */ |
| 2642 | @SdkConstant(SdkConstantType.FEATURE) |
| 2643 | public static final String FEATURE_VERIFIED_BOOT = "android.software.verified_boot"; |
| 2644 | |
| 2645 | /** |
| 2646 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
| 2647 | * The device supports secure removal of users. When a user is deleted the data associated |
| 2648 | * with that user is securely deleted and no longer available. |
| 2649 | */ |
| 2650 | @SdkConstant(SdkConstantType.FEATURE) |
| 2651 | public static final String FEATURE_SECURELY_REMOVES_USERS |
| 2652 | = "android.software.securely_removes_users"; |
| 2653 | |
Jeff Sharkey | b92b05b | 2016-01-28 09:50:00 -0700 | [diff] [blame] | 2654 | /** {@hide} */ |
Jeff Sharkey | 8eb783b | 2018-01-04 16:46:48 -0700 | [diff] [blame] | 2655 | @TestApi |
Jeff Sharkey | b92b05b | 2016-01-28 09:50:00 -0700 | [diff] [blame] | 2656 | @SdkConstant(SdkConstantType.FEATURE) |
| 2657 | public static final String FEATURE_FILE_BASED_ENCRYPTION |
| 2658 | = "android.software.file_based_encryption"; |
| 2659 | |
Jeff Sharkey | 8eb783b | 2018-01-04 16:46:48 -0700 | [diff] [blame] | 2660 | /** {@hide} */ |
| 2661 | @TestApi |
| 2662 | @SdkConstant(SdkConstantType.FEATURE) |
| 2663 | public static final String FEATURE_ADOPTABLE_STORAGE |
| 2664 | = "android.software.adoptable_storage"; |
| 2665 | |
Adam Connors | 19ccb5f | 2014-09-08 17:31:50 +0100 | [diff] [blame] | 2666 | /** |
| 2667 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Ben Murdoch | 422c7a5 | 2014-05-16 13:45:47 +0100 | [diff] [blame] | 2668 | * The device has a full implementation of the android.webkit.* APIs. Devices |
| 2669 | * lacking this feature will not have a functioning WebView implementation. |
| 2670 | */ |
| 2671 | @SdkConstant(SdkConstantType.FEATURE) |
| 2672 | public static final String FEATURE_WEBVIEW = "android.software.webview"; |
| 2673 | |
| 2674 | /** |
Joe LaPenna | 4bb015d | 2014-07-04 17:15:54 -0700 | [diff] [blame] | 2675 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2676 | * {@link #hasSystemFeature}: This device supports ethernet. |
Joe LaPenna | 4bb015d | 2014-07-04 17:15:54 -0700 | [diff] [blame] | 2677 | */ |
| 2678 | @SdkConstant(SdkConstantType.FEATURE) |
| 2679 | public static final String FEATURE_ETHERNET = "android.hardware.ethernet"; |
| 2680 | |
| 2681 | /** |
Yuncheol Heo | a0c4a06 | 2014-07-10 20:49:27 +0900 | [diff] [blame] | 2682 | * Feature for {@link #getSystemAvailableFeatures} and |
| 2683 | * {@link #hasSystemFeature}: This device supports HDMI-CEC. |
| 2684 | * @hide |
| 2685 | */ |
| 2686 | @SdkConstant(SdkConstantType.FEATURE) |
| 2687 | public static final String FEATURE_HDMI_CEC = "android.hardware.hdmi.cec"; |
| 2688 | |
| 2689 | /** |
Michael Wright | 6faa675 | 2014-09-05 17:57:44 -0700 | [diff] [blame] | 2690 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
| 2691 | * The device has all of the inputs necessary to be considered a compatible game controller, or |
| 2692 | * includes a compatible game controller in the box. |
| 2693 | */ |
| 2694 | @SdkConstant(SdkConstantType.FEATURE) |
| 2695 | public static final String FEATURE_GAMEPAD = "android.hardware.gamepad"; |
| 2696 | |
Mike Lockwood | 5781cd5 | 2015-03-27 13:23:41 -0700 | [diff] [blame] | 2697 | /** |
| 2698 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
| 2699 | * The device has a full implementation of the android.media.midi.* APIs. |
| 2700 | */ |
| 2701 | @SdkConstant(SdkConstantType.FEATURE) |
| 2702 | public static final String FEATURE_MIDI = "android.software.midi"; |
Michael Wright | 6faa675 | 2014-09-05 17:57:44 -0700 | [diff] [blame] | 2703 | |
| 2704 | /** |
Ruben Brunk | dd18a0b | 2015-12-04 16:16:31 -0800 | [diff] [blame] | 2705 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Ruben Brunk | 927d345 | 2016-05-02 19:30:51 -0700 | [diff] [blame] | 2706 | * The device implements an optimized mode for virtual reality (VR) applications that handles |
| 2707 | * stereoscopic rendering of notifications, and disables most monocular system UI components |
| 2708 | * while a VR application has user focus. |
| 2709 | * Devices declaring this feature must include an application implementing a |
| 2710 | * {@link android.service.vr.VrListenerService} that can be targeted by VR applications via |
| 2711 | * {@link android.app.Activity#setVrModeEnabled}. |
Craig Donner | c6f9c85 | 2017-12-27 17:15:19 -0800 | [diff] [blame] | 2712 | * @deprecated use {@link #FEATURE_VR_MODE_HIGH_PERFORMANCE} instead. |
Ruben Brunk | dd18a0b | 2015-12-04 16:16:31 -0800 | [diff] [blame] | 2713 | */ |
Craig Donner | c6f9c85 | 2017-12-27 17:15:19 -0800 | [diff] [blame] | 2714 | @Deprecated |
Ruben Brunk | dd18a0b | 2015-12-04 16:16:31 -0800 | [diff] [blame] | 2715 | @SdkConstant(SdkConstantType.FEATURE) |
| 2716 | public static final String FEATURE_VR_MODE = "android.software.vr.mode"; |
| 2717 | |
| 2718 | /** |
Ruben Brunk | 31d80ea | 2016-01-25 20:14:08 -0800 | [diff] [blame] | 2719 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Craig Donner | c6f9c85 | 2017-12-27 17:15:19 -0800 | [diff] [blame] | 2720 | * The device implements an optimized mode for virtual reality (VR) applications that handles |
| 2721 | * stereoscopic rendering of notifications, disables most monocular system UI components |
| 2722 | * while a VR application has user focus and meets extra CDD requirements to provide a |
| 2723 | * high-quality VR experience. |
| 2724 | * Devices declaring this feature must include an application implementing a |
| 2725 | * {@link android.service.vr.VrListenerService} that can be targeted by VR applications via |
| 2726 | * {@link android.app.Activity#setVrModeEnabled}. |
| 2727 | * and must meet CDD requirements to provide a high-quality VR experience. |
Ruben Brunk | 31d80ea | 2016-01-25 20:14:08 -0800 | [diff] [blame] | 2728 | */ |
| 2729 | @SdkConstant(SdkConstantType.FEATURE) |
| 2730 | public static final String FEATURE_VR_MODE_HIGH_PERFORMANCE |
| 2731 | = "android.hardware.vr.high_performance"; |
| 2732 | |
| 2733 | /** |
Craig Donner | 279dd66 | 2017-03-15 17:10:50 -0700 | [diff] [blame] | 2734 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Svet Ganov | 43574b0 | 2017-04-12 09:25:20 -0700 | [diff] [blame] | 2735 | * The device supports autofill of user credentials, addresses, credit cards, etc |
| 2736 | * via integration with {@link android.service.autofill.AutofillService autofill |
| 2737 | * providers}. |
| 2738 | */ |
| 2739 | @SdkConstant(SdkConstantType.FEATURE) |
| 2740 | public static final String FEATURE_AUTOFILL = "android.software.autofill"; |
| 2741 | |
| 2742 | /** |
| 2743 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
Craig Donner | 279dd66 | 2017-03-15 17:10:50 -0700 | [diff] [blame] | 2744 | * The device implements headtracking suitable for a VR device. |
| 2745 | */ |
| 2746 | @SdkConstant(SdkConstantType.FEATURE) |
| 2747 | public static final String FEATURE_VR_HEADTRACKING = "android.hardware.vr.headtracking"; |
| 2748 | |
| 2749 | /** |
Frank Salim | ea5e038 | 2018-01-23 22:42:29 -0800 | [diff] [blame] | 2750 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
| 2751 | * The device has a StrongBox hardware-backed Keystore. |
| 2752 | */ |
| 2753 | @SdkConstant(SdkConstantType.FEATURE) |
| 2754 | public static final String FEATURE_STRONGBOX_KEYSTORE = |
| 2755 | "android.hardware.strongbox_keystore"; |
| 2756 | |
| 2757 | /** |
Eran Messeri | adaf68c | 2018-03-27 19:34:03 +0100 | [diff] [blame] | 2758 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: |
| 2759 | * The device has a Keymaster implementation that supports Device ID attestation. |
| 2760 | * |
| 2761 | * @see DevicePolicyManager#isDeviceIdAttestationSupported |
| 2762 | * @hide |
| 2763 | */ |
| 2764 | @SdkConstant(SdkConstantType.FEATURE) |
| 2765 | public static final String FEATURE_DEVICE_ID_ATTESTATION = |
| 2766 | "android.software.device_id_attestation"; |
| 2767 | |
| 2768 | /** |
Benedict Wong | dc92c69 | 2018-11-05 13:35:06 -0800 | [diff] [blame] | 2769 | * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device has |
| 2770 | * the requisite kernel support for multinetworking-capable IPsec tunnels. |
| 2771 | * |
| 2772 | * <p>This feature implies that the device supports XFRM Interfaces (CONFIG_XFRM_INTERFACE), or |
| 2773 | * VTIs with kernel patches allowing updates of output/set mark via UPDSA. |
| 2774 | */ |
| 2775 | @SdkConstant(SdkConstantType.FEATURE) |
| 2776 | public static final String FEATURE_IPSEC_TUNNELS = "android.software.ipsec_tunnels"; |
| 2777 | |
| 2778 | /** |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 2779 | * Extra field name for the URI to a verification file. Passed to a package |
| 2780 | * verifier. |
| 2781 | * |
| 2782 | * @hide |
| 2783 | */ |
| 2784 | public static final String EXTRA_VERIFICATION_URI = "android.content.pm.extra.VERIFICATION_URI"; |
| 2785 | |
| 2786 | /** |
| 2787 | * Extra field name for the ID of a package pending verification. Passed to |
| 2788 | * a package verifier and is used to call back to |
Kenny Root | 3a9b5fb | 2011-09-20 14:15:38 -0700 | [diff] [blame] | 2789 | * {@link PackageManager#verifyPendingInstall(int, int)} |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 2790 | */ |
| 2791 | public static final String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID"; |
| 2792 | |
| 2793 | /** |
| 2794 | * Extra field name for the package identifier which is trying to install |
| 2795 | * the package. |
| 2796 | * |
| 2797 | * @hide |
| 2798 | */ |
| 2799 | public static final String EXTRA_VERIFICATION_INSTALLER_PACKAGE |
| 2800 | = "android.content.pm.extra.VERIFICATION_INSTALLER_PACKAGE"; |
| 2801 | |
| 2802 | /** |
| 2803 | * Extra field name for the requested install flags for a package pending |
| 2804 | * verification. Passed to a package verifier. |
| 2805 | * |
| 2806 | * @hide |
| 2807 | */ |
| 2808 | public static final String EXTRA_VERIFICATION_INSTALL_FLAGS |
| 2809 | = "android.content.pm.extra.VERIFICATION_INSTALL_FLAGS"; |
| 2810 | |
| 2811 | /** |
rich cannings | 13d428e | 2012-09-13 13:43:07 -0700 | [diff] [blame] | 2812 | * Extra field name for the uid of who is requesting to install |
| 2813 | * the package. |
| 2814 | * |
| 2815 | * @hide |
| 2816 | */ |
| 2817 | public static final String EXTRA_VERIFICATION_INSTALLER_UID |
| 2818 | = "android.content.pm.extra.VERIFICATION_INSTALLER_UID"; |
| 2819 | |
| 2820 | /** |
| 2821 | * Extra field name for the package name of a package pending verification. |
| 2822 | * |
| 2823 | * @hide |
| 2824 | */ |
| 2825 | public static final String EXTRA_VERIFICATION_PACKAGE_NAME |
| 2826 | = "android.content.pm.extra.VERIFICATION_PACKAGE_NAME"; |
| 2827 | /** |
rich cannings | d1b5cfc | 2012-08-29 14:49:51 -0700 | [diff] [blame] | 2828 | * Extra field name for the result of a verification, either |
| 2829 | * {@link #VERIFICATION_ALLOW}, or {@link #VERIFICATION_REJECT}. |
| 2830 | * Passed to package verifiers after a package is verified. |
| 2831 | */ |
| 2832 | public static final String EXTRA_VERIFICATION_RESULT |
| 2833 | = "android.content.pm.extra.VERIFICATION_RESULT"; |
| 2834 | |
| 2835 | /** |
rich cannings | 13d428e | 2012-09-13 13:43:07 -0700 | [diff] [blame] | 2836 | * Extra field name for the version code of a package pending verification. |
Dianne Hackborn | 3accca0 | 2013-09-20 09:32:11 -0700 | [diff] [blame] | 2837 | * @deprecated Use {@link #EXTRA_VERIFICATION_LONG_VERSION_CODE} instead. |
| 2838 | * @hide |
| 2839 | */ |
| 2840 | @Deprecated |
| 2841 | public static final String EXTRA_VERIFICATION_VERSION_CODE |
| 2842 | = "android.content.pm.extra.VERIFICATION_VERSION_CODE"; |
| 2843 | |
| 2844 | /** |
| 2845 | * 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] | 2846 | * |
| 2847 | * @hide |
| 2848 | */ |
Dianne Hackborn | 3accca0 | 2013-09-20 09:32:11 -0700 | [diff] [blame] | 2849 | public static final String EXTRA_VERIFICATION_LONG_VERSION_CODE = |
| 2850 | "android.content.pm.extra.VERIFICATION_LONG_VERSION_CODE"; |
rich cannings | 13d428e | 2012-09-13 13:43:07 -0700 | [diff] [blame] | 2851 | |
| 2852 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 2853 | * Extra field name for the ID of a intent filter pending verification. |
| 2854 | * Passed to an intent filter verifier and is used to call back to |
| 2855 | * {@link #verifyIntentFilter} |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 2856 | * |
| 2857 | * @hide |
| 2858 | */ |
| 2859 | public static final String EXTRA_INTENT_FILTER_VERIFICATION_ID |
| 2860 | = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_ID"; |
| 2861 | |
| 2862 | /** |
| 2863 | * Extra field name for the scheme used for an intent filter pending verification. Passed to |
| 2864 | * an intent filter verifier and is used to construct the URI to verify against. |
| 2865 | * |
| 2866 | * Usually this is "https" |
| 2867 | * |
| 2868 | * @hide |
| 2869 | */ |
| 2870 | public static final String EXTRA_INTENT_FILTER_VERIFICATION_URI_SCHEME |
| 2871 | = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_URI_SCHEME"; |
| 2872 | |
| 2873 | /** |
| 2874 | * Extra field name for the host names to be used for an intent filter pending verification. |
| 2875 | * Passed to an intent filter verifier and is used to construct the URI to verify the |
| 2876 | * intent filter. |
| 2877 | * |
| 2878 | * This is a space delimited list of hosts. |
| 2879 | * |
| 2880 | * @hide |
| 2881 | */ |
| 2882 | public static final String EXTRA_INTENT_FILTER_VERIFICATION_HOSTS |
| 2883 | = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_HOSTS"; |
| 2884 | |
| 2885 | /** |
| 2886 | * Extra field name for the package name to be used for an intent filter pending verification. |
| 2887 | * Passed to an intent filter verifier and is used to check the verification responses coming |
| 2888 | * from the hosts. Each host response will need to include the package name of APK containing |
| 2889 | * the intent filter. |
| 2890 | * |
| 2891 | * @hide |
| 2892 | */ |
| 2893 | public static final String EXTRA_INTENT_FILTER_VERIFICATION_PACKAGE_NAME |
| 2894 | = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_PACKAGE_NAME"; |
| 2895 | |
| 2896 | /** |
| 2897 | * The action used to request that the user approve a permission request |
| 2898 | * from the application. |
Nick Kralevich | 035f80d | 2013-03-27 15:20:08 -0700 | [diff] [blame] | 2899 | * |
| 2900 | * @hide |
| 2901 | */ |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 2902 | @SystemApi |
| 2903 | public static final String ACTION_REQUEST_PERMISSIONS = |
| 2904 | "android.content.pm.action.REQUEST_PERMISSIONS"; |
Nick Kralevich | 035f80d | 2013-03-27 15:20:08 -0700 | [diff] [blame] | 2905 | |
| 2906 | /** |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 2907 | * The names of the requested permissions. |
| 2908 | * <p> |
| 2909 | * <strong>Type:</strong> String[] |
| 2910 | * </p> |
| 2911 | * |
| 2912 | * @hide |
| 2913 | */ |
| 2914 | @SystemApi |
| 2915 | public static final String EXTRA_REQUEST_PERMISSIONS_NAMES = |
| 2916 | "android.content.pm.extra.REQUEST_PERMISSIONS_NAMES"; |
| 2917 | |
| 2918 | /** |
| 2919 | * The results from the permissions request. |
| 2920 | * <p> |
| 2921 | * <strong>Type:</strong> int[] of #PermissionResult |
| 2922 | * </p> |
| 2923 | * |
| 2924 | * @hide |
| 2925 | */ |
| 2926 | @SystemApi |
| 2927 | public static final String EXTRA_REQUEST_PERMISSIONS_RESULTS |
| 2928 | = "android.content.pm.extra.REQUEST_PERMISSIONS_RESULTS"; |
Nick Kralevich | 035f80d | 2013-03-27 15:20:08 -0700 | [diff] [blame] | 2929 | |
| 2930 | /** |
Jeff Sharkey | bb58067 | 2014-07-10 12:10:25 -0700 | [diff] [blame] | 2931 | * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of |
Christopher Tate | f1977b4 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 2932 | * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the package which provides |
| 2933 | * the existing definition for the permission. |
| 2934 | * @hide |
| 2935 | */ |
| 2936 | public static final String EXTRA_FAILURE_EXISTING_PACKAGE |
| 2937 | = "android.content.pm.extra.FAILURE_EXISTING_PACKAGE"; |
| 2938 | |
| 2939 | /** |
Jeff Sharkey | bb58067 | 2014-07-10 12:10:25 -0700 | [diff] [blame] | 2940 | * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of |
Christopher Tate | f1977b4 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 2941 | * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the permission that is |
| 2942 | * being redundantly defined by the package being installed. |
| 2943 | * @hide |
| 2944 | */ |
| 2945 | public static final String EXTRA_FAILURE_EXISTING_PERMISSION |
| 2946 | = "android.content.pm.extra.FAILURE_EXISTING_PERMISSION"; |
| 2947 | |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 2948 | /** |
| 2949 | * Permission flag: The permission is set in its current state |
| 2950 | * by the user and apps can still request it at runtime. |
| 2951 | * |
| 2952 | * @hide |
| 2953 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 2954 | @SystemApi |
Philip P. Moltmann | 3e49617 | 2019-02-11 16:29:19 -0800 | [diff] [blame] | 2955 | @TestApi |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 2956 | public static final int FLAG_PERMISSION_USER_SET = 1 << 0; |
| 2957 | |
| 2958 | /** |
| 2959 | * Permission flag: The permission is set in its current state |
| 2960 | * by the user and it is fixed, i.e. apps can no longer request |
| 2961 | * this permission. |
| 2962 | * |
| 2963 | * @hide |
| 2964 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 2965 | @SystemApi |
Philip P. Moltmann | 3e49617 | 2019-02-11 16:29:19 -0800 | [diff] [blame] | 2966 | @TestApi |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 2967 | public static final int FLAG_PERMISSION_USER_FIXED = 1 << 1; |
| 2968 | |
| 2969 | /** |
| 2970 | * Permission flag: The permission is set in its current state |
| 2971 | * by device policy and neither apps nor the user can change |
| 2972 | * its state. |
| 2973 | * |
| 2974 | * @hide |
| 2975 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 2976 | @SystemApi |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 2977 | public static final int FLAG_PERMISSION_POLICY_FIXED = 1 << 2; |
| 2978 | |
| 2979 | /** |
| 2980 | * Permission flag: The permission is set in a granted state but |
| 2981 | * access to resources it guards is restricted by other means to |
| 2982 | * enable revoking a permission on legacy apps that do not support |
| 2983 | * runtime permissions. If this permission is upgraded to runtime |
| 2984 | * because the app was updated to support runtime permissions, the |
| 2985 | * the permission will be revoked in the upgrade process. |
| 2986 | * |
| 2987 | * @hide |
| 2988 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 2989 | @SystemApi |
Philip P. Moltmann | 4845667 | 2019-01-20 13:14:03 -0800 | [diff] [blame] | 2990 | @TestApi |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 2991 | public static final int FLAG_PERMISSION_REVOKE_ON_UPGRADE = 1 << 3; |
| 2992 | |
Svet Ganov | b3f22b4 | 2015-05-12 11:01:24 -0700 | [diff] [blame] | 2993 | /** |
| 2994 | * Permission flag: The permission is set in its current state |
| 2995 | * because the app is a component that is a part of the system. |
| 2996 | * |
| 2997 | * @hide |
| 2998 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 2999 | @SystemApi |
Svet Ganov | b3f22b4 | 2015-05-12 11:01:24 -0700 | [diff] [blame] | 3000 | public static final int FLAG_PERMISSION_SYSTEM_FIXED = 1 << 4; |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3001 | |
Svet Ganov | 77ab6a8 | 2015-07-03 12:03:02 -0700 | [diff] [blame] | 3002 | /** |
| 3003 | * Permission flag: The permission is granted by default because it |
| 3004 | * enables app functionality that is expected to work out-of-the-box |
| 3005 | * for providing a smooth user experience. For example, the phone app |
| 3006 | * is expected to have the phone permission. |
| 3007 | * |
| 3008 | * @hide |
| 3009 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 3010 | @SystemApi |
Svet Ganov | 77ab6a8 | 2015-07-03 12:03:02 -0700 | [diff] [blame] | 3011 | public static final int FLAG_PERMISSION_GRANTED_BY_DEFAULT = 1 << 5; |
| 3012 | |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3013 | /** |
Svet Ganov | 9c165d7 | 2015-12-01 19:52:26 -0800 | [diff] [blame] | 3014 | * Permission flag: The permission has to be reviewed before any of |
| 3015 | * the app components can run. |
| 3016 | * |
| 3017 | * @hide |
| 3018 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 3019 | @SystemApi |
Philip P. Moltmann | 3e49617 | 2019-02-11 16:29:19 -0800 | [diff] [blame] | 3020 | @TestApi |
Svet Ganov | 9c165d7 | 2015-12-01 19:52:26 -0800 | [diff] [blame] | 3021 | public static final int FLAG_PERMISSION_REVIEW_REQUIRED = 1 << 6; |
| 3022 | |
| 3023 | /** |
Philip P. Moltmann | 17f65af | 2018-10-18 15:32:29 -0700 | [diff] [blame] | 3024 | * Permission flag: The permission has not been explicitly requested by |
| 3025 | * the app but has been added automatically by the system. Revoke once |
| 3026 | * the app does explicitly request it. |
| 3027 | * |
| 3028 | * @hide |
| 3029 | */ |
Philip P. Moltmann | 4845667 | 2019-01-20 13:14:03 -0800 | [diff] [blame] | 3030 | @TestApi |
Philip P. Moltmann | 17f65af | 2018-10-18 15:32:29 -0700 | [diff] [blame] | 3031 | public static final int FLAG_PERMISSION_REVOKE_WHEN_REQUESTED = 1 << 7; |
| 3032 | |
| 3033 | /** |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3034 | * Mask for all permission flags. |
| 3035 | * |
| 3036 | * @hide |
| 3037 | */ |
| 3038 | @SystemApi |
Svet Ganov | b3f22b4 | 2015-05-12 11:01:24 -0700 | [diff] [blame] | 3039 | public static final int MASK_PERMISSION_FLAGS = 0xFF; |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3040 | |
Christopher Tate | f1977b4 | 2014-03-24 16:25:51 -0700 | [diff] [blame] | 3041 | /** |
Ricky Wai | 92cd006 | 2019-02-14 20:23:22 +0000 | [diff] [blame] | 3042 | * Injected activity in app that forwards user to setting activity of that app. |
| 3043 | * |
| 3044 | * @hide |
| 3045 | */ |
| 3046 | public static final String APP_DETAILS_ACTIVITY_CLASS_NAME = AppDetailsActivity.class.getName(); |
| 3047 | |
| 3048 | /** |
Svet Ganov | d7b1f411 | 2016-02-09 18:49:23 -0800 | [diff] [blame] | 3049 | * This is a library that contains components apps can invoke. For |
| 3050 | * example, a services for apps to bind to, or standard chooser UI, |
| 3051 | * etc. This library is versioned and backwards compatible. Clients |
| 3052 | * should check its version via {@link android.ext.services.Version |
| 3053 | * #getVersionCode()} and avoid calling APIs added in later versions. |
| 3054 | * |
| 3055 | * @hide |
| 3056 | */ |
Jeff Sharkey | c609116 | 2018-06-29 17:15:40 -0600 | [diff] [blame] | 3057 | @TestApi |
Svet Ganov | d7b1f411 | 2016-02-09 18:49:23 -0800 | [diff] [blame] | 3058 | public static final String SYSTEM_SHARED_LIBRARY_SERVICES = "android.ext.services"; |
| 3059 | |
| 3060 | /** |
| 3061 | * This is a library that contains components apps can dynamically |
| 3062 | * load. For example, new widgets, helper classes, etc. This library |
| 3063 | * is versioned and backwards compatible. Clients should check its |
| 3064 | * version via {@link android.ext.shared.Version#getVersionCode()} |
| 3065 | * and avoid calling APIs added in later versions. |
| 3066 | * |
| 3067 | * @hide |
| 3068 | */ |
Jeff Sharkey | c609116 | 2018-06-29 17:15:40 -0600 | [diff] [blame] | 3069 | @TestApi |
Svet Ganov | d7b1f411 | 2016-02-09 18:49:23 -0800 | [diff] [blame] | 3070 | public static final String SYSTEM_SHARED_LIBRARY_SHARED = "android.ext.shared"; |
| 3071 | |
| 3072 | /** |
Brian Carlstrom | ca82e61 | 2016-04-19 23:16:08 -0700 | [diff] [blame] | 3073 | * Used when starting a process for an Activity. |
| 3074 | * |
| 3075 | * @hide |
| 3076 | */ |
| 3077 | public static final int NOTIFY_PACKAGE_USE_ACTIVITY = 0; |
| 3078 | |
| 3079 | /** |
| 3080 | * Used when starting a process for a Service. |
| 3081 | * |
| 3082 | * @hide |
| 3083 | */ |
| 3084 | public static final int NOTIFY_PACKAGE_USE_SERVICE = 1; |
| 3085 | |
| 3086 | /** |
| 3087 | * Used when moving a Service to the foreground. |
| 3088 | * |
| 3089 | * @hide |
| 3090 | */ |
| 3091 | public static final int NOTIFY_PACKAGE_USE_FOREGROUND_SERVICE = 2; |
| 3092 | |
| 3093 | /** |
| 3094 | * Used when starting a process for a BroadcastReceiver. |
| 3095 | * |
| 3096 | * @hide |
| 3097 | */ |
| 3098 | public static final int NOTIFY_PACKAGE_USE_BROADCAST_RECEIVER = 3; |
| 3099 | |
| 3100 | /** |
| 3101 | * Used when starting a process for a ContentProvider. |
| 3102 | * |
| 3103 | * @hide |
| 3104 | */ |
| 3105 | public static final int NOTIFY_PACKAGE_USE_CONTENT_PROVIDER = 4; |
| 3106 | |
| 3107 | /** |
| 3108 | * Used when starting a process for a BroadcastReceiver. |
| 3109 | * |
| 3110 | * @hide |
| 3111 | */ |
| 3112 | public static final int NOTIFY_PACKAGE_USE_BACKUP = 5; |
| 3113 | |
| 3114 | /** |
| 3115 | * Used with Context.getClassLoader() across Android packages. |
| 3116 | * |
| 3117 | * @hide |
| 3118 | */ |
| 3119 | public static final int NOTIFY_PACKAGE_USE_CROSS_PACKAGE = 6; |
| 3120 | |
| 3121 | /** |
| 3122 | * Used when starting a package within a process for Instrumentation. |
| 3123 | * |
| 3124 | * @hide |
| 3125 | */ |
| 3126 | public static final int NOTIFY_PACKAGE_USE_INSTRUMENTATION = 7; |
| 3127 | |
| 3128 | /** |
| 3129 | * Total number of usage reasons. |
| 3130 | * |
| 3131 | * @hide |
| 3132 | */ |
| 3133 | public static final int NOTIFY_PACKAGE_USE_REASONS_COUNT = 8; |
| 3134 | |
| 3135 | /** |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 3136 | * Constant for specifying the highest installed package version code. |
| 3137 | */ |
| 3138 | public static final int VERSION_CODE_HIGHEST = -1; |
| 3139 | |
Jeff Sharkey | ad357d1 | 2018-02-02 13:25:31 -0700 | [diff] [blame] | 3140 | /** {@hide} */ |
| 3141 | public int getUserId() { |
| 3142 | return UserHandle.myUserId(); |
| 3143 | } |
| 3144 | |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 3145 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3146 | * Retrieve overall information about an application package that is |
| 3147 | * installed on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3148 | * |
| 3149 | * @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] | 3150 | * desired package. |
| 3151 | * @param flags Additional option flags to modify the data returned. |
| 3152 | * @return A PackageInfo object containing information about the package. If |
| 3153 | * flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the package |
| 3154 | * is not found in the list of installed applications, the package |
| 3155 | * information is retrieved from the list of uninstalled |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 3156 | * applications (which includes installed applications as well as |
| 3157 | * applications with data directory i.e. applications which had been |
| 3158 | * deleted with {@code DONT_DELETE_DATA} flag set). |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3159 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3160 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3161 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3162 | public abstract PackageInfo getPackageInfo(String packageName, @PackageInfoFlags int flags) |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3163 | throws NameNotFoundException; |
| 3164 | |
| 3165 | /** |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 3166 | * Retrieve overall information about an application package that is |
| 3167 | * installed on the system. This method can be used for retrieving |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3168 | * information about packages for which multiple versions can be installed |
| 3169 | * at the time. Currently only packages hosting static shared libraries can |
| 3170 | * have multiple installed versions. The method can also be used to get info |
| 3171 | * for a package that has a single version installed by passing |
| 3172 | * {@link #VERSION_CODE_HIGHEST} in the {@link VersionedPackage} |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 3173 | * constructor. |
| 3174 | * |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 3175 | * @param versionedPackage The versioned package for which to query. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3176 | * @param flags Additional option flags to modify the data returned. |
| 3177 | * @return A PackageInfo object containing information about the package. If |
| 3178 | * flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the package |
| 3179 | * is not found in the list of installed applications, the package |
| 3180 | * information is retrieved from the list of uninstalled |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 3181 | * applications (which includes installed applications as well as |
| 3182 | * applications with data directory i.e. applications which had been |
| 3183 | * deleted with {@code DONT_DELETE_DATA} flag set). |
| 3184 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3185 | * found on the system. |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 3186 | */ |
| 3187 | public abstract PackageInfo getPackageInfo(VersionedPackage versionedPackage, |
| 3188 | @PackageInfoFlags int flags) throws NameNotFoundException; |
| 3189 | |
| 3190 | /** |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 3191 | * Retrieve overall information about an application package that is |
| 3192 | * installed on the system. |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 3193 | * |
| 3194 | * @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] | 3195 | * desired package. |
| 3196 | * @param flags Additional option flags to modify the data returned. |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 3197 | * @param userId The user id. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3198 | * @return A PackageInfo object containing information about the package. If |
| 3199 | * flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if the package |
| 3200 | * is not found in the list of installed applications, the package |
| 3201 | * information is retrieved from the list of uninstalled |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 3202 | * applications (which includes installed applications as well as |
| 3203 | * applications with data directory i.e. applications which had been |
| 3204 | * deleted with {@code DONT_DELETE_DATA} flag set). |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3205 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3206 | * found on the system. |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 3207 | * @hide |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 3208 | */ |
| 3209 | @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS) |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 3210 | @UnsupportedAppUsage |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3211 | public abstract PackageInfo getPackageInfoAsUser(String packageName, |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3212 | @PackageInfoFlags int flags, @UserIdInt int userId) throws NameNotFoundException; |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 3213 | |
| 3214 | /** |
Dianne Hackborn | 4709693 | 2010-02-11 15:57:09 -0800 | [diff] [blame] | 3215 | * Map from the current package names in use on the device to whatever |
| 3216 | * the current canonical name of that package is. |
| 3217 | * @param names Array of current names to be mapped. |
| 3218 | * @return Returns an array of the same size as the original, containing |
| 3219 | * the canonical name for each package. |
| 3220 | */ |
| 3221 | public abstract String[] currentToCanonicalPackageNames(String[] names); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3222 | |
Dianne Hackborn | 4709693 | 2010-02-11 15:57:09 -0800 | [diff] [blame] | 3223 | /** |
| 3224 | * Map from a packages canonical name to the current name in use on the device. |
| 3225 | * @param names Array of new names to be mapped. |
| 3226 | * @return Returns an array of the same size as the original, containing |
| 3227 | * the current name for each package. |
| 3228 | */ |
| 3229 | public abstract String[] canonicalToCurrentPackageNames(String[] names); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3230 | |
Dianne Hackborn | 4709693 | 2010-02-11 15:57:09 -0800 | [diff] [blame] | 3231 | /** |
Andrew Solovay | 5ae1335 | 2014-06-06 12:23:09 -0700 | [diff] [blame] | 3232 | * Returns a "good" intent to launch a front-door activity in a package. |
| 3233 | * This is used, for example, to implement an "open" button when browsing |
| 3234 | * through packages. The current implementation looks first for a main |
| 3235 | * activity in the category {@link Intent#CATEGORY_INFO}, and next for a |
| 3236 | * main activity in the category {@link Intent#CATEGORY_LAUNCHER}. Returns |
| 3237 | * <code>null</code> if neither are found. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3238 | * |
| 3239 | * @param packageName The name of the package to inspect. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3240 | * |
Andrew Solovay | 5ae1335 | 2014-06-06 12:23:09 -0700 | [diff] [blame] | 3241 | * @return A fully-qualified {@link Intent} that can be used to launch the |
| 3242 | * main activity in the package. Returns <code>null</code> if the package |
| 3243 | * 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] | 3244 | * recognized. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3245 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 3246 | public abstract @Nullable Intent getLaunchIntentForPackage(@NonNull String packageName); |
Mihai Preda | eae850c | 2009-05-13 10:13:48 +0200 | [diff] [blame] | 3247 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3248 | /** |
Jose Lima | 970417c | 2014-04-10 10:42:19 -0700 | [diff] [blame] | 3249 | * Return a "good" intent to launch a front-door Leanback activity in a |
| 3250 | * package, for use for example to implement an "open" button when browsing |
| 3251 | * through packages. The current implementation will look for a main |
| 3252 | * activity in the category {@link Intent#CATEGORY_LEANBACK_LAUNCHER}, or |
| 3253 | * return null if no main leanback activities are found. |
Adam Connors | 551c078 | 2014-06-05 12:13:03 +0100 | [diff] [blame] | 3254 | * |
Jose Lima | 970417c | 2014-04-10 10:42:19 -0700 | [diff] [blame] | 3255 | * @param packageName The name of the package to inspect. |
| 3256 | * @return Returns either a fully-qualified Intent that can be used to launch |
| 3257 | * the main Leanback activity in the package, or null if the package |
| 3258 | * does not contain such an activity. |
| 3259 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 3260 | public abstract @Nullable Intent getLeanbackLaunchIntentForPackage(@NonNull String packageName); |
Jose Lima | 970417c | 2014-04-10 10:42:19 -0700 | [diff] [blame] | 3261 | |
| 3262 | /** |
Roberto Perez | 7ee1a7a | 2017-12-04 17:14:33 -0800 | [diff] [blame] | 3263 | * Return a "good" intent to launch a front-door Car activity in a |
| 3264 | * package, for use for example to implement an "open" button when browsing |
| 3265 | * through packages. The current implementation will look for a main |
| 3266 | * activity in the category {@link Intent#CATEGORY_CAR_LAUNCHER}, or |
| 3267 | * return null if no main car activities are found. |
| 3268 | * |
| 3269 | * @param packageName The name of the package to inspect. |
| 3270 | * @return Returns either a fully-qualified Intent that can be used to launch |
| 3271 | * the main Car activity in the package, or null if the package |
| 3272 | * does not contain such an activity. |
| 3273 | * @hide |
| 3274 | */ |
| 3275 | public abstract @Nullable Intent getCarLaunchIntentForPackage(@NonNull String packageName); |
| 3276 | |
| 3277 | /** |
Jeff Sharkey | cf3f0a1 | 2016-03-17 19:57:58 -0600 | [diff] [blame] | 3278 | * Return an array of all of the POSIX secondary group IDs that have been |
| 3279 | * assigned to the given package. |
| 3280 | * <p> |
| 3281 | * Note that the same package may have different GIDs under different |
| 3282 | * {@link UserHandle} on the same device. |
Adam Connors | 551c078 | 2014-06-05 12:13:03 +0100 | [diff] [blame] | 3283 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3284 | * @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] | 3285 | * desired package. |
| 3286 | * @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] | 3287 | * none. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3288 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3289 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3290 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 3291 | public abstract int[] getPackageGids(@NonNull String packageName) |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3292 | throws NameNotFoundException; |
| 3293 | |
| 3294 | /** |
Jeff Sharkey | cf3f0a1 | 2016-03-17 19:57:58 -0600 | [diff] [blame] | 3295 | * Return an array of all of the POSIX secondary group IDs that have been |
| 3296 | * assigned to the given package. |
| 3297 | * <p> |
| 3298 | * Note that the same package may have different GIDs under different |
| 3299 | * {@link UserHandle} on the same device. |
Dianne Hackborn | a06de0f | 2012-12-11 16:34:47 -0800 | [diff] [blame] | 3300 | * |
| 3301 | * @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] | 3302 | * desired package. |
| 3303 | * @return Returns an int array of the assigned gids, or null if there are |
| 3304 | * none. |
| 3305 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3306 | * found on the system. |
Dianne Hackborn | a06de0f | 2012-12-11 16:34:47 -0800 | [diff] [blame] | 3307 | */ |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3308 | public abstract int[] getPackageGids(String packageName, @PackageInfoFlags int flags) |
Dianne Hackborn | a06de0f | 2012-12-11 16:34:47 -0800 | [diff] [blame] | 3309 | throws NameNotFoundException; |
| 3310 | |
| 3311 | /** |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3312 | * Return the UID associated with the given package name. |
Jeff Sharkey | cf3f0a1 | 2016-03-17 19:57:58 -0600 | [diff] [blame] | 3313 | * <p> |
| 3314 | * Note that the same package will have different UIDs under different |
| 3315 | * {@link UserHandle} on the same device. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3316 | * |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3317 | * @param packageName The full name (i.e. com.google.apps.contacts) of the |
| 3318 | * desired package. |
| 3319 | * @return Returns an integer UID who owns the given package name. |
| 3320 | * @throws NameNotFoundException if a package with the given name can not be |
| 3321 | * found on the system. |
| 3322 | */ |
| 3323 | public abstract int getPackageUid(String packageName, @PackageInfoFlags int flags) |
| 3324 | throws NameNotFoundException; |
| 3325 | |
| 3326 | /** |
| 3327 | * Return the UID associated with the given package name. |
Jeff Sharkey | cf3f0a1 | 2016-03-17 19:57:58 -0600 | [diff] [blame] | 3328 | * <p> |
| 3329 | * Note that the same package will have different UIDs under different |
| 3330 | * {@link UserHandle} on the same device. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3331 | * |
| 3332 | * @param packageName The full name (i.e. com.google.apps.contacts) of the |
| 3333 | * desired package. |
| 3334 | * @param userId The user handle identifier to look up the package under. |
| 3335 | * @return Returns an integer UID who owns the given package name. |
| 3336 | * @throws NameNotFoundException if a package with the given name can not be |
| 3337 | * found on the system. |
| 3338 | * @hide |
| 3339 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 3340 | @UnsupportedAppUsage |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3341 | public abstract int getPackageUidAsUser(String packageName, @UserIdInt int userId) |
| 3342 | throws NameNotFoundException; |
| 3343 | |
| 3344 | /** |
| 3345 | * Return the UID associated with the given package name. |
Jeff Sharkey | cf3f0a1 | 2016-03-17 19:57:58 -0600 | [diff] [blame] | 3346 | * <p> |
| 3347 | * Note that the same package will have different UIDs under different |
| 3348 | * {@link UserHandle} on the same device. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3349 | * |
| 3350 | * @param packageName The full name (i.e. com.google.apps.contacts) of the |
| 3351 | * desired package. |
| 3352 | * @param userId The user handle identifier to look up the package under. |
| 3353 | * @return Returns an integer UID who owns the given package name. |
| 3354 | * @throws NameNotFoundException if a package with the given name can not be |
| 3355 | * found on the system. |
| 3356 | * @hide |
| 3357 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 3358 | @UnsupportedAppUsage |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3359 | public abstract int getPackageUidAsUser(String packageName, @PackageInfoFlags int flags, |
| 3360 | @UserIdInt int userId) throws NameNotFoundException; |
| 3361 | |
| 3362 | /** |
| 3363 | * 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] | 3364 | * |
| 3365 | * @param name The fully qualified name (i.e. com.google.permission.LOGIN) |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3366 | * of the permission you are interested in. |
| 3367 | * @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] | 3368 | * @return Returns a {@link PermissionInfo} containing information about the |
| 3369 | * permission. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3370 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3371 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3372 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3373 | public abstract PermissionInfo getPermissionInfo(String name, @PermissionInfoFlags int flags) |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3374 | throws NameNotFoundException; |
| 3375 | |
| 3376 | /** |
| 3377 | * Query for all of the permissions associated with a particular group. |
| 3378 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3379 | * @param group The fully qualified name (i.e. com.google.permission.LOGIN) |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3380 | * of the permission group you are interested in. Use null to |
| 3381 | * find all of the permissions not associated with a group. |
| 3382 | * @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] | 3383 | * @return Returns a list of {@link PermissionInfo} containing information |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3384 | * about all of the permissions in the given group. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3385 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3386 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3387 | */ |
| 3388 | public abstract List<PermissionInfo> queryPermissionsByGroup(String group, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3389 | @PermissionInfoFlags int flags) throws NameNotFoundException; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3390 | |
| 3391 | /** |
Philip P. Moltmann | a4b3022 | 2018-08-31 09:30:18 -0700 | [diff] [blame] | 3392 | * Returns true if some permissions are individually controlled. |
| 3393 | * |
| 3394 | * <p>The user usually grants and revokes permission-groups. If this option is set some |
| 3395 | * dangerous system permissions can be revoked/granted by the user separately from their group. |
Paul Navin | 7b89a7b | 2017-01-26 23:56:08 +0000 | [diff] [blame] | 3396 | * |
| 3397 | * @hide |
| 3398 | */ |
Philip P. Moltmann | a4b3022 | 2018-08-31 09:30:18 -0700 | [diff] [blame] | 3399 | @TestApi @SystemApi |
Philip P. Moltmann | 6c644e6 | 2018-07-18 15:41:24 -0700 | [diff] [blame] | 3400 | public abstract boolean arePermissionsIndividuallyControlled(); |
| 3401 | |
| 3402 | /** |
| 3403 | * Returns true if wireless consent mode is enabled |
| 3404 | * |
| 3405 | * @hide |
| 3406 | */ |
| 3407 | public abstract boolean isWirelessConsentModeEnabled(); |
Paul Navin | 7b89a7b | 2017-01-26 23:56:08 +0000 | [diff] [blame] | 3408 | |
| 3409 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3410 | * Retrieve all of the information we know about a particular group of |
| 3411 | * permissions. |
| 3412 | * |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3413 | * @param name The fully qualified name (i.e. |
| 3414 | * com.google.permission_group.APPS) of the permission you are |
| 3415 | * interested in. |
| 3416 | * @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] | 3417 | * @return Returns a {@link PermissionGroupInfo} containing information |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 3418 | * about the permission. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3419 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3420 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3421 | */ |
| 3422 | public abstract PermissionGroupInfo getPermissionGroupInfo(String name, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3423 | @PermissionGroupInfoFlags int flags) throws NameNotFoundException; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3424 | |
| 3425 | /** |
| 3426 | * Retrieve all of the known permission groups in the system. |
| 3427 | * |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3428 | * @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] | 3429 | * @return Returns a list of {@link PermissionGroupInfo} containing |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 3430 | * information about all of the known permission groups. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3431 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3432 | public abstract List<PermissionGroupInfo> getAllPermissionGroups( |
| 3433 | @PermissionGroupInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3434 | |
| 3435 | /** |
| 3436 | * Retrieve all of the information we know about a particular |
| 3437 | * package/application. |
| 3438 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3439 | * @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] | 3440 | * application. |
| 3441 | * @param flags Additional option flags to modify the data returned. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 3442 | * @return An {@link ApplicationInfo} containing information about the |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3443 | * package. If flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if |
| 3444 | * the package is not found in the list of installed applications, |
| 3445 | * the application information is retrieved from the list of |
| 3446 | * uninstalled applications (which includes installed applications |
| 3447 | * as well as applications with data directory i.e. applications |
| 3448 | * which had been deleted with {@code DONT_DELETE_DATA} flag set). |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3449 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3450 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3451 | */ |
| 3452 | public abstract ApplicationInfo getApplicationInfo(String packageName, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3453 | @ApplicationInfoFlags int flags) throws NameNotFoundException; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3454 | |
Jeff Sharkey | cd65448 | 2016-01-08 17:42:11 -0700 | [diff] [blame] | 3455 | /** {@hide} */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 3456 | @UnsupportedAppUsage |
Jeff Sharkey | cd65448 | 2016-01-08 17:42:11 -0700 | [diff] [blame] | 3457 | public abstract ApplicationInfo getApplicationInfoAsUser(String packageName, |
| 3458 | @ApplicationInfoFlags int flags, @UserIdInt int userId) throws NameNotFoundException; |
| 3459 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3460 | /** |
Hai Zhang | 8c7e93b | 2018-12-11 18:34:06 -0800 | [diff] [blame] | 3461 | * Retrieve all of the information we know about a particular |
| 3462 | * package/application, for a specific user. |
| 3463 | * |
| 3464 | * @param packageName The full name (i.e. com.google.apps.contacts) of an |
| 3465 | * application. |
| 3466 | * @param flags Additional option flags to modify the data returned. |
| 3467 | * @return An {@link ApplicationInfo} containing information about the |
| 3468 | * package. If flag {@code MATCH_UNINSTALLED_PACKAGES} is set and if |
| 3469 | * the package is not found in the list of installed applications, |
| 3470 | * the application information is retrieved from the list of |
| 3471 | * uninstalled applications (which includes installed applications |
| 3472 | * as well as applications with data directory i.e. applications |
| 3473 | * which had been deleted with {@code DONT_DELETE_DATA} flag set). |
| 3474 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3475 | * found on the system. |
| 3476 | * @hide |
| 3477 | */ |
| 3478 | @NonNull |
| 3479 | @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS) |
| 3480 | @SystemApi |
| 3481 | public ApplicationInfo getApplicationInfoAsUser(@NonNull String packageName, |
| 3482 | @ApplicationInfoFlags int flags, @NonNull UserHandle user) |
| 3483 | throws NameNotFoundException { |
| 3484 | return getApplicationInfoAsUser(packageName, flags, user.getIdentifier()); |
| 3485 | } |
| 3486 | |
| 3487 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3488 | * Retrieve all of the information we know about a particular activity |
| 3489 | * class. |
| 3490 | * |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 3491 | * @param component The full component name (i.e. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 3492 | * com.google.apps.contacts/com.google.apps.contacts. |
| 3493 | * ContactsList) of an Activity class. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3494 | * @param flags Additional option flags to modify the data returned. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 3495 | * @return An {@link ActivityInfo} containing information about the |
| 3496 | * activity. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3497 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3498 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3499 | */ |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 3500 | public abstract ActivityInfo getActivityInfo(ComponentName component, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3501 | @ComponentInfoFlags int flags) throws NameNotFoundException; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3502 | |
| 3503 | /** |
| 3504 | * Retrieve all of the information we know about a particular receiver |
| 3505 | * class. |
| 3506 | * |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 3507 | * @param component The full component name (i.e. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 3508 | * com.google.apps.calendar/com.google.apps.calendar. |
| 3509 | * CalendarAlarm) of a Receiver class. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3510 | * @param flags Additional option flags to modify the data returned. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 3511 | * @return An {@link ActivityInfo} containing information about the |
| 3512 | * receiver. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3513 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3514 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3515 | */ |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 3516 | public abstract ActivityInfo getReceiverInfo(ComponentName component, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3517 | @ComponentInfoFlags int flags) throws NameNotFoundException; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3518 | |
| 3519 | /** |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 3520 | * 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] | 3521 | * |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 3522 | * @param component The full component name (i.e. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 3523 | * com.google.apps.media/com.google.apps.media. |
| 3524 | * BackgroundPlayback) of a Service class. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3525 | * @param flags Additional option flags to modify the data returned. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 3526 | * @return A {@link ServiceInfo} object containing information about the |
| 3527 | * service. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3528 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3529 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3530 | */ |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 3531 | public abstract ServiceInfo getServiceInfo(ComponentName component, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3532 | @ComponentInfoFlags int flags) throws NameNotFoundException; |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 3533 | |
| 3534 | /** |
| 3535 | * Retrieve all of the information we know about a particular content |
| 3536 | * provider class. |
| 3537 | * |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 3538 | * @param component The full component name (i.e. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 3539 | * com.google.providers.media/com.google.providers.media. |
| 3540 | * MediaProvider) of a ContentProvider class. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3541 | * @param flags Additional option flags to modify the data returned. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 3542 | * @return A {@link ProviderInfo} object containing information about the |
| 3543 | * provider. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3544 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3545 | * found on the system. |
Dianne Hackborn | 361199b | 2010-08-30 17:42:07 -0700 | [diff] [blame] | 3546 | */ |
| 3547 | public abstract ProviderInfo getProviderInfo(ComponentName component, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3548 | @ComponentInfoFlags int flags) throws NameNotFoundException; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3549 | |
| 3550 | /** |
Todd Kennedy | 3dbf83a | 2018-11-13 13:29:16 -0800 | [diff] [blame] | 3551 | * Retrieve information for a particular module. |
| 3552 | * |
| 3553 | * @param packageName The name of the module. |
| 3554 | * @param flags Additional option flags to modify the data returned. |
| 3555 | * @return A {@link ModuleInfo} object containing information about the |
| 3556 | * module. |
| 3557 | * @throws NameNotFoundException if a module with the given name cannot be |
| 3558 | * found on the system. |
| 3559 | */ |
| 3560 | public ModuleInfo getModuleInfo(String packageName, @ModuleInfoFlags int flags) |
| 3561 | throws NameNotFoundException { |
| 3562 | throw new UnsupportedOperationException( |
| 3563 | "getModuleInfo not implemented in subclass"); |
| 3564 | } |
| 3565 | |
| 3566 | /** |
| 3567 | * Return a List of all modules that are installed. |
| 3568 | * |
| 3569 | * @param flags Additional option flags to modify the data returned. |
| 3570 | * @return A {@link List} of {@link ModuleInfo} objects, one for each installed |
| 3571 | * module, containing information about the module. In the unlikely case |
| 3572 | * there are no installed modules, an empty list is returned. |
| 3573 | */ |
| 3574 | public @NonNull List<ModuleInfo> getInstalledModules(@ModuleInfoFlags int flags) { |
| 3575 | throw new UnsupportedOperationException( |
| 3576 | "getInstalledModules not implemented in subclass"); |
| 3577 | } |
| 3578 | |
| 3579 | /** |
Ricky Wai | 9964f70 | 2018-04-12 17:01:20 +0100 | [diff] [blame] | 3580 | * 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] | 3581 | * |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3582 | * @param flags Additional option flags to modify the data returned. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 3583 | * @return A List of PackageInfo objects, one for each installed package, |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3584 | * containing information about the package. In the unlikely case |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 3585 | * there are no installed packages, an empty list is returned. If |
| 3586 | * flag {@code MATCH_UNINSTALLED_PACKAGES} is set, the package |
| 3587 | * information is retrieved from the list of uninstalled |
| 3588 | * applications (which includes installed applications as well as |
| 3589 | * applications with data directory i.e. applications which had been |
| 3590 | * deleted with {@code DONT_DELETE_DATA} flag set). |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3591 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3592 | public abstract List<PackageInfo> getInstalledPackages(@PackageInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3593 | |
| 3594 | /** |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3595 | * Return a List of all installed packages that are currently holding any of |
| 3596 | * the given permissions. |
Dianne Hackborn | e799175 | 2013-01-16 17:56:46 -0800 | [diff] [blame] | 3597 | * |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3598 | * @param flags Additional option flags to modify the data returned. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 3599 | * @return A List of PackageInfo objects, one for each installed package |
| 3600 | * that holds any of the permissions that were provided, containing |
| 3601 | * information about the package. If no installed packages hold any |
| 3602 | * of the permissions, an empty list is returned. If flag |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3603 | * {@code MATCH_UNINSTALLED_PACKAGES} is set, the package |
| 3604 | * information is retrieved from the list of uninstalled |
| 3605 | * applications (which includes installed applications as well as |
| 3606 | * applications with data directory i.e. applications which had been |
| 3607 | * deleted with {@code DONT_DELETE_DATA} flag set). |
Dianne Hackborn | e799175 | 2013-01-16 17:56:46 -0800 | [diff] [blame] | 3608 | */ |
| 3609 | public abstract List<PackageInfo> getPackagesHoldingPermissions( |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3610 | String[] permissions, @PackageInfoFlags int flags); |
Dianne Hackborn | e799175 | 2013-01-16 17:56:46 -0800 | [diff] [blame] | 3611 | |
| 3612 | /** |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3613 | * 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] | 3614 | * specific user. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 3615 | * |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3616 | * @param flags Additional option flags to modify the data returned. |
Amith Yamasani | 151ec4c | 2012-09-07 19:25:16 -0700 | [diff] [blame] | 3617 | * @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] | 3618 | * @return A List of PackageInfo objects, one for each installed package, |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3619 | * containing information about the package. In the unlikely case |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 3620 | * there are no installed packages, an empty list is returned. If |
| 3621 | * flag {@code MATCH_UNINSTALLED_PACKAGES} is set, the package |
| 3622 | * information is retrieved from the list of uninstalled |
| 3623 | * applications (which includes installed applications as well as |
| 3624 | * applications with data directory i.e. applications which had been |
| 3625 | * deleted with {@code DONT_DELETE_DATA} flag set). |
Amith Yamasani | 151ec4c | 2012-09-07 19:25:16 -0700 | [diff] [blame] | 3626 | * @hide |
| 3627 | */ |
Todd Kennedy | ef9acb6 | 2018-05-29 15:18:06 -0700 | [diff] [blame] | 3628 | @TestApi |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 3629 | @SystemApi |
Jeff Sharkey | d86b8fe | 2017-06-02 17:36:26 -0600 | [diff] [blame] | 3630 | @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL) |
Jeff Sharkey | e06b4d1 | 2016-01-06 14:51:50 -0700 | [diff] [blame] | 3631 | public abstract List<PackageInfo> getInstalledPackagesAsUser(@PackageInfoFlags int flags, |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3632 | @UserIdInt int userId); |
Amith Yamasani | 151ec4c | 2012-09-07 19:25:16 -0700 | [diff] [blame] | 3633 | |
| 3634 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3635 | * Check whether a particular package has been granted a particular |
| 3636 | * permission. |
| 3637 | * |
Svet Ganov | ad3b297 | 2015-07-07 22:49:17 -0700 | [diff] [blame] | 3638 | * @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] | 3639 | * @param pkgName The name of the package you are checking against. |
| 3640 | * |
| 3641 | * @return If the package has the permission, PERMISSION_GRANTED is |
| 3642 | * returned. If it does not have the permission, PERMISSION_DENIED |
| 3643 | * is returned. |
| 3644 | * |
| 3645 | * @see #PERMISSION_GRANTED |
| 3646 | * @see #PERMISSION_DENIED |
| 3647 | */ |
Tor Norbye | 1c2bf03 | 2015-03-02 10:57:08 -0800 | [diff] [blame] | 3648 | @CheckResult |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 3649 | public abstract @PermissionResult int checkPermission(String permName, String pkgName); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3650 | |
| 3651 | /** |
Svet Ganov | ad3b297 | 2015-07-07 22:49:17 -0700 | [diff] [blame] | 3652 | * Checks whether a particular permissions has been revoked for a |
| 3653 | * package by policy. Typically the device owner or the profile owner |
| 3654 | * may apply such a policy. The user cannot grant policy revoked |
| 3655 | * permissions, hence the only way for an app to get such a permission |
| 3656 | * is by a policy change. |
| 3657 | * |
| 3658 | * @param permName The name of the permission you are checking for. |
| 3659 | * @param pkgName The name of the package you are checking against. |
| 3660 | * |
| 3661 | * @return Whether the permission is restricted by policy. |
| 3662 | */ |
| 3663 | @CheckResult |
Svet Ganov | f1b7f20 | 2015-07-29 08:33:42 -0700 | [diff] [blame] | 3664 | public abstract boolean isPermissionRevokedByPolicy(@NonNull String permName, |
| 3665 | @NonNull String pkgName); |
| 3666 | |
| 3667 | /** |
| 3668 | * Gets the package name of the component controlling runtime permissions. |
| 3669 | * |
| 3670 | * @return The package name. |
| 3671 | * |
| 3672 | * @hide |
| 3673 | */ |
Philip P. Moltmann | eb0a0ae | 2017-06-30 10:55:51 -0700 | [diff] [blame] | 3674 | @TestApi |
Svet Ganov | f1b7f20 | 2015-07-29 08:33:42 -0700 | [diff] [blame] | 3675 | public abstract String getPermissionControllerPackageName(); |
Svet Ganov | ad3b297 | 2015-07-07 22:49:17 -0700 | [diff] [blame] | 3676 | |
| 3677 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3678 | * Add a new dynamic permission to the system. For this to work, your |
| 3679 | * package must have defined a permission tree through the |
| 3680 | * {@link android.R.styleable#AndroidManifestPermissionTree |
| 3681 | * <permission-tree>} tag in its manifest. A package can only add |
| 3682 | * permissions to trees that were defined by either its own package or |
| 3683 | * another with the same user id; a permission is in a tree if it |
| 3684 | * matches the name of the permission tree + ".": for example, |
| 3685 | * "com.foo.bar" is a member of the permission tree "com.foo". |
| 3686 | * |
| 3687 | * <p>It is good to make your permission tree name descriptive, because you |
| 3688 | * are taking possession of that entire set of permission names. Thus, it |
| 3689 | * must be under a domain you control, with a suffix that will not match |
| 3690 | * any normal permissions that may be declared in any applications that |
| 3691 | * are part of that domain. |
| 3692 | * |
| 3693 | * <p>New permissions must be added before |
| 3694 | * any .apks are installed that use those permissions. Permissions you |
| 3695 | * add through this method are remembered across reboots of the device. |
| 3696 | * If the given permission already exists, the info you supply here |
| 3697 | * will be used to update it. |
| 3698 | * |
| 3699 | * @param info Description of the permission to be added. |
| 3700 | * |
| 3701 | * @return Returns true if a new permission was created, false if an |
| 3702 | * existing one was updated. |
| 3703 | * |
| 3704 | * @throws SecurityException if you are not allowed to add the |
| 3705 | * given permission name. |
| 3706 | * |
| 3707 | * @see #removePermission(String) |
| 3708 | */ |
| 3709 | public abstract boolean addPermission(PermissionInfo info); |
| 3710 | |
| 3711 | /** |
Dianne Hackborn | d7c0968 | 2010-03-30 10:42:20 -0700 | [diff] [blame] | 3712 | * Like {@link #addPermission(PermissionInfo)} but asynchronously |
| 3713 | * persists the package manager state after returning from the call, |
| 3714 | * allowing it to return quicker and batch a series of adds at the |
| 3715 | * expense of no guarantee the added permission will be retained if |
| 3716 | * the device is rebooted before it is written. |
| 3717 | */ |
| 3718 | public abstract boolean addPermissionAsync(PermissionInfo info); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3719 | |
Dianne Hackborn | d7c0968 | 2010-03-30 10:42:20 -0700 | [diff] [blame] | 3720 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3721 | * Removes a permission that was previously added with |
| 3722 | * {@link #addPermission(PermissionInfo)}. The same ownership rules apply |
| 3723 | * -- you are only allowed to remove permissions that you are allowed |
| 3724 | * to add. |
| 3725 | * |
| 3726 | * @param name The name of the permission to remove. |
| 3727 | * |
| 3728 | * @throws SecurityException if you are not allowed to remove the |
| 3729 | * given permission name. |
| 3730 | * |
| 3731 | * @see #addPermission(PermissionInfo) |
| 3732 | */ |
| 3733 | public abstract void removePermission(String name); |
| 3734 | |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3735 | /** |
| 3736 | * Permission flags set when granting or revoking a permission. |
| 3737 | * |
| 3738 | * @hide |
| 3739 | */ |
| 3740 | @SystemApi |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3741 | @IntDef(prefix = { "FLAG_PERMISSION_" }, value = { |
| 3742 | FLAG_PERMISSION_USER_SET, |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3743 | FLAG_PERMISSION_USER_FIXED, |
| 3744 | FLAG_PERMISSION_POLICY_FIXED, |
Svet Ganov | b3f22b4 | 2015-05-12 11:01:24 -0700 | [diff] [blame] | 3745 | FLAG_PERMISSION_REVOKE_ON_UPGRADE, |
Svet Ganov | 77ab6a8 | 2015-07-03 12:03:02 -0700 | [diff] [blame] | 3746 | FLAG_PERMISSION_SYSTEM_FIXED, |
Philip P. Moltmann | 17f65af | 2018-10-18 15:32:29 -0700 | [diff] [blame] | 3747 | FLAG_PERMISSION_GRANTED_BY_DEFAULT, |
| 3748 | /* |
| 3749 | FLAG_PERMISSION_REVOKE_WHEN_REQUESED |
| 3750 | */ |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3751 | }) |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3752 | @Retention(RetentionPolicy.SOURCE) |
| 3753 | public @interface PermissionFlags {} |
| 3754 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3755 | /** |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3756 | * Grant a runtime permission to an application which the application does not |
| 3757 | * already have. The permission must have been requested by the application. |
| 3758 | * If the application is not allowed to hold the permission, a {@link |
Ruben Brunk | 12ab5e1 | 2016-11-10 15:27:30 -0800 | [diff] [blame] | 3759 | * java.lang.SecurityException} is thrown. If the package or permission is |
| 3760 | * invalid, a {@link java.lang.IllegalArgumentException} is thrown. |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3761 | * <p> |
| 3762 | * <strong>Note: </strong>Using this API requires holding |
Todd Kennedy | a8eb6a8 | 2016-07-28 16:35:42 -0700 | [diff] [blame] | 3763 | * android.permission.GRANT_RUNTIME_PERMISSIONS and if the user id is |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3764 | * not the current user android.permission.INTERACT_ACROSS_USERS_FULL. |
| 3765 | * </p> |
Nick Kralevich | 035f80d | 2013-03-27 15:20:08 -0700 | [diff] [blame] | 3766 | * |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3767 | * @param packageName The package to which to grant the permission. |
| 3768 | * @param permissionName The permission name to grant. |
| 3769 | * @param user The user for which to grant the permission. |
| 3770 | * |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3771 | * @see #revokeRuntimePermission(String, String, android.os.UserHandle) |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3772 | * |
| 3773 | * @hide |
Nick Kralevich | 035f80d | 2013-03-27 15:20:08 -0700 | [diff] [blame] | 3774 | */ |
Svet Ganov | d873ae6 | 2018-06-25 16:39:23 -0700 | [diff] [blame] | 3775 | @TestApi |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3776 | @SystemApi |
Jeff Sharkey | d86b8fe | 2017-06-02 17:36:26 -0600 | [diff] [blame] | 3777 | @RequiresPermission(android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS) |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3778 | public abstract void grantRuntimePermission(@NonNull String packageName, |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3779 | @NonNull String permissionName, @NonNull UserHandle user); |
Nick Kralevich | 035f80d | 2013-03-27 15:20:08 -0700 | [diff] [blame] | 3780 | |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3781 | /** |
| 3782 | * Revoke a runtime permission that was previously granted by {@link |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3783 | * #grantRuntimePermission(String, String, android.os.UserHandle)}. The |
| 3784 | * permission must have been requested by and granted to the application. |
| 3785 | * If the application is not allowed to hold the permission, a {@link |
Ruben Brunk | 12ab5e1 | 2016-11-10 15:27:30 -0800 | [diff] [blame] | 3786 | * java.lang.SecurityException} is thrown. If the package or permission is |
| 3787 | * invalid, a {@link java.lang.IllegalArgumentException} is thrown. |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3788 | * <p> |
| 3789 | * <strong>Note: </strong>Using this API requires holding |
Todd Kennedy | a8eb6a8 | 2016-07-28 16:35:42 -0700 | [diff] [blame] | 3790 | * android.permission.REVOKE_RUNTIME_PERMISSIONS and if the user id is |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3791 | * not the current user android.permission.INTERACT_ACROSS_USERS_FULL. |
| 3792 | * </p> |
| 3793 | * |
| 3794 | * @param packageName The package from which to revoke the permission. |
| 3795 | * @param permissionName The permission name to revoke. |
| 3796 | * @param user The user for which to revoke the permission. |
| 3797 | * |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3798 | * @see #grantRuntimePermission(String, String, android.os.UserHandle) |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3799 | * |
| 3800 | * @hide |
| 3801 | */ |
Svet Ganov | d873ae6 | 2018-06-25 16:39:23 -0700 | [diff] [blame] | 3802 | @TestApi |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3803 | @SystemApi |
Jeff Sharkey | d86b8fe | 2017-06-02 17:36:26 -0600 | [diff] [blame] | 3804 | @RequiresPermission(android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS) |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3805 | public abstract void revokeRuntimePermission(@NonNull String packageName, |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3806 | @NonNull String permissionName, @NonNull UserHandle user); |
| 3807 | |
| 3808 | /** |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3809 | * Gets the state flags associated with a permission. |
| 3810 | * |
| 3811 | * @param permissionName The permission for which to get the flags. |
| 3812 | * @param packageName The package name for which to get the flags. |
| 3813 | * @param user The user for which to get permission flags. |
| 3814 | * @return The permission flags. |
| 3815 | * |
| 3816 | * @hide |
| 3817 | */ |
| 3818 | @SystemApi |
Philip P. Moltmann | 3e49617 | 2019-02-11 16:29:19 -0800 | [diff] [blame] | 3819 | @TestApi |
Jeff Sharkey | d86b8fe | 2017-06-02 17:36:26 -0600 | [diff] [blame] | 3820 | @RequiresPermission(anyOf = { |
| 3821 | android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS, |
| 3822 | android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS |
| 3823 | }) |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3824 | public abstract @PermissionFlags int getPermissionFlags(String permissionName, |
| 3825 | String packageName, @NonNull UserHandle user); |
| 3826 | |
| 3827 | /** |
| 3828 | * Updates the flags associated with a permission by replacing the flags in |
| 3829 | * the specified mask with the provided flag values. |
| 3830 | * |
| 3831 | * @param permissionName The permission for which to update the flags. |
| 3832 | * @param packageName The package name for which to update the flags. |
| 3833 | * @param flagMask The flags which to replace. |
| 3834 | * @param flagValues The flags with which to replace. |
| 3835 | * @param user The user for which to update the permission flags. |
| 3836 | * |
| 3837 | * @hide |
| 3838 | */ |
| 3839 | @SystemApi |
Philip P. Moltmann | 3e49617 | 2019-02-11 16:29:19 -0800 | [diff] [blame] | 3840 | @TestApi |
Jeff Sharkey | d86b8fe | 2017-06-02 17:36:26 -0600 | [diff] [blame] | 3841 | @RequiresPermission(anyOf = { |
| 3842 | android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS, |
| 3843 | android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS |
| 3844 | }) |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3845 | public abstract void updatePermissionFlags(String permissionName, |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3846 | String packageName, @PermissionFlags int flagMask, @PermissionFlags int flagValues, |
Svet Ganov | 8c7f700 | 2015-05-07 10:48:44 -0700 | [diff] [blame] | 3847 | @NonNull UserHandle user); |
| 3848 | |
| 3849 | /** |
Svetoslav | 20770dd | 2015-05-29 15:43:04 -0700 | [diff] [blame] | 3850 | * Gets whether you should show UI with rationale for requesting a permission. |
| 3851 | * You should do this only if you do not have the permission and the context in |
| 3852 | * which the permission is requested does not clearly communicate to the user |
| 3853 | * what would be the benefit from grating this permission. |
| 3854 | * |
| 3855 | * @param permission A permission your app wants to request. |
| 3856 | * @return Whether you can show permission rationale UI. |
| 3857 | * |
| 3858 | * @hide |
| 3859 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 3860 | @UnsupportedAppUsage |
Svetoslav | 20770dd | 2015-05-29 15:43:04 -0700 | [diff] [blame] | 3861 | public abstract boolean shouldShowRequestPermissionRationale(String permission); |
| 3862 | |
| 3863 | /** |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3864 | * Returns an {@link android.content.Intent} suitable for passing to |
| 3865 | * {@link android.app.Activity#startActivityForResult(android.content.Intent, int)} |
| 3866 | * which prompts the user to grant permissions to this application. |
| 3867 | * |
| 3868 | * @throws NullPointerException if {@code permissions} is {@code null} or empty. |
| 3869 | * |
| 3870 | * @hide |
| 3871 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 3872 | @UnsupportedAppUsage |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3873 | public Intent buildRequestPermissionsIntent(@NonNull String[] permissions) { |
| 3874 | if (ArrayUtils.isEmpty(permissions)) { |
Svet Ganov | f66381c | 2016-02-18 20:02:36 -0800 | [diff] [blame] | 3875 | throw new IllegalArgumentException("permission cannot be null or empty"); |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3876 | } |
| 3877 | Intent intent = new Intent(ACTION_REQUEST_PERMISSIONS); |
| 3878 | intent.putExtra(EXTRA_REQUEST_PERMISSIONS_NAMES, permissions); |
Svet Ganov | f1b7f20 | 2015-07-29 08:33:42 -0700 | [diff] [blame] | 3879 | intent.setPackage(getPermissionControllerPackageName()); |
Svetoslav | c6d1c34 | 2015-02-26 14:44:43 -0800 | [diff] [blame] | 3880 | return intent; |
Nick Kralevich | 035f80d | 2013-03-27 15:20:08 -0700 | [diff] [blame] | 3881 | } |
| 3882 | |
| 3883 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3884 | * Compare the signatures of two packages to determine if the same |
| 3885 | * signature appears in both of them. If they do contain the same |
| 3886 | * signature, then they are allowed special privileges when working |
| 3887 | * with each other: they can share the same user-id, run instrumentation |
| 3888 | * against each other, etc. |
| 3889 | * |
| 3890 | * @param pkg1 First package name whose signature will be compared. |
| 3891 | * @param pkg2 Second package name whose signature will be compared. |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 3892 | * |
| 3893 | * @return Returns an integer indicating whether all signatures on the |
| 3894 | * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if |
| 3895 | * all signatures match or < 0 if there is not a match ({@link |
| 3896 | * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}). |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3897 | * |
Dianne Hackborn | 766cbfe | 2009-08-12 18:33:39 -0700 | [diff] [blame] | 3898 | * @see #checkSignatures(int, int) |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3899 | */ |
Tor Norbye | 1c2bf03 | 2015-03-02 10:57:08 -0800 | [diff] [blame] | 3900 | @CheckResult |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 3901 | public abstract @SignatureResult int checkSignatures(String pkg1, String pkg2); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3902 | |
| 3903 | /** |
Dianne Hackborn | 766cbfe | 2009-08-12 18:33:39 -0700 | [diff] [blame] | 3904 | * Like {@link #checkSignatures(String, String)}, but takes UIDs of |
| 3905 | * the two packages to be checked. This can be useful, for example, |
| 3906 | * when doing the check in an IPC, where the UID is the only identity |
| 3907 | * available. It is functionally identical to determining the package |
| 3908 | * associated with the UIDs and checking their signatures. |
| 3909 | * |
Joe Onorato | 25660ec | 2009-08-12 22:40:37 -0700 | [diff] [blame] | 3910 | * @param uid1 First UID whose signature will be compared. |
| 3911 | * @param uid2 Second UID whose signature will be compared. |
Dianne Hackborn | 766cbfe | 2009-08-12 18:33:39 -0700 | [diff] [blame] | 3912 | * |
Chris Palmer | 09f3360 | 2010-09-13 14:27:18 -0700 | [diff] [blame] | 3913 | * @return Returns an integer indicating whether all signatures on the |
| 3914 | * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if |
| 3915 | * all signatures match or < 0 if there is not a match ({@link |
| 3916 | * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}). |
| 3917 | * |
| 3918 | * @see #checkSignatures(String, String) |
Dianne Hackborn | 766cbfe | 2009-08-12 18:33:39 -0700 | [diff] [blame] | 3919 | */ |
Tor Norbye | 1c2bf03 | 2015-03-02 10:57:08 -0800 | [diff] [blame] | 3920 | @CheckResult |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 3921 | public abstract @SignatureResult int checkSignatures(int uid1, int uid2); |
Dianne Hackborn | 766cbfe | 2009-08-12 18:33:39 -0700 | [diff] [blame] | 3922 | |
| 3923 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3924 | * Retrieve the names of all packages that are associated with a particular |
| 3925 | * user id. In most cases, this will be a single package name, the package |
| 3926 | * that has been assigned that user id. Where there are multiple packages |
| 3927 | * sharing the same user id through the "sharedUserId" mechanism, all |
| 3928 | * packages with that id will be returned. |
| 3929 | * |
| 3930 | * @param uid The user id for which you would like to retrieve the |
| 3931 | * associated packages. |
| 3932 | * |
| 3933 | * @return Returns an array of one or more packages assigned to the user |
| 3934 | * id, or null if there are no known packages with the given id. |
| 3935 | */ |
Jeff Sharkey | 377ded0f | 2016-01-10 13:15:41 -0700 | [diff] [blame] | 3936 | public abstract @Nullable String[] getPackagesForUid(int uid); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3937 | |
| 3938 | /** |
Michal Karpinski | cb67dc9 | 2016-12-13 18:20:23 +0000 | [diff] [blame] | 3939 | * Retrieve the official name associated with a uid. This name is |
Jonathan Basseri | 7ea3a33 | 2015-05-12 19:39:22 -0700 | [diff] [blame] | 3940 | * guaranteed to never change, though it is possible for the underlying |
Michal Karpinski | cb67dc9 | 2016-12-13 18:20:23 +0000 | [diff] [blame] | 3941 | * uid to be changed. That is, if you are storing information about |
| 3942 | * uids in persistent storage, you should use the string returned |
| 3943 | * by this function instead of the raw uid. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3944 | * |
Michal Karpinski | cb67dc9 | 2016-12-13 18:20:23 +0000 | [diff] [blame] | 3945 | * @param uid The uid for which you would like to retrieve a name. |
| 3946 | * @return Returns a unique name for the given uid, or null if the |
| 3947 | * uid is not currently assigned. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3948 | */ |
Jeff Sharkey | 377ded0f | 2016-01-10 13:15:41 -0700 | [diff] [blame] | 3949 | public abstract @Nullable String getNameForUid(int uid); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3950 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3951 | /** |
Todd Kennedy | 9da8b8a7 | 2017-07-25 15:38:39 -0700 | [diff] [blame] | 3952 | * Retrieves the official names associated with each given uid. |
| 3953 | * @see #getNameForUid(int) |
| 3954 | * |
| 3955 | * @hide |
| 3956 | */ |
Philip P. Moltmann | abeb04e | 2018-03-26 10:15:23 -0700 | [diff] [blame] | 3957 | @TestApi |
Todd Kennedy | 9da8b8a7 | 2017-07-25 15:38:39 -0700 | [diff] [blame] | 3958 | public abstract @Nullable String[] getNamesForUids(int[] uids); |
| 3959 | |
| 3960 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3961 | * Return the user id associated with a shared user name. Multiple |
| 3962 | * applications can specify a shared user name in their manifest and thus |
| 3963 | * end up using a common uid. This might be used for new applications |
| 3964 | * that use an existing shared user name and need to know the uid of the |
| 3965 | * shared user. |
| 3966 | * |
| 3967 | * @param sharedUserName The shared user name whose uid is to be retrieved. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 3968 | * @return Returns the UID associated with the shared user. |
| 3969 | * @throws NameNotFoundException if a package with the given name cannot be |
| 3970 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3971 | * @hide |
| 3972 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 3973 | @UnsupportedAppUsage |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3974 | public abstract int getUidForSharedUser(String sharedUserName) |
| 3975 | throws NameNotFoundException; |
| 3976 | |
| 3977 | /** |
Ricky Wai | 9964f70 | 2018-04-12 17:01:20 +0100 | [diff] [blame] | 3978 | * Return a List of all application packages that are installed for the |
| 3979 | * 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] | 3980 | * applications including those deleted with {@code DONT_DELETE_DATA} |
| 3981 | * (partially installed apps with data directory) will be returned. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3982 | * |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3983 | * @param flags Additional option flags to modify the data returned. |
| 3984 | * @return A List of ApplicationInfo objects, one for each installed |
| 3985 | * application. In the unlikely case there are no installed |
| 3986 | * packages, an empty list is returned. If flag |
| 3987 | * {@code MATCH_UNINSTALLED_PACKAGES} is set, the application |
| 3988 | * information is retrieved from the list of uninstalled |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 3989 | * applications (which includes installed applications as well as |
| 3990 | * applications with data directory i.e. applications which had been |
| 3991 | * deleted with {@code DONT_DELETE_DATA} flag set). |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3992 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 3993 | public abstract List<ApplicationInfo> getInstalledApplications(@ApplicationInfoFlags int flags); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 3994 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3995 | /** |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 3996 | * Return a List of all application packages that are installed on the |
| 3997 | * device, for a specific user. If flag GET_UNINSTALLED_PACKAGES has been |
| 3998 | * set, a list of all applications including those deleted with |
| 3999 | * {@code DONT_DELETE_DATA} (partially installed apps with data directory) |
Bartosz Fabianowski | 1133424 | 2016-11-17 20:49:16 +0100 | [diff] [blame] | 4000 | * will be returned. |
| 4001 | * |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4002 | * @param flags Additional option flags to modify the data returned. |
| 4003 | * @param userId The user for whom the installed applications are to be |
| 4004 | * listed |
| 4005 | * @return A List of ApplicationInfo objects, one for each installed |
| 4006 | * application. In the unlikely case there are no installed |
| 4007 | * packages, an empty list is returned. If flag |
| 4008 | * {@code MATCH_UNINSTALLED_PACKAGES} is set, the application |
| 4009 | * information is retrieved from the list of uninstalled |
Bartosz Fabianowski | 1133424 | 2016-11-17 20:49:16 +0100 | [diff] [blame] | 4010 | * applications (which includes installed applications as well as |
| 4011 | * applications with data directory i.e. applications which had been |
| 4012 | * deleted with {@code DONT_DELETE_DATA} flag set). |
| 4013 | * @hide |
Bartosz Fabianowski | 1133424 | 2016-11-17 20:49:16 +0100 | [diff] [blame] | 4014 | */ |
Hongming Jin | 83e1626 | 2018-05-18 10:47:57 -0700 | [diff] [blame] | 4015 | @TestApi |
Bartosz Fabianowski | 1133424 | 2016-11-17 20:49:16 +0100 | [diff] [blame] | 4016 | public abstract List<ApplicationInfo> getInstalledApplicationsAsUser( |
| 4017 | @ApplicationInfoFlags int flags, @UserIdInt int userId); |
| 4018 | |
| 4019 | /** |
Jeff Sharkey | 910e081 | 2017-04-21 16:29:27 -0600 | [diff] [blame] | 4020 | * Gets the instant applications the user recently used. |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 4021 | * |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 4022 | * @return The instant app list. |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 4023 | * |
| 4024 | * @hide |
| 4025 | */ |
Todd Kennedy | 9c9fdf2 | 2017-03-06 10:58:27 -0800 | [diff] [blame] | 4026 | @SystemApi |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 4027 | @RequiresPermission(Manifest.permission.ACCESS_INSTANT_APPS) |
| 4028 | public abstract @NonNull List<InstantAppInfo> getInstantApps(); |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 4029 | |
| 4030 | /** |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 4031 | * Gets the icon for an instant application. |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 4032 | * |
| 4033 | * @param packageName The app package name. |
| 4034 | * |
| 4035 | * @hide |
| 4036 | */ |
Todd Kennedy | 9c9fdf2 | 2017-03-06 10:58:27 -0800 | [diff] [blame] | 4037 | @SystemApi |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 4038 | @RequiresPermission(Manifest.permission.ACCESS_INSTANT_APPS) |
| 4039 | public abstract @Nullable Drawable getInstantAppIcon(String packageName); |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 4040 | |
| 4041 | /** |
David Christie | 31a1655 | 2017-03-01 15:08:45 -0800 | [diff] [blame] | 4042 | * Gets whether this application is an instant app. |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 4043 | * |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 4044 | * @return Whether caller is an instant app. |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 4045 | * |
David Christie | 31a1655 | 2017-03-01 15:08:45 -0800 | [diff] [blame] | 4046 | * @see #isInstantApp(String) |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 4047 | * @see #updateInstantAppCookie(byte[]) |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 4048 | * @see #getInstantAppCookie() |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 4049 | * @see #getInstantAppCookieMaxBytes() |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 4050 | */ |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 4051 | public abstract boolean isInstantApp(); |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 4052 | |
| 4053 | /** |
David Christie | 31a1655 | 2017-03-01 15:08:45 -0800 | [diff] [blame] | 4054 | * Gets whether the given package is an instant app. |
| 4055 | * |
| 4056 | * @param packageName The package to check |
| 4057 | * @return Whether the given package is an instant app. |
| 4058 | * |
| 4059 | * @see #isInstantApp() |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 4060 | * @see #updateInstantAppCookie(byte[]) |
David Christie | 31a1655 | 2017-03-01 15:08:45 -0800 | [diff] [blame] | 4061 | * @see #getInstantAppCookie() |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 4062 | * @see #getInstantAppCookieMaxBytes() |
| 4063 | * @see #clearInstantAppCookie() |
David Christie | 31a1655 | 2017-03-01 15:08:45 -0800 | [diff] [blame] | 4064 | */ |
| 4065 | public abstract boolean isInstantApp(String packageName); |
| 4066 | |
| 4067 | /** |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 4068 | * 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] | 4069 | * can store on the device. |
| 4070 | * |
| 4071 | * @return The max cookie size in bytes. |
| 4072 | * |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 4073 | * @see #isInstantApp() |
David Christie | 31a1655 | 2017-03-01 15:08:45 -0800 | [diff] [blame] | 4074 | * @see #isInstantApp(String) |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 4075 | * @see #updateInstantAppCookie(byte[]) |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 4076 | * @see #getInstantAppCookie() |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 4077 | * @see #clearInstantAppCookie() |
| 4078 | */ |
| 4079 | public abstract int getInstantAppCookieMaxBytes(); |
| 4080 | |
| 4081 | /** |
Daniel Cashman | 5cdda34 | 2018-01-19 07:22:52 -0800 | [diff] [blame] | 4082 | * deprecated |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 4083 | * @hide |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 4084 | */ |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 4085 | public abstract int getInstantAppCookieMaxSize(); |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 4086 | |
| 4087 | /** |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 4088 | * Gets the instant application cookie for this app. Non |
| 4089 | * instant apps and apps that were instant but were upgraded |
| 4090 | * to normal apps can still access this API. For instant apps |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 4091 | * this cookie is cached for some time after uninstall while for |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 4092 | * normal apps the cookie is deleted after the app is uninstalled. |
| 4093 | * The cookie is always present while the app is installed. |
| 4094 | * |
| 4095 | * @return The cookie. |
| 4096 | * |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 4097 | * @see #isInstantApp() |
David Christie | 31a1655 | 2017-03-01 15:08:45 -0800 | [diff] [blame] | 4098 | * @see #isInstantApp(String) |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 4099 | * @see #updateInstantAppCookie(byte[]) |
| 4100 | * @see #getInstantAppCookieMaxBytes() |
| 4101 | * @see #clearInstantAppCookie() |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 4102 | */ |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 4103 | public abstract @NonNull byte[] getInstantAppCookie(); |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 4104 | |
| 4105 | /** |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 4106 | * Clears the instant application cookie for the calling app. |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 4107 | * |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 4108 | * @see #isInstantApp() |
David Christie | 31a1655 | 2017-03-01 15:08:45 -0800 | [diff] [blame] | 4109 | * @see #isInstantApp(String) |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 4110 | * @see #getInstantAppCookieMaxBytes() |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 4111 | * @see #getInstantAppCookie() |
Svetoslav Ganov | 345ffa5 | 2017-04-18 16:08:41 -0700 | [diff] [blame] | 4112 | * @see #clearInstantAppCookie() |
| 4113 | */ |
| 4114 | public abstract void clearInstantAppCookie(); |
| 4115 | |
| 4116 | /** |
| 4117 | * Updates the instant application cookie for the calling app. Non |
| 4118 | * instant apps and apps that were instant but were upgraded |
| 4119 | * to normal apps can still access this API. For instant apps |
| 4120 | * this cookie is cached for some time after uninstall while for |
| 4121 | * normal apps the cookie is deleted after the app is uninstalled. |
| 4122 | * The cookie is always present while the app is installed. The |
| 4123 | * cookie size is limited by {@link #getInstantAppCookieMaxBytes()}. |
| 4124 | * Passing <code>null</code> or an empty array clears the cookie. |
| 4125 | * </p> |
| 4126 | * |
| 4127 | * @param cookie The cookie data. |
| 4128 | * |
| 4129 | * @see #isInstantApp() |
| 4130 | * @see #isInstantApp(String) |
| 4131 | * @see #getInstantAppCookieMaxBytes() |
| 4132 | * @see #getInstantAppCookie() |
| 4133 | * @see #clearInstantAppCookie() |
| 4134 | * |
| 4135 | * @throws IllegalArgumentException if the array exceeds max cookie size. |
| 4136 | */ |
| 4137 | public abstract void updateInstantAppCookie(@Nullable byte[] cookie); |
| 4138 | |
| 4139 | /** |
| 4140 | * @removed |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 4141 | */ |
Svetoslav Ganov | 096d304 | 2017-01-30 16:34:13 -0800 | [diff] [blame] | 4142 | public abstract boolean setInstantAppCookie(@Nullable byte[] cookie); |
Svet Ganov | 2acf063 | 2015-11-24 19:10:59 -0800 | [diff] [blame] | 4143 | |
| 4144 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4145 | * Get a list of shared libraries that are available on the |
| 4146 | * system. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 4147 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4148 | * @return An array of shared library names that are |
| 4149 | * available on the system, or null if none are installed. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 4150 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4151 | */ |
| 4152 | public abstract String[] getSystemSharedLibraryNames(); |
| 4153 | |
| 4154 | /** |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 4155 | * Get a list of shared libraries on the device. |
| 4156 | * |
| 4157 | * @param flags To filter the libraries to return. |
| 4158 | * @return The shared library list. |
| 4159 | * |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 4160 | * @see #MATCH_UNINSTALLED_PACKAGES |
| 4161 | */ |
| 4162 | public abstract @NonNull List<SharedLibraryInfo> getSharedLibraries( |
| 4163 | @InstallFlags int flags); |
| 4164 | |
| 4165 | /** |
| 4166 | * Get a list of shared libraries on the device. |
| 4167 | * |
| 4168 | * @param flags To filter the libraries to return. |
| 4169 | * @param userId The user to query for. |
| 4170 | * @return The shared library list. |
| 4171 | * |
| 4172 | * @see #MATCH_FACTORY_ONLY |
| 4173 | * @see #MATCH_KNOWN_PACKAGES |
| 4174 | * @see #MATCH_ANY_USER |
| 4175 | * @see #MATCH_UNINSTALLED_PACKAGES |
| 4176 | * |
| 4177 | * @hide |
| 4178 | */ |
| 4179 | public abstract @NonNull List<SharedLibraryInfo> getSharedLibrariesAsUser( |
| 4180 | @InstallFlags int flags, @UserIdInt int userId); |
| 4181 | |
| 4182 | /** |
Svet Ganov | d7b1f411 | 2016-02-09 18:49:23 -0800 | [diff] [blame] | 4183 | * Get the name of the package hosting the services shared library. |
| 4184 | * |
| 4185 | * @return The library host package. |
| 4186 | * |
| 4187 | * @hide |
| 4188 | */ |
Philip P. Moltmann | f80809f | 2018-04-04 11:20:44 -0700 | [diff] [blame] | 4189 | @TestApi |
Svetoslav Ganov | a9c2500 | 2016-04-13 19:25:56 -0700 | [diff] [blame] | 4190 | public abstract @NonNull String getServicesSystemSharedLibraryPackageName(); |
| 4191 | |
| 4192 | /** |
| 4193 | * Get the name of the package hosting the shared components shared library. |
| 4194 | * |
| 4195 | * @return The library host package. |
| 4196 | * |
| 4197 | * @hide |
| 4198 | */ |
Philip P. Moltmann | f80809f | 2018-04-04 11:20:44 -0700 | [diff] [blame] | 4199 | @TestApi |
Svetoslav Ganov | a9c2500 | 2016-04-13 19:25:56 -0700 | [diff] [blame] | 4200 | public abstract @NonNull String getSharedSystemSharedLibraryPackageName(); |
Svet Ganov | d7b1f411 | 2016-02-09 18:49:23 -0800 | [diff] [blame] | 4201 | |
| 4202 | /** |
Todd Kennedy | 9106c64 | 2017-02-08 14:16:53 -0800 | [diff] [blame] | 4203 | * Returns the names of the packages that have been changed |
| 4204 | * [eg. added, removed or updated] since the given sequence |
| 4205 | * number. |
| 4206 | * <p>If no packages have been changed, returns <code>null</code>. |
| 4207 | * <p>The sequence number starts at <code>0</code> and is |
| 4208 | * reset every boot. |
Todd Kennedy | 8fddf9d | 2017-04-17 15:16:12 -0700 | [diff] [blame] | 4209 | * @param sequenceNumber The first sequence number for which to retrieve package changes. |
Aurimas Liutikas | 7f69533 | 2018-05-31 21:07:32 -0700 | [diff] [blame] | 4210 | * @see android.provider.Settings.Global#BOOT_COUNT |
Todd Kennedy | 9106c64 | 2017-02-08 14:16:53 -0800 | [diff] [blame] | 4211 | */ |
| 4212 | public abstract @Nullable ChangedPackages getChangedPackages( |
| 4213 | @IntRange(from=0) int sequenceNumber); |
| 4214 | |
| 4215 | /** |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 4216 | * Get a list of features that are available on the |
| 4217 | * system. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 4218 | * |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 4219 | * @return An array of FeatureInfo classes describing the features |
| 4220 | * that are available on the system, or null if there are none(!!). |
Dianne Hackborn | 4923734 | 2009-08-27 20:08:01 -0700 | [diff] [blame] | 4221 | */ |
| 4222 | public abstract FeatureInfo[] getSystemAvailableFeatures(); |
| 4223 | |
| 4224 | /** |
Jeff Sharkey | 115d2c1 | 2016-02-15 17:25:57 -0700 | [diff] [blame] | 4225 | * Check whether the given feature name is one of the available features as |
| 4226 | * returned by {@link #getSystemAvailableFeatures()}. This tests for the |
| 4227 | * presence of <em>any</em> version of the given feature name; use |
| 4228 | * {@link #hasSystemFeature(String, int)} to check for a minimum version. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 4229 | * |
Jeff Sharkey | 115d2c1 | 2016-02-15 17:25:57 -0700 | [diff] [blame] | 4230 | * @return Returns true if the devices supports the feature, else false. |
Dianne Hackborn | 039c68e | 2009-09-26 16:39:23 -0700 | [diff] [blame] | 4231 | */ |
| 4232 | public abstract boolean hasSystemFeature(String name); |
| 4233 | |
| 4234 | /** |
Jeff Sharkey | 115d2c1 | 2016-02-15 17:25:57 -0700 | [diff] [blame] | 4235 | * Check whether the given feature name and version is one of the available |
| 4236 | * features as returned by {@link #getSystemAvailableFeatures()}. Since |
| 4237 | * features are defined to always be backwards compatible, this returns true |
| 4238 | * if the available feature version is greater than or equal to the |
| 4239 | * requested version. |
| 4240 | * |
| 4241 | * @return Returns true if the devices supports the feature, else false. |
| 4242 | */ |
| 4243 | public abstract boolean hasSystemFeature(String name, int version); |
| 4244 | |
| 4245 | /** |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4246 | * Determine the best action to perform for a given Intent. This is how |
| 4247 | * {@link Intent#resolveActivity} finds an activity if a class has not been |
| 4248 | * explicitly specified. |
| 4249 | * <p> |
| 4250 | * <em>Note:</em> if using an implicit Intent (without an explicit |
| 4251 | * ComponentName specified), be sure to consider whether to set the |
| 4252 | * {@link #MATCH_DEFAULT_ONLY} only flag. You need to do so to resolve the |
| 4253 | * activity in the same way that |
| 4254 | * {@link android.content.Context#startActivity(Intent)} and |
Dianne Hackborn | 4d023d21 | 2010-10-01 13:41:04 -0700 | [diff] [blame] | 4255 | * {@link android.content.Intent#resolveActivity(PackageManager) |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4256 | * Intent.resolveActivity(PackageManager)} do. |
| 4257 | * </p> |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 4258 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4259 | * @param intent An intent containing all of the desired specification |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4260 | * (action, data, type, category, and/or component). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4261 | * @param flags Additional option flags to modify the data returned. The |
| 4262 | * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the |
| 4263 | * resolution to only those activities that support the |
| 4264 | * {@link android.content.Intent#CATEGORY_DEFAULT}. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 4265 | * @return Returns a ResolveInfo object containing the final activity intent |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4266 | * that was determined to be the best action. Returns null if no |
Mike LeBeau | bd3f527 | 2010-02-18 19:27:17 -0800 | [diff] [blame] | 4267 | * matching activity was found. If multiple matching activities are |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 4268 | * found and there is no default set, returns a ResolveInfo object |
Mike LeBeau | bd3f527 | 2010-02-18 19:27:17 -0800 | [diff] [blame] | 4269 | * containing something else, such as the activity resolver. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4270 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4271 | public abstract ResolveInfo resolveActivity(Intent intent, @ResolveInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4272 | |
| 4273 | /** |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4274 | * Determine the best action to perform for a given Intent for a given user. |
| 4275 | * This is how {@link Intent#resolveActivity} finds an activity if a class |
| 4276 | * has not been explicitly specified. |
| 4277 | * <p> |
| 4278 | * <em>Note:</em> if using an implicit Intent (without an explicit |
| 4279 | * ComponentName specified), be sure to consider whether to set the |
| 4280 | * {@link #MATCH_DEFAULT_ONLY} only flag. You need to do so to resolve the |
| 4281 | * activity in the same way that |
| 4282 | * {@link android.content.Context#startActivity(Intent)} and |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4283 | * {@link android.content.Intent#resolveActivity(PackageManager) |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4284 | * Intent.resolveActivity(PackageManager)} do. |
| 4285 | * </p> |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4286 | * |
| 4287 | * @param intent An intent containing all of the desired specification |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4288 | * (action, data, type, category, and/or component). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4289 | * @param flags Additional option flags to modify the data returned. The |
| 4290 | * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the |
| 4291 | * resolution to only those activities that support the |
| 4292 | * {@link android.content.Intent#CATEGORY_DEFAULT}. |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4293 | * @param userId The user id. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 4294 | * @return Returns a ResolveInfo object containing the final activity intent |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4295 | * that was determined to be the best action. Returns null if no |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4296 | * matching activity was found. If multiple matching activities are |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 4297 | * found and there is no default set, returns a ResolveInfo object |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4298 | * containing something else, such as the activity resolver. |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4299 | * @hide |
| 4300 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 4301 | @UnsupportedAppUsage |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4302 | public abstract ResolveInfo resolveActivityAsUser(Intent intent, @ResolveInfoFlags int flags, |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 4303 | @UserIdInt int userId); |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4304 | |
| 4305 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4306 | * Retrieve all activities that can be performed for the given intent. |
| 4307 | * |
| 4308 | * @param intent The desired intent as per resolveActivity(). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4309 | * @param flags Additional option flags to modify the data returned. The |
| 4310 | * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the |
| 4311 | * resolution to only those activities that support the |
| 4312 | * {@link android.content.Intent#CATEGORY_DEFAULT}. Or, set |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4313 | * {@link #MATCH_ALL} to prevent any filtering of the results. |
| 4314 | * @return Returns a List of ResolveInfo objects containing one entry for |
| 4315 | * each matching activity, ordered from best to worst. In other |
| 4316 | * words, the first item is what would be returned by |
| 4317 | * {@link #resolveActivity}. If there are no matching activities, an |
| 4318 | * empty list is returned. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4319 | */ |
| 4320 | public abstract List<ResolveInfo> queryIntentActivities(Intent intent, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4321 | @ResolveInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4322 | |
| 4323 | /** |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4324 | * Retrieve all activities that can be performed for the given intent, for a |
| 4325 | * specific user. |
Amith Yamasani | 151ec4c | 2012-09-07 19:25:16 -0700 | [diff] [blame] | 4326 | * |
| 4327 | * @param intent The desired intent as per resolveActivity(). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4328 | * @param flags Additional option flags to modify the data returned. The |
| 4329 | * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the |
| 4330 | * resolution to only those activities that support the |
| 4331 | * {@link android.content.Intent#CATEGORY_DEFAULT}. Or, set |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4332 | * {@link #MATCH_ALL} to prevent any filtering of the results. |
| 4333 | * @return Returns a List of ResolveInfo objects containing one entry for |
| 4334 | * each matching activity, ordered from best to worst. In other |
| 4335 | * words, the first item is what would be returned by |
| 4336 | * {@link #resolveActivity}. If there are no matching activities, an |
| 4337 | * empty list is returned. |
Amith Yamasani | 151ec4c | 2012-09-07 19:25:16 -0700 | [diff] [blame] | 4338 | * @hide |
| 4339 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 4340 | @UnsupportedAppUsage |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4341 | public abstract List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent, |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 4342 | @ResolveInfoFlags int flags, @UserIdInt int userId); |
Amith Yamasani | 151ec4c | 2012-09-07 19:25:16 -0700 | [diff] [blame] | 4343 | |
| 4344 | /** |
Hai Zhang | 8c7e93b | 2018-12-11 18:34:06 -0800 | [diff] [blame] | 4345 | * Retrieve all activities that can be performed for the given intent, for a |
| 4346 | * specific user. |
| 4347 | * |
| 4348 | * @param intent The desired intent as per resolveActivity(). |
| 4349 | * @param flags Additional option flags to modify the data returned. The |
| 4350 | * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the |
| 4351 | * resolution to only those activities that support the |
| 4352 | * {@link android.content.Intent#CATEGORY_DEFAULT}. Or, set |
| 4353 | * {@link #MATCH_ALL} to prevent any filtering of the results. |
| 4354 | * @param user The user being queried. |
| 4355 | * @return Returns a List of ResolveInfo objects containing one entry for |
| 4356 | * each matching activity, ordered from best to worst. In other |
| 4357 | * words, the first item is what would be returned by |
| 4358 | * {@link #resolveActivity}. If there are no matching activities, an |
| 4359 | * empty list is returned. |
| 4360 | * @hide |
| 4361 | */ |
| 4362 | @NonNull |
| 4363 | @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS) |
| 4364 | @SystemApi |
| 4365 | public List<ResolveInfo> queryIntentActivitiesAsUser(@NonNull Intent intent, |
| 4366 | @ResolveInfoFlags int flags, @NonNull UserHandle user) { |
| 4367 | return queryIntentActivitiesAsUser(intent, flags, user.getIdentifier()); |
| 4368 | } |
| 4369 | |
| 4370 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4371 | * 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] | 4372 | * similar options. This is like {@link #queryIntentActivities}, except it |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4373 | * also allows you to supply a list of more explicit Intents that you would |
| 4374 | * like to resolve to particular options, and takes care of returning the |
| 4375 | * final ResolveInfo list in a reasonable order, with no duplicates, based |
| 4376 | * on those inputs. |
| 4377 | * |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4378 | * @param caller The class name of the activity that is making the request. |
| 4379 | * This activity will never appear in the output list. Can be |
| 4380 | * null. |
| 4381 | * @param specifics An array of Intents that should be resolved to the first |
| 4382 | * specific results. Can be null. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4383 | * @param intent The desired intent as per resolveActivity(). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4384 | * @param flags Additional option flags to modify the data returned. The |
| 4385 | * most important is {@link #MATCH_DEFAULT_ONLY}, to limit the |
| 4386 | * resolution to only those activities that support the |
| 4387 | * {@link android.content.Intent#CATEGORY_DEFAULT}. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4388 | * @return Returns a List of ResolveInfo objects containing one entry for |
| 4389 | * each matching activity. The list is ordered first by all of the |
| 4390 | * intents resolved in <var>specifics</var> and then any additional |
| 4391 | * activities that can handle <var>intent</var> but did not get |
| 4392 | * included by one of the <var>specifics</var> intents. If there are |
| 4393 | * no matching activities, an empty list is returned. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4394 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 4395 | public abstract List<ResolveInfo> queryIntentActivityOptions(@Nullable ComponentName caller, |
| 4396 | @Nullable Intent[] specifics, Intent intent, @ResolveInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4397 | |
| 4398 | /** |
| 4399 | * Retrieve all receivers that can handle a broadcast of the given intent. |
| 4400 | * |
| 4401 | * @param intent The desired intent as per resolveActivity(). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4402 | * @param flags Additional option flags to modify the data returned. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4403 | * @return Returns a List of ResolveInfo objects containing one entry for |
| 4404 | * each matching receiver, ordered from best to worst. If there are |
| 4405 | * 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] | 4406 | */ |
| 4407 | public abstract List<ResolveInfo> queryBroadcastReceivers(Intent intent, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4408 | @ResolveInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4409 | |
| 4410 | /** |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4411 | * Retrieve all receivers that can handle a broadcast of the given intent, |
| 4412 | * for a specific user. |
Amith Yamasani | f203aee | 2012-08-29 18:41:53 -0700 | [diff] [blame] | 4413 | * |
| 4414 | * @param intent The desired intent as per resolveActivity(). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4415 | * @param flags Additional option flags to modify the data returned. |
Fyodor Kupolov | 940e857 | 2016-01-26 12:03:51 -0800 | [diff] [blame] | 4416 | * @param userHandle UserHandle of the user being queried. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4417 | * @return Returns a List of ResolveInfo objects containing one entry for |
| 4418 | * each matching receiver, ordered from best to worst. If there are |
| 4419 | * no matching receivers, an empty list or null is returned. |
Amith Yamasani | f203aee | 2012-08-29 18:41:53 -0700 | [diff] [blame] | 4420 | * @hide |
| 4421 | */ |
Fyodor Kupolov | 940e857 | 2016-01-26 12:03:51 -0800 | [diff] [blame] | 4422 | @SystemApi |
Todd Kennedy | dbaef6d | 2017-07-24 11:28:00 -0700 | [diff] [blame] | 4423 | @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS) |
Fyodor Kupolov | 940e857 | 2016-01-26 12:03:51 -0800 | [diff] [blame] | 4424 | public List<ResolveInfo> queryBroadcastReceiversAsUser(Intent intent, |
| 4425 | @ResolveInfoFlags int flags, UserHandle userHandle) { |
| 4426 | return queryBroadcastReceiversAsUser(intent, flags, userHandle.getIdentifier()); |
| 4427 | } |
| 4428 | |
| 4429 | /** |
| 4430 | * @hide |
| 4431 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 4432 | @UnsupportedAppUsage |
Jeff Sharkey | e06b4d1 | 2016-01-06 14:51:50 -0700 | [diff] [blame] | 4433 | public abstract List<ResolveInfo> queryBroadcastReceiversAsUser(Intent intent, |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 4434 | @ResolveInfoFlags int flags, @UserIdInt int userId); |
Amith Yamasani | f203aee | 2012-08-29 18:41:53 -0700 | [diff] [blame] | 4435 | |
Fyodor Kupolov | 940e857 | 2016-01-26 12:03:51 -0800 | [diff] [blame] | 4436 | |
Jeff Sharkey | bd94022 | 2016-01-08 11:07:13 -0700 | [diff] [blame] | 4437 | /** {@hide} */ |
| 4438 | @Deprecated |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 4439 | @UnsupportedAppUsage |
Jeff Sharkey | bd94022 | 2016-01-08 11:07:13 -0700 | [diff] [blame] | 4440 | public List<ResolveInfo> queryBroadcastReceivers(Intent intent, |
| 4441 | @ResolveInfoFlags int flags, @UserIdInt int userId) { |
Jeff Sharkey | 6f4b2a3 | 2017-03-21 14:13:41 -0600 | [diff] [blame] | 4442 | final String msg = "Shame on you for calling the hidden API " |
| 4443 | + "queryBroadcastReceivers(). Shame!"; |
| 4444 | if (VMRuntime.getRuntime().getTargetSdkVersion() >= Build.VERSION_CODES.O) { |
| 4445 | throw new UnsupportedOperationException(msg); |
| 4446 | } else { |
| 4447 | Log.d(TAG, msg); |
| 4448 | return queryBroadcastReceiversAsUser(intent, flags, userId); |
| 4449 | } |
Jeff Sharkey | bd94022 | 2016-01-08 11:07:13 -0700 | [diff] [blame] | 4450 | } |
| 4451 | |
Amith Yamasani | f203aee | 2012-08-29 18:41:53 -0700 | [diff] [blame] | 4452 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4453 | * Determine the best service to handle for a given Intent. |
| 4454 | * |
| 4455 | * @param intent An intent containing all of the desired specification |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4456 | * (action, data, type, category, and/or component). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4457 | * @param flags Additional option flags to modify the data returned. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 4458 | * @return Returns a ResolveInfo object containing the final service intent |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4459 | * 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] | 4460 | * matching service was found. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4461 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4462 | public abstract ResolveInfo resolveService(Intent intent, @ResolveInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4463 | |
| 4464 | /** |
Philip P. Moltmann | 18e3eb8 | 2018-03-09 16:55:55 -0800 | [diff] [blame] | 4465 | * @hide |
| 4466 | */ |
| 4467 | public abstract ResolveInfo resolveServiceAsUser(Intent intent, @ResolveInfoFlags int flags, |
| 4468 | @UserIdInt int userId); |
| 4469 | |
| 4470 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4471 | * Retrieve all services that can match the given intent. |
| 4472 | * |
| 4473 | * @param intent The desired intent as per resolveService(). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4474 | * @param flags Additional option flags to modify the data returned. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4475 | * @return Returns a List of ResolveInfo objects containing one entry for |
| 4476 | * each matching service, ordered from best to worst. In other |
| 4477 | * words, the first item is what would be returned by |
| 4478 | * {@link #resolveService}. If there are no matching services, an |
| 4479 | * empty list or null is returned. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4480 | */ |
| 4481 | public abstract List<ResolveInfo> queryIntentServices(Intent intent, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4482 | @ResolveInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4483 | |
| 4484 | /** |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4485 | * Retrieve all services that can match the given intent for a given user. |
| 4486 | * |
| 4487 | * @param intent The desired intent as per resolveService(). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4488 | * @param flags Additional option flags to modify the data returned. |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4489 | * @param userId The user id. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4490 | * @return Returns a List of ResolveInfo objects containing one entry for |
| 4491 | * each matching service, ordered from best to worst. In other |
| 4492 | * words, the first item is what would be returned by |
| 4493 | * {@link #resolveService}. If there are no matching services, an |
| 4494 | * empty list or null is returned. |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4495 | * @hide |
| 4496 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 4497 | @UnsupportedAppUsage |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4498 | public abstract List<ResolveInfo> queryIntentServicesAsUser(Intent intent, |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 4499 | @ResolveInfoFlags int flags, @UserIdInt int userId); |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4500 | |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 4501 | /** |
Hai Zhang | 8c7e93b | 2018-12-11 18:34:06 -0800 | [diff] [blame] | 4502 | * Retrieve all services that can match the given intent for a given user. |
| 4503 | * |
| 4504 | * @param intent The desired intent as per resolveService(). |
| 4505 | * @param flags Additional option flags to modify the data returned. |
| 4506 | * @param user The user being queried. |
| 4507 | * @return Returns a List of ResolveInfo objects containing one entry for |
| 4508 | * each matching service, ordered from best to worst. In other |
| 4509 | * words, the first item is what would be returned by |
| 4510 | * {@link #resolveService}. If there are no matching services, an |
| 4511 | * empty list or null is returned. |
| 4512 | * @hide |
| 4513 | */ |
| 4514 | @NonNull |
| 4515 | @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS) |
| 4516 | @SystemApi |
| 4517 | public List<ResolveInfo> queryIntentServicesAsUser(@NonNull Intent intent, |
| 4518 | @ResolveInfoFlags int flags, @NonNull UserHandle user) { |
| 4519 | return queryIntentServicesAsUser(intent, flags, user.getIdentifier()); |
| 4520 | } |
| 4521 | |
| 4522 | /** |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 4523 | * Retrieve all providers that can match the given intent. |
| 4524 | * |
| 4525 | * @param intent An intent containing all of the desired specification |
| 4526 | * (action, data, type, category, and/or component). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4527 | * @param flags Additional option flags to modify the data returned. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 4528 | * @param userId The user id. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4529 | * @return Returns a List of ResolveInfo objects containing one entry for |
| 4530 | * each matching provider, ordered from best to worst. If there are |
| 4531 | * no matching services, an empty list or null is returned. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 4532 | * @hide |
| 4533 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 4534 | @UnsupportedAppUsage |
Jeff Sharkey | 85f5f81 | 2013-10-07 10:16:12 -0700 | [diff] [blame] | 4535 | public abstract List<ResolveInfo> queryIntentContentProvidersAsUser( |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 4536 | Intent intent, @ResolveInfoFlags int flags, @UserIdInt int userId); |
Jeff Sharkey | 85f5f81 | 2013-10-07 10:16:12 -0700 | [diff] [blame] | 4537 | |
| 4538 | /** |
| 4539 | * Retrieve all providers that can match the given intent. |
| 4540 | * |
| 4541 | * @param intent An intent containing all of the desired specification |
| 4542 | * (action, data, type, category, and/or component). |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4543 | * @param flags Additional option flags to modify the data returned. |
Hai Zhang | 8c7e93b | 2018-12-11 18:34:06 -0800 | [diff] [blame] | 4544 | * @param user The user being queried. |
| 4545 | * @return Returns a List of ResolveInfo objects containing one entry for |
| 4546 | * each matching provider, ordered from best to worst. If there are |
| 4547 | * no matching services, an empty list or null is returned. |
| 4548 | * @hide |
| 4549 | */ |
| 4550 | @NonNull |
| 4551 | @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS) |
| 4552 | @SystemApi |
| 4553 | public List<ResolveInfo> queryIntentContentProvidersAsUser(@NonNull Intent intent, |
| 4554 | @ResolveInfoFlags int flags, @NonNull UserHandle user) { |
| 4555 | return queryIntentContentProvidersAsUser(intent, flags, user.getIdentifier()); |
| 4556 | } |
| 4557 | |
| 4558 | /** |
| 4559 | * Retrieve all providers that can match the given intent. |
| 4560 | * |
| 4561 | * @param intent An intent containing all of the desired specification |
| 4562 | * (action, data, type, category, and/or component). |
| 4563 | * @param flags Additional option flags to modify the data returned. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4564 | * @return Returns a List of ResolveInfo objects containing one entry for |
| 4565 | * each matching provider, ordered from best to worst. If there are |
| 4566 | * no matching services, an empty list or null is returned. |
Jeff Sharkey | 85f5f81 | 2013-10-07 10:16:12 -0700 | [diff] [blame] | 4567 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4568 | public abstract List<ResolveInfo> queryIntentContentProviders(Intent intent, |
| 4569 | @ResolveInfoFlags int flags); |
Jeff Sharkey | 85f5f81 | 2013-10-07 10:16:12 -0700 | [diff] [blame] | 4570 | |
Svetoslav Ganov | 58d37b5 | 2012-09-18 12:04:19 -0700 | [diff] [blame] | 4571 | /** |
Todd Kennedy | 5fdbabb | 2018-03-07 15:59:41 -0800 | [diff] [blame] | 4572 | * Find a single content provider by its authority. |
| 4573 | * <p> |
| 4574 | * Example:<p> |
| 4575 | * <pre> |
| 4576 | * Uri uri = Uri.parse("content://com.example.app.provider/table1"); |
| 4577 | * ProviderInfo info = packageManager.resolveContentProvider(uri.getAuthority(), flags); |
| 4578 | * </pre> |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4579 | * |
Todd Kennedy | 5fdbabb | 2018-03-07 15:59:41 -0800 | [diff] [blame] | 4580 | * @param authority The authority of the provider to find. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4581 | * @param flags Additional option flags to modify the data returned. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4582 | * @return A {@link ProviderInfo} object containing information about the |
| 4583 | * provider. If a provider was not found, returns null. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4584 | */ |
Todd Kennedy | 5fdbabb | 2018-03-07 15:59:41 -0800 | [diff] [blame] | 4585 | public abstract ProviderInfo resolveContentProvider(String authority, |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4586 | @ComponentInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4587 | |
| 4588 | /** |
Alexandra Gherghina | 0363c3e | 2014-06-23 13:34:59 +0100 | [diff] [blame] | 4589 | * Find a single content provider by its base path name. |
| 4590 | * |
| 4591 | * @param name The name of the provider to find. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4592 | * @param flags Additional option flags to modify the data returned. |
Alexandra Gherghina | 0363c3e | 2014-06-23 13:34:59 +0100 | [diff] [blame] | 4593 | * @param userId The user id. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4594 | * @return A {@link ProviderInfo} object containing information about the |
| 4595 | * provider. If a provider was not found, returns null. |
Alexandra Gherghina | 0363c3e | 2014-06-23 13:34:59 +0100 | [diff] [blame] | 4596 | * @hide |
| 4597 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 4598 | @UnsupportedAppUsage |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4599 | public abstract ProviderInfo resolveContentProviderAsUser(String name, |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 4600 | @ComponentInfoFlags int flags, @UserIdInt int userId); |
Alexandra Gherghina | 0363c3e | 2014-06-23 13:34:59 +0100 | [diff] [blame] | 4601 | |
| 4602 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4603 | * Retrieve content provider information. |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4604 | * <p> |
| 4605 | * <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] | 4606 | * by a null return instead of an empty list.</em> |
| 4607 | * |
| 4608 | * @param processName If non-null, limits the returned providers to only |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 4609 | * those that are hosted by the given process. If null, all |
| 4610 | * content providers are returned. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4611 | * @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] | 4612 | * uid owning the requested content providers. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4613 | * @param flags Additional option flags to modify the data returned. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 4614 | * @return A list of {@link ProviderInfo} objects containing one entry for |
| 4615 | * each provider either matching <var>processName</var> or, if |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4616 | * <var>processName</var> is null, all known content providers. |
| 4617 | * <em>If there are no matching providers, null is returned.</em> |
| 4618 | */ |
| 4619 | public abstract List<ProviderInfo> queryContentProviders( |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4620 | String processName, int uid, @ComponentInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4621 | |
| 4622 | /** |
Makoto Onuki | 3275729 | 2017-02-22 14:36:59 -0800 | [diff] [blame] | 4623 | * Same as {@link #queryContentProviders}, except when {@code metaDataKey} is not null, |
| 4624 | * it only returns providers which have metadata with the {@code metaDataKey} key. |
| 4625 | * |
| 4626 | * <p>DO NOT USE the {@code metaDataKey} parameter, unless you're the contacts provider. |
| 4627 | * You really shouldn't need it. Other apps should use {@link #queryIntentContentProviders} |
| 4628 | * instead. |
| 4629 | * |
| 4630 | * <p>The {@code metaDataKey} parameter was added to allow the contacts provider to quickly |
| 4631 | * scan the GAL providers on the device. Unfortunately the discovery protocol used metadata |
| 4632 | * to mark GAL providers, rather than intent filters, so we can't use |
| 4633 | * {@link #queryIntentContentProviders} for that. |
| 4634 | * |
| 4635 | * @hide |
| 4636 | */ |
| 4637 | public List<ProviderInfo> queryContentProviders( |
| 4638 | String processName, int uid, @ComponentInfoFlags int flags, String metaDataKey) { |
| 4639 | // Provide the default implementation for mocks. |
| 4640 | return queryContentProviders(processName, uid, flags); |
| 4641 | } |
| 4642 | |
| 4643 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4644 | * Retrieve all of the information we know about a particular |
| 4645 | * instrumentation class. |
| 4646 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4647 | * @param className The full name (i.e. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4648 | * com.google.apps.contacts.InstrumentList) of an Instrumentation |
| 4649 | * class. |
| 4650 | * @param flags Additional option flags to modify the data returned. |
| 4651 | * @return An {@link InstrumentationInfo} object containing information |
| 4652 | * about the instrumentation. |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 4653 | * @throws NameNotFoundException if a package with the given name cannot be |
| 4654 | * found on the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4655 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4656 | public abstract InstrumentationInfo getInstrumentationInfo(ComponentName className, |
| 4657 | @InstrumentationInfoFlags int flags) throws NameNotFoundException; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4658 | |
| 4659 | /** |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4660 | * Retrieve information about available instrumentation code. May be used to |
| 4661 | * retrieve either all instrumentation code, or only the code targeting a |
| 4662 | * particular package. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4663 | * |
| 4664 | * @param targetPackage If null, all instrumentation is returned; only the |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 4665 | * instrumentation targeting this package name is returned. |
| 4666 | * @param flags Additional option flags to modify the data returned. |
Todd Kennedy | 6b9bfa1 | 2016-01-08 13:44:51 -0800 | [diff] [blame] | 4667 | * @return A list of {@link InstrumentationInfo} objects containing one |
| 4668 | * entry for each matching instrumentation. If there are no |
Jesse Hall | f77a34f | 2016-02-04 18:41:33 -0800 | [diff] [blame] | 4669 | * instrumentation available, returns an empty list. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4670 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 4671 | public abstract List<InstrumentationInfo> queryInstrumentation(String targetPackage, |
| 4672 | @InstrumentationInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4673 | |
| 4674 | /** |
| 4675 | * Retrieve an image from a package. This is a low-level API used by |
| 4676 | * the various package manager info structures (such as |
| 4677 | * {@link ComponentInfo} to implement retrieval of their associated |
| 4678 | * icon. |
| 4679 | * |
| 4680 | * @param packageName The name of the package that this icon is coming from. |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4681 | * Cannot be null. |
| 4682 | * @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] | 4683 | * @param appInfo Overall information about <var>packageName</var>. This |
| 4684 | * may be null, in which case the application information will be retrieved |
| 4685 | * for you if needed; if you already have this information around, it can |
| 4686 | * be much more efficient to supply it here. |
| 4687 | * |
| 4688 | * @return Returns a Drawable holding the requested image. Returns null if |
| 4689 | * an image could not be found for any reason. |
| 4690 | */ |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 4691 | public abstract Drawable getDrawable(String packageName, @DrawableRes int resid, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4692 | ApplicationInfo appInfo); |
| 4693 | |
| 4694 | /** |
| 4695 | * Retrieve the icon associated with an activity. Given the full name of |
| 4696 | * an activity, retrieves the information about it and calls |
| 4697 | * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its icon. |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4698 | * If the activity cannot be found, NameNotFoundException is thrown. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4699 | * |
| 4700 | * @param activityName Name of the activity whose icon is to be retrieved. |
| 4701 | * |
| 4702 | * @return Returns the image of the icon, or the default activity icon if |
| 4703 | * it could not be found. Does not return null. |
| 4704 | * @throws NameNotFoundException Thrown if the resources for the given |
| 4705 | * activity could not be loaded. |
| 4706 | * |
| 4707 | * @see #getActivityIcon(Intent) |
| 4708 | */ |
| 4709 | public abstract Drawable getActivityIcon(ComponentName activityName) |
| 4710 | throws NameNotFoundException; |
| 4711 | |
| 4712 | /** |
| 4713 | * Retrieve the icon associated with an Intent. If intent.getClassName() is |
| 4714 | * set, this simply returns the result of |
| 4715 | * getActivityIcon(intent.getClassName()). Otherwise it resolves the intent's |
| 4716 | * component and returns the icon associated with the resolved component. |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4717 | * 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] | 4718 | * to a component, NameNotFoundException is thrown. |
| 4719 | * |
| 4720 | * @param intent The intent for which you would like to retrieve an icon. |
| 4721 | * |
| 4722 | * @return Returns the image of the icon, or the default activity icon if |
| 4723 | * it could not be found. Does not return null. |
| 4724 | * @throws NameNotFoundException Thrown if the resources for application |
| 4725 | * matching the given intent could not be loaded. |
| 4726 | * |
| 4727 | * @see #getActivityIcon(ComponentName) |
| 4728 | */ |
| 4729 | public abstract Drawable getActivityIcon(Intent intent) |
| 4730 | throws NameNotFoundException; |
| 4731 | |
| 4732 | /** |
Jose Lima | f78e312 | 2014-03-06 12:13:15 -0800 | [diff] [blame] | 4733 | * Retrieve the banner associated with an activity. Given the full name of |
| 4734 | * an activity, retrieves the information about it and calls |
| 4735 | * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its |
| 4736 | * banner. If the activity cannot be found, NameNotFoundException is thrown. |
| 4737 | * |
| 4738 | * @param activityName Name of the activity whose banner is to be retrieved. |
| 4739 | * @return Returns the image of the banner, or null if the activity has no |
| 4740 | * banner specified. |
| 4741 | * @throws NameNotFoundException Thrown if the resources for the given |
| 4742 | * activity could not be loaded. |
| 4743 | * @see #getActivityBanner(Intent) |
| 4744 | */ |
| 4745 | public abstract Drawable getActivityBanner(ComponentName activityName) |
| 4746 | throws NameNotFoundException; |
| 4747 | |
| 4748 | /** |
| 4749 | * Retrieve the banner associated with an Intent. If intent.getClassName() |
| 4750 | * is set, this simply returns the result of |
| 4751 | * getActivityBanner(intent.getClassName()). Otherwise it resolves the |
| 4752 | * intent's component and returns the banner associated with the resolved |
| 4753 | * component. If intent.getClassName() cannot be found or the Intent cannot |
| 4754 | * be resolved to a component, NameNotFoundException is thrown. |
| 4755 | * |
| 4756 | * @param intent The intent for which you would like to retrieve a banner. |
| 4757 | * @return Returns the image of the banner, or null if the activity has no |
| 4758 | * banner specified. |
| 4759 | * @throws NameNotFoundException Thrown if the resources for application |
| 4760 | * matching the given intent could not be loaded. |
| 4761 | * @see #getActivityBanner(ComponentName) |
| 4762 | */ |
| 4763 | public abstract Drawable getActivityBanner(Intent intent) |
| 4764 | throws NameNotFoundException; |
| 4765 | |
| 4766 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4767 | * Return the generic icon for an activity that is used when no specific |
| 4768 | * icon is defined. |
Adam Connors | 23cc04e | 2014-04-01 12:12:20 +0100 | [diff] [blame] | 4769 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4770 | * @return Drawable Image of the icon. |
| 4771 | */ |
| 4772 | public abstract Drawable getDefaultActivityIcon(); |
| 4773 | |
| 4774 | /** |
| 4775 | * Retrieve the icon associated with an application. If it has not defined |
| 4776 | * an icon, the default app icon is returned. Does not return null. |
| 4777 | * |
| 4778 | * @param info Information about application being queried. |
| 4779 | * |
| 4780 | * @return Returns the image of the icon, or the default application icon |
| 4781 | * if it could not be found. |
| 4782 | * |
| 4783 | * @see #getApplicationIcon(String) |
| 4784 | */ |
| 4785 | public abstract Drawable getApplicationIcon(ApplicationInfo info); |
| 4786 | |
| 4787 | /** |
| 4788 | * Retrieve the icon associated with an application. Given the name of the |
| 4789 | * application's package, retrieves the information about it and calls |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4790 | * 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] | 4791 | * found, NameNotFoundException is thrown. |
| 4792 | * |
| 4793 | * @param packageName Name of the package whose application icon is to be |
| 4794 | * retrieved. |
| 4795 | * |
| 4796 | * @return Returns the image of the icon, or the default application icon |
| 4797 | * if it could not be found. Does not return null. |
| 4798 | * @throws NameNotFoundException Thrown if the resources for the given |
| 4799 | * application could not be loaded. |
| 4800 | * |
| 4801 | * @see #getApplicationIcon(ApplicationInfo) |
| 4802 | */ |
| 4803 | public abstract Drawable getApplicationIcon(String packageName) |
| 4804 | throws NameNotFoundException; |
| 4805 | |
| 4806 | /** |
Jose Lima | f78e312 | 2014-03-06 12:13:15 -0800 | [diff] [blame] | 4807 | * Retrieve the banner associated with an application. |
| 4808 | * |
| 4809 | * @param info Information about application being queried. |
| 4810 | * @return Returns the image of the banner or null if the application has no |
| 4811 | * banner specified. |
| 4812 | * @see #getApplicationBanner(String) |
| 4813 | */ |
| 4814 | public abstract Drawable getApplicationBanner(ApplicationInfo info); |
| 4815 | |
| 4816 | /** |
| 4817 | * Retrieve the banner associated with an application. Given the name of the |
| 4818 | * application's package, retrieves the information about it and calls |
| 4819 | * getApplicationIcon() to return its banner. If the application cannot be |
| 4820 | * found, NameNotFoundException is thrown. |
| 4821 | * |
| 4822 | * @param packageName Name of the package whose application banner is to be |
| 4823 | * retrieved. |
| 4824 | * @return Returns the image of the banner or null if the application has no |
| 4825 | * banner specified. |
| 4826 | * @throws NameNotFoundException Thrown if the resources for the given |
| 4827 | * application could not be loaded. |
| 4828 | * @see #getApplicationBanner(ApplicationInfo) |
| 4829 | */ |
| 4830 | public abstract Drawable getApplicationBanner(String packageName) |
| 4831 | throws NameNotFoundException; |
| 4832 | |
| 4833 | /** |
| 4834 | * Retrieve the logo associated with an activity. Given the full name of an |
| 4835 | * activity, retrieves the information about it and calls |
| 4836 | * {@link ComponentInfo#loadLogo ComponentInfo.loadLogo()} to return its |
| 4837 | * logo. If the activity cannot be found, NameNotFoundException is thrown. |
Adam Powell | 81cd2e9 | 2010-04-21 16:35:18 -0700 | [diff] [blame] | 4838 | * |
| 4839 | * @param activityName Name of the activity whose logo is to be retrieved. |
Jose Lima | f78e312 | 2014-03-06 12:13:15 -0800 | [diff] [blame] | 4840 | * @return Returns the image of the logo or null if the activity has no logo |
| 4841 | * specified. |
Adam Powell | 81cd2e9 | 2010-04-21 16:35:18 -0700 | [diff] [blame] | 4842 | * @throws NameNotFoundException Thrown if the resources for the given |
Jose Lima | f78e312 | 2014-03-06 12:13:15 -0800 | [diff] [blame] | 4843 | * activity could not be loaded. |
Adam Powell | 81cd2e9 | 2010-04-21 16:35:18 -0700 | [diff] [blame] | 4844 | * @see #getActivityLogo(Intent) |
| 4845 | */ |
| 4846 | public abstract Drawable getActivityLogo(ComponentName activityName) |
| 4847 | throws NameNotFoundException; |
| 4848 | |
| 4849 | /** |
| 4850 | * Retrieve the logo associated with an Intent. If intent.getClassName() is |
| 4851 | * set, this simply returns the result of |
| 4852 | * getActivityLogo(intent.getClassName()). Otherwise it resolves the intent's |
| 4853 | * component and returns the logo associated with the resolved component. |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4854 | * If intent.getClassName() cannot be found or the Intent cannot be resolved |
Adam Powell | 81cd2e9 | 2010-04-21 16:35:18 -0700 | [diff] [blame] | 4855 | * to a component, NameNotFoundException is thrown. |
| 4856 | * |
| 4857 | * @param intent The intent for which you would like to retrieve a logo. |
| 4858 | * |
| 4859 | * @return Returns the image of the logo, or null if the activity has no |
| 4860 | * logo specified. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 4861 | * |
Adam Powell | 81cd2e9 | 2010-04-21 16:35:18 -0700 | [diff] [blame] | 4862 | * @throws NameNotFoundException Thrown if the resources for application |
| 4863 | * matching the given intent could not be loaded. |
| 4864 | * |
| 4865 | * @see #getActivityLogo(ComponentName) |
| 4866 | */ |
| 4867 | public abstract Drawable getActivityLogo(Intent intent) |
| 4868 | throws NameNotFoundException; |
| 4869 | |
| 4870 | /** |
| 4871 | * Retrieve the logo associated with an application. If it has not specified |
| 4872 | * a logo, this method returns null. |
| 4873 | * |
| 4874 | * @param info Information about application being queried. |
| 4875 | * |
| 4876 | * @return Returns the image of the logo, or null if no logo is specified |
| 4877 | * by the application. |
| 4878 | * |
| 4879 | * @see #getApplicationLogo(String) |
| 4880 | */ |
| 4881 | public abstract Drawable getApplicationLogo(ApplicationInfo info); |
| 4882 | |
| 4883 | /** |
| 4884 | * Retrieve the logo associated with an application. Given the name of the |
| 4885 | * application's package, retrieves the information about it and calls |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 4886 | * getApplicationLogo() to return its logo. If the application cannot be |
Adam Powell | 81cd2e9 | 2010-04-21 16:35:18 -0700 | [diff] [blame] | 4887 | * found, NameNotFoundException is thrown. |
| 4888 | * |
| 4889 | * @param packageName Name of the package whose application logo is to be |
| 4890 | * retrieved. |
| 4891 | * |
| 4892 | * @return Returns the image of the logo, or null if no application logo |
| 4893 | * has been specified. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 4894 | * |
Adam Powell | 81cd2e9 | 2010-04-21 16:35:18 -0700 | [diff] [blame] | 4895 | * @throws NameNotFoundException Thrown if the resources for the given |
| 4896 | * application could not be loaded. |
| 4897 | * |
| 4898 | * @see #getApplicationLogo(ApplicationInfo) |
| 4899 | */ |
| 4900 | public abstract Drawable getApplicationLogo(String packageName) |
| 4901 | throws NameNotFoundException; |
| 4902 | |
| 4903 | /** |
Tony Mak | 4dc008c | 2016-03-16 10:46:49 +0000 | [diff] [blame] | 4904 | * If the target user is a managed profile, then this returns a badged copy of the given icon |
| 4905 | * 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] | 4906 | * {@link #getUserBadgedDrawableForDensity( |
Svetoslav | c7d62f0 | 2014-09-04 15:39:54 -0700 | [diff] [blame] | 4907 | * android.graphics.drawable.Drawable, UserHandle, android.graphics.Rect, int)}. |
| 4908 | * <p> |
| 4909 | * If the original drawable is a BitmapDrawable and the backing bitmap is |
| 4910 | * mutable as per {@link android.graphics.Bitmap#isMutable()}, the badging |
| 4911 | * is performed in place and the original drawable is returned. |
| 4912 | * </p> |
| 4913 | * |
| 4914 | * @param icon The icon to badge. |
| 4915 | * @param user The target user. |
| 4916 | * @return A drawable that combines the original icon and a badge as |
| 4917 | * determined by the system. |
| 4918 | */ |
| 4919 | public abstract Drawable getUserBadgedIcon(Drawable icon, UserHandle user); |
| 4920 | |
| 4921 | /** |
| 4922 | * If the target user is a managed profile of the calling user or the caller |
| 4923 | * is itself a managed profile, then this returns a badged copy of the given |
| 4924 | * drawable allowing the user to distinguish it from the original drawable. |
| 4925 | * The caller can specify the location in the bounds of the drawable to be |
| 4926 | * badged where the badge should be applied as well as the density of the |
| 4927 | * badge to be used. |
| 4928 | * <p> |
| 4929 | * If the original drawable is a BitmapDrawable and the backing bitmap is |
Vadim Tryshev | 66ae66a | 2016-02-18 15:41:21 -0800 | [diff] [blame] | 4930 | * mutable as per {@link android.graphics.Bitmap#isMutable()}, the badging |
Svetoslav | c7d62f0 | 2014-09-04 15:39:54 -0700 | [diff] [blame] | 4931 | * is performed in place and the original drawable is returned. |
| 4932 | * </p> |
| 4933 | * |
| 4934 | * @param drawable The drawable to badge. |
| 4935 | * @param user The target user. |
| 4936 | * @param badgeLocation Where in the bounds of the badged drawable to place |
Vadim Tryshev | 66ae66a | 2016-02-18 15:41:21 -0800 | [diff] [blame] | 4937 | * 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] | 4938 | * drawable being badged. |
| 4939 | * @param badgeDensity The optional desired density for the badge as per |
Vadim Tryshev | 66ae66a | 2016-02-18 15:41:21 -0800 | [diff] [blame] | 4940 | * {@link android.util.DisplayMetrics#densityDpi}. If it's not positive, |
Svetoslav | c7d62f0 | 2014-09-04 15:39:54 -0700 | [diff] [blame] | 4941 | * the density of the display is used. |
| 4942 | * @return A drawable that combines the original drawable and a badge as |
| 4943 | * determined by the system. |
| 4944 | */ |
| 4945 | public abstract Drawable getUserBadgedDrawableForDensity(Drawable drawable, |
| 4946 | UserHandle user, Rect badgeLocation, int badgeDensity); |
| 4947 | |
| 4948 | /** |
| 4949 | * If the target user is a managed profile of the calling user or the caller |
| 4950 | * is itself a managed profile, then this returns a drawable to use as a small |
| 4951 | * icon to include in a view to distinguish it from the original icon. |
| 4952 | * |
| 4953 | * @param user The target user. |
| 4954 | * @param density The optional desired density for the badge as per |
| 4955 | * {@link android.util.DisplayMetrics#densityDpi}. If not provided |
| 4956 | * the density of the current display is used. |
| 4957 | * @return the drawable or null if no drawable is required. |
| 4958 | * @hide |
| 4959 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 4960 | @UnsupportedAppUsage |
Svetoslav | c7d62f0 | 2014-09-04 15:39:54 -0700 | [diff] [blame] | 4961 | public abstract Drawable getUserBadgeForDensity(UserHandle user, int density); |
| 4962 | |
| 4963 | /** |
| 4964 | * 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] | 4965 | * is itself a managed profile, then this returns a drawable to use as a small |
| 4966 | * icon to include in a view to distinguish it from the original icon. This version |
| 4967 | * doesn't have background protection and should be used over a light background instead of |
| 4968 | * a badge. |
| 4969 | * |
| 4970 | * @param user The target user. |
| 4971 | * @param density The optional desired density for the badge as per |
| 4972 | * {@link android.util.DisplayMetrics#densityDpi}. If not provided |
| 4973 | * the density of the current display is used. |
| 4974 | * @return the drawable or null if no drawable is required. |
| 4975 | * @hide |
| 4976 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 4977 | @UnsupportedAppUsage |
Selim Cinek | e6ff946 | 2016-01-15 15:07:06 -0800 | [diff] [blame] | 4978 | public abstract Drawable getUserBadgeForDensityNoBackground(UserHandle user, int density); |
| 4979 | |
| 4980 | /** |
| 4981 | * 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] | 4982 | * is itself a managed profile, then this returns a copy of the label with |
| 4983 | * badging for accessibility services like talkback. E.g. passing in "Email" |
| 4984 | * and it might return "Work Email" for Email in the work profile. |
| 4985 | * |
| 4986 | * @param label The label to change. |
| 4987 | * @param user The target user. |
| 4988 | * @return A label that combines the original label and a badge as |
| 4989 | * determined by the system. |
| 4990 | */ |
| 4991 | public abstract CharSequence getUserBadgedLabel(CharSequence label, UserHandle user); |
| 4992 | |
| 4993 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4994 | * Retrieve text from a package. This is a low-level API used by |
| 4995 | * the various package manager info structures (such as |
| 4996 | * {@link ComponentInfo} to implement retrieval of their associated |
| 4997 | * labels and other text. |
| 4998 | * |
| 4999 | * @param packageName The name of the package that this text is coming from. |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 5000 | * Cannot be null. |
| 5001 | * @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] | 5002 | * @param appInfo Overall information about <var>packageName</var>. This |
| 5003 | * may be null, in which case the application information will be retrieved |
| 5004 | * for you if needed; if you already have this information around, it can |
| 5005 | * be much more efficient to supply it here. |
| 5006 | * |
| 5007 | * @return Returns a CharSequence holding the requested text. Returns null |
| 5008 | * if the text could not be found for any reason. |
| 5009 | */ |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 5010 | public abstract CharSequence getText(String packageName, @StringRes int resid, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5011 | ApplicationInfo appInfo); |
| 5012 | |
| 5013 | /** |
| 5014 | * Retrieve an XML file from a package. This is a low-level API used to |
| 5015 | * retrieve XML meta data. |
| 5016 | * |
| 5017 | * @param packageName The name of the package that this xml is coming from. |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 5018 | * Cannot be null. |
| 5019 | * @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] | 5020 | * @param appInfo Overall information about <var>packageName</var>. This |
| 5021 | * may be null, in which case the application information will be retrieved |
| 5022 | * for you if needed; if you already have this information around, it can |
| 5023 | * be much more efficient to supply it here. |
| 5024 | * |
| 5025 | * @return Returns an XmlPullParser allowing you to parse out the XML |
| 5026 | * data. Returns null if the xml resource could not be found for any |
| 5027 | * reason. |
| 5028 | */ |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 5029 | public abstract XmlResourceParser getXml(String packageName, @XmlRes int resid, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5030 | ApplicationInfo appInfo); |
| 5031 | |
| 5032 | /** |
| 5033 | * Return the label to use for this application. |
| 5034 | * |
| 5035 | * @return Returns the label associated with this application, or null if |
| 5036 | * it could not be found for any reason. |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 5037 | * @param info The application to get the label of. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5038 | */ |
| 5039 | public abstract CharSequence getApplicationLabel(ApplicationInfo info); |
| 5040 | |
| 5041 | /** |
| 5042 | * Retrieve the resources associated with an activity. Given the full |
| 5043 | * name of an activity, retrieves the information about it and calls |
| 5044 | * getResources() to return its application's resources. If the activity |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 5045 | * cannot be found, NameNotFoundException is thrown. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5046 | * |
| 5047 | * @param activityName Name of the activity whose resources are to be |
| 5048 | * retrieved. |
| 5049 | * |
| 5050 | * @return Returns the application's Resources. |
| 5051 | * @throws NameNotFoundException Thrown if the resources for the given |
| 5052 | * application could not be loaded. |
| 5053 | * |
| 5054 | * @see #getResourcesForApplication(ApplicationInfo) |
| 5055 | */ |
| 5056 | public abstract Resources getResourcesForActivity(ComponentName activityName) |
| 5057 | throws NameNotFoundException; |
| 5058 | |
| 5059 | /** |
| 5060 | * Retrieve the resources for an application. Throws NameNotFoundException |
| 5061 | * if the package is no longer installed. |
| 5062 | * |
| 5063 | * @param app Information about the desired application. |
| 5064 | * |
| 5065 | * @return Returns the application's Resources. |
| 5066 | * @throws NameNotFoundException Thrown if the resources for the given |
| 5067 | * application could not be loaded (most likely because it was uninstalled). |
| 5068 | */ |
| 5069 | public abstract Resources getResourcesForApplication(ApplicationInfo app) |
| 5070 | throws NameNotFoundException; |
| 5071 | |
| 5072 | /** |
| 5073 | * Retrieve the resources associated with an application. Given the full |
| 5074 | * package name of an application, retrieves the information about it and |
| 5075 | * calls getResources() to return its application's resources. If the |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 5076 | * appPackageName cannot be found, NameNotFoundException is thrown. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5077 | * |
| 5078 | * @param appPackageName Package name of the application whose resources |
| 5079 | * are to be retrieved. |
| 5080 | * |
| 5081 | * @return Returns the application's Resources. |
| 5082 | * @throws NameNotFoundException Thrown if the resources for the given |
| 5083 | * application could not be loaded. |
| 5084 | * |
| 5085 | * @see #getResourcesForApplication(ApplicationInfo) |
| 5086 | */ |
| 5087 | public abstract Resources getResourcesForApplication(String appPackageName) |
| 5088 | throws NameNotFoundException; |
| 5089 | |
Amith Yamasani | 98edc95 | 2012-09-25 14:09:27 -0700 | [diff] [blame] | 5090 | /** @hide */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 5091 | @UnsupportedAppUsage |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 5092 | public abstract Resources getResourcesForApplicationAsUser(String appPackageName, |
| 5093 | @UserIdInt int userId) throws NameNotFoundException; |
Amith Yamasani | 98edc95 | 2012-09-25 14:09:27 -0700 | [diff] [blame] | 5094 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5095 | /** |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 5096 | * Retrieve overall information about an application package defined in a |
| 5097 | * package archive file |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5098 | * |
| 5099 | * @param archiveFilePath The path to the archive file |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 5100 | * @param flags Additional option flags to modify the data returned. |
| 5101 | * @return A PackageInfo object containing information about the package |
| 5102 | * 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] | 5103 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 5104 | public PackageInfo getPackageArchiveInfo(String archiveFilePath, @PackageInfoFlags int flags) { |
Jeff Sharkey | 275e085 | 2014-06-17 18:18:49 -0700 | [diff] [blame] | 5105 | final PackageParser parser = new PackageParser(); |
Dianne Hackborn | cd154e9 | 2017-02-28 17:37:35 -0800 | [diff] [blame] | 5106 | parser.setCallback(new PackageParser.CallbackImpl(this)); |
Jeff Sharkey | 275e085 | 2014-06-17 18:18:49 -0700 | [diff] [blame] | 5107 | final File apkFile = new File(archiveFilePath); |
Jeff Sharkey | c4858a2 | 2014-06-16 10:51:20 -0700 | [diff] [blame] | 5108 | try { |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 5109 | if ((flags & (MATCH_DIRECT_BOOT_UNAWARE | MATCH_DIRECT_BOOT_AWARE)) != 0) { |
Jeff Sharkey | c313251 | 2016-01-12 14:06:58 -0700 | [diff] [blame] | 5110 | // Caller expressed an explicit opinion about what encryption |
| 5111 | // aware/unaware components they want to see, so fall through and |
| 5112 | // give them what they want |
| 5113 | } else { |
| 5114 | // Caller expressed no opinion, so match everything |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 5115 | flags |= MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE; |
Jeff Sharkey | c313251 | 2016-01-12 14:06:58 -0700 | [diff] [blame] | 5116 | } |
| 5117 | |
Jeff Sharkey | 275e085 | 2014-06-17 18:18:49 -0700 | [diff] [blame] | 5118 | PackageParser.Package pkg = parser.parseMonolithicPackage(apkFile, 0); |
Jeff Sharkey | c4858a2 | 2014-06-16 10:51:20 -0700 | [diff] [blame] | 5119 | if ((flags & GET_SIGNATURES) != 0) { |
Victor Hsieh | 5f76124 | 2018-01-20 10:30:12 -0800 | [diff] [blame] | 5120 | PackageParser.collectCertificates(pkg, false /* skipVerify */); |
Jeff Sharkey | c4858a2 | 2014-06-16 10:51:20 -0700 | [diff] [blame] | 5121 | } |
| 5122 | PackageUserState state = new PackageUserState(); |
| 5123 | return PackageParser.generatePackageInfo(pkg, null, flags, 0, 0, null, state); |
| 5124 | } catch (PackageParserException e) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5125 | return null; |
| 5126 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5127 | } |
| 5128 | |
| 5129 | /** |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 5130 | * If there is already an application with the given package name installed |
| 5131 | * on the system for other users, also install it for the calling user. |
| 5132 | * @hide |
Chandan Nath | e8e463b | 2019-01-28 15:23:38 +0000 | [diff] [blame] | 5133 | * |
| 5134 | * @deprecated use {@link PackageInstaller#installExistingPackage()} instead. |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 5135 | */ |
Chandan Nath | e8e463b | 2019-01-28 15:23:38 +0000 | [diff] [blame] | 5136 | @Deprecated |
Sunny Goyal | 07f41fb | 2017-08-09 02:56:34 -0700 | [diff] [blame] | 5137 | @SystemApi |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 5138 | public abstract int installExistingPackage(String packageName) throws NameNotFoundException; |
| 5139 | |
| 5140 | /** |
| 5141 | * If there is already an application with the given package name installed |
Sunny Goyal | a31a74b | 2017-05-11 15:59:19 -0700 | [diff] [blame] | 5142 | * on the system for other users, also install it for the calling user. |
| 5143 | * @hide |
Chandan Nath | e8e463b | 2019-01-28 15:23:38 +0000 | [diff] [blame] | 5144 | * |
| 5145 | * @deprecated use {@link PackageInstaller#installExistingPackage()} instead. |
Sunny Goyal | a31a74b | 2017-05-11 15:59:19 -0700 | [diff] [blame] | 5146 | */ |
Chandan Nath | e8e463b | 2019-01-28 15:23:38 +0000 | [diff] [blame] | 5147 | @Deprecated |
Sunny Goyal | 07f41fb | 2017-08-09 02:56:34 -0700 | [diff] [blame] | 5148 | @SystemApi |
Sunny Goyal | a31a74b | 2017-05-11 15:59:19 -0700 | [diff] [blame] | 5149 | public abstract int installExistingPackage(String packageName, @InstallReason int installReason) |
| 5150 | throws NameNotFoundException; |
| 5151 | |
| 5152 | /** |
| 5153 | * If there is already an application with the given package name installed |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 5154 | * on the system for other users, also install it for the specified user. |
| 5155 | * @hide |
Chandan Nath | e8e463b | 2019-01-28 15:23:38 +0000 | [diff] [blame] | 5156 | * |
| 5157 | * @deprecated use {@link PackageInstaller#installExistingPackage()} instead. |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 5158 | */ |
Chandan Nath | e8e463b | 2019-01-28 15:23:38 +0000 | [diff] [blame] | 5159 | @Deprecated |
Rhed Jao | cd47c26 | 2018-06-13 11:16:16 +0800 | [diff] [blame] | 5160 | @RequiresPermission(anyOf = { |
| 5161 | Manifest.permission.INSTALL_EXISTING_PACKAGES, |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 5162 | Manifest.permission.INSTALL_PACKAGES, |
| 5163 | Manifest.permission.INTERACT_ACROSS_USERS_FULL}) |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 5164 | @UnsupportedAppUsage |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 5165 | public abstract int installExistingPackageAsUser(String packageName, @UserIdInt int userId) |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 5166 | throws NameNotFoundException; |
| 5167 | |
| 5168 | /** |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 5169 | * Allows a package listening to the |
| 5170 | * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification |
Kenny Root | 3a9b5fb | 2011-09-20 14:15:38 -0700 | [diff] [blame] | 5171 | * broadcast} to respond to the package manager. The response must include |
| 5172 | * the {@code verificationCode} which is one of |
| 5173 | * {@link PackageManager#VERIFICATION_ALLOW} or |
| 5174 | * {@link PackageManager#VERIFICATION_REJECT}. |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 5175 | * |
| 5176 | * @param id pending package identifier as passed via the |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 5177 | * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra. |
Kenny Root | 3a9b5fb | 2011-09-20 14:15:38 -0700 | [diff] [blame] | 5178 | * @param verificationCode either {@link PackageManager#VERIFICATION_ALLOW} |
| 5179 | * or {@link PackageManager#VERIFICATION_REJECT}. |
rich cannings | 7e67151 | 2012-08-27 14:44:16 -0700 | [diff] [blame] | 5180 | * @throws SecurityException if the caller does not have the |
Dianne Hackborn | 8832c18 | 2012-09-17 17:20:24 -0700 | [diff] [blame] | 5181 | * PACKAGE_VERIFICATION_AGENT permission. |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 5182 | */ |
Kenny Root | 3a9b5fb | 2011-09-20 14:15:38 -0700 | [diff] [blame] | 5183 | public abstract void verifyPendingInstall(int id, int verificationCode); |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 5184 | |
| 5185 | /** |
rich cannings | d9ef3e5 | 2012-08-22 14:28:05 -0700 | [diff] [blame] | 5186 | * Allows a package listening to the |
| 5187 | * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification |
| 5188 | * broadcast} to extend the default timeout for a response and declare what |
| 5189 | * action to perform after the timeout occurs. The response must include |
| 5190 | * the {@code verificationCodeAtTimeout} which is one of |
| 5191 | * {@link PackageManager#VERIFICATION_ALLOW} or |
| 5192 | * {@link PackageManager#VERIFICATION_REJECT}. |
| 5193 | * |
| 5194 | * This method may only be called once per package id. Additional calls |
| 5195 | * will have no effect. |
| 5196 | * |
| 5197 | * @param id pending package identifier as passed via the |
kmccormick | 30498b4 | 2013-03-27 17:39:17 -0700 | [diff] [blame] | 5198 | * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra. |
rich cannings | d9ef3e5 | 2012-08-22 14:28:05 -0700 | [diff] [blame] | 5199 | * @param verificationCodeAtTimeout either |
| 5200 | * {@link PackageManager#VERIFICATION_ALLOW} or |
rich cannings | d1b5cfc | 2012-08-29 14:49:51 -0700 | [diff] [blame] | 5201 | * {@link PackageManager#VERIFICATION_REJECT}. If |
| 5202 | * {@code verificationCodeAtTimeout} is neither |
| 5203 | * {@link PackageManager#VERIFICATION_ALLOW} or |
| 5204 | * {@link PackageManager#VERIFICATION_REJECT}, then |
| 5205 | * {@code verificationCodeAtTimeout} will default to |
rich cannings | d9ef3e5 | 2012-08-22 14:28:05 -0700 | [diff] [blame] | 5206 | * {@link PackageManager#VERIFICATION_REJECT}. |
| 5207 | * @param millisecondsToDelay the amount of time requested for the timeout. |
| 5208 | * Must be positive and less than |
rich cannings | d1b5cfc | 2012-08-29 14:49:51 -0700 | [diff] [blame] | 5209 | * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}. If |
| 5210 | * {@code millisecondsToDelay} is out of bounds, |
| 5211 | * {@code millisecondsToDelay} will be set to the closest in |
| 5212 | * bounds value; namely, 0 or |
rich cannings | d9ef3e5 | 2012-08-22 14:28:05 -0700 | [diff] [blame] | 5213 | * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}. |
rich cannings | 7e67151 | 2012-08-27 14:44:16 -0700 | [diff] [blame] | 5214 | * @throws SecurityException if the caller does not have the |
Dianne Hackborn | 8832c18 | 2012-09-17 17:20:24 -0700 | [diff] [blame] | 5215 | * PACKAGE_VERIFICATION_AGENT permission. |
rich cannings | d9ef3e5 | 2012-08-22 14:28:05 -0700 | [diff] [blame] | 5216 | */ |
| 5217 | public abstract void extendVerificationTimeout(int id, |
| 5218 | int verificationCodeAtTimeout, long millisecondsToDelay); |
| 5219 | |
| 5220 | /** |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 5221 | * Allows a package listening to the |
Todd Kennedy | dfa93ab | 2016-03-03 15:24:33 -0800 | [diff] [blame] | 5222 | * {@link Intent#ACTION_INTENT_FILTER_NEEDS_VERIFICATION} intent filter verification |
| 5223 | * broadcast to respond to the package manager. The response must include |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 5224 | * the {@code verificationCode} which is one of |
| 5225 | * {@link PackageManager#INTENT_FILTER_VERIFICATION_SUCCESS} or |
| 5226 | * {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}. |
| 5227 | * |
| 5228 | * @param verificationId pending package identifier as passed via the |
| 5229 | * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra. |
| 5230 | * @param verificationCode either {@link PackageManager#INTENT_FILTER_VERIFICATION_SUCCESS} |
| 5231 | * or {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}. |
Todd Kennedy | dfa93ab | 2016-03-03 15:24:33 -0800 | [diff] [blame] | 5232 | * @param failedDomains a list of failed domains if the verificationCode is |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 5233 | * {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}, otherwise null; |
| 5234 | * @throws SecurityException if the caller does not have the |
| 5235 | * INTENT_FILTER_VERIFICATION_AGENT permission. |
| 5236 | * |
| 5237 | * @hide |
| 5238 | */ |
Fabrice Di Meglio | ef741da | 2015-05-12 16:31:38 -0700 | [diff] [blame] | 5239 | @SystemApi |
Jeff Sharkey | d86b8fe | 2017-06-02 17:36:26 -0600 | [diff] [blame] | 5240 | @RequiresPermission(android.Manifest.permission.INTENT_FILTER_VERIFICATION_AGENT) |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 5241 | public abstract void verifyIntentFilter(int verificationId, int verificationCode, |
Todd Kennedy | dfa93ab | 2016-03-03 15:24:33 -0800 | [diff] [blame] | 5242 | List<String> failedDomains); |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 5243 | |
| 5244 | /** |
| 5245 | * Get the status of a Domain Verification Result for an IntentFilter. This is |
| 5246 | * related to the {@link android.content.IntentFilter#setAutoVerify(boolean)} and |
| 5247 | * {@link android.content.IntentFilter#getAutoVerify()} |
| 5248 | * |
| 5249 | * This is used by the ResolverActivity to change the status depending on what the User select |
| 5250 | * in the Disambiguation Dialog and also used by the Settings App for changing the default App |
| 5251 | * for a domain. |
| 5252 | * |
| 5253 | * @param packageName The package name of the Activity associated with the IntentFilter. |
| 5254 | * @param userId The user id. |
| 5255 | * |
| 5256 | * @return The status to set to. This can be |
| 5257 | * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK} or |
| 5258 | * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS} or |
| 5259 | * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER} or |
| 5260 | * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED} |
| 5261 | * |
| 5262 | * @hide |
| 5263 | */ |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 5264 | @SystemApi |
Todd Kennedy | dbaef6d | 2017-07-24 11:28:00 -0700 | [diff] [blame] | 5265 | @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS_FULL) |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 5266 | public abstract int getIntentVerificationStatusAsUser(String packageName, @UserIdInt int userId); |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 5267 | |
| 5268 | /** |
| 5269 | * Allow to change the status of a Intent Verification status for all IntentFilter of an App. |
| 5270 | * This is related to the {@link android.content.IntentFilter#setAutoVerify(boolean)} and |
| 5271 | * {@link android.content.IntentFilter#getAutoVerify()} |
| 5272 | * |
| 5273 | * This is used by the ResolverActivity to change the status depending on what the User select |
| 5274 | * in the Disambiguation Dialog and also used by the Settings App for changing the default App |
| 5275 | * for a domain. |
| 5276 | * |
| 5277 | * @param packageName The package name of the Activity associated with the IntentFilter. |
| 5278 | * @param status The status to set to. This can be |
| 5279 | * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK} or |
| 5280 | * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS} or |
| 5281 | * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER} |
| 5282 | * @param userId The user id. |
| 5283 | * |
| 5284 | * @return true if the status has been set. False otherwise. |
| 5285 | * |
| 5286 | * @hide |
| 5287 | */ |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 5288 | @SystemApi |
Jeff Sharkey | d86b8fe | 2017-06-02 17:36:26 -0600 | [diff] [blame] | 5289 | @RequiresPermission(android.Manifest.permission.SET_PREFERRED_APPLICATIONS) |
Jeff Sharkey | e06b4d1 | 2016-01-06 14:51:50 -0700 | [diff] [blame] | 5290 | public abstract boolean updateIntentVerificationStatusAsUser(String packageName, int status, |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 5291 | @UserIdInt int userId); |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 5292 | |
| 5293 | /** |
| 5294 | * Get the list of IntentFilterVerificationInfo for a specific package and User. |
| 5295 | * |
| 5296 | * @param packageName the package name. When this parameter is set to a non null value, |
| 5297 | * the results will be filtered by the package name provided. |
| 5298 | * 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] | 5299 | * corresponding for all packages |
| 5300 | * |
| 5301 | * @return a list of IntentFilterVerificationInfo for a specific package. |
| 5302 | * |
| 5303 | * @hide |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 5304 | */ |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 5305 | @SystemApi |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 5306 | public abstract List<IntentFilterVerificationInfo> getIntentFilterVerifications( |
| 5307 | String packageName); |
| 5308 | |
| 5309 | /** |
Fabrice Di Meglio | 0788595 | 2015-04-06 19:41:28 -0700 | [diff] [blame] | 5310 | * Get the list of IntentFilter for a specific package. |
| 5311 | * |
| 5312 | * @param packageName the package name. This parameter is set to a non null value, |
| 5313 | * the list will contain all the IntentFilter for that package. |
| 5314 | * Otherwise, the list will be empty. |
| 5315 | * |
| 5316 | * @return a list of IntentFilter for a specific package. |
| 5317 | * |
| 5318 | * @hide |
| 5319 | */ |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 5320 | @SystemApi |
Fabrice Di Meglio | 0788595 | 2015-04-06 19:41:28 -0700 | [diff] [blame] | 5321 | public abstract List<IntentFilter> getAllIntentFilters(String packageName); |
| 5322 | |
| 5323 | /** |
Fabrice Di Meglio | 6227172 | 2015-04-10 17:24:02 -0700 | [diff] [blame] | 5324 | * Get the default Browser package name for a specific user. |
| 5325 | * |
| 5326 | * @param userId The user id. |
| 5327 | * |
| 5328 | * @return the package name of the default Browser for the specified user. If the user id passed |
| 5329 | * is -1 (all users) it will return a null value. |
| 5330 | * |
| 5331 | * @hide |
| 5332 | */ |
Jeff Sharkey | a73b8fd | 2016-01-06 17:02:08 -0700 | [diff] [blame] | 5333 | @TestApi |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 5334 | @SystemApi |
Todd Kennedy | dbaef6d | 2017-07-24 11:28:00 -0700 | [diff] [blame] | 5335 | @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS_FULL) |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 5336 | public abstract String getDefaultBrowserPackageNameAsUser(@UserIdInt int userId); |
Fabrice Di Meglio | 6227172 | 2015-04-10 17:24:02 -0700 | [diff] [blame] | 5337 | |
| 5338 | /** |
| 5339 | * Set the default Browser package name for a specific user. |
| 5340 | * |
| 5341 | * @param packageName The package name of the default Browser. |
| 5342 | * @param userId The user id. |
| 5343 | * |
| 5344 | * @return true if the default Browser for the specified user has been set, |
| 5345 | * otherwise return false. If the user id passed is -1 (all users) this call will not |
| 5346 | * do anything and just return false. |
| 5347 | * |
| 5348 | * @hide |
| 5349 | */ |
Jeff Schumacher | 6fd90ed | 2017-01-20 13:58:34 -0800 | [diff] [blame] | 5350 | @SystemApi |
Todd Kennedy | dbaef6d | 2017-07-24 11:28:00 -0700 | [diff] [blame] | 5351 | @RequiresPermission(allOf = { |
| 5352 | Manifest.permission.SET_PREFERRED_APPLICATIONS, |
| 5353 | Manifest.permission.INTERACT_ACROSS_USERS_FULL}) |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 5354 | public abstract boolean setDefaultBrowserPackageNameAsUser(String packageName, |
| 5355 | @UserIdInt int userId); |
Fabrice Di Meglio | 6227172 | 2015-04-10 17:24:02 -0700 | [diff] [blame] | 5356 | |
| 5357 | /** |
Dianne Hackborn | 880119b | 2010-11-18 22:26:40 -0800 | [diff] [blame] | 5358 | * Change the installer associated with a given package. There are limitations |
| 5359 | * on how the installer package can be changed; in particular: |
| 5360 | * <ul> |
| 5361 | * <li> A SecurityException will be thrown if <var>installerPackageName</var> |
| 5362 | * is not signed with the same certificate as the calling application. |
| 5363 | * <li> A SecurityException will be thrown if <var>targetPackage</var> already |
| 5364 | * has an installer package, and that installer package is not signed with |
| 5365 | * the same certificate as the calling application. |
| 5366 | * </ul> |
| 5367 | * |
| 5368 | * @param targetPackage The installed package whose installer will be changed. |
| 5369 | * @param installerPackageName The package name of the new installer. May be |
| 5370 | * null to clear the association. |
| 5371 | */ |
| 5372 | public abstract void setInstallerPackageName(String targetPackage, |
| 5373 | String installerPackageName); |
| 5374 | |
Todd Kennedy | ab53289 | 2017-03-08 14:19:49 -0800 | [diff] [blame] | 5375 | /** @hide */ |
| 5376 | @SystemApi |
| 5377 | @RequiresPermission(Manifest.permission.INSTALL_PACKAGES) |
| 5378 | public abstract void setUpdateAvailable(String packageName, boolean updateAvaialble); |
| 5379 | |
Dianne Hackborn | 880119b | 2010-11-18 22:26:40 -0800 | [diff] [blame] | 5380 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 5381 | * Attempts to delete a package. Since this may take a little while, the |
| 5382 | * result will be posted back to the given observer. A deletion will fail if |
| 5383 | * the calling context lacks the |
| 5384 | * {@link android.Manifest.permission#DELETE_PACKAGES} permission, if the |
| 5385 | * named package cannot be found, or if the named package is a system |
| 5386 | * package. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5387 | * |
| 5388 | * @param packageName The name of the package to delete |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 5389 | * @param observer An observer callback to get notified when the package |
| 5390 | * deletion is complete. |
| 5391 | * {@link android.content.pm.IPackageDeleteObserver#packageDeleted} |
| 5392 | * will be called when that happens. observer may be null to |
| 5393 | * indicate that no callback is desired. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5394 | * @hide |
| 5395 | */ |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 5396 | @RequiresPermission(Manifest.permission.DELETE_PACKAGES) |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 5397 | @UnsupportedAppUsage |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 5398 | public abstract void deletePackage(String packageName, IPackageDeleteObserver observer, |
| 5399 | @DeleteFlags int flags); |
Jacek Surazski | 65e1317 | 2009-04-28 15:26:38 +0200 | [diff] [blame] | 5400 | |
| 5401 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 5402 | * Attempts to delete a package. Since this may take a little while, the |
| 5403 | * result will be posted back to the given observer. A deletion will fail if |
| 5404 | * the named package cannot be found, or if the named package is a system |
| 5405 | * package. |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 5406 | * |
| 5407 | * @param packageName The name of the package to delete |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 5408 | * @param observer An observer callback to get notified when the package |
| 5409 | * deletion is complete. |
| 5410 | * {@link android.content.pm.IPackageDeleteObserver#packageDeleted} |
| 5411 | * will be called when that happens. observer may be null to |
| 5412 | * indicate that no callback is desired. |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 5413 | * @param userId The user Id |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 5414 | * @hide |
| 5415 | */ |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 5416 | @RequiresPermission(anyOf = { |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 5417 | Manifest.permission.DELETE_PACKAGES, |
| 5418 | Manifest.permission.INTERACT_ACROSS_USERS_FULL}) |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 5419 | @UnsupportedAppUsage |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 5420 | public abstract void deletePackageAsUser(@NonNull String packageName, |
| 5421 | IPackageDeleteObserver observer, @DeleteFlags int flags, @UserIdInt int userId); |
Nicolas Prevot | 9a80e53 | 2015-09-23 15:49:28 +0100 | [diff] [blame] | 5422 | |
| 5423 | /** |
Jacek Surazski | 65e1317 | 2009-04-28 15:26:38 +0200 | [diff] [blame] | 5424 | * Retrieve the package name of the application that installed a package. This identifies |
| 5425 | * which market the package came from. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 5426 | * |
Jacek Surazski | 65e1317 | 2009-04-28 15:26:38 +0200 | [diff] [blame] | 5427 | * @param packageName The name of the package to query |
Todd Kennedy | 9db6563 | 2018-02-13 11:12:35 -0800 | [diff] [blame] | 5428 | * @throws IllegalArgumentException if the given package name is not installed |
Jacek Surazski | 65e1317 | 2009-04-28 15:26:38 +0200 | [diff] [blame] | 5429 | */ |
Scott Kennedy | 98b5f89 | 2018-10-09 17:26:19 -0700 | [diff] [blame] | 5430 | @Nullable |
Jacek Surazski | 65e1317 | 2009-04-28 15:26:38 +0200 | [diff] [blame] | 5431 | public abstract String getInstallerPackageName(String packageName); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 5432 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5433 | /** |
| 5434 | * Attempts to clear the user data directory of an application. |
| 5435 | * Since this may take a little while, the result will |
| 5436 | * be posted back to the given observer. A deletion will fail if the |
| 5437 | * named package cannot be found, or if the named package is a "system package". |
| 5438 | * |
| 5439 | * @param packageName The name of the package |
| 5440 | * @param observer An observer callback to get notified when the operation is finished |
| 5441 | * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)} |
| 5442 | * will be called when that happens. observer may be null to indicate that |
| 5443 | * no callback is desired. |
| 5444 | * |
| 5445 | * @hide |
| 5446 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 5447 | @UnsupportedAppUsage |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5448 | public abstract void clearApplicationUserData(String packageName, |
| 5449 | IPackageDataObserver observer); |
| 5450 | /** |
| 5451 | * Attempts to delete the cache files associated with an application. |
| 5452 | * Since this may take a little while, the result will |
| 5453 | * be posted back to the given observer. A deletion will fail if the calling context |
| 5454 | * lacks the {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the |
| 5455 | * named package cannot be found, or if the named package is a "system package". |
| 5456 | * |
| 5457 | * @param packageName The name of the package to delete |
| 5458 | * @param observer An observer callback to get notified when the cache file deletion |
| 5459 | * is complete. |
| 5460 | * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)} |
| 5461 | * will be called when that happens. observer may be null to indicate that |
| 5462 | * no callback is desired. |
| 5463 | * |
| 5464 | * @hide |
| 5465 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 5466 | @UnsupportedAppUsage |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5467 | public abstract void deleteApplicationCacheFiles(String packageName, |
| 5468 | IPackageDataObserver observer); |
| 5469 | |
| 5470 | /** |
Suprabh Shukla | 78c9eb8 | 2016-04-12 15:51:35 -0700 | [diff] [blame] | 5471 | * Attempts to delete the cache files associated with an application for a given user. Since |
| 5472 | * this may take a little while, the result will be posted back to the given observer. A |
| 5473 | * deletion will fail if the calling context lacks the |
| 5474 | * {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the named package |
| 5475 | * cannot be found, or if the named package is a "system package". If {@code userId} does not |
| 5476 | * belong to the calling user, the caller must have |
| 5477 | * {@link android.Manifest.permission#INTERACT_ACROSS_USERS} permission. |
| 5478 | * |
| 5479 | * @param packageName The name of the package to delete |
| 5480 | * @param userId the user for which the cache files needs to be deleted |
| 5481 | * @param observer An observer callback to get notified when the cache file deletion is |
| 5482 | * complete. |
| 5483 | * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)} |
| 5484 | * will be called when that happens. observer may be null to indicate that no |
| 5485 | * callback is desired. |
| 5486 | * @hide |
| 5487 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 5488 | @UnsupportedAppUsage |
Suprabh Shukla | 78c9eb8 | 2016-04-12 15:51:35 -0700 | [diff] [blame] | 5489 | public abstract void deleteApplicationCacheFilesAsUser(String packageName, int userId, |
| 5490 | IPackageDataObserver observer); |
| 5491 | |
| 5492 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5493 | * Free storage by deleting LRU sorted list of cache files across |
| 5494 | * all applications. If the currently available free storage |
| 5495 | * on the device is greater than or equal to the requested |
| 5496 | * free storage, no cache files are cleared. If the currently |
| 5497 | * available storage on the device is less than the requested |
| 5498 | * free storage, some or all of the cache files across |
| 5499 | * all applications are deleted (based on last accessed time) |
| 5500 | * to increase the free storage space on the device to |
| 5501 | * the requested value. There is no guarantee that clearing all |
| 5502 | * the cache files from all applications will clear up |
| 5503 | * enough storage to achieve the desired value. |
| 5504 | * @param freeStorageSize The number of bytes of storage to be |
| 5505 | * freed by the system. Say if freeStorageSize is XX, |
| 5506 | * and the current free storage is YY, |
| 5507 | * if XX is less than YY, just return. if not free XX-YY number |
| 5508 | * of bytes if possible. |
| 5509 | * @param observer call back used to notify when |
| 5510 | * the operation is completed |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 5511 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5512 | * @hide |
| 5513 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 5514 | @UnsupportedAppUsage |
Jeff Sharkey | 529f91f | 2015-04-18 20:23:13 -0700 | [diff] [blame] | 5515 | public void freeStorageAndNotify(long freeStorageSize, IPackageDataObserver observer) { |
| 5516 | freeStorageAndNotify(null, freeStorageSize, observer); |
| 5517 | } |
| 5518 | |
| 5519 | /** {@hide} */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 5520 | @UnsupportedAppUsage |
Jeff Sharkey | 529f91f | 2015-04-18 20:23:13 -0700 | [diff] [blame] | 5521 | public abstract void freeStorageAndNotify(String volumeUuid, long freeStorageSize, |
| 5522 | IPackageDataObserver observer); |
Suchi Amalapurapu | 1ccac75 | 2009-06-12 10:09:58 -0700 | [diff] [blame] | 5523 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5524 | /** |
| 5525 | * Free storage by deleting LRU sorted list of cache files across |
| 5526 | * all applications. If the currently available free storage |
| 5527 | * on the device is greater than or equal to the requested |
| 5528 | * free storage, no cache files are cleared. If the currently |
| 5529 | * available storage on the device is less than the requested |
| 5530 | * free storage, some or all of the cache files across |
| 5531 | * all applications are deleted (based on last accessed time) |
| 5532 | * to increase the free storage space on the device to |
| 5533 | * the requested value. There is no guarantee that clearing all |
| 5534 | * the cache files from all applications will clear up |
| 5535 | * enough storage to achieve the desired value. |
| 5536 | * @param freeStorageSize The number of bytes of storage to be |
| 5537 | * freed by the system. Say if freeStorageSize is XX, |
| 5538 | * and the current free storage is YY, |
| 5539 | * if XX is less than YY, just return. if not free XX-YY number |
| 5540 | * of bytes if possible. |
Suchi Amalapurapu | 1ccac75 | 2009-06-12 10:09:58 -0700 | [diff] [blame] | 5541 | * @param pi IntentSender call back used to |
| 5542 | * notify when the operation is completed.May be null |
| 5543 | * to indicate that no call back is desired. |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 5544 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5545 | * @hide |
| 5546 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 5547 | @UnsupportedAppUsage |
Jeff Sharkey | 529f91f | 2015-04-18 20:23:13 -0700 | [diff] [blame] | 5548 | public void freeStorage(long freeStorageSize, IntentSender pi) { |
| 5549 | freeStorage(null, freeStorageSize, pi); |
| 5550 | } |
| 5551 | |
| 5552 | /** {@hide} */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 5553 | @UnsupportedAppUsage |
Jeff Sharkey | 529f91f | 2015-04-18 20:23:13 -0700 | [diff] [blame] | 5554 | 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] | 5555 | |
| 5556 | /** |
| 5557 | * Retrieve the size information for a package. |
| 5558 | * Since this may take a little while, the result will |
| 5559 | * be posted back to the given observer. The calling context |
| 5560 | * should have the {@link android.Manifest.permission#GET_PACKAGE_SIZE} permission. |
| 5561 | * |
| 5562 | * @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] | 5563 | * @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] | 5564 | * @param observer An observer callback to get notified when the operation |
| 5565 | * is complete. |
| 5566 | * {@link android.content.pm.IPackageStatsObserver#onGetStatsCompleted(PackageStats, boolean)} |
| 5567 | * The observer's callback is invoked with a PackageStats object(containing the |
| 5568 | * code, data and cache sizes of the package) and a boolean value representing |
| 5569 | * the status of the operation. observer may be null to indicate that |
| 5570 | * no callback is desired. |
| 5571 | * |
Jeff Sharkey | 60f95aa | 2017-03-08 13:57:15 -0700 | [diff] [blame] | 5572 | * @deprecated use {@link StorageStatsManager} instead. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5573 | * @hide |
| 5574 | */ |
Jeff Sharkey | 60f95aa | 2017-03-08 13:57:15 -0700 | [diff] [blame] | 5575 | @Deprecated |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 5576 | @UnsupportedAppUsage |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 5577 | public abstract void getPackageSizeInfoAsUser(String packageName, @UserIdInt int userId, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5578 | IPackageStatsObserver observer); |
| 5579 | |
| 5580 | /** |
Jeff Sharkey | e06b4d1 | 2016-01-06 14:51:50 -0700 | [diff] [blame] | 5581 | * Like {@link #getPackageSizeInfoAsUser(String, int, IPackageStatsObserver)}, but |
Dianne Hackborn | 0c38049 | 2012-08-20 17:23:30 -0700 | [diff] [blame] | 5582 | * returns the size for the calling user. |
| 5583 | * |
Jeff Sharkey | 60f95aa | 2017-03-08 13:57:15 -0700 | [diff] [blame] | 5584 | * @deprecated use {@link StorageStatsManager} instead. |
Dianne Hackborn | 0c38049 | 2012-08-20 17:23:30 -0700 | [diff] [blame] | 5585 | * @hide |
| 5586 | */ |
Jeff Sharkey | 60f95aa | 2017-03-08 13:57:15 -0700 | [diff] [blame] | 5587 | @Deprecated |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 5588 | @UnsupportedAppUsage |
Dianne Hackborn | 0c38049 | 2012-08-20 17:23:30 -0700 | [diff] [blame] | 5589 | public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) { |
Jeff Sharkey | ad357d1 | 2018-02-02 13:25:31 -0700 | [diff] [blame] | 5590 | getPackageSizeInfoAsUser(packageName, getUserId(), observer); |
Dianne Hackborn | 0c38049 | 2012-08-20 17:23:30 -0700 | [diff] [blame] | 5591 | } |
| 5592 | |
| 5593 | /** |
Nikita Dubrovsky | 7e9d5e1 | 2019-01-15 08:09:22 -0800 | [diff] [blame] | 5594 | * @deprecated This function no longer does anything. It is the platform's |
| 5595 | * responsibility to assign preferred activities and this cannot be modified |
| 5596 | * directly. To determine the activities resolved by the platform, use |
| 5597 | * {@link #resolveActivity} or {@link #queryIntentActivities}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5598 | */ |
Dianne Hackborn | a7ca0e5 | 2009-12-01 14:31:55 -0800 | [diff] [blame] | 5599 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5600 | public abstract void addPackageToPreferred(String packageName); |
| 5601 | |
| 5602 | /** |
Nikita Dubrovsky | 7e9d5e1 | 2019-01-15 08:09:22 -0800 | [diff] [blame] | 5603 | * @deprecated This function no longer does anything. It is the platform's |
| 5604 | * responsibility to assign preferred activities and this cannot be modified |
| 5605 | * directly. To determine the activities resolved by the platform, use |
| 5606 | * {@link #resolveActivity} or {@link #queryIntentActivities}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5607 | */ |
Dianne Hackborn | a7ca0e5 | 2009-12-01 14:31:55 -0800 | [diff] [blame] | 5608 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5609 | public abstract void removePackageFromPreferred(String packageName); |
| 5610 | |
| 5611 | /** |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 5612 | * Retrieve the list of all currently configured preferred packages. The |
| 5613 | * first package on the list is the most preferred, the last is the least |
| 5614 | * preferred. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5615 | * |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 5616 | * @param flags Additional option flags to modify the data returned. |
| 5617 | * @return A List of PackageInfo objects, one for each preferred |
| 5618 | * application, in order of preference. |
Nikita Dubrovsky | 7e9d5e1 | 2019-01-15 08:09:22 -0800 | [diff] [blame] | 5619 | * |
| 5620 | * @deprecated This function no longer does anything. It is the platform's |
| 5621 | * responsibility to assign preferred activities and this cannot be modified |
| 5622 | * directly. To determine the activities resolved by the platform, use |
| 5623 | * {@link #resolveActivity} or {@link #queryIntentActivities}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5624 | */ |
Nikita Dubrovsky | 18a8769 | 2018-11-27 16:43:22 -0800 | [diff] [blame] | 5625 | @Deprecated |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 5626 | public abstract List<PackageInfo> getPreferredPackages(@PackageInfoFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5627 | |
| 5628 | /** |
| 5629 | * Add a new preferred activity mapping to the system. This will be used |
| 5630 | * to automatically select the given activity component when |
| 5631 | * {@link Context#startActivity(Intent) Context.startActivity()} finds |
| 5632 | * multiple matching activities and also matches the given filter. |
| 5633 | * |
| 5634 | * @param filter The set of intents under which this activity will be |
| 5635 | * made preferred. |
| 5636 | * @param match The IntentFilter match category that this preference |
| 5637 | * applies to. |
| 5638 | * @param set The set of activities that the user was picking from when |
| 5639 | * this preference was made. |
| 5640 | * @param activity The component name of the activity that is to be |
| 5641 | * preferred. |
Nikita Dubrovsky | 7e9d5e1 | 2019-01-15 08:09:22 -0800 | [diff] [blame] | 5642 | * |
| 5643 | * @deprecated This function no longer does anything. It is the platform's |
| 5644 | * responsibility to assign preferred activities and this cannot be modified |
| 5645 | * directly. To determine the activities resolved by the platform, use |
| 5646 | * {@link #resolveActivity} or {@link #queryIntentActivities}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5647 | */ |
Dianne Hackborn | 2ee89ea | 2010-03-10 18:27:09 -0800 | [diff] [blame] | 5648 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5649 | public abstract void addPreferredActivity(IntentFilter filter, int match, |
| 5650 | ComponentName[] set, ComponentName activity); |
| 5651 | |
| 5652 | /** |
Amith Yamasani | a3f133a | 2012-08-09 17:11:28 -0700 | [diff] [blame] | 5653 | * Same as {@link #addPreferredActivity(IntentFilter, int, |
| 5654 | ComponentName[], ComponentName)}, but with a specific userId to apply the preference |
| 5655 | to. |
| 5656 | * @hide |
Nikita Dubrovsky | 7e9d5e1 | 2019-01-15 08:09:22 -0800 | [diff] [blame] | 5657 | * |
| 5658 | * @deprecated This function no longer does anything. It is the platform's |
| 5659 | * responsibility to assign preferred activities and this cannot be modified |
| 5660 | * directly. To determine the activities resolved by the platform, use |
| 5661 | * {@link #resolveActivity} or {@link #queryIntentActivities}. |
Amith Yamasani | a3f133a | 2012-08-09 17:11:28 -0700 | [diff] [blame] | 5662 | */ |
Nikita Dubrovsky | 18a8769 | 2018-11-27 16:43:22 -0800 | [diff] [blame] | 5663 | @Deprecated |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 5664 | @UnsupportedAppUsage |
Jeff Sharkey | e06b4d1 | 2016-01-06 14:51:50 -0700 | [diff] [blame] | 5665 | public void addPreferredActivityAsUser(IntentFilter filter, int match, |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 5666 | ComponentName[] set, ComponentName activity, @UserIdInt int userId) { |
Amith Yamasani | a3f133a | 2012-08-09 17:11:28 -0700 | [diff] [blame] | 5667 | throw new RuntimeException("Not implemented. Must override in a subclass."); |
| 5668 | } |
| 5669 | |
| 5670 | /** |
Satish Sampath | 8dbe612 | 2009-06-02 23:35:54 +0100 | [diff] [blame] | 5671 | * Replaces an existing preferred activity mapping to the system, and if that were not present |
| 5672 | * adds a new preferred activity. This will be used |
| 5673 | * to automatically select the given activity component when |
| 5674 | * {@link Context#startActivity(Intent) Context.startActivity()} finds |
| 5675 | * multiple matching activities and also matches the given filter. |
| 5676 | * |
| 5677 | * @param filter The set of intents under which this activity will be |
| 5678 | * made preferred. |
| 5679 | * @param match The IntentFilter match category that this preference |
| 5680 | * applies to. |
| 5681 | * @param set The set of activities that the user was picking from when |
| 5682 | * this preference was made. |
| 5683 | * @param activity The component name of the activity that is to be |
| 5684 | * preferred. |
Nikita Dubrovsky | 7e9d5e1 | 2019-01-15 08:09:22 -0800 | [diff] [blame] | 5685 | * |
Satish Sampath | 8dbe612 | 2009-06-02 23:35:54 +0100 | [diff] [blame] | 5686 | * @hide |
Nikita Dubrovsky | 7e9d5e1 | 2019-01-15 08:09:22 -0800 | [diff] [blame] | 5687 | * |
| 5688 | * @deprecated This function no longer does anything. It is the platform's |
| 5689 | * responsibility to assign preferred activities and this cannot be modified |
| 5690 | * directly. To determine the activities resolved by the platform, use |
| 5691 | * {@link #resolveActivity} or {@link #queryIntentActivities}. |
Satish Sampath | 8dbe612 | 2009-06-02 23:35:54 +0100 | [diff] [blame] | 5692 | */ |
Dianne Hackborn | 2ee89ea | 2010-03-10 18:27:09 -0800 | [diff] [blame] | 5693 | @Deprecated |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 5694 | @UnsupportedAppUsage |
Satish Sampath | 8dbe612 | 2009-06-02 23:35:54 +0100 | [diff] [blame] | 5695 | public abstract void replacePreferredActivity(IntentFilter filter, int match, |
| 5696 | ComponentName[] set, ComponentName activity); |
| 5697 | |
| 5698 | /** |
Hai Zhang | b777668 | 2018-09-25 15:10:57 -0700 | [diff] [blame] | 5699 | * Replaces an existing preferred activity mapping to the system, and if that were not present |
| 5700 | * adds a new preferred activity. This will be used to automatically select the given activity |
| 5701 | * component when {@link Context#startActivity(Intent) Context.startActivity()} finds multiple |
| 5702 | * matching activities and also matches the given filter. |
| 5703 | * |
| 5704 | * @param filter The set of intents under which this activity will be made preferred. |
| 5705 | * @param match The IntentFilter match category that this preference applies to. Should be a |
| 5706 | * combination of {@link IntentFilter#MATCH_CATEGORY_MASK} and |
| 5707 | * {@link IntentFilter#MATCH_ADJUSTMENT_MASK}). |
| 5708 | * @param set The set of activities that the user was picking from when this preference was |
| 5709 | * made. |
| 5710 | * @param activity The component name of the activity that is to be preferred. |
| 5711 | * |
| 5712 | * @hide |
Nikita Dubrovsky | 7e9d5e1 | 2019-01-15 08:09:22 -0800 | [diff] [blame] | 5713 | * |
| 5714 | * @deprecated This function no longer does anything. It is the platform's |
| 5715 | * responsibility to assign preferred activities and this cannot be modified |
| 5716 | * directly. To determine the activities resolved by the platform, use |
| 5717 | * {@link #resolveActivity} or {@link #queryIntentActivities}. |
Hai Zhang | b777668 | 2018-09-25 15:10:57 -0700 | [diff] [blame] | 5718 | */ |
Nikita Dubrovsky | 18a8769 | 2018-11-27 16:43:22 -0800 | [diff] [blame] | 5719 | @Deprecated |
Hai Zhang | b777668 | 2018-09-25 15:10:57 -0700 | [diff] [blame] | 5720 | @SystemApi |
| 5721 | public void replacePreferredActivity(@NonNull IntentFilter filter, int match, |
| 5722 | @NonNull List<ComponentName> set, @NonNull ComponentName activity) { |
| 5723 | replacePreferredActivity(filter, match, set.toArray(new ComponentName[0]), activity); |
| 5724 | } |
| 5725 | |
| 5726 | /** |
Amith Yamasani | 41c1ded | 2014-08-05 11:15:05 -0700 | [diff] [blame] | 5727 | * @hide |
Nikita Dubrovsky | 7e9d5e1 | 2019-01-15 08:09:22 -0800 | [diff] [blame] | 5728 | * |
| 5729 | * @deprecated This function no longer does anything. It is the platform's |
| 5730 | * responsibility to assign preferred activities and this cannot be modified |
| 5731 | * directly. To determine the activities resolved by the platform, use |
| 5732 | * {@link #resolveActivity} or {@link #queryIntentActivities}. |
Amith Yamasani | 41c1ded | 2014-08-05 11:15:05 -0700 | [diff] [blame] | 5733 | */ |
| 5734 | @Deprecated |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 5735 | @UnsupportedAppUsage |
Amith Yamasani | 41c1ded | 2014-08-05 11:15:05 -0700 | [diff] [blame] | 5736 | public void replacePreferredActivityAsUser(IntentFilter filter, int match, |
Jeff Sharkey | 8588bc1 | 2016-01-06 16:47:42 -0700 | [diff] [blame] | 5737 | ComponentName[] set, ComponentName activity, @UserIdInt int userId) { |
Amith Yamasani | 41c1ded | 2014-08-05 11:15:05 -0700 | [diff] [blame] | 5738 | throw new RuntimeException("Not implemented. Must override in a subclass."); |
| 5739 | } |
| 5740 | |
| 5741 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5742 | * Remove all preferred activity mappings, previously added with |
| 5743 | * {@link #addPreferredActivity}, from the |
| 5744 | * system whose activities are implemented in the given package name. |
Dianne Hackborn | 2ee89ea | 2010-03-10 18:27:09 -0800 | [diff] [blame] | 5745 | * An application can only clear its own package(s). |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5746 | * |
| 5747 | * @param packageName The name of the package whose preferred activity |
| 5748 | * mappings are to be removed. |
Nikita Dubrovsky | 7e9d5e1 | 2019-01-15 08:09:22 -0800 | [diff] [blame] | 5749 | * |
| 5750 | * @deprecated This function no longer does anything. It is the platform's |
| 5751 | * responsibility to assign preferred activities and this cannot be modified |
| 5752 | * directly. To determine the activities resolved by the platform, use |
| 5753 | * {@link #resolveActivity} or {@link #queryIntentActivities}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5754 | */ |
Nikita Dubrovsky | 18a8769 | 2018-11-27 16:43:22 -0800 | [diff] [blame] | 5755 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5756 | public abstract void clearPackagePreferredActivities(String packageName); |
| 5757 | |
| 5758 | /** |
| 5759 | * Retrieve all preferred activities, previously added with |
| 5760 | * {@link #addPreferredActivity}, that are |
| 5761 | * currently registered with the system. |
| 5762 | * |
John Spurlock | 38e6425 | 2015-03-18 12:09:32 -0400 | [diff] [blame] | 5763 | * @param outFilters A required list in which to place the filters of all of the |
| 5764 | * preferred activities. |
| 5765 | * @param outActivities A required list in which to place the component names of |
| 5766 | * all of the preferred activities. |
| 5767 | * @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] | 5768 | * the list. If null, all activities will be returned; if non-null, only |
| 5769 | * those activities in the given package are returned. |
| 5770 | * |
| 5771 | * @return Returns the total number of registered preferred activities |
| 5772 | * (the number of distinct IntentFilter records, not the number of unique |
| 5773 | * activity components) that were found. |
Nikita Dubrovsky | 7e9d5e1 | 2019-01-15 08:09:22 -0800 | [diff] [blame] | 5774 | * |
| 5775 | * @deprecated This function no longer does anything. It is the platform's |
| 5776 | * responsibility to assign preferred activities and this cannot be modified |
| 5777 | * directly. To determine the activities resolved by the platform, use |
| 5778 | * {@link #resolveActivity} or {@link #queryIntentActivities}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5779 | */ |
Nikita Dubrovsky | 18a8769 | 2018-11-27 16:43:22 -0800 | [diff] [blame] | 5780 | @Deprecated |
John Spurlock | 38e6425 | 2015-03-18 12:09:32 -0400 | [diff] [blame] | 5781 | public abstract int getPreferredActivities(@NonNull List<IntentFilter> outFilters, |
| 5782 | @NonNull List<ComponentName> outActivities, String packageName); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5783 | |
| 5784 | /** |
Christopher Tate | a2a0850d | 2013-09-05 16:38:58 -0700 | [diff] [blame] | 5785 | * Ask for the set of available 'home' activities and the current explicit |
| 5786 | * default, if any. |
| 5787 | * @hide |
| 5788 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 5789 | @UnsupportedAppUsage |
Christopher Tate | a2a0850d | 2013-09-05 16:38:58 -0700 | [diff] [blame] | 5790 | public abstract ComponentName getHomeActivities(List<ResolveInfo> outActivities); |
| 5791 | |
| 5792 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5793 | * Set the enabled setting for a package component (activity, receiver, service, provider). |
| 5794 | * This setting will override any enabled state which may have been set by the component in its |
| 5795 | * manifest. |
| 5796 | * |
| 5797 | * @param componentName The component to enable |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5798 | * @param newState The new enabled state for the component. |
| 5799 | * @param flags Optional behavior flags. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5800 | */ |
Chad Brubaker | 3875ce0 | 2018-05-11 13:40:51 -0700 | [diff] [blame] | 5801 | @RequiresPermission(value = android.Manifest.permission.CHANGE_COMPONENT_ENABLED_STATE, |
| 5802 | conditional = true) |
Adrian Roos | 918c4f1 | 2019-01-22 17:48:51 +0100 | [diff] [blame] | 5803 | public abstract void setComponentEnabledSetting(@NonNull ComponentName componentName, |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5804 | @EnabledState int newState, @EnabledFlags int flags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5805 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5806 | /** |
Amaury Medeiros | dde2426 | 2014-06-03 20:06:41 -0300 | [diff] [blame] | 5807 | * Return the enabled setting for a package component (activity, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5808 | * receiver, service, provider). This returns the last value set by |
| 5809 | * {@link #setComponentEnabledSetting(ComponentName, int, int)}; in most |
| 5810 | * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since |
| 5811 | * the value originally specified in the manifest has not been modified. |
| 5812 | * |
| 5813 | * @param componentName The component to retrieve. |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5814 | * @return Returns the current enabled state for the component. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5815 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5816 | public abstract @EnabledState int getComponentEnabledSetting( |
Adrian Roos | 918c4f1 | 2019-01-22 17:48:51 +0100 | [diff] [blame] | 5817 | @NonNull ComponentName componentName); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5818 | |
| 5819 | /** |
Ricky Wai | 92cd006 | 2019-02-14 20:23:22 +0000 | [diff] [blame] | 5820 | * Set the enabled setting for a package app settings activity. |
| 5821 | * |
| 5822 | * @param packageName The package name of the app |
| 5823 | * @param enabled The new enabled state for app details activity |
| 5824 | * |
| 5825 | * @hide |
| 5826 | */ |
| 5827 | @RequiresPermission(value = android.Manifest.permission.CHANGE_COMPONENT_ENABLED_STATE, |
| 5828 | conditional = true) |
| 5829 | @SystemApi |
| 5830 | public void setAppDetailsActivityEnabled(@NonNull String packageName, boolean enabled) { |
| 5831 | throw new UnsupportedOperationException( |
| 5832 | "setAppDetailsActivityEnabled not implemented"); |
| 5833 | } |
| 5834 | |
| 5835 | |
| 5836 | /** |
| 5837 | * Return the enabled setting for a package app settings activity. |
| 5838 | * |
| 5839 | * @param packageName The package name of the app |
| 5840 | * @return Returns the current enabled state for app settings activity. |
| 5841 | * |
| 5842 | * @hide |
| 5843 | */ |
| 5844 | @SystemApi |
| 5845 | public boolean getAppDetailsActivityEnabled(@NonNull String packageName) { |
| 5846 | throw new UnsupportedOperationException( |
| 5847 | "getAppDetailsActivityEnabled not implemented"); |
| 5848 | } |
| 5849 | |
| 5850 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5851 | * Set the enabled setting for an application |
| 5852 | * This setting will override any enabled state which may have been set by the application in |
| 5853 | * its manifest. It also overrides the enabled state set in the manifest for any of the |
| 5854 | * application's components. It does not override any enabled state set by |
| 5855 | * {@link #setComponentEnabledSetting} for any of the application's components. |
| 5856 | * |
| 5857 | * @param packageName The package name of the application to enable |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5858 | * @param newState The new enabled state for the application. |
| 5859 | * @param flags Optional behavior flags. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5860 | */ |
Chad Brubaker | 3875ce0 | 2018-05-11 13:40:51 -0700 | [diff] [blame] | 5861 | @RequiresPermission(value = android.Manifest.permission.CHANGE_COMPONENT_ENABLED_STATE, |
| 5862 | conditional = true) |
Adrian Roos | 918c4f1 | 2019-01-22 17:48:51 +0100 | [diff] [blame] | 5863 | public abstract void setApplicationEnabledSetting(@NonNull String packageName, |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5864 | @EnabledState int newState, @EnabledFlags int flags); |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 5865 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5866 | /** |
Amaury Medeiros | dde2426 | 2014-06-03 20:06:41 -0300 | [diff] [blame] | 5867 | * Return the enabled setting for an application. This returns |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5868 | * the last value set by |
| 5869 | * {@link #setApplicationEnabledSetting(String, int, int)}; in most |
| 5870 | * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since |
| 5871 | * the value originally specified in the manifest has not been modified. |
| 5872 | * |
Amaury Medeiros | dde2426 | 2014-06-03 20:06:41 -0300 | [diff] [blame] | 5873 | * @param packageName The package name of the application to retrieve. |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5874 | * @return Returns the current enabled state for the application. |
Mathew Inwood | 1b9f8d9 | 2011-09-26 13:23:56 +0100 | [diff] [blame] | 5875 | * @throws IllegalArgumentException if the named package does not exist. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5876 | */ |
Adrian Roos | 918c4f1 | 2019-01-22 17:48:51 +0100 | [diff] [blame] | 5877 | public abstract @EnabledState int getApplicationEnabledSetting(@NonNull String packageName); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5878 | |
| 5879 | /** |
Sudheer Shanka | bbb3ff2 | 2015-07-09 15:39:23 +0100 | [diff] [blame] | 5880 | * Flush the package restrictions for a given user to disk. This forces the package restrictions |
| 5881 | * like component and package enabled settings to be written to disk and avoids the delay that |
| 5882 | * is otherwise present when changing those settings. |
| 5883 | * |
| 5884 | * @param userId Ther userId of the user whose restrictions are to be flushed. |
| 5885 | * @hide |
| 5886 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 5887 | @UnsupportedAppUsage |
Sudheer Shanka | bbb3ff2 | 2015-07-09 15:39:23 +0100 | [diff] [blame] | 5888 | public abstract void flushPackageRestrictionsAsUser(int userId); |
| 5889 | |
| 5890 | /** |
Amith Yamasani | e5bcff6 | 2014-07-19 15:44:09 -0700 | [diff] [blame] | 5891 | * 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] | 5892 | * 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] | 5893 | * package file. Application can be unhidden by either resetting the hidden state |
| 5894 | * or by installing it, such as with {@link #installExistingPackage(String)} |
Amith Yamasani | 655d0e2 | 2013-06-12 14:19:10 -0700 | [diff] [blame] | 5895 | * @hide |
| 5896 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 5897 | @UnsupportedAppUsage |
Amith Yamasani | e5bcff6 | 2014-07-19 15:44:09 -0700 | [diff] [blame] | 5898 | public abstract boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden, |
Amith Yamasani | 655d0e2 | 2013-06-12 14:19:10 -0700 | [diff] [blame] | 5899 | UserHandle userHandle); |
| 5900 | |
| 5901 | /** |
Amith Yamasani | e5bcff6 | 2014-07-19 15:44:09 -0700 | [diff] [blame] | 5902 | * Returns the hidden state of a package. |
| 5903 | * @see #setApplicationHiddenSettingAsUser(String, boolean, UserHandle) |
Amith Yamasani | 655d0e2 | 2013-06-12 14:19:10 -0700 | [diff] [blame] | 5904 | * @hide |
| 5905 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 5906 | @UnsupportedAppUsage |
Amith Yamasani | e5bcff6 | 2014-07-19 15:44:09 -0700 | [diff] [blame] | 5907 | public abstract boolean getApplicationHiddenSettingAsUser(String packageName, |
Amith Yamasani | 655d0e2 | 2013-06-12 14:19:10 -0700 | [diff] [blame] | 5908 | UserHandle userHandle); |
| 5909 | |
| 5910 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5911 | * Return whether the device has been booted into safe mode. |
| 5912 | */ |
| 5913 | public abstract boolean isSafeMode(); |
Suchi Amalapurapu | 8946dd3 | 2010-02-19 09:19:34 -0800 | [diff] [blame] | 5914 | |
| 5915 | /** |
Svetoslav | f7c06eb | 2015-06-10 18:43:22 -0700 | [diff] [blame] | 5916 | * Adds a listener for permission changes for installed packages. |
| 5917 | * |
| 5918 | * @param listener The listener to add. |
| 5919 | * |
| 5920 | * @hide |
| 5921 | */ |
| 5922 | @SystemApi |
| 5923 | @RequiresPermission(Manifest.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS) |
| 5924 | public abstract void addOnPermissionsChangeListener(OnPermissionsChangedListener listener); |
| 5925 | |
| 5926 | /** |
| 5927 | * Remvoes a listener for permission changes for installed packages. |
| 5928 | * |
| 5929 | * @param listener The listener to remove. |
| 5930 | * |
| 5931 | * @hide |
| 5932 | */ |
| 5933 | @SystemApi |
Jeff Sharkey | d86b8fe | 2017-06-02 17:36:26 -0600 | [diff] [blame] | 5934 | @RequiresPermission(Manifest.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS) |
Svetoslav | f7c06eb | 2015-06-10 18:43:22 -0700 | [diff] [blame] | 5935 | public abstract void removeOnPermissionsChangeListener(OnPermissionsChangedListener listener); |
| 5936 | |
| 5937 | /** |
dcashman | 9d2f441 | 2014-06-09 09:27:54 -0700 | [diff] [blame] | 5938 | * Return the {@link KeySet} associated with the String alias for this |
| 5939 | * application. |
| 5940 | * |
| 5941 | * @param alias The alias for a given {@link KeySet} as defined in the |
| 5942 | * application's AndroidManifest.xml. |
dcashman | c6f2249 | 2014-08-14 09:54:51 -0700 | [diff] [blame] | 5943 | * @hide |
dcashman | 9d2f441 | 2014-06-09 09:27:54 -0700 | [diff] [blame] | 5944 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 5945 | @UnsupportedAppUsage |
dcashman | 9d2f441 | 2014-06-09 09:27:54 -0700 | [diff] [blame] | 5946 | public abstract KeySet getKeySetByAlias(String packageName, String alias); |
| 5947 | |
Ihab Awad | 1ec6888 | 2014-09-12 11:09:01 -0700 | [diff] [blame] | 5948 | /** Return the signing {@link KeySet} for this application. |
dcashman | c6f2249 | 2014-08-14 09:54:51 -0700 | [diff] [blame] | 5949 | * @hide |
| 5950 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 5951 | @UnsupportedAppUsage |
dcashman | 9d2f441 | 2014-06-09 09:27:54 -0700 | [diff] [blame] | 5952 | public abstract KeySet getSigningKeySet(String packageName); |
| 5953 | |
| 5954 | /** |
| 5955 | * Return whether the package denoted by packageName has been signed by all |
| 5956 | * of the keys specified by the {@link KeySet} ks. This will return true if |
| 5957 | * the package has been signed by additional keys (a superset) as well. |
| 5958 | * Compare to {@link #isSignedByExactly(String packageName, KeySet ks)}. |
dcashman | c6f2249 | 2014-08-14 09:54:51 -0700 | [diff] [blame] | 5959 | * @hide |
dcashman | 9d2f441 | 2014-06-09 09:27:54 -0700 | [diff] [blame] | 5960 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 5961 | @UnsupportedAppUsage |
dcashman | 9d2f441 | 2014-06-09 09:27:54 -0700 | [diff] [blame] | 5962 | public abstract boolean isSignedBy(String packageName, KeySet ks); |
| 5963 | |
| 5964 | /** |
| 5965 | * Return whether the package denoted by packageName has been signed by all |
| 5966 | * of, and only, the keys specified by the {@link KeySet} ks. Compare to |
| 5967 | * {@link #isSignedBy(String packageName, KeySet ks)}. |
dcashman | c6f2249 | 2014-08-14 09:54:51 -0700 | [diff] [blame] | 5968 | * @hide |
dcashman | 9d2f441 | 2014-06-09 09:27:54 -0700 | [diff] [blame] | 5969 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 5970 | @UnsupportedAppUsage |
dcashman | 9d2f441 | 2014-06-09 09:27:54 -0700 | [diff] [blame] | 5971 | public abstract boolean isSignedByExactly(String packageName, KeySet ks); |
| 5972 | |
| 5973 | /** |
Suprabh Shukla | 7900049 | 2018-12-24 17:03:02 -0800 | [diff] [blame] | 5974 | * Flag to denote no restrictions. This should be used to clear any restrictions that may have |
| 5975 | * been previously set for the package. |
Suprabh Shukla | 7900049 | 2018-12-24 17:03:02 -0800 | [diff] [blame] | 5976 | * @hide |
Suprabh Shukla | 8b92443 | 2019-02-12 15:48:22 -0800 | [diff] [blame] | 5977 | * @see #setDistractingPackageRestrictions(String[], int) |
Suprabh Shukla | 7900049 | 2018-12-24 17:03:02 -0800 | [diff] [blame] | 5978 | */ |
| 5979 | @SystemApi |
| 5980 | public static final int RESTRICTION_NONE = 0x0; |
| 5981 | |
| 5982 | /** |
| 5983 | * Flag to denote that a package should be hidden from any suggestions to the user. |
Suprabh Shukla | 7900049 | 2018-12-24 17:03:02 -0800 | [diff] [blame] | 5984 | * @hide |
Suprabh Shukla | 8b92443 | 2019-02-12 15:48:22 -0800 | [diff] [blame] | 5985 | * @see #setDistractingPackageRestrictions(String[], int) |
Suprabh Shukla | 7900049 | 2018-12-24 17:03:02 -0800 | [diff] [blame] | 5986 | */ |
| 5987 | @SystemApi |
| 5988 | public static final int RESTRICTION_HIDE_FROM_SUGGESTIONS = 0x00000001; |
| 5989 | |
| 5990 | /** |
| 5991 | * Flag to denote that a package's notifications should be hidden. |
Suprabh Shukla | 7900049 | 2018-12-24 17:03:02 -0800 | [diff] [blame] | 5992 | * @hide |
Suprabh Shukla | 8b92443 | 2019-02-12 15:48:22 -0800 | [diff] [blame] | 5993 | * @see #setDistractingPackageRestrictions(String[], int) |
Suprabh Shukla | 7900049 | 2018-12-24 17:03:02 -0800 | [diff] [blame] | 5994 | */ |
| 5995 | @SystemApi |
| 5996 | public static final int RESTRICTION_HIDE_NOTIFICATIONS = 0x00000002; |
| 5997 | |
| 5998 | /** |
| 5999 | * Restriction flags to set on a package that is considered as distracting to the user. |
| 6000 | * These should help the user to restrict their usage of these apps. |
| 6001 | * |
| 6002 | * @see #setDistractingPackageRestrictions(String[], int) |
| 6003 | * @hide |
| 6004 | */ |
Suprabh Shukla | 7900049 | 2018-12-24 17:03:02 -0800 | [diff] [blame] | 6005 | @IntDef(flag = true, prefix = {"RESTRICTION_"}, value = { |
| 6006 | RESTRICTION_NONE, |
| 6007 | RESTRICTION_HIDE_FROM_SUGGESTIONS, |
| 6008 | RESTRICTION_HIDE_NOTIFICATIONS |
| 6009 | }) |
| 6010 | @Retention(RetentionPolicy.SOURCE) |
| 6011 | public @interface DistractionRestriction {} |
| 6012 | |
| 6013 | /** |
| 6014 | * Mark or unmark the given packages as distracting to the user. |
| 6015 | * These packages can have certain restrictions set that should discourage the user to launch |
| 6016 | * them often. For example, notifications from such an app can be hidden, or the app can be |
| 6017 | * removed from launcher suggestions, so the user is able to restrict their use of these apps. |
| 6018 | * |
| 6019 | * <p>The caller must hold {@link android.Manifest.permission#SUSPEND_APPS} to use this API. |
| 6020 | * |
| 6021 | * @param packages Packages to mark as distracting. |
Suprabh Shukla | 8b92443 | 2019-02-12 15:48:22 -0800 | [diff] [blame] | 6022 | * @param restrictionFlags Any combination of restrictions to impose on the given packages. |
| 6023 | * {@link #RESTRICTION_NONE} can be used to clear any existing |
| 6024 | * restrictions. |
Suprabh Shukla | 7900049 | 2018-12-24 17:03:02 -0800 | [diff] [blame] | 6025 | * @return A list of packages that could not have the {@code restrictionFlags} set. The system |
| 6026 | * may prevent restricting critical packages to preserve normal device function. |
| 6027 | * |
Suprabh Shukla | 7900049 | 2018-12-24 17:03:02 -0800 | [diff] [blame] | 6028 | * @hide |
Suprabh Shukla | 8b92443 | 2019-02-12 15:48:22 -0800 | [diff] [blame] | 6029 | * @see #RESTRICTION_NONE |
| 6030 | * @see #RESTRICTION_HIDE_FROM_SUGGESTIONS |
| 6031 | * @see #RESTRICTION_HIDE_NOTIFICATIONS |
Suprabh Shukla | 7900049 | 2018-12-24 17:03:02 -0800 | [diff] [blame] | 6032 | */ |
| 6033 | @SystemApi |
| 6034 | @RequiresPermission(android.Manifest.permission.SUSPEND_APPS) |
| 6035 | @NonNull |
| 6036 | public String[] setDistractingPackageRestrictions(@NonNull String[] packages, |
| 6037 | @DistractionRestriction int restrictionFlags) { |
| 6038 | throw new UnsupportedOperationException( |
| 6039 | "setDistractingPackageRestrictions not implemented"); |
| 6040 | } |
| 6041 | |
| 6042 | /** |
Andrei Stingaceanu | eb84b18 | 2016-01-26 18:39:55 +0000 | [diff] [blame] | 6043 | * 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] | 6044 | * |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 6045 | * <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] | 6046 | * 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] | 6047 | * show toasts or system alert windows or ring the device. |
| 6048 | * |
| 6049 | * <p>When the user tries to launch a suspended app, a system dialog with the given |
| 6050 | * {@code dialogMessage} will be shown instead. Since the message is supplied to the system as |
| 6051 | * a {@link String}, the caller needs to take care of localization as needed. |
| 6052 | * The dialog message can optionally contain a placeholder for the name of the suspended app. |
| 6053 | * The system uses {@link String#format(Locale, String, Object...) String.format} to insert the |
| 6054 | * app name into the message, so an example format string could be {@code "The app %1$s is |
| 6055 | * currently suspended"}. This makes it easier for callers to provide a single message which |
| 6056 | * works for all the packages being suspended in a single call. |
Andrei Stingaceanu | eb84b18 | 2016-01-26 18:39:55 +0000 | [diff] [blame] | 6057 | * |
Kenny Guy | 871f3eb | 2016-03-09 20:06:16 +0000 | [diff] [blame] | 6058 | * <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] | 6059 | * the package will no longer be suspended. </p> |
| 6060 | * |
| 6061 | * <p>Optionally, the suspending app can provide extra information in the form of |
| 6062 | * {@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] | 6063 | * 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] | 6064 | * |
Suprabh Shukla | 7900049 | 2018-12-24 17:03:02 -0800 | [diff] [blame] | 6065 | * <p>The caller must hold {@link Manifest.permission#SUSPEND_APPS} to use this API. |
Kenny Guy | 871f3eb | 2016-03-09 20:06:16 +0000 | [diff] [blame] | 6066 | * |
Andrei Stingaceanu | eb84b18 | 2016-01-26 18:39:55 +0000 | [diff] [blame] | 6067 | * @param packageNames The names of the packages to set the suspended status. |
Suprabh Shukla | 389cb6f | 2018-10-01 18:20:39 -0700 | [diff] [blame] | 6068 | * @param suspended If set to {@code true}, the packages will be suspended, if set to |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 6069 | * {@code false}, the packages will be unsuspended. |
| 6070 | * @param appExtras An optional {@link PersistableBundle} that the suspending app can provide |
| 6071 | * which will be shared with the apps being suspended. Ignored if |
| 6072 | * {@code suspended} is false. |
| 6073 | * @param launcherExtras An optional {@link PersistableBundle} that the suspending app can |
| 6074 | * provide which will be shared with the launcher. Ignored if |
| 6075 | * {@code suspended} is false. |
| 6076 | * @param dialogMessage The message to be displayed to the user, when they try to launch a |
| 6077 | * suspended app. |
Andrei Stingaceanu | 1e28391 | 2015-11-26 15:26:28 +0000 | [diff] [blame] | 6078 | * |
Suprabh Shukla | 3e03ab9 | 2018-04-11 16:03:49 -0700 | [diff] [blame] | 6079 | * @return an array of package names for which the suspended status could not be set as |
Suprabh Shukla | 389cb6f | 2018-10-01 18:20:39 -0700 | [diff] [blame] | 6080 | * requested in this method. Returns {@code null} if {@code packageNames} was {@code null}. |
| 6081 | * |
| 6082 | * @deprecated use {@link #setPackagesSuspended(String[], boolean, PersistableBundle, |
| 6083 | * PersistableBundle, android.content.pm.SuspendDialogInfo)} instead. |
| 6084 | * |
| 6085 | * @hide |
| 6086 | */ |
| 6087 | @SystemApi |
| 6088 | @Deprecated |
| 6089 | @RequiresPermission(Manifest.permission.SUSPEND_APPS) |
| 6090 | @Nullable |
| 6091 | public String[] setPackagesSuspended(@Nullable String[] packageNames, boolean suspended, |
| 6092 | @Nullable PersistableBundle appExtras, @Nullable PersistableBundle launcherExtras, |
| 6093 | @Nullable String dialogMessage) { |
| 6094 | throw new UnsupportedOperationException("setPackagesSuspended not implemented"); |
| 6095 | } |
| 6096 | |
| 6097 | /** |
| 6098 | * Puts the given packages in a suspended state, where attempts at starting activities are |
| 6099 | * denied. |
| 6100 | * |
| 6101 | * <p>The suspended application's notifications and all of its windows will be hidden, any |
| 6102 | * of its started activities will be stopped and it won't be able to ring the device. |
| 6103 | * It doesn't remove the data or the actual package file. |
| 6104 | * |
| 6105 | * <p>When the user tries to launch a suspended app, a system dialog alerting them that the app |
| 6106 | * is suspended will be shown instead. |
| 6107 | * The caller can optionally customize the dialog by passing a {@link SuspendDialogInfo} object |
Suprabh Shukla | 7900049 | 2018-12-24 17:03:02 -0800 | [diff] [blame] | 6108 | * to this API. This dialog will have a button that starts the |
Suprabh Shukla | 389cb6f | 2018-10-01 18:20:39 -0700 | [diff] [blame] | 6109 | * {@link Intent#ACTION_SHOW_SUSPENDED_APP_DETAILS} intent if the suspending app declares an |
| 6110 | * activity which handles this action. |
| 6111 | * |
| 6112 | * <p>The packages being suspended must already be installed. If a package is uninstalled, it |
| 6113 | * will no longer be suspended. |
| 6114 | * |
| 6115 | * <p>Optionally, the suspending app can provide extra information in the form of |
| 6116 | * {@link PersistableBundle} objects to be shared with the apps being suspended and the |
| 6117 | * launcher to support customization that they might need to handle the suspended state. |
| 6118 | * |
Suprabh Shukla | 7900049 | 2018-12-24 17:03:02 -0800 | [diff] [blame] | 6119 | * <p>The caller must hold {@link Manifest.permission#SUSPEND_APPS} to use this API. |
Suprabh Shukla | 389cb6f | 2018-10-01 18:20:39 -0700 | [diff] [blame] | 6120 | * |
| 6121 | * @param packageNames The names of the packages to set the suspended status. |
| 6122 | * @param suspended If set to {@code true}, the packages will be suspended, if set to |
| 6123 | * {@code false}, the packages will be unsuspended. |
| 6124 | * @param appExtras An optional {@link PersistableBundle} that the suspending app can provide |
| 6125 | * which will be shared with the apps being suspended. Ignored if |
| 6126 | * {@code suspended} is false. |
| 6127 | * @param launcherExtras An optional {@link PersistableBundle} that the suspending app can |
| 6128 | * provide which will be shared with the launcher. Ignored if |
| 6129 | * {@code suspended} is false. |
| 6130 | * @param dialogInfo An optional {@link SuspendDialogInfo} object describing the dialog that |
| 6131 | * should be shown to the user when they try to launch a suspended app. |
| 6132 | * Ignored if {@code suspended} is false. |
| 6133 | * |
| 6134 | * @return an array of package names for which the suspended status could not be set as |
| 6135 | * requested in this method. Returns {@code null} if {@code packageNames} was {@code null}. |
| 6136 | * |
| 6137 | * @see #isPackageSuspended |
| 6138 | * @see SuspendDialogInfo |
| 6139 | * @see SuspendDialogInfo.Builder |
| 6140 | * @see Intent#ACTION_SHOW_SUSPENDED_APP_DETAILS |
Andrei Stingaceanu | eb84b18 | 2016-01-26 18:39:55 +0000 | [diff] [blame] | 6141 | * |
Andrei Stingaceanu | 1e28391 | 2015-11-26 15:26:28 +0000 | [diff] [blame] | 6142 | * @hide |
| 6143 | */ |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 6144 | @SystemApi |
Suprabh Shukla | 14405c9 | 2018-05-16 20:41:00 -0700 | [diff] [blame] | 6145 | @RequiresPermission(Manifest.permission.SUSPEND_APPS) |
Suprabh Shukla | 389cb6f | 2018-10-01 18:20:39 -0700 | [diff] [blame] | 6146 | @Nullable |
| 6147 | public String[] setPackagesSuspended(@Nullable String[] packageNames, boolean suspended, |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 6148 | @Nullable PersistableBundle appExtras, @Nullable PersistableBundle launcherExtras, |
Suprabh Shukla | 389cb6f | 2018-10-01 18:20:39 -0700 | [diff] [blame] | 6149 | @Nullable SuspendDialogInfo dialogInfo) { |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 6150 | throw new UnsupportedOperationException("setPackagesSuspended not implemented"); |
| 6151 | } |
Andrei Stingaceanu | 1e28391 | 2015-11-26 15:26:28 +0000 | [diff] [blame] | 6152 | |
Andrei Stingaceanu | 355b232 | 2016-02-12 16:43:51 +0000 | [diff] [blame] | 6153 | /** |
Suprabh Shukla | 436d093ba | 2018-12-12 16:01:41 +0000 | [diff] [blame] | 6154 | * Returns any packages in a given set of packages that cannot be suspended via a call to {@link |
Suprabh Shukla | 1f1de70 | 2018-11-09 22:49:23 -0800 | [diff] [blame] | 6155 | * #setPackagesSuspended(String[], boolean, PersistableBundle, PersistableBundle, |
| 6156 | * SuspendDialogInfo) setPackagesSuspended}. The platform prevents suspending certain critical |
| 6157 | * packages to keep the device in a functioning state, e.g. the default dialer. |
Suprabh Shukla | 7900049 | 2018-12-24 17:03:02 -0800 | [diff] [blame] | 6158 | * Apps need to hold {@link Manifest.permission#SUSPEND_APPS SUSPEND_APPS} to call this API. |
Suprabh Shukla | 1f1de70 | 2018-11-09 22:49:23 -0800 | [diff] [blame] | 6159 | * |
| 6160 | * <p> |
Suprabh Shukla | 436d093ba | 2018-12-12 16:01:41 +0000 | [diff] [blame] | 6161 | * Note that this set of critical packages can change with time, so even though a package name |
| 6162 | * was not returned by this call, it does not guarantee that a subsequent call to |
| 6163 | * {@link #setPackagesSuspended(String[], boolean, PersistableBundle, PersistableBundle, |
| 6164 | * SuspendDialogInfo) setPackagesSuspended} for that package will succeed, especially if |
| 6165 | * significant time elapsed between the two calls. |
Suprabh Shukla | 1f1de70 | 2018-11-09 22:49:23 -0800 | [diff] [blame] | 6166 | * |
Suprabh Shukla | 436d093ba | 2018-12-12 16:01:41 +0000 | [diff] [blame] | 6167 | * @param packageNames The packages to check. |
| 6168 | * @return A list of packages that can not be currently suspended by the system. |
Suprabh Shukla | 1f1de70 | 2018-11-09 22:49:23 -0800 | [diff] [blame] | 6169 | * @hide |
| 6170 | */ |
| 6171 | @SystemApi |
| 6172 | @RequiresPermission(Manifest.permission.SUSPEND_APPS) |
Suprabh Shukla | 436d093ba | 2018-12-12 16:01:41 +0000 | [diff] [blame] | 6173 | @NonNull |
| 6174 | public String[] getUnsuspendablePackages(@NonNull String[] packageNames) { |
| 6175 | throw new UnsupportedOperationException("canSuspendPackages not implemented"); |
Suprabh Shukla | 1f1de70 | 2018-11-09 22:49:23 -0800 | [diff] [blame] | 6176 | } |
| 6177 | |
| 6178 | /** |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 6179 | * @see #setPackagesSuspended(String[], boolean, PersistableBundle, PersistableBundle, String) |
Andrei Stingaceanu | 355b232 | 2016-02-12 16:43:51 +0000 | [diff] [blame] | 6180 | * @param packageName The name of the package to get the suspended status of. |
| 6181 | * @param userId The user id. |
| 6182 | * @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] | 6183 | * suspended. |
| 6184 | * @throws IllegalArgumentException if the package was not found. |
Andrei Stingaceanu | 355b232 | 2016-02-12 16:43:51 +0000 | [diff] [blame] | 6185 | * @hide |
| 6186 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 6187 | @UnsupportedAppUsage |
Andrei Stingaceanu | 355b232 | 2016-02-12 16:43:51 +0000 | [diff] [blame] | 6188 | public abstract boolean isPackageSuspendedForUser(String packageName, int userId); |
| 6189 | |
Jeff Sharkey | 9bc89af | 2017-01-11 11:25:50 -0700 | [diff] [blame] | 6190 | /** |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 6191 | * Query if an app is currently suspended. |
| 6192 | * |
| 6193 | * @return {@code true} if the given package is suspended, {@code false} otherwise |
Suprabh Shukla | 96212bc | 2018-04-10 15:04:51 -0700 | [diff] [blame] | 6194 | * @throws NameNotFoundException if the package could not be found. |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 6195 | * |
Suprabh Shukla | a89d7f8 | 2018-08-13 14:27:01 -0700 | [diff] [blame] | 6196 | * @see #isPackageSuspended() |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 6197 | */ |
Suprabh Shukla | 96212bc | 2018-04-10 15:04:51 -0700 | [diff] [blame] | 6198 | public boolean isPackageSuspended(String packageName) throws NameNotFoundException { |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 6199 | throw new UnsupportedOperationException("isPackageSuspended not implemented"); |
| 6200 | } |
| 6201 | |
| 6202 | /** |
Suprabh Shukla | 2fd43ba | 2018-03-22 16:57:49 -0700 | [diff] [blame] | 6203 | * Apps can query this to know if they have been suspended. A system app with the permission |
| 6204 | * {@code android.permission.SUSPEND_APPS} can put any app on the device into a suspended state. |
| 6205 | * |
| 6206 | * <p>While in this state, the application's notifications will be hidden, any of its started |
Suprabh Shukla | 3017fe4 | 2018-11-08 19:00:01 -0800 | [diff] [blame] | 6207 | * activities will be stopped and it will not be able to show toasts or dialogs or play audio. |
| 6208 | * When the user tries to launch a suspended app, the system will, instead, show a |
Suprabh Shukla | 2fd43ba | 2018-03-22 16:57:49 -0700 | [diff] [blame] | 6209 | * dialog to the user informing them that they cannot use this app while it is suspended. |
| 6210 | * |
| 6211 | * <p>When an app is put into this state, the broadcast action |
| 6212 | * {@link Intent#ACTION_MY_PACKAGE_SUSPENDED} will be delivered to any of its broadcast |
| 6213 | * receivers that included this action in their intent-filters, <em>including manifest |
| 6214 | * receivers.</em> Similarly, a broadcast action {@link Intent#ACTION_MY_PACKAGE_UNSUSPENDED} |
Suprabh Shukla | 3017fe4 | 2018-11-08 19:00:01 -0800 | [diff] [blame] | 6215 | * is delivered when a previously suspended app is taken out of this state. Apps are expected to |
| 6216 | * use these to gracefully deal with transitions to and from this state. |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 6217 | * |
| 6218 | * @return {@code true} if the calling package has been suspended, {@code false} otherwise. |
| 6219 | * |
| 6220 | * @see #getSuspendedPackageAppExtras() |
Suprabh Shukla | 2fd43ba | 2018-03-22 16:57:49 -0700 | [diff] [blame] | 6221 | * @see Intent#ACTION_MY_PACKAGE_SUSPENDED |
| 6222 | * @see Intent#ACTION_MY_PACKAGE_UNSUSPENDED |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 6223 | */ |
| 6224 | public boolean isPackageSuspended() { |
| 6225 | throw new UnsupportedOperationException("isPackageSuspended not implemented"); |
| 6226 | } |
| 6227 | |
| 6228 | /** |
Suprabh Shukla | 96212bc | 2018-04-10 15:04:51 -0700 | [diff] [blame] | 6229 | * Returns a {@link Bundle} of extras that was meant to be sent to the calling app when it was |
| 6230 | * suspended. An app with the permission {@code android.permission.SUSPEND_APPS} can supply this |
| 6231 | * to the system at the time of suspending an app. |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 6232 | * |
Suprabh Shukla | 96212bc | 2018-04-10 15:04:51 -0700 | [diff] [blame] | 6233 | * <p>This is the same {@link Bundle} that is sent along with the broadcast |
| 6234 | * {@link Intent#ACTION_MY_PACKAGE_SUSPENDED}, whenever the app is suspended. The contents of |
| 6235 | * this {@link Bundle} are a contract between the suspended app and the suspending app. |
| 6236 | * |
| 6237 | * <p>Note: These extras are optional, so if no extras were supplied to the system, this method |
| 6238 | * will return {@code null}, even when the calling app has been suspended. |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 6239 | * |
Suprabh Shukla | 2fd43ba | 2018-03-22 16:57:49 -0700 | [diff] [blame] | 6240 | * @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] | 6241 | * package is not currently suspended. |
Suprabh Shukla | 2fd43ba | 2018-03-22 16:57:49 -0700 | [diff] [blame] | 6242 | * |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 6243 | * @see #isPackageSuspended() |
Suprabh Shukla | 2fd43ba | 2018-03-22 16:57:49 -0700 | [diff] [blame] | 6244 | * @see Intent#ACTION_MY_PACKAGE_UNSUSPENDED |
| 6245 | * @see Intent#ACTION_MY_PACKAGE_SUSPENDED |
Suprabh Shukla | 96212bc | 2018-04-10 15:04:51 -0700 | [diff] [blame] | 6246 | * @see Intent#EXTRA_SUSPENDED_PACKAGE_EXTRAS |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 6247 | */ |
Suprabh Shukla | 2fd43ba | 2018-03-22 16:57:49 -0700 | [diff] [blame] | 6248 | public @Nullable Bundle getSuspendedPackageAppExtras() { |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 6249 | throw new UnsupportedOperationException("getSuspendedPackageAppExtras not implemented"); |
| 6250 | } |
| 6251 | |
| 6252 | /** |
Jeff Sharkey | 9bc89af | 2017-01-11 11:25:50 -0700 | [diff] [blame] | 6253 | * Provide a hint of what the {@link ApplicationInfo#category} value should |
| 6254 | * be for the given package. |
| 6255 | * <p> |
| 6256 | * This hint can only be set by the app which installed this package, as |
| 6257 | * determined by {@link #getInstallerPackageName(String)}. |
Jeff Sharkey | 60a82cd | 2017-04-18 18:19:16 -0600 | [diff] [blame] | 6258 | * |
| 6259 | * @param packageName the package to change the category hint for. |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 6260 | * @param categoryHint the category hint to set. |
Jeff Sharkey | 9bc89af | 2017-01-11 11:25:50 -0700 | [diff] [blame] | 6261 | */ |
Jeff Sharkey | 60a82cd | 2017-04-18 18:19:16 -0600 | [diff] [blame] | 6262 | public abstract void setApplicationCategoryHint(@NonNull String packageName, |
Jeff Sharkey | 9bc89af | 2017-01-11 11:25:50 -0700 | [diff] [blame] | 6263 | @ApplicationInfo.Category int categoryHint); |
| 6264 | |
Jeff Sharkey | b2b9ab8 | 2015-04-05 21:10:42 -0700 | [diff] [blame] | 6265 | /** {@hide} */ |
Jeff Sharkey | 620b32b | 2015-04-23 19:36:02 -0700 | [diff] [blame] | 6266 | public static boolean isMoveStatusFinished(int status) { |
| 6267 | return (status < 0 || status > 100); |
| 6268 | } |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 6269 | |
Jeff Sharkey | e2d45be | 2015-04-15 17:14:12 -0700 | [diff] [blame] | 6270 | /** {@hide} */ |
Jeff Sharkey | 620b32b | 2015-04-23 19:36:02 -0700 | [diff] [blame] | 6271 | public static abstract class MoveCallback { |
Jeff Sharkey | 50a0545 | 2015-04-29 11:24:52 -0700 | [diff] [blame] | 6272 | public void onCreated(int moveId, Bundle extras) {} |
| 6273 | public abstract void onStatusChanged(int moveId, int status, long estMillis); |
Jeff Sharkey | 620b32b | 2015-04-23 19:36:02 -0700 | [diff] [blame] | 6274 | } |
Jeff Sharkey | e2d45be | 2015-04-15 17:14:12 -0700 | [diff] [blame] | 6275 | |
| 6276 | /** {@hide} */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 6277 | @UnsupportedAppUsage |
Jeff Sharkey | 620b32b | 2015-04-23 19:36:02 -0700 | [diff] [blame] | 6278 | public abstract int getMoveStatus(int moveId); |
| 6279 | |
| 6280 | /** {@hide} */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 6281 | @UnsupportedAppUsage |
Jeff Sharkey | 620b32b | 2015-04-23 19:36:02 -0700 | [diff] [blame] | 6282 | public abstract void registerMoveCallback(MoveCallback callback, Handler handler); |
| 6283 | /** {@hide} */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 6284 | @UnsupportedAppUsage |
Jeff Sharkey | 620b32b | 2015-04-23 19:36:02 -0700 | [diff] [blame] | 6285 | public abstract void unregisterMoveCallback(MoveCallback callback); |
| 6286 | |
| 6287 | /** {@hide} */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 6288 | @UnsupportedAppUsage |
Jeff Sharkey | 620b32b | 2015-04-23 19:36:02 -0700 | [diff] [blame] | 6289 | public abstract int movePackage(String packageName, VolumeInfo vol); |
| 6290 | /** {@hide} */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 6291 | @UnsupportedAppUsage |
Jeff Sharkey | 620b32b | 2015-04-23 19:36:02 -0700 | [diff] [blame] | 6292 | public abstract @Nullable VolumeInfo getPackageCurrentVolume(ApplicationInfo app); |
| 6293 | /** {@hide} */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 6294 | @UnsupportedAppUsage |
Jeff Sharkey | 620b32b | 2015-04-23 19:36:02 -0700 | [diff] [blame] | 6295 | public abstract @NonNull List<VolumeInfo> getPackageCandidateVolumes(ApplicationInfo app); |
| 6296 | |
| 6297 | /** {@hide} */ |
| 6298 | public abstract int movePrimaryStorage(VolumeInfo vol); |
| 6299 | /** {@hide} */ |
| 6300 | public abstract @Nullable VolumeInfo getPrimaryStorageCurrentVolume(); |
| 6301 | /** {@hide} */ |
| 6302 | public abstract @NonNull List<VolumeInfo> getPrimaryStorageCandidateVolumes(); |
Jeff Sharkey | e2d45be | 2015-04-15 17:14:12 -0700 | [diff] [blame] | 6303 | |
Amith Yamasani | 4b2e934 | 2011-03-31 12:38:53 -0700 | [diff] [blame] | 6304 | /** |
Amith Yamasani | 1359360 | 2012-03-22 16:16:17 -0700 | [diff] [blame] | 6305 | * Returns the device identity that verifiers can use to associate their scheme to a particular |
| 6306 | * 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] | 6307 | * |
Kenny Root | 0aaa0d9 | 2011-09-12 16:42:55 -0700 | [diff] [blame] | 6308 | * @return identity that uniquely identifies current device |
| 6309 | * @hide |
| 6310 | */ |
| 6311 | public abstract VerifierDeviceIdentity getVerifierDeviceIdentity(); |
Amith Yamasani | 742a671 | 2011-05-04 14:49:28 -0700 | [diff] [blame] | 6312 | |
Jeff Sharkey | 6c833e0 | 2014-07-14 22:44:30 -0700 | [diff] [blame] | 6313 | /** |
Jeff Hao | 9f60c08 | 2014-10-28 18:51:07 -0700 | [diff] [blame] | 6314 | * Returns true if the device is upgrading, such as first boot after OTA. |
| 6315 | * |
| 6316 | * @hide |
| 6317 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 6318 | @UnsupportedAppUsage |
Jeff Hao | 9f60c08 | 2014-10-28 18:51:07 -0700 | [diff] [blame] | 6319 | public abstract boolean isUpgrade(); |
| 6320 | |
| 6321 | /** |
Jeff Sharkey | 6c833e0 | 2014-07-14 22:44:30 -0700 | [diff] [blame] | 6322 | * Return interface that offers the ability to install, upgrade, and remove |
| 6323 | * applications on the device. |
| 6324 | */ |
Jeff Sharkey | 16c8e3f | 2014-07-24 17:08:17 -0700 | [diff] [blame] | 6325 | public abstract @NonNull PackageInstaller getPackageInstaller(); |
Jeff Sharkey | 3a44f3f | 2014-04-28 17:36:31 -0700 | [diff] [blame] | 6326 | |
Amith Yamasani | 742a671 | 2011-05-04 14:49:28 -0700 | [diff] [blame] | 6327 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 6328 | * Adds a {@code CrossProfileIntentFilter}. After calling this method all |
| 6329 | * intents sent from the user with id sourceUserId can also be be resolved |
| 6330 | * by activities in the user with id targetUserId if they match the |
| 6331 | * specified intent filter. |
| 6332 | * |
Nicolas Prevot | 3f7777f | 2014-07-24 15:58:39 +0100 | [diff] [blame] | 6333 | * @param filter The {@link IntentFilter} the intent has to match |
| 6334 | * @param sourceUserId The source user id. |
| 6335 | * @param targetUserId The target user id. |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 6336 | * @param flags The possible values are {@link #SKIP_CURRENT_PROFILE} and |
| 6337 | * {@link #ONLY_IF_NO_MATCH_FOUND}. |
Nicolas Prevot | c79586e | 2014-05-06 12:47:57 +0100 | [diff] [blame] | 6338 | * @hide |
| 6339 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 6340 | @UnsupportedAppUsage |
Nicolas Prevot | 63798c5 | 2014-05-27 13:22:38 +0100 | [diff] [blame] | 6341 | public abstract void addCrossProfileIntentFilter(IntentFilter filter, int sourceUserId, |
| 6342 | int targetUserId, int flags); |
Nicolas Prevot | c79586e | 2014-05-06 12:47:57 +0100 | [diff] [blame] | 6343 | |
| 6344 | /** |
Jeff Sharkey | 5aa8693 | 2016-01-08 19:07:49 -0700 | [diff] [blame] | 6345 | * Clearing {@code CrossProfileIntentFilter}s which have the specified user |
| 6346 | * as their source, and have been set by the app calling this method. |
| 6347 | * |
Nicolas Prevot | 3f7777f | 2014-07-24 15:58:39 +0100 | [diff] [blame] | 6348 | * @param sourceUserId The source user id. |
Nicolas Prevot | c79586e | 2014-05-06 12:47:57 +0100 | [diff] [blame] | 6349 | * @hide |
| 6350 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 6351 | @UnsupportedAppUsage |
Nicolas Prevot | 8194899 | 2014-05-16 18:25:26 +0100 | [diff] [blame] | 6352 | public abstract void clearCrossProfileIntentFilters(int sourceUserId); |
Alexandra Gherghina | 6e2ae25 | 2014-06-12 16:03:58 +0100 | [diff] [blame] | 6353 | |
| 6354 | /** |
Nicolas Prevot | 88cc346 | 2014-05-14 14:51:48 +0100 | [diff] [blame] | 6355 | * @hide |
| 6356 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 6357 | @UnsupportedAppUsage |
Nicolas Prevot | 7f7b0c7 | 2014-06-23 15:59:38 +0100 | [diff] [blame] | 6358 | public abstract Drawable loadItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo); |
Jeff Sharkey | 6c833e0 | 2014-07-14 22:44:30 -0700 | [diff] [blame] | 6359 | |
Benjamin Franz | ec2d48b | 2014-10-01 15:38:43 +0100 | [diff] [blame] | 6360 | /** |
| 6361 | * @hide |
| 6362 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 6363 | @UnsupportedAppUsage |
Benjamin Franz | ec2d48b | 2014-10-01 15:38:43 +0100 | [diff] [blame] | 6364 | public abstract Drawable loadUnbadgedItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo); |
| 6365 | |
Jeff Sharkey | 6c833e0 | 2014-07-14 22:44:30 -0700 | [diff] [blame] | 6366 | /** {@hide} */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 6367 | @UnsupportedAppUsage |
Jeff Sharkey | 6c833e0 | 2014-07-14 22:44:30 -0700 | [diff] [blame] | 6368 | public abstract boolean isPackageAvailable(String packageName); |
Jeff Sharkey | 16c8e3f | 2014-07-24 17:08:17 -0700 | [diff] [blame] | 6369 | |
| 6370 | /** {@hide} */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 6371 | @UnsupportedAppUsage |
Jeff Sharkey | a090743 | 2014-08-15 10:23:11 -0700 | [diff] [blame] | 6372 | public static String installStatusToString(int status, String msg) { |
| 6373 | final String str = installStatusToString(status); |
| 6374 | if (msg != null) { |
| 6375 | return str + ": " + msg; |
| 6376 | } else { |
| 6377 | return str; |
| 6378 | } |
| 6379 | } |
| 6380 | |
| 6381 | /** {@hide} */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 6382 | @UnsupportedAppUsage |
Jeff Sharkey | 16c8e3f | 2014-07-24 17:08:17 -0700 | [diff] [blame] | 6383 | public static String installStatusToString(int status) { |
| 6384 | switch (status) { |
| 6385 | case INSTALL_SUCCEEDED: return "INSTALL_SUCCEEDED"; |
| 6386 | case INSTALL_FAILED_ALREADY_EXISTS: return "INSTALL_FAILED_ALREADY_EXISTS"; |
| 6387 | case INSTALL_FAILED_INVALID_APK: return "INSTALL_FAILED_INVALID_APK"; |
| 6388 | case INSTALL_FAILED_INVALID_URI: return "INSTALL_FAILED_INVALID_URI"; |
| 6389 | case INSTALL_FAILED_INSUFFICIENT_STORAGE: return "INSTALL_FAILED_INSUFFICIENT_STORAGE"; |
| 6390 | case INSTALL_FAILED_DUPLICATE_PACKAGE: return "INSTALL_FAILED_DUPLICATE_PACKAGE"; |
| 6391 | case INSTALL_FAILED_NO_SHARED_USER: return "INSTALL_FAILED_NO_SHARED_USER"; |
| 6392 | case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return "INSTALL_FAILED_UPDATE_INCOMPATIBLE"; |
| 6393 | case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return "INSTALL_FAILED_SHARED_USER_INCOMPATIBLE"; |
| 6394 | case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return "INSTALL_FAILED_MISSING_SHARED_LIBRARY"; |
| 6395 | case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return "INSTALL_FAILED_REPLACE_COULDNT_DELETE"; |
| 6396 | case INSTALL_FAILED_DEXOPT: return "INSTALL_FAILED_DEXOPT"; |
| 6397 | case INSTALL_FAILED_OLDER_SDK: return "INSTALL_FAILED_OLDER_SDK"; |
| 6398 | case INSTALL_FAILED_CONFLICTING_PROVIDER: return "INSTALL_FAILED_CONFLICTING_PROVIDER"; |
| 6399 | case INSTALL_FAILED_NEWER_SDK: return "INSTALL_FAILED_NEWER_SDK"; |
| 6400 | case INSTALL_FAILED_TEST_ONLY: return "INSTALL_FAILED_TEST_ONLY"; |
| 6401 | case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return "INSTALL_FAILED_CPU_ABI_INCOMPATIBLE"; |
| 6402 | case INSTALL_FAILED_MISSING_FEATURE: return "INSTALL_FAILED_MISSING_FEATURE"; |
| 6403 | case INSTALL_FAILED_CONTAINER_ERROR: return "INSTALL_FAILED_CONTAINER_ERROR"; |
| 6404 | case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return "INSTALL_FAILED_INVALID_INSTALL_LOCATION"; |
| 6405 | case INSTALL_FAILED_MEDIA_UNAVAILABLE: return "INSTALL_FAILED_MEDIA_UNAVAILABLE"; |
| 6406 | case INSTALL_FAILED_VERIFICATION_TIMEOUT: return "INSTALL_FAILED_VERIFICATION_TIMEOUT"; |
| 6407 | case INSTALL_FAILED_VERIFICATION_FAILURE: return "INSTALL_FAILED_VERIFICATION_FAILURE"; |
| 6408 | case INSTALL_FAILED_PACKAGE_CHANGED: return "INSTALL_FAILED_PACKAGE_CHANGED"; |
| 6409 | case INSTALL_FAILED_UID_CHANGED: return "INSTALL_FAILED_UID_CHANGED"; |
| 6410 | case INSTALL_FAILED_VERSION_DOWNGRADE: return "INSTALL_FAILED_VERSION_DOWNGRADE"; |
| 6411 | case INSTALL_PARSE_FAILED_NOT_APK: return "INSTALL_PARSE_FAILED_NOT_APK"; |
| 6412 | case INSTALL_PARSE_FAILED_BAD_MANIFEST: return "INSTALL_PARSE_FAILED_BAD_MANIFEST"; |
| 6413 | case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return "INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION"; |
| 6414 | case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return "INSTALL_PARSE_FAILED_NO_CERTIFICATES"; |
| 6415 | case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return "INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES"; |
| 6416 | case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return "INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING"; |
| 6417 | case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return "INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME"; |
| 6418 | case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return "INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID"; |
| 6419 | case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return "INSTALL_PARSE_FAILED_MANIFEST_MALFORMED"; |
| 6420 | case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return "INSTALL_PARSE_FAILED_MANIFEST_EMPTY"; |
| 6421 | case INSTALL_FAILED_INTERNAL_ERROR: return "INSTALL_FAILED_INTERNAL_ERROR"; |
| 6422 | case INSTALL_FAILED_USER_RESTRICTED: return "INSTALL_FAILED_USER_RESTRICTED"; |
| 6423 | case INSTALL_FAILED_DUPLICATE_PERMISSION: return "INSTALL_FAILED_DUPLICATE_PERMISSION"; |
| 6424 | case INSTALL_FAILED_NO_MATCHING_ABIS: return "INSTALL_FAILED_NO_MATCHING_ABIS"; |
Jeff Sharkey | f060095 | 2014-08-07 17:31:53 -0700 | [diff] [blame] | 6425 | case INSTALL_FAILED_ABORTED: return "INSTALL_FAILED_ABORTED"; |
Todd Kennedy | 29cfa27 | 2018-09-26 10:25:24 -0700 | [diff] [blame] | 6426 | case INSTALL_FAILED_BAD_DEX_METADATA: return "INSTALL_FAILED_BAD_DEX_METADATA"; |
| 6427 | case INSTALL_FAILED_MISSING_SPLIT: return "INSTALL_FAILED_MISSING_SPLIT"; |
Victor Hsieh | c0cd748 | 2018-10-04 10:10:54 -0700 | [diff] [blame] | 6428 | case INSTALL_FAILED_BAD_SIGNATURE: return "INSTALL_FAILED_BAD_SIGNATURE"; |
Jeff Sharkey | 16c8e3f | 2014-07-24 17:08:17 -0700 | [diff] [blame] | 6429 | default: return Integer.toString(status); |
| 6430 | } |
| 6431 | } |
| 6432 | |
| 6433 | /** {@hide} */ |
Jeff Sharkey | a090743 | 2014-08-15 10:23:11 -0700 | [diff] [blame] | 6434 | public static int installStatusToPublicStatus(int status) { |
Jeff Sharkey | 16c8e3f | 2014-07-24 17:08:17 -0700 | [diff] [blame] | 6435 | switch (status) { |
Jeff Sharkey | a090743 | 2014-08-15 10:23:11 -0700 | [diff] [blame] | 6436 | case INSTALL_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS; |
| 6437 | case INSTALL_FAILED_ALREADY_EXISTS: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 6438 | case INSTALL_FAILED_INVALID_APK: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 6439 | case INSTALL_FAILED_INVALID_URI: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 6440 | case INSTALL_FAILED_INSUFFICIENT_STORAGE: return PackageInstaller.STATUS_FAILURE_STORAGE; |
| 6441 | case INSTALL_FAILED_DUPLICATE_PACKAGE: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 6442 | case INSTALL_FAILED_NO_SHARED_USER: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 6443 | case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 6444 | case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 6445 | case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; |
| 6446 | case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 6447 | case INSTALL_FAILED_DEXOPT: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 6448 | case INSTALL_FAILED_OLDER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; |
| 6449 | case INSTALL_FAILED_CONFLICTING_PROVIDER: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 6450 | case INSTALL_FAILED_NEWER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; |
| 6451 | case INSTALL_FAILED_TEST_ONLY: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 6452 | case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; |
| 6453 | case INSTALL_FAILED_MISSING_FEATURE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; |
| 6454 | case INSTALL_FAILED_CONTAINER_ERROR: return PackageInstaller.STATUS_FAILURE_STORAGE; |
| 6455 | case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return PackageInstaller.STATUS_FAILURE_STORAGE; |
| 6456 | case INSTALL_FAILED_MEDIA_UNAVAILABLE: return PackageInstaller.STATUS_FAILURE_STORAGE; |
| 6457 | case INSTALL_FAILED_VERIFICATION_TIMEOUT: return PackageInstaller.STATUS_FAILURE_ABORTED; |
| 6458 | case INSTALL_FAILED_VERIFICATION_FAILURE: return PackageInstaller.STATUS_FAILURE_ABORTED; |
| 6459 | case INSTALL_FAILED_PACKAGE_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 6460 | case INSTALL_FAILED_UID_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 6461 | case INSTALL_FAILED_VERSION_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID; |
Svetoslav | d965370 | 2015-05-13 18:02:46 -0700 | [diff] [blame] | 6462 | case INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID; |
Jeff Sharkey | a090743 | 2014-08-15 10:23:11 -0700 | [diff] [blame] | 6463 | case INSTALL_PARSE_FAILED_NOT_APK: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 6464 | case INSTALL_PARSE_FAILED_BAD_MANIFEST: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 6465 | case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 6466 | case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 6467 | case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 6468 | case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 6469 | case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 6470 | case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 6471 | case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return PackageInstaller.STATUS_FAILURE_INVALID; |
| 6472 | case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return PackageInstaller.STATUS_FAILURE_INVALID; |
Calin Juravle | 3fc56c3 | 2017-12-11 18:26:13 -0800 | [diff] [blame] | 6473 | case INSTALL_FAILED_BAD_DEX_METADATA: return PackageInstaller.STATUS_FAILURE_INVALID; |
Victor Hsieh | c0cd748 | 2018-10-04 10:10:54 -0700 | [diff] [blame] | 6474 | case INSTALL_FAILED_BAD_SIGNATURE: return PackageInstaller.STATUS_FAILURE_INVALID; |
Jeff Sharkey | a090743 | 2014-08-15 10:23:11 -0700 | [diff] [blame] | 6475 | case INSTALL_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE; |
| 6476 | case INSTALL_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; |
| 6477 | case INSTALL_FAILED_DUPLICATE_PERMISSION: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
| 6478 | case INSTALL_FAILED_NO_MATCHING_ABIS: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; |
| 6479 | case INSTALL_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED; |
Todd Kennedy | 29cfa27 | 2018-09-26 10:25:24 -0700 | [diff] [blame] | 6480 | case INSTALL_FAILED_MISSING_SPLIT: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; |
Jeff Sharkey | a090743 | 2014-08-15 10:23:11 -0700 | [diff] [blame] | 6481 | default: return PackageInstaller.STATUS_FAILURE; |
| 6482 | } |
| 6483 | } |
| 6484 | |
| 6485 | /** {@hide} */ |
| 6486 | public static String deleteStatusToString(int status, String msg) { |
| 6487 | final String str = deleteStatusToString(status); |
| 6488 | if (msg != null) { |
| 6489 | return str + ": " + msg; |
| 6490 | } else { |
| 6491 | return str; |
Jeff Sharkey | 16c8e3f | 2014-07-24 17:08:17 -0700 | [diff] [blame] | 6492 | } |
| 6493 | } |
| 6494 | |
| 6495 | /** {@hide} */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 6496 | @UnsupportedAppUsage |
Jeff Sharkey | 16c8e3f | 2014-07-24 17:08:17 -0700 | [diff] [blame] | 6497 | public static String deleteStatusToString(int status) { |
| 6498 | switch (status) { |
| 6499 | case DELETE_SUCCEEDED: return "DELETE_SUCCEEDED"; |
| 6500 | case DELETE_FAILED_INTERNAL_ERROR: return "DELETE_FAILED_INTERNAL_ERROR"; |
| 6501 | case DELETE_FAILED_DEVICE_POLICY_MANAGER: return "DELETE_FAILED_DEVICE_POLICY_MANAGER"; |
| 6502 | case DELETE_FAILED_USER_RESTRICTED: return "DELETE_FAILED_USER_RESTRICTED"; |
| 6503 | case DELETE_FAILED_OWNER_BLOCKED: return "DELETE_FAILED_OWNER_BLOCKED"; |
Jeff Sharkey | f060095 | 2014-08-07 17:31:53 -0700 | [diff] [blame] | 6504 | case DELETE_FAILED_ABORTED: return "DELETE_FAILED_ABORTED"; |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 6505 | case DELETE_FAILED_USED_SHARED_LIBRARY: return "DELETE_FAILED_USED_SHARED_LIBRARY"; |
Jeff Sharkey | 16c8e3f | 2014-07-24 17:08:17 -0700 | [diff] [blame] | 6506 | default: return Integer.toString(status); |
| 6507 | } |
| 6508 | } |
Jeff Sharkey | f060095 | 2014-08-07 17:31:53 -0700 | [diff] [blame] | 6509 | |
| 6510 | /** {@hide} */ |
Jeff Sharkey | a090743 | 2014-08-15 10:23:11 -0700 | [diff] [blame] | 6511 | public static int deleteStatusToPublicStatus(int status) { |
Jeff Sharkey | f060095 | 2014-08-07 17:31:53 -0700 | [diff] [blame] | 6512 | switch (status) { |
Jeff Sharkey | a090743 | 2014-08-15 10:23:11 -0700 | [diff] [blame] | 6513 | case DELETE_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS; |
| 6514 | case DELETE_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE; |
| 6515 | case DELETE_FAILED_DEVICE_POLICY_MANAGER: return PackageInstaller.STATUS_FAILURE_BLOCKED; |
| 6516 | case DELETE_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_BLOCKED; |
| 6517 | case DELETE_FAILED_OWNER_BLOCKED: return PackageInstaller.STATUS_FAILURE_BLOCKED; |
| 6518 | case DELETE_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED; |
Svet Ganov | 6788212 | 2016-12-11 16:36:34 -0800 | [diff] [blame] | 6519 | case DELETE_FAILED_USED_SHARED_LIBRARY: return PackageInstaller.STATUS_FAILURE_CONFLICT; |
Jeff Sharkey | a090743 | 2014-08-15 10:23:11 -0700 | [diff] [blame] | 6520 | default: return PackageInstaller.STATUS_FAILURE; |
Jeff Sharkey | f060095 | 2014-08-07 17:31:53 -0700 | [diff] [blame] | 6521 | } |
| 6522 | } |
Jeff Sharkey | 6c0b9da | 2014-08-07 22:07:11 -0700 | [diff] [blame] | 6523 | |
| 6524 | /** {@hide} */ |
Svet Ganov | 77ab6a8 | 2015-07-03 12:03:02 -0700 | [diff] [blame] | 6525 | public static String permissionFlagToString(int flag) { |
| 6526 | switch (flag) { |
Svetoslav | 4a5f4a2 | 2015-07-07 18:18:15 -0700 | [diff] [blame] | 6527 | case FLAG_PERMISSION_GRANTED_BY_DEFAULT: return "GRANTED_BY_DEFAULT"; |
| 6528 | case FLAG_PERMISSION_POLICY_FIXED: return "POLICY_FIXED"; |
| 6529 | case FLAG_PERMISSION_SYSTEM_FIXED: return "SYSTEM_FIXED"; |
| 6530 | case FLAG_PERMISSION_USER_SET: return "USER_SET"; |
| 6531 | case FLAG_PERMISSION_REVOKE_ON_UPGRADE: return "REVOKE_ON_UPGRADE"; |
| 6532 | case FLAG_PERMISSION_USER_FIXED: return "USER_FIXED"; |
Svet Ganov | 9c165d7 | 2015-12-01 19:52:26 -0800 | [diff] [blame] | 6533 | case FLAG_PERMISSION_REVIEW_REQUIRED: return "REVIEW_REQUIRED"; |
Philip P. Moltmann | 17f65af | 2018-10-18 15:32:29 -0700 | [diff] [blame] | 6534 | case FLAG_PERMISSION_REVOKE_WHEN_REQUESTED: return "REVOKE_WHEN_REQUESTED"; |
Svet Ganov | 77ab6a8 | 2015-07-03 12:03:02 -0700 | [diff] [blame] | 6535 | default: return Integer.toString(flag); |
| 6536 | } |
| 6537 | } |
| 6538 | |
| 6539 | /** {@hide} */ |
Jeff Sharkey | 6c0b9da | 2014-08-07 22:07:11 -0700 | [diff] [blame] | 6540 | public static class LegacyPackageDeleteObserver extends PackageDeleteObserver { |
| 6541 | private final IPackageDeleteObserver mLegacy; |
| 6542 | |
| 6543 | public LegacyPackageDeleteObserver(IPackageDeleteObserver legacy) { |
| 6544 | mLegacy = legacy; |
| 6545 | } |
| 6546 | |
| 6547 | @Override |
| 6548 | public void onPackageDeleted(String basePackageName, int returnCode, String msg) { |
| 6549 | if (mLegacy == null) return; |
| 6550 | try { |
| 6551 | mLegacy.packageDeleted(basePackageName, returnCode); |
| 6552 | } catch (RemoteException ignored) { |
| 6553 | } |
| 6554 | } |
| 6555 | } |
Bartosz Fabianowski | a34f53f | 2017-01-11 18:08:47 +0100 | [diff] [blame] | 6556 | |
| 6557 | /** |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 6558 | * Return the install reason that was recorded when a package was first |
| 6559 | * installed for a specific user. Requesting the install reason for another |
| 6560 | * user will require the permission INTERACT_ACROSS_USERS_FULL. |
Bartosz Fabianowski | a34f53f | 2017-01-11 18:08:47 +0100 | [diff] [blame] | 6561 | * |
| 6562 | * @param packageName The package for which to retrieve the install reason |
| 6563 | * @param user The user for whom to retrieve the install reason |
Jeff Sharkey | 4347f81 | 2017-04-21 12:08:39 -0600 | [diff] [blame] | 6564 | * @return The install reason. If the package is not installed for the given |
| 6565 | * user, {@code INSTALL_REASON_UNKNOWN} is returned. |
Bartosz Fabianowski | a34f53f | 2017-01-11 18:08:47 +0100 | [diff] [blame] | 6566 | * @hide |
| 6567 | */ |
| 6568 | @TestApi |
| 6569 | public abstract @InstallReason int getInstallReason(String packageName, |
| 6570 | @NonNull UserHandle user); |
Suprabh Shukla | aef2513 | 2017-01-23 18:09:03 -0800 | [diff] [blame] | 6571 | |
| 6572 | /** |
| 6573 | * 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] | 6574 | * 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] | 6575 | * intent {@link android.content.Intent#ACTION_INSTALL_PACKAGE}. Starting from Android O, the |
| 6576 | * 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] | 6577 | * 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] | 6578 | * a dialog will be shown to the user with an option to launch settings to change their |
| 6579 | * preference. An application must target Android O or higher and declare permission |
Suprabh Shukla | 5752847 | 2017-04-14 19:22:45 -0700 | [diff] [blame] | 6580 | * {@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] | 6581 | * |
| 6582 | * @return true if the calling package is trusted by the user to request install packages on |
| 6583 | * the device, false otherwise. |
Suprabh Shukla | 5752847 | 2017-04-14 19:22:45 -0700 | [diff] [blame] | 6584 | * @see android.content.Intent#ACTION_INSTALL_PACKAGE |
| 6585 | * @see android.provider.Settings#ACTION_MANAGE_UNKNOWN_APP_SOURCES |
Suprabh Shukla | aef2513 | 2017-01-23 18:09:03 -0800 | [diff] [blame] | 6586 | */ |
| 6587 | public abstract boolean canRequestPackageInstalls(); |
Chad Brubaker | aa49cb8 | 2017-03-24 15:53:09 -0700 | [diff] [blame] | 6588 | |
| 6589 | /** |
| 6590 | * Return the {@link ComponentName} of the activity providing Settings for the Instant App |
| 6591 | * resolver. |
| 6592 | * |
Todd Kennedy | 801e659 | 2017-04-12 14:10:12 -0700 | [diff] [blame] | 6593 | * @see {@link android.content.Intent#ACTION_INSTANT_APP_RESOLVER_SETTINGS} |
Chad Brubaker | aa49cb8 | 2017-03-24 15:53:09 -0700 | [diff] [blame] | 6594 | * @hide |
| 6595 | */ |
| 6596 | @SystemApi |
| 6597 | public abstract ComponentName getInstantAppResolverSettingsComponent(); |
Todd Kennedy | 801e659 | 2017-04-12 14:10:12 -0700 | [diff] [blame] | 6598 | |
| 6599 | /** |
| 6600 | * Return the {@link ComponentName} of the activity responsible for installing instant |
| 6601 | * applications. |
| 6602 | * |
| 6603 | * @see {@link android.content.Intent#ACTION_INSTALL_INSTANT_APP_PACKAGE} |
| 6604 | * @hide |
| 6605 | */ |
| 6606 | @SystemApi |
| 6607 | public abstract ComponentName getInstantAppInstallerComponent(); |
Chad Brubaker | 0d277a7 | 2017-04-12 16:56:53 -0700 | [diff] [blame] | 6608 | |
| 6609 | /** |
| 6610 | * Return the Android Id for a given Instant App. |
| 6611 | * |
| 6612 | * @see {@link android.provider.Settings.Secure#ANDROID_ID} |
| 6613 | * @hide |
| 6614 | */ |
| 6615 | public abstract String getInstantAppAndroidId(String packageName, @NonNull UserHandle user); |
Calin Juravle | 3d2af7f | 2017-04-19 19:56:21 -0700 | [diff] [blame] | 6616 | |
| 6617 | /** |
| 6618 | * Callback use to notify the callers of module registration that the operation |
| 6619 | * has finished. |
| 6620 | * |
| 6621 | * @hide |
| 6622 | */ |
Jeff Sharkey | 9039636 | 2017-06-12 16:26:53 -0600 | [diff] [blame] | 6623 | @SystemApi |
Calin Juravle | 3d2af7f | 2017-04-19 19:56:21 -0700 | [diff] [blame] | 6624 | public static abstract class DexModuleRegisterCallback { |
| 6625 | public abstract void onDexModuleRegistered(String dexModulePath, boolean success, |
| 6626 | String message); |
| 6627 | } |
| 6628 | |
| 6629 | /** |
| 6630 | * Register an application dex module with the package manager. |
| 6631 | * The package manager will keep track of the given module for future optimizations. |
| 6632 | * |
| 6633 | * Dex module optimizations will disable the classpath checking at runtime. The client bares |
| 6634 | * the responsibility to ensure that the static assumptions on classes in the optimized code |
| 6635 | * hold at runtime (e.g. there's no duplicate classes in the classpath). |
| 6636 | * |
| 6637 | * Note that the package manager already keeps track of dex modules loaded with |
| 6638 | * {@link dalvik.system.DexClassLoader} and {@link dalvik.system.PathClassLoader}. |
| 6639 | * This can be called for an eager registration. |
| 6640 | * |
| 6641 | * The call might take a while and the results will be posted on the main thread, using |
| 6642 | * the given callback. |
| 6643 | * |
| 6644 | * If the module is intended to be shared with other apps, make sure that the file |
| 6645 | * permissions allow for it. |
| 6646 | * If at registration time the permissions allow for others to read it, the module would |
| 6647 | * be marked as a shared module which might undergo a different optimization strategy. |
| 6648 | * (usually shared modules will generated larger optimizations artifacts, |
| 6649 | * taking more disk space). |
| 6650 | * |
| 6651 | * @param dexModulePath the absolute path of the dex module. |
| 6652 | * @param callback if not null, {@link DexModuleRegisterCallback#onDexModuleRegistered} will |
| 6653 | * be called once the registration finishes. |
| 6654 | * |
| 6655 | * @hide |
| 6656 | */ |
Jeff Sharkey | 9039636 | 2017-06-12 16:26:53 -0600 | [diff] [blame] | 6657 | @SystemApi |
Calin Juravle | 3d2af7f | 2017-04-19 19:56:21 -0700 | [diff] [blame] | 6658 | public abstract void registerDexModule(String dexModulePath, |
| 6659 | @Nullable DexModuleRegisterCallback callback); |
Calin Juravle | 45f8b29 | 2017-11-07 18:49:43 -0800 | [diff] [blame] | 6660 | |
| 6661 | /** |
| 6662 | * Returns the {@link ArtManager} associated with this package manager. |
| 6663 | * |
| 6664 | * @hide |
| 6665 | */ |
| 6666 | @SystemApi |
| 6667 | public @NonNull ArtManager getArtManager() { |
| 6668 | throw new UnsupportedOperationException("getArtManager not implemented in subclass"); |
| 6669 | } |
Ben Gruver | 1ab3d6e | 2017-12-07 13:45:08 -0800 | [diff] [blame] | 6670 | |
| 6671 | /** |
| 6672 | * Sets or clears the harmful app warning details for the given app. |
| 6673 | * |
| 6674 | * When set, any attempt to launch an activity in this package will be intercepted and a |
| 6675 | * warning dialog will be shown to the user instead, with the given warning. The user |
| 6676 | * will have the option to proceed with the activity launch, or to uninstall the application. |
| 6677 | * |
| 6678 | * @param packageName The full name of the package to warn on. |
| 6679 | * @param warning A warning string to display to the user describing the threat posed by the |
| 6680 | * application, or null to clear the warning. |
| 6681 | * |
| 6682 | * @hide |
| 6683 | */ |
| 6684 | @RequiresPermission(Manifest.permission.SET_HARMFUL_APP_WARNINGS) |
| 6685 | @SystemApi |
| 6686 | public void setHarmfulAppWarning(@NonNull String packageName, @Nullable CharSequence warning) { |
| 6687 | throw new UnsupportedOperationException("setHarmfulAppWarning not implemented in subclass"); |
| 6688 | } |
| 6689 | |
| 6690 | /** |
| 6691 | * Returns the harmful app warning string for the given app, or null if there is none set. |
| 6692 | * |
| 6693 | * @param packageName The full name of the desired package. |
| 6694 | * |
| 6695 | * @hide |
| 6696 | */ |
| 6697 | @RequiresPermission(Manifest.permission.SET_HARMFUL_APP_WARNINGS) |
| 6698 | @Nullable |
| 6699 | @SystemApi |
| 6700 | public CharSequence getHarmfulAppWarning(@NonNull String packageName) { |
| 6701 | throw new UnsupportedOperationException("getHarmfulAppWarning not implemented in subclass"); |
| 6702 | } |
Daniel Cashman | 5cdda34 | 2018-01-19 07:22:52 -0800 | [diff] [blame] | 6703 | |
| 6704 | /** @hide */ |
| 6705 | @IntDef(prefix = { "CERT_INPUT_" }, value = { |
| 6706 | CERT_INPUT_RAW_X509, |
| 6707 | CERT_INPUT_SHA256 |
| 6708 | }) |
| 6709 | @Retention(RetentionPolicy.SOURCE) |
| 6710 | public @interface CertificateInputType {} |
| 6711 | |
| 6712 | /** |
| 6713 | * Certificate input bytes: the input bytes represent an encoded X.509 Certificate which could |
| 6714 | * be generated using an {@code CertificateFactory} |
| 6715 | */ |
| 6716 | public static final int CERT_INPUT_RAW_X509 = 0; |
| 6717 | |
| 6718 | /** |
| 6719 | * Certificate input bytes: the input bytes represent the SHA256 output of an encoded X.509 |
| 6720 | * Certificate. |
| 6721 | */ |
| 6722 | public static final int CERT_INPUT_SHA256 = 1; |
| 6723 | |
| 6724 | /** |
| 6725 | * Searches the set of signing certificates by which the given package has proven to have been |
| 6726 | * signed. This should be used instead of {@code getPackageInfo} with {@code GET_SIGNATURES} |
| 6727 | * since it takes into account the possibility of signing certificate rotation, except in the |
| 6728 | * 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] | 6729 | * rotation is not supported. This method is analogous to using {@code getPackageInfo} with |
| 6730 | * {@code GET_SIGNING_CERTIFICATES} and then searching through the resulting {@code |
Dan Cashman | e942b91 | 2018-04-16 14:41:24 -0700 | [diff] [blame] | 6731 | * signingInfo} field to see if the desired certificate is present. |
Daniel Cashman | 5cdda34 | 2018-01-19 07:22:52 -0800 | [diff] [blame] | 6732 | * |
| 6733 | * @param packageName package whose signing certificates to check |
| 6734 | * @param certificate signing certificate for which to search |
| 6735 | * @param type representation of the {@code certificate} |
| 6736 | * @return true if this package was or is signed by exactly the certificate {@code certificate} |
| 6737 | */ |
| 6738 | public boolean hasSigningCertificate( |
| 6739 | String packageName, byte[] certificate, @CertificateInputType int type) { |
| 6740 | throw new UnsupportedOperationException( |
| 6741 | "hasSigningCertificate not implemented in subclass"); |
| 6742 | } |
| 6743 | |
| 6744 | /** |
Daniel Cashman | bd8ce38 | 2018-04-02 16:59:19 -0700 | [diff] [blame] | 6745 | * Searches the set of signing certificates by which the package(s) for the given uid has proven |
| 6746 | * to have been signed. For multiple packages sharing the same uid, this will return the |
| 6747 | * signing certificates found in the signing history of the "newest" package, where "newest" |
| 6748 | * indicates the package with the newest signing certificate in the shared uid group. This |
| 6749 | * method should be used instead of {@code getPackageInfo} with {@code GET_SIGNATURES} |
Daniel Cashman | 5cdda34 | 2018-01-19 07:22:52 -0800 | [diff] [blame] | 6750 | * since it takes into account the possibility of signing certificate rotation, except in the |
| 6751 | * 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] | 6752 | * rotation is not supported. This method is analogous to using {@code getPackagesForUid} |
| 6753 | * followed by {@code getPackageInfo} with {@code GET_SIGNING_CERTIFICATES}, selecting the |
| 6754 | * {@code PackageInfo} of the newest-signed bpackage , and finally searching through the |
Dan Cashman | e942b91 | 2018-04-16 14:41:24 -0700 | [diff] [blame] | 6755 | * resulting {@code signingInfo} field to see if the desired certificate is there. |
Daniel Cashman | 5cdda34 | 2018-01-19 07:22:52 -0800 | [diff] [blame] | 6756 | * |
Daniel Cashman | bd8ce38 | 2018-04-02 16:59:19 -0700 | [diff] [blame] | 6757 | * @param uid uid whose signing certificates to check |
Daniel Cashman | 5cdda34 | 2018-01-19 07:22:52 -0800 | [diff] [blame] | 6758 | * @param certificate signing certificate for which to search |
| 6759 | * @param type representation of the {@code certificate} |
| 6760 | * @return true if this package was or is signed by exactly the certificate {@code certificate} |
| 6761 | */ |
| 6762 | public boolean hasSigningCertificate( |
| 6763 | int uid, byte[] certificate, @CertificateInputType int type) { |
| 6764 | throw new UnsupportedOperationException( |
| 6765 | "hasSigningCertificate not implemented in subclass"); |
| 6766 | } |
Makoto Onuki | 700feef | 2018-02-15 10:59:41 -0800 | [diff] [blame] | 6767 | |
| 6768 | /** |
| 6769 | * @return the system defined text classifier package name, or null if there's none. |
| 6770 | * |
| 6771 | * @hide |
| 6772 | */ |
| 6773 | public String getSystemTextClassifierPackageName() { |
| 6774 | throw new UnsupportedOperationException( |
| 6775 | "getSystemTextClassifierPackageName not implemented in subclass"); |
| 6776 | } |
Benjamin Franz | 7cc9a81 | 2018-03-22 10:11:29 +0000 | [diff] [blame] | 6777 | |
| 6778 | /** |
Varun Shah | 5f30365 | 2018-11-16 18:11:19 -0800 | [diff] [blame] | 6779 | * @return the wellbeing app package name, or null if it's not defined by the OEM. |
| 6780 | * |
| 6781 | * @hide |
| 6782 | */ |
Varun Shah | dad9b86 | 2018-12-10 20:17:31 -0800 | [diff] [blame] | 6783 | @TestApi |
Varun Shah | 5f30365 | 2018-11-16 18:11:19 -0800 | [diff] [blame] | 6784 | public String getWellbeingPackageName() { |
| 6785 | throw new UnsupportedOperationException( |
| 6786 | "getWellbeingPackageName not implemented in subclass"); |
| 6787 | } |
| 6788 | |
| 6789 | /** |
George Hodulik | cd7695d | 2019-01-29 18:17:05 -0800 | [diff] [blame] | 6790 | * @return the system defined app predictor package name, or null if there's none. |
| 6791 | * |
| 6792 | * @hide |
| 6793 | */ |
| 6794 | public String getAppPredictionServicePackageName() { |
| 6795 | throw new UnsupportedOperationException( |
| 6796 | "getAppPredictionServicePackageName not implemented in subclass"); |
| 6797 | } |
| 6798 | |
| 6799 | /** |
Nadav Bar | 6d79ab7 | 2019-01-10 10:52:11 +0200 | [diff] [blame] | 6800 | * @return the system defined content capture service package name, or null if there's none. |
| 6801 | * |
| 6802 | * @hide |
| 6803 | */ |
| 6804 | public String getContentCaptureServicePackageName() { |
| 6805 | throw new UnsupportedOperationException( |
| 6806 | "getContentCaptureServicePackageName not implemented in subclass"); |
| 6807 | } |
| 6808 | |
| 6809 | /** |
Joe Onorato | 5a15b55 | 2018-12-18 10:40:04 -0800 | [diff] [blame] | 6810 | * @return the incident report approver app package name, or null if it's not defined |
| 6811 | * by the OEM. |
| 6812 | * |
| 6813 | * @hide |
| 6814 | */ |
| 6815 | @SystemApi |
| 6816 | @TestApi |
| 6817 | public String getIncidentReportApproverPackageName() { |
| 6818 | throw new UnsupportedOperationException( |
| 6819 | "getIncidentReportApproverPackageName not implemented in subclass"); |
| 6820 | } |
| 6821 | |
| 6822 | /** |
Benjamin Franz | 7cc9a81 | 2018-03-22 10:11:29 +0000 | [diff] [blame] | 6823 | * @return whether a given package's state is protected, e.g. package cannot be disabled, |
| 6824 | * suspended, hidden or force stopped. |
| 6825 | * |
| 6826 | * @hide |
| 6827 | */ |
| 6828 | public boolean isPackageStateProtected(String packageName, int userId) { |
| 6829 | throw new UnsupportedOperationException( |
| 6830 | "isPackageStateProtected not implemented in subclass"); |
| 6831 | } |
| 6832 | |
MÃ¥rten Kongstad | fd20b83 | 2018-10-26 15:36:20 +0200 | [diff] [blame] | 6833 | /** |
| 6834 | * Notify to the rest of the system that a new device configuration has |
| 6835 | * been prepared and that it is time to refresh caches. |
| 6836 | * |
| 6837 | * @see android.content.Intent#ACTION_DEVICE_CUSTOMIZATION_READY |
| 6838 | * |
| 6839 | * @hide |
| 6840 | */ |
| 6841 | @SystemApi |
| 6842 | public void sendDeviceCustomizationReadyBroadcast() { |
| 6843 | throw new UnsupportedOperationException( |
| 6844 | "sendDeviceCustomizationReadyBroadcast not implemented in subclass"); |
| 6845 | } |
| 6846 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 6847 | } |