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

Commit bb4870d1 authored by Thomas Girardier's avatar Thomas Girardier
Browse files

[Pandora] Change has<Field> to get<Field>Case

Internal branches only support protobuf v3.9.1 which does not
provide has<Field> helper functions.

Test: atest pts-bot
Change-Id: Ide921eba99f8c6caeaf7c8d2973bd8239336997c
parent a497114a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -90,14 +90,14 @@ class Security(private val context: Context) : SecurityImplBase() {
      var reached =
        when (transport) {
          TRANSPORT_LE -> {
            check(request.hasLe())
            check(request.getLevelCase() == SecureRequest.LevelCase.LE);
            val level = request.le
            if (level == LE_LEVEL1) true
            if (level == LE_LEVEL4) throw Status.UNKNOWN.asException()
            false
          }
          TRANSPORT_BREDR -> {
            check(request.hasClassic())
            check(request.getLevelCase() == SecureRequest.LevelCase.CLASSIC)
            val level = request.classic
            if (level == LEVEL0) true
            if (level >= LEVEL3) throw Status.UNKNOWN.asException()
+2 −2
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ class SecurityStorage(private val context: Context) : SecurityStorageImplBase()

  override fun isBonded(request: IsBondedRequest, responseObserver: StreamObserver<BoolValue>) {
    grpcUnary(globalScope, responseObserver) {
      check(request.hasPublic())
      check(request.getAddressCase() == IsBondedRequest.AddressCase.PUBLIC)
      val bluetoothDevice = request.public.toBluetoothDevice(bluetoothAdapter)
      Log.i(TAG, "isBonded: $bluetoothDevice")
      val isBonded = bluetoothDevice.getBondState() == BluetoothDevice.BOND_BONDED
@@ -75,7 +75,7 @@ class SecurityStorage(private val context: Context) : SecurityStorageImplBase()

  override fun deleteBond(request: DeleteBondRequest, responseObserver: StreamObserver<Empty>) {
    grpcUnary(globalScope, responseObserver) {
      check(request.hasPublic())
      check(request.getAddressCase() == DeleteBondRequest.AddressCase.PUBLIC)
      val bluetoothDevice = request.public.toBluetoothDevice(bluetoothAdapter)
      Log.i(TAG, "deleteBond: device=$bluetoothDevice")