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

Commit 6a4e4454 authored by Neill Kapron's avatar Neill Kapron
Browse files

[AOA FFS Implementation] Check ro.usb.userspace.aoa.enabled property



This checks the ro.usb.userspace.aoa.enabled property which is set by
device init when enabling the userspace AOA implementation

Bug: 407985367
Bug: 440091110
Flag: android.hardware.usb.flags.enable_aoa_userspace_implementation
Test: Manual - flagging infrastructure
Change-Id: I96ed1133dddabbcf685597179db7fb5bcb154893
Signed-off-by: default avatarNeill Kapron <nkapron@google.com>
parent c22af53a
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -241,6 +241,7 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser
    private final boolean mEnableUdcSysfsUsbStateUpdate;
    private String mUdcName = "";

    private static final String DEVICE_UAOA_ENABLED_PROPERTY = "ro.usb.userspace.aoa.enabled";
    private boolean mEnableAoaUserspaceImplementation = false;

    /**
@@ -363,11 +364,16 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser
        }
        mControlFds.put(UsbManager.FUNCTION_PTP, ptpFd);

      // TODO: b/440091110 - Add check for device property.
        boolean deviceEnabledUserspaceAoa =
                SystemProperties.getBoolean(DEVICE_UAOA_ENABLED_PROPERTY, false);
        Slog.i(TAG, "Device enabled userspace AOA: " + deviceEnabledUserspaceAoa);
        mEnableAoaUserspaceImplementation =
                android.hardware.usb.flags.Flags.enableAoaUserspaceImplementation()
                        && deviceEnabledUserspaceAoa
                        && nativeCheckAccessoryFfsDirectories();

        Slog.i(TAG, "Enabling userspace AOA: " + mEnableAoaUserspaceImplementation);

        if (mEnableAoaUserspaceImplementation) {
            if (!nativeOpenAccessoryControl()) {
                Slog.e(TAG, "Failed to open control for accessory");