Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
feat(android): fixed screen sharing for Android 33 (#14359)
Calinteodora98eef7eb385
diff --git a/android/build.gradle b/android/build.gradleindex ffbc66f191..4d525c6662 100644--- a/android/build.gradle+++ b/android/build.gradle@@ -19,9 +19,9 @@ buildscript {ext {kotlinVersion = "1.7.0"buildToolsVersion = "33.0.2"- compileSdkVersion = 34+ compileSdkVersion = 33minSdkVersion = 24- targetSdkVersion = 34+ targetSdkVersion = 33supportLibVersion = "28.0.0"// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetMediaProjectionService.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetMediaProjectionService.javaindex e197ff626e..ffbbc5da78 100644--- a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetMediaProjectionService.java+++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetMediaProjectionService.java@@ -28,6 +28,8 @@ import android.os.IBinder;import org.jitsi.meet.sdk.log.JitsiMeetLogger;+import java.util.Random;+/*** This class implements an Android {@link Service}, a foreground one specifically, and it's@@ -39,6 +41,8 @@ import org.jitsi.meet.sdk.log.JitsiMeetLogger;public class JitsiMeetMediaProjectionService extends Service {private static final String TAG = JitsiMeetMediaProjectionService.class.getSimpleName();+ static final int NOTIFICATION_ID = new Random().nextInt(99999) + 10000;+public static void launch(Context context) {OngoingNotification.createOngoingConferenceNotificationChannel();@@ -70,30 +74,27 @@ public class JitsiMeetMediaProjectionService extends Service {}@Override- public void onCreate() {- super.onCreate();+ public IBinder onBind(Intent intent) {+ return null;+ }++ @Override+ public int onStartCommand(Intent intent, int flags, int startId) {Notification notification = OngoingNotification.buildOngoingConferenceNotification(null);if (notification == null) {stopSelf();JitsiMeetLogger.w(TAG + " Couldn't start service, notification is null");++ return START_NOT_STICKY;}if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {- startForeground(OngoingNotification.NOTIFICATION_ID, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION);+ startForeground(NOTIFICATION_ID, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION);} else {- startForeground(OngoingNotification.NOTIFICATION_ID, notification);+ startForeground(NOTIFICATION_ID, notification);}- }-- @Override- public IBinder onBind(Intent intent) {- return null;- }-- @Override- public int onStartCommand(Intent intent, int flags, int startId) {return START_NOT_STICKY;}diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetOngoingConferenceService.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetOngoingConferenceService.javaindex e26eee777c..7db7226e1e 100644--- a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetOngoingConferenceService.java+++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetOngoingConferenceService.java@@ -33,6 +33,7 @@ import androidx.localbroadcastmanager.content.LocalBroadcastManager;import org.jitsi.meet.sdk.log.JitsiMeetLogger;import java.util.HashMap;+import java.util.Random;/*** This class implements an Android {@link Service}, a foreground one specifically, and it's@@ -52,6 +53,9 @@ public class JitsiMeetOngoingConferenceService extends Serviceprivate boolean isAudioMuted;+ static final int NOTIFICATION_ID = new Random().nextInt(99999) + 10000;++public static void launch(Context context, HashMap<String, Object> extraData) {OngoingNotification.createOngoingConferenceNotificationChannel();@@ -96,9 +100,9 @@ public class JitsiMeetOngoingConferenceService extends ServiceJitsiMeetLogger.w(TAG + " Couldn't start service, notification is null");} else {if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {- startForeground(OngoingNotification.NOTIFICATION_ID, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK);+ startForeground(NOTIFICATION_ID, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK);} else {- startForeground(OngoingNotification.NOTIFICATION_ID, notification);+ startForeground(NOTIFICATION_ID, notification);}}@@ -136,7 +140,7 @@ public class JitsiMeetOngoingConferenceService extends ServiceJitsiMeetLogger.w(TAG + " Couldn't start service, notification is null");} else {NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);- notificationManager.notify(OngoingNotification.NOTIFICATION_ID, notification);+ notificationManager.notify(NOTIFICATION_ID, notification);}}@@ -222,7 +226,7 @@ public class JitsiMeetOngoingConferenceService extends ServiceJitsiMeetLogger.w(TAG + " Couldn't update service, notification is null");} else {NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);- notificationManager.notify(OngoingNotification.NOTIFICATION_ID, notification);+ notificationManager.notify(NOTIFICATION_ID, notification);JitsiMeetLogger.i(TAG + " audio muted changed");}diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/OngoingNotification.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/OngoingNotification.javaindex 5ed402457e..07cc38dc45 100644--- a/android/sdk/src/main/java/org/jitsi/meet/sdk/OngoingNotification.java+++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/OngoingNotification.java@@ -41,7 +41,6 @@ import java.util.Random;class OngoingNotification {private static final String TAG = OngoingNotification.class.getSimpleName();- static final int NOTIFICATION_ID = new Random().nextInt(99999) + 10000;private static long startingTime = 0;static void createOngoingConferenceNotificationChannel() {diff --git a/react/features/base/tracks/actions.native.ts b/react/features/base/tracks/actions.native.tsindex 700cc7c6b7..9debfe1315 100644--- a/react/features/base/tracks/actions.native.ts+++ b/react/features/base/tracks/actions.native.ts@@ -33,12 +33,12 @@ export function toggleScreensharing(enabled: boolean, _ignore1?: boolean, _ignorif (enabled) {const isSharing = isLocalVideoTrackDesktop(state);- if (!isSharing) {- _startScreenSharing(dispatch, state);+ if (isSharing) {+ Platform.OS === 'android' && JitsiMeetMediaProjectionModule.abort();+ } else {Platform.OS === 'android' && JitsiMeetMediaProjectionModule.launch();+ _startScreenSharing(dispatch, state);}-- Platform.OS === 'android' && JitsiMeetMediaProjectionModule.abort();} else {dispatch(setScreenshareMuted(true));dispatch(setVideoMuted(false, VIDEO_MUTISM_AUTHORITY.SCREEN_SHARE));