Merge "Break out static update method"

This commit is contained in:
TreeHugger Robot
2016-08-04 19:00:46 +00:00
committed by Android (Google) Code Review
7 changed files with 850 additions and 136 deletions

View File

@@ -4955,6 +4955,19 @@ public class PackageParser {
}
}
public List<String> getChildPackageNames() {
if (childPackages == null) {
return null;
}
final int childCount = childPackages.size();
final List<String> childPackageNames = new ArrayList<>(childCount);
for (int i = 0; i < childCount; i++) {
String childPackageName = childPackages.get(i).packageName;
childPackageNames.add(childPackageName);
}
return childPackageNames;
}
public boolean hasChildPackage(String packageName) {
final int childCount = (childPackages != null) ? childPackages.size() : 0;
for (int i = 0; i < childCount; i++) {

View File

@@ -29,6 +29,7 @@ import static android.content.pm.PackageManager.MATCH_SYSTEM_ONLY;
import android.util.ArraySet;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.ArrayUtils;
/**
@@ -147,4 +148,76 @@ public class PackageUserState {
return componentInfo.enabled;
}
@Override
final public boolean equals(Object obj) {
if (!(obj instanceof PackageUserState)) {
return false;
}
final PackageUserState oldState = (PackageUserState) obj;
if (ceDataInode != oldState.ceDataInode) {
return false;
}
if (installed != oldState.installed) {
return false;
}
if (stopped != oldState.stopped) {
return false;
}
if (notLaunched != oldState.notLaunched) {
return false;
}
if (hidden != oldState.hidden) {
return false;
}
if (suspended != oldState.suspended) {
return false;
}
if (blockUninstall != oldState.blockUninstall) {
return false;
}
if (enabled != oldState.enabled) {
return false;
}
if ((lastDisableAppCaller == null && oldState.lastDisableAppCaller != null)
|| (lastDisableAppCaller != null
&& !lastDisableAppCaller.equals(oldState.lastDisableAppCaller))) {
return false;
}
if (domainVerificationStatus != oldState.domainVerificationStatus) {
return false;
}
if (appLinkGeneration != oldState.appLinkGeneration) {
return false;
}
if ((disabledComponents == null && oldState.disabledComponents != null)
|| (disabledComponents != null && oldState.disabledComponents == null)) {
return false;
}
if (disabledComponents != null) {
if (disabledComponents.size() != oldState.disabledComponents.size()) {
return false;
}
for (int i = disabledComponents.size() - 1; i >=0; --i) {
if (!oldState.disabledComponents.contains(disabledComponents.valueAt(i))) {
return false;
}
}
}
if ((enabledComponents == null && oldState.enabledComponents != null)
|| (enabledComponents != null && oldState.enabledComponents == null)) {
return false;
}
if (enabledComponents != null) {
if (enabledComponents.size() != oldState.enabledComponents.size()) {
return false;
}
for (int i = enabledComponents.size() - 1; i >=0; --i) {
if (!oldState.enabledComponents.contains(enabledComponents.valueAt(i))) {
return false;
}
}
}
return true;
}
}