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

Commit c17bb68c authored by Winson's avatar Winson
Browse files

Clean up trivial package refactor TODOs

Several TODOs were wrapped up as part of other work, but not cleaned up
properly.

Also fixes some toString methods which were incorrectly copy-pasted.

Bug: 160868823

Test: manual build, mostly non-functional changes

Change-Id: I577786f1ee178922a8d9a0d6c2708589b1b8dc37
parent 19378800
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ import java.util.List;
/** @hide */
public class ApkLiteParseUtils {

    private static final String TAG = ParsingPackageUtils.TAG;
    private static final String TAG = ParsingUtils.TAG;

    // TODO(b/135203078): Consolidate constants
    private static final int DEFAULT_MIN_SDK_VERSION = 1;
+24 −26
Original line number Diff line number Diff line
@@ -888,6 +888,9 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
    public ApplicationInfo toAppInfoWithoutStateWithoutFlags() {
        ApplicationInfo appInfo = new ApplicationInfo();

        // Lines that are commented below are state related and should not be assigned here.
        // They are left in as placeholders, since there is no good backwards compatible way to
        // separate these.
        appInfo.appComponentFactory = appComponentFactory;
        appInfo.backupAgentName = backupAgentName;
        appInfo.banner = banner;
@@ -897,13 +900,17 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
        appInfo.compatibleWidthLimitDp = compatibleWidthLimitDp;
        appInfo.compileSdkVersion = compileSdkVersion;
        appInfo.compileSdkVersionCodename = compileSdkVersionCodeName;
//        appInfo.credentialProtectedDataDir = credentialProtectedDataDir;
//        appInfo.dataDir = dataDir;
//        appInfo.credentialProtectedDataDir
        appInfo.crossProfile = isCrossProfile();
//        appInfo.dataDir
        appInfo.descriptionRes = descriptionRes;
//        appInfo.deviceProtectedDataDir = deviceProtectedDataDir;
//        appInfo.deviceProtectedDataDir
        appInfo.enabled = enabled;
//        appInfo.enabledSetting
        appInfo.fullBackupContent = fullBackupContent;
//        appInfo.hiddenUntilInstalled = hiddenUntilInstalled;
        // TODO(b/135203078): See ParsingPackageImpl#getHiddenApiEnforcementPolicy
//        appInfo.mHiddenApiPolicy
//        appInfo.hiddenUntilInstalled
        appInfo.icon = (PackageParser.sUseRoundIcon && roundIconRes != 0) ? roundIconRes : iconRes;
        appInfo.iconRes = iconRes;
        appInfo.roundIconRes = roundIconRes;
@@ -920,9 +927,9 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
        if (appInfo.name != null) {
            appInfo.name = appInfo.name.trim();
        }
//        appInfo.nativeLibraryDir = nativeLibraryDir;
//        appInfo.nativeLibraryRootDir = nativeLibraryRootDir;
//        appInfo.nativeLibraryRootRequiresIsa = nativeLibraryRootRequiresIsa;
//        appInfo.nativeLibraryDir
//        appInfo.nativeLibraryRootDir
//        appInfo.nativeLibraryRootRequiresIsa
        appInfo.networkSecurityConfigRes = networkSecurityConfigRes;
        appInfo.nonLocalizedLabel = nonLocalizedLabel;
        if (appInfo.nonLocalizedLabel != null) {
@@ -930,16 +937,17 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
        }
        appInfo.packageName = packageName;
        appInfo.permission = permission;
//        appInfo.primaryCpuAbi = primaryCpuAbi;
//        appInfo.primaryCpuAbi
        appInfo.processName = getProcessName();
        appInfo.requiresSmallestWidthDp = requiresSmallestWidthDp;
//        appInfo.secondaryCpuAbi = secondaryCpuAbi;
//        appInfo.secondaryNativeLibraryDir = secondaryNativeLibraryDir;
//        appInfo.seInfo = seInfo;
//        appInfo.seInfoUser = seInfoUser;
//        appInfo.sharedLibraryFiles = usesLibraryFiles.isEmpty()
//                ? null : usesLibraryFiles.toArray(new String[0]);
//        appInfo.sharedLibraryInfos = usesLibraryInfos.isEmpty() ? null : usesLibraryInfos;
//        appInfo.resourceDirs
//        appInfo.secondaryCpuAbi
//        appInfo.secondaryNativeLibraryDir
//        appInfo.seInfo
//        appInfo.seInfoUser
//        appInfo.sharedLibraryFiles
//        appInfo.sharedLibraryInfos
//        appInfo.showUserIcon
        appInfo.splitClassLoaderNames = splitClassLoaderNames;
        appInfo.splitDependencies = splitDependencies;
        appInfo.splitNames = splitNames;
@@ -948,11 +956,10 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
        appInfo.targetSdkVersion = targetSdkVersion;
        appInfo.taskAffinity = taskAffinity;
        appInfo.theme = theme;
//        appInfo.uid = uid;
//        appInfo.uid
        appInfo.uiOptions = uiOptions;
        appInfo.volumeUuid = volumeUuid;
        appInfo.zygotePreloadName = zygotePreloadName;
        appInfo.crossProfile = isCrossProfile();
        appInfo.setGwpAsanMode(gwpAsanMode);
        appInfo.setBaseCodePath(baseCodePath);
        appInfo.setBaseResourcePath(baseCodePath);
@@ -962,15 +969,6 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
        appInfo.setSplitResourcePaths(splitCodePaths);
        appInfo.setVersionCode(PackageInfo.composeLongVersionCode(versionCodeMajor, versionCode));

        // TODO(b/135203078): Can this be removed? Looks only used in ActivityInfo.
//        appInfo.showUserIcon = pkg.getShowUserIcon();
        // TODO(b/135203078): Unused?
//        appInfo.resourceDirs = pkg.getResourceDirs();
        // TODO(b/135203078): Unused?
//        appInfo.enabledSetting = pkg.getEnabledSetting();
        // TODO(b/135203078): See ParsingPackageImpl#getHiddenApiEnforcementPolicy
//        appInfo.mHiddenApiPolicy = pkg.getHiddenApiPolicy();

        return appInfo;
    }

+1 −6
Original line number Diff line number Diff line
@@ -128,7 +128,7 @@ import java.util.StringTokenizer;
 */
public class ParsingPackageUtils {

    public static final String TAG = ParsingUtils.TAG;
    private static final String TAG = ParsingUtils.TAG;

    /**
     * @see #parseDefault(ParseInput, File, int, boolean)
@@ -740,7 +740,6 @@ public class ParsingPackageUtils {
            String tagName = parser.getName();
            final ParseResult result;

            // TODO(b/135203078): Convert to instance methods to share variables
            // <application> has special logic, so it's handled outside the general method
            if (PackageParser.TAG_APPLICATION.equals(tagName)) {
                if (foundApp) {
@@ -1720,10 +1719,6 @@ public class ParsingPackageUtils {
                pkg.setPersistent(requiredFeature == null || mCallback.hasFeature(requiredFeature));
            }

            // TODO(b/135203078): Should parsing code be responsible for this? Maybe move to a
            //  util or just have PackageImpl return true if either flag is set
            pkg.setProfileableByShell(pkg.isProfileableByShell());

            if (sa.hasValueOrEmpty(R.styleable.AndroidManifestApplication_resizeableActivity)) {
                pkg.setResizeableActivity(sa.getBoolean(
                        R.styleable.AndroidManifestApplication_resizeableActivity, true));
+0 −1
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ import java.io.IOException;
/** @hide **/
public class ParsingUtils {

    // TODO(b/135203078): Consolidate log tags
    public static final String TAG = "PackageParsing";

    @Nullable
+2 −6
Original line number Diff line number Diff line
@@ -24,15 +24,13 @@ import android.content.pm.PackageParser;
import android.content.pm.PackageUserState;
import android.content.pm.parsing.ParsingPackage;
import android.content.pm.parsing.ParsingUtils;
import android.content.pm.parsing.result.ParseInput;
import android.content.pm.parsing.result.ParseResult;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.text.TextUtils;

import android.content.pm.parsing.ParsingPackageUtils;
import android.content.pm.parsing.result.ParseInput;
import android.content.pm.parsing.result.ParseResult;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

@@ -41,8 +39,6 @@ import java.io.IOException;
/** @hide */
public class ComponentParseUtils {

    private static final String TAG = ParsingPackageUtils.TAG;

    public static boolean isImplicitlyExposedIntent(ParsedIntentInfo intentInfo) {
        return intentInfo.hasCategory(Intent.CATEGORY_BROWSABLE)
                || intentInfo.hasAction(Intent.ACTION_SEND)
Loading