Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c98aebc4 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Encapsulate remaining PackageSetting fields"

parents 394a85f7 8b88795f
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1499,8 +1499,8 @@ public class ComputerEngine implements Computer {
            ai.primaryCpuAbi = ps.getPrimaryCpuAbi();
            ai.secondaryCpuAbi = ps.getSecondaryCpuAbi();
            ai.setVersionCode(ps.getVersionCode());
            ai.flags = ps.getPkgFlags();
            ai.privateFlags = ps.getPkgPrivateFlags();
            ai.flags = ps.getFlags();
            ai.privateFlags = ps.getPrivateFlags();
            pi.applicationInfo = PackageInfoWithoutStateUtils.generateDelegateApplicationInfo(
                    ai, flags, state, userId);

+1 −1
Original line number Diff line number Diff line
@@ -829,7 +829,7 @@ final class DeletePackageHelper {
            }
            final String packageName = ps.getPkg().getPackageName();
            // Skip over if system app or static shared library
            if ((ps.pkgFlags & ApplicationInfo.FLAG_SYSTEM) != 0
            if ((ps.getFlags() & ApplicationInfo.FLAG_SYSTEM) != 0
                    || !TextUtils.isEmpty(ps.getPkg().getStaticSharedLibName())) {
                continue;
            }
+7 −6
Original line number Diff line number Diff line
@@ -2192,15 +2192,16 @@ final class InstallPackageHelper {
                            reconciledPkg.mPrepareResult.mExistingPackage.getPackageName());
                    if ((reconciledPkg.mInstallArgs.mInstallFlags & PackageManager.DONT_KILL_APP)
                            == 0) {
                        if (ps1.mOldCodePaths == null) {
                            ps1.mOldCodePaths = new ArraySet<>();
                        if (ps1.getOldCodePaths() == null) {
                            ps1.setOldCodePaths(new ArraySet<>());
                        }
                        Collections.addAll(ps1.mOldCodePaths, oldPackage.getBaseApkPath());
                        Collections.addAll(ps1.getOldCodePaths(), oldPackage.getBaseApkPath());
                        if (oldPackage.getSplitCodePaths() != null) {
                            Collections.addAll(ps1.mOldCodePaths, oldPackage.getSplitCodePaths());
                            Collections.addAll(ps1.getOldCodePaths(),
                                    oldPackage.getSplitCodePaths());
                        }
                    } else {
                        ps1.mOldCodePaths = null;
                        ps1.setOldCodePaths(null);
                    }

                    if (reconciledPkg.mInstallResult.mReturnCode
@@ -3600,7 +3601,7 @@ final class InstallPackageHelper {
             * If this is not a system app, it can't be a
             * disable system app.
             */
            if ((ps.pkgFlags & ApplicationInfo.FLAG_SYSTEM) == 0) {
            if (!ps.isSystem()) {
                continue;
            }

+12 −10
Original line number Diff line number Diff line
@@ -2071,7 +2071,7 @@ public class PackageManagerService extends IPackageManager.Stub
                int size = packageSettings.size();
                for (int i = 0; i < size; i++) {
                    final PackageSetting ps = packageSettings.valueAt(i);
                    if ((ps.pkgFlags & ApplicationInfo.FLAG_SYSTEM) != 0) {
                    if ((ps.getFlags() & ApplicationInfo.FLAG_SYSTEM) != 0) {
                        continue;
                    }
                    ps.disableComponentLPw(PackageManager.APP_DETAILS_ACTIVITY_CLASS_NAME,
@@ -3370,11 +3370,11 @@ public class PackageManagerService extends IPackageManager.Stub

            final String libName = libInfo.getName();
            if (libInfo.isStatic()) {
                final int libIdx = ArrayUtils.indexOf(ps.usesStaticLibraries, libName);
                final int libIdx = ArrayUtils.indexOf(ps.getUsesStaticLibraries(), libName);
                if (libIdx < 0) {
                    continue;
                }
                if (ps.usesStaticLibrariesVersions[libIdx] != libInfo.getLongVersion()) {
                if (ps.getUsesStaticLibrariesVersions()[libIdx] != libInfo.getLongVersion()) {
                    continue;
                }
                if (shouldFilterApplicationLocked(ps, callingUid, userId)) {
@@ -4046,13 +4046,13 @@ public class PackageManagerService extends IPackageManager.Stub
                if (shouldFilterApplicationLocked(sus, callingUid, callingUserId)) {
                    return 0;
                }
                return sus.pkgFlags;
                return sus.getFlags();
            } else if (obj instanceof PackageSetting) {
                final PackageSetting ps = (PackageSetting) obj;
                if (shouldFilterApplicationLocked(ps, callingUid, callingUserId)) {
                    return 0;
                }
                return ps.pkgFlags;
                return ps.getFlags();
            }
        }
        return 0;
@@ -4073,13 +4073,13 @@ public class PackageManagerService extends IPackageManager.Stub
                if (shouldFilterApplicationLocked(sus, callingUid, callingUserId)) {
                    return 0;
                }
                return sus.pkgPrivateFlags;
                return sus.getPrivateFlags();
            } else if (obj instanceof PackageSetting) {
                final PackageSetting ps = (PackageSetting) obj;
                if (shouldFilterApplicationLocked(ps, callingUid, callingUserId)) {
                    return 0;
                }
                return ps.pkgPrivateFlags;
                return ps.getPrivateFlags();
            }
        }
        return 0;
@@ -6867,9 +6867,11 @@ public class PackageManagerService extends IPackageManager.Stub
                return false;
            }
            if (systemUserApp) {
                ps.pkgPrivateFlags |= ApplicationInfo.PRIVATE_FLAG_REQUIRED_FOR_SYSTEM_USER;
                ps.setPrivateFlags(ps.getPrivateFlags()
                        | ApplicationInfo.PRIVATE_FLAG_REQUIRED_FOR_SYSTEM_USER);
            } else {
                ps.pkgPrivateFlags &= ~ApplicationInfo.PRIVATE_FLAG_REQUIRED_FOR_SYSTEM_USER;
                ps.setPrivateFlags(ps.getPrivateFlags()
                        & ~ApplicationInfo.PRIVATE_FLAG_REQUIRED_FOR_SYSTEM_USER);
            }
            writeSettingsLPrTEMP();
        }
@@ -7800,7 +7802,7 @@ public class PackageManagerService extends IPackageManager.Stub
                            : "Unknown package: " + packageName);
                }
                if (callingUid == Process.SHELL_UID
                        && (pkgSetting.pkgFlags & ApplicationInfo.FLAG_TEST_ONLY) == 0) {
                        && (pkgSetting.getFlags() & ApplicationInfo.FLAG_TEST_ONLY) == 0) {
                    // Shell can only change whole packages between ENABLED and DISABLED_USER states
                    // unless it is a test package.
                    final int oldState = pkgSetting.getEnabled(userId);
+2 −2
Original line number Diff line number Diff line
@@ -989,11 +989,11 @@ public class PackageManagerServiceUtils {
    }

    public static boolean isSystemApp(PackageSetting ps) {
        return (ps.pkgFlags & ApplicationInfo.FLAG_SYSTEM) != 0;
        return (ps.getFlags() & ApplicationInfo.FLAG_SYSTEM) != 0;
    }

    public static boolean isUpdatedSystemApp(PackageSetting ps) {
        return (ps.pkgFlags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0;
        return (ps.getFlags() & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0;
    }

    // Static to give access to ComputeEngine
Loading