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

Commit 64581a64 authored by William Escande's avatar William Escande
Browse files

BluetoothAdapter: throw when system server is dead

Calling the manager service must never failed as the manager service
cannot be turned off.
If a remote exception occurs that mean the whole system is dead and we
have to rethrow the exception

Test: m .
Bug: 311772251
Flag: Exempt refactor
Change-Id: I3ab9d5f06c05f26afbc5ad94aaef2db0aa3a8126
parent c6eabcd4
Loading
Loading
Loading
Loading
+11 −23
Original line number Diff line number Diff line
@@ -1403,9 +1403,8 @@ public final class BluetoothAdapter {
        try {
            return mManagerService.disableBle(mAttributionSource, mToken);
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
            throw e.rethrowFromSystemServer();
        }
        return false;
    }

    /**
@@ -1447,10 +1446,8 @@ public final class BluetoothAdapter {
        try {
            return mManagerService.enableBle(mAttributionSource, mToken);
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
            throw e.rethrowFromSystemServer();
        }

        return false;
    }

    /**
@@ -1686,9 +1683,8 @@ public final class BluetoothAdapter {
        try {
            return mManagerService.enable(mAttributionSource);
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
            throw e.rethrowFromSystemServer();
        }
        return false;
    }

    /**
@@ -1751,9 +1747,8 @@ public final class BluetoothAdapter {
        try {
            return mManagerService.disable(mAttributionSource, persist);
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
            throw e.rethrowFromSystemServer();
        }
        return false;
    }

    /**
@@ -1770,9 +1765,8 @@ public final class BluetoothAdapter {
        try {
            return mManagerService.getAddress(mAttributionSource);
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
            throw e.rethrowFromSystemServer();
        }
        return null;
    }

    /**
@@ -1789,9 +1783,8 @@ public final class BluetoothAdapter {
        try {
            return mManagerService.getName(mAttributionSource);
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
            throw e.rethrowFromSystemServer();
        }
        return null;
    }

    /** @hide */
@@ -2396,8 +2389,7 @@ public final class BluetoothAdapter {
        try {
            return mManagerService.isBleScanAvailable();
        } catch (RemoteException e) {
            Log.e(TAG, "remote exception when calling isBleScanAvailable", e);
            return false;
            throw e.rethrowFromSystemServer();
        }
    }

@@ -2744,8 +2736,7 @@ public final class BluetoothAdapter {
        try {
            return mManagerService.isHearingAidProfileSupported();
        } catch (RemoteException e) {
            Log.e(TAG, "remote exception when calling isHearingAidProfileSupported", e);
            return false;
            throw e.rethrowFromSystemServer();
        }
    }

@@ -3924,9 +3915,8 @@ public final class BluetoothAdapter {
        try {
            return mManagerService.enableNoAutoConnect(mAttributionSource);
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
            throw e.rethrowFromSystemServer();
        }
        return false;
    }

    /** @hide */
@@ -5375,9 +5365,8 @@ public final class BluetoothAdapter {
        try {
            return mManagerService.setBtHciSnoopLogMode(mode);
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
            throw e.rethrowFromSystemServer();
        }
        return BluetoothStatusCodes.ERROR_UNKNOWN;
    }

    /**
@@ -5393,9 +5382,8 @@ public final class BluetoothAdapter {
        try {
            return mManagerService.getBtHciSnoopLogMode();
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
            throw e.rethrowFromSystemServer();
        }
        return BT_SNOOP_LOG_MODE_DISABLED;
    }

    /**