summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/content/res/Resources.java29
-rw-r--r--services/core/java/com/android/server/pm/AppDataHelper.java7
-rw-r--r--services/core/java/com/android/server/wm/Task.java6
3 files changed, 29 insertions, 13 deletions
diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java
index 36719805b9c3..7fba3e890ec6 100644
--- a/core/java/android/content/res/Resources.java
+++ b/core/java/android/content/res/Resources.java
@@ -89,7 +89,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
@@ -188,7 +187,7 @@ public class Resources {
private int mBaseApkAssetsSize;
/** @hide */
- private static Set<Resources> sResourcesHistory = Collections.synchronizedSet(
+ private static final Set<Resources> sResourcesHistory = Collections.synchronizedSet(
Collections.newSetFromMap(
new WeakHashMap<>()));
@@ -2808,7 +2807,12 @@ public class Resources {
public void dump(PrintWriter pw, String prefix) {
pw.println(prefix + "class=" + getClass());
pw.println(prefix + "resourcesImpl");
- mResourcesImpl.dump(pw, prefix + " ");
+ final var impl = mResourcesImpl;
+ if (impl != null) {
+ impl.dump(pw, prefix + " ");
+ } else {
+ pw.println(prefix + " " + "null");
+ }
}
/** @hide */
@@ -2816,15 +2820,22 @@ public class Resources {
pw.println(prefix + "history");
// Putting into a map keyed on the apk assets to deduplicate resources that are different
// objects but ultimately represent the same assets
- Map<List<ApkAssets>, Resources> history = new ArrayMap<>();
+ ArrayMap<List<ApkAssets>, Resources> history = new ArrayMap<>();
sResourcesHistory.forEach(
- r -> history.put(Arrays.asList(r.mResourcesImpl.mAssets.getApkAssets()), r));
+ r -> {
+ if (r != null) {
+ final var impl = r.mResourcesImpl;
+ if (impl != null) {
+ history.put(Arrays.asList(impl.mAssets.getApkAssets()), r);
+ } else {
+ history.put(null, r);
+ }
+ }
+ });
int i = 0;
for (Resources r : history.values()) {
- if (r != null) {
- pw.println(prefix + i++);
- r.dump(pw, prefix + " ");
- }
+ pw.println(prefix + i++);
+ r.dump(pw, prefix + " ");
}
}
diff --git a/services/core/java/com/android/server/pm/AppDataHelper.java b/services/core/java/com/android/server/pm/AppDataHelper.java
index 79d17534ab26..1dd790502486 100644
--- a/services/core/java/com/android/server/pm/AppDataHelper.java
+++ b/services/core/java/com/android/server/pm/AppDataHelper.java
@@ -50,6 +50,7 @@ import com.android.server.pm.dex.ArtManagerService;
import com.android.server.pm.parsing.pkg.AndroidPackageUtils;
import com.android.server.pm.pkg.AndroidPackage;
import com.android.server.pm.pkg.PackageStateInternal;
+import com.android.server.pm.pkg.PackageUserStateInternal;
import com.android.server.pm.pkg.SELinuxUtil;
import dalvik.system.VMRuntime;
@@ -502,6 +503,7 @@ public class AppDataHelper {
private void assertPackageStorageValid(@NonNull Computer snapshot, String volumeUuid,
String packageName, int userId) throws PackageManagerException {
final PackageStateInternal packageState = snapshot.getPackageStateInternal(packageName);
+ final PackageUserStateInternal userState = packageState.getUserStateOrDefault(userId);
if (packageState == null) {
throw PackageManagerException.ofInternalError("Package " + packageName + " is unknown",
PackageManagerException.INTERNAL_ERROR_STORAGE_INVALID_PACKAGE_UNKNOWN);
@@ -510,9 +512,10 @@ public class AppDataHelper {
"Package " + packageName + " found on unknown volume " + volumeUuid
+ "; expected volume " + packageState.getVolumeUuid(),
PackageManagerException.INTERNAL_ERROR_STORAGE_INVALID_VOLUME_UNKNOWN);
- } else if (!packageState.getUserStateOrDefault(userId).isInstalled()) {
+ } else if (!userState.isInstalled() && !userState.dataExists()) {
throw PackageManagerException.ofInternalError(
- "Package " + packageName + " not installed for user " + userId,
+ "Package " + packageName + " not installed for user " + userId
+ + " or was deleted without DELETE_KEEP_DATA",
PackageManagerException.INTERNAL_ERROR_STORAGE_INVALID_NOT_INSTALLED_FOR_USER);
} else if (packageState.getPkg() != null
&& !shouldHaveAppStorage(packageState.getPkg())) {
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index 5b5177683252..2bee095e7f46 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -4386,10 +4386,12 @@ class Task extends TaskFragment {
void setHasBeenVisible(boolean hasBeenVisible) {
mHasBeenVisible = hasBeenVisible;
- if (!hasBeenVisible || mDeferTaskAppear) {
+ if (!hasBeenVisible) {
return;
}
- sendTaskAppeared();
+ if (!mDeferTaskAppear) {
+ sendTaskAppeared();
+ }
for (WindowContainer<?> parent = getParent(); parent != null; parent = parent.getParent()) {
final Task parentTask = parent.asTask();
if (parentTask == null) {