Added logs

This commit is contained in:
Sylvain Berfini 2019-12-04 10:53:36 +01:00
parent ac12b1a7ea
commit 82b6acff27
4 changed files with 14 additions and 20 deletions

View file

@ -21,7 +21,6 @@ package org.linphone;
import static android.content.Intent.ACTION_MAIN;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
@ -84,7 +83,6 @@ public class LinphoneContext {
private NotificationsManager mNotificationManager;
private LinphoneManager mLinphoneManager;
private ContactsManager mContactsManager;
private Class<? extends Activity> mIncomingReceivedActivity = CallIncomingActivity.class;
private final ArrayList<CoreStartedListener> mCoreStartedListeners;
public static boolean isReady() {
@ -108,15 +106,6 @@ public class LinphoneContext {
dumpDeviceInformation();
dumpLinphoneInformation();
String incomingReceivedActivityName =
LinphonePreferences.instance().getActivityToLaunchOnIncomingReceived();
try {
mIncomingReceivedActivity =
(Class<? extends Activity>) Class.forName(incomingReceivedActivityName);
} catch (ClassNotFoundException e) {
Log.e(e);
}
sInstance = this;
Log.i("[Context] Ready");
@ -195,23 +184,23 @@ public class LinphoneContext {
if (DeviceUtils.isAppUserRestricted(mContext)) {
// See https://firebase.google.com/docs/cloud-messaging/android/receive#restricted
Log.w(
"[Main Activity] Device has been restricted by user (Android 9+), push notifications won't work !");
"[Context] Device has been restricted by user (Android 9+), push notifications won't work !");
}
int bucket = DeviceUtils.getAppStandbyBucket(mContext);
if (bucket > 0) {
Log.w(
"[Main Activity] Device is in bucket "
"[Context] Device is in bucket "
+ Compatibility.getAppStandbyBucketNameFromValue(bucket));
}
if (!PushNotificationUtils.isAvailable(mContext)) {
Log.w("[Main Activity] Push notifications won't work !");
Log.w("[Context] Push notifications won't work !");
}
}
public void start(boolean isPush) {
Log.i("[Context] Starting");
Log.i("[Context] Starting, push status is ", isPush);
mLinphoneManager.startLibLinphone(isPush, mListener);
mNotificationManager.onCoreReady();
@ -226,7 +215,6 @@ public class LinphoneContext {
if (mContactsManager.hasReadContactsAccess()) {
mContactsManager.enableContactsAccess();
}
mContactsManager.initializeContactManager();
}
@ -325,7 +313,7 @@ public class LinphoneContext {
/* Call activities */
private void onIncomingReceived() {
Intent intent = new Intent().setClass(mContext, mIncomingReceivedActivity);
Intent intent = new Intent(mContext, CallIncomingActivity.class);
// This flag is required to start an Activity from a Service context
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(intent);

View file

@ -437,7 +437,7 @@ public class LinphoneManager implements SensorEventListener {
mTimer = new Timer("Linphone scheduler");
mTimer.schedule(lTask, 0, 20);
initLiblinphone();
configureCore();
} catch (Exception e) {
Log.e(e, "[Manager] Cannot start linphone");
}
@ -446,7 +446,8 @@ public class LinphoneManager implements SensorEventListener {
H264Helper.setH264Mode(H264Helper.MODE_AUTO, mCore);
}
private synchronized void initLiblinphone() {
private synchronized void configureCore() {
Log.i("[Manager] Configuring Core");
mAudioManager = new AndroidAudioManager(mContext);
mCore.setZrtpSecretsFile(mBasePath + "/zrtp_secrets");
@ -515,6 +516,8 @@ public class LinphoneManager implements SensorEventListener {
mAccountCreator = mCore.createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl());
mAccountCreator.setListener(mAccountCreatorListener);
mCallGsmON = false;
Log.i("[Manager] Core configured");
}
public void resetCameraFromPreferences() {

View file

@ -80,7 +80,10 @@ public abstract class LinphoneGenericActivity extends ThemeableActivity {
if (!LinphoneContext.isReady()) {
new LinphoneContext(getApplicationContext());
LinphoneContext.instance().start(false);
Log.i("[Generic Activity] Context created & started");
}
Log.i("[Generic Activity] Starting Service");
startService(new Intent().setClass(this, LinphoneService.class));
}
}

View file

@ -37,7 +37,7 @@ public class FirebaseMessaging extends FirebaseMessagingService {
android.util.Log.i(
"FirebaseMessaging", "[Push Notification] Starting context");
new LinphoneContext(getApplicationContext());
LinphoneContext.instance().start(false);
LinphoneContext.instance().start(true);
} else {
Log.i("[Push Notification] Notifying Core");
if (LinphoneManager.getInstance() != null) {