Merge branch 'master' into dev_group_chat

This commit is contained in:
Sylvain Berfini 2018-01-09 14:53:12 +01:00
commit 69b377f81f
9 changed files with 108 additions and 48 deletions

View file

@ -2,8 +2,8 @@
<manifest package="org.linphone"
xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="auto"
android:versionCode="3303"
android:versionName="3.3.0">
android:versionCode="3311"
android:versionName="3.3.1">
<uses-sdk
android:minSdkVersion="16"

View file

@ -2,8 +2,8 @@
<manifest package="org.linphone.core"
xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="auto"
android:versionCode="3303"
android:versionName="3.3.0">
android:versionCode="3311"
android:versionName="3.3.1">
<uses-sdk
android:minSdkVersion="16"

View file

@ -8,7 +8,7 @@ Linphone is a free VoIP and video softphone based on the SIP protocol.
2. Download the Android ndk (version r11c or 15) from google and add it to your path (no symlink !!!) and ANDROID_NDK environment variable.
3. Install _yasm_, _nasm_, _ant_, _python_, _intltoolize_, _cmake(3.7)_ and _vim-common_.
3. Install _yasm_, _nasm_ (For OpenH224 support only), _python_, _pkg_config_ and _cmake(>=3.7)_.
* On 64 bits linux systems you'll need the _ia32-libs_ package.
* With the latest Debian (multiarch), you need this:
* `dpkg --add-architecture i386`

View file

@ -293,10 +293,12 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
} else {
progress.dismiss();
progress = null;
LinphoneManager.getLc().reloadMsPlugins(LinphoneManager.this.getContext().getApplicationInfo().nativeLibraryDir);
if (ohcodec.getUserDataSize() > box && ohcodec.getUserData(box) != null) {
((CheckBoxPreference) ohcodec.getUserData(box)).setSummary(mCodecDownloader.getLicenseMessage());
((CheckBoxPreference) ohcodec.getUserData(box)).setTitle("OpenH264");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
LinphoneManager.getLc().reloadMsPlugins(AssistantActivity.instance().getApplicationInfo().nativeLibraryDir);
AssistantActivity.instance().endDownloadCodec();
} else {
// We need to restart due to bad android linker
AssistantActivity.instance().restartApplication();
}
}
}
@ -348,9 +350,6 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
// H264 codec Management - set to auto mode -> MediaCodec >= android 5.0 >= OpenH264
H264Helper.setH264Mode(H264Helper.MODE_AUTO, getLc());
TelephonyManager tm = (TelephonyManager) c.getSystemService(Context.TELEPHONY_SERVICE);
boolean gsmIdle = tm.getCallState() == TelephonyManager.CALL_STATE_IDLE;
setGsmIdle(gsmIdle);
return instance;
}
@ -1135,33 +1134,6 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
}
}
private int savedMaxCallWhileGsmIncall;
private synchronized void preventSIPCalls() {
if (savedMaxCallWhileGsmIncall != 0) {
Log.w("SIP calls are already blocked due to GSM call running");
return;
}
savedMaxCallWhileGsmIncall = mLc.getMaxCalls();
mLc.setMaxCalls(0);
}
private synchronized void allowSIPCalls() {
if (savedMaxCallWhileGsmIncall == 0) {
Log.w("SIP calls are already allowed as no GSM call known to be running");
return;
}
mLc.setMaxCalls(savedMaxCallWhileGsmIncall);
savedMaxCallWhileGsmIncall = 0;
}
public static void setGsmIdle(boolean gsmIdle) {
LinphoneManager mThis = instance;
if (mThis == null) return;
if (gsmIdle) {
mThis.allowSIPCalls();
} else {
mThis.preventSIPCalls();
}
}
public Context getContext() {
try {
if (LinphoneActivity.isInstanciated())

View file

@ -532,8 +532,8 @@ public class LinphonePreferences {
String domain = getAccountDomain(n);
String userid = null;
String realm = null;
if(user != null && domain != null) {
if (LinphoneManager.getLc().getAuthInfoList().length >= n && LinphoneManager.getLc().getAuthInfoList()[n] != null) {
if (user != null && domain != null) {
if (LinphoneManager.getLc().getAuthInfoList().length > n && LinphoneManager.getLc().getAuthInfoList()[n] != null) {
userid = getAccountUserId(n);
realm = getAccountRealm(n);
LinphoneManager.getLc().removeAuthInfo(LinphoneManager.getLc().getAuthInfoList()[n]);

View file

@ -24,7 +24,10 @@ import android.app.Activity;
import android.app.Dialog;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.res.Resources;
@ -119,6 +122,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
private boolean isVideoCallPaused = false;
private Dialog dialog = null;
private static long TimeRemind = 0;
private HeadsetReceiver headsetReceiver;
private LinearLayout callsList, conferenceList;
private LayoutInflater inflater;
@ -133,6 +137,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
private HashMap<String, String> mEncoderTexts;
private HashMap<String, String> mDecoderTexts;
private boolean oldIsSpeakerEnabled = false;
public static CallActivity instance() {
return instance;
}
@ -153,6 +159,12 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
setContentView(R.layout.call);
//Earset Connectivity Broadcast Processing
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("android.intent.action.HEADSET_PLUG");
headsetReceiver = new HeadsetReceiver();
registerReceiver(headsetReceiver, intentFilter);
isTransferAllowed = getApplicationContext().getResources().getBoolean(R.bool.allow_transfers);
cameraNumber = AndroidCameraConfiguration.retrieveCameras().length;
@ -1247,6 +1259,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
LinphoneManager.getInstance().changeStatusToOnline();
LinphoneManager.getInstance().enableProximitySensing(false);
unregisterReceiver(headsetReceiver);
if (mControlsHandler != null && mControls != null) {
mControlsHandler.removeCallbacks(mControls);
}
@ -1749,4 +1763,31 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
};
mTimer.scheduleAtFixedRate(mTask, 0, 1000);
}
////Earset Connectivity Broadcast innerClass
public class HeadsetReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (!BluetoothManager.getInstance().isBluetoothHeadsetAvailable()) {
if (intent.hasExtra("state")) {
switch (intent.getIntExtra("state", 0)) {
case 0:
if (oldIsSpeakerEnabled) {
LinphoneManager.getInstance().routeAudioToSpeaker();
isSpeakerEnabled = true;
speaker.setEnabled(true);
}
break;
case 1:
LinphoneManager.getInstance().routeAudioToReceiver();
oldIsSpeakerEnabled = isSpeakerEnabled;
isSpeakerEnabled = false;
speaker.setEnabled(false);
break;
}
refreshInCallActions();
}
}
}
}
}

View file

@ -680,6 +680,31 @@ public class SettingsFragment extends PreferencesListFragment {
echoCancellerCalibration.setSummary(R.string.failed);
}
private void initOpenH264AlertDialog(final OpenH264DownloadHelper mCodecDownloader, final CheckBoxPreference codec) {
mCodecDownloader.setOpenH264HelperListener(LinphoneManager.getInstance().getOpenH264HelperListener());
mCodecDownloader.setUserData(0, LinphoneManager.getInstance().getContext());
mCodecDownloader.setUserData(1, codec);
AlertDialog.Builder builder = new AlertDialog.Builder(LinphoneManager.getInstance().getContext());
builder.setCancelable(false);
builder.setMessage("Do you agree to download " + mCodecDownloader.getLicenseMessage()).setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (which == DialogInterface.BUTTON_POSITIVE)
mCodecDownloader.downloadCodec();
}
});
builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (which == DialogInterface.BUTTON_NEGATIVE) {
// Disable H264
codec.setChecked(false);
}
}
}).show();
}
private void initVideoSettings() {
initializePreferredVideoSizePreferences((ListPreference) findPreference(getString(R.string.pref_preferred_video_size_key)));
initializePreferredVideoFpsPreferences((ListPreference) findPreference(getString(R.string.pref_preferred_video_fps_key)));
@ -699,6 +724,7 @@ public class SettingsFragment extends PreferencesListFragment {
final OpenH264DownloadHelper mCodecDownloader = LinphoneManager.getInstance().getOpenH264DownloadHelper();
boolean h264IsHere = false;
for (final PayloadType pt : lc.getVideoPayloadTypes()) {
final CheckBoxPreference codec = new CheckBoxPreference(getActivity());
codec.setTitle(pt.getMimeType());
@ -707,20 +733,20 @@ public class SettingsFragment extends PreferencesListFragment {
if (getResources().getBoolean(R.bool.disable_all_patented_codecs_for_markets)) {
continue;
} else {
if (!Version.hasFastCpuWithAsmOptim() && pt.getMimeType().equals("H264"))
{
if (!Version.hasFastCpuWithAsmOptim() && pt.getMimeType().equals("H264")) {
// Android without neon doesn't support H264
Log.w("CPU does not have asm optimisations available, disabling H264");
continue;
}
}
}
if (OpenH264DownloadHelper.isOpenH264DownloadEnabled()) {
if (pt.getMimeType().equals("H264") && mCodecDownloader.isCodecFound()) {
} else if (pt.getMimeType().equals("H264")) {
h264IsHere = true;
if (OpenH264DownloadHelper.isOpenH264DownloadEnabled() && mCodecDownloader.isCodecFound()) {
codec.setSummary(mCodecDownloader.getLicenseMessage());
codec.setTitle("OpenH264");
}
}
codec.setDefaultValue(pt.enabled());
codec.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@ -760,6 +786,27 @@ public class SettingsFragment extends PreferencesListFragment {
codecs.addPreference(codec);
}
// Adding OpenH264 button on device < 5.1
if (mCodecDownloader.isOpenH264DownloadEnabled() && !h264IsHere) {
final CheckBoxPreference codec = new CheckBoxPreference(getActivity());
codec.setTitle("OpenH264");
codec.setSummary(mCodecDownloader.getLicenseMessage());
//codec.setEnabled(false);
codec.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
boolean enable = (Boolean) newValue;
if (mCodecDownloader.isOpenH264DownloadEnabled()) {
if (enable && Version.getCpuAbis().contains("armeabi-v7a") && !Version.getCpuAbis().contains("x86")
&& !mCodecDownloader.isCodecFound()) {
initOpenH264AlertDialog(mCodecDownloader, codec);
}
}
return true;
}
});
codecs.addPreference(codec);
}
((CheckBoxPreference) findPreference(getString(R.string.pref_video_enable_key))).setChecked(mPrefs.isVideoEnabled());
((CheckBoxPreference) findPreference(getString(R.string.pref_video_use_front_camera_key))).setChecked(mPrefs.useFrontCam());
((CheckBoxPreference) findPreference(getString(R.string.pref_video_initiate_call_with_video_key))).setChecked(mPrefs.shouldInitiateVideoCall());

@ -1 +1 @@
Subproject commit 18b41c2569ea76b8eb1df9f85a32f16b3d001cc0
Subproject commit e7722332645b324dfc6aba3e94ab71750a3c0fd7

@ -1 +1 @@
Subproject commit 3a22b8d31c43a3a4e1e4985b5a6bbec7b03972bf
Subproject commit 1df2129d373c4752929f2d0ae834dbdeb4855170