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

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

Merge "[ADI][34/N] enable a verification policy delegate" into main

parents 8dc22d9e 23f9e00d
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -4327,11 +4327,12 @@ package android.content.pm {
  }
  public class PackageInstaller {
    method @FlaggedApi("android.content.pm.verification_service") @RequiresPermission(android.Manifest.permission.DEVELOPER_VERIFICATION_AGENT) public final int getDeveloperVerificationPolicy();
    method @FlaggedApi("android.content.pm.verification_service") @RequiresPermission(value=android.Manifest.permission.DEVELOPER_VERIFICATION_AGENT, conditional=true) public final int getDeveloperVerificationPolicy();
    method @FlaggedApi("android.content.pm.verification_service") @Nullable @RequiresPermission(android.Manifest.permission.DEVELOPER_VERIFICATION_AGENT) public String getDeveloperVerificationPolicyDelegatePackage();
    method @FlaggedApi("android.content.pm.verification_service") @Nullable @RequiresPermission(android.Manifest.permission.SET_DEVELOPER_VERIFICATION_USER_RESPONSE) public android.content.pm.PackageInstaller.DeveloperVerificationUserConfirmationInfo getDeveloperVerificationUserConfirmationInfo(int);
    method @NonNull public android.content.pm.PackageInstaller.InstallInfo readInstallInfo(@NonNull java.io.File, int) throws android.content.pm.PackageInstaller.PackageParsingException;
    method @FlaggedApi("android.content.pm.read_install_info") @NonNull public android.content.pm.PackageInstaller.InstallInfo readInstallInfo(@NonNull android.os.ParcelFileDescriptor, @Nullable String, int) throws android.content.pm.PackageInstaller.PackageParsingException;
    method @FlaggedApi("android.content.pm.verification_service") @RequiresPermission(android.Manifest.permission.DEVELOPER_VERIFICATION_AGENT) public final boolean setDeveloperVerificationPolicy(int);
    method @FlaggedApi("android.content.pm.verification_service") @RequiresPermission(value=android.Manifest.permission.DEVELOPER_VERIFICATION_AGENT, conditional=true) public final boolean setDeveloperVerificationPolicy(int);
    method @FlaggedApi("android.content.pm.verification_service") @RequiresPermission(android.Manifest.permission.SET_DEVELOPER_VERIFICATION_USER_RESPONSE) public void setDeveloperVerificationUserResponse(int, int);
    method @RequiresPermission(android.Manifest.permission.INSTALL_PACKAGES) public void setPermissionsResult(int, boolean);
    field @FlaggedApi("android.content.pm.verification_service") public static final String ACTION_CONFIRM_DEVELOPER_VERIFICATION = "android.content.pm.action.CONFIRM_DEVELOPER_VERIFICATION";
+4 −2
Original line number Diff line number Diff line
@@ -96,11 +96,13 @@ interface IPackageInstaller {
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(anyOf={android.Manifest.permission.INSTALL_PACKAGES,android.Manifest.permission.REQUEST_INSTALL_PACKAGES})")
    void reportUnarchivalStatus(int unarchiveId, int status, long requiredStorageBytes, in PendingIntent userActionIntent, in UserHandle userHandle);

    @EnforcePermission("DEVELOPER_VERIFICATION_AGENT")
    @PermissionManuallyEnforced
    int getDeveloperVerificationPolicy(int userId);
    @EnforcePermission("DEVELOPER_VERIFICATION_AGENT")
    @PermissionManuallyEnforced
    boolean setDeveloperVerificationPolicy(int policy, int userId);
    ComponentName getDeveloperVerificationServiceProvider();
    @EnforcePermission("DEVELOPER_VERIFICATION_AGENT")
    String getDeveloperVerificationPolicyDelegatePackage(int userId);

    @EnforcePermission("SET_DEVELOPER_VERIFICATION_USER_RESPONSE")
    void setDeveloperVerificationUserResponse(int sessionId, int developerVerificationUserResponse);
+43 −7
Original line number Diff line number Diff line
@@ -1739,13 +1739,21 @@ public class PackageInstaller {
    }

    /**
     * Return the current developer verification enforcement policy. This may only be called by the
     * package currently set by the system as the verifier agent.
     * Return the current developer verification enforcement policy. This may only be called by:
     * <ul>
     *     <li> Packages with {@link android.Manifest.permission#DEVELOPER_VERIFICATION_AGENT}
     *     permission. </li>
     *     <li> The package set by the system as the developer verification service provider.</li>
     *     <li> The package set by the system as the developer verification service policy delegate.
     *     </li>
     * </ul>
     *
     * @hide
     */
    @FlaggedApi(Flags.FLAG_VERIFICATION_SERVICE)
    @SystemApi
    @RequiresPermission(android.Manifest.permission.DEVELOPER_VERIFICATION_AGENT)
    @RequiresPermission(value = Manifest.permission.DEVELOPER_VERIFICATION_AGENT,
            conditional = true)
    public final @DeveloperVerificationPolicy int getDeveloperVerificationPolicy() {
        try {
            return mInstaller.getDeveloperVerificationPolicy(mUserId);
@@ -1756,14 +1764,19 @@ public class PackageInstaller {

    /**
     * Set the current developer verification enforcement policy which will be applied to all future
     * installation sessions. This may only be called by the package currently set by the system as
     * the verifier agent.
     * @hide
     * installation sessions. This may only be called by:
     * <ul>
     *     <li> The package set by the system as the developer verification service provider.</li>
     *     <li> The package set by the system as the developer verification service policy delegate.
     *     </li>
     * </ul>
     * @return whether the new policy was successfully set.
     * @hide
     */
    @FlaggedApi(Flags.FLAG_VERIFICATION_SERVICE)
    @SystemApi
    @RequiresPermission(android.Manifest.permission.DEVELOPER_VERIFICATION_AGENT)
    @RequiresPermission(value = Manifest.permission.DEVELOPER_VERIFICATION_AGENT,
            conditional = true)
    public final boolean setDeveloperVerificationPolicy(@DeveloperVerificationPolicy int policy) {
        try {
            return mInstaller.setDeveloperVerificationPolicy(policy, mUserId);
@@ -1788,6 +1801,29 @@ public class PackageInstaller {
        }
    }

    /**
     * Returns the package name of the app that is specified by the system as the delegate of
     * the developer verification service provider (a.k.a. the verifier) and can change the default
     * developer verification policy on behalf of the verifier. Only the verifier itself can call
     * this method to query the package name of the delegate app, and it must also have package
     * visibility to the delegate app to get the result.
     *
     * @return the package name of the delegate, or null if the delegate app is not specified by
     * the system, or is not available to the caller.
     * @hide
     */
    @FlaggedApi(android.content.pm.Flags.FLAG_VERIFICATION_SERVICE)
    @SystemApi
    @RequiresPermission(android.Manifest.permission.DEVELOPER_VERIFICATION_AGENT)
    @Nullable
    public String getDeveloperVerificationPolicyDelegatePackage() {
        try {
            return mInstaller.getDeveloperVerificationPolicyDelegatePackage(mUserId);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Set user's response to an incomplete developer verification, regarding proceeding with the
     * installation.
+2 −0
Original line number Diff line number Diff line
@@ -7638,6 +7638,8 @@

    <!-- Package name for developer verification service provider app [DO NOT TRANSLATE] -->
    <string name="config_developerVerificationServiceProviderPackageName" translatable="false"></string>
    <!-- Package name for developer verification policy delegate app [DO NOT TRANSLATE] -->
    <string name="config_developerVerificationPolicyDelegatePackageName" translatable="false"></string>

    <!-- Whether the system package installer supports the material design. -->
    <bool name="config_enableMaterialDesignInPackageInstaller">true</bool>
+2 −0
Original line number Diff line number Diff line
@@ -6282,6 +6282,8 @@

  <!-- Developer verification service provider -->
  <java-symbol type="string" name="config_developerVerificationServiceProviderPackageName" />
  <!-- Developer verification policy delegate -->
  <java-symbol type="string" name="config_developerVerificationPolicyDelegatePackageName" />

  <!-- Package and class info to bind to ProximityProviderService -->
  <java-symbol type="string" name="proximity_provider_service_package_name" />
Loading