diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index d649a1660..12556e399 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -122,7 +122,8 @@
-
+
+
diff --git a/src/org/linphone/KeepAliveReceiver.java b/src/org/linphone/KeepAliveReceiver.java
index ed5c9b980..321953df1 100644
--- a/src/org/linphone/KeepAliveReceiver.java
+++ b/src/org/linphone/KeepAliveReceiver.java
@@ -25,7 +25,9 @@ import android.content.Context;
import android.content.Intent;
-
+/*
+ * Purpose of this receiver is to disable keep alives when screen is off
+ * */
public class KeepAliveReceiver extends BroadcastReceiver {
@Override
diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java
index 03ecb2e99..9e3a033fb 100644
--- a/src/org/linphone/LinphoneManager.java
+++ b/src/org/linphone/LinphoneManager.java
@@ -576,7 +576,8 @@ public final class LinphoneManager implements LinphoneCoreListener {
mLc.iterate();
}
};
- mTimer.scheduleAtFixedRate(lTask, 0, 20);
+ /*use schedule instead of scheduleAtFixedRate to avoid iterate from being call in burst after cpu wake up*/
+ mTimer.schedule(lTask, 0, 20);
IntentFilter lFilter = new IntentFilter(Intent.ACTION_SCREEN_ON);
lFilter.addAction(Intent.ACTION_SCREEN_OFF);
diff --git a/src/org/linphone/LinphoneService.java b/src/org/linphone/LinphoneService.java
index 257ea0b35..8a2b46486 100644
--- a/src/org/linphone/LinphoneService.java
+++ b/src/org/linphone/LinphoneService.java
@@ -40,6 +40,7 @@ import org.linphone.mediastream.Log;
import org.linphone.mediastream.Version;
import android.app.Activity;
+import android.app.AlarmManager;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
@@ -58,6 +59,7 @@ import android.net.wifi.WifiManager.WifiLock;
import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
+import android.os.SystemClock;
import android.preference.PreferenceManager;
import android.provider.MediaStore;
@@ -112,6 +114,7 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
private Notification mCustomNotif;
private int mMsgNotifCount;
private PendingIntent mNotifContentIntent;
+ private PendingIntent mkeepAlivePendingIntent;
private String mNotificationTitle;
@@ -198,6 +201,13 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
}
LinphoneManager.getLc().setPresenceInfo(0, "", OnlineStatus.Online);
+ //make sure the application will at least wakes up every 10 mn
+ Intent intent = new Intent(this, KeepAliveHandler.class);
+ mkeepAlivePendingIntent = PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_ONE_SHOT);
+ ((AlarmManager) this.getSystemService(Context.ALARM_SERVICE)).setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP
+ , SystemClock.elapsedRealtime()+600000
+ , 600000
+ , mkeepAlivePendingIntent);
}
private enum IncallIconState {INCALL, PAUSE, VIDEO, IDLE}
@@ -474,6 +484,7 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
mNM.cancel(INCALL_NOTIF_ID);
mNM.cancel(MESSAGE_NOTIF_ID);
mWifiLock.release();
+ ((AlarmManager) this.getSystemService(Context.ALARM_SERVICE)).cancel(mkeepAlivePendingIntent);
super.onDestroy();
}
diff --git a/submodules/belle-sip b/submodules/belle-sip
index ecfff5f64..43ad4169d 160000
--- a/submodules/belle-sip
+++ b/submodules/belle-sip
@@ -1 +1 @@
-Subproject commit ecfff5f64d95723ed194bae09b96509aeb778159
+Subproject commit 43ad4169d316649ed2e31eba1f9b19792d5cc492