feat: adding basic webrtc deps and test activity
This commit is contained in:
parent
39d997a636
commit
9340c01af2
|
@ -53,7 +53,7 @@ dependencies {
|
|||
implementation 'com.google.android.exoplayer:exoplayer-ui:2.9.1'
|
||||
implementation 'org.conscrypt:conscrypt-android:2.0.0'
|
||||
implementation 'org.signal:aesgcmprovider:0.0.3'
|
||||
implementation 'org.whispersystems:webrtc-android:M74'
|
||||
implementation 'org.whispersystems:webrtc-android:M77'
|
||||
implementation "me.leolin:ShortcutBadger:1.1.16"
|
||||
implementation 'se.emilsjolander:stickylistheaders:2.7.0'
|
||||
implementation 'com.jpardogo.materialtabstrip:library:1.0.9'
|
||||
|
|
|
@ -295,6 +295,14 @@
|
|||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
|
||||
android:exported="true"
|
||||
android:theme="@style/Theme.Session.DayNight.NoActionBar" />
|
||||
<activity android:name="org.thoughtcrime.securesms.calls.WebRtcTestsActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:parentActivityName="org.thoughtcrime.securesms.home.HomeActivity"
|
||||
android:theme="@style/Theme.Session.DayNight.FlatActionBar">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="org.thoughtcrime.securesms.home.HomeActivity" />
|
||||
</activity>
|
||||
<service
|
||||
android:name="org.thoughtcrime.securesms.notifications.PushNotificationService"
|
||||
android:enabled="true"
|
||||
|
@ -303,6 +311,7 @@
|
|||
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
<service android:enabled="true" android:name="org.thoughtcrime.securesms.service.WebRtcCallService"/>
|
||||
<service
|
||||
android:name="org.thoughtcrime.securesms.service.KeyCachingService"
|
||||
android:enabled="true"
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
*/
|
||||
package org.thoughtcrime.securesms;
|
||||
|
||||
import static nl.komponents.kovenant.android.KovenantAndroid.startKovenant;
|
||||
import static nl.komponents.kovenant.android.KovenantAndroid.stopKovenant;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
@ -48,8 +51,11 @@ import org.signal.aesgcmprovider.AesGcmProvider;
|
|||
import org.thoughtcrime.securesms.components.TypingStatusSender;
|
||||
import org.thoughtcrime.securesms.crypto.KeyPairUtilities;
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
import org.thoughtcrime.securesms.database.LokiAPIDatabase;
|
||||
import org.thoughtcrime.securesms.dependencies.InjectableType;
|
||||
import org.thoughtcrime.securesms.dependencies.SignalCommunicationModule;
|
||||
import org.thoughtcrime.securesms.groups.OpenGroupManager;
|
||||
import org.thoughtcrime.securesms.home.HomeActivity;
|
||||
import org.thoughtcrime.securesms.jobmanager.DependencyInjector;
|
||||
import org.thoughtcrime.securesms.jobmanager.JobManager;
|
||||
import org.thoughtcrime.securesms.jobmanager.impl.JsonDataSerializer;
|
||||
|
@ -57,15 +63,10 @@ import org.thoughtcrime.securesms.jobs.FastJobStorage;
|
|||
import org.thoughtcrime.securesms.jobs.JobManagerFactories;
|
||||
import org.thoughtcrime.securesms.logging.AndroidLogger;
|
||||
import org.thoughtcrime.securesms.logging.UncaughtExceptionLogger;
|
||||
import org.thoughtcrime.securesms.home.HomeActivity;
|
||||
import org.thoughtcrime.securesms.notifications.BackgroundPollWorker;
|
||||
import org.thoughtcrime.securesms.notifications.LokiPushNotificationManager;
|
||||
import org.thoughtcrime.securesms.groups.OpenGroupManager;
|
||||
import org.thoughtcrime.securesms.database.LokiAPIDatabase;
|
||||
import org.thoughtcrime.securesms.util.Broadcaster;
|
||||
import org.thoughtcrime.securesms.notifications.FcmUtils;
|
||||
import org.thoughtcrime.securesms.util.UiModeUtilities;
|
||||
import org.thoughtcrime.securesms.notifications.DefaultMessageNotifier;
|
||||
import org.thoughtcrime.securesms.notifications.FcmUtils;
|
||||
import org.thoughtcrime.securesms.notifications.LokiPushNotificationManager;
|
||||
import org.thoughtcrime.securesms.notifications.NotificationChannels;
|
||||
import org.thoughtcrime.securesms.notifications.OptimizedMessageNotifier;
|
||||
import org.thoughtcrime.securesms.providers.BlobProvider;
|
||||
|
@ -75,6 +76,8 @@ import org.thoughtcrime.securesms.service.UpdateApkRefreshListener;
|
|||
import org.thoughtcrime.securesms.sskenvironment.ProfileManager;
|
||||
import org.thoughtcrime.securesms.sskenvironment.ReadReceiptManager;
|
||||
import org.thoughtcrime.securesms.sskenvironment.TypingStatusRepository;
|
||||
import org.thoughtcrime.securesms.util.Broadcaster;
|
||||
import org.thoughtcrime.securesms.util.UiModeUtilities;
|
||||
import org.thoughtcrime.securesms.util.dynamiclanguage.LocaleParseHelper;
|
||||
import org.webrtc.PeerConnectionFactory;
|
||||
import org.webrtc.PeerConnectionFactory.InitializationOptions;
|
||||
|
@ -93,9 +96,6 @@ import kotlin.Unit;
|
|||
import kotlinx.coroutines.Job;
|
||||
import network.loki.messenger.BuildConfig;
|
||||
|
||||
import static nl.komponents.kovenant.android.KovenantAndroid.startKovenant;
|
||||
import static nl.komponents.kovenant.android.KovenantAndroid.stopKovenant;
|
||||
|
||||
/**
|
||||
* Will be called once when the TextSecure process is created.
|
||||
* <p>
|
||||
|
@ -123,6 +123,7 @@ public class ApplicationContext extends Application implements DependencyInjecto
|
|||
public SignalCommunicationModule communicationModule;
|
||||
private Job firebaseInstanceIdJob;
|
||||
private Handler conversationListNotificationHandler;
|
||||
private final AndroidLogger logger = new AndroidLogger();
|
||||
|
||||
private volatile boolean isAppVisible;
|
||||
|
||||
|
@ -276,7 +277,7 @@ public class ApplicationContext extends Application implements DependencyInjecto
|
|||
}
|
||||
|
||||
private void initializeLogging() {
|
||||
Log.initialize(new AndroidLogger());
|
||||
Log.initialize(logger);
|
||||
}
|
||||
|
||||
private void initializeCrashHandling() {
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
package org.thoughtcrime.securesms.calls
|
||||
|
||||
import android.os.Bundle
|
||||
import network.loki.messenger.R
|
||||
import org.session.libsignal.utilities.Log
|
||||
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
|
||||
import org.webrtc.*
|
||||
|
||||
class WebRtcTestsActivity: PassphraseRequiredActionBarActivity(), PeerConnection.Observer,
|
||||
SdpObserver {
|
||||
|
||||
private val connectionFactory by lazy { PeerConnectionFactory.builder().createPeerConnectionFactory() }
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?, ready: Boolean) {
|
||||
super.onCreate(savedInstanceState, ready)
|
||||
setContentView(R.layout.activity_webrtc_tests)
|
||||
|
||||
val server = PeerConnection.IceServer.builder("stun:stun.l.google.com:19302").createIceServer()
|
||||
|
||||
val peerConnection = connectionFactory.createPeerConnection(listOf(server), this) ?: return
|
||||
Log.d("Loki-RTC", "peer connecting?")
|
||||
peerConnection.connectionState()
|
||||
val stream = connectionFactory.createLocalMediaStream("stream")
|
||||
val audioSource = connectionFactory.createAudioSource(MediaConstraints())
|
||||
val audioTrack = connectionFactory.createAudioTrack("audio", audioSource)
|
||||
stream.addTrack(audioTrack)
|
||||
peerConnection.addStream(stream)
|
||||
peerConnection.createOffer(this, MediaConstraints())
|
||||
}
|
||||
|
||||
override fun onSignalingChange(p0: PeerConnection.SignalingState?) {
|
||||
Log.d("Loki-RTC", "onSignalingChange: $p0")
|
||||
}
|
||||
|
||||
override fun onIceConnectionChange(p0: PeerConnection.IceConnectionState?) {
|
||||
Log.d("Loki-RTC", "onIceConnectionChange: $p0")
|
||||
}
|
||||
|
||||
override fun onIceConnectionReceivingChange(p0: Boolean) {
|
||||
Log.d("Loki-RTC", "onIceConnectionReceivingChange: $p0")
|
||||
}
|
||||
|
||||
override fun onIceGatheringChange(p0: PeerConnection.IceGatheringState?) {
|
||||
Log.d("Loki-RTC", "onIceGatheringChange: $p0")
|
||||
}
|
||||
|
||||
override fun onIceCandidate(p0: IceCandidate?) {
|
||||
Log.d("Loki-RTC", "onIceCandidate: $p0")
|
||||
}
|
||||
|
||||
override fun onIceCandidatesRemoved(p0: Array<out IceCandidate>?) {
|
||||
Log.d("Loki-RTC", "onIceCandidatesRemoved: $p0")
|
||||
}
|
||||
|
||||
override fun onAddStream(p0: MediaStream?) {
|
||||
Log.d("Loki-RTC", "onAddStream: $p0")
|
||||
}
|
||||
|
||||
override fun onRemoveStream(p0: MediaStream?) {
|
||||
Log.d("Loki-RTC", "onRemoveStream: $p0")
|
||||
}
|
||||
|
||||
override fun onDataChannel(p0: DataChannel?) {
|
||||
Log.d("Loki-RTC", "onDataChannel: $p0")
|
||||
}
|
||||
|
||||
override fun onRenegotiationNeeded() {
|
||||
Log.d("Loki-RTC", "onRenegotiationNeeded")
|
||||
}
|
||||
|
||||
override fun onAddTrack(p0: RtpReceiver?, p1: Array<out MediaStream>?) {
|
||||
Log.d("Loki-RTC", "onAddTrack: $p0: $p1")
|
||||
}
|
||||
|
||||
override fun onCreateSuccess(p0: SessionDescription) {
|
||||
Log.d("Loki-RTC", "onCreateSuccess: ${p0.description}, ${p0.type}")
|
||||
}
|
||||
|
||||
override fun onSetSuccess() {
|
||||
Log.d("Loki-RTC", "onSetSuccess")
|
||||
}
|
||||
|
||||
override fun onCreateFailure(p0: String?) {
|
||||
Log.d("Loki-RTC", "onCreateFailure: $p0")
|
||||
}
|
||||
|
||||
override fun onSetFailure(p0: String?) {
|
||||
Log.d("Loki-RTC", "onSetFailure: $p0")
|
||||
}
|
||||
|
||||
}
|
|
@ -39,6 +39,7 @@ import org.session.libsignal.utilities.toHexString
|
|||
import org.thoughtcrime.securesms.ApplicationContext
|
||||
import org.thoughtcrime.securesms.MuteDialog
|
||||
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
|
||||
import org.thoughtcrime.securesms.calls.WebRtcTestsActivity
|
||||
import org.thoughtcrime.securesms.conversation.v2.ConversationActivityV2
|
||||
import org.thoughtcrime.securesms.conversation.v2.utilities.NotificationUtils
|
||||
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil
|
||||
|
@ -52,7 +53,6 @@ import org.thoughtcrime.securesms.mms.GlideApp
|
|||
import org.thoughtcrime.securesms.mms.GlideRequests
|
||||
import org.thoughtcrime.securesms.onboarding.SeedActivity
|
||||
import org.thoughtcrime.securesms.onboarding.SeedReminderViewDelegate
|
||||
import org.thoughtcrime.securesms.preferences.SettingsActivity
|
||||
import org.thoughtcrime.securesms.util.*
|
||||
import java.io.IOException
|
||||
import java.util.*
|
||||
|
@ -400,8 +400,9 @@ class HomeActivity : PassphraseRequiredActionBarActivity(), ConversationClickLis
|
|||
}
|
||||
|
||||
private fun openSettings() {
|
||||
val intent = Intent(this, SettingsActivity::class.java)
|
||||
show(intent, isForResult = true)
|
||||
val intent = Intent(this, WebRtcTestsActivity::class.java)
|
||||
// val intent = Intent(this, SettingsActivity::class.java)
|
||||
show(intent, isForResult = false)
|
||||
}
|
||||
|
||||
private fun showPath() {
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package org.thoughtcrime.securesms.service
|
||||
|
||||
import android.app.Service
|
||||
import android.content.Intent
|
||||
import android.os.IBinder
|
||||
|
||||
class WebRtcCallService: Service() {
|
||||
|
||||
companion object {
|
||||
private const val ACTION_UPDATE = "UPDATE"
|
||||
private const val ACTION_STOP = "STOP"
|
||||
private const val ACTION_DENY_CALL = "DENY_CALL"
|
||||
private const val ACTION_LOCAL_HANGUP = "LOCAL_HANGUP"
|
||||
private const val ACTION_WANTS_BLUETOOTH = "WANTS_BLUETOOTH"
|
||||
private const val ACTION_CHANGE_POWER_BUTTON = "CHANGE_POWER_BUTTON"
|
||||
|
||||
private const val EXTRA_UPDATE_TYPE = "UPDATE_TYPE"
|
||||
private const val EXTRA_RECIPIENT_ID = "RECIPIENT_ID"
|
||||
private const val EXTRA_ENABLED = "ENABLED"
|
||||
|
||||
private const val INVALID_NOTIFICATION_ID = -1
|
||||
}
|
||||
|
||||
override fun onBind(intent: Intent?): IBinder? = null
|
||||
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
|
||||
</RelativeLayout>
|
Loading…
Reference in New Issue