Update associate API by adding certificate param

Fix: 184264581

Test: N/A
Change-Id: Ie28a2e68826744c0f020113d1b85b5a4b2d54c7f
This commit is contained in:
Guojing Yuan
2021-05-21 21:24:56 +00:00
parent 16cd6bb81f
commit cc4ffc849b
4 changed files with 19 additions and 5 deletions

View File

@@ -442,13 +442,18 @@ public final class CompanionDeviceManager {
/**
* Associates given device with given app for the given user directly, without UI prompt.
*
* @param packageName package name of the companion app
* @param macAddress mac address of the device to associate
* @param certificate The SHA256 digest of the companion app's signing certificate
*
* @hide
*/
@SystemApi
@RequiresPermission(android.Manifest.permission.ASSOCIATE_COMPANION_DEVICES)
public void associate(
@NonNull String packageName,
@NonNull MacAddress macAddress) {
@NonNull MacAddress macAddress,
@NonNull byte[] certificate) {
if (!checkFeaturePresent()) {
return;
}
@@ -458,7 +463,7 @@ public final class CompanionDeviceManager {
UserHandle user = android.os.Process.myUserHandle();
try {
mService.createAssociation(
packageName, macAddress.toString(), user.getIdentifier());
packageName, macAddress.toString(), user.getIdentifier(), certificate);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}

View File

@@ -52,5 +52,6 @@ interface ICompanionDeviceManager {
boolean canPairWithoutPrompt(in String packageName, in String deviceMacAddress, int userId);
void createAssociation(in String packageName, in String macAddress, int userId);
void createAssociation(in String packageName, in String macAddress, int userId,
in byte[] certificate);
}