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

Commit 2b9d8aee authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Add Bluetooth state check as service null isn't sufficient." am: f10c7e00 am: c79ccd20

parents e1f4829f c79ccd20
Loading
Loading
Loading
Loading
+30 −30
Original line number Diff line number Diff line
@@ -1477,7 +1477,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
    })
    public @Nullable String getIdentityAddress() {
        final IBluetooth service = sService;
        if (service == null) {
        if (service == null || !isBluetoothEnabled()) {
            Log.e(TAG, "BT not enabled. Cannot get identity address");
            return null;
        }
@@ -1505,7 +1505,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
        if (DBG) log("getName()");
        final IBluetooth service = sService;
        final String defaultValue = null;
        if (service == null) {
        if (service == null || !isBluetoothEnabled()) {
            Log.e(TAG, "BT not enabled. Cannot get Remote Device name");
            if (DBG) log(Log.getStackTraceString(new Throwable()));
        } else {
@@ -1540,7 +1540,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
        if (DBG) log("getType()");
        final IBluetooth service = sService;
        final int defaultValue = DEVICE_TYPE_UNKNOWN;
        if (service == null) {
        if (service == null || !isBluetoothEnabled()) {
            Log.e(TAG, "BT not enabled. Cannot get Remote Device type");
            if (DBG) log(Log.getStackTraceString(new Throwable()));
        } else {
@@ -1569,7 +1569,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
        if (DBG) log("getAlias()");
        final IBluetooth service = sService;
        final String defaultValue = null;
        if (service == null) {
        if (service == null || !isBluetoothEnabled()) {
            Log.e(TAG, "BT not enabled. Cannot get Remote Device Alias");
            if (DBG) log(Log.getStackTraceString(new Throwable()));
        } else {
@@ -1630,7 +1630,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
        if (DBG) log("setAlias(" + alias + ")");
        final IBluetooth service = sService;
        final int defaultValue = BluetoothStatusCodes.ERROR_BLUETOOTH_NOT_ENABLED;
        if (service == null) {
        if (service == null || !isBluetoothEnabled()) {
            Log.e(TAG, "BT not enabled. Cannot set Remote Device name");
            if (DBG) log(Log.getStackTraceString(new Throwable()));
        } else {
@@ -1664,7 +1664,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
        if (DBG) log("getBatteryLevel()");
        final IBluetooth service = sService;
        final int defaultValue = BATTERY_LEVEL_BLUETOOTH_OFF;
        if (service == null) {
        if (service == null || !isBluetoothEnabled()) {
            Log.e(TAG, "Bluetooth disabled. Cannot get remote device battery level");
            if (DBG) log(Log.getStackTraceString(new Throwable()));
        } else {
@@ -1759,7 +1759,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
        if (DBG) log("createBondOutOfBand()");
        final IBluetooth service = sService;
        final boolean defaultValue = false;
        if (service == null) {
        if (service == null || !isBluetoothEnabled()) {
            Log.w(TAG, "BT not enabled, createBondOutOfBand failed");
            if (DBG) log(Log.getStackTraceString(new Throwable()));
        } else if (NULL_MAC_ADDRESS.equals(mAddress)) {
@@ -1792,7 +1792,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
        if (DBG) log("isBondingInitiatedLocally()");
        final IBluetooth service = sService;
        final boolean defaultValue = false;
        if (service == null) {
        if (service == null || !isBluetoothEnabled()) {
            Log.w(TAG, "BT not enabled, isBondingInitiatedLocally failed");
            if (DBG) log(Log.getStackTraceString(new Throwable()));
        } else {
@@ -1819,7 +1819,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
        if (DBG) log("cancelBondProcess()");
        final IBluetooth service = sService;
        final boolean defaultValue = false;
        if (service == null) {
        if (service == null || !isBluetoothEnabled()) {
            Log.e(TAG, "BT not enabled. Cannot cancel Remote Device bond");
            if (DBG) log(Log.getStackTraceString(new Throwable()));
        } else {
@@ -1852,7 +1852,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
        if (DBG) log("removeBond()");
        final IBluetooth service = sService;
        final boolean defaultValue = false;
        if (service == null) {
        if (service == null || !isBluetoothEnabled()) {
            Log.e(TAG, "BT not enabled. Cannot remove Remote Device bond");
            if (DBG) log(Log.getStackTraceString(new Throwable()));
        } else {
@@ -1959,7 +1959,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
        if (DBG) log("canBondWithoutDialog, device: " + this);
        final IBluetooth service = sService;
        final boolean defaultValue = false;
        if (service == null) {
        if (service == null || !isBluetoothEnabled()) {
            Log.e(TAG, "BT not enabled. Cannot check if we can skip pairing dialog");
            if (DBG) log(Log.getStackTraceString(new Throwable()));
        } else {
@@ -2013,7 +2013,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
        }
        final IBluetooth service = sService;
        final int defaultValue = BluetoothStatusCodes.ERROR_BLUETOOTH_NOT_ENABLED;
        if (service == null) {
        if (service == null || !isBluetoothEnabled()) {
            Log.e(TAG, "BT not enabled. Cannot connect to remote device.");
            if (DBG) log(Log.getStackTraceString(new Throwable()));
        } else {
@@ -2056,7 +2056,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
        }
        final IBluetooth service = sService;
        final int defaultValue = BluetoothStatusCodes.ERROR_BLUETOOTH_NOT_ENABLED;
        if (service == null) {
        if (service == null || !isBluetoothEnabled()) {
            Log.e(TAG, "BT not enabled. Cannot disconnect to remote device.");
            if (DBG) log(Log.getStackTraceString(new Throwable()));
        } else {
@@ -2088,7 +2088,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
        if (DBG) log("isConnected()");
        final IBluetooth service = sService;
        final int defaultValue = CONNECTION_STATE_DISCONNECTED;
        if (service == null) {
        if (service == null || !isBluetoothEnabled()) {
            Log.w(TAG, "Proxy not attached to service");
            if (DBG) log(Log.getStackTraceString(new Throwable()));
        } else {
@@ -2120,7 +2120,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
        if (DBG) log("isEncrypted()");
        final IBluetooth service = sService;
        final int defaultValue = CONNECTION_STATE_DISCONNECTED;
        if (service == null) {
        if (service == null || !isBluetoothEnabled()) {
            Log.w(TAG, "Proxy not attached to service");
            if (DBG) log(Log.getStackTraceString(new Throwable()));
        } else {
@@ -2149,7 +2149,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
        if (DBG) log("getBluetoothClass()");
        final IBluetooth service = sService;
        final int defaultValue = 0;
        if (service == null) {
        if (service == null || !isBluetoothEnabled()) {
            Log.e(TAG, "BT not enabled. Cannot get Bluetooth Class");
            if (DBG) log(Log.getStackTraceString(new Throwable()));
        } else {
@@ -2292,7 +2292,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
        if (DBG) log("sdpSearch()");
        final IBluetooth service = sService;
        final boolean defaultValue = false;
        if (service == null) {
        if (service == null || !isBluetoothEnabled()) {
            Log.e(TAG, "BT not enabled. Cannot query remote device sdp records");
            if (DBG) log(Log.getStackTraceString(new Throwable()));
        } else {
@@ -2319,7 +2319,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
        if (DBG) log("setPin()");
        final IBluetooth service = sService;
        final boolean defaultValue = false;
        if (service == null) {
        if (service == null || !isBluetoothEnabled()) {
            Log.e(TAG, "BT not enabled. Cannot set Remote Device pin");
            if (DBG) log(Log.getStackTraceString(new Throwable()));
        } else {
@@ -2365,7 +2365,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
        if (DBG) log("setPairingConfirmation()");
        final IBluetooth service = sService;
        final boolean defaultValue = false;
        if (service == null) {
        if (service == null || !isBluetoothEnabled()) {
            Log.e(TAG, "BT not enabled. Cannot set pairing confirmation");
            if (DBG) log(Log.getStackTraceString(new Throwable()));
        } else {
@@ -2404,7 +2404,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
        if (DBG) log("getPhonebookAccessPermission()");
        final IBluetooth service = sService;
        final int defaultValue = ACCESS_UNKNOWN;
        if (service == null) {
        if (service == null || !isBluetoothEnabled()) {
            Log.w(TAG, "Proxy not attached to service");
            if (DBG) log(Log.getStackTraceString(new Throwable()));
        } else {
@@ -2451,7 +2451,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
        if (DBG) log("setSilenceMode()");
        final IBluetooth service = sService;
        final boolean defaultValue = false;
        if (service == null) {
        if (service == null || !isBluetoothEnabled()) {
            throw new IllegalStateException("Bluetooth is not turned ON");
        } else {
            try {
@@ -2481,7 +2481,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
        if (DBG) log("isInSilenceMode()");
        final IBluetooth service = sService;
        final boolean defaultValue = false;
        if (service == null) {
        if (service == null || !isBluetoothEnabled()) {
            throw new IllegalStateException("Bluetooth is not turned ON");
        } else {
            try {
@@ -2512,7 +2512,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
        if (DBG) log("setPhonebookAccessPermission()");
        final IBluetooth service = sService;
        final boolean defaultValue = false;
        if (service == null) {
        if (service == null || !isBluetoothEnabled()) {
            Log.w(TAG, "Proxy not attached to service");
            if (DBG) log(Log.getStackTraceString(new Throwable()));
        } else {
@@ -2541,7 +2541,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
        if (DBG) log("getMessageAccessPermission()");
        final IBluetooth service = sService;
        final int defaultValue = ACCESS_UNKNOWN;
        if (service == null) {
        if (service == null || !isBluetoothEnabled()) {
            Log.w(TAG, "Proxy not attached to service");
            if (DBG) log(Log.getStackTraceString(new Throwable()));
        } else {
@@ -2578,7 +2578,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
        if (DBG) log("setMessageAccessPermission()");
        final IBluetooth service = sService;
        final boolean defaultValue = false;
        if (service == null) {
        if (service == null || !isBluetoothEnabled()) {
            Log.w(TAG, "Proxy not attached to service");
            if (DBG) log(Log.getStackTraceString(new Throwable()));
        } else {
@@ -2607,7 +2607,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
        if (DBG) log("getSimAccessPermission()");
        final IBluetooth service = sService;
        final int defaultValue = ACCESS_UNKNOWN;
        if (service == null) {
        if (service == null || !isBluetoothEnabled()) {
            Log.w(TAG, "Proxy not attached to service");
            if (DBG) log(Log.getStackTraceString(new Throwable()));
        } else {
@@ -2640,7 +2640,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
        if (DBG) log("setSimAccessPermission()");
        final IBluetooth service = sService;
        final boolean defaultValue = false;
        if (service == null) {
        if (service == null || !isBluetoothEnabled()) {
            Log.w(TAG, "Proxy not attached to service");
            if (DBG) log(Log.getStackTraceString(new Throwable()));
        } else {
@@ -3151,7 +3151,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
        if (DBG) log("setMetadata()");
        final IBluetooth service = sService;
        final boolean defaultValue = false;
        if (service == null) {
        if (service == null || !isBluetoothEnabled()) {
            Log.e(TAG, "Bluetooth is not enabled. Cannot set metadata");
            if (DBG) log(Log.getStackTraceString(new Throwable()));
        } else if (value.length > METADATA_MAX_LENGTH) {
@@ -3186,7 +3186,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
        if (DBG) log("getMetadata()");
        final IBluetooth service = sService;
        final byte[] defaultValue = null;
        if (service == null) {
        if (service == null || !isBluetoothEnabled()) {
            Log.e(TAG, "Bluetooth is not enabled. Cannot get metadata");
            if (DBG) log(Log.getStackTraceString(new Throwable()));
        } else {
@@ -3229,7 +3229,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
        if (DBG) log("setLowLatencyAudioAllowed(" + allowed + ")");
        final IBluetooth service = sService;
        final boolean defaultValue = false;
        if (service == null) {
        if (service == null || !isBluetoothEnabled()) {
            Log.e(TAG, "Bluetooth is not enabled. Cannot allow low latency");
            if (DBG) log(Log.getStackTraceString(new Throwable()));
        } else {