Started early-media display
This commit is contained in:
parent
4edf8086ca
commit
62daa5c1a3
12 changed files with 94 additions and 40 deletions
|
@ -1070,7 +1070,8 @@ public class LinphoneActivity extends LinphoneGenericActivity
|
|||
|
||||
if (LinphoneManager.isInstanciated() && LinphoneManager.getLc().getCallsNb() > 0) {
|
||||
Call call = LinphoneManager.getLc().getCalls()[0];
|
||||
if (call.getState() == Call.State.IncomingReceived) {
|
||||
if (call.getState() == Call.State.IncomingReceived
|
||||
|| call.getState() == State.IncomingEarlyMedia) {
|
||||
startActivity(new Intent(LinphoneActivity.this, CallIncomingActivity.class));
|
||||
} else {
|
||||
startIncallActivity();
|
||||
|
@ -1399,7 +1400,8 @@ public class LinphoneActivity extends LinphoneGenericActivity
|
|||
Call call = LinphoneManager.getLc().getCalls()[0];
|
||||
Call.State onCallStateChanged = call.getState();
|
||||
|
||||
if (onCallStateChanged == State.IncomingReceived) {
|
||||
if (onCallStateChanged == State.IncomingReceived
|
||||
|| onCallStateChanged == State.IncomingEarlyMedia) {
|
||||
startActivity(new Intent(this, CallIncomingActivity.class));
|
||||
} else if (onCallStateChanged == State.OutgoingInit
|
||||
|| onCallStateChanged == State.OutgoingProgress
|
||||
|
|
|
@ -1161,7 +1161,8 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
|||
}
|
||||
}
|
||||
|
||||
if (state == State.IncomingReceived && getCallGsmON()) {
|
||||
if ((state == State.IncomingReceived || state == State.IncomingEarlyMedia)
|
||||
&& getCallGsmON()) {
|
||||
if (mCore != null) {
|
||||
mCore.declineCall(call, Reason.Busy);
|
||||
}
|
||||
|
|
|
@ -203,7 +203,8 @@ public final class LinphoneService extends Service {
|
|||
mNotificationManager.displayCallNotification(call);
|
||||
}
|
||||
|
||||
if (state == Call.State.IncomingReceived) {
|
||||
if (state == Call.State.IncomingReceived
|
||||
|| state == State.IncomingEarlyMedia) {
|
||||
if (!LinphoneManager.getInstance().getCallGsmON())
|
||||
onIncomingReceived();
|
||||
}
|
||||
|
|
|
@ -209,7 +209,7 @@ public class CallActivity extends LinphoneGenericActivity
|
|||
return;
|
||||
}
|
||||
|
||||
if (state == State.IncomingReceived) {
|
||||
if (state == State.IncomingReceived || state == State.IncomingEarlyMedia) {
|
||||
// This scenario will be handled by the Service listener
|
||||
return;
|
||||
} else if (state == State.Paused
|
||||
|
|
|
@ -27,6 +27,7 @@ import android.content.pm.ActivityInfo;
|
|||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.TextureView;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
@ -63,6 +64,7 @@ public class CallIncomingActivity extends LinphoneGenericActivity {
|
|||
private CoreListenerStub mListener;
|
||||
private boolean mAlreadyAcceptedOrDeniedCall;
|
||||
private KeyguardManager mKeyguardManager;
|
||||
private TextureView mVideoDisplay;
|
||||
|
||||
public static CallIncomingActivity instance() {
|
||||
return sInstance;
|
||||
|
@ -88,6 +90,7 @@ public class CallIncomingActivity extends LinphoneGenericActivity {
|
|||
|
||||
mName = findViewById(R.id.contact_name);
|
||||
mNumber = findViewById(R.id.contact_number);
|
||||
mVideoDisplay = findViewById(R.id.videoSurface);
|
||||
|
||||
mAccept = findViewById(R.id.answer_button);
|
||||
mDecline = findViewById(R.id.decline_button);
|
||||
|
@ -189,6 +192,10 @@ public class CallIncomingActivity extends LinphoneGenericActivity {
|
|||
mName.setText(displayName);
|
||||
}
|
||||
mNumber.setText(address.asStringUriOnly());
|
||||
|
||||
if (LinphonePreferences.instance().acceptIncomingEarlyMedia()) {
|
||||
mCall.getCore().setNativeVideoWindowId(mVideoDisplay);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -225,7 +232,8 @@ public class CallIncomingActivity extends LinphoneGenericActivity {
|
|||
private void lookupCurrentCall() {
|
||||
if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null) {
|
||||
for (Call call : LinphoneManager.getLc().getCalls()) {
|
||||
if (State.IncomingReceived == call.getState()) {
|
||||
if (State.IncomingReceived == call.getState()
|
||||
|| State.IncomingEarlyMedia == call.getState()) {
|
||||
mCall = call;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -748,6 +748,14 @@ public class LinphonePreferences {
|
|||
// End of video settings
|
||||
|
||||
// Call settings
|
||||
public boolean acceptIncomingEarlyMedia() {
|
||||
return getConfig().getBool("sip", "incoming_calls_early_media", false);
|
||||
}
|
||||
|
||||
public void setAcceptIncomingEarlyMedia(boolean accept) {
|
||||
getConfig().setBool("sip", "incoming_calls_early_media", accept);
|
||||
}
|
||||
|
||||
public boolean useRfc2833Dtmfs() {
|
||||
if (getLc() == null) return false;
|
||||
return getLc().getUseRfc2833ForDtmf();
|
||||
|
|
|
@ -1123,6 +1123,9 @@ public class SettingsFragment extends PreferenceFragment {
|
|||
EditTextPreference incTimeout =
|
||||
(EditTextPreference)
|
||||
findPreference(getString(R.string.pref_incoming_call_timeout_key));
|
||||
CheckBoxPreference earlyMedia =
|
||||
(CheckBoxPreference)
|
||||
findPreference(getString(R.string.pref_accept_early_media_key));
|
||||
|
||||
rfc2833.setChecked(mPrefs.useRfc2833Dtmfs());
|
||||
sipInfo.setChecked(mPrefs.useSipInfoDtmfs());
|
||||
|
@ -1133,6 +1136,7 @@ public class SettingsFragment extends PreferenceFragment {
|
|||
autoAnswer.setChecked(mPrefs.isAutoAnswerEnabled());
|
||||
autoAnswerTime.setText(String.valueOf(mPrefs.getAutoAnswerTime()));
|
||||
autoAnswerTime.setSummary(String.valueOf(mPrefs.getAutoAnswerTime()));
|
||||
earlyMedia.setChecked(mPrefs.acceptIncomingEarlyMedia());
|
||||
|
||||
if (mPrefs.isAutoAnswerEnabled()) {
|
||||
autoAnswerTime.setEnabled(true);
|
||||
|
@ -1317,6 +1321,18 @@ public class SettingsFragment extends PreferenceFragment {
|
|||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
findPreference(getString(R.string.pref_accept_early_media_key))
|
||||
.setOnPreferenceChangeListener(
|
||||
new OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(
|
||||
Preference preference, Object newValue) {
|
||||
boolean accept = (Boolean) newValue;
|
||||
mPrefs.setAcceptIncomingEarlyMedia(accept);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initChatSettings() {
|
||||
|
|
|
@ -29,14 +29,18 @@
|
|||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/contact_detail"
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@+id/menu"
|
||||
android:layout_below="@id/top_bar"
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/contact_detail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/contact_name"
|
||||
style="@style/big_contact_name_font"
|
||||
|
@ -73,6 +77,13 @@
|
|||
|
||||
</RelativeLayout>
|
||||
|
||||
<TextureView
|
||||
android:id="@+id/videoSurface"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/menu"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
|
||||
<!-- Call -->
|
||||
<bool name="forbid_self_call">false</bool>
|
||||
<bool name="allow_ringing_while_early_media">true</bool>
|
||||
<bool name="allow_ringing_while_early_media">false</bool>
|
||||
<bool name="allow_transfers">true</bool>
|
||||
<bool name="disable_options_in_call">false</bool>
|
||||
<!-- This settings handle the behavior of the view waiting for the remote provisioning configuration to be done -->
|
||||
|
|
|
@ -131,6 +131,7 @@
|
|||
<item>@string/pref_auto_download_policy_always_key</item>
|
||||
<item>@string/pref_auto_download_policy_size_key</item>
|
||||
</string-array>
|
||||
<string name="pref_accept_early_media_key">pref_accept_early_media_key</string>
|
||||
|
||||
<string name="push_reg_id_key" translatable="false">push_reg_id_key</string>
|
||||
<string name="push_sender_id_key" translatable="false">push_sender_id_key</string>
|
||||
|
|
|
@ -433,6 +433,7 @@
|
|||
<string name="pref_call_timeout_title">Call timeout (in seconds)</string>
|
||||
<string name="pref_voice_mail">Voice mail URI</string>
|
||||
<string name="pref_dialer_call">Use Linphone as default phone app</string>
|
||||
<string name="pref_accept_early_media">Accept early-media</string>
|
||||
|
||||
<!-- Chat settings -->
|
||||
<string name="pref_chat_title">Chat</string>
|
||||
|
|
|
@ -231,6 +231,12 @@
|
|||
android:persistent="false"
|
||||
android:title="@string/pref_incoming_call_timeout_title" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="@string/pref_accept_early_media_key"
|
||||
android:persistent="false"
|
||||
android:layout="@layout/hidden"
|
||||
android:title="@string/pref_accept_early_media" />
|
||||
|
||||
<EditTextPreference
|
||||
android:key="@string/pref_voice_mail_key"
|
||||
android:persistent="false"
|
||||
|
@ -241,7 +247,6 @@
|
|||
android:persistent="false"
|
||||
android:title="@string/pref_dialer_call" />
|
||||
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
|
Loading…
Reference in a new issue