Add log and turn on debug flag

Add log and turn on debug flag

Bug: 80161203
Test: make -j42 RunSettingsRoboTests
Change-Id: Ibd57f91b83c487ee71adb9e3de7ecfc5ea66bbef
This commit is contained in:
hughchen
2018-06-28 17:25:40 +08:00
committed by Hugh Chen
parent a5f68f9c3c
commit 37dd4f1c71
4 changed files with 14 additions and 2 deletions

View File

@@ -35,7 +35,7 @@ public class AvailableMediaBluetoothDeviceUpdater extends BluetoothDeviceUpdater
implements Preference.OnPreferenceClickListener { implements Preference.OnPreferenceClickListener {
private static final String TAG = "AvailableMediaBluetoothDeviceUpdater"; private static final String TAG = "AvailableMediaBluetoothDeviceUpdater";
private static final boolean DBG = false; private static final boolean DBG = true;
private final AudioManager mAudioManager; private final AudioManager mAudioManager;

View File

@@ -19,6 +19,7 @@ import android.bluetooth.BluetoothDevice;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.os.SystemProperties; import android.os.SystemProperties;
import android.util.Log;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.connecteddevice.DevicePreferenceCallback; import com.android.settings.connecteddevice.DevicePreferenceCallback;
@@ -49,6 +50,7 @@ import androidx.preference.Preference;
public abstract class BluetoothDeviceUpdater implements BluetoothCallback, public abstract class BluetoothDeviceUpdater implements BluetoothCallback,
LocalBluetoothProfileManager.ServiceListener { LocalBluetoothProfileManager.ServiceListener {
private static final String TAG = "BluetoothDeviceUpdater"; private static final String TAG = "BluetoothDeviceUpdater";
private static final boolean DBG = true;
private static final String BLUETOOTH_SHOW_DEVICES_WITHOUT_NAMES_PROPERTY = private static final String BLUETOOTH_SHOW_DEVICES_WITHOUT_NAMES_PROPERTY =
"persist.bluetooth.showdeviceswithoutnames"; "persist.bluetooth.showdeviceswithoutnames";
@@ -250,6 +252,10 @@ public abstract class BluetoothDeviceUpdater implements BluetoothCallback,
return false; return false;
} }
final BluetoothDevice device = cachedDevice.getDevice(); final BluetoothDevice device = cachedDevice.getDevice();
if (DBG) {
Log.d(TAG, "isDeviceConnected() device name : " + cachedDevice.getName() +
", is connected : " + device.isConnected());
}
return device.getBondState() == BluetoothDevice.BOND_BONDED && device.isConnected(); return device.getBondState() == BluetoothDevice.BOND_BONDED && device.isConnected();
} }
} }

View File

@@ -35,7 +35,7 @@ import androidx.preference.Preference;
public class ConnectedBluetoothDeviceUpdater extends BluetoothDeviceUpdater { public class ConnectedBluetoothDeviceUpdater extends BluetoothDeviceUpdater {
private static final String TAG = "ConnBluetoothDeviceUpdater"; private static final String TAG = "ConnBluetoothDeviceUpdater";
private static final boolean DBG = false; private static final boolean DBG = true;
private final AudioManager mAudioManager; private final AudioManager mAudioManager;

View File

@@ -19,6 +19,7 @@ import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothProfile; import android.bluetooth.BluetoothProfile;
import android.content.Context; import android.content.Context;
import android.util.Log;
import com.android.settings.connecteddevice.DevicePreferenceCallback; import com.android.settings.connecteddevice.DevicePreferenceCallback;
import com.android.settings.dashboard.DashboardFragment; import com.android.settings.dashboard.DashboardFragment;
import com.android.settingslib.bluetooth.CachedBluetoothDevice; import com.android.settingslib.bluetooth.CachedBluetoothDevice;
@@ -33,6 +34,7 @@ import androidx.preference.Preference;
public class SavedBluetoothDeviceUpdater extends BluetoothDeviceUpdater public class SavedBluetoothDeviceUpdater extends BluetoothDeviceUpdater
implements Preference.OnPreferenceClickListener { implements Preference.OnPreferenceClickListener {
private static final String TAG = "SavedBluetoothDeviceUpdater"; private static final String TAG = "SavedBluetoothDeviceUpdater";
private static final boolean DBG = true;
public SavedBluetoothDeviceUpdater(Context context, DashboardFragment fragment, public SavedBluetoothDeviceUpdater(Context context, DashboardFragment fragment,
DevicePreferenceCallback devicePreferenceCallback) { DevicePreferenceCallback devicePreferenceCallback) {
@@ -59,6 +61,10 @@ public class SavedBluetoothDeviceUpdater extends BluetoothDeviceUpdater
@Override @Override
public boolean isFilterMatched(CachedBluetoothDevice cachedDevice) { public boolean isFilterMatched(CachedBluetoothDevice cachedDevice) {
final BluetoothDevice device = cachedDevice.getDevice(); final BluetoothDevice device = cachedDevice.getDevice();
if (DBG) {
Log.d(TAG, "isFilterMatched() device name : " + cachedDevice.getName() +
", is connected : " + device.isConnected());
}
return device.getBondState() == BluetoothDevice.BOND_BONDED && !device.isConnected(); return device.getBondState() == BluetoothDevice.BOND_BONDED && !device.isConnected();
} }