Added logs
This commit is contained in:
parent
ac12b1a7ea
commit
82b6acff27
4 changed files with 14 additions and 20 deletions
|
@ -21,7 +21,6 @@ package org.linphone;
|
||||||
|
|
||||||
import static android.content.Intent.ACTION_MAIN;
|
import static android.content.Intent.ACTION_MAIN;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
@ -84,7 +83,6 @@ public class LinphoneContext {
|
||||||
private NotificationsManager mNotificationManager;
|
private NotificationsManager mNotificationManager;
|
||||||
private LinphoneManager mLinphoneManager;
|
private LinphoneManager mLinphoneManager;
|
||||||
private ContactsManager mContactsManager;
|
private ContactsManager mContactsManager;
|
||||||
private Class<? extends Activity> mIncomingReceivedActivity = CallIncomingActivity.class;
|
|
||||||
private final ArrayList<CoreStartedListener> mCoreStartedListeners;
|
private final ArrayList<CoreStartedListener> mCoreStartedListeners;
|
||||||
|
|
||||||
public static boolean isReady() {
|
public static boolean isReady() {
|
||||||
|
@ -108,15 +106,6 @@ public class LinphoneContext {
|
||||||
dumpDeviceInformation();
|
dumpDeviceInformation();
|
||||||
dumpLinphoneInformation();
|
dumpLinphoneInformation();
|
||||||
|
|
||||||
String incomingReceivedActivityName =
|
|
||||||
LinphonePreferences.instance().getActivityToLaunchOnIncomingReceived();
|
|
||||||
try {
|
|
||||||
mIncomingReceivedActivity =
|
|
||||||
(Class<? extends Activity>) Class.forName(incomingReceivedActivityName);
|
|
||||||
} catch (ClassNotFoundException e) {
|
|
||||||
Log.e(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
sInstance = this;
|
sInstance = this;
|
||||||
Log.i("[Context] Ready");
|
Log.i("[Context] Ready");
|
||||||
|
|
||||||
|
@ -195,23 +184,23 @@ public class LinphoneContext {
|
||||||
if (DeviceUtils.isAppUserRestricted(mContext)) {
|
if (DeviceUtils.isAppUserRestricted(mContext)) {
|
||||||
// See https://firebase.google.com/docs/cloud-messaging/android/receive#restricted
|
// See https://firebase.google.com/docs/cloud-messaging/android/receive#restricted
|
||||||
Log.w(
|
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);
|
int bucket = DeviceUtils.getAppStandbyBucket(mContext);
|
||||||
if (bucket > 0) {
|
if (bucket > 0) {
|
||||||
Log.w(
|
Log.w(
|
||||||
"[Main Activity] Device is in bucket "
|
"[Context] Device is in bucket "
|
||||||
+ Compatibility.getAppStandbyBucketNameFromValue(bucket));
|
+ Compatibility.getAppStandbyBucketNameFromValue(bucket));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!PushNotificationUtils.isAvailable(mContext)) {
|
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) {
|
public void start(boolean isPush) {
|
||||||
Log.i("[Context] Starting");
|
Log.i("[Context] Starting, push status is ", isPush);
|
||||||
mLinphoneManager.startLibLinphone(isPush, mListener);
|
mLinphoneManager.startLibLinphone(isPush, mListener);
|
||||||
|
|
||||||
mNotificationManager.onCoreReady();
|
mNotificationManager.onCoreReady();
|
||||||
|
@ -226,7 +215,6 @@ public class LinphoneContext {
|
||||||
if (mContactsManager.hasReadContactsAccess()) {
|
if (mContactsManager.hasReadContactsAccess()) {
|
||||||
mContactsManager.enableContactsAccess();
|
mContactsManager.enableContactsAccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
mContactsManager.initializeContactManager();
|
mContactsManager.initializeContactManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,7 +313,7 @@ public class LinphoneContext {
|
||||||
/* Call activities */
|
/* Call activities */
|
||||||
|
|
||||||
private void onIncomingReceived() {
|
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
|
// This flag is required to start an Activity from a Service context
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
mContext.startActivity(intent);
|
mContext.startActivity(intent);
|
||||||
|
|
|
@ -437,7 +437,7 @@ public class LinphoneManager implements SensorEventListener {
|
||||||
mTimer = new Timer("Linphone scheduler");
|
mTimer = new Timer("Linphone scheduler");
|
||||||
mTimer.schedule(lTask, 0, 20);
|
mTimer.schedule(lTask, 0, 20);
|
||||||
|
|
||||||
initLiblinphone();
|
configureCore();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(e, "[Manager] Cannot start linphone");
|
Log.e(e, "[Manager] Cannot start linphone");
|
||||||
}
|
}
|
||||||
|
@ -446,7 +446,8 @@ public class LinphoneManager implements SensorEventListener {
|
||||||
H264Helper.setH264Mode(H264Helper.MODE_AUTO, mCore);
|
H264Helper.setH264Mode(H264Helper.MODE_AUTO, mCore);
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void initLiblinphone() {
|
private synchronized void configureCore() {
|
||||||
|
Log.i("[Manager] Configuring Core");
|
||||||
mAudioManager = new AndroidAudioManager(mContext);
|
mAudioManager = new AndroidAudioManager(mContext);
|
||||||
|
|
||||||
mCore.setZrtpSecretsFile(mBasePath + "/zrtp_secrets");
|
mCore.setZrtpSecretsFile(mBasePath + "/zrtp_secrets");
|
||||||
|
@ -515,6 +516,8 @@ public class LinphoneManager implements SensorEventListener {
|
||||||
mAccountCreator = mCore.createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl());
|
mAccountCreator = mCore.createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl());
|
||||||
mAccountCreator.setListener(mAccountCreatorListener);
|
mAccountCreator.setListener(mAccountCreatorListener);
|
||||||
mCallGsmON = false;
|
mCallGsmON = false;
|
||||||
|
|
||||||
|
Log.i("[Manager] Core configured");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetCameraFromPreferences() {
|
public void resetCameraFromPreferences() {
|
||||||
|
|
|
@ -80,7 +80,10 @@ public abstract class LinphoneGenericActivity extends ThemeableActivity {
|
||||||
if (!LinphoneContext.isReady()) {
|
if (!LinphoneContext.isReady()) {
|
||||||
new LinphoneContext(getApplicationContext());
|
new LinphoneContext(getApplicationContext());
|
||||||
LinphoneContext.instance().start(false);
|
LinphoneContext.instance().start(false);
|
||||||
|
Log.i("[Generic Activity] Context created & started");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.i("[Generic Activity] Starting Service");
|
||||||
startService(new Intent().setClass(this, LinphoneService.class));
|
startService(new Intent().setClass(this, LinphoneService.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class FirebaseMessaging extends FirebaseMessagingService {
|
||||||
android.util.Log.i(
|
android.util.Log.i(
|
||||||
"FirebaseMessaging", "[Push Notification] Starting context");
|
"FirebaseMessaging", "[Push Notification] Starting context");
|
||||||
new LinphoneContext(getApplicationContext());
|
new LinphoneContext(getApplicationContext());
|
||||||
LinphoneContext.instance().start(false);
|
LinphoneContext.instance().start(true);
|
||||||
} else {
|
} else {
|
||||||
Log.i("[Push Notification] Notifying Core");
|
Log.i("[Push Notification] Notifying Core");
|
||||||
if (LinphoneManager.getInstance() != null) {
|
if (LinphoneManager.getInstance() != null) {
|
||||||
|
|
Loading…
Reference in a new issue