Loading core/java/android/server/BluetoothA2dpService.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -194,7 +194,7 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub { } } private synchronized void onBluetoothEnable() { private synchronized void onBluetoothEnable() { String devices = mBluetoothService.getProperty("Devices"); String devices = mBluetoothService.getProperty("Devices", true); if (devices != null) { if (devices != null) { String [] paths = devices.split(","); String [] paths = devices.split(","); for (String path: paths) { for (String path: paths) { Loading core/java/android/server/BluetoothService.java +20 −11 Original line number Original line Diff line number Diff line Loading @@ -798,8 +798,15 @@ public class BluetoothService extends IBluetooth.Stub { return true; return true; } } /*package*/ synchronized String getProperty(String name) { /*package*/ synchronized String getProperty(String name, boolean checkState) { // If checkState is false, check if the event loop is running. // before making the call to Bluez if (checkState) { if (!isEnabledInternal()) return null; if (!isEnabledInternal()) return null; } else if (!mEventLoop.isEventLoopRunning()) { return null; } return mAdapterProperties.getProperty(name); return mAdapterProperties.getProperty(name); } } Loading @@ -825,17 +832,19 @@ public class BluetoothService extends IBluetooth.Stub { public synchronized String getAddress() { public synchronized String getAddress() { mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); return getProperty("Address"); // Don't check state since we want to provide address, even if BT is off return getProperty("Address", false); } } public synchronized String getName() { public synchronized String getName() { mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); return getProperty("Name"); // Don't check state since we want to provide name, even if BT is off return getProperty("Name", false); } } public synchronized ParcelUuid[] getUuids() { public synchronized ParcelUuid[] getUuids() { mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); String value = getProperty("UUIDs"); String value = getProperty("UUIDs", true); if (value == null) return null; if (value == null) return null; return convertStringToParcelUuid(value); return convertStringToParcelUuid(value); } } Loading Loading @@ -915,7 +924,7 @@ public class BluetoothService extends IBluetooth.Stub { */ */ public synchronized int getDiscoverableTimeout() { public synchronized int getDiscoverableTimeout() { mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); String timeout = getProperty("DiscoverableTimeout"); String timeout = getProperty("DiscoverableTimeout", true); if (timeout != null) if (timeout != null) return Integer.valueOf(timeout); return Integer.valueOf(timeout); else else Loading @@ -927,8 +936,8 @@ public class BluetoothService extends IBluetooth.Stub { if (!isEnabledInternal()) if (!isEnabledInternal()) return BluetoothAdapter.SCAN_MODE_NONE; return BluetoothAdapter.SCAN_MODE_NONE; boolean pairable = getProperty("Pairable").equals("true"); boolean pairable = getProperty("Pairable", true).equals("true"); boolean discoverable = getProperty("Discoverable").equals("true"); boolean discoverable = getProperty("Discoverable", true).equals("true"); return bluezStringToScanMode (pairable, discoverable); return bluezStringToScanMode (pairable, discoverable); } } Loading @@ -951,7 +960,7 @@ public class BluetoothService extends IBluetooth.Stub { public synchronized boolean isDiscovering() { public synchronized boolean isDiscovering() { mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); String discoveringProperty = mAdapterProperties.getProperty("Discovering"); String discoveringProperty = getProperty("Discovering", false); if (discoveringProperty == null) { if (discoveringProperty == null) { return false; return false; } } Loading Loading @@ -2341,7 +2350,7 @@ public class BluetoothService extends IBluetooth.Stub { synchronized String[] getKnownDevices() { synchronized String[] getKnownDevices() { String[] bonds = null; String[] bonds = null; String val = getProperty("Devices"); String val = getProperty("Devices", true); if (val != null) { if (val != null) { bonds = val.split(","); bonds = val.split(","); } } Loading @@ -2350,7 +2359,7 @@ public class BluetoothService extends IBluetooth.Stub { private void initProfileState() { private void initProfileState() { String[] bonds = null; String[] bonds = null; String val = mAdapterProperties.getProperty("Devices"); String val = getProperty("Devices", false); if (val != null) { if (val != null) { bonds = val.split(","); bonds = val.split(","); } } Loading Loading
core/java/android/server/BluetoothA2dpService.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -194,7 +194,7 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub { } } private synchronized void onBluetoothEnable() { private synchronized void onBluetoothEnable() { String devices = mBluetoothService.getProperty("Devices"); String devices = mBluetoothService.getProperty("Devices", true); if (devices != null) { if (devices != null) { String [] paths = devices.split(","); String [] paths = devices.split(","); for (String path: paths) { for (String path: paths) { Loading
core/java/android/server/BluetoothService.java +20 −11 Original line number Original line Diff line number Diff line Loading @@ -798,8 +798,15 @@ public class BluetoothService extends IBluetooth.Stub { return true; return true; } } /*package*/ synchronized String getProperty(String name) { /*package*/ synchronized String getProperty(String name, boolean checkState) { // If checkState is false, check if the event loop is running. // before making the call to Bluez if (checkState) { if (!isEnabledInternal()) return null; if (!isEnabledInternal()) return null; } else if (!mEventLoop.isEventLoopRunning()) { return null; } return mAdapterProperties.getProperty(name); return mAdapterProperties.getProperty(name); } } Loading @@ -825,17 +832,19 @@ public class BluetoothService extends IBluetooth.Stub { public synchronized String getAddress() { public synchronized String getAddress() { mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); return getProperty("Address"); // Don't check state since we want to provide address, even if BT is off return getProperty("Address", false); } } public synchronized String getName() { public synchronized String getName() { mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); return getProperty("Name"); // Don't check state since we want to provide name, even if BT is off return getProperty("Name", false); } } public synchronized ParcelUuid[] getUuids() { public synchronized ParcelUuid[] getUuids() { mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); String value = getProperty("UUIDs"); String value = getProperty("UUIDs", true); if (value == null) return null; if (value == null) return null; return convertStringToParcelUuid(value); return convertStringToParcelUuid(value); } } Loading Loading @@ -915,7 +924,7 @@ public class BluetoothService extends IBluetooth.Stub { */ */ public synchronized int getDiscoverableTimeout() { public synchronized int getDiscoverableTimeout() { mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); String timeout = getProperty("DiscoverableTimeout"); String timeout = getProperty("DiscoverableTimeout", true); if (timeout != null) if (timeout != null) return Integer.valueOf(timeout); return Integer.valueOf(timeout); else else Loading @@ -927,8 +936,8 @@ public class BluetoothService extends IBluetooth.Stub { if (!isEnabledInternal()) if (!isEnabledInternal()) return BluetoothAdapter.SCAN_MODE_NONE; return BluetoothAdapter.SCAN_MODE_NONE; boolean pairable = getProperty("Pairable").equals("true"); boolean pairable = getProperty("Pairable", true).equals("true"); boolean discoverable = getProperty("Discoverable").equals("true"); boolean discoverable = getProperty("Discoverable", true).equals("true"); return bluezStringToScanMode (pairable, discoverable); return bluezStringToScanMode (pairable, discoverable); } } Loading @@ -951,7 +960,7 @@ public class BluetoothService extends IBluetooth.Stub { public synchronized boolean isDiscovering() { public synchronized boolean isDiscovering() { mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); String discoveringProperty = mAdapterProperties.getProperty("Discovering"); String discoveringProperty = getProperty("Discovering", false); if (discoveringProperty == null) { if (discoveringProperty == null) { return false; return false; } } Loading Loading @@ -2341,7 +2350,7 @@ public class BluetoothService extends IBluetooth.Stub { synchronized String[] getKnownDevices() { synchronized String[] getKnownDevices() { String[] bonds = null; String[] bonds = null; String val = getProperty("Devices"); String val = getProperty("Devices", true); if (val != null) { if (val != null) { bonds = val.split(","); bonds = val.split(","); } } Loading @@ -2350,7 +2359,7 @@ public class BluetoothService extends IBluetooth.Stub { private void initProfileState() { private void initProfileState() { String[] bonds = null; String[] bonds = null; String val = mAdapterProperties.getProperty("Devices"); String val = getProperty("Devices", false); if (val != null) { if (val != null) { bonds = val.split(","); bonds = val.split(","); } } Loading