Loading services/core/java/com/android/server/pm/parsing/PackageInfoUtils.java +30 −5 Original line number Diff line number Diff line Loading @@ -444,7 +444,7 @@ public class PackageInfoUtils { updateApplicationInfo(info, flags, state); initForUser(info, pkg, userId); initForUser(info, pkg, userId, state); // TODO(b/135203078): Remove PackageParser1/toAppInfoWithoutState and clean all this up PackageStateUnserialized pkgState = pkgSetting.getTransientState(); Loading Loading @@ -690,7 +690,7 @@ public class PackageInfoUtils { info.splitDependencies = pkg.getSplitDependencies().size() == 0 ? null : pkg.getSplitDependencies(); initForUser(info, pkg, userId); initForUser(info, pkg, userId, state); info.primaryCpuAbi = pkgSetting.getPrimaryCpuAbi(); info.secondaryCpuAbi = pkgSetting.getSecondaryCpuAbi(); Loading Loading @@ -1006,7 +1006,7 @@ public class PackageInfoUtils { } private static void initForUser(ApplicationInfo output, AndroidPackage input, @UserIdInt int userId) { @UserIdInt int userId, PackageUserStateInternal state) { PackageImpl pkg = ((PackageImpl) input); String packageName = input.getPackageName(); output.uid = UserHandle.getUid(userId, UserHandle.getAppId(input.getUid())); Loading @@ -1016,6 +1016,13 @@ public class PackageInfoUtils { return; } if (android.content.pm.Flags.nullableDataDir() && !state.isInstalled() && !state.dataExists()) { // The data dir has been deleted output.dataDir = null; return; } // For performance reasons, all these paths are built as strings if (userId == UserHandle.USER_SYSTEM) { output.credentialProtectedDataDir = Loading Loading @@ -1050,7 +1057,7 @@ public class PackageInfoUtils { // This duplicates the ApplicationInfo variant because it uses field assignment and the classes // don't inherit from each other, unfortunately. Consolidating logic would introduce overhead. private static void initForUser(InstrumentationInfo output, AndroidPackage input, @UserIdInt int userId) { @UserIdInt int userId, PackageUserStateInternal state) { PackageImpl pkg = ((PackageImpl) input); String packageName = input.getPackageName(); if ("android".equals(packageName)) { Loading @@ -1058,6 +1065,13 @@ public class PackageInfoUtils { return; } if (android.content.pm.Flags.nullableDataDir() && !state.isInstalled() && !state.dataExists()) { // The data dir has been deleted output.dataDir = null; return; } // For performance reasons, all these paths are built as strings if (userId == UserHandle.USER_SYSTEM) { output.credentialProtectedDataDir = Loading Loading @@ -1089,12 +1103,23 @@ public class PackageInfoUtils { } } @NonNull /** * Returns the data dir of the app for the target user. Return null if the app isn't installed * on the target user and doesn't have a data dir on the target user. */ @Nullable public static File getDataDir(PackageStateInternal ps, int userId) { if ("android".equals(ps.getPackageName())) { return Environment.getDataSystemDirectory(); } if (android.content.pm.Flags.nullableDataDir() && !ps.getUserStateOrDefault(userId).isInstalled() && !ps.getUserStateOrDefault(userId).dataExists()) { // The app has been uninstalled for the user and the data dir has been deleted return null; } if (ps.isDefaultToDeviceProtectedStorage() && PackageManager.APPLY_DEFAULT_TO_DEVICE_PROTECTED_STORAGE) { return Environment.getDataUserDePackageDirectory(ps.getVolumeUuid(), userId, Loading Loading
services/core/java/com/android/server/pm/parsing/PackageInfoUtils.java +30 −5 Original line number Diff line number Diff line Loading @@ -444,7 +444,7 @@ public class PackageInfoUtils { updateApplicationInfo(info, flags, state); initForUser(info, pkg, userId); initForUser(info, pkg, userId, state); // TODO(b/135203078): Remove PackageParser1/toAppInfoWithoutState and clean all this up PackageStateUnserialized pkgState = pkgSetting.getTransientState(); Loading Loading @@ -690,7 +690,7 @@ public class PackageInfoUtils { info.splitDependencies = pkg.getSplitDependencies().size() == 0 ? null : pkg.getSplitDependencies(); initForUser(info, pkg, userId); initForUser(info, pkg, userId, state); info.primaryCpuAbi = pkgSetting.getPrimaryCpuAbi(); info.secondaryCpuAbi = pkgSetting.getSecondaryCpuAbi(); Loading Loading @@ -1006,7 +1006,7 @@ public class PackageInfoUtils { } private static void initForUser(ApplicationInfo output, AndroidPackage input, @UserIdInt int userId) { @UserIdInt int userId, PackageUserStateInternal state) { PackageImpl pkg = ((PackageImpl) input); String packageName = input.getPackageName(); output.uid = UserHandle.getUid(userId, UserHandle.getAppId(input.getUid())); Loading @@ -1016,6 +1016,13 @@ public class PackageInfoUtils { return; } if (android.content.pm.Flags.nullableDataDir() && !state.isInstalled() && !state.dataExists()) { // The data dir has been deleted output.dataDir = null; return; } // For performance reasons, all these paths are built as strings if (userId == UserHandle.USER_SYSTEM) { output.credentialProtectedDataDir = Loading Loading @@ -1050,7 +1057,7 @@ public class PackageInfoUtils { // This duplicates the ApplicationInfo variant because it uses field assignment and the classes // don't inherit from each other, unfortunately. Consolidating logic would introduce overhead. private static void initForUser(InstrumentationInfo output, AndroidPackage input, @UserIdInt int userId) { @UserIdInt int userId, PackageUserStateInternal state) { PackageImpl pkg = ((PackageImpl) input); String packageName = input.getPackageName(); if ("android".equals(packageName)) { Loading @@ -1058,6 +1065,13 @@ public class PackageInfoUtils { return; } if (android.content.pm.Flags.nullableDataDir() && !state.isInstalled() && !state.dataExists()) { // The data dir has been deleted output.dataDir = null; return; } // For performance reasons, all these paths are built as strings if (userId == UserHandle.USER_SYSTEM) { output.credentialProtectedDataDir = Loading Loading @@ -1089,12 +1103,23 @@ public class PackageInfoUtils { } } @NonNull /** * Returns the data dir of the app for the target user. Return null if the app isn't installed * on the target user and doesn't have a data dir on the target user. */ @Nullable public static File getDataDir(PackageStateInternal ps, int userId) { if ("android".equals(ps.getPackageName())) { return Environment.getDataSystemDirectory(); } if (android.content.pm.Flags.nullableDataDir() && !ps.getUserStateOrDefault(userId).isInstalled() && !ps.getUserStateOrDefault(userId).dataExists()) { // The app has been uninstalled for the user and the data dir has been deleted return null; } if (ps.isDefaultToDeviceProtectedStorage() && PackageManager.APPLY_DEFAULT_TO_DEVICE_PROTECTED_STORAGE) { return Environment.getDataUserDePackageDirectory(ps.getVolumeUuid(), userId, Loading