Commit 4f7b5a12 authored by Aline Gondim Santos's avatar Aline Gondim Santos

plugin: handle mediaHandlers for different callIDs

Change-Id: I79b5fd9998175e3b9e58973cf9ca16faf08da482
parent 4d495c98
......@@ -45,8 +45,6 @@ import cx.ring.services.NotificationService;
import cx.ring.utils.KeyboardVisibilityManager;
import cx.ring.utils.MediaButtonsHelper;
import static cx.ring.daemon.Ringservice.getPluginsEnabled;
public class CallActivity extends AppCompatActivity {
public static final String ACTION_CALL = BuildConfig.APPLICATION_ID + ".action.call";
public static final String ACTION_CALL_ACCEPT = BuildConfig.APPLICATION_ID + ".action.CALL_ACCEPT";
......
......@@ -315,6 +315,7 @@ public class CallFragment extends BaseSupportFragment<CallPresenter> implements
}else {
if (binding.pluginPreviewContainer.getVisibility() == View.VISIBLE) {
restartPreview = true;
presenter.stopPlugin();
}
}
}
......@@ -1328,6 +1329,8 @@ public class CallFragment extends BaseSupportFragment<CallPresenter> implements
.putExtra(KEY_CONF_ID, conferenceId),
CallFragment.REQUEST_CODE_ADD_PARTICIPANT);
}
@Override
public void toggleCallMediaHandler(String id, boolean toggle) {
Ringservice.toggleCallMediaHandler(id, toggle);
}
......@@ -1449,7 +1452,6 @@ public class CallFragment extends BaseSupportFragment<CallPresenter> implements
if (position > 0) {
String callMediaId = callMediaHandlers.get(position-1);
presenter.startPlugin(callMediaId);
//toggleCallMediaHandler(callMediaId, true);
}
}
......@@ -1458,7 +1460,7 @@ public class CallFragment extends BaseSupportFragment<CallPresenter> implements
String callMediaId = callMediaHandlers.
get(previousPluginPosition-1);
toggleCallMediaHandler(callMediaId, false);
presenter.toggleCallMediaHandler(callMediaId, false);
rp.scrollToPosition(previousPluginPosition);
}
presenter.stopPlugin();
......@@ -1483,13 +1485,13 @@ public class CallFragment extends BaseSupportFragment<CallPresenter> implements
*/
if (previousPluginPosition > 0) {
String callMediaId = callMediaHandlers.get(previousPluginPosition-1);
toggleCallMediaHandler(callMediaId, false);
presenter.toggleCallMediaHandler(callMediaId, false);
}
if (position > 0) {
previousPluginPosition = position;
String callMediaId = callMediaHandlers.get(position-1);
toggleCallMediaHandler(callMediaId, true);
presenter.toggleCallMediaHandler(callMediaId, true);
}
}
......@@ -1507,7 +1509,7 @@ public class CallFragment extends BaseSupportFragment<CallPresenter> implements
*/
if (previousPluginPosition > 0) {
String callMediaId = callMediaHandlers.get(previousPluginPosition-1);
toggleCallMediaHandler(callMediaId, false);
presenter.toggleCallMediaHandler(callMediaId, false);
rp.scrollToPosition(previousPluginPosition);
}
......
......@@ -49,6 +49,7 @@ import java.util.Map;
import cx.ring.daemon.IntVect;
import cx.ring.daemon.Ringservice;
import cx.ring.daemon.StringMap;
import cx.ring.daemon.UintVect;
import cx.ring.model.Conference;
import cx.ring.model.SipCall;
......@@ -58,6 +59,7 @@ import cx.ring.utils.Log;
import cx.ring.utils.Ringer;
import io.reactivex.Completable;
import static cx.ring.daemon.Ringservice.getCallMediaHandlerStatus;
import static cx.ring.daemon.RingserviceJNI.toggleCallMediaHandler;
public class HardwareServiceImpl extends HardwareService implements AudioManager.OnAudioFocusChangeListener, BluetoothWrapper.BluetoothChangeListener {
......@@ -89,7 +91,8 @@ public class HardwareServiceImpl extends HardwareService implements AudioManager
private boolean mShouldSpeakerphone = false;
private final boolean mHasSpeakerPhone;
private boolean mIsChoosePlugin = false;
private String mMediaHandlerId;
private String mMediaHandlerId = "";
private String mPluginCallId = "";
public HardwareServiceImpl(Context context) {
mContext = context;
......@@ -544,7 +547,15 @@ public class HardwareServiceImpl extends HardwareService implements AudioManager
new CameraService.CameraListener() {
@Override
public void onOpened() {
if(mIsChoosePlugin && !mMediaHandlerId.isEmpty())
String currentCall = conf.getConfId();
if (!mPluginCallId.isEmpty() && !currentCall.equals(mPluginCallId)) {
toggleCallMediaHandler("", false);
mIsChoosePlugin = false;
mMediaHandlerId = "";
mPluginCallId = "";
}
else if(mIsChoosePlugin && !mMediaHandlerId.isEmpty())
mPluginCallId = conf.getConfId();
toggleMediaHandler();
}
......
......@@ -663,6 +663,11 @@ public class TVCallFragment extends BaseSupportFragment<CallPresenter> implement
binding.participantLabelContainer.setVisibility(info.isEmpty() ? View.GONE : View.VISIBLE);
}
@Override
public void toggleCallMediaHandler(String id, boolean toggle) {
cx.ring.daemon.RingserviceJNI.toggleCallMediaHandler(id, toggle);
}
@Override
public void goToConversation(String accountId, String conversationId) {
......
......@@ -50,7 +50,6 @@ import io.reactivex.subjects.BehaviorSubject;
import io.reactivex.subjects.Subject;
import static cx.ring.daemon.Ringservice.listCallMediaHandlers;
import static cx.ring.daemon.Ringservice.toggleCallMediaHandler;
public class CallPresenter extends RootPresenter<CallView> {
......@@ -618,6 +617,13 @@ public class CallPresenter extends RootPresenter<CallView> {
}
}
public void toggleCallMediaHandler(String id, boolean toggle)
{
if (mConference != null && mConference.isOnGoing() && mConference.hasVideo()) {
getView().toggleCallMediaHandler(id, toggle);
}
}
public boolean isSpeakerphoneOn() {
return mHardwareService.isSpeakerPhoneOn();
}
......
......@@ -84,4 +84,6 @@ public interface CallView {
boolean displayPluginsButton();
void updateConfInfo(List<Conference.ParticipantInfo> info);
void toggleCallMediaHandler(String id, boolean toggle);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment