Skip to content

Commit 563e414

Browse files
author
Matthew Xie
committed
Reduce android.bluetooth package debug messages
bug 7174712 Change-Id: I8d3fdc8edbe42068b5a550660d7b24854c3c4af4
1 parent d9c9912 commit 563e414

File tree

8 files changed

+80
-69
lines changed

8 files changed

+80
-69
lines changed

core/java/android/bluetooth/BluetoothA2dp.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
public final class BluetoothA2dp implements BluetoothProfile {
4646
private static final String TAG = "BluetoothA2dp";
4747
private static final boolean DBG = true;
48+
private static final boolean VDBG = false;
4849

4950
/**
5051
* Intent used to broadcast the change in connection state of the A2DP
@@ -113,7 +114,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
113114
public void onBluetoothStateChange(boolean up) {
114115
if (DBG) Log.d(TAG, "onBluetoothStateChange: up=" + up);
115116
if (!up) {
116-
if (DBG) Log.d(TAG,"Unbinding service...");
117+
if (VDBG) Log.d(TAG,"Unbinding service...");
117118
synchronized (mConnection) {
118119
try {
119120
mService = null;
@@ -126,7 +127,7 @@ public void onBluetoothStateChange(boolean up) {
126127
synchronized (mConnection) {
127128
try {
128129
if (mService == null) {
129-
if (DBG) Log.d(TAG,"Binding service...");
130+
if (VDBG) Log.d(TAG,"Binding service...");
130131
if (!mContext.bindService(new Intent(IBluetoothA2dp.class.getName()), mConnection, 0)) {
131132
Log.e(TAG, "Could not bind to Bluetooth A2DP Service");
132133
}
@@ -269,7 +270,7 @@ public boolean disconnect(BluetoothDevice device) {
269270
* {@inheritDoc}
270271
*/
271272
public List<BluetoothDevice> getConnectedDevices() {
272-
if (DBG) log("getConnectedDevices()");
273+
if (VDBG) log("getConnectedDevices()");
273274
if (mService != null && isEnabled()) {
274275
try {
275276
return mService.getConnectedDevices();
@@ -286,7 +287,7 @@ public List<BluetoothDevice> getConnectedDevices() {
286287
* {@inheritDoc}
287288
*/
288289
public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
289-
if (DBG) log("getDevicesMatchingStates()");
290+
if (VDBG) log("getDevicesMatchingStates()");
290291
if (mService != null && isEnabled()) {
291292
try {
292293
return mService.getDevicesMatchingConnectionStates(states);
@@ -303,7 +304,7 @@ public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
303304
* {@inheritDoc}
304305
*/
305306
public int getConnectionState(BluetoothDevice device) {
306-
if (DBG) log("getState(" + device + ")");
307+
if (VDBG) log("getState(" + device + ")");
307308
if (mService != null && isEnabled()
308309
&& isValidDevice(device)) {
309310
try {
@@ -365,7 +366,7 @@ && isValidDevice(device)) {
365366
* @hide
366367
*/
367368
public int getPriority(BluetoothDevice device) {
368-
if (DBG) log("getPriority(" + device + ")");
369+
if (VDBG) log("getPriority(" + device + ")");
369370
if (mService != null && isEnabled()
370371
&& isValidDevice(device)) {
371372
try {

core/java/android/bluetooth/BluetoothHeadset.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
public final class BluetoothHeadset implements BluetoothProfile {
4747
private static final String TAG = "BluetoothHeadset";
4848
private static final boolean DBG = true;
49+
private static final boolean VDBG = false;
4950

5051
/**
5152
* Intent used to broadcast the change in connection state of the Headset
@@ -226,7 +227,7 @@ public final class BluetoothHeadset implements BluetoothProfile {
226227
public void onBluetoothStateChange(boolean up) {
227228
if (DBG) Log.d(TAG, "onBluetoothStateChange: up=" + up);
228229
if (!up) {
229-
if (DBG) Log.d(TAG,"Unbinding service...");
230+
if (VDBG) Log.d(TAG,"Unbinding service...");
230231
synchronized (mConnection) {
231232
try {
232233
mService = null;
@@ -239,7 +240,7 @@ public void onBluetoothStateChange(boolean up) {
239240
synchronized (mConnection) {
240241
try {
241242
if (mService == null) {
242-
if (DBG) Log.d(TAG,"Binding service...");
243+
if (VDBG) Log.d(TAG,"Binding service...");
243244
if (!mContext.bindService(new Intent(IBluetoothHeadset.class.getName()), mConnection, 0)) {
244245
Log.e(TAG, "Could not bind to Bluetooth Headset Service");
245246
}
@@ -281,7 +282,7 @@ public void onBluetoothStateChange(boolean up) {
281282
* are ok.
282283
*/
283284
/*package*/ void close() {
284-
if (DBG) log("close()");
285+
if (VDBG) log("close()");
285286

286287
IBluetoothManager mgr = mAdapter.getBluetoothManager();
287288
if (mgr != null) {
@@ -387,7 +388,7 @@ public boolean disconnect(BluetoothDevice device) {
387388
* {@inheritDoc}
388389
*/
389390
public List<BluetoothDevice> getConnectedDevices() {
390-
if (DBG) log("getConnectedDevices()");
391+
if (VDBG) log("getConnectedDevices()");
391392
if (mService != null && isEnabled()) {
392393
try {
393394
return mService.getConnectedDevices();
@@ -404,7 +405,7 @@ public List<BluetoothDevice> getConnectedDevices() {
404405
* {@inheritDoc}
405406
*/
406407
public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
407-
if (DBG) log("getDevicesMatchingStates()");
408+
if (VDBG) log("getDevicesMatchingStates()");
408409
if (mService != null && isEnabled()) {
409410
try {
410411
return mService.getDevicesMatchingConnectionStates(states);
@@ -421,7 +422,7 @@ public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
421422
* {@inheritDoc}
422423
*/
423424
public int getConnectionState(BluetoothDevice device) {
424-
if (DBG) log("getConnectionState(" + device + ")");
425+
if (VDBG) log("getConnectionState(" + device + ")");
425426
if (mService != null && isEnabled() &&
426427
isValidDevice(device)) {
427428
try {
@@ -483,7 +484,7 @@ public boolean setPriority(BluetoothDevice device, int priority) {
483484
* @hide
484485
*/
485486
public int getPriority(BluetoothDevice device) {
486-
if (DBG) log("getPriority(" + device + ")");
487+
if (VDBG) log("getPriority(" + device + ")");
487488
if (mService != null && isEnabled() &&
488489
isValidDevice(device)) {
489490
try {
@@ -566,7 +567,7 @@ public boolean stopVoiceRecognition(BluetoothDevice device) {
566567
* false otherwise or on error
567568
*/
568569
public boolean isAudioConnected(BluetoothDevice device) {
569-
if (DBG) log("isAudioConnected()");
570+
if (VDBG) log("isAudioConnected()");
570571
if (mService != null && isEnabled() &&
571572
isValidDevice(device)) {
572573
try {
@@ -594,7 +595,7 @@ public boolean isAudioConnected(BluetoothDevice device) {
594595
* @hide
595596
*/
596597
public int getBatteryUsageHint(BluetoothDevice device) {
597-
if (DBG) log("getBatteryUsageHint()");
598+
if (VDBG) log("getBatteryUsageHint()");
598599
if (mService != null && isEnabled() &&
599600
isValidDevice(device)) {
600601
try {
@@ -661,7 +662,7 @@ public boolean rejectIncomingConnect(BluetoothDevice device) {
661662
* @hide
662663
*/
663664
public int getAudioState(BluetoothDevice device) {
664-
if (DBG) log("getAudioState");
665+
if (VDBG) log("getAudioState");
665666
if (mService != null && !isDisabled()) {
666667
try {
667668
return mService.getAudioState(device);
@@ -683,7 +684,7 @@ public int getAudioState(BluetoothDevice device) {
683684
* @hide
684685
*/
685686
public boolean isAudioOn() {
686-
if (DBG) log("isAudioOn()");
687+
if (VDBG) log("isAudioOn()");
687688
if (mService != null && isEnabled()) {
688689
try {
689690
return mService.isAudioOn();

core/java/android/bluetooth/BluetoothHealth.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
public final class BluetoothHealth implements BluetoothProfile {
5959
private static final String TAG = "BluetoothHealth";
6060
private static final boolean DBG = true;
61+
private static final boolean VDBG = false;
6162

6263
/**
6364
* Health Profile Source Role - the health device.
@@ -102,7 +103,7 @@ public final class BluetoothHealth implements BluetoothProfile {
102103
public void onBluetoothStateChange(boolean up) {
103104
if (DBG) Log.d(TAG, "onBluetoothStateChange: up=" + up);
104105
if (!up) {
105-
if (DBG) Log.d(TAG,"Unbinding service...");
106+
if (VDBG) Log.d(TAG,"Unbinding service...");
106107
synchronized (mConnection) {
107108
try {
108109
mService = null;
@@ -115,7 +116,7 @@ public void onBluetoothStateChange(boolean up) {
115116
synchronized (mConnection) {
116117
try {
117118
if (mService == null) {
118-
if (DBG) Log.d(TAG,"Binding service...");
119+
if (VDBG) Log.d(TAG,"Binding service...");
119120
if (!mContext.bindService(new Intent(IBluetoothHealth.class.getName()), mConnection, 0)) {
120121
Log.e(TAG, "Could not bind to Bluetooth Health Service");
121122
}
@@ -148,7 +149,7 @@ public boolean registerSinkAppConfiguration(String name, int dataType,
148149
BluetoothHealthCallback callback) {
149150
if (!isEnabled() || name == null) return false;
150151

151-
if (DBG) log("registerSinkApplication(" + name + ":" + dataType + ")");
152+
if (VDBG) log("registerSinkApplication(" + name + ":" + dataType + ")");
152153
return registerAppConfiguration(name, dataType, SINK_ROLE,
153154
CHANNEL_TYPE_ANY, callback);
154155
}
@@ -174,7 +175,7 @@ public boolean registerAppConfiguration(String name, int dataType, int role,
174175
boolean result = false;
175176
if (!isEnabled() || !checkAppParam(name, role, channelType, callback)) return result;
176177

177-
if (DBG) log("registerApplication(" + name + ":" + dataType + ")");
178+
if (VDBG) log("registerApplication(" + name + ":" + dataType + ")");
178179
BluetoothHealthCallbackWrapper wrapper = new BluetoothHealthCallbackWrapper(callback);
179180
BluetoothHealthAppConfiguration config =
180181
new BluetoothHealthAppConfiguration(name, dataType, role, channelType);
@@ -488,7 +489,7 @@ public void onHealthChannelStateChange(BluetoothHealthAppConfiguration config,
488489
}
489490

490491
/*package*/ void close() {
491-
if (DBG) log("close()");
492+
if (VDBG) log("close()");
492493
IBluetoothManager mgr = mAdapter.getBluetoothManager();
493494
if (mgr != null) {
494495
try {

core/java/android/bluetooth/BluetoothInputDevice.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
public final class BluetoothInputDevice implements BluetoothProfile {
4646
private static final String TAG = "BluetoothInputDevice";
4747
private static final boolean DBG = true;
48+
private static final boolean VDBG = false;
4849

4950
/**
5051
* Intent used to broadcast the change in connection state of the Input
@@ -191,7 +192,7 @@ public final class BluetoothInputDevice implements BluetoothProfile {
191192
public void onBluetoothStateChange(boolean up) {
192193
if (DBG) Log.d(TAG, "onBluetoothStateChange: up=" + up);
193194
if (!up) {
194-
if (DBG) Log.d(TAG,"Unbinding service...");
195+
if (VDBG) Log.d(TAG,"Unbinding service...");
195196
synchronized (mConnection) {
196197
try {
197198
mService = null;
@@ -204,7 +205,7 @@ public void onBluetoothStateChange(boolean up) {
204205
synchronized (mConnection) {
205206
try {
206207
if (mService == null) {
207-
if (DBG) Log.d(TAG,"Binding service...");
208+
if (VDBG) Log.d(TAG,"Binding service...");
208209
if (!mContext.bindService(new Intent(IBluetoothInputDevice.class.getName()), mConnection, 0)) {
209210
Log.e(TAG, "Could not bind to Bluetooth HID Service");
210211
}
@@ -243,7 +244,7 @@ public void onBluetoothStateChange(boolean up) {
243244
}
244245

245246
/*package*/ void close() {
246-
if (DBG) log("close()");
247+
if (VDBG) log("close()");
247248
IBluetoothManager mgr = mAdapter.getBluetoothManager();
248249
if (mgr != null) {
249250
try {
@@ -344,7 +345,7 @@ public boolean disconnect(BluetoothDevice device) {
344345
* {@inheritDoc}
345346
*/
346347
public List<BluetoothDevice> getConnectedDevices() {
347-
if (DBG) log("getConnectedDevices()");
348+
if (VDBG) log("getConnectedDevices()");
348349
if (mService != null && isEnabled()) {
349350
try {
350351
return mService.getConnectedDevices();
@@ -361,7 +362,7 @@ public List<BluetoothDevice> getConnectedDevices() {
361362
* {@inheritDoc}
362363
*/
363364
public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
364-
if (DBG) log("getDevicesMatchingStates()");
365+
if (VDBG) log("getDevicesMatchingStates()");
365366
if (mService != null && isEnabled()) {
366367
try {
367368
return mService.getDevicesMatchingConnectionStates(states);
@@ -378,7 +379,7 @@ public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
378379
* {@inheritDoc}
379380
*/
380381
public int getConnectionState(BluetoothDevice device) {
381-
if (DBG) log("getState(" + device + ")");
382+
if (VDBG) log("getState(" + device + ")");
382383
if (mService != null && isEnabled() && isValidDevice(device)) {
383384
try {
384385
return mService.getConnectionState(device);
@@ -438,7 +439,7 @@ public boolean setPriority(BluetoothDevice device, int priority) {
438439
* @hide
439440
*/
440441
public int getPriority(BluetoothDevice device) {
441-
if (DBG) log("getPriority(" + device + ")");
442+
if (VDBG) log("getPriority(" + device + ")");
442443
if (mService != null && isEnabled() && isValidDevice(device)) {
443444
try {
444445
return mService.getPriority(device);
@@ -519,7 +520,7 @@ public boolean virtualUnplug(BluetoothDevice device) {
519520
* @hide
520521
*/
521522
public boolean getProtocolMode(BluetoothDevice device) {
522-
if (DBG) log("getProtocolMode(" + device + ")");
523+
if (VDBG) log("getProtocolMode(" + device + ")");
523524
if (mService != null && isEnabled() && isValidDevice(device)) {
524525
try {
525526
return mService.getProtocolMode(device);
@@ -570,7 +571,7 @@ public boolean setProtocolMode(BluetoothDevice device, int protocolMode) {
570571
* @hide
571572
*/
572573
public boolean getReport(BluetoothDevice device, byte reportType, byte reportId, int bufferSize) {
573-
if (DBG) log("getReport(" + device + "), reportType=" + reportType + " reportId=" + reportId + "bufferSize=" + bufferSize);
574+
if (VDBG) log("getReport(" + device + "), reportType=" + reportType + " reportId=" + reportId + "bufferSize=" + bufferSize);
574575
if (mService != null && isEnabled() && isValidDevice(device)) {
575576
try {
576577
return mService.getReport(device, reportType, reportId, bufferSize);

core/java/android/bluetooth/BluetoothPan.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
public final class BluetoothPan implements BluetoothProfile {
4545
private static final String TAG = "BluetoothPan";
4646
private static final boolean DBG = true;
47+
private static final boolean VDBG = false;
4748

4849
/**
4950
* Intent used to broadcast the change in connection state of the Pan
@@ -145,7 +146,7 @@ public final class BluetoothPan implements BluetoothProfile {
145146
}
146147

147148
/*package*/ void close() {
148-
if (DBG) log("close()");
149+
if (VDBG) log("close()");
149150
if (mConnection != null) {
150151
mContext.unbindService(mConnection);
151152
mConnection = null;
@@ -175,7 +176,7 @@ public void onBluetoothStateChange(boolean on) throws RemoteException {
175176
}
176177
Log.d(TAG, "BluetoothPan(), bindService called");
177178
} else {
178-
if (DBG) Log.d(TAG,"Unbinding service...");
179+
if (VDBG) Log.d(TAG,"Unbinding service...");
179180
synchronized (mConnection) {
180181
try {
181182
mPanService = null;
@@ -266,7 +267,7 @@ public boolean disconnect(BluetoothDevice device) {
266267
* {@inheritDoc}
267268
*/
268269
public List<BluetoothDevice> getConnectedDevices() {
269-
if (DBG) log("getConnectedDevices()");
270+
if (VDBG) log("getConnectedDevices()");
270271
if (mPanService != null && isEnabled()) {
271272
try {
272273
return mPanService.getConnectedDevices();
@@ -283,7 +284,7 @@ public List<BluetoothDevice> getConnectedDevices() {
283284
* {@inheritDoc}
284285
*/
285286
public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
286-
if (DBG) log("getDevicesMatchingStates()");
287+
if (VDBG) log("getDevicesMatchingStates()");
287288
if (mPanService != null && isEnabled()) {
288289
try {
289290
return mPanService.getDevicesMatchingConnectionStates(states);
@@ -300,7 +301,7 @@ public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
300301
* {@inheritDoc}
301302
*/
302303
public int getConnectionState(BluetoothDevice device) {
303-
if (DBG) log("getState(" + device + ")");
304+
if (VDBG) log("getState(" + device + ")");
304305
if (mPanService != null && isEnabled()
305306
&& isValidDevice(device)) {
306307
try {
@@ -324,7 +325,7 @@ public void setBluetoothTethering(boolean value) {
324325
}
325326

326327
public boolean isTetheringOn() {
327-
if (DBG) log("isTetheringOn()");
328+
if (VDBG) log("isTetheringOn()");
328329
try {
329330
return mPanService.isTetheringOn();
330331
} catch (RemoteException e) {

0 commit comments

Comments
 (0)