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

Commit 094d9f02 authored by Vladimir Komsiyski's avatar Vladimir Komsiyski
Browse files

Require VDM device profile for CDM associations

when creating virtual devices. This breaks all our CTS
because the CDM shell doesn't accept device profiles,
so fixing this as well.

Bug: 315481938
Test: atest VirtualDeviceManagerBasicTest
Change-Id: I431a2e170d5ef485daa6fe06b424e699adb1f597
parent f5423b1d
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -92,9 +92,10 @@ class CompanionDeviceShellCommand extends ShellCommand {
                    int userId = getNextIntArgRequired();
                    String packageName = getNextArgRequired();
                    String address = getNextArgRequired();
                    String deviceProfile = getNextArg();
                    final MacAddress macAddress = MacAddress.fromString(address);
                    mService.createNewAssociation(userId, packageName, macAddress,
                            null, null, false);
                            null, deviceProfile, false);
                }
                break;

@@ -350,7 +351,7 @@ class CompanionDeviceShellCommand extends ShellCommand {
        pw.println("      Print this help text.");
        pw.println("  list USER_ID");
        pw.println("      List all Associations for a user.");
        pw.println("  associate USER_ID PACKAGE MAC_ADDRESS");
        pw.println("  associate USER_ID PACKAGE MAC_ADDRESS [DEVICE_PROFILE]");
        pw.println("      Create a new Association.");
        pw.println("  disassociate USER_ID PACKAGE MAC_ADDRESS");
        pw.println("      Remove an existing Association.");
+6 −0
Original line number Diff line number Diff line
@@ -439,6 +439,12 @@ public class VirtualDeviceManagerService extends SystemService {
            if (associationInfo == null) {
                throw new IllegalArgumentException("No association with ID " + associationId);
            }
            if (!VIRTUAL_DEVICE_COMPANION_DEVICE_PROFILES
                    .contains(associationInfo.getDeviceProfile())
                    && Flags.persistentDeviceIdApi()) {
                throw new IllegalArgumentException("Unsupported CDM Association device profile "
                        + associationInfo.getDeviceProfile() + " for virtual device creation.");
            }
            Objects.requireNonNull(params);
            Objects.requireNonNull(activityListener);
            Objects.requireNonNull(soundEffectListener);