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

Commit 370be0ce authored by Kyunglyul Hyun's avatar Kyunglyul Hyun
Browse files

No crash when remote service dead

Log error instead of throw the exception when
the remote service is dead.

Bug: 280538026
Test: atest BluetoothInstrumentationtests
Change-Id: I1d008d3b045424e94d3c7c83f3c3619123613142
parent afcd758d
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -88,11 +88,9 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable
                                service.registerCallback(mCallback, mAttributionSource, recv);
                                recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null);
                            }
                        } catch (TimeoutException e) {
                        } catch (RemoteException | TimeoutException e) {
                            Log.e(TAG, e.toString() + "\n"
                                    + Log.getStackTraceString(new Throwable()));
                        } catch (RemoteException e) {
                            throw e.rethrowFromSystemServer();
                        }
                    }
                }
+1 −3
Original line number Diff line number Diff line
@@ -91,10 +91,8 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
                                service.registerCallback(mCallback, mAttributionSource, recv);
                                recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null);
                            }
                        } catch (TimeoutException e) {
                        } catch (RemoteException | TimeoutException e) {
                            Log.e(TAG, "Failed to register callback", e);
                        } catch (RemoteException e) {
                            throw e.rethrowFromSystemServer();
                        }
                    }
                }
+6 −5
Original line number Diff line number Diff line
@@ -194,11 +194,12 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi
                                recv.awaitResultNoInterrupt(getSyncTimeout())
                                        .getValue(null);
                            }
                        } catch (TimeoutException e) {
                            Log.e(TAG, "onBluetoothServiceUp: Failed to register "
                                    + "Le Broadcaster callback", e);
                        } catch (RemoteException e) {
                            throw e.rethrowFromSystemServer();
                        } catch (RemoteException | TimeoutException e) {
                            Log.e(
                                    TAG,
                                    "onServiceConnected: Failed to register "
                                            + "Le Broadcaster callback",
                                    e);
                        }
                    }
                }