Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 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 | |
| 19 | import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DEFAULT; |
Jeff Sharkey | 2bd31db | 2016-01-09 16:58:14 -0700 | [diff] [blame] | 20 | import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED; |
| 21 | import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED; |
| 22 | import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER; |
| 23 | import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED; |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 24 | import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_AWARE; |
| 25 | import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_UNAWARE; |
Todd Kennedy | 5eb5a7d | 2017-08-01 07:42:47 -0700 | [diff] [blame] | 26 | import static android.content.pm.PackageManager.MATCH_DISABLED_COMPONENTS; |
| 27 | import static android.content.pm.PackageManager.MATCH_DISABLED_UNTIL_USED_COMPONENTS; |
Jeff Sharkey | 2bd31db | 2016-01-09 16:58:14 -0700 | [diff] [blame] | 28 | import static android.content.pm.PackageManager.MATCH_SYSTEM_ONLY; |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 29 | |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 30 | import android.annotation.UnsupportedAppUsage; |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 31 | import android.os.BaseBundle; |
Eugene Susla | 4ab9511 | 2018-12-17 14:45:11 -0800 | [diff] [blame] | 32 | import android.os.Debug; |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 33 | import android.os.PersistableBundle; |
Jeff Sharkey | 9f837a9 | 2014-10-24 12:07:24 -0700 | [diff] [blame] | 34 | import android.util.ArraySet; |
Eugene Susla | 4ab9511 | 2018-12-17 14:45:11 -0800 | [diff] [blame] | 35 | import android.util.DebugUtils; |
| 36 | import android.util.Slog; |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 37 | |
Suprabh Shukla | 389cb6f | 2018-10-01 18:20:39 -0700 | [diff] [blame] | 38 | import com.android.internal.annotations.VisibleForTesting; |
Jeff Sharkey | 2bd31db | 2016-01-09 16:58:14 -0700 | [diff] [blame] | 39 | import com.android.internal.util.ArrayUtils; |
| 40 | |
Mårten Kongstad | 2e0d0f3 | 2016-06-02 09:35:31 +0200 | [diff] [blame] | 41 | import java.util.Arrays; |
Suprabh Shukla | 3c3af14 | 2018-03-30 00:28:37 -0700 | [diff] [blame] | 42 | import java.util.Objects; |
Mårten Kongstad | 2e0d0f3 | 2016-06-02 09:35:31 +0200 | [diff] [blame] | 43 | |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 44 | /** |
| 45 | * Per-user state information about a package. |
Dianne Hackborn | 8832c18 | 2012-09-17 17:20:24 -0700 | [diff] [blame] | 46 | * @hide |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 47 | */ |
| 48 | public class PackageUserState { |
Eugene Susla | 4ab9511 | 2018-12-17 14:45:11 -0800 | [diff] [blame] | 49 | private static final boolean DEBUG = false; |
| 50 | private static final String LOG_TAG = "PackageUserState"; |
| 51 | |
Jeff Sharkey | 4288419 | 2016-04-09 16:12:01 -0600 | [diff] [blame] | 52 | public long ceDataInode; |
| 53 | public boolean installed; |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 54 | public boolean stopped; |
| 55 | public boolean notLaunched; |
Amith Yamasani | e5bcff6 | 2014-07-19 15:44:09 -0700 | [diff] [blame] | 56 | public boolean hidden; // Is the app restricted by owner / admin |
Suprabh Shukla | 7900049 | 2018-12-24 17:03:02 -0800 | [diff] [blame] | 57 | public int distractionFlags; |
Andrei Stingaceanu | 1e28391 | 2015-11-26 15:26:28 +0000 | [diff] [blame] | 58 | public boolean suspended; |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 59 | public String suspendingPackage; |
Suprabh Shukla | 389cb6f | 2018-10-01 18:20:39 -0700 | [diff] [blame] | 60 | public SuspendDialogInfo dialogInfo; |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 61 | public PersistableBundle suspendedAppExtras; |
| 62 | public PersistableBundle suspendedLauncherExtras; |
Todd Kennedy | be0b889 | 2017-02-15 14:13:52 -0800 | [diff] [blame] | 63 | public boolean instantApp; |
Todd Kennedy | 5eb5a7d | 2017-08-01 07:42:47 -0700 | [diff] [blame] | 64 | public boolean virtualPreload; |
Jeff Sharkey | 4288419 | 2016-04-09 16:12:01 -0600 | [diff] [blame] | 65 | public int enabled; |
Dianne Hackborn | 3fa3c28a | 2013-03-26 16:15:41 -0700 | [diff] [blame] | 66 | public String lastDisableAppCaller; |
Jeff Sharkey | 4288419 | 2016-04-09 16:12:01 -0600 | [diff] [blame] | 67 | public int domainVerificationStatus; |
| 68 | public int appLinkGeneration; |
Jeff Sharkey | 9bc89af | 2017-01-11 11:25:50 -0700 | [diff] [blame] | 69 | public int categoryHint = ApplicationInfo.CATEGORY_UNDEFINED; |
Bartosz Fabianowski | a34f53f | 2017-01-11 18:08:47 +0100 | [diff] [blame] | 70 | public int installReason; |
Ben Gruver | 1ab3d6e | 2017-12-07 13:45:08 -0800 | [diff] [blame] | 71 | public String harmfulAppWarning; |
Dianne Hackborn | 3fa3c28a | 2013-03-26 16:15:41 -0700 | [diff] [blame] | 72 | |
Jeff Sharkey | 9f837a9 | 2014-10-24 12:07:24 -0700 | [diff] [blame] | 73 | public ArraySet<String> disabledComponents; |
| 74 | public ArraySet<String> enabledComponents; |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 75 | |
Todd Kennedy | b274947 | 2017-06-13 08:24:32 -0700 | [diff] [blame] | 76 | public String[] overlayPaths; |
Mårten Kongstad | 2e0d0f3 | 2016-06-02 09:35:31 +0200 | [diff] [blame] | 77 | |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 78 | @UnsupportedAppUsage |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 79 | public PackageUserState() { |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 80 | installed = true; |
Amith Yamasani | e5bcff6 | 2014-07-19 15:44:09 -0700 | [diff] [blame] | 81 | hidden = false; |
Andrei Stingaceanu | 1e28391 | 2015-11-26 15:26:28 +0000 | [diff] [blame] | 82 | suspended = false; |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 83 | enabled = COMPONENT_ENABLED_STATE_DEFAULT; |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 84 | domainVerificationStatus = |
| 85 | PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED; |
Bartosz Fabianowski | a34f53f | 2017-01-11 18:08:47 +0100 | [diff] [blame] | 86 | installReason = PackageManager.INSTALL_REASON_UNKNOWN; |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 87 | } |
| 88 | |
Suprabh Shukla | 389cb6f | 2018-10-01 18:20:39 -0700 | [diff] [blame] | 89 | @VisibleForTesting |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 90 | public PackageUserState(PackageUserState o) { |
Jeff Sharkey | 4288419 | 2016-04-09 16:12:01 -0600 | [diff] [blame] | 91 | ceDataInode = o.ceDataInode; |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 92 | installed = o.installed; |
| 93 | stopped = o.stopped; |
| 94 | notLaunched = o.notLaunched; |
Amith Yamasani | e5bcff6 | 2014-07-19 15:44:09 -0700 | [diff] [blame] | 95 | hidden = o.hidden; |
Suprabh Shukla | 7900049 | 2018-12-24 17:03:02 -0800 | [diff] [blame] | 96 | distractionFlags = o.distractionFlags; |
Andrei Stingaceanu | 1e28391 | 2015-11-26 15:26:28 +0000 | [diff] [blame] | 97 | suspended = o.suspended; |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 98 | suspendingPackage = o.suspendingPackage; |
Suprabh Shukla | 389cb6f | 2018-10-01 18:20:39 -0700 | [diff] [blame] | 99 | dialogInfo = o.dialogInfo; |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 100 | suspendedAppExtras = o.suspendedAppExtras; |
| 101 | suspendedLauncherExtras = o.suspendedLauncherExtras; |
Todd Kennedy | be0b889 | 2017-02-15 14:13:52 -0800 | [diff] [blame] | 102 | instantApp = o.instantApp; |
Todd Kennedy | 5eb5a7d | 2017-08-01 07:42:47 -0700 | [diff] [blame] | 103 | virtualPreload = o.virtualPreload; |
Jeff Sharkey | 4288419 | 2016-04-09 16:12:01 -0600 | [diff] [blame] | 104 | enabled = o.enabled; |
| 105 | lastDisableAppCaller = o.lastDisableAppCaller; |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 106 | domainVerificationStatus = o.domainVerificationStatus; |
Christopher Tate | f0d6cb3 | 2015-07-10 17:44:53 -0700 | [diff] [blame] | 107 | appLinkGeneration = o.appLinkGeneration; |
Jeff Sharkey | 9bc89af | 2017-01-11 11:25:50 -0700 | [diff] [blame] | 108 | categoryHint = o.categoryHint; |
Bartosz Fabianowski | a34f53f | 2017-01-11 18:08:47 +0100 | [diff] [blame] | 109 | installReason = o.installReason; |
Jeff Sharkey | 4288419 | 2016-04-09 16:12:01 -0600 | [diff] [blame] | 110 | disabledComponents = ArrayUtils.cloneOrNull(o.disabledComponents); |
| 111 | enabledComponents = ArrayUtils.cloneOrNull(o.enabledComponents); |
Todd Kennedy | b274947 | 2017-06-13 08:24:32 -0700 | [diff] [blame] | 112 | overlayPaths = |
| 113 | o.overlayPaths == null ? null : Arrays.copyOf(o.overlayPaths, o.overlayPaths.length); |
Ben Gruver | 1ab3d6e | 2017-12-07 13:45:08 -0800 | [diff] [blame] | 114 | harmfulAppWarning = o.harmfulAppWarning; |
Dianne Hackborn | 7767eac | 2012-08-23 18:25:40 -0700 | [diff] [blame] | 115 | } |
Jeff Sharkey | 2bd31db | 2016-01-09 16:58:14 -0700 | [diff] [blame] | 116 | |
| 117 | /** |
| 118 | * Test if this package is installed. |
| 119 | */ |
Amith Yamasani | 0d1fd8d | 2016-10-12 14:21:51 -0700 | [diff] [blame] | 120 | public boolean isAvailable(int flags) { |
| 121 | // True if it is installed for this user and it is not hidden. If it is hidden, |
| 122 | // still return true if the caller requested MATCH_UNINSTALLED_PACKAGES |
| 123 | final boolean matchAnyUser = (flags & PackageManager.MATCH_ANY_USER) != 0; |
| 124 | final boolean matchUninstalled = (flags & PackageManager.MATCH_UNINSTALLED_PACKAGES) != 0; |
| 125 | return matchAnyUser |
| 126 | || (this.installed |
| 127 | && (!this.hidden || matchUninstalled)); |
Jeff Sharkey | 2bd31db | 2016-01-09 16:58:14 -0700 | [diff] [blame] | 128 | } |
| 129 | |
| 130 | /** |
| 131 | * Test if the given component is considered installed, enabled and a match |
| 132 | * for the given flags. |
Bernard Chau | 186f29b | 2016-04-13 15:58:38 +0100 | [diff] [blame] | 133 | * |
| 134 | * <p> |
| 135 | * Expects at least one of {@link PackageManager#MATCH_DIRECT_BOOT_AWARE} and |
| 136 | * {@link PackageManager#MATCH_DIRECT_BOOT_UNAWARE} are specified in {@code flags}. |
| 137 | * </p> |
Jeff Sharkey | 2bd31db | 2016-01-09 16:58:14 -0700 | [diff] [blame] | 138 | */ |
| 139 | public boolean isMatch(ComponentInfo componentInfo, int flags) { |
Amith Yamasani | 0d1fd8d | 2016-10-12 14:21:51 -0700 | [diff] [blame] | 140 | final boolean isSystemApp = componentInfo.applicationInfo.isSystemApp(); |
| 141 | final boolean matchUninstalled = (flags & PackageManager.MATCH_KNOWN_PACKAGES) != 0; |
| 142 | if (!isAvailable(flags) |
Eugene Susla | 4ab9511 | 2018-12-17 14:45:11 -0800 | [diff] [blame] | 143 | && !(isSystemApp && matchUninstalled)) return reportIfDebug(false, flags); |
| 144 | if (!isEnabled(componentInfo, flags)) return reportIfDebug(false, flags); |
Jeff Sharkey | 2bd31db | 2016-01-09 16:58:14 -0700 | [diff] [blame] | 145 | |
| 146 | if ((flags & MATCH_SYSTEM_ONLY) != 0) { |
Amith Yamasani | 0d1fd8d | 2016-10-12 14:21:51 -0700 | [diff] [blame] | 147 | if (!isSystemApp) { |
Eugene Susla | 4ab9511 | 2018-12-17 14:45:11 -0800 | [diff] [blame] | 148 | return reportIfDebug(false, flags); |
Jeff Sharkey | 2bd31db | 2016-01-09 16:58:14 -0700 | [diff] [blame] | 149 | } |
| 150 | } |
| 151 | |
Jeff Sharkey | 8a372a0 | 2016-03-16 16:25:45 -0600 | [diff] [blame] | 152 | final boolean matchesUnaware = ((flags & MATCH_DIRECT_BOOT_UNAWARE) != 0) |
| 153 | && !componentInfo.directBootAware; |
| 154 | final boolean matchesAware = ((flags & MATCH_DIRECT_BOOT_AWARE) != 0) |
| 155 | && componentInfo.directBootAware; |
Eugene Susla | 4ab9511 | 2018-12-17 14:45:11 -0800 | [diff] [blame] | 156 | return reportIfDebug(matchesUnaware || matchesAware, flags); |
| 157 | } |
| 158 | |
| 159 | private boolean reportIfDebug(boolean result, int flags) { |
| 160 | if (DEBUG && !result) { |
| 161 | Slog.i(LOG_TAG, "No match!; flags: " |
| 162 | + DebugUtils.flagsToString(PackageManager.class, "MATCH_", flags) + " " |
| 163 | + Debug.getCaller()); |
| 164 | } |
| 165 | return result; |
Jeff Sharkey | 2bd31db | 2016-01-09 16:58:14 -0700 | [diff] [blame] | 166 | } |
| 167 | |
| 168 | /** |
| 169 | * Test if the given component is considered enabled. |
| 170 | */ |
| 171 | public boolean isEnabled(ComponentInfo componentInfo, int flags) { |
| 172 | if ((flags & MATCH_DISABLED_COMPONENTS) != 0) { |
| 173 | return true; |
| 174 | } |
| 175 | |
| 176 | // First check if the overall package is disabled; if the package is |
| 177 | // enabled then fall through to check specific component |
| 178 | switch (this.enabled) { |
| 179 | case COMPONENT_ENABLED_STATE_DISABLED: |
| 180 | case COMPONENT_ENABLED_STATE_DISABLED_USER: |
| 181 | return false; |
| 182 | case COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED: |
| 183 | if ((flags & MATCH_DISABLED_UNTIL_USED_COMPONENTS) == 0) { |
| 184 | return false; |
| 185 | } |
| 186 | case COMPONENT_ENABLED_STATE_DEFAULT: |
| 187 | if (!componentInfo.applicationInfo.enabled) { |
| 188 | return false; |
| 189 | } |
| 190 | case COMPONENT_ENABLED_STATE_ENABLED: |
| 191 | break; |
| 192 | } |
| 193 | |
| 194 | // Check if component has explicit state before falling through to |
| 195 | // the manifest default |
| 196 | if (ArrayUtils.contains(this.enabledComponents, componentInfo.name)) { |
| 197 | return true; |
| 198 | } |
| 199 | if (ArrayUtils.contains(this.disabledComponents, componentInfo.name)) { |
| 200 | return false; |
| 201 | } |
| 202 | |
| 203 | return componentInfo.enabled; |
| 204 | } |
Todd Kennedy | 13715d5 | 2016-08-01 13:38:57 -0700 | [diff] [blame] | 205 | |
| 206 | @Override |
| 207 | final public boolean equals(Object obj) { |
| 208 | if (!(obj instanceof PackageUserState)) { |
| 209 | return false; |
| 210 | } |
| 211 | final PackageUserState oldState = (PackageUserState) obj; |
| 212 | if (ceDataInode != oldState.ceDataInode) { |
| 213 | return false; |
| 214 | } |
| 215 | if (installed != oldState.installed) { |
| 216 | return false; |
| 217 | } |
| 218 | if (stopped != oldState.stopped) { |
| 219 | return false; |
| 220 | } |
| 221 | if (notLaunched != oldState.notLaunched) { |
| 222 | return false; |
| 223 | } |
| 224 | if (hidden != oldState.hidden) { |
| 225 | return false; |
| 226 | } |
Suprabh Shukla | 7900049 | 2018-12-24 17:03:02 -0800 | [diff] [blame] | 227 | if (distractionFlags != oldState.distractionFlags) { |
| 228 | return false; |
| 229 | } |
Todd Kennedy | 13715d5 | 2016-08-01 13:38:57 -0700 | [diff] [blame] | 230 | if (suspended != oldState.suspended) { |
| 231 | return false; |
| 232 | } |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 233 | if (suspended) { |
| 234 | if (suspendingPackage == null |
| 235 | || !suspendingPackage.equals(oldState.suspendingPackage)) { |
| 236 | return false; |
| 237 | } |
Suprabh Shukla | 389cb6f | 2018-10-01 18:20:39 -0700 | [diff] [blame] | 238 | if (!Objects.equals(dialogInfo, oldState.dialogInfo)) { |
Suprabh Shukla | 3c3af14 | 2018-03-30 00:28:37 -0700 | [diff] [blame] | 239 | return false; |
| 240 | } |
Suprabh Shukla | 021b57a | 2018-03-08 18:21:50 -0800 | [diff] [blame] | 241 | if (!BaseBundle.kindofEquals(suspendedAppExtras, |
| 242 | oldState.suspendedAppExtras)) { |
| 243 | return false; |
| 244 | } |
| 245 | if (!BaseBundle.kindofEquals(suspendedLauncherExtras, |
| 246 | oldState.suspendedLauncherExtras)) { |
| 247 | return false; |
| 248 | } |
| 249 | } |
Todd Kennedy | be0b889 | 2017-02-15 14:13:52 -0800 | [diff] [blame] | 250 | if (instantApp != oldState.instantApp) { |
| 251 | return false; |
| 252 | } |
Todd Kennedy | 5eb5a7d | 2017-08-01 07:42:47 -0700 | [diff] [blame] | 253 | if (virtualPreload != oldState.virtualPreload) { |
| 254 | return false; |
| 255 | } |
Todd Kennedy | 13715d5 | 2016-08-01 13:38:57 -0700 | [diff] [blame] | 256 | if (enabled != oldState.enabled) { |
| 257 | return false; |
| 258 | } |
| 259 | if ((lastDisableAppCaller == null && oldState.lastDisableAppCaller != null) |
| 260 | || (lastDisableAppCaller != null |
| 261 | && !lastDisableAppCaller.equals(oldState.lastDisableAppCaller))) { |
| 262 | return false; |
| 263 | } |
| 264 | if (domainVerificationStatus != oldState.domainVerificationStatus) { |
| 265 | return false; |
| 266 | } |
| 267 | if (appLinkGeneration != oldState.appLinkGeneration) { |
| 268 | return false; |
| 269 | } |
Jeff Sharkey | 9bc89af | 2017-01-11 11:25:50 -0700 | [diff] [blame] | 270 | if (categoryHint != oldState.categoryHint) { |
| 271 | return false; |
| 272 | } |
Bartosz Fabianowski | a34f53f | 2017-01-11 18:08:47 +0100 | [diff] [blame] | 273 | if (installReason != oldState.installReason) { |
| 274 | return false; |
| 275 | } |
Todd Kennedy | 13715d5 | 2016-08-01 13:38:57 -0700 | [diff] [blame] | 276 | if ((disabledComponents == null && oldState.disabledComponents != null) |
| 277 | || (disabledComponents != null && oldState.disabledComponents == null)) { |
| 278 | return false; |
| 279 | } |
| 280 | if (disabledComponents != null) { |
| 281 | if (disabledComponents.size() != oldState.disabledComponents.size()) { |
| 282 | return false; |
| 283 | } |
| 284 | for (int i = disabledComponents.size() - 1; i >=0; --i) { |
| 285 | if (!oldState.disabledComponents.contains(disabledComponents.valueAt(i))) { |
| 286 | return false; |
| 287 | } |
| 288 | } |
| 289 | } |
| 290 | if ((enabledComponents == null && oldState.enabledComponents != null) |
| 291 | || (enabledComponents != null && oldState.enabledComponents == null)) { |
| 292 | return false; |
| 293 | } |
| 294 | if (enabledComponents != null) { |
| 295 | if (enabledComponents.size() != oldState.enabledComponents.size()) { |
| 296 | return false; |
| 297 | } |
| 298 | for (int i = enabledComponents.size() - 1; i >=0; --i) { |
| 299 | if (!oldState.enabledComponents.contains(enabledComponents.valueAt(i))) { |
| 300 | return false; |
| 301 | } |
| 302 | } |
| 303 | } |
Ben Gruver | 1ab3d6e | 2017-12-07 13:45:08 -0800 | [diff] [blame] | 304 | if (harmfulAppWarning == null && oldState.harmfulAppWarning != null |
| 305 | || (harmfulAppWarning != null |
| 306 | && !harmfulAppWarning.equals(oldState.harmfulAppWarning))) { |
| 307 | return false; |
| 308 | } |
Todd Kennedy | 13715d5 | 2016-08-01 13:38:57 -0700 | [diff] [blame] | 309 | return true; |
| 310 | } |
Jeff Sharkey | 9f837a9 | 2014-10-24 12:07:24 -0700 | [diff] [blame] | 311 | } |