[HookReceiver] updates & clean up

This commit is contained in:
Brieuc Viel 2017-04-21 15:29:14 +02:00
parent 576611de60
commit 2ee985da16
3 changed files with 11 additions and 2 deletions

View file

@ -18,6 +18,7 @@ public class HookReceiver extends BroadcastReceiver {
//handset on
Log.i(" ======>>>>>> HookReceiver - handset ON");
LinphoneManager.getLc().enableSpeaker(false);
if(!LinphoneManager.getInstance().isHansetModeOn())
LinphoneManager.getInstance().setHandsetMode(true);

View file

@ -163,6 +163,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
private SensorManager mSensorManager;
private Sensor mProximity;
private boolean mProximitySensingEnabled;
private boolean handsetON = false;
public String wizardLoginViewDomain = null;
@ -854,18 +855,25 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
protected void setHandsetMode(Boolean on){
if(mLc.isInComingInvitePending() && on){
handsetON = true;
try {
mLc.acceptCall(mLc.getCurrentCall());
LinphoneActivity.instance().startIncallActivity(mLc.getCurrentCall());
}catch(LinphoneCoreException e){}
}else if(on && CallActivity.isInstanciated()){
handsetON = true;
CallActivity.instance().setSpeakerEnabled(true);
CallActivity.instance().refreshInCallActions();
}else if (!on){
handsetON = false;
LinphoneManager.getInstance().terminateCall();
}
}
protected boolean isHansetModeOn(){
return handsetON;
}
private void copyAssetsFromPackage() throws IOException {
copyIfNotExist(R.raw.notes_of_the_optimistic, mRingSoundFile);
copyIfNotExist(R.raw.ringback, mRingbackSoundFile);

View file

@ -409,7 +409,7 @@ public class SettingsFragment extends PreferencesListFragment {
if (value.toString().equals(getString(R.string.media_encryption_srtp)))
key = getString(R.string.pref_media_encryption_key_srtp);
else if (value.toString().equals(getString(R.string.media_encryption_zrtp)))
key = getString(R.string.pref_media_encryption_key_zrtp);
key = getString(R.string.pref_media_encryption_key_0zrtp);
else if (value.toString().equals(getString(R.string.media_encryption_dtls)))
key = getString(R.string.pref_media_encryption_key_dtls);
pref.setValue(key);