Updated cmakebuilder to set vCards enabled as default + rework keepalive
This commit is contained in:
parent
dad7927371
commit
6f51902be9
7 changed files with 50 additions and 90 deletions
|
@ -207,7 +207,13 @@
|
||||||
<intent-filter><action android:name="android.intent.action.PHONE_STATE" /></intent-filter>
|
<intent-filter><action android:name="android.intent.action.PHONE_STATE" /></intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<receiver android:name="KeepAliveHandler" >
|
<receiver android:name="KeepAliveReceiver">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.SCREEN_ON"></action>
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.SCREEN_OFF"></action>
|
||||||
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<!-- Needed for push notification -->
|
<!-- Needed for push notification -->
|
||||||
|
|
|
@ -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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -18,12 +18,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
package org.linphone;
|
package org.linphone;
|
||||||
|
|
||||||
|
import org.linphone.core.LinphoneCore;
|
||||||
|
import org.linphone.core.LinphoneCoreFactory;
|
||||||
import org.linphone.mediastream.Log;
|
import org.linphone.mediastream.Log;
|
||||||
|
|
||||||
|
import android.app.AlarmManager;
|
||||||
|
import android.app.PendingIntent;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.os.SystemClock;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Purpose of this receiver is to disable keep alives when screen is off
|
* Purpose of this receiver is to disable keep alives when screen is off
|
||||||
|
@ -32,13 +36,37 @@ public class KeepAliveReceiver extends BroadcastReceiver {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
if (!LinphoneService.isReady()) {
|
if (!LinphoneService.isReady()) {
|
||||||
Log.i("Keep alive broadcast received while Linphone service not ready");
|
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
if (intent.getAction().equalsIgnoreCase(Intent.ACTION_SCREEN_ON)) {
|
boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled();
|
||||||
LinphoneManager.getLc().enableKeepAlive(true);
|
LinphoneCoreFactory.instance().enableLogCollection(isDebugEnabled);
|
||||||
} else if (intent.getAction().equalsIgnoreCase(Intent.ACTION_SCREEN_OFF)) {
|
LinphoneCoreFactory.instance().setDebugMode(isDebugEnabled, context.getString(R.string.app_name));
|
||||||
LinphoneManager.getLc().enableKeepAlive(false);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,8 +38,6 @@ import java.util.TimerTask;
|
||||||
|
|
||||||
import org.linphone.compatibility.Compatibility;
|
import org.linphone.compatibility.Compatibility;
|
||||||
import org.linphone.core.CallDirection;
|
import org.linphone.core.CallDirection;
|
||||||
import org.linphone.core.OpenH264DownloadHelperAction;
|
|
||||||
import org.linphone.core.OpenH264DownloadHelperListener;
|
|
||||||
import org.linphone.core.LinphoneAddress;
|
import org.linphone.core.LinphoneAddress;
|
||||||
import org.linphone.core.LinphoneBuffer;
|
import org.linphone.core.LinphoneBuffer;
|
||||||
import org.linphone.core.LinphoneCall;
|
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.LinphoneCore.RemoteProvisioningState;
|
||||||
import org.linphone.core.LinphoneCoreException;
|
import org.linphone.core.LinphoneCoreException;
|
||||||
import org.linphone.core.LinphoneCoreFactory;
|
import org.linphone.core.LinphoneCoreFactory;
|
||||||
import org.linphone.core.LinphoneCoreFactoryImpl;
|
|
||||||
import org.linphone.core.LinphoneCoreListener;
|
import org.linphone.core.LinphoneCoreListener;
|
||||||
import org.linphone.core.LinphoneEvent;
|
import org.linphone.core.LinphoneEvent;
|
||||||
import org.linphone.core.LinphoneFriend;
|
import org.linphone.core.LinphoneFriend;
|
||||||
import org.linphone.core.LinphoneFriendList;
|
import org.linphone.core.LinphoneFriendList;
|
||||||
import org.linphone.core.LinphoneInfoMessage;
|
import org.linphone.core.LinphoneInfoMessage;
|
||||||
import org.linphone.core.LinphoneProxyConfig;
|
import org.linphone.core.LinphoneProxyConfig;
|
||||||
|
import org.linphone.core.OpenH264DownloadHelperListener;
|
||||||
import org.linphone.core.PayloadType;
|
import org.linphone.core.PayloadType;
|
||||||
import org.linphone.core.PresenceActivityType;
|
import org.linphone.core.PresenceActivityType;
|
||||||
import org.linphone.core.PresenceModel;
|
import org.linphone.core.PresenceModel;
|
||||||
|
@ -82,12 +80,8 @@ import android.annotation.TargetApi;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
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.pm.PackageManager.NameNotFoundException;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.hardware.Sensor;
|
import android.hardware.Sensor;
|
||||||
|
@ -105,8 +99,6 @@ import android.os.PowerManager;
|
||||||
import android.os.PowerManager.WakeLock;
|
import android.os.PowerManager.WakeLock;
|
||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
import android.preference.CheckBoxPreference;
|
import android.preference.CheckBoxPreference;
|
||||||
import android.provider.MediaStore;
|
|
||||||
import android.provider.MediaStore.Images;
|
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.provider.Settings.SettingNotFoundException;
|
import android.provider.Settings.SettingNotFoundException;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
|
@ -207,11 +199,8 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
private final String mErrorToneFile;
|
private final String mErrorToneFile;
|
||||||
private final String mUserCertificatePath;
|
private final String mUserCertificatePath;
|
||||||
private ByteArrayInputStream mUploadingImageStream;
|
private ByteArrayInputStream mUploadingImageStream;
|
||||||
|
|
||||||
private Timer mTimer;
|
private Timer mTimer;
|
||||||
|
|
||||||
private BroadcastReceiver mKeepAliveReceiver = new KeepAliveReceiver();
|
|
||||||
|
|
||||||
private void routeAudioToSpeakerHelper(boolean speakerOn) {
|
private void routeAudioToSpeakerHelper(boolean speakerOn) {
|
||||||
Log.w("Routing audio to " + (speakerOn ? "speaker" : "earpiece") + ", disabling bluetooth audio route");
|
Log.w("Routing audio to " + (speakerOn ? "speaker" : "earpiece") + ", disabling bluetooth audio route");
|
||||||
BluetoothManager.getInstance().disableBluetoothSCO();
|
BluetoothManager.getInstance().disableBluetoothSCO();
|
||||||
|
@ -644,11 +633,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
Log.e(e);
|
Log.e(e);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
try {
|
|
||||||
mServiceContext.unregisterReceiver(mKeepAliveReceiver);
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(e);
|
|
||||||
}
|
|
||||||
mLc = null;
|
mLc = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -656,10 +640,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
public void restartLinphoneCore() {
|
public void restartLinphoneCore() {
|
||||||
destroyLinphoneCore();
|
destroyLinphoneCore();
|
||||||
startLibLinphone(mServiceContext);
|
startLibLinphone(mServiceContext);
|
||||||
|
|
||||||
IntentFilter lFilter = new IntentFilter(Intent.ACTION_SCREEN_ON);
|
|
||||||
lFilter.addAction(Intent.ACTION_SCREEN_OFF);
|
|
||||||
mServiceContext.registerReceiver(mKeepAliveReceiver, lFilter);
|
|
||||||
|
|
||||||
sExited = false;
|
sExited = false;
|
||||||
}
|
}
|
||||||
|
@ -750,10 +730,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
Compatibility.initPushNotificationService(mServiceContext);
|
Compatibility.initPushNotificationService(mServiceContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
IntentFilter lFilter = new IntentFilter(Intent.ACTION_SCREEN_ON);
|
|
||||||
lFilter.addAction(Intent.ACTION_SCREEN_OFF);
|
|
||||||
mServiceContext.registerReceiver(mKeepAliveReceiver, lFilter);
|
|
||||||
|
|
||||||
updateNetworkReachability();
|
updateNetworkReachability();
|
||||||
|
|
||||||
if (Version.sdkAboveOrEqual(Version.API11_HONEYCOMB_30)) {
|
if (Version.sdkAboveOrEqual(Version.API11_HONEYCOMB_30)) {
|
||||||
|
@ -869,7 +845,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
Log.e(e);
|
Log.e(e);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
mServiceContext.unregisterReceiver(mKeepAliveReceiver);
|
|
||||||
mLc = null;
|
mLc = null;
|
||||||
instance = null;
|
instance = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ package org.linphone;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.Calendar;
|
||||||
|
|
||||||
import org.linphone.compatibility.Compatibility;
|
import org.linphone.compatibility.Compatibility;
|
||||||
import org.linphone.core.LinphoneAddress;
|
import org.linphone.core.LinphoneAddress;
|
||||||
|
@ -114,7 +115,6 @@ public final class LinphoneService extends Service {
|
||||||
private Notification mCustomNotif;
|
private Notification mCustomNotif;
|
||||||
private int mMsgNotifCount;
|
private int mMsgNotifCount;
|
||||||
private PendingIntent mNotifContentIntent;
|
private PendingIntent mNotifContentIntent;
|
||||||
private PendingIntent mkeepAlivePendingIntent;
|
|
||||||
private String mNotificationTitle;
|
private String mNotificationTitle;
|
||||||
private boolean mDisableRegistrationStatus;
|
private boolean mDisableRegistrationStatus;
|
||||||
private LinphoneCoreListenerBase mListener;
|
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
|
//make sure the application will at least wakes up every 10 mn
|
||||||
Intent intent = new Intent(this, KeepAliveHandler.class);
|
Intent intent = new Intent(this, KeepAliveReceiver.class);
|
||||||
mkeepAlivePendingIntent = PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_ONE_SHOT);
|
PendingIntent keepAlivePendingIntent = PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_ONE_SHOT);
|
||||||
((AlarmManager) this.getSystemService(Context.ALARM_SERVICE)).setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP
|
((AlarmManager) this.getSystemService(Context.ALARM_SERVICE)).setExact(AlarmManager.ELAPSED_REALTIME_WAKEUP
|
||||||
, SystemClock.elapsedRealtime()+600000
|
, SystemClock.elapsedRealtime() + 600000
|
||||||
, 600000
|
, keepAlivePendingIntent);
|
||||||
, mkeepAlivePendingIntent);
|
|
||||||
|
|
||||||
mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
|
mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
|
||||||
}
|
}
|
||||||
|
@ -630,7 +629,6 @@ public final class LinphoneService extends Service {
|
||||||
mNM.cancel(INCALL_NOTIF_ID);
|
mNM.cancel(INCALL_NOTIF_ID);
|
||||||
mNM.cancel(MESSAGE_NOTIF_ID);
|
mNM.cancel(MESSAGE_NOTIF_ID);
|
||||||
|
|
||||||
((AlarmManager) this.getSystemService(Context.ALARM_SERVICE)).cancel(mkeepAlivePendingIntent);
|
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 6d4281181addb913e851622e6d9b04d093c869d4
|
Subproject commit 29911ee5ba6053dd041ee02c6dc13b0134e890d2
|
2
submodules/externals/sqlite3/CMakeLists.txt
vendored
2
submodules/externals/sqlite3/CMakeLists.txt
vendored
|
@ -16,7 +16,7 @@
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# 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.
|
||||||
#
|
#
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue