Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ public abstract class io/getstream/video/android/ui/common/StreamCallActivity :
public fun onResume (Lio/getstream/video/android/core/Call;)V
public final fun onStop ()V
public fun onStop (Lio/getstream/video/android/core/Call;)V
public final fun onUserLeaveHint ()V
public fun onUserLeaveHint (Lio/getstream/video/android/core/Call;)V
public fun reject (Lio/getstream/video/android/core/Call;Lio/getstream/video/android/core/model/RejectReason;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;)V
public static synthetic fun reject$default (Lio/getstream/video/android/ui/common/StreamCallActivity;Lio/getstream/video/android/core/Call;Lio/getstream/video/android/core/model/RejectReason;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)V
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import android.app.PictureInPictureParams
import android.content.Context
import android.content.Intent
import android.content.pm.ActivityInfo
import android.content.pm.PackageManager
import android.os.Build
import android.os.Bundle
import android.os.PersistableBundle
Expand Down Expand Up @@ -231,6 +232,13 @@ public abstract class StreamCallActivity : ComponentActivity() {
}
}

public final override fun onUserLeaveHint() {
withCachedCall {
onUserLeaveHint(it)
super.onUserLeaveHint()
}
}

public final override fun onPause() {
withCachedCall {
onPause(it)
Expand Down Expand Up @@ -352,20 +360,36 @@ public abstract class StreamCallActivity : ComponentActivity() {
}

/**
* Called when the activity is paused. Makes sure the call object is available.
* Called when the activity is about to go into the background as the result of user choice. Makes sure the call object is available.
*
* @param call the call
*/
public open fun onPause(call: Call) {
public open fun onUserLeaveHint(call: Call) {
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
// Default PiP behavior
if (isConnected(call) &&
if (packageManager.hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE) &&
isConnected(call) &&
!isChangingConfigurations &&
isVideoCall(call) &&
!isInPictureInPictureMode
) {
enterPictureInPicture()
try {
enterPictureInPicture()
} catch (e: Exception) {
logger.e(e) { "[onUserLeaveHint] Something went wrong when entering PiP." }
}
}

logger.d { "DefaultCallActivity - Leave Hinted (call -> $call)" }
}

/**
* Called when the activity is paused. Makes sure the call object is available.
*
* @param call the call
*/
public open fun onPause(call: Call) {
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
logger.d { "DefaultCallActivity - Paused (call -> $call)" }
}

Expand Down
Loading