Bluetooth: More logging of bluetooth service state am: 9fa2491850 am: d8e027b5a4
am: 849174f228
Change-Id: I3049a597bf3182b68167973ab897749833a0dc9d
diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java
index 38788dc..111085d 100644
--- a/core/java/android/bluetooth/BluetoothAdapter.java
+++ b/core/java/android/bluetooth/BluetoothAdapter.java
@@ -2060,7 +2060,7 @@
final private IBluetoothManagerCallback mManagerCallback =
new IBluetoothManagerCallback.Stub() {
public void onBluetoothServiceUp(IBluetooth bluetoothService) {
- if (VDBG) Log.d(TAG, "onBluetoothServiceUp: " + bluetoothService);
+ if (DBG) Log.d(TAG, "onBluetoothServiceUp: " + bluetoothService);
mServiceLock.writeLock().lock();
mService = bluetoothService;
@@ -2082,7 +2082,7 @@
}
public void onBluetoothServiceDown() {
- if (VDBG) Log.d(TAG, "onBluetoothServiceDown: " + mService);
+ if (DBG) Log.d(TAG, "onBluetoothServiceDown: " + mService);
try {
mServiceLock.writeLock().lock();
@@ -2110,7 +2110,7 @@
}
public void onBrEdrDown() {
- if (VDBG) Log.i(TAG, "on QBrEdrDown: ");
+ if (DBG) Log.i(TAG, "onBrEdrDown:");
}
};
diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java
index 3ad71ea..067f932 100644
--- a/services/core/java/com/android/server/BluetoothManagerService.java
+++ b/services/core/java/com/android/server/BluetoothManagerService.java
@@ -208,7 +208,7 @@
} finally {
mBluetoothLock.readLock().unlock();
}
- Slog.d(TAG, "state" + st);
+ Slog.d(TAG, "Airplane Mode change - current state: " + st);
if (isAirplaneModeOn()) {
// Clear registered LE apps to force shut-off
@@ -275,6 +275,7 @@
mContext.registerReceiver(mReceiver, filter);
loadStoredNameAndAddress();
if (isBluetoothPersistedStateOn()) {
+ if (DBG) Slog.d(TAG, "Startup: Bluetooth persisted state is ON.");
mEnableExternal = true;
}
@@ -301,8 +302,10 @@
* Returns true if the Bluetooth saved state is "on"
*/
private final boolean isBluetoothPersistedStateOn() {
- return Settings.Global.getInt(mContentResolver,
- Settings.Global.BLUETOOTH_ON, BLUETOOTH_ON_BLUETOOTH) != BLUETOOTH_OFF;
+ int state = Settings.Global.getInt(mContentResolver,
+ Settings.Global.BLUETOOTH_ON, -1);
+ if (DBG) Slog.d(TAG, "Bluetooth persisted state: " + state);
+ return state != BLUETOOTH_OFF;
}
/**
@@ -318,6 +321,7 @@
*
*/
private void persistBluetoothSetting(int value) {
+ if (DBG) Slog.d(TAG, "Persisting Bluetooth Setting: " + value);
Settings.Global.putInt(mContext.getContentResolver(),
Settings.Global.BLUETOOTH_ON,
value);
@@ -1430,7 +1434,7 @@
{
int prevState = msg.arg1;
int newState = msg.arg2;
- if (DBG) Slog.d(TAG, "MESSAGE_BLUETOOTH_STATE_CHANGE: prevState = " + prevState + ", newState=" + newState);
+ if (DBG) Slog.d(TAG, "MESSAGE_BLUETOOTH_STATE_CHANGE: prevState = " + prevState + ", newState =" + newState);
mState = newState;
bluetoothStateChangeHandler(prevState, newState);
// handle error state transition case from TURNING_ON to OFF
@@ -1742,6 +1746,7 @@
private void bluetoothStateChangeHandler(int prevState, int newState) {
boolean isStandardBroadcast = true;
+ if (DBG) Slog.d(TAG, "bluetoothStateChangeHandler: " + prevState + " -> " + newState);
if (prevState != newState) {
//Notify all proxy objects first of adapter state change
if (newState == BluetoothAdapter.STATE_BLE_ON ||