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

Commit f383021e authored by William Escande's avatar William Escande
Browse files

BluetoothAdapter: App exception aren't from SystemServer

Calling into IBluetooth will call the AdapterService from Bluetooth
app that does not live in the systemServer.
Therefore, exception should be rethrown as runtimeException

Bug: 298264617
Test: atest CtsBluetoothTestCases | Cts does not handled failure in the
      binder nor any of the Test framework we currently have
Change-Id: Ia6b9d8cdd2f37036a6fc985e4b7ed37067eeb528
parent 12013934
Loading
Loading
Loading
Loading
+17 −17
Original line number Original line Diff line number Diff line
@@ -1902,7 +1902,7 @@ public final class BluetoothAdapter {
        } catch (TimeoutException e) {
        } catch (TimeoutException e) {
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
            throw e.rethrowAsRuntimeException();
        } finally {
        } finally {
            mServiceLock.readLock().unlock();
            mServiceLock.readLock().unlock();
        }
        }
@@ -1952,7 +1952,7 @@ public final class BluetoothAdapter {
        } catch (TimeoutException e) {
        } catch (TimeoutException e) {
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
            throw e.rethrowAsRuntimeException();
        } finally {
        } finally {
            mServiceLock.readLock().unlock();
            mServiceLock.readLock().unlock();
        }
        }
@@ -1981,7 +1981,7 @@ public final class BluetoothAdapter {
        } catch (TimeoutException e) {
        } catch (TimeoutException e) {
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
            throw e.rethrowAsRuntimeException();
        } finally {
        } finally {
            mServiceLock.readLock().unlock();
            mServiceLock.readLock().unlock();
        }
        }
@@ -2028,7 +2028,7 @@ public final class BluetoothAdapter {
        } catch (TimeoutException e) {
        } catch (TimeoutException e) {
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
            throw e.rethrowAsRuntimeException();
        } finally {
        } finally {
            mServiceLock.readLock().unlock();
            mServiceLock.readLock().unlock();
        }
        }
@@ -2620,7 +2620,7 @@ public final class BluetoothAdapter {
        } catch (TimeoutException e) {
        } catch (TimeoutException e) {
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            e.rethrowFromSystemServer();
            throw e.rethrowAsRuntimeException();
        } finally {
        } finally {
            mServiceLock.readLock().unlock();
            mServiceLock.readLock().unlock();
        }
        }
@@ -2654,7 +2654,7 @@ public final class BluetoothAdapter {
        } catch (TimeoutException e) {
        } catch (TimeoutException e) {
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            e.rethrowFromSystemServer();
            throw e.rethrowAsRuntimeException();
        } finally {
        } finally {
            mServiceLock.readLock().unlock();
            mServiceLock.readLock().unlock();
        }
        }
@@ -2689,7 +2689,7 @@ public final class BluetoothAdapter {
        } catch (TimeoutException e) {
        } catch (TimeoutException e) {
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            e.rethrowFromSystemServer();
            throw e.rethrowAsRuntimeException();
        } finally {
        } finally {
            mServiceLock.readLock().unlock();
            mServiceLock.readLock().unlock();
        }
        }
@@ -2727,7 +2727,7 @@ public final class BluetoothAdapter {
        } catch (TimeoutException e) {
        } catch (TimeoutException e) {
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            e.rethrowFromSystemServer();
            throw e.rethrowAsRuntimeException();
        } finally {
        } finally {
            mServiceLock.readLock().unlock();
            mServiceLock.readLock().unlock();
        }
        }
@@ -4252,14 +4252,14 @@ public final class BluetoothAdapter {
                try {
                try {
                    sService = mManagerService.registerAdapter(sManagerCallback);
                    sService = mManagerService.registerAdapter(sManagerCallback);
                } catch (RemoteException e) {
                } catch (RemoteException e) {
                    throw e.rethrowFromSystemServer();
                    throw e.rethrowAsRuntimeException();
                }
                }
            } else {
            } else {
                try {
                try {
                    mManagerService.unregisterAdapter(sManagerCallback);
                    mManagerService.unregisterAdapter(sManagerCallback);
                    sService = null;
                    sService = null;
                } catch (RemoteException e) {
                } catch (RemoteException e) {
                    throw e.rethrowFromSystemServer();
                    throw e.rethrowAsRuntimeException();
                }
                }
            }
            }
            sServiceRegistered = wantRegistered;
            sServiceRegistered = wantRegistered;
@@ -5058,7 +5058,7 @@ public final class BluetoothAdapter {
            }
            }
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
            throw e.rethrowFromSystemServer();
            throw e.rethrowAsRuntimeException();
        } catch (TimeoutException e) {
        } catch (TimeoutException e) {
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
        } finally {
        } finally {
@@ -5123,7 +5123,7 @@ public final class BluetoothAdapter {
            }
            }
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
            throw e.rethrowFromSystemServer();
            throw e.rethrowAsRuntimeException();
        } catch (TimeoutException e) {
        } catch (TimeoutException e) {
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
        } finally {
        } finally {
@@ -5186,7 +5186,7 @@ public final class BluetoothAdapter {
            }
            }
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
            throw e.rethrowFromSystemServer();
            throw e.rethrowAsRuntimeException();
        } catch (TimeoutException e) {
        } catch (TimeoutException e) {
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
        } finally {
        } finally {
@@ -5271,7 +5271,7 @@ public final class BluetoothAdapter {
                                .getValue(defaultValue);
                                .getValue(defaultValue);
                    }
                    }
                } catch (RemoteException e) {
                } catch (RemoteException e) {
                    throw e.rethrowFromSystemServer();
                    throw e.rethrowAsRuntimeException();
                } catch (TimeoutException e) {
                } catch (TimeoutException e) {
                    Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
                    Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
                } finally {
                } finally {
@@ -5352,7 +5352,7 @@ public final class BluetoothAdapter {
        } catch (TimeoutException e) {
        } catch (TimeoutException e) {
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
            throw e.rethrowAsRuntimeException();
        } finally {
        } finally {
            mServiceLock.readLock().unlock();
            mServiceLock.readLock().unlock();
        }
        }
@@ -5470,7 +5470,7 @@ public final class BluetoothAdapter {
                                .getValue(defaultValue);
                                .getValue(defaultValue);
                    }
                    }
                } catch (RemoteException e) {
                } catch (RemoteException e) {
                    throw e.rethrowFromSystemServer();
                    throw e.rethrowAsRuntimeException();
                } catch (TimeoutException e) {
                } catch (TimeoutException e) {
                    Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
                    Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
                } finally {
                } finally {
@@ -5550,7 +5550,7 @@ public final class BluetoothAdapter {
        } catch (TimeoutException e) {
        } catch (TimeoutException e) {
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
            throw e.rethrowAsRuntimeException();
        } finally {
        } finally {
            mServiceLock.readLock().unlock();
            mServiceLock.readLock().unlock();
        }
        }