Bluetooth: More logging of bluetooth service state

am: 9fa2491850

Change-Id: Idd26922caf3c1a0fb77d2091ac86bfe3a1d1c62a
This commit is contained in:
Marie Janssen
2016-10-19 16:43:09 +00:00
committed by android-build-merger
2 changed files with 12 additions and 7 deletions

View File

@@ -2036,7 +2036,7 @@ public final class BluetoothAdapter {
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;
@@ -2058,7 +2058,7 @@ public final class BluetoothAdapter {
}
public void onBluetoothServiceDown() {
if (VDBG) Log.d(TAG, "onBluetoothServiceDown: " + mService);
if (DBG) Log.d(TAG, "onBluetoothServiceDown: " + mService);
try {
mServiceLock.writeLock().lock();
@@ -2086,7 +2086,7 @@ public final class BluetoothAdapter {
}
public void onBrEdrDown() {
if (VDBG) Log.i(TAG, "on QBrEdrDown: ");
if (DBG) Log.i(TAG, "onBrEdrDown:");
}
};

View File

@@ -203,7 +203,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
} 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
@@ -266,6 +266,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
mContext.registerReceiver(mReceiver, filter);
loadStoredNameAndAddress();
if (isBluetoothPersistedStateOn()) {
if (DBG) Slog.d(TAG, "Startup: Bluetooth persisted state is ON.");
mEnableExternal = true;
}
@@ -292,8 +293,10 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
* 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;
}
/**
@@ -309,6 +312,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
*
*/
private void persistBluetoothSetting(int value) {
if (DBG) Slog.d(TAG, "Persisting Bluetooth Setting: " + value);
Settings.Global.putInt(mContext.getContentResolver(),
Settings.Global.BLUETOOTH_ON,
value);
@@ -1366,7 +1370,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
{
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
@@ -1678,6 +1682,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
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 ||