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

Commit 0f0b94bc authored by Josh Wu's avatar Josh Wu
Browse files

[Pandora] Return RemoteNotFound when device name is null

BluetoothDevice::getName() returns null when there is no record cached,
but setting a null value in proto raises errors, so we should simply
returns not found.

Bug: 259449713
Test: atest -v avatar
Change-Id: Ia409b61491f4f13982a07db9c11667aabb246bb1
parent b8197244
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -687,7 +687,12 @@ class Host(private val context: Context, private val server: Server) : HostImplB
        } else {
          request.address.toBluetoothDevice(bluetoothAdapter)
        }
      GetRemoteNameResponse.newBuilder().setName(device.name).build()
      val deviceName = device.name
      if (deviceName == null) {
        GetRemoteNameResponse.newBuilder().setRemoteNotFound(Empty.getDefaultInstance()).build()
      } else{
        GetRemoteNameResponse.newBuilder().setName(deviceName).build()
      }
    }
  }
}