Move some things from MainActivity to LinphoneContext to prevent log pollution
This commit is contained in:
parent
ba6a3c70bb
commit
8226b53a2d
2 changed files with 19 additions and 18 deletions
|
@ -45,7 +45,9 @@ import org.linphone.core.tools.Log;
|
||||||
import org.linphone.mediastream.Version;
|
import org.linphone.mediastream.Version;
|
||||||
import org.linphone.notifications.NotificationsManager;
|
import org.linphone.notifications.NotificationsManager;
|
||||||
import org.linphone.settings.LinphonePreferences;
|
import org.linphone.settings.LinphonePreferences;
|
||||||
|
import org.linphone.utils.DeviceUtils;
|
||||||
import org.linphone.utils.LinphoneUtils;
|
import org.linphone.utils.LinphoneUtils;
|
||||||
|
import org.linphone.utils.PushNotificationUtils;
|
||||||
|
|
||||||
public class LinphoneContext {
|
public class LinphoneContext {
|
||||||
private static LinphoneContext sInstance = null;
|
private static LinphoneContext sInstance = null;
|
||||||
|
@ -188,6 +190,23 @@ public class LinphoneContext {
|
||||||
|
|
||||||
mLinphoneManager = new LinphoneManager(context);
|
mLinphoneManager = new LinphoneManager(context);
|
||||||
mNotificationManager = new NotificationsManager(context);
|
mNotificationManager = new NotificationsManager(context);
|
||||||
|
|
||||||
|
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 !");
|
||||||
|
}
|
||||||
|
|
||||||
|
int bucket = DeviceUtils.getAppStandbyBucket(mContext);
|
||||||
|
if (bucket > 0) {
|
||||||
|
Log.w(
|
||||||
|
"[Main Activity] Device is in bucket "
|
||||||
|
+ Compatibility.getAppStandbyBucketNameFromValue(bucket));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!PushNotificationUtils.isAvailable(mContext)) {
|
||||||
|
Log.w("[Main Activity] Push notifications won't work !");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start(boolean isPush) {
|
public void start(boolean isPush) {
|
||||||
|
|
|
@ -73,7 +73,6 @@ import org.linphone.settings.LinphonePreferences;
|
||||||
import org.linphone.settings.SettingsActivity;
|
import org.linphone.settings.SettingsActivity;
|
||||||
import org.linphone.utils.DeviceUtils;
|
import org.linphone.utils.DeviceUtils;
|
||||||
import org.linphone.utils.LinphoneUtils;
|
import org.linphone.utils.LinphoneUtils;
|
||||||
import org.linphone.utils.PushNotificationUtils;
|
|
||||||
|
|
||||||
public abstract class MainActivity extends LinphoneGenericActivity
|
public abstract class MainActivity extends LinphoneGenericActivity
|
||||||
implements StatusBarFragment.MenuClikedListener, SideMenuFragment.QuitClikedListener {
|
implements StatusBarFragment.MenuClikedListener, SideMenuFragment.QuitClikedListener {
|
||||||
|
@ -275,23 +274,6 @@ public abstract class MainActivity extends LinphoneGenericActivity
|
||||||
super.onStart();
|
super.onStart();
|
||||||
|
|
||||||
requestRequiredPermissions();
|
requestRequiredPermissions();
|
||||||
|
|
||||||
if (DeviceUtils.isAppUserRestricted(this)) {
|
|
||||||
// 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 !");
|
|
||||||
}
|
|
||||||
|
|
||||||
int bucket = DeviceUtils.getAppStandbyBucket(this);
|
|
||||||
if (bucket > 0) {
|
|
||||||
Log.w(
|
|
||||||
"[Main Activity] Device is in bucket "
|
|
||||||
+ Compatibility.getAppStandbyBucketNameFromValue(bucket));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!PushNotificationUtils.isAvailable(this)) {
|
|
||||||
Log.w("[Main Activity] Push notifications won't work !");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue