launch calls in new task
This commit is contained in:
		
							parent
							
								
									c7269bc0aa
								
							
						
					
					
						commit
						f7f0dc99a7
					
				@ -57,12 +57,12 @@
 | 
				
			|||||||
    <application
 | 
					    <application
 | 
				
			||||||
        android:allowBackup="false"
 | 
					        android:allowBackup="false"
 | 
				
			||||||
        android:appCategory="social"
 | 
					        android:appCategory="social"
 | 
				
			||||||
 | 
					        android:hardwareAccelerated="true"
 | 
				
			||||||
        android:icon="@mipmap/new_launcher"
 | 
					        android:icon="@mipmap/new_launcher"
 | 
				
			||||||
        android:label="@string/app_name"
 | 
					        android:label="@string/app_name"
 | 
				
			||||||
        android:networkSecurityConfig="@xml/network_security_configuration"
 | 
					        android:networkSecurityConfig="@xml/network_security_configuration"
 | 
				
			||||||
        android:theme="@style/ConversationsTheme"
 | 
					        android:theme="@style/ConversationsTheme"
 | 
				
			||||||
        tools:replace="android:label"
 | 
					        tools:replace="android:label"
 | 
				
			||||||
        android:hardwareAccelerated="true"
 | 
					 | 
				
			||||||
        tools:targetApi="o">
 | 
					        tools:targetApi="o">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <meta-data
 | 
					        <meta-data
 | 
				
			||||||
@ -291,10 +291,11 @@
 | 
				
			|||||||
        <activity
 | 
					        <activity
 | 
				
			||||||
            android:name=".ui.ChannelDiscoveryActivity"
 | 
					            android:name=".ui.ChannelDiscoveryActivity"
 | 
				
			||||||
            android:label="@string/discover_channels" />
 | 
					            android:label="@string/discover_channels" />
 | 
				
			||||||
        <activity android:name=".ui.RtpSessionActivity"
 | 
					        <activity
 | 
				
			||||||
            android:supportsPictureInPicture="true"
 | 
					            android:name=".ui.RtpSessionActivity"
 | 
				
			||||||
            android:launchMode="singleTask"
 | 
					            android:autoRemoveFromRecents="true"
 | 
				
			||||||
            android:autoRemoveFromRecents="true"/>
 | 
					            android:launchMode="singleInstance"
 | 
				
			||||||
 | 
					            android:supportsPictureInPicture="true" />
 | 
				
			||||||
    </application>
 | 
					    </application>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</manifest>
 | 
					</manifest>
 | 
				
			||||||
 | 
				
			|||||||
@ -1273,11 +1273,17 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private void triggerRtpSession(final String action) {
 | 
					    private void triggerRtpSession(final String action) {
 | 
				
			||||||
 | 
					        if (activity.xmppConnectionService.getJingleConnectionManager().isBusy()) {
 | 
				
			||||||
 | 
					            Toast.makeText(getActivity(), R.string.only_one_call_at_a_time, Toast.LENGTH_LONG).show();
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        final Contact contact = conversation.getContact();
 | 
					        final Contact contact = conversation.getContact();
 | 
				
			||||||
        final Intent intent = new Intent(activity, RtpSessionActivity.class);
 | 
					        final Intent intent = new Intent(activity, RtpSessionActivity.class);
 | 
				
			||||||
        intent.setAction(action);
 | 
					        intent.setAction(action);
 | 
				
			||||||
        intent.putExtra(RtpSessionActivity.EXTRA_ACCOUNT, contact.getAccount().getJid().toEscapedString());
 | 
					        intent.putExtra(RtpSessionActivity.EXTRA_ACCOUNT, contact.getAccount().getJid().toEscapedString());
 | 
				
			||||||
        intent.putExtra(RtpSessionActivity.EXTRA_WITH, contact.getJid().asBareJid().toEscapedString());
 | 
					        intent.putExtra(RtpSessionActivity.EXTRA_WITH, contact.getJid().asBareJid().toEscapedString());
 | 
				
			||||||
 | 
					        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
 | 
				
			||||||
 | 
					        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
 | 
				
			||||||
        startActivity(intent);
 | 
					        startActivity(intent);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -78,6 +78,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void onCreate(Bundle savedInstanceState) {
 | 
					    public void onCreate(Bundle savedInstanceState) {
 | 
				
			||||||
 | 
					        Log.d(Config.LOGTAG, this.getClass().getName() + ".onCreate()");
 | 
				
			||||||
        super.onCreate(savedInstanceState);
 | 
					        super.onCreate(savedInstanceState);
 | 
				
			||||||
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
 | 
					        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
 | 
				
			||||||
                | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
 | 
					                | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
 | 
				
			||||||
@ -87,12 +88,6 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
 | 
				
			|||||||
        setSupportActionBar(binding.toolbar);
 | 
					        setSupportActionBar(binding.toolbar);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    public void onStart() {
 | 
					 | 
				
			||||||
        super.onStart();
 | 
					 | 
				
			||||||
        Log.d(Config.LOGTAG, "RtpSessionActivity.onStart()");
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private void endCall(View view) {
 | 
					    private void endCall(View view) {
 | 
				
			||||||
        endCall();
 | 
					        endCall();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -145,7 +140,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
 | 
				
			|||||||
            if (isMicrophoneAvailable) {
 | 
					            if (isMicrophoneAvailable) {
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            runOnUiThread(() -> Toast.makeText(this, R.string.microphone_unavailable, Toast.LENGTH_SHORT).show());
 | 
					            runOnUiThread(() -> Toast.makeText(this, R.string.microphone_unavailable, Toast.LENGTH_LONG).show());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        ).start();
 | 
					        ).start();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -206,6 +201,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void onNewIntent(final Intent intent) {
 | 
					    public void onNewIntent(final Intent intent) {
 | 
				
			||||||
 | 
					        Log.d(Config.LOGTAG, this.getClass().getName() + ".onNewIntent()");
 | 
				
			||||||
        super.onNewIntent(intent);
 | 
					        super.onNewIntent(intent);
 | 
				
			||||||
        setIntent(intent);
 | 
					        setIntent(intent);
 | 
				
			||||||
        if (xmppConnectionService == null) {
 | 
					        if (xmppConnectionService == null) {
 | 
				
			||||||
 | 
				
			|||||||
@ -104,7 +104,7 @@ public class JingleConnectionManager extends AbstractConnectionManager {
 | 
				
			|||||||
        return account.isOnion() || mXmppConnectionService.useTorToConnect();
 | 
					        return account.isOnion() || mXmppConnectionService.useTorToConnect();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private boolean isBusy() {
 | 
					    public boolean isBusy() {
 | 
				
			||||||
        for (AbstractJingleConnection connection : this.connections.values()) {
 | 
					        for (AbstractJingleConnection connection : this.connections.values()) {
 | 
				
			||||||
            if (connection instanceof JingleRtpConnection) {
 | 
					            if (connection instanceof JingleRtpConnection) {
 | 
				
			||||||
                return true;
 | 
					                return true;
 | 
				
			||||||
@ -403,6 +403,9 @@ public class JingleConnectionManager extends AbstractConnectionManager {
 | 
				
			|||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            if (isBusy()) {
 | 
				
			||||||
 | 
					                throw new IllegalStateException("There is already a running RTP session. This should have been caught by the UI");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
            final RtpSessionProposal proposal = RtpSessionProposal.of(account, with.asBareJid(), media);
 | 
					            final RtpSessionProposal proposal = RtpSessionProposal.of(account, with.asBareJid(), media);
 | 
				
			||||||
            this.rtpSessionProposals.put(proposal, DeviceDiscoveryState.SEARCHING);
 | 
					            this.rtpSessionProposals.put(proposal, DeviceDiscoveryState.SEARCHING);
 | 
				
			||||||
            mXmppConnectionService.notifyJingleRtpConnectionUpdate(
 | 
					            mXmppConnectionService.notifyJingleRtpConnectionUpdate(
 | 
				
			||||||
 | 
				
			|||||||
@ -915,6 +915,7 @@
 | 
				
			|||||||
    <string name="audio_call">Audio call</string>
 | 
					    <string name="audio_call">Audio call</string>
 | 
				
			||||||
    <string name="video_call">Video call</string>
 | 
					    <string name="video_call">Video call</string>
 | 
				
			||||||
    <string name="microphone_unavailable">Your microphone is unavailable</string>
 | 
					    <string name="microphone_unavailable">Your microphone is unavailable</string>
 | 
				
			||||||
 | 
					    <string name="only_one_call_at_a_time">You can only have one call at a time.</string>
 | 
				
			||||||
    <plurals name="view_users">
 | 
					    <plurals name="view_users">
 | 
				
			||||||
        <item quantity="one">View %1$d Participant</item>
 | 
					        <item quantity="one">View %1$d Participant</item>
 | 
				
			||||||
        <item quantity="other">View %1$d Participants</item>
 | 
					        <item quantity="other">View %1$d Participants</item>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user