UI add more log

Bug: 260535339
Bug: 275754566
Test: build pass
Change-Id: I15c26d5b13f93e5a425c16174d6fbc2780c4e0a6
This commit is contained in:
SongFerngWang
2023-03-31 17:31:20 +08:00
parent 785cdf5499
commit 62cc96ac05
6 changed files with 77 additions and 24 deletions

View File

@@ -58,7 +58,7 @@ public abstract class BluetoothDeviceUpdater implements BluetoothCallback,
protected LocalBluetoothManager mLocalManager;
protected int mMetricsCategory;
private static final String TAG = "BluetoothDeviceUpdater";
protected static final String TAG = "BluetoothDeviceUpdater";
private static final boolean DBG = Log.isLoggable(TAG, Log.DEBUG);
@VisibleForTesting
@@ -88,7 +88,7 @@ public abstract class BluetoothDeviceUpdater implements BluetoothCallback,
*/
public void registerCallback() {
if (mLocalManager == null) {
Log.e(TAG, "registerCallback() Bluetooth is not supported on this device");
Log.e(getLogTag(), "registerCallback() Bluetooth is not supported on this device");
return;
}
mLocalManager.setForegroundActivity(mContext);
@@ -102,7 +102,7 @@ public abstract class BluetoothDeviceUpdater implements BluetoothCallback,
*/
public void unregisterCallback() {
if (mLocalManager == null) {
Log.e(TAG, "unregisterCallback() Bluetooth is not supported on this device");
Log.e(getLogTag(), "unregisterCallback() Bluetooth is not supported on this device");
return;
}
mLocalManager.setForegroundActivity(null);
@@ -115,7 +115,7 @@ public abstract class BluetoothDeviceUpdater implements BluetoothCallback,
*/
public void forceUpdate() {
if (mLocalManager == null) {
Log.e(TAG, "forceUpdate() Bluetooth is not supported on this device");
Log.e(getLogTag(), "forceUpdate() Bluetooth is not supported on this device");
return;
}
if (BluetoothAdapter.getDefaultAdapter().isEnabled()) {
@@ -131,7 +131,8 @@ public abstract class BluetoothDeviceUpdater implements BluetoothCallback,
public void removeAllDevicesFromPreference() {
if (mLocalManager == null) {
Log.e(TAG, "removeAllDevicesFromPreference() BT is not supported on this device");
Log.e(getLogTag(),
"removeAllDevicesFromPreference() BT is not supported on this device");
return;
}
final Collection<CachedBluetoothDevice> cachedDevices =
@@ -172,7 +173,7 @@ public abstract class BluetoothDeviceUpdater implements BluetoothCallback,
public void onProfileConnectionStateChanged(CachedBluetoothDevice cachedDevice, int state,
int bluetoothProfile) {
if (DBG) {
Log.d(TAG, "onProfileConnectionStateChanged() device: " + cachedDevice.getName()
Log.d(getLogTag(), "onProfileConnectionStateChanged() device: " + cachedDevice.getName()
+ ", state: " + state + ", bluetoothProfile: " + bluetoothProfile);
}
update(cachedDevice);
@@ -181,7 +182,7 @@ public abstract class BluetoothDeviceUpdater implements BluetoothCallback,
@Override
public void onAclConnectionStateChanged(CachedBluetoothDevice cachedDevice, int state) {
if (DBG) {
Log.d(TAG, "onAclConnectionStateChanged() device: " + cachedDevice.getName()
Log.d(getLogTag(), "onAclConnectionStateChanged() device: " + cachedDevice.getName()
+ ", state: " + state);
}
update(cachedDevice);
@@ -312,8 +313,8 @@ public abstract class BluetoothDeviceUpdater implements BluetoothCallback,
}
final BluetoothDevice device = cachedDevice.getDevice();
if (DBG) {
Log.d(TAG, "isDeviceConnected() device name : " + cachedDevice.getName() +
", is connected : " + device.isConnected() + " , is profile connected : "
Log.d(getLogTag(), "isDeviceConnected() device name : " + cachedDevice.getName()
+ ", is connected : " + device.isConnected() + " , is profile connected : "
+ cachedDevice.isConnected());
}
return device.getBondState() == BluetoothDevice.BOND_BONDED && device.isConnected();
@@ -331,4 +332,7 @@ public abstract class BluetoothDeviceUpdater implements BluetoothCallback,
protected boolean isDeviceInCachedDevicesList(CachedBluetoothDevice cachedDevice){
return mLocalManager.getCachedDeviceManager().getCachedDevicesCopy().contains(cachedDevice);
}
protected String getLogTag() {
return TAG;
}
}