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

Commit 708c3ada authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[ADI][41/N] remove DEVELOPER_VERIFICATION_BYPASSED_REASON_UNSPECIFIED" into main

parents a27e0f34 a364a1ec
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -4782,7 +4782,6 @@ package android.content.pm.verify.developer {
    field public static final int DEVELOPER_VERIFICATION_BYPASSED_REASON_ADB = 1; // 0x1
    field public static final int DEVELOPER_VERIFICATION_BYPASSED_REASON_EMERGENCY = 2; // 0x2
    field public static final int DEVELOPER_VERIFICATION_BYPASSED_REASON_TEST = 3; // 0x3
    field public static final int DEVELOPER_VERIFICATION_BYPASSED_REASON_UNSPECIFIED = 0; // 0x0
    field public static final int DEVELOPER_VERIFICATION_INCOMPLETE_NETWORK_UNAVAILABLE = 1; // 0x1
    field public static final int DEVELOPER_VERIFICATION_INCOMPLETE_UNKNOWN = 0; // 0x0
  }
+2 −9
Original line number Diff line number Diff line
@@ -67,11 +67,6 @@ public final class DeveloperVerificationSession implements Parcelable {
    public @interface DeveloperVerificationIncompleteReason {
    }

    /**
     * The developer verification is bypassed because of an unspecified reason. This field is
     * reserved and must not be used when reporting a developer verification bypass.
     */
    public static final int DEVELOPER_VERIFICATION_BYPASSED_REASON_UNSPECIFIED = 0;
    /**
     * The developer verification is bypassed because the installation was initiated from the
     * Android Debug Bridge (ADB) service.
@@ -320,10 +315,8 @@ public final class DeveloperVerificationSession implements Parcelable {
    /**
     * Report to the system that the developer verification verification has been bypassed because
     * of a certain reason.
     * @param bypassReason The reason for the verification bypass, which must be larger than
     *                     {@link #DEVELOPER_VERIFICATION_BYPASSED_REASON_UNSPECIFIED}.
     * @throws IllegalArgumentException if @bypassReason is less than or equal to
     * {@link #DEVELOPER_VERIFICATION_BYPASSED_REASON_UNSPECIFIED}.
     * @param bypassReason The reason for the verification bypass, which must be a positive integer.
     * @throws IllegalArgumentException if @bypassReason is not a positive integer.
     * @throws SecurityException if the caller is not the current verifier bound by the system.
     * @throws IllegalStateException if this is called after the session has finished, because
     * this API or {@link #reportVerificationComplete} or or {@link #reportVerificationIncomplete}
+1 −3
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ import android.annotation.Nullable;
import android.content.pm.DataLoaderType;
import android.content.pm.PackageInstaller;
import android.content.pm.PackageManager;
import android.content.pm.verify.developer.DeveloperVerificationSession;
import android.content.pm.verify.developer.DeveloperVerificationStatus;
import android.os.Handler;

@@ -85,8 +84,7 @@ final class SessionMetrics {
    private long mDeveloperVerificationRetryDurationMillis;

    private int mDeveloperVerifierUid = INVALID_UID;
    private int mIsDeveloperVerificationBypassedReason =
            DeveloperVerificationSession.DEVELOPER_VERIFICATION_BYPASSED_REASON_UNSPECIFIED;
    private int mIsDeveloperVerificationBypassedReason = 0;
    private boolean mIsDeveloperVerificationTimeoutExtensionRequested = false;
    private final boolean mHasDeveloperVerificationExtensionParams;
    private boolean mIsDeveloperVerificationPolicyOverridden = false;
+1 −2
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.server.pm.verify.developer;

import static android.content.pm.verify.developer.DeveloperVerificationSession.DEVELOPER_VERIFICATION_BYPASSED_REASON_UNSPECIFIED;
import static android.content.pm.verify.developer.DeveloperVerificationSession.DEVELOPER_VERIFICATION_INCOMPLETE_NETWORK_UNAVAILABLE;
import static android.content.pm.verify.developer.DeveloperVerificationSession.DEVELOPER_VERIFICATION_INCOMPLETE_UNKNOWN;
import static android.os.Process.INVALID_UID;
@@ -658,7 +657,7 @@ public class DeveloperVerifierController {
                            + " doesn't exist or has finished");
                }
            }
            if (bypassReason <= DEVELOPER_VERIFICATION_BYPASSED_REASON_UNSPECIFIED) {
            if (bypassReason <= 0) {
                throw new IllegalArgumentException("Verification session " + id
                        + " reported invalid bypass_reason code " + bypassReason);
            }
+2 −4
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.server.pm.verify.developer;
import static android.content.pm.PackageInstaller.DEVELOPER_VERIFICATION_POLICY_BLOCK_FAIL_CLOSED;
import static android.content.pm.PackageInstaller.DEVELOPER_VERIFICATION_POLICY_BLOCK_FAIL_OPEN;
import static android.content.pm.verify.developer.DeveloperVerificationSession.DEVELOPER_VERIFICATION_BYPASSED_REASON_EMERGENCY;
import static android.content.pm.verify.developer.DeveloperVerificationSession.DEVELOPER_VERIFICATION_BYPASSED_REASON_UNSPECIFIED;
import static android.os.Process.INVALID_UID;

import static com.google.common.truth.Truth.assertThat;
@@ -483,10 +482,9 @@ public class DeveloperVerifierControllerTest {
        // Reason cannot be negative
        expectThrows(IllegalArgumentException.class,
                () -> session.reportVerificationBypassed(-1));
        // Reason cannot be unspecified
        // Reason cannot be 0
        expectThrows(IllegalArgumentException.class,
                () -> session.reportVerificationBypassed(
                        DEVELOPER_VERIFICATION_BYPASSED_REASON_UNSPECIFIED));
                () -> session.reportVerificationBypassed(0));
    }

    @Test