mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 12:09:45 +01:00
Disable network receiver
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
c52cc03602
commit
04d67829b3
@ -197,9 +197,6 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
private boolean videoOn = false;
|
private boolean videoOn = false;
|
||||||
private boolean audioOn = false;
|
private boolean audioOn = false;
|
||||||
|
|
||||||
private boolean cameraInitialized = false;
|
|
||||||
private boolean microphoneInitialized = false;
|
|
||||||
|
|
||||||
private BroadcastReceiver networkBroadcastReceier;
|
private BroadcastReceiver networkBroadcastReceier;
|
||||||
|
|
||||||
private static int getSystemUiVisibility() {
|
private static int getSystemUiVisibility() {
|
||||||
@ -231,11 +228,11 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
networkBroadcastReceier = new BroadcastReceiver() {
|
networkBroadcastReceier = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
if ("android.net.conn.CONNECTIVITY_CHANGE".equals(intent.getAction())) {
|
||||||
if (!Device.getNetworkType(context).equals(JobRequest.NetworkType.ANY)) {
|
if (!Device.getNetworkType(context).equals(JobRequest.NetworkType.ANY)) {
|
||||||
if (!leavingCall) {
|
|
||||||
startPullingSignalingMessages(true);
|
startPullingSignalingMessages(true);
|
||||||
} else {
|
} else {
|
||||||
hangup(true);
|
//hangup(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -285,6 +282,14 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void performIceRestart() {
|
||||||
|
for (int i = 0; i < magicPeerConnectionWrapperList.size(); i++) {
|
||||||
|
sdpConstraints.optional.add(new MediaConstraints.KeyValuePair("IceRestart", "true"));
|
||||||
|
PeerConnection.RTCConfiguration rtcConfiguration = new PeerConnection.RTCConfiguration(iceServers);
|
||||||
|
magicPeerConnectionWrapperList.get(i).getPeerConnection().setConfiguration(rtcConfiguration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void handleFromNotification() {
|
private void handleFromNotification() {
|
||||||
ncApi.getRooms(credentials, ApiHelper.getUrlForGetRooms(userEntity.getBaseUrl()))
|
ncApi.getRooms(credentials, ApiHelper.getUrlForGetRooms(userEntity.getBaseUrl()))
|
||||||
.subscribeOn(Schedulers.newThread())
|
.subscribeOn(Schedulers.newThread())
|
||||||
@ -604,8 +609,6 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
// And finally, with our VideoRenderer ready, we
|
// And finally, with our VideoRenderer ready, we
|
||||||
// can add our renderer to the VideoTrack.
|
// can add our renderer to the VideoTrack.
|
||||||
localVideoTrack.addRenderer(localRenderer);
|
localVideoTrack.addRenderer(localRenderer);
|
||||||
|
|
||||||
cameraInitialized = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void microphoneInitialization() {
|
private void microphoneInitialization() {
|
||||||
@ -614,15 +617,13 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
localAudioTrack = peerConnectionFactory.createAudioTrack("NCa0", audioSource);
|
localAudioTrack = peerConnectionFactory.createAudioTrack("NCa0", audioSource);
|
||||||
localAudioTrack.setEnabled(false);
|
localAudioTrack.setEnabled(false);
|
||||||
localMediaStream.addTrack(localAudioTrack);
|
localMediaStream.addTrack(localAudioTrack);
|
||||||
|
|
||||||
microphoneInitialized = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startCall() {
|
private void startCall() {
|
||||||
inCall = true;
|
inCall = true;
|
||||||
animateCallControls(false, 5000);
|
animateCallControls(false, 5000);
|
||||||
startPullingSignalingMessages(false);
|
startPullingSignalingMessages(false);
|
||||||
registerNetworkReceiver();
|
//registerNetworkReceiver();
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnClick({R.id.pip_video_view, R.id.remote_renderers_layout})
|
@OnClick({R.id.pip_video_view, R.id.remote_renderers_layout})
|
||||||
@ -636,7 +637,7 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
if (restart) {
|
if (restart) {
|
||||||
dispose(null);
|
dispose(null);
|
||||||
hangupNetworkCalls();
|
//hangupNetworkCalls();
|
||||||
}
|
}
|
||||||
|
|
||||||
leavingCall = false;
|
leavingCall = false;
|
||||||
@ -680,9 +681,11 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (restart) {
|
||||||
|
performIceRestart();
|
||||||
|
} else {
|
||||||
joinRoomAndCall();
|
joinRoomAndCall();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -973,11 +976,14 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!dueToNetworkChange) {
|
||||||
|
pipVideoView.release();
|
||||||
|
|
||||||
if (videoCapturer != null) {
|
if (videoCapturer != null) {
|
||||||
videoCapturer.dispose();
|
videoCapturer.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (localMediaStream != null) {
|
if (localMediaStream != null) {
|
||||||
if (localMediaStream.videoTracks != null && localMediaStream.videoTracks.size() > 0) {
|
if (localMediaStream.videoTracks != null && localMediaStream.videoTracks.size() > 0) {
|
||||||
localMediaStream.removeTrack(localMediaStream.videoTracks.get(0));
|
localMediaStream.removeTrack(localMediaStream.videoTracks.get(0));
|
||||||
@ -998,10 +1004,8 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
videoCapturer = null;
|
videoCapturer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
pipVideoView.release();
|
|
||||||
|
|
||||||
if (!dueToNetworkChange) {
|
|
||||||
hangupNetworkCalls();
|
hangupNetworkCalls();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1113,7 +1117,7 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
hangup(false);
|
hangup(false);
|
||||||
this.unregisterReceiver(networkBroadcastReceier);
|
//this.unregisterReceiver(networkBroadcastReceier);
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user