Use LoggingService instead of JNI log handler, fixes log issue on Blackberry Keyone
This commit is contained in:
parent
d6bc43da3f
commit
685c959d2c
7 changed files with 43 additions and 11 deletions
|
@ -1192,8 +1192,7 @@ public class LinphonePreferences {
|
||||||
// Advanced settings
|
// Advanced settings
|
||||||
public void setDebugEnabled(boolean enabled) {
|
public void setDebugEnabled(boolean enabled) {
|
||||||
getConfig().setBool("app", "debug", enabled);
|
getConfig().setBool("app", "debug", enabled);
|
||||||
Factory.instance().enableLogCollection(LogCollectionState.Enabled);
|
LinphoneUtils.initLoggingService(enabled);
|
||||||
Factory.instance().setDebugMode(enabled, getString(R.string.app_name));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDebugEnabled() {
|
public boolean isDebugEnabled() {
|
||||||
|
|
|
@ -32,6 +32,9 @@ import org.linphone.core.Call;
|
||||||
import org.linphone.core.Call.State;
|
import org.linphone.core.Call.State;
|
||||||
import org.linphone.core.Core;
|
import org.linphone.core.Core;
|
||||||
import org.linphone.core.GlobalState;
|
import org.linphone.core.GlobalState;
|
||||||
|
import org.linphone.core.LogLevel;
|
||||||
|
import org.linphone.core.LoggingService;
|
||||||
|
import org.linphone.core.LoggingServiceListener;
|
||||||
import org.linphone.core.RegistrationState;
|
import org.linphone.core.RegistrationState;
|
||||||
import org.linphone.core.Factory;
|
import org.linphone.core.Factory;
|
||||||
import org.linphone.core.LogCollectionState;
|
import org.linphone.core.LogCollectionState;
|
||||||
|
@ -298,8 +301,7 @@ public final class LinphoneService extends Service {
|
||||||
LinphonePreferences.instance().setContext(getBaseContext());
|
LinphonePreferences.instance().setContext(getBaseContext());
|
||||||
Factory.instance().setLogCollectionPath(getFilesDir().getAbsolutePath());
|
Factory.instance().setLogCollectionPath(getFilesDir().getAbsolutePath());
|
||||||
boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled();
|
boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled();
|
||||||
Factory.instance().enableLogCollection(LogCollectionState.Enabled);
|
LinphoneUtils.initLoggingService(isDebugEnabled);
|
||||||
Factory.instance().setDebugMode(isDebugEnabled, getString(R.string.app_name));
|
|
||||||
|
|
||||||
// Dump some debugging information to the logs
|
// Dump some debugging information to the logs
|
||||||
Log.i(START_LINPHONE_LOGS);
|
Log.i(START_LINPHONE_LOGS);
|
||||||
|
|
|
@ -67,6 +67,10 @@ import org.linphone.core.Core;
|
||||||
import org.linphone.core.Factory;
|
import org.linphone.core.Factory;
|
||||||
import org.linphone.core.Friend;
|
import org.linphone.core.Friend;
|
||||||
import org.linphone.core.FriendList;
|
import org.linphone.core.FriendList;
|
||||||
|
import org.linphone.core.LogCollectionState;
|
||||||
|
import org.linphone.core.LogLevel;
|
||||||
|
import org.linphone.core.LoggingService;
|
||||||
|
import org.linphone.core.LoggingServiceListener;
|
||||||
import org.linphone.core.ProxyConfig;
|
import org.linphone.core.ProxyConfig;
|
||||||
import org.linphone.mediastream.Log;
|
import org.linphone.mediastream.Log;
|
||||||
import org.linphone.mediastream.video.capture.hwconf.Hacks;
|
import org.linphone.mediastream.video.capture.hwconf.Hacks;
|
||||||
|
@ -111,6 +115,34 @@ public final class LinphoneUtils {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void initLoggingService(boolean isDebugEnabled) {
|
||||||
|
Factory.instance().setDebugMode(isDebugEnabled, "");
|
||||||
|
Factory.instance().enableLogCollection(LogCollectionState.EnabledWithoutPreviousLogHandler);
|
||||||
|
Factory.instance().getLoggingService().setListener(new LoggingServiceListener() {
|
||||||
|
@Override
|
||||||
|
public void onLogMessageWritten(LoggingService logService, String domain, LogLevel lev, String message) {
|
||||||
|
switch (lev) {
|
||||||
|
case Debug:
|
||||||
|
android.util.Log.d(domain, message);
|
||||||
|
break;
|
||||||
|
case Message:
|
||||||
|
android.util.Log.i(domain, message);
|
||||||
|
break;
|
||||||
|
case Warning:
|
||||||
|
android.util.Log.w(domain, message);
|
||||||
|
break;
|
||||||
|
case Error:
|
||||||
|
android.util.Log.e(domain, message);
|
||||||
|
break;
|
||||||
|
case Fatal:
|
||||||
|
default:
|
||||||
|
android.util.Log.wtf(domain, message);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public static void dispatchOnUIThread(Runnable r) {
|
public static void dispatchOnUIThread(Runnable r) {
|
||||||
mHandler.post(r);
|
mHandler.post(r);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
import org.linphone.LinphoneManager;
|
import org.linphone.LinphoneManager;
|
||||||
import org.linphone.LinphonePreferences;
|
import org.linphone.LinphonePreferences;
|
||||||
import org.linphone.LinphoneService;
|
import org.linphone.LinphoneService;
|
||||||
|
import org.linphone.LinphoneUtils;
|
||||||
import org.linphone.R;
|
import org.linphone.R;
|
||||||
import org.linphone.core.Core;
|
import org.linphone.core.Core;
|
||||||
import org.linphone.core.Factory;
|
import org.linphone.core.Factory;
|
||||||
|
@ -43,8 +44,7 @@ public class DozeReceiver extends android.content.BroadcastReceiver {
|
||||||
if (!LinphoneService.isReady()) return;
|
if (!LinphoneService.isReady()) return;
|
||||||
|
|
||||||
boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled();
|
boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled();
|
||||||
Factory.instance().enableLogCollection(isDebugEnabled ? LogCollectionState.Enabled : LogCollectionState.Disabled);
|
LinphoneUtils.initLoggingService(isDebugEnabled);
|
||||||
Factory.instance().setDebugMode(isDebugEnabled, context.getString(R.string.app_name));
|
|
||||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||||
if (lc == null) return;
|
if (lc == null) return;
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
import org.linphone.LinphoneManager;
|
import org.linphone.LinphoneManager;
|
||||||
import org.linphone.LinphonePreferences;
|
import org.linphone.LinphonePreferences;
|
||||||
import org.linphone.LinphoneService;
|
import org.linphone.LinphoneService;
|
||||||
|
import org.linphone.LinphoneUtils;
|
||||||
import org.linphone.R;
|
import org.linphone.R;
|
||||||
import org.linphone.compatibility.Compatibility;
|
import org.linphone.compatibility.Compatibility;
|
||||||
import org.linphone.core.Core;
|
import org.linphone.core.Core;
|
||||||
|
@ -46,8 +47,7 @@ public class KeepAliveReceiver extends BroadcastReceiver {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled();
|
boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled();
|
||||||
Factory.instance().enableLogCollection(isDebugEnabled ? LogCollectionState.Enabled : LogCollectionState.Disabled);
|
LinphoneUtils.initLoggingService(isDebugEnabled);
|
||||||
Factory.instance().setDebugMode(isDebugEnabled, context.getString(R.string.app_name));
|
|
||||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||||
if (lc == null) return;
|
if (lc == null) return;
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.linphone.LinphoneUtils;
|
||||||
import org.linphone.call.CallActivity;
|
import org.linphone.call.CallActivity;
|
||||||
import org.linphone.LinphoneManager;
|
import org.linphone.LinphoneManager;
|
||||||
import org.linphone.LinphonePreferences;
|
import org.linphone.LinphonePreferences;
|
||||||
|
@ -139,7 +140,6 @@ public class Digit extends Button implements AddressAware {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
if(which == 0){
|
if(which == 0){
|
||||||
LinphonePreferences.instance().setDebugEnabled(false);
|
LinphonePreferences.instance().setDebugEnabled(false);
|
||||||
Factory.instance().enableLogCollection(LogCollectionState.Disabled);
|
|
||||||
}
|
}
|
||||||
if(which == 1) {
|
if(which == 1) {
|
||||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||||
|
@ -155,7 +155,6 @@ public class Digit extends Button implements AddressAware {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
if(which == 0) {
|
if(which == 0) {
|
||||||
LinphonePreferences.instance().setDebugEnabled(true);
|
LinphonePreferences.instance().setDebugEnabled(true);
|
||||||
Factory.instance().enableLogCollection(LogCollectionState.Enabled);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 5290d59d769c90f18f720b07495061ba6dcbbb84
|
Subproject commit 0bf5362bf0b793eb21f533eeb65ae3e2804962f5
|
Loading…
Reference in a new issue