Reworked a few logs
This commit is contained in:
parent
e11780075a
commit
c4e9fc742b
2 changed files with 27 additions and 27 deletions
|
@ -67,14 +67,14 @@ public class BluetoothManager extends BroadcastReceiver {
|
|||
public BluetoothManager() {
|
||||
isBluetoothConnected = false;
|
||||
if (!ensureInit()) {
|
||||
Log.w("BluetoothManager tried to init but LinphoneService not ready yet...");
|
||||
Log.w("[Bluetooth] Manager tried to init but LinphoneService not ready yet...");
|
||||
}
|
||||
instance = this;
|
||||
}
|
||||
|
||||
public void initBluetooth() {
|
||||
if (!ensureInit()) {
|
||||
Log.w("BluetoothManager tried to init bluetooth but LinphoneService not ready yet...");
|
||||
Log.w("[Bluetooth] Manager tried to init bluetooth but LinphoneService not ready yet...");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -84,14 +84,14 @@ public class BluetoothManager extends BroadcastReceiver {
|
|||
filter.addAction(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED);
|
||||
filter.addAction(BluetoothHeadset.ACTION_VENDOR_SPECIFIC_HEADSET_EVENT);
|
||||
mContext.registerReceiver(this, filter);
|
||||
Log.d("Bluetooth receiver started");
|
||||
Log.d("[Bluetooth] Receiver started");
|
||||
|
||||
startBluetooth();
|
||||
}
|
||||
|
||||
private void startBluetooth() {
|
||||
if (isBluetoothConnected) {
|
||||
Log.e("Bluetooth already started");
|
||||
Log.e("[Bluetooth] Already started, skipping...");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -99,14 +99,14 @@ public class BluetoothManager extends BroadcastReceiver {
|
|||
|
||||
if (mBluetoothAdapter != null && mBluetoothAdapter.isEnabled()) {
|
||||
if (mProfileListener != null) {
|
||||
Log.w("Bluetooth headset profile was already opened, let's close it");
|
||||
Log.w("[Bluetooth] Headset profile was already opened, let's close it");
|
||||
mBluetoothAdapter.closeProfileProxy(BluetoothProfile.HEADSET, mBluetoothHeadset);
|
||||
}
|
||||
|
||||
mProfileListener = new BluetoothProfile.ServiceListener() {
|
||||
public void onServiceConnected(int profile, BluetoothProfile proxy) {
|
||||
if (profile == BluetoothProfile.HEADSET) {
|
||||
Log.d("Bluetooth headset connected");
|
||||
Log.d("[Bluetooth] Headset connected");
|
||||
mBluetoothHeadset = (BluetoothHeadset) proxy;
|
||||
isBluetoothConnected = true;
|
||||
}
|
||||
|
@ -115,17 +115,17 @@ public class BluetoothManager extends BroadcastReceiver {
|
|||
if (profile == BluetoothProfile.HEADSET) {
|
||||
mBluetoothHeadset = null;
|
||||
isBluetoothConnected = false;
|
||||
Log.d("Bluetooth headset disconnected");
|
||||
Log.d("[Bluetooth] Headset disconnected");
|
||||
LinphoneManager.getInstance().routeAudioToReceiver();
|
||||
}
|
||||
}
|
||||
};
|
||||
boolean success = mBluetoothAdapter.getProfileProxy(mContext, mProfileListener, BluetoothProfile.HEADSET);
|
||||
if (!success) {
|
||||
Log.e("Bluetooth getProfileProxy failed !");
|
||||
Log.e("[Bluetooth] getProfileProxy failed !");
|
||||
}
|
||||
} else {
|
||||
Log.w("Bluetooth interface disabled on device");
|
||||
Log.w("[Bluetooth] Interface disabled on device");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ public class BluetoothManager extends BroadcastReceiver {
|
|||
if (mBluetoothAdapter != null && mBluetoothAdapter.isEnabled() && mAudioManager != null && mAudioManager.isBluetoothScoAvailableOffCall()) {
|
||||
if (isBluetoothHeadsetAvailable()) {
|
||||
if (mAudioManager != null && !mAudioManager.isBluetoothScoOn()) {
|
||||
Log.d("Bluetooth sco off, let's start it");
|
||||
Log.d("[Bluetooth] SCO off, let's start it");
|
||||
mAudioManager.setBluetoothScoOn(true);
|
||||
mAudioManager.startBluetoothSco();
|
||||
}
|
||||
|
@ -179,12 +179,12 @@ public class BluetoothManager extends BroadcastReceiver {
|
|||
}
|
||||
if (ok) {
|
||||
if (retries > 0) {
|
||||
Log.d("Bluetooth route ok after " + retries + " retries");
|
||||
Log.d("[Bluetooth] Audio route ok after " + retries + " retries");
|
||||
} else {
|
||||
Log.d("Bluetooth route ok");
|
||||
Log.d("[Bluetooth] Audio route ok");
|
||||
}
|
||||
} else {
|
||||
Log.d("Bluetooth still not ok...");
|
||||
Log.d("[Bluetooth] Audio route still not ok...");
|
||||
}
|
||||
|
||||
return ok;
|
||||
|
@ -211,7 +211,7 @@ public class BluetoothManager extends BroadcastReceiver {
|
|||
break;
|
||||
}
|
||||
}
|
||||
Log.d(isHeadsetConnected ? "Headset found, bluetooth audio route available" : "No headset found, bluetooth audio route unavailable");
|
||||
Log.d(isHeadsetConnected ? "[Bluetooth] Headset found, bluetooth audio route available" : "[Bluetooth] No headset found, bluetooth audio route unavailable");
|
||||
}
|
||||
return isHeadsetConnected;
|
||||
}
|
||||
|
@ -236,12 +236,12 @@ public class BluetoothManager extends BroadcastReceiver {
|
|||
mAudioManager.stopBluetoothSco();
|
||||
mAudioManager.setBluetoothScoOn(false);
|
||||
}
|
||||
Log.w("Bluetooth sco disconnected!");
|
||||
Log.w("[Bluetooth] SCO disconnected!");
|
||||
}
|
||||
}
|
||||
|
||||
public void stopBluetooth() {
|
||||
Log.w("Stopping bluetooth...");
|
||||
Log.w("[Bluetooth] Stopping...");
|
||||
isBluetoothConnected = false;
|
||||
|
||||
disableBluetoothSCO();
|
||||
|
@ -252,7 +252,7 @@ public class BluetoothManager extends BroadcastReceiver {
|
|||
}
|
||||
mBluetoothDevice = null;
|
||||
|
||||
Log.w("Bluetooth stopped!");
|
||||
Log.w("[Bluetooth] Stopped!");
|
||||
|
||||
if (LinphoneManager.isInstanciated()) {
|
||||
LinphoneManager.getInstance().routeAudioToReceiver();
|
||||
|
@ -265,7 +265,7 @@ public class BluetoothManager extends BroadcastReceiver {
|
|||
|
||||
try {
|
||||
mContext.unregisterReceiver(this);
|
||||
Log.d("Bluetooth receiver stopped");
|
||||
Log.d("[Bluetooth] Receiver stopped");
|
||||
} catch (Exception e) {}
|
||||
} catch (Exception e) {
|
||||
Log.e(e);
|
||||
|
@ -280,27 +280,27 @@ public class BluetoothManager extends BroadcastReceiver {
|
|||
if (AudioManager.ACTION_SCO_AUDIO_STATE_UPDATED.equals(action)) {
|
||||
int state = intent.getIntExtra(AudioManager.EXTRA_SCO_AUDIO_STATE, 0);
|
||||
if (state == AudioManager.SCO_AUDIO_STATE_CONNECTED) {
|
||||
Log.d("Bluetooth sco state => connected");
|
||||
Log.d("[Bluetooth] SCO state: connected");
|
||||
// LinphoneManager.getInstance().audioStateChanged(AudioState.BLUETOOTH);
|
||||
isScoConnected = true;
|
||||
} else if (state == AudioManager.SCO_AUDIO_STATE_DISCONNECTED) {
|
||||
Log.d("Bluetooth sco state => disconnected");
|
||||
Log.d("[Bluetooth] SCO state: disconnected");
|
||||
// LinphoneManager.getInstance().audioStateChanged(AudioState.SPEAKER);
|
||||
isScoConnected = false;
|
||||
} else {
|
||||
Log.d("Bluetooth sco state => " + state);
|
||||
Log.d("[Bluetooth] SCO state: " + state);
|
||||
}
|
||||
}
|
||||
else if (BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED.equals(action)) {
|
||||
int state = intent.getIntExtra(BluetoothAdapter.EXTRA_CONNECTION_STATE, BluetoothAdapter.STATE_DISCONNECTED);
|
||||
if (state == 0) {
|
||||
Log.d("Bluetooth state => disconnected");
|
||||
Log.d("[Bluetooth] State: disconnected");
|
||||
stopBluetooth();
|
||||
} else if (state == 2) {
|
||||
Log.d("Bluetooth state => connected");
|
||||
Log.d("[Bluetooth] State: connected");
|
||||
startBluetooth();
|
||||
} else {
|
||||
Log.d("Bluetooth state => " + state);
|
||||
Log.d("[Bluetooth] State: " + state);
|
||||
}
|
||||
}
|
||||
else if (intent.getAction().equals(BluetoothHeadset.ACTION_VENDOR_SPECIFIC_HEADSET_EVENT)) {
|
||||
|
@ -313,7 +313,7 @@ public class BluetoothManager extends BroadcastReceiver {
|
|||
if (eventName.equals("BUTTON") && args.length >= 3) {
|
||||
Integer buttonID = (Integer) args[1];
|
||||
Integer mode = (Integer) args[2];
|
||||
Log.d("Bluetooth event: " + command + " : " + eventName + ", id = " + buttonID + " (" + mode + ")");
|
||||
Log.d("[Bluetooth] Event: " + command + " : " + eventName + ", id = " + buttonID + " (" + mode + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1048,10 +1048,10 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
|
||||
public void setAudioManagerInCallMode() {
|
||||
if (mAudioManager.getMode() == AudioManager.MODE_IN_COMMUNICATION) {
|
||||
Log.w("---AudioManager: already in MODE_IN_COMMUNICATION, skipping...");
|
||||
Log.w("[AudioManager] already in MODE_IN_COMMUNICATION, skipping...");
|
||||
return;
|
||||
}
|
||||
Log.d("---AudioManager: set mode to MODE_IN_COMMUNICATION");
|
||||
Log.d("[AudioManager] Mode: MODE_IN_COMMUNICATION");
|
||||
mAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue