Update linphone
This commit is contained in:
parent
f59cf99caa
commit
0b0f90f798
5 changed files with 34 additions and 55 deletions
|
@ -145,7 +145,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
private LinphoneCore mLc;
|
private LinphoneCore mLc;
|
||||||
private OpenH264DownloadHelper mCodecDownloader;
|
private OpenH264DownloadHelper mCodecDownloader;
|
||||||
private OpenH264DownloadHelperListener mCodecListener;
|
private OpenH264DownloadHelperListener mCodecListener;
|
||||||
private OpenH264DownloadHelperAction mCodecAction;
|
|
||||||
private String lastLcStatusMessage;
|
private String lastLcStatusMessage;
|
||||||
private String basePath;
|
private String basePath;
|
||||||
private static boolean sExited;
|
private static boolean sExited;
|
||||||
|
@ -193,7 +192,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
mConnectivityManager = (ConnectivityManager) c.getSystemService(Context.CONNECTIVITY_SERVICE);
|
mConnectivityManager = (ConnectivityManager) c.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
mR = c.getResources();
|
mR = c.getResources();
|
||||||
mPendingChatFileMessage = new ArrayList<LinphoneChatMessage>();
|
mPendingChatFileMessage = new ArrayList<LinphoneChatMessage>();
|
||||||
initOpenH264Helper();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int LINPHONE_VOLUME_STREAM = STREAM_VOICE_CALL;
|
private static final int LINPHONE_VOLUME_STREAM = STREAM_VOICE_CALL;
|
||||||
|
@ -225,7 +223,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initOpenH264Helper() {
|
public void initOpenH264Helper() {
|
||||||
mCodecDownloader = new OpenH264DownloadHelper();
|
mCodecDownloader = LinphoneCoreFactory.instance().createOpenH264DownloadHelper();
|
||||||
mCodecListener = new OpenH264DownloadHelperListener() {
|
mCodecListener = new OpenH264DownloadHelperListener() {
|
||||||
ProgressDialog progress;
|
ProgressDialog progress;
|
||||||
int box = 1;
|
int box = 1;
|
||||||
|
@ -250,7 +248,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
} else {
|
} else {
|
||||||
progress.dismiss();
|
progress.dismiss();
|
||||||
progress = null;
|
progress = null;
|
||||||
LinphoneCoreFactoryImpl.loadOptionalLibraryWithPath(((Context)ohcodec.getUserData(ctxt)).getFilesDir() + "/" + mCodecDownloader.getNameLib());
|
|
||||||
LinphoneManager.getLc().reloadMsPlugins(null);
|
LinphoneManager.getLc().reloadMsPlugins(null);
|
||||||
if (ohcodec.getUserDataSize() > box
|
if (ohcodec.getUserDataSize() > box
|
||||||
&& ohcodec.getUserData(box) != null)
|
&& ohcodec.getUserData(box) != null)
|
||||||
|
@ -276,45 +273,13 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
mCodecAction = new OpenH264DownloadHelperAction() {
|
|
||||||
@Override
|
|
||||||
public void startDownload() {
|
|
||||||
askPopUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void askPopUp() {
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(LinphoneManager.getInstance().getContext());
|
|
||||||
builder.setCancelable(false);
|
|
||||||
AlertDialog.Builder show = 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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).show();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
mCodecDownloader.setOpenH264HelperListener(mCodecListener);
|
mCodecDownloader.setOpenH264HelperListener(mCodecListener);
|
||||||
mCodecDownloader.setOpenH264HelperAction(mCodecAction);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public OpenH264DownloadHelperListener getOpenH264HelperListener() {
|
public OpenH264DownloadHelperListener getOpenH264HelperListener() {
|
||||||
return mCodecListener;
|
return mCodecListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OpenH264DownloadHelperAction getOpenH264HelperAction() {
|
|
||||||
return mCodecAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OpenH264DownloadHelper getOpenH264DownloadHelper(){
|
public OpenH264DownloadHelper getOpenH264DownloadHelper(){
|
||||||
return mCodecDownloader;
|
return mCodecDownloader;
|
||||||
}
|
}
|
||||||
|
@ -1005,6 +970,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
if (state == GlobalState.GlobalOn){
|
if (state == GlobalState.GlobalOn){
|
||||||
try {
|
try {
|
||||||
initLiblinphone(lc);
|
initLiblinphone(lc);
|
||||||
|
initOpenH264Helper();
|
||||||
} catch (LinphoneCoreException e) {
|
} catch (LinphoneCoreException e) {
|
||||||
Log.e(e);
|
Log.e(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,8 @@ import org.linphone.tools.OpenH264DownloadHelper;
|
||||||
import org.linphone.ui.LedPreference;
|
import org.linphone.ui.LedPreference;
|
||||||
import org.linphone.ui.PreferencesListFragment;
|
import org.linphone.ui.PreferencesListFragment;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.preference.CheckBoxPreference;
|
import android.preference.CheckBoxPreference;
|
||||||
|
@ -571,7 +573,6 @@ public class SettingsFragment extends PreferencesListFragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mCodecDownloader.setFileDirection(LinphoneManager.getInstance().getContext().getFilesDir().toString());
|
|
||||||
if (pt.getMime().equals("H264") && mCodecDownloader.isCodecFound())
|
if (pt.getMime().equals("H264") && mCodecDownloader.isCodecFound())
|
||||||
codec.setSummary(mCodecDownloader.getLicenseMessage());
|
codec.setSummary(mCodecDownloader.getLicenseMessage());
|
||||||
codec.setChecked(lc.isPayloadTypeEnabled(pt));
|
codec.setChecked(lc.isPayloadTypeEnabled(pt));
|
||||||
|
@ -584,10 +585,27 @@ public class SettingsFragment extends PreferencesListFragment {
|
||||||
if (enable && Version.getCpuAbis().contains("armeabi-v7a") && !Version.getCpuAbis().contains("x86")
|
if (enable && Version.getCpuAbis().contains("armeabi-v7a") && !Version.getCpuAbis().contains("x86")
|
||||||
&& pt.getMime().equals("H264") && !mCodecDownloader.isCodecFound()) {
|
&& pt.getMime().equals("H264") && !mCodecDownloader.isCodecFound()) {
|
||||||
LinphoneManager.getInstance().getOpenH264DownloadHelper().setOpenH264HelperListener(LinphoneManager.getInstance().getOpenH264HelperListener());
|
LinphoneManager.getInstance().getOpenH264DownloadHelper().setOpenH264HelperListener(LinphoneManager.getInstance().getOpenH264HelperListener());
|
||||||
LinphoneManager.getInstance().getOpenH264DownloadHelper().setOpenH264HelperAction(LinphoneManager.getInstance().getOpenH264DownloadHelper().getOpenH264DownloadHelperAction());
|
|
||||||
LinphoneManager.getInstance().getOpenH264DownloadHelper().setUserData(0,LinphoneManager.getInstance().getContext());
|
LinphoneManager.getInstance().getOpenH264DownloadHelper().setUserData(0,LinphoneManager.getInstance().getContext());
|
||||||
LinphoneManager.getInstance().getOpenH264DownloadHelper().setUserData(1,codec);
|
LinphoneManager.getInstance().getOpenH264DownloadHelper().setUserData(1,codec);
|
||||||
LinphoneManager.getInstance().getOpenH264DownloadHelper().getOpenH264DownloadHelperAction().startDownload();
|
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(LinphoneManager.getInstance().getContext());
|
||||||
|
builder.setCancelable(false);
|
||||||
|
AlertDialog.Builder show = 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).show();
|
||||||
}
|
}
|
||||||
LinphoneManager.getLcIfManagerNotDestroyedOrNull().enablePayloadType(pt, enable);
|
LinphoneManager.getLcIfManagerNotDestroyedOrNull().enablePayloadType(pt, enable);
|
||||||
} catch (LinphoneCoreException e) {
|
} catch (LinphoneCoreException e) {
|
||||||
|
|
|
@ -113,7 +113,8 @@ private static AssistantActivity instance;
|
||||||
if (state == RegistrationState.RegistrationOk) {
|
if (state == RegistrationState.RegistrationOk) {
|
||||||
if (progress != null) progress.dismiss();
|
if (progress != null) progress.dismiss();
|
||||||
if (LinphoneManager.getLc().getDefaultProxyConfig() != null) {
|
if (LinphoneManager.getLc().getDefaultProxyConfig() != null) {
|
||||||
launchEchoCancellerCalibration(true);
|
if (!launchEchoCancellerCalibration(true))
|
||||||
|
launchDownloadCodec();
|
||||||
}
|
}
|
||||||
} else if (state == RegistrationState.RegistrationFailed) {
|
} else if (state == RegistrationState.RegistrationFailed) {
|
||||||
if (progress != null) progress.dismiss();
|
if (progress != null) progress.dismiss();
|
||||||
|
@ -242,15 +243,11 @@ private static AssistantActivity instance;
|
||||||
if (requestCode == PERMISSIONS_REQUEST_RECORD_AUDIO) {
|
if (requestCode == PERMISSIONS_REQUEST_RECORD_AUDIO) {
|
||||||
if (getPackageManager().checkPermission(Manifest.permission.RECORD_AUDIO, getPackageName()) == PackageManager.PERMISSION_GRANTED) {
|
if (getPackageManager().checkPermission(Manifest.permission.RECORD_AUDIO, getPackageName()) == PackageManager.PERMISSION_GRANTED) {
|
||||||
launchEchoCancellerCalibration(true);
|
launchEchoCancellerCalibration(true);
|
||||||
} else {
|
|
||||||
launchDownloadCodec();
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
launchDownloadCodec();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void launchEchoCancellerCalibration(boolean sendEcCalibrationResult) {
|
private boolean launchEchoCancellerCalibration(boolean sendEcCalibrationResult) {
|
||||||
if (getPackageManager().checkPermission(Manifest.permission.RECORD_AUDIO, getPackageName()) == PackageManager.PERMISSION_GRANTED) {
|
if (getPackageManager().checkPermission(Manifest.permission.RECORD_AUDIO, getPackageName()) == PackageManager.PERMISSION_GRANTED) {
|
||||||
boolean needsEchoCalibration = LinphoneManager.getLc().needsEchoCalibration();
|
boolean needsEchoCalibration = LinphoneManager.getLc().needsEchoCalibration();
|
||||||
if (needsEchoCalibration && mPrefs.isFirstLaunch()) {
|
if (needsEchoCalibration && mPrefs.isFirstLaunch()) {
|
||||||
|
@ -260,12 +257,12 @@ private static AssistantActivity instance;
|
||||||
currentFragment = AssistantFragmentsEnum.ECHO_CANCELLER_CALIBRATION;
|
currentFragment = AssistantFragmentsEnum.ECHO_CANCELLER_CALIBRATION;
|
||||||
back.setVisibility(View.VISIBLE);
|
back.setVisibility(View.VISIBLE);
|
||||||
cancel.setEnabled(false);
|
cancel.setEnabled(false);
|
||||||
} else {
|
return true;
|
||||||
launchDownloadCodec();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
checkAndRequestAudioPermission();
|
checkAndRequestAudioPermission();
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logIn(String username, String password, String displayName, String domain, TransportType transport, boolean sendEcCalibrationResult) {
|
private void logIn(String username, String password, String displayName, String domain, TransportType transport, boolean sendEcCalibrationResult) {
|
||||||
|
@ -355,8 +352,7 @@ private static AssistantActivity instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void launchDownloadCodec() {
|
private void launchDownloadCodec() {
|
||||||
OpenH264DownloadHelper downloadHelper = new OpenH264DownloadHelper();
|
OpenH264DownloadHelper downloadHelper = LinphoneCoreFactory.instance().createOpenH264DownloadHelper();
|
||||||
downloadHelper.setFileDirection(LinphoneManager.getInstance().getContext().getFilesDir().toString());
|
|
||||||
if (Version.getCpuAbis().contains("armeabi-v7a") && !Version.getCpuAbis().contains("x86") && !downloadHelper.isCodecFound()) {
|
if (Version.getCpuAbis().contains("armeabi-v7a") && !Version.getCpuAbis().contains("x86") && !downloadHelper.isCodecFound()) {
|
||||||
CodecDownloaderFragment codecFragment = new CodecDownloaderFragment();
|
CodecDownloaderFragment codecFragment = new CodecDownloaderFragment();
|
||||||
changeFragment(codecFragment);
|
changeFragment(codecFragment);
|
||||||
|
@ -498,7 +494,8 @@ private static AssistantActivity instance;
|
||||||
|
|
||||||
public void isAccountVerified(String username) {
|
public void isAccountVerified(String username) {
|
||||||
Toast.makeText(this, getString(R.string.assistant_account_validated), Toast.LENGTH_LONG).show();
|
Toast.makeText(this, getString(R.string.assistant_account_validated), Toast.LENGTH_LONG).show();
|
||||||
launchEchoCancellerCalibration(true);
|
if(!launchEchoCancellerCalibration(true))
|
||||||
|
launchDownloadCodec(); // Echo canceller cancel
|
||||||
}
|
}
|
||||||
|
|
||||||
public void isEchoCalibrationFinished() {
|
public void isEchoCalibrationFinished() {
|
||||||
|
|
|
@ -31,9 +31,9 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import org.linphone.LinphoneManager;
|
import org.linphone.LinphoneManager;
|
||||||
import org.linphone.R;
|
import org.linphone.R;
|
||||||
|
import org.linphone.core.LinphoneCoreFactory;
|
||||||
import org.linphone.core.OpenH264DownloadHelperListener;
|
import org.linphone.core.OpenH264DownloadHelperListener;
|
||||||
import org.linphone.core.LinphoneCoreException;
|
import org.linphone.core.LinphoneCoreException;
|
||||||
import org.linphone.core.LinphoneCoreFactoryImpl;
|
|
||||||
import org.linphone.core.PayloadType;
|
import org.linphone.core.PayloadType;
|
||||||
import org.linphone.tools.OpenH264DownloadHelper;
|
import org.linphone.tools.OpenH264DownloadHelper;
|
||||||
|
|
||||||
|
@ -57,8 +57,7 @@ public class CodecDownloaderFragment extends Fragment {
|
||||||
final ProgressBar bar = (ProgressBar) view.findViewById(R.id.progressBar);
|
final ProgressBar bar = (ProgressBar) view.findViewById(R.id.progressBar);
|
||||||
final TextView downloadingInfo = (TextView) view.findViewById(R.id.downloadingInfo);
|
final TextView downloadingInfo = (TextView) view.findViewById(R.id.downloadingInfo);
|
||||||
|
|
||||||
final OpenH264DownloadHelper codecDownloader = new OpenH264DownloadHelper();
|
final OpenH264DownloadHelper codecDownloader = LinphoneCoreFactory.instance().createOpenH264DownloadHelper();
|
||||||
codecDownloader.setFileDirection(LinphoneManager.getInstance().getContext().getFilesDir().toString());
|
|
||||||
final OpenH264DownloadHelperListener codecListener = new OpenH264DownloadHelperListener() {
|
final OpenH264DownloadHelperListener codecListener = new OpenH264DownloadHelperListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -75,7 +74,6 @@ public class CodecDownloaderFragment extends Fragment {
|
||||||
} else {
|
} else {
|
||||||
downloadingInfo.setVisibility(View.INVISIBLE);
|
downloadingInfo.setVisibility(View.INVISIBLE);
|
||||||
bar.setVisibility(View.INVISIBLE);
|
bar.setVisibility(View.INVISIBLE);
|
||||||
LinphoneCoreFactoryImpl.loadOptionalLibraryWithPath(LinphoneManager.getInstance().getContext().getFilesDir() + "/" + codecDownloader.getNameLib());
|
|
||||||
LinphoneManager.getLc().reloadMsPlugins(null);
|
LinphoneManager.getLc().reloadMsPlugins(null);
|
||||||
downloading.setVisibility(View.INVISIBLE);
|
downloading.setVisibility(View.INVISIBLE);
|
||||||
downloaded.setVisibility(View.VISIBLE);
|
downloaded.setVisibility(View.VISIBLE);
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 7ab235c55a337f68e404097d6e76baf6edc11b4f
|
Subproject commit 1bfb20e56f99ae77578d90850750c740a065c7fe
|
Loading…
Reference in a new issue