diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 909529b19..59f557074 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -207,7 +207,13 @@
-
+
+
+
+
+
+
+
diff --git a/src/org/linphone/KeepAliveHandler.java b/src/org/linphone/KeepAliveHandler.java
deleted file mode 100644
index 9812248f6..000000000
--- a/src/org/linphone/KeepAliveHandler.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.linphone;
-/*
-KeepAliveHandler.java
-Copyright (C) 2013 Belledonne Communications, Grenoble, France
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-import org.linphone.core.LinphoneCoreFactory;
-import org.linphone.mediastream.Log;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-
-public class KeepAliveHandler extends BroadcastReceiver {
- @Override
- public void onReceive(Context context, Intent intent) {
- boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled();
- LinphoneCoreFactory.instance().enableLogCollection(isDebugEnabled);
- LinphoneCoreFactory.instance().setDebugMode(isDebugEnabled, context.getString(R.string.app_name));
-
- Log.i("Keep alive handler invoked");
- if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null) {
- //first refresh registers
- LinphoneManager.getLc().refreshRegisters();
- //make sure iterate will have enough time, device will not sleep until exit from this method
- try {
- Thread.sleep(2000);
- } catch (InterruptedException e) {
- //Log.e("Cannot sleep for 2s", e); //TODO FIXME Crash since the log rework
- }
- }
- }
-}
diff --git a/src/org/linphone/KeepAliveReceiver.java b/src/org/linphone/KeepAliveReceiver.java
index 7c104f578..bc78137e4 100644
--- a/src/org/linphone/KeepAliveReceiver.java
+++ b/src/org/linphone/KeepAliveReceiver.java
@@ -18,12 +18,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package org.linphone;
+import org.linphone.core.LinphoneCore;
+import org.linphone.core.LinphoneCoreFactory;
import org.linphone.mediastream.Log;
+import android.app.AlarmManager;
+import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
-
+import android.os.SystemClock;
/*
* Purpose of this receiver is to disable keep alives when screen is off
@@ -32,13 +36,37 @@ public class KeepAliveReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (!LinphoneService.isReady()) {
- Log.i("Keep alive broadcast received while Linphone service not ready");
return;
} else {
- if (intent.getAction().equalsIgnoreCase(Intent.ACTION_SCREEN_ON)) {
- LinphoneManager.getLc().enableKeepAlive(true);
- } else if (intent.getAction().equalsIgnoreCase(Intent.ACTION_SCREEN_OFF)) {
- LinphoneManager.getLc().enableKeepAlive(false);
+ boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled();
+ LinphoneCoreFactory.instance().enableLogCollection(isDebugEnabled);
+ LinphoneCoreFactory.instance().setDebugMode(isDebugEnabled, context.getString(R.string.app_name));
+ LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
+ if (lc == null) return;
+
+ String action = intent.getAction();
+ if (action == null) {
+ Log.i("[KeepAlive] Refresh registers");
+ lc.refreshRegisters();
+ //make sure iterate will have enough time, device will not sleep until exit from this method
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+ Log.e("Cannot sleep for 2s", e);
+ } finally {
+ //make sure the application will at least wakes up every 10 mn
+ Intent newIntent = new Intent(context, KeepAliveReceiver.class);
+ PendingIntent keepAlivePendingIntent = PendingIntent.getBroadcast(context, 0, newIntent, PendingIntent.FLAG_ONE_SHOT);
+ ((AlarmManager) context.getSystemService(Context.ALARM_SERVICE)).setExact(AlarmManager.ELAPSED_REALTIME_WAKEUP
+ , SystemClock.elapsedRealtime() + 600000
+ , keepAlivePendingIntent);
+ }
+ } else if (action.equalsIgnoreCase(Intent.ACTION_SCREEN_ON)) {
+ Log.i("[KeepAlive] Screen is on, enable");
+ lc.enableKeepAlive(true);
+ } else if (action.equalsIgnoreCase(Intent.ACTION_SCREEN_OFF)) {
+ Log.i("[KeepAlive] Screen is off, disable");
+ lc.enableKeepAlive(false);
}
}
}
diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java
index 6d6056045..739387310 100644
--- a/src/org/linphone/LinphoneManager.java
+++ b/src/org/linphone/LinphoneManager.java
@@ -38,8 +38,6 @@ import java.util.TimerTask;
import org.linphone.compatibility.Compatibility;
import org.linphone.core.CallDirection;
-import org.linphone.core.OpenH264DownloadHelperAction;
-import org.linphone.core.OpenH264DownloadHelperListener;
import org.linphone.core.LinphoneAddress;
import org.linphone.core.LinphoneBuffer;
import org.linphone.core.LinphoneCall;
@@ -57,13 +55,13 @@ import org.linphone.core.LinphoneCore.RegistrationState;
import org.linphone.core.LinphoneCore.RemoteProvisioningState;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphoneCoreFactory;
-import org.linphone.core.LinphoneCoreFactoryImpl;
import org.linphone.core.LinphoneCoreListener;
import org.linphone.core.LinphoneEvent;
import org.linphone.core.LinphoneFriend;
import org.linphone.core.LinphoneFriendList;
import org.linphone.core.LinphoneInfoMessage;
import org.linphone.core.LinphoneProxyConfig;
+import org.linphone.core.OpenH264DownloadHelperListener;
import org.linphone.core.PayloadType;
import org.linphone.core.PresenceActivityType;
import org.linphone.core.PresenceModel;
@@ -82,12 +80,8 @@ import android.annotation.TargetApi;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
-import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.IntentFilter;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Resources;
import android.hardware.Sensor;
@@ -105,8 +99,6 @@ import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.os.Vibrator;
import android.preference.CheckBoxPreference;
-import android.provider.MediaStore;
-import android.provider.MediaStore.Images;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.telephony.TelephonyManager;
@@ -207,11 +199,8 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
private final String mErrorToneFile;
private final String mUserCertificatePath;
private ByteArrayInputStream mUploadingImageStream;
-
private Timer mTimer;
- private BroadcastReceiver mKeepAliveReceiver = new KeepAliveReceiver();
-
private void routeAudioToSpeakerHelper(boolean speakerOn) {
Log.w("Routing audio to " + (speakerOn ? "speaker" : "earpiece") + ", disabling bluetooth audio route");
BluetoothManager.getInstance().disableBluetoothSCO();
@@ -644,11 +633,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
Log.e(e);
}
finally {
- try {
- mServiceContext.unregisterReceiver(mKeepAliveReceiver);
- } catch (Exception e) {
- Log.e(e);
- }
mLc = null;
}
}
@@ -656,10 +640,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
public void restartLinphoneCore() {
destroyLinphoneCore();
startLibLinphone(mServiceContext);
-
- IntentFilter lFilter = new IntentFilter(Intent.ACTION_SCREEN_ON);
- lFilter.addAction(Intent.ACTION_SCREEN_OFF);
- mServiceContext.registerReceiver(mKeepAliveReceiver, lFilter);
sExited = false;
}
@@ -750,10 +730,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
Compatibility.initPushNotificationService(mServiceContext);
}
- IntentFilter lFilter = new IntentFilter(Intent.ACTION_SCREEN_ON);
- lFilter.addAction(Intent.ACTION_SCREEN_OFF);
- mServiceContext.registerReceiver(mKeepAliveReceiver, lFilter);
-
updateNetworkReachability();
if (Version.sdkAboveOrEqual(Version.API11_HONEYCOMB_30)) {
@@ -869,7 +845,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
Log.e(e);
}
finally {
- mServiceContext.unregisterReceiver(mKeepAliveReceiver);
mLc = null;
instance = null;
}
diff --git a/src/org/linphone/LinphoneService.java b/src/org/linphone/LinphoneService.java
index 402e29fde..5e7743a27 100644
--- a/src/org/linphone/LinphoneService.java
+++ b/src/org/linphone/LinphoneService.java
@@ -20,6 +20,7 @@ package org.linphone;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.util.Calendar;
import org.linphone.compatibility.Compatibility;
import org.linphone.core.LinphoneAddress;
@@ -114,7 +115,6 @@ public final class LinphoneService extends Service {
private Notification mCustomNotif;
private int mMsgNotifCount;
private PendingIntent mNotifContentIntent;
- private PendingIntent mkeepAlivePendingIntent;
private String mNotificationTitle;
private boolean mDisableRegistrationStatus;
private LinphoneCoreListenerBase mListener;
@@ -287,12 +287,11 @@ public final class LinphoneService extends Service {
}
//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);
+ Intent intent = new Intent(this, KeepAliveReceiver.class);
+ PendingIntent keepAlivePendingIntent = PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_ONE_SHOT);
+ ((AlarmManager) this.getSystemService(Context.ALARM_SERVICE)).setExact(AlarmManager.ELAPSED_REALTIME_WAKEUP
+ , SystemClock.elapsedRealtime() + 600000
+ , keepAlivePendingIntent);
mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
}
@@ -630,7 +629,6 @@ public final class LinphoneService extends Service {
mNM.cancel(INCALL_NOTIF_ID);
mNM.cancel(MESSAGE_NOTIF_ID);
- ((AlarmManager) this.getSystemService(Context.ALARM_SERVICE)).cancel(mkeepAlivePendingIntent);
super.onDestroy();
}
diff --git a/submodules/cmake-builder b/submodules/cmake-builder
index 6d4281181..29911ee5b 160000
--- a/submodules/cmake-builder
+++ b/submodules/cmake-builder
@@ -1 +1 @@
-Subproject commit 6d4281181addb913e851622e6d9b04d093c869d4
+Subproject commit 29911ee5ba6053dd041ee02c6dc13b0134e890d2
diff --git a/submodules/externals/sqlite3/CMakeLists.txt b/submodules/externals/sqlite3/CMakeLists.txt
index 8c722641d..28a7b381c 100644
--- a/submodules/externals/sqlite3/CMakeLists.txt
+++ b/submodules/externals/sqlite3/CMakeLists.txt
@@ -16,7 +16,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
############################################################################