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

Commit 00ac3178 authored by Song Chun Fan's avatar Song Chun Fan
Browse files

[ADI][9/N] use resource config to specify verifier package

+ Add a getter API to return the verifier package name
+ Allow a system property to override the verifier for testing
+ Shell command to retrieve the verifier package name

Note: the system property is added so that the current CTS tests can
continue to run. It will be removed after the current CTS tests are all
moved to cts-root.

FLAG: android.content.pm.verification_service

BUG: 360129657
Test: atest FrameworksMockingServicesTests_android_server_pm:com.android.server.pm.PackageInstallerServiceTest
Test: manually change the config to specify a test app which is manually
API-Coverage-Bug: 367776952

pushed onto the system partition, verify that it is specified as the
verification service provider via the shell command.

Merged-In: I25babe66665d144a45e032e005186d792455dc3b
Change-Id: I25babe66665d144a45e032e005186d792455dc3b
parent fbc17957
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -13083,6 +13083,7 @@ package android.content.pm {
    method @NonNull public java.util.List<android.content.pm.PackageInstaller.SessionInfo> getMySessions();
    method @Nullable public android.content.pm.PackageInstaller.SessionInfo getSessionInfo(int);
    method @NonNull public java.util.List<android.content.pm.PackageInstaller.SessionInfo> getStagedSessions();
    method @FlaggedApi("android.content.pm.verification_service") @Nullable public final String getVerificationServiceProvider();
    method @RequiresPermission(allOf={android.Manifest.permission.INSTALL_PACKAGES, "com.android.permission.INSTALL_EXISTING_PACKAGES"}) public void installExistingPackage(@NonNull String, int, @Nullable android.content.IntentSender);
    method @FlaggedApi("android.content.pm.archiving") @RequiresPermission(android.Manifest.permission.INSTALL_PACKAGES) public void installPackageArchived(@NonNull android.content.pm.ArchivedPackageInfo, @NonNull android.content.pm.PackageInstaller.SessionParams, @NonNull android.content.IntentSender);
    method @NonNull public android.content.pm.PackageInstaller.Session openSession(int) throws java.io.IOException;
+1 −1
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@ interface IPackageInstaller {

    @EnforcePermission("VERIFICATION_AGENT")
    int getVerificationPolicy(int userId);

    @EnforcePermission("VERIFICATION_AGENT")
    boolean setVerificationPolicy(int policy, int userId);
    String getVerificationServiceProvider();
}
+16 −0
Original line number Diff line number Diff line
@@ -1649,6 +1649,22 @@ public class PackageInstaller {
        }
    }

    /**
     *  Return the package name of the verification service provider, for the
     *  purpose of interacting with the specific verifier in relation to
     *  extension parameters and response structure.  Return null if the system
     *  verifier service provider is not available to the caller, or if there is no
     *  such provider specified by the system.
     */
    @FlaggedApi(Flags.FLAG_VERIFICATION_SERVICE)
    public final @Nullable String getVerificationServiceProvider() {
        try {
            return mInstaller.getVerificationServiceProvider();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * An installation that is being actively staged. For an install to succeed,
     * all existing and new packages must have identical package names, version
+14 −1
Original line number Diff line number Diff line
@@ -28,7 +28,20 @@ import android.os.IBinder;

/**
 * A base service implementation for the verifier agent to implement.
 *
 * <p></p>
 * The verifier agent app should register the implemented {@link VerifierService} in the manifest.
 * Example:
 * <pre>{@code
 *     <service android:name=".MyVerifierService"
 *         permission="android.permission.BIND_VERIFICATION_AGENT">
 *       <intent-filter>
 *         <action android:name="android.intent.action.VERIFICATION_AGENT" />
 *       </intent-filter>
 *     </service>
 * }</pre>
 * <p></p>
 * Notice that the verifier agent app should also declare {@code android:forceQueryable="true"} to
 * make itself visible to the installers.
 * @hide
 */
@SystemApi
+2 −0
Original line number Diff line number Diff line
@@ -7574,4 +7574,6 @@
    <string-array name="config_appFunctionsDeviceSettingsPackages" translatable="false">
    </string-array>

    <!-- Package name for verification service provider app [DO NOT TRANSLATE] -->
    <string name="config_verificationServiceProviderPackageName" translatable="false" />
</resources>
Loading