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

Commit c03bc7ce authored by Himanshu Rawat's avatar Himanshu Rawat Committed by Gerrit Code Review
Browse files

Merge changes from topic "revert-3283939-NGDXBRJSCP" into main

* changes:
  Revert "Bumble Java Android Headtracker Test Infra Changes"
  Revert "Modified HidHostTest as per new hid rpc call"
  Revert "Modified HidHostDualModeTest as per new hid rpc call"
  Revert "Modified LeAudioServiceDiscoveryTest"
parents 268ac766 f2157382
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -83,9 +83,6 @@ import org.mockito.MockitoAnnotations;
import org.mockito.hamcrest.MockitoHamcrest;
import org.mockito.stubbing.Answer;

import pandora.HIDGrpc;
import pandora.HidProto.HidServiceType;
import pandora.HidProto.ServiceRequest;
import pandora.HostProto.AdvertiseRequest;
import pandora.HostProto.OwnAddressType;

@@ -109,7 +106,6 @@ public class HidHostDualModeTest {
            InstrumentationRegistry.getInstrumentation().getTargetContext();
    private final BluetoothAdapter mAdapter =
            mContext.getSystemService(BluetoothManager.class).getAdapter();
    private HIDGrpc.HIDBlockingStub mHidBlockingStub;

    @Rule(order = 0)
    public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();
@@ -276,11 +272,6 @@ public class HidHostDualModeTest {
        mAdapter.getProfileProxy(mContext, mProfileServiceListener, BluetoothProfile.HEADSET);
        BluetoothHeadset hfpService =
                (BluetoothHeadset) verifyProfileServiceConnected(BluetoothProfile.HEADSET);
        mHidBlockingStub = mBumble.hidBlocking();
        mHidBlockingStub.registerService(
                ServiceRequest.newBuilder()
                        .setServiceType(HidServiceType.SERVICE_TYPE_BOTH)
                        .build());

        AdvertiseRequest request =
                AdvertiseRequest.newBuilder()
+0 −6
Original line number Diff line number Diff line
@@ -44,10 +44,8 @@ import org.junit.Test;
import org.junit.runner.RunWith;

import pandora.HIDGrpc;
import pandora.HidProto.HidServiceType;
import pandora.HidProto.ProtocolModeEvent;
import pandora.HidProto.ReportEvent;
import pandora.HidProto.ServiceRequest;

import java.time.Duration;
import java.util.Iterator;
@@ -235,10 +233,6 @@ public class HidHostTest {
        mAdapter.getProfileProxy(
                mContext, mBluetoothProfileServiceListener, BluetoothProfile.HEADSET);
        mHidBlockingStub = mBumble.hidBlocking();
        mHidBlockingStub.registerService(
                ServiceRequest.newBuilder()
                        .setServiceType(HidServiceType.SERVICE_TYPE_HID)
                        .build());
        mFutureConnectionIntent = SettableFuture.create();

        mDevice = mBumble.getRemoteDevice();
+3 −1
Original line number Diff line number Diff line
@@ -269,11 +269,13 @@ public class LeAudioServiceDiscoveryTest {
                        BluetoothDevice.EXTRA_UUID,
                        Matchers.allOf(
                                Matchers.hasItemInArray(BluetoothUuid.HFP),
                                Matchers.hasItemInArray(BluetoothUuid.HID),
                                Matchers.hasItemInArray(BluetoothUuid.A2DP_SOURCE),
                                Matchers.hasItemInArray(BluetoothUuid.A2DP_SINK),
                                Matchers.hasItemInArray(BluetoothUuid.AVRCP),
                                Matchers.hasItemInArray(BluetoothUuid.LE_AUDIO),
                                Matchers.hasItemInArray(BluetoothUuid.BATTERY))));
                                Matchers.hasItemInArray(BluetoothUuid.BATTERY),
                                Matchers.hasItemInArray(BluetoothUuid.HOGP))));
        unregisterIntentActions(
                BluetoothDevice.ACTION_UUID,
                BluetoothDevice.ACTION_ACL_CONNECTED,
+0 −11
Original line number Diff line number Diff line
@@ -7,8 +7,6 @@ option java_outer_classname = "HidProto";
import "google/protobuf/empty.proto";

service HID {
  // Register service
  rpc RegisterService(ServiceRequest) returns (google.protobuf.Empty);
  // Connect HID Host
  rpc ConnectHost(google.protobuf.Empty) returns (google.protobuf.Empty);
  // Disconnect HID Host
@@ -41,15 +39,6 @@ enum HidReportId {
  HID_INVALID_RPT_ID = 3;
}

enum HidServiceType {
  SERVICE_TYPE_HID = 0;
  SERVICE_TYPE_HOGP = 1;
  SERVICE_TYPE_BOTH = 2;
}

message ServiceRequest {
  HidServiceType service_type = 1;
}
message SendHostReportRequest {
  bytes address = 1;
  HidReportType report_type = 2;
+14 −32
Original line number Diff line number Diff line
@@ -18,8 +18,6 @@ from pandora_experimental.hid_pb2 import (
    PROTOCOL_REPORT_MODE,
    PROTOCOL_BOOT_MODE,
    PROTOCOL_UNSUPPORTED_MODE,
    SERVICE_TYPE_HID,
    SERVICE_TYPE_HOGP,
)

from bumble.core import (
@@ -704,11 +702,20 @@ def on_virtual_cable_unplug_cb():


hid_protoMode_queue = None
hid_device = None


def register_hid(self) -> None:
# This class implements the Hid Pandora interface.
class HIDService(HIDServicer):

    hid_device = None

    def __init__(self, device: Device) -> None:
        super().__init__()
        self.device = device
        self.device.sdp_service_records.update(sdp_records())
        self.event_queue: Optional[asyncio.Queue[ProtocolModeEvent]] = None
        hogp_device(self.device)
        logging.info(f'Hid device register: ')
        global hid_device
        hid_device = HID_Device(self.device)
        # Register for  call backs
@@ -719,31 +726,6 @@ def register_hid(self) -> None:
        # Register for virtual cable unplug call back
        hid_device.on('virtual_cable_unplug', on_virtual_cable_unplug_cb)


# This class implements the Hid Pandora interface.
class HIDService(HIDServicer):

    def __init__(self, device: Device) -> None:
        super().__init__()
        self.device = device
        self.event_queue: Optional[asyncio.Queue[ProtocolModeEvent]] = None

    @utils.rpc
    async def RegisterService(self, request: empty_pb2.Empty, context: grpc.ServicerContext) -> empty_pb2.Empty:

        if request.service_type == SERVICE_TYPE_HID:
            logging.info(f'Registering HID')
            register_hid(self)
        elif request.service_type == SERVICE_TYPE_HOGP:
            logging.info(f'Registering HOGP')
            hogp_device(self.device)
        else:
            logging.info(f'Registering both HID and HOGP')
            register_hid(self)
            hogp_device(self.device)

        return empty_pb2.Empty()

    @utils.rpc
    async def ConnectHost(self, request: empty_pb2.Empty, context: grpc.ServicerContext) -> empty_pb2.Empty: