launch calls in new task
This commit is contained in:
		
							parent
							
								
									c7269bc0aa
								
							
						
					
					
						commit
						f7f0dc99a7
					
				@ -34,7 +34,7 @@
 | 
			
		||||
    <uses-permission android:name="android.permission.BLUETOOTH" />
 | 
			
		||||
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
 | 
			
		||||
    <uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
 | 
			
		||||
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
 | 
			
		||||
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
 | 
			
		||||
 | 
			
		||||
    <uses-permission
 | 
			
		||||
        android:name="android.permission.READ_PHONE_STATE"
 | 
			
		||||
@ -57,12 +57,12 @@
 | 
			
		||||
    <application
 | 
			
		||||
        android:allowBackup="false"
 | 
			
		||||
        android:appCategory="social"
 | 
			
		||||
        android:hardwareAccelerated="true"
 | 
			
		||||
        android:icon="@mipmap/new_launcher"
 | 
			
		||||
        android:label="@string/app_name"
 | 
			
		||||
        android:networkSecurityConfig="@xml/network_security_configuration"
 | 
			
		||||
        android:theme="@style/ConversationsTheme"
 | 
			
		||||
        tools:replace="android:label"
 | 
			
		||||
        android:hardwareAccelerated="true"
 | 
			
		||||
        tools:targetApi="o">
 | 
			
		||||
 | 
			
		||||
        <meta-data
 | 
			
		||||
@ -291,10 +291,11 @@
 | 
			
		||||
        <activity
 | 
			
		||||
            android:name=".ui.ChannelDiscoveryActivity"
 | 
			
		||||
            android:label="@string/discover_channels" />
 | 
			
		||||
        <activity android:name=".ui.RtpSessionActivity"
 | 
			
		||||
            android:supportsPictureInPicture="true"
 | 
			
		||||
            android:launchMode="singleTask"
 | 
			
		||||
            android:autoRemoveFromRecents="true"/>
 | 
			
		||||
        <activity
 | 
			
		||||
            android:name=".ui.RtpSessionActivity"
 | 
			
		||||
            android:autoRemoveFromRecents="true"
 | 
			
		||||
            android:launchMode="singleInstance"
 | 
			
		||||
            android:supportsPictureInPicture="true" />
 | 
			
		||||
    </application>
 | 
			
		||||
 | 
			
		||||
</manifest>
 | 
			
		||||
 | 
			
		||||
@ -1273,11 +1273,17 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    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 Intent intent = new Intent(activity, RtpSessionActivity.class);
 | 
			
		||||
        intent.setAction(action);
 | 
			
		||||
        intent.putExtra(RtpSessionActivity.EXTRA_ACCOUNT, contact.getAccount().getJid().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);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -78,6 +78,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void onCreate(Bundle savedInstanceState) {
 | 
			
		||||
        Log.d(Config.LOGTAG, this.getClass().getName() + ".onCreate()");
 | 
			
		||||
        super.onCreate(savedInstanceState);
 | 
			
		||||
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
 | 
			
		||||
                | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
 | 
			
		||||
@ -87,12 +88,6 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
 | 
			
		||||
        setSupportActionBar(binding.toolbar);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void onStart() {
 | 
			
		||||
        super.onStart();
 | 
			
		||||
        Log.d(Config.LOGTAG, "RtpSessionActivity.onStart()");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void endCall(View view) {
 | 
			
		||||
        endCall();
 | 
			
		||||
    }
 | 
			
		||||
@ -145,7 +140,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
 | 
			
		||||
            if (isMicrophoneAvailable) {
 | 
			
		||||
                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();
 | 
			
		||||
    }
 | 
			
		||||
@ -206,6 +201,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void onNewIntent(final Intent intent) {
 | 
			
		||||
        Log.d(Config.LOGTAG, this.getClass().getName() + ".onNewIntent()");
 | 
			
		||||
        super.onNewIntent(intent);
 | 
			
		||||
        setIntent(intent);
 | 
			
		||||
        if (xmppConnectionService == null) {
 | 
			
		||||
 | 
			
		||||
@ -104,7 +104,7 @@ public class JingleConnectionManager extends AbstractConnectionManager {
 | 
			
		||||
        return account.isOnion() || mXmppConnectionService.useTorToConnect();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private boolean isBusy() {
 | 
			
		||||
    public boolean isBusy() {
 | 
			
		||||
        for (AbstractJingleConnection connection : this.connections.values()) {
 | 
			
		||||
            if (connection instanceof JingleRtpConnection) {
 | 
			
		||||
                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);
 | 
			
		||||
            this.rtpSessionProposals.put(proposal, DeviceDiscoveryState.SEARCHING);
 | 
			
		||||
            mXmppConnectionService.notifyJingleRtpConnectionUpdate(
 | 
			
		||||
 | 
			
		||||
@ -915,6 +915,7 @@
 | 
			
		||||
    <string name="audio_call">Audio call</string>
 | 
			
		||||
    <string name="video_call">Video call</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">
 | 
			
		||||
        <item quantity="one">View %1$d Participant</item>
 | 
			
		||||
        <item quantity="other">View %1$d Participants</item>
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user