From b148bc844e5eddb07bef2fd1b4b754716decb43e Mon Sep 17 00:00:00 2001 From: Jaikumar Ganesh Date: Fri, 20 Nov 2009 13:41:07 -0800 Subject: [PATCH] Fix pairings lost on reboot. Bug:2277376 Dr No:Eastham --- .../java/android/server/BluetoothEventLoop.java | 4 ++-- core/java/android/server/BluetoothService.java | 14 +++++++++----- .../.android_server_BluetoothEventLoop.cpp.swp | Bin 16384 -> 0 bytes 3 files changed, 11 insertions(+), 7 deletions(-) delete mode 100644 core/jni/.android_server_BluetoothEventLoop.cpp.swp diff --git a/core/java/android/server/BluetoothEventLoop.java b/core/java/android/server/BluetoothEventLoop.java index c0b9a6843ea17..cb3b6ee0ee011 100644 --- a/core/java/android/server/BluetoothEventLoop.java +++ b/core/java/android/server/BluetoothEventLoop.java @@ -292,9 +292,9 @@ class BluetoothEventLoop { mBluetoothService.setProperty(name, propValues[1]); } else if (name.equals("Pairable") || name.equals("Discoverable")) { String pairable = name.equals("Pairable") ? propValues[1] : - mBluetoothService.getProperty("Pairable"); + mBluetoothService.getPropertyInternal("Pairable"); String discoverable = name.equals("Discoverable") ? propValues[1] : - mBluetoothService.getProperty("Discoverable"); + mBluetoothService.getPropertyInternal("Discoverable"); // This shouldn't happen, unless Adapter Properties are null. if (pairable == null || discoverable == null) diff --git a/core/java/android/server/BluetoothService.java b/core/java/android/server/BluetoothService.java index 809e23034bc1c..db9f34a68c386 100644 --- a/core/java/android/server/BluetoothService.java +++ b/core/java/android/server/BluetoothService.java @@ -531,7 +531,7 @@ public class BluetoothService extends IBluetooth.Stub { return; } String []bonds = null; - String val = getProperty("Devices"); + String val = getPropertyInternal("Devices"); if (val != null) { bonds = val.split(","); } @@ -681,7 +681,6 @@ public class BluetoothService extends IBluetooth.Stub { /*package*/synchronized void getAllProperties() { mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); - if (!isEnabledInternal()) return; mAdapterProperties.clear(); String properties[] = (String [])getAdapterPropertiesNative(); @@ -806,7 +805,12 @@ public class BluetoothService extends IBluetooth.Stub { return true; } - /*package*/ synchronized String getProperty (String name) { + /*package*/ synchronized String getProperty(String name) { + if (!isEnabledInternal()) return null; + return getPropertyInternal(name); + } + + /*package*/ synchronized String getPropertyInternal(String name) { if (!mAdapterProperties.isEmpty()) return mAdapterProperties.get(name); getAllProperties(); @@ -1639,7 +1643,7 @@ public class BluetoothService extends IBluetooth.Stub { } /*package*/ String getAddressFromObjectPath(String objectPath) { - String adapterObjectPath = getProperty("ObjectPath"); + String adapterObjectPath = getPropertyInternal("ObjectPath"); if (adapterObjectPath == null || objectPath == null) { Log.e(TAG, "getAddressFromObjectPath: AdpaterObjectPath:" + adapterObjectPath + " or deviceObjectPath:" + objectPath + " is null"); @@ -1659,7 +1663,7 @@ public class BluetoothService extends IBluetooth.Stub { } /*package*/ String getObjectPathFromAddress(String address) { - String path = getProperty("ObjectPath"); + String path = getPropertyInternal("ObjectPath"); if (path == null) { Log.e(TAG, "Error: Object Path is null"); return null; diff --git a/core/jni/.android_server_BluetoothEventLoop.cpp.swp b/core/jni/.android_server_BluetoothEventLoop.cpp.swp deleted file mode 100644 index d36e403a79a8413ea9aeced90eb669b2bc99e6ff..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16384 zcmeHOUx*|}8Lz1EUvesU2qHd|y$G|z-1Oc_NVwA@bGvi56Zd8>JG&e62b-Rmnwi?` zsp@oB&t@+i;-3c}d=Y}4;F~C-K1J}&phOTv0wFepTIHS9NW3Ww&;PK3qOSaD0G}H($K?*v+-?+?Q+-vgh+_N#BpO zXx=f@JH78mVY#mc<(9;cu9V$?;dkFuc9S@A1KIKeHvHAw{aCTc z?L>Z`?aSy|>^A+Fxv&Xc!ChapBgxxd%%TB{yo*7?l$5Gh9WbFbqzucgFr4SFm01Sv zO$JVokDooWqGMljK1xrW+_^Vtuu)qEECZGS%YbFTGGH073|I#4Q3h1_0QoFpf18Ql zH|P6u=l_`_Fy+mh{Em?iC*H5*Iq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