Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Jitsi SDK to 6.2.2 #6195

Merged
merged 12 commits into from
Nov 2, 2022
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ allprojects {
}
// Jitsi repo
maven {
url "https://github.com/vector-im/jitsi_libre_maven/raw/main/android-sdk-5.0.2"
url "https://github.com/vector-im/jitsi_libre_maven/raw/main/android-sdk-6.2.2"
// Note: to test Jitsi release you can use a local file like this:
// url "file:///Users/bmarty/workspaces/jitsi_libre_maven/android-sdk-3.10.0"
// url "file:///Users/bmarty/workspaces/jitsi_libre_maven/android-sdk-6.2.2"
content {
groups.jitsi.regex.each { includeGroupByRegex it }
groups.jitsi.group.each { includeGroup it }
Expand Down
1 change: 1 addition & 0 deletions changelog.d/6195.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Upgrade Jitsi SDK to 6.2.2 and WebRtc to 1.106.1-jitsi-12039821.
2 changes: 1 addition & 1 deletion docs/jitsi.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ url "https://github.com/vector-im/jitsi_libre_maven/raw/master/android-sdk-3.10.

- Build the project and perform the sanity tests again.

- Update the file `/CHANGES.md` to notify about the library upgrade, and create a regular PR for project Element Android.
- Create a PR for project Element Android and add a changelog file `<PR_NUMBER>.misc` to notify about the library upgrade.
8 changes: 2 additions & 6 deletions tools/jitsi/build_jisti_libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,8 @@ export LIBRE_BUILD=true

cd jitsi-meet

# This is commit after version 2.2.2, which does not compile
# git checkout 5a934c071a5cbe64de275a25d0ed62d8193cdd03

# Changelog: https://github.com/jitsi/jitsi-meet-release-notes/blob/master/CHANGELOG-MOBILE-SDKS.md

git checkout android-sdk-5.0.2
# Get the latest version from the changelog: https://github.com/jitsi/jitsi-meet-release-notes/blob/master/CHANGELOG-MOBILE-SDKS.md
git checkout android-sdk-6.2.2

echo
echo "##################################################"
Expand Down
1 change: 1 addition & 0 deletions vector-app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<application>
<activity android:name="im.vector.app.features.debug.TestLinkifyActivity" />
<activity android:name="im.vector.app.features.debug.DebugPermissionActivity" />
<activity android:name="im.vector.app.features.debug.jitsi.DebugJitsiActivity" />
<activity android:name="im.vector.app.features.debug.analytics.DebugAnalyticsActivity" />
<activity android:name="im.vector.app.features.debug.settings.DebugPrivateSettingsActivity" />
<activity android:name="im.vector.app.features.debug.sas.DebugSasEmojiActivity" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import im.vector.app.core.utils.registerForPermissionsResult
import im.vector.app.core.utils.toast
import im.vector.app.features.debug.analytics.DebugAnalyticsActivity
import im.vector.app.features.debug.features.DebugFeaturesSettingsActivity
import im.vector.app.features.debug.jitsi.DebugJitsiActivity
import im.vector.app.features.debug.leak.DebugMemoryLeaksActivity
import im.vector.app.features.debug.sas.DebugSasEmojiActivity
import im.vector.app.features.debug.settings.DebugPrivateSettingsActivity
Expand Down Expand Up @@ -121,6 +122,9 @@ class DebugMenuActivity : VectorBaseActivity<ActivityDebugMenuBinding>() {
views.debugPermission.setOnClickListener {
startActivity(Intent(this, DebugPermissionActivity::class.java))
}
views.debugJitsi.setOnClickListener {
startActivity(Intent(this, DebugJitsiActivity::class.java))
}
}

private fun openPrivateSettings() {
Expand Down Expand Up @@ -175,7 +179,7 @@ class DebugMenuActivity : VectorBaseActivity<ActivityDebugMenuBinding>() {
.setContentText("Content")
// No effect because it's a group summary notif
.setNumber(33)
.setSmallIcon(R.drawable.ic_status_bar)
.setSmallIcon(R.drawable.ic_notification)
// This provocate the badge issue: no badge for group notification
.setGroup("GroupKey")
.setGroupSummary(true)
Expand Down Expand Up @@ -208,7 +212,7 @@ class DebugMenuActivity : VectorBaseActivity<ActivityDebugMenuBinding>() {
// For shortcut on long press on launcher icon
.setBadgeIconType(NotificationCompat.BADGE_ICON_NONE)
.setStyle(messagingStyle1)
.setSmallIcon(R.drawable.ic_status_bar)
.setSmallIcon(R.drawable.ic_notification)
.setGroup("GroupKey")
.build()
)
Expand All @@ -220,7 +224,7 @@ class DebugMenuActivity : VectorBaseActivity<ActivityDebugMenuBinding>() {
.setContentTitle("Title 2")
.setContentText("Content 2")
.setStyle(messagingStyle2)
.setSmallIcon(R.drawable.ic_status_bar)
.setSmallIcon(R.drawable.ic_notification)
.setGroup("GroupKey")
.build()
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (c) 2022 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package im.vector.app.features.debug.jitsi

import android.annotation.SuppressLint
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.core.platform.VectorBaseActivity
import im.vector.application.databinding.ActivityDebugJitsiBinding
import org.jitsi.meet.sdk.JitsiMeet

@AndroidEntryPoint
class DebugJitsiActivity : VectorBaseActivity<ActivityDebugJitsiBinding>() {

override fun getBinding() = ActivityDebugJitsiBinding.inflate(layoutInflater)

override fun getCoordinatorLayout() = views.coordinatorLayout

@SuppressLint("SetTextI18n")
override fun initUiAndData() {
val isCrashReportingDisabled = JitsiMeet.isCrashReportingDisabled(this)
views.status.text = "Jitsi crash reporting is disabled: $isCrashReportingDisabled"

views.splash.setOnClickListener {
JitsiMeet.showSplashScreen(this)
}

views.dev.setOnClickListener {
JitsiMeet.showDevOptions()
}
}
}
47 changes: 47 additions & 0 deletions vector-app/src/debug/res/layout/activity_debug_jitsi.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="im.vector.app.features.debug.jitsi.DebugJitsiActivity"
tools:ignore="HardcodedText">

<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@drawable/linear_divider"
android:gravity="center_horizontal"
android:orientation="vertical"
android:padding="@dimen/layout_horizontal_margin"
android:showDividers="middle">

<TextView
android:id="@+id/status"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Status" />

<Button
android:id="@+id/splash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Splash"
android:textAllCaps="false" />

<Button
android:id="@+id/dev"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Dev options"
android:textAllCaps="false" />

</LinearLayout>

</ScrollView>

</androidx.coordinatorlayout.widget.CoordinatorLayout>
6 changes: 6 additions & 0 deletions vector-app/src/debug/res/layout/activity_debug_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@
android:layout_height="wrap_content"
android:text="Permissions" />

<Button
android:id="@+id/debug_jitsi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Jitsi" />

</LinearLayout>

</ScrollView>
Expand Down
11 changes: 8 additions & 3 deletions vector/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,10 @@ dependencies {
// WebRTC
// org.webrtc:google-webrtc is for development purposes only
// implementation 'org.webrtc:google-webrtc:1.0.+'
implementation('com.facebook.react:react-native-webrtc:1.94.2-jitsi-10227332@aar')

implementation('com.facebook.react:react-native-webrtc:1.106.1-jitsi-12039821@aar')
// Jitsi
api('org.jitsi.react:jitsi-meet-sdk:5.0.2') {
// Note: version is 6.2.0, but built from the tag `android-sdk-6.2.2`.
api('org.jitsi.react:jitsi-meet-sdk:6.2.0') {
exclude group: 'com.google.firebase'
exclude group: 'com.google.android.gms'
exclude group: 'com.android.installreferrer'
Expand Down Expand Up @@ -305,6 +305,11 @@ dependencies {
exclude group: "org.jetbrains.kotlinx", module: "kotlinx-coroutines-debug"
}

// Fix issue with Jitsi. Inspired from https://github.com/android/android-test/issues/861#issuecomment-872067868
// Error was lots of `Duplicate class org.checkerframework.common.reflection.qual.MethodVal found in modules jetified-checker-3.1 (org.checkerframework:checker:3.1.1) and jetified-checker-qual-3.12.0 (org.checkerframework:checker-qual:3.12.0)
//noinspection GradleDependency Cannot use latest 3.15.0 since it required min API 26.
implementation "org.checkerframework:checker:3.11.0"

androidTestImplementation libs.androidx.testCore
androidTestImplementation libs.androidx.testRunner
androidTestImplementation libs.androidx.testRules
Expand Down
2 changes: 1 addition & 1 deletion vector/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<!-- Jitsi SDK is now API23+ -->
<uses-sdk tools:overrideLibrary="org.jitsi.meet.sdk,com.oney.WebRTCModule,com.learnium.RNDeviceInfo,com.reactnativecommunity.asyncstorage,com.ocetnik.timer,com.calendarevents,com.reactnativecommunity.netinfo,com.kevinresol.react_native_default_preference,com.rnimmersive,com.corbt.keepawake,com.BV.LinearGradient,com.horcrux.svg,com.oblador.performance,com.reactnativecommunity.slider,com.brentvatne.react,com.reactnativecommunity.clipboard,com.swmansion.gesturehandler.react,org.linusu,org.reactnative.maskedview,com.reactnativepagerview,com.swmansion.reanimated,com.th3rdwave.safeareacontext,com.swmansion.rnscreens,org.devio.rn.splashscreen,com.reactnativecommunity.webview" />
<uses-sdk tools:overrideLibrary="org.jitsi.meet.sdk,com.oney.WebRTCModule,com.learnium.RNDeviceInfo,com.reactnativecommunity.asyncstorage,com.ocetnik.timer,com.calendarevents,com.reactnativecommunity.netinfo,com.kevinresol.react_native_default_preference,com.rnimmersive,com.corbt.keepawake,com.BV.LinearGradient,com.horcrux.svg,com.oblador.performance,com.reactnativecommunity.slider,com.brentvatne.react,com.reactnativecommunity.clipboard,com.swmansion.gesturehandler.react,org.linusu,org.reactnative.maskedview,com.reactnativepagerview,com.swmansion.reanimated,com.th3rdwave.safeareacontext,com.swmansion.rnscreens,org.devio.rn.splashscreen,com.reactnativecommunity.webview,org.wonday.orientation" />

<!-- Adding CAMERA permission prevents Chromebooks to see the application on the PlayStore -->
<!-- Tell that the Camera is not mandatory to install the application -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.LifecycleOwner
import androidx.localbroadcastmanager.content.LocalBroadcastManager
import com.facebook.react.bridge.JavaOnlyMap
import im.vector.app.config.Config
import org.jitsi.meet.sdk.BroadcastEmitter
import org.jitsi.meet.sdk.BroadcastEvent
import org.jitsi.meet.sdk.JitsiMeet
Expand All @@ -35,6 +36,7 @@ sealed class ConferenceEvent(open val data: Map<String, Any>) {
data class Terminated(override val data: Map<String, Any>) : ConferenceEvent(data)
data class WillJoin(override val data: Map<String, Any>) : ConferenceEvent(data)
data class Joined(override val data: Map<String, Any>) : ConferenceEvent(data)
object ReadyToClose : ConferenceEvent(emptyMap())

fun extractConferenceUrl(): String? {
return data[CONFERENCE_URL_DATA_KEY] as? String
Expand Down Expand Up @@ -84,14 +86,24 @@ class ConferenceEventObserver(

private fun onBroadcastReceived(intent: Intent) {
val event = BroadcastEvent(intent)
safeLog("onBroadcastReceived: Event received (type ${event.type})", event.data)
val conferenceEvent = when (event.type) {
BroadcastEvent.Type.CONFERENCE_JOINED -> ConferenceEvent.Joined(event.data)
BroadcastEvent.Type.CONFERENCE_TERMINATED -> ConferenceEvent.Terminated(event.data)
BroadcastEvent.Type.CONFERENCE_WILL_JOIN -> ConferenceEvent.WillJoin(event.data)
BroadcastEvent.Type.READY_TO_CLOSE -> ConferenceEvent.ReadyToClose
else -> null
}
if (conferenceEvent != null) {
onBroadcastEvent(conferenceEvent)
}
}

private fun safeLog(message: String, sensitiveData: Any?) {
if (Config.LOW_PRIVACY_LOG_ENABLE) {
Timber.v("$message: $sensitiveData")
} else {
Timber.v(message)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package im.vector.app.features.call.conference
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.content.res.Configuration
import android.os.Build
import android.os.Bundle
import android.os.Parcelable
Expand All @@ -28,6 +29,7 @@ import androidx.core.app.PictureInPictureModeChangedInfo
import androidx.core.util.Consumer
import androidx.core.view.isVisible
import androidx.lifecycle.Lifecycle
import androidx.localbroadcastmanager.content.LocalBroadcastManager
import com.airbnb.mvrx.Fail
import com.airbnb.mvrx.Mavericks
import com.airbnb.mvrx.Success
Expand All @@ -40,10 +42,12 @@ import im.vector.app.core.platform.VectorBaseActivity
import im.vector.app.databinding.ActivityJitsiBinding
import im.vector.lib.core.utils.compat.getParcelableExtraCompat
import kotlinx.parcelize.Parcelize
import org.jitsi.meet.sdk.BroadcastIntentHelper
import org.jitsi.meet.sdk.JitsiMeet
import org.jitsi.meet.sdk.JitsiMeetActivityDelegate
import org.jitsi.meet.sdk.JitsiMeetActivityInterface
import org.jitsi.meet.sdk.JitsiMeetConferenceOptions
import org.jitsi.meet.sdk.JitsiMeetOngoingConferenceService
import org.jitsi.meet.sdk.JitsiMeetView
import org.matrix.android.sdk.api.extensions.tryOrNull
import org.matrix.android.sdk.api.util.JsonDict
Expand All @@ -66,6 +70,13 @@ class VectorJitsiActivity : VectorBaseActivity<ActivityJitsiBinding>(), JitsiMee

private val jitsiViewModel: JitsiCallViewModel by viewModel()

override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
val intent = Intent("onConfigurationChanged")
intent.putExtra("newConfig", newConfig)
LocalBroadcastManager.getInstance(this).sendBroadcast(intent)
}

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
addOnPictureInPictureModeChangedListener(pictureInPictureModeChangedInfoConsumer)
Expand Down Expand Up @@ -105,17 +116,26 @@ class VectorJitsiActivity : VectorBaseActivity<ActivityJitsiBinding>(), JitsiMee

override fun onDestroy() {
val currentConf = JitsiMeet.getCurrentConference()
jitsiMeetView?.leave()
handleLeaveConference()
jitsiMeetView?.dispose()
// Fake emitting CONFERENCE_TERMINATED event when currentConf is not null (probably when closing the PiP screen).
if (currentConf != null) {
ConferenceEventEmitter(this).emitConferenceEnded()
}
JitsiMeetOngoingConferenceService.abort(this)
JitsiMeetActivityDelegate.onHostDestroy(this)
removeOnPictureInPictureModeChangedListener(pictureInPictureModeChangedInfoConsumer)
super.onDestroy()
}

// Activity lifecycle methods
//
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
@Suppress("DEPRECATION")
super.onActivityResult(requestCode, resultCode, data)
JitsiMeetActivityDelegate.onActivityResult(this, requestCode, resultCode, data)
}

override fun onBackPressed() {
JitsiMeetActivityDelegate.onBackPressed()
}
Expand All @@ -128,7 +148,8 @@ class VectorJitsiActivity : VectorBaseActivity<ActivityJitsiBinding>(), JitsiMee
}

private fun handleLeaveConference() {
jitsiMeetView?.leave()
val leaveBroadcastIntent = BroadcastIntentHelper.buildHangUpIntent()
LocalBroadcastManager.getInstance(applicationContext).sendBroadcast(leaveBroadcastIntent)
}

private fun handleConfirmSwitching(action: JitsiCallViewEvents.ConfirmSwitchingConference) {
Expand Down Expand Up @@ -222,10 +243,17 @@ class VectorJitsiActivity : VectorBaseActivity<ActivityJitsiBinding>(), JitsiMee
Timber.v("Broadcast received: $event")
when (event) {
is ConferenceEvent.Terminated -> onConferenceTerminated(event.data)
else -> Unit
is ConferenceEvent.Joined -> onConferenceJoined(event.data)
is ConferenceEvent.ReadyToClose -> onReadyToClose()
is ConferenceEvent.WillJoin -> Unit
}
}

private fun onConferenceJoined(extraData: Map<String, Any>) {
// Launch the service for the ongoing notification.
JitsiMeetOngoingConferenceService.launch(this, HashMap(extraData))
}

private fun onConferenceTerminated(data: JsonDict) {
Timber.v("JitsiMeetViewListener.onConferenceTerminated()")
// Do not finish if there is an error
Expand All @@ -234,6 +262,11 @@ class VectorJitsiActivity : VectorBaseActivity<ActivityJitsiBinding>(), JitsiMee
}
}

private fun onReadyToClose() {
Timber.v("SDK is ready to close")
finish()
}

companion object {
fun newIntent(context: Context, roomId: String, widgetId: String, enableVideo: Boolean): Intent {
return Intent(context, VectorJitsiActivity::class.java).apply {
Expand Down
Loading