Prefixed all logs from LinphoneManager class by the same tag
This commit is contained in:
parent
4c30791582
commit
908edbaab5
1 changed files with 77 additions and 77 deletions
|
@ -238,7 +238,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
File f = new File(mUserCertsPath);
|
File f = new File(mUserCertsPath);
|
||||||
if (!f.exists()) {
|
if (!f.exists()) {
|
||||||
if (!f.mkdir()) {
|
if (!f.mkdir()) {
|
||||||
Log.e(mUserCertsPath + " can't be created.");
|
Log.e("[Manager] " + mUserCertsPath + " can't be created.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
public static synchronized void createAndStart(Context c) {
|
public static synchronized void createAndStart(Context c) {
|
||||||
if (sInstance != null) {
|
if (sInstance != null) {
|
||||||
Log.e(
|
Log.e(
|
||||||
"Linphone Manager is already initialized ! Destroying it and creating a new one...");
|
"[Manager] Linphone Manager is already initialized ! Destroying it and creating a new one...");
|
||||||
destroy();
|
destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,11 +265,11 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
|
|
||||||
if (sExited) {
|
if (sExited) {
|
||||||
throw new RuntimeException(
|
throw new RuntimeException(
|
||||||
"Linphone Manager was already destroyed. "
|
"[Manager] Linphone Manager was already destroyed. "
|
||||||
+ "Better use getLcIfManagerNotDestroyedOrNull and check returned value");
|
+ "Better use getLcIfManagerNotDestroyedOrNull and check returned value");
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new RuntimeException("Linphone Manager should be created before accessed");
|
throw new RuntimeException("[Manager] Linphone Manager should be created before accessed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static synchronized Core getLc() {
|
public static synchronized Core getLc() {
|
||||||
|
@ -282,7 +282,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
final float distanceInCm = event.values[0];
|
final float distanceInCm = event.values[0];
|
||||||
final float maxDistance = event.sensor.getMaximumRange();
|
final float maxDistance = event.sensor.getMaximumRange();
|
||||||
Log.d(
|
Log.d(
|
||||||
"Proximity sensor report ["
|
"[Manager] Proximity sensor report ["
|
||||||
+ distanceInCm
|
+ distanceInCm
|
||||||
+ "] , for max range ["
|
+ "] , for max range ["
|
||||||
+ maxDistance
|
+ maxDistance
|
||||||
|
@ -337,7 +337,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
|
|
||||||
private void routeAudioToSpeakerHelper(boolean speakerOn) {
|
private void routeAudioToSpeakerHelper(boolean speakerOn) {
|
||||||
Log.w(
|
Log.w(
|
||||||
"Routing audio to "
|
"[Manager] Routing audio to "
|
||||||
+ (speakerOn ? "speaker" : "earpiece")
|
+ (speakerOn ? "speaker" : "earpiece")
|
||||||
+ ", disabling bluetooth audio route");
|
+ ", disabling bluetooth audio route");
|
||||||
BluetoothManager.getInstance().disableBluetoothSCO();
|
BluetoothManager.getInstance().disableBluetoothSCO();
|
||||||
|
@ -355,7 +355,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
|
|
||||||
private void initOpenH264DownloadHelper() {
|
private void initOpenH264DownloadHelper() {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
|
||||||
Log.i("Android >= 5.1 we disable the download of OpenH264");
|
Log.i("[Manager] Android >= 5.1 we disable the download of OpenH264");
|
||||||
OpenH264DownloadHelper.setOpenH264DownloadEnabled(false);
|
OpenH264DownloadHelper.setOpenH264DownloadEnabled(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -466,14 +466,6 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
PresenceModel model = lc.createPresenceModel();
|
PresenceModel model = lc.createPresenceModel();
|
||||||
model.setBasicStatus(PresenceBasicStatus.Open);
|
model.setBasicStatus(PresenceBasicStatus.Open);
|
||||||
lc.setPresenceModel(model);
|
lc.setPresenceModel(model);
|
||||||
/*
|
|
||||||
if (isInstanciated() && lc != null && isPresenceModelActivitySet() && lc.getPresenceModel().getActivity().getType() != PresenceActivity.Type.TV) {
|
|
||||||
lc.getPresenceModel().getActivity().setType(PresenceActivity.Type.TV);
|
|
||||||
} else if (isInstanciated() && lc != null && !isPresenceModelActivitySet()) {
|
|
||||||
PresenceModel model = lc.createPresenceModelWithActivity(PresenceActivity.Type.TV, null);
|
|
||||||
lc.setPresenceModel(model);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void changeStatusToOnThePhone() {
|
public void changeStatusToOnThePhone() {
|
||||||
|
@ -505,7 +497,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
Core lc = getLcIfManagerNotDestroyedOrNull();
|
Core lc = getLcIfManagerNotDestroyedOrNull();
|
||||||
if (lc != null && lc.getFriendsLists() != null && lc.getFriendsLists().length > 0) {
|
if (lc != null && lc.getFriendsLists() != null && lc.getFriendsLists().length > 0) {
|
||||||
FriendList mFriendList = (lc.getFriendsLists())[0];
|
FriendList mFriendList = (lc.getFriendsLists())[0];
|
||||||
Log.i("Presence list subscription is " + (enabled ? "enabled" : "disabled"));
|
Log.i("[Manager] Presence list subscription is " + (enabled ? "enabled" : "disabled"));
|
||||||
mFriendList.enableSubscriptions(enabled);
|
mFriendList.enableSubscriptions(enabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -536,7 +528,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
Address lAddress;
|
Address lAddress;
|
||||||
lAddress = mCore.interpretUrl(to); // InterpretUrl does normalizePhoneNumber
|
lAddress = mCore.interpretUrl(to); // InterpretUrl does normalizePhoneNumber
|
||||||
if (lAddress == null) {
|
if (lAddress == null) {
|
||||||
Log.e("Couldn't convert to String to Address : " + to);
|
Log.e("[Manager] Couldn't convert to String to Address : " + to);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -569,7 +561,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
.displayCustomToast(
|
.displayCustomToast(
|
||||||
getString(R.string.error_network_unreachable), Toast.LENGTH_LONG);
|
getString(R.string.error_network_unreachable), Toast.LENGTH_LONG);
|
||||||
} else {
|
} else {
|
||||||
Log.e("Error: " + getString(R.string.error_network_unreachable));
|
Log.e("[Manager] Error: " + getString(R.string.error_network_unreachable));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -586,7 +578,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
String[] devices = getLc().getVideoDevicesList();
|
String[] devices = getLc().getVideoDevicesList();
|
||||||
if (camId >= devices.length) {
|
if (camId >= devices.length) {
|
||||||
Log.e(
|
Log.e(
|
||||||
"Trying to use a camera id that's higher than the linphone's devices list, using 0 to prevent crash...");
|
"[Manager] Trying to use a camera id that's higher than the linphone's devices list, using 0 to prevent crash...");
|
||||||
camId = 0;
|
camId = 0;
|
||||||
}
|
}
|
||||||
String newDevice = devices[camId];
|
String newDevice = devices[camId];
|
||||||
|
@ -610,7 +602,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (SettingNotFoundException e) {
|
} catch (SettingNotFoundException e) {
|
||||||
Log.e(e);
|
Log.e("[Manager] playDtmf exception: " + e);
|
||||||
}
|
}
|
||||||
|
|
||||||
getLc().playDtmf(dtmf, -1);
|
getLc().playDtmf(dtmf, -1);
|
||||||
|
@ -637,7 +629,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
|
|
||||||
private boolean isTunnelNeeded(NetworkInfo info) {
|
private boolean isTunnelNeeded(NetworkInfo info) {
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
Log.i("No connectivity: tunnel should be disabled");
|
Log.i("[Manager] No connectivity: tunnel should be disabled");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -649,7 +641,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
|
|
||||||
if (info.getType() != ConnectivityManager.TYPE_WIFI
|
if (info.getType() != ConnectivityManager.TYPE_WIFI
|
||||||
&& getString(R.string.tunnel_mode_entry_value_3G_only).equals(pref)) {
|
&& getString(R.string.tunnel_mode_entry_value_3G_only).equals(pref)) {
|
||||||
Log.i("need tunnel: 'no wifi' connection");
|
Log.i("[Manager] Need tunnel: 'no wifi' connection");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -661,12 +653,12 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
if (!mCore.tunnelAvailable()) return;
|
if (!mCore.tunnelAvailable()) return;
|
||||||
Tunnel tunnel = mCore.getTunnel();
|
Tunnel tunnel = mCore.getTunnel();
|
||||||
|
|
||||||
Log.i("Managing tunnel");
|
Log.i("[Manager] Managing tunnel");
|
||||||
if (isTunnelNeeded(info)) {
|
if (isTunnelNeeded(info)) {
|
||||||
Log.i("Tunnel need to be activated");
|
Log.i("[Manager] Tunnel need to be activated");
|
||||||
tunnel.setMode(Tunnel.Mode.Enable);
|
tunnel.setMode(Tunnel.Mode.Enable);
|
||||||
} else {
|
} else {
|
||||||
Log.i("Tunnel should not be used");
|
Log.i("[Manager] Tunnel should not be used");
|
||||||
String pref = mPrefs.getTunnelMode();
|
String pref = mPrefs.getTunnelMode();
|
||||||
tunnel.setMode(Tunnel.Mode.Disable);
|
tunnel.setMode(Tunnel.Mode.Disable);
|
||||||
if (getString(R.string.tunnel_mode_entry_value_auto).equals(pref)) {
|
if (getString(R.string.tunnel_mode_entry_value_auto).equals(pref)) {
|
||||||
|
@ -683,34 +675,34 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
mTimer.cancel();
|
mTimer.cancel();
|
||||||
destroyLinphoneCore();
|
destroyLinphoneCore();
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
Log.e(e);
|
Log.e("[Manager] Destroy Core Runtime Exception: " + e);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) {
|
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) {
|
||||||
mServiceContext.unregisterReceiver(mNetworkReceiver);
|
mServiceContext.unregisterReceiver(mNetworkReceiver);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(e);
|
Log.e("[Manager] unregister receiver exception: " + e);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
mServiceContext.unregisterReceiver(mHookReceiver);
|
mServiceContext.unregisterReceiver(mHookReceiver);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(e);
|
Log.e("[Manager] unregister receiver exception: " + e);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
mServiceContext.unregisterReceiver(mCallReceiver);
|
mServiceContext.unregisterReceiver(mCallReceiver);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(e);
|
Log.e("[Manager] unregister receiver exception: " + e);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
mServiceContext.unregisterReceiver(mKeepAliveReceiver);
|
mServiceContext.unregisterReceiver(mKeepAliveReceiver);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(e);
|
Log.e("[Manager] unregister receiver exception: " + e);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
dozeManager(false);
|
dozeManager(false);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(e);
|
Log.e("[Manager] unregister receiver exception: " + e);
|
||||||
}
|
}
|
||||||
mCore = null;
|
mCore = null;
|
||||||
}
|
}
|
||||||
|
@ -748,14 +740,14 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
mTimer = new Timer("Linphone scheduler");
|
mTimer = new Timer("Linphone scheduler");
|
||||||
mTimer.schedule(lTask, 0, 20);
|
mTimer.schedule(lTask, 0, 20);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(e, "Cannot start linphone");
|
Log.e(e, "[Manager] Cannot start linphone");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initPushNotificationsService() {
|
private void initPushNotificationsService() {
|
||||||
if (getString(R.string.push_type).equals("firebase")) {
|
if (getString(R.string.push_type).equals("firebase")) {
|
||||||
Log.i(
|
Log.i(
|
||||||
"[Push Notification] firebase push sender id "
|
"[Manager][Push Notification] firebase push sender id "
|
||||||
+ getString(R.string.gcm_defaultSenderId));
|
+ getString(R.string.gcm_defaultSenderId));
|
||||||
try {
|
try {
|
||||||
FirebaseInstanceId.getInstance()
|
FirebaseInstanceId.getInstance()
|
||||||
|
@ -766,18 +758,20 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
public void onComplete(@NonNull Task<InstanceIdResult> task) {
|
public void onComplete(@NonNull Task<InstanceIdResult> task) {
|
||||||
if (!task.isSuccessful()) {
|
if (!task.isSuccessful()) {
|
||||||
Log.e(
|
Log.e(
|
||||||
"[Push Notification] firebase getInstanceId failed: "
|
"[Manager][Push Notification] firebase getInstanceId failed: "
|
||||||
+ task.getException());
|
+ task.getException());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String token = task.getResult().getToken();
|
String token = task.getResult().getToken();
|
||||||
Log.i("[Push Notification] firebase token is: " + token);
|
Log.i(
|
||||||
|
"[Manager][Push Notification] firebase token is: "
|
||||||
|
+ token);
|
||||||
LinphonePreferences.instance()
|
LinphonePreferences.instance()
|
||||||
.setPushNotificationRegistrationID(token);
|
.setPushNotificationRegistrationID(token);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e("[Push Notification] firebase not available.");
|
Log.e("[Manager][Push Notification] firebase not available.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -808,7 +802,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
enableDeviceRingtone(mPrefs.isDeviceRingtoneEnabled());
|
enableDeviceRingtone(mPrefs.isDeviceRingtoneEnabled());
|
||||||
|
|
||||||
int availableCores = Runtime.getRuntime().availableProcessors();
|
int availableCores = Runtime.getRuntime().availableProcessors();
|
||||||
Log.w("MediaStreamer : " + availableCores + " cores detected and configured");
|
Log.w("[Manager] MediaStreamer : " + availableCores + " cores detected and configured");
|
||||||
|
|
||||||
mCore.migrateLogsFromRcToDb();
|
mCore.migrateLogsFromRcToDb();
|
||||||
|
|
||||||
|
@ -953,10 +947,10 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
}
|
}
|
||||||
|
|
||||||
if (networkInfo == null || !connected) {
|
if (networkInfo == null || !connected) {
|
||||||
Log.i("No connectivity: setting network unreachable");
|
Log.i("[Manager] No connectivity: setting network unreachable");
|
||||||
mCore.setNetworkReachable(false);
|
mCore.setNetworkReachable(false);
|
||||||
} else if (mDozeModeEnabled) {
|
} else if (mDozeModeEnabled) {
|
||||||
Log.i("Doze Mode enabled: shutting down network");
|
Log.i("[Manager] Doze Mode enabled: shutting down network");
|
||||||
mCore.setNetworkReachable(false);
|
mCore.setNetworkReachable(false);
|
||||||
} else if (connected) {
|
} else if (connected) {
|
||||||
manageTunnelServer(networkInfo);
|
manageTunnelServer(networkInfo);
|
||||||
|
@ -966,7 +960,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
if (networkInfo.getType() == ConnectivityManager.TYPE_WIFI) {
|
if (networkInfo.getType() == ConnectivityManager.TYPE_WIFI) {
|
||||||
mCore.setNetworkReachable(true);
|
mCore.setNetworkReachable(true);
|
||||||
} else {
|
} else {
|
||||||
Log.i("Wifi-only mode, setting network not reachable");
|
Log.i("[Manager] Wifi-only mode, setting network not reachable");
|
||||||
mCore.setNetworkReachable(false);
|
mCore.setNetworkReachable(false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -976,7 +970,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
// if kind of network has changed, we need to notify network_reachable(false) to
|
// if kind of network has changed, we need to notify network_reachable(false) to
|
||||||
// make sure all current connections are destroyed.
|
// make sure all current connections are destroyed.
|
||||||
// they will be re-created during setNetworkReachable(true).
|
// they will be re-created during setNetworkReachable(true).
|
||||||
Log.i("Connectivity has changed.");
|
Log.i("[Manager] Connectivity has changed.");
|
||||||
mCore.setNetworkReachable(false);
|
mCore.setNetworkReachable(false);
|
||||||
}
|
}
|
||||||
mCore.setNetworkReachable(true);
|
mCore.setNetworkReachable(true);
|
||||||
|
@ -1006,11 +1000,11 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
|
|
||||||
private void dozeManager(boolean enable) {
|
private void dozeManager(boolean enable) {
|
||||||
if (enable) {
|
if (enable) {
|
||||||
Log.i("[Doze Mode]: register");
|
Log.i("[Manager][Doze Mode]: register");
|
||||||
mServiceContext.registerReceiver(mDozeReceiver, mDozeIntentFilter);
|
mServiceContext.registerReceiver(mDozeReceiver, mDozeIntentFilter);
|
||||||
mDozeModeEnabled = true;
|
mDozeModeEnabled = true;
|
||||||
} else {
|
} else {
|
||||||
Log.i("[Doze Mode]: unregister");
|
Log.i("[Manager][Doze Mode]: unregister");
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
try {
|
try {
|
||||||
mServiceContext.unregisterReceiver(mDozeReceiver);
|
mServiceContext.unregisterReceiver(mDozeReceiver);
|
||||||
|
@ -1087,7 +1081,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDtmfReceived(Core lc, Call call, int dtmf) {
|
public void onDtmfReceived(Core lc, Call call, int dtmf) {
|
||||||
Log.d("DTMF received: " + dtmf);
|
Log.d("[Manager] DTMF received: " + dtmf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1100,18 +1094,20 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
&& cr.getPeerAddress()
|
&& cr.getPeerAddress()
|
||||||
.asStringUriOnly()
|
.asStringUriOnly()
|
||||||
.equals(mCurrentChatRoomAddress.asStringUriOnly())) {
|
.equals(mCurrentChatRoomAddress.asStringUriOnly())) {
|
||||||
Log.i("Message received for currently displayed chat room, do not make a notification");
|
Log.i(
|
||||||
|
"[Manager] Message received for currently displayed chat room, do not make a notification");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message.getErrorInfo() != null
|
if (message.getErrorInfo() != null
|
||||||
&& message.getErrorInfo().getReason() == Reason.UnsupportedContent) {
|
&& message.getErrorInfo().getReason() == Reason.UnsupportedContent) {
|
||||||
Log.w("Message received but content is unsupported, do not notify it");
|
Log.w("[Manager] Message received but content is unsupported, do not notify it");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!message.hasTextContent() && message.getFileTransferInformation() == null) {
|
if (!message.hasTextContent() && message.getFileTransferInformation() == null) {
|
||||||
Log.w("Message has no text or file transfer information to display, ignoring it...");
|
Log.w(
|
||||||
|
"[Manager] Message has no text or file transfer information to display, ignoring it...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1235,7 +1231,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
((AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE))
|
((AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE))
|
||||||
.setMode(AudioManager.MODE_NORMAL);
|
.setMode(AudioManager.MODE_NORMAL);
|
||||||
mAudioManager.abandonAudioFocus(null);
|
mAudioManager.abandonAudioFocus(null);
|
||||||
Log.i("Set audio mode on 'Normal'");
|
Log.i("[Manager] Set audio mode on 'Normal'");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onGlobalStateChanged(final Core lc, final GlobalState state, final String message) {
|
public void onGlobalStateChanged(final Core lc, final GlobalState state, final String message) {
|
||||||
|
@ -1244,7 +1240,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
try {
|
try {
|
||||||
initLiblinphone(lc);
|
initLiblinphone(lc);
|
||||||
} catch (IllegalArgumentException iae) {
|
} catch (IllegalArgumentException iae) {
|
||||||
Log.e(iae);
|
Log.e("[Manager] Global State Changed Illegal Argument Exception: " + iae);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1254,7 +1250,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
final ProxyConfig proxy,
|
final ProxyConfig proxy,
|
||||||
final RegistrationState state,
|
final RegistrationState state,
|
||||||
final String message) {
|
final String message) {
|
||||||
Log.i("New registration state [" + state + "]");
|
Log.i("[Manager] New registration state [" + state + "]");
|
||||||
if (LinphoneManager.getLc().getDefaultProxyConfig() == null) {
|
if (LinphoneManager.getLc().getDefaultProxyConfig() == null) {
|
||||||
subscribeFriendList(false);
|
subscribeFriendList(false);
|
||||||
}
|
}
|
||||||
|
@ -1280,10 +1276,10 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
|
|
||||||
private void setAudioManagerInCallMode() {
|
private void setAudioManagerInCallMode() {
|
||||||
if (mAudioManager.getMode() == AudioManager.MODE_IN_COMMUNICATION) {
|
if (mAudioManager.getMode() == AudioManager.MODE_IN_COMMUNICATION) {
|
||||||
Log.w("[AudioManager] already in MODE_IN_COMMUNICATION, skipping...");
|
Log.w("[Manager][AudioManager] already in MODE_IN_COMMUNICATION, skipping...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Log.d("[AudioManager] Mode: MODE_IN_COMMUNICATION");
|
Log.d("[Manager][AudioManager] Mode: MODE_IN_COMMUNICATION");
|
||||||
|
|
||||||
mAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
mAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||||
}
|
}
|
||||||
|
@ -1291,7 +1287,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
@SuppressLint("Wakelock")
|
@SuppressLint("Wakelock")
|
||||||
public void onCallStateChanged(
|
public void onCallStateChanged(
|
||||||
final Core lc, final Call call, final State state, final String message) {
|
final Core lc, final Call call, final State state, final String message) {
|
||||||
Log.i("New call state [", state, "]");
|
Log.i("[Manager] New call state [", state, "]");
|
||||||
if (state == State.IncomingReceived && !call.equals(lc.getCurrentCall())) {
|
if (state == State.IncomingReceived && !call.equals(lc.getCurrentCall())) {
|
||||||
if (call.getReplacedCall() != null) {
|
if (call.getReplacedCall() != null) {
|
||||||
// attended transfer
|
// attended transfer
|
||||||
|
@ -1354,7 +1350,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Hacks.needSoftvolume()) {
|
if (Hacks.needSoftvolume()) {
|
||||||
Log.w("Using soft volume audio hack");
|
Log.w("[Manager] Using soft volume audio hack");
|
||||||
adjustVolume(0); // Synchronize
|
adjustVolume(0); // Synchronize
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1367,7 +1363,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
if (mAudioFocused) {
|
if (mAudioFocused) {
|
||||||
int res = mAudioManager.abandonAudioFocus(null);
|
int res = mAudioManager.abandonAudioFocus(null);
|
||||||
Log.d(
|
Log.d(
|
||||||
"Audio focus released a bit later: "
|
"[Manager] Audio focus released a bit later: "
|
||||||
+ (res == AudioManager.AUDIOFOCUS_REQUEST_GRANTED
|
+ (res == AudioManager.AUDIOFOCUS_REQUEST_GRANTED
|
||||||
? "Granted"
|
? "Granted"
|
||||||
: "Denied"));
|
: "Denied"));
|
||||||
|
@ -1377,9 +1373,9 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
TelephonyManager tm =
|
TelephonyManager tm =
|
||||||
(TelephonyManager) activity.getSystemService(Context.TELEPHONY_SERVICE);
|
(TelephonyManager) activity.getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
if (tm.getCallState() == TelephonyManager.CALL_STATE_IDLE) {
|
if (tm.getCallState() == TelephonyManager.CALL_STATE_IDLE) {
|
||||||
Log.d("---AudioManager: back to MODE_NORMAL");
|
Log.d("[Manager] ---AudioManager: back to MODE_NORMAL");
|
||||||
mAudioManager.setMode(AudioManager.MODE_NORMAL);
|
mAudioManager.setMode(AudioManager.MODE_NORMAL);
|
||||||
Log.d("All call terminated, routing back to earpiece");
|
Log.d("[Manager] All call terminated, routing back to earpiece");
|
||||||
routeAudioToReceiver();
|
routeAudioToReceiver();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1432,7 +1428,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
public void startEcCalibration() {
|
public void startEcCalibration() {
|
||||||
routeAudioToSpeaker();
|
routeAudioToSpeaker();
|
||||||
setAudioManagerInCallMode();
|
setAudioManagerInCallMode();
|
||||||
Log.i("Set audio mode on 'Voice Communication'");
|
Log.i("[Manager] Set audio mode on 'Voice Communication'");
|
||||||
requestAudioFocus(STREAM_VOICE_CALL);
|
requestAudioFocus(STREAM_VOICE_CALL);
|
||||||
int oldVolume = mAudioManager.getStreamVolume(STREAM_VOICE_CALL);
|
int oldVolume = mAudioManager.getStreamVolume(STREAM_VOICE_CALL);
|
||||||
int maxVolume = mAudioManager.getStreamMaxVolume(STREAM_VOICE_CALL);
|
int maxVolume = mAudioManager.getStreamMaxVolume(STREAM_VOICE_CALL);
|
||||||
|
@ -1444,7 +1440,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
public int startEchoTester() {
|
public int startEchoTester() {
|
||||||
routeAudioToSpeaker();
|
routeAudioToSpeaker();
|
||||||
setAudioManagerInCallMode();
|
setAudioManagerInCallMode();
|
||||||
Log.i("Set audio mode on 'Voice Communication'");
|
Log.i("[Manager] Set audio mode on 'Voice Communication'");
|
||||||
requestAudioFocus(STREAM_VOICE_CALL);
|
requestAudioFocus(STREAM_VOICE_CALL);
|
||||||
int maxVolume = mAudioManager.getStreamMaxVolume(STREAM_VOICE_CALL);
|
int maxVolume = mAudioManager.getStreamMaxVolume(STREAM_VOICE_CALL);
|
||||||
int sampleRate;
|
int sampleRate;
|
||||||
|
@ -1463,7 +1459,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
routeAudioToReceiver();
|
routeAudioToReceiver();
|
||||||
((AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE))
|
((AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE))
|
||||||
.setMode(AudioManager.MODE_NORMAL);
|
.setMode(AudioManager.MODE_NORMAL);
|
||||||
Log.i("Set audio mode on 'Normal'");
|
Log.i("[Manager] Set audio mode on 'Normal'");
|
||||||
return 1; // status;
|
return 1; // status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1477,7 +1473,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
mAudioManager.requestAudioFocus(
|
mAudioManager.requestAudioFocus(
|
||||||
null, stream, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE);
|
null, stream, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE);
|
||||||
Log.d(
|
Log.d(
|
||||||
"Audio focus requested: "
|
"[Manager] Audio focus requested: "
|
||||||
+ (res == AudioManager.AUDIOFOCUS_REQUEST_GRANTED
|
+ (res == AudioManager.AUDIOFOCUS_REQUEST_GRANTED
|
||||||
? "Granted"
|
? "Granted"
|
||||||
: "Denied"));
|
: "Denied"));
|
||||||
|
@ -1532,17 +1528,17 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
fis.close();
|
fis.close();
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(e, "Cannot set ringtone");
|
Log.e(e, "[Manager] Cannot set ringtone");
|
||||||
}
|
}
|
||||||
|
|
||||||
mRingerPlayer.prepare();
|
mRingerPlayer.prepare();
|
||||||
mRingerPlayer.setLooping(true);
|
mRingerPlayer.setLooping(true);
|
||||||
mRingerPlayer.start();
|
mRingerPlayer.start();
|
||||||
} else {
|
} else {
|
||||||
Log.w("already ringing");
|
Log.w("[Manager] Already ringing");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(e, "cannot handle incoming call");
|
Log.e(e, "[Manager] Cannot handle incoming call");
|
||||||
}
|
}
|
||||||
mIsRinging = true;
|
mIsRinging = true;
|
||||||
}
|
}
|
||||||
|
@ -1563,10 +1559,10 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
// You may need to call galaxys audio hack after this method
|
// You may need to call galaxys audio hack after this method
|
||||||
if (!BluetoothManager.getInstance().isBluetoothHeadsetAvailable()) {
|
if (!BluetoothManager.getInstance().isBluetoothHeadsetAvailable()) {
|
||||||
if (mServiceContext.getResources().getBoolean(R.bool.isTablet)) {
|
if (mServiceContext.getResources().getBoolean(R.bool.isTablet)) {
|
||||||
Log.d("Stopped ringing, routing back to speaker");
|
Log.d("[Manager] Stopped ringing, routing back to speaker");
|
||||||
routeAudioToSpeaker();
|
routeAudioToSpeaker();
|
||||||
} else {
|
} else {
|
||||||
Log.d("Stopped ringing, routing back to earpiece");
|
Log.d("[Manager] Stopped ringing, routing back to earpiece");
|
||||||
routeAudioToReceiver();
|
routeAudioToReceiver();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1603,7 +1599,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
params.setRecordFile(
|
params.setRecordFile(
|
||||||
FileUtils.getCallRecordingFilename(getContext(), call.getRemoteAddress()));
|
FileUtils.getCallRecordingFilename(getContext(), call.getRemoteAddress()));
|
||||||
} else {
|
} else {
|
||||||
Log.e("Could not create call params for call");
|
Log.e("[Manager] Could not create call params for call");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1728,11 +1724,11 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInfoReceived(Core lc, Call call, InfoMessage info) {
|
public void onInfoReceived(Core lc, Call call, InfoMessage info) {
|
||||||
Log.d("Info message received from " + call.getRemoteAddress().asString());
|
Log.d("[Manager] Info message received from " + call.getRemoteAddress().asString());
|
||||||
Content ct = info.getContent();
|
Content ct = info.getContent();
|
||||||
if (ct != null) {
|
if (ct != null) {
|
||||||
Log.d(
|
Log.d(
|
||||||
"Info received with body with mime type "
|
"[Manager] Info received with body with mime type "
|
||||||
+ ct.getType()
|
+ ct.getType()
|
||||||
+ "/"
|
+ "/"
|
||||||
+ ct.getSubtype()
|
+ ct.getSubtype()
|
||||||
|
@ -1744,7 +1740,11 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSubscriptionStateChanged(Core lc, Event ev, SubscriptionState state) {
|
public void onSubscriptionStateChanged(Core lc, Event ev, SubscriptionState state) {
|
||||||
Log.d("Subscription state changed to " + state + " event name is " + ev.getName());
|
Log.d(
|
||||||
|
"[Manager] Subscription state changed to "
|
||||||
|
+ state
|
||||||
|
+ " event name is "
|
||||||
|
+ ev.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1752,10 +1752,10 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNotifyReceived(Core lc, Event ev, String eventName, Content content) {
|
public void onNotifyReceived(Core lc, Event ev, String eventName, Content content) {
|
||||||
Log.d("Notify received for event " + eventName);
|
Log.d("[Manager] Notify received for event " + eventName);
|
||||||
if (content != null)
|
if (content != null)
|
||||||
Log.d(
|
Log.d(
|
||||||
"with content "
|
"[Manager] With content "
|
||||||
+ content.getType()
|
+ content.getType()
|
||||||
+ "/"
|
+ "/"
|
||||||
+ content.getSubtype()
|
+ content.getSubtype()
|
||||||
|
@ -1768,12 +1768,12 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPublishStateChanged(Core lc, Event ev, PublishState state) {
|
public void onPublishStateChanged(Core lc, Event ev, PublishState state) {
|
||||||
Log.d("Publish state changed to " + state + " for event name " + ev.getName());
|
Log.d("[Manager] Publish state changed to " + state + " for event name " + ev.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onIsComposingReceived(Core lc, ChatRoom cr) {
|
public void onIsComposingReceived(Core lc, ChatRoom cr) {
|
||||||
Log.d("Composing received for chatroom " + cr.getPeerAddress().asStringUriOnly());
|
Log.d("[Manager] Composing received for chatroom " + cr.getPeerAddress().asStringUriOnly());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1781,7 +1781,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConfiguringStatus(Core lc, ConfiguringState state, String message) {
|
public void onConfiguringStatus(Core lc, ConfiguringState state, String message) {
|
||||||
Log.d("Remote provisioning status = " + state.toString() + " (" + message + ")");
|
Log.d("[Manager] Remote provisioning status = " + state.toString() + " (" + message + ")");
|
||||||
|
|
||||||
LinphonePreferences prefs = LinphonePreferences.instance();
|
LinphonePreferences prefs = LinphonePreferences.instance();
|
||||||
if (state == ConfiguringState.Successful) {
|
if (state == ConfiguringState.Successful) {
|
||||||
|
@ -1801,7 +1801,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
public void onLogCollectionUploadProgressIndication(Core linphoneCore, int offset, int total) {
|
public void onLogCollectionUploadProgressIndication(Core linphoneCore, int offset, int total) {
|
||||||
if (total > 0)
|
if (total > 0)
|
||||||
Log.d(
|
Log.d(
|
||||||
"Log upload progress: currently uploaded = "
|
"[Manager] Log upload progress: currently uploaded = "
|
||||||
+ offset
|
+ offset
|
||||||
+ " , total = "
|
+ " , total = "
|
||||||
+ total
|
+ total
|
||||||
|
@ -1849,7 +1849,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
@Override
|
@Override
|
||||||
public void onLogCollectionUploadStateChanged(
|
public void onLogCollectionUploadStateChanged(
|
||||||
Core linphoneCore, LogCollectionUploadState state, String info) {
|
Core linphoneCore, LogCollectionUploadState state, String info) {
|
||||||
Log.d("Log upload state: " + state.toString() + ", info = " + info);
|
Log.d("[Manager] Log upload state: " + state.toString() + ", info = " + info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue