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

Commit 399c35b0 authored by Luca Zuccarini's avatar Luca Zuccarini Committed by Android (Google) Code Review
Browse files

Merge "Revert "Move isArchived into the PackageItemInfo class."" into main

parents 823689ad 510310bc
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -3798,6 +3798,10 @@ package android.content.pm {
    field @RequiresPermission(android.Manifest.permission.ACCESS_SHORTCUTS) public static final int FLAG_GET_PERSONS_DATA = 2048; // 0x800
    field @RequiresPermission(android.Manifest.permission.ACCESS_SHORTCUTS) public static final int FLAG_GET_PERSONS_DATA = 2048; // 0x800
  }
  }
  public class PackageInfo implements android.os.Parcelable {
    field public boolean isArchived;
  }
  public class PackageInstaller {
  public class PackageInstaller {
    method @NonNull public android.content.pm.PackageInstaller.InstallInfo readInstallInfo(@NonNull java.io.File, int) throws android.content.pm.PackageInstaller.PackageParsingException;
    method @NonNull public android.content.pm.PackageInstaller.InstallInfo readInstallInfo(@NonNull java.io.File, int) throws android.content.pm.PackageInstaller.PackageParsingException;
    method @NonNull public android.content.pm.PackageInstaller.InstallInfo readInstallInfo(@NonNull android.os.ParcelFileDescriptor, @Nullable String, int) throws android.content.pm.PackageInstaller.PackageParsingException;
    method @NonNull public android.content.pm.PackageInstaller.InstallInfo readInstallInfo(@NonNull android.os.ParcelFileDescriptor, @Nullable String, int) throws android.content.pm.PackageInstaller.PackageParsingException;
@@ -3875,7 +3879,6 @@ package android.content.pm {
    method public static void forceSafeLabels();
    method public static void forceSafeLabels();
    method @Deprecated @NonNull public CharSequence loadSafeLabel(@NonNull android.content.pm.PackageManager);
    method @Deprecated @NonNull public CharSequence loadSafeLabel(@NonNull android.content.pm.PackageManager);
    method @NonNull public CharSequence loadSafeLabel(@NonNull android.content.pm.PackageManager, @FloatRange(from=0) float, int);
    method @NonNull public CharSequence loadSafeLabel(@NonNull android.content.pm.PackageManager, @FloatRange(from=0) float, int);
    field @FlaggedApi(Flags.FLAG_ARCHIVING) public boolean isArchived;
  }
  }
  public abstract class PackageManager {
  public abstract class PackageManager {
+16 −0
Original line number Original line Diff line number Diff line
@@ -18,7 +18,9 @@ package android.content.pm;


import android.annotation.NonNull;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.compat.annotation.UnsupportedAppUsage;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.IntentSender;
import android.os.Build;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable;
@@ -488,6 +490,18 @@ public class PackageInfo implements Parcelable {
     */
     */
    public boolean isActiveApex;
    public boolean isActiveApex;


    /**
     * Whether the package is currently in an archived state.
     *
     * <p>Packages can be archived through
     * {@link PackageInstaller#requestArchive(String, IntentSender)} and do not have any APKs stored
     * on the device, but do keep the data directory.
     * @hide
     */
    // TODO(b/278553670) Unhide and update @links before launch.
    @SystemApi
    public boolean isArchived;

    public PackageInfo() {
    public PackageInfo() {
    }
    }


@@ -575,6 +589,7 @@ public class PackageInfo implements Parcelable {
        }
        }
        dest.writeBoolean(isApex);
        dest.writeBoolean(isApex);
        dest.writeBoolean(isActiveApex);
        dest.writeBoolean(isActiveApex);
        dest.writeBoolean(isArchived);
        dest.restoreAllowSquashing(prevAllowSquashing);
        dest.restoreAllowSquashing(prevAllowSquashing);
    }
    }


@@ -640,5 +655,6 @@ public class PackageInfo implements Parcelable {
        }
        }
        isApex = source.readBoolean();
        isApex = source.readBoolean();
        isActiveApex = source.readBoolean();
        isActiveApex = source.readBoolean();
        isArchived = source.readBoolean();
    }
    }
}
}
+0 −17
Original line number Original line Diff line number Diff line
@@ -21,7 +21,6 @@ import static android.text.TextUtils.SAFE_STRING_FLAG_SINGLE_LINE;
import static android.text.TextUtils.SAFE_STRING_FLAG_TRIM;
import static android.text.TextUtils.SAFE_STRING_FLAG_TRIM;
import static android.text.TextUtils.makeSafeForPresentation;
import static android.text.TextUtils.makeSafeForPresentation;


import android.annotation.FlaggedApi;
import android.annotation.FloatRange;
import android.annotation.FloatRange;
import android.annotation.NonNull;
import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.annotation.SystemApi;
@@ -174,18 +173,6 @@ public class PackageItemInfo {
     */
     */
    public int showUserIcon;
    public int showUserIcon;


    /**
     * Whether the package is currently in an archived state.
     *
     * <p>Packages can be archived through {@link PackageArchiver} and do not have any APKs stored
     * on the device, but do keep the data directory.
     * @hide
     */
    // TODO(b/278553670) Unhide and update @links before launch.
    @SystemApi
    @FlaggedApi(Flags.FLAG_ARCHIVING)
    public boolean isArchived;

    public PackageItemInfo() {
    public PackageItemInfo() {
        showUserIcon = UserHandle.USER_NULL;
        showUserIcon = UserHandle.USER_NULL;
    }
    }
@@ -202,7 +189,6 @@ public class PackageItemInfo {
        logo = orig.logo;
        logo = orig.logo;
        metaData = orig.metaData;
        metaData = orig.metaData;
        showUserIcon = orig.showUserIcon;
        showUserIcon = orig.showUserIcon;
        isArchived = orig.isArchived;
    }
    }


    /**
    /**
@@ -456,7 +442,6 @@ public class PackageItemInfo {
        dest.writeBundle(metaData);
        dest.writeBundle(metaData);
        dest.writeInt(banner);
        dest.writeInt(banner);
        dest.writeInt(showUserIcon);
        dest.writeInt(showUserIcon);
        dest.writeBoolean(isArchived);
    }
    }


    /**
    /**
@@ -474,7 +459,6 @@ public class PackageItemInfo {
        }
        }
        proto.write(PackageItemInfoProto.ICON, icon);
        proto.write(PackageItemInfoProto.ICON, icon);
        proto.write(PackageItemInfoProto.BANNER, banner);
        proto.write(PackageItemInfoProto.BANNER, banner);
        proto.write(PackageItemInfoProto.IS_ARCHIVED, isArchived);
        proto.end(token);
        proto.end(token);
    }
    }


@@ -489,7 +473,6 @@ public class PackageItemInfo {
        metaData = source.readBundle();
        metaData = source.readBundle();
        banner = source.readInt();
        banner = source.readInt();
        showUserIcon = source.readInt();
        showUserIcon = source.readInt();
        isArchived = source.readBoolean();
    }
    }


    /**
    /**
+0 −1
Original line number Original line Diff line number Diff line
@@ -30,7 +30,6 @@ message PackageItemInfoProto {
    optional string non_localized_label = 4;
    optional string non_localized_label = 4;
    optional int32 icon = 5;
    optional int32 icon = 5;
    optional int32 banner = 6;
    optional int32 banner = 6;
    optional bool is_archived = 7;
}
}


// Proto of android.content.pm.ApplicationInfo which extends PackageItemInfo
// Proto of android.content.pm.ApplicationInfo which extends PackageItemInfo
+2 −1
Original line number Original line Diff line number Diff line
@@ -1024,7 +1024,7 @@ public class ComputerEngine implements Computer {
        if ("android".equals(packageName) || "system".equals(packageName)) {
        if ("android".equals(packageName) || "system".equals(packageName)) {
            return androidApplication();
            return androidApplication();
        }
        }
        if ((flags & (MATCH_KNOWN_PACKAGES | MATCH_ARCHIVED_PACKAGES)) != 0) {
        if ((flags & MATCH_KNOWN_PACKAGES) != 0) {
            // Already generates the external package name
            // Already generates the external package name
            return generateApplicationInfoFromSettings(packageName,
            return generateApplicationInfoFromSettings(packageName,
                    flags, filterCallingUid, userId);
                    flags, filterCallingUid, userId);
@@ -1518,6 +1518,7 @@ public class ComputerEngine implements Computer {
            pi.sharedUserId = (sharedUser != null) ? sharedUser.getName() : null;
            pi.sharedUserId = (sharedUser != null) ? sharedUser.getName() : null;
            pi.firstInstallTime = state.getFirstInstallTimeMillis();
            pi.firstInstallTime = state.getFirstInstallTimeMillis();
            pi.lastUpdateTime = ps.getLastUpdateTime();
            pi.lastUpdateTime = ps.getLastUpdateTime();
            pi.isArchived = isArchived(state);


            ApplicationInfo ai = new ApplicationInfo();
            ApplicationInfo ai = new ApplicationInfo();
            ai.packageName = ps.getPackageName();
            ai.packageName = ps.getPackageName();
Loading