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

Commit a6a1036f authored by Winson Chiu's avatar Winson Chiu Committed by Automerger Merge Worker
Browse files

Merge "Add skip functionality to package parsing" into rvc-dev am: 2728af85 am: 80fb4ca6

Change-Id: Ia18468fa5b5c2e0f9b2738aac3cacd4a3eccf0c2
parents cae18cfd 80fb4ca6
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1561,6 +1561,14 @@ public abstract class PackageManager {
     */
    public static final int INSTALL_PARSE_FAILED_RESOURCES_ARSC_COMPRESSED = -124;

    /**
     * Installation failed return code: the package was skipped and should be ignored.
     *
     * The reason for the skip is undefined.
     * @hide
     */
    public static final int INSTALL_PARSE_FAILED_SKIPPED = -125;

    /** @hide */
    @IntDef(flag = true, prefix = { "DELETE_" }, value = {
            DELETE_KEEP_DATA,
+1 −0
Original line number Diff line number Diff line
@@ -2001,6 +2001,7 @@ public class PackageParser {
                    Slog.i(TAG, "Skipping target and overlay pair " + pkg.mOverlayTarget + " and "
                        + pkg.baseCodePath+ ": overlay ignored due to required system property: "
                        + propName + " with value: " + propValue);
                    mParseError = PackageManager.INSTALL_PARSE_FAILED_SKIPPED;
                    return null;
                }

+4 −6
Original line number Diff line number Diff line
@@ -2347,14 +2347,12 @@ public class ParsingPackageUtils {
            String propValue = sa.getString(
                    R.styleable.AndroidManifestResourceOverlay_requiredSystemPropertyValue);
            if (!PackageParser.checkRequiredSystemProperties(propName, propValue)) {
                Slog.i(TAG, "Skipping target and overlay pair " + target + " and "
                String message = "Skipping target and overlay pair " + target + " and "
                        + pkg.getBaseCodePath()
                        + ": overlay ignored due to required system property: "
                        + propName + " with value: " + propValue);
                return input.error("Skipping target and overlay pair " + target + " and "
                        + pkg.getBaseCodePath()
                        + ": overlay ignored due to required system property: "
                        + propName + " with value: " + propValue);
                        + propName + " with value: " + propValue;
                Slog.i(TAG, message);
                return input.skip(message);
            }

            return input.success(pkg.setOverlay(true)
+8 −0
Original line number Diff line number Diff line
@@ -88,6 +88,14 @@ public interface ParseInput {
     */
    ParseResult<?> enableDeferredError(String packageName, int targetSdkVersion);

    /**
     * This will assign errorCode to {@link PackageManager#INSTALL_PARSE_FAILED_SKIPPED, used for
     * packages which should be ignored by the caller.
     *
     * @see #error(int, String, Exception)
     */
    <ResultType> ParseResult<ResultType> skip(@NonNull String parseError);

    /** @see #error(int, String, Exception) */
    <ResultType> ParseResult<ResultType> error(int parseError);

+5 −0
Original line number Diff line number Diff line
@@ -146,6 +146,11 @@ public class ParseTypeImpl implements ParseInput, ParseResult<Object> {
        return success(null);
    }

    @Override
    public <ResultType> ParseResult<ResultType> skip(@NonNull String parseError) {
        return error(PackageManager.INSTALL_PARSE_FAILED_SKIPPED, parseError);
    }

    @Override
    public <ResultType> ParseResult<ResultType> error(int parseError) {
        return error(parseError, null);
Loading