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

Looper on a different thread for the SessionLifecycleClient's callbacks #5447

Merged
merged 6 commits into from
Oct 20, 2023
Merged
Changes from 1 commit
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 @@ -21,6 +21,7 @@ import android.content.Context
import android.content.Intent
import android.content.ServiceConnection
import android.os.Handler
import android.os.HandlerThread
import android.os.IBinder
import android.os.Looper
import android.os.Message
Expand Down Expand Up @@ -54,13 +55,14 @@ internal object SessionLifecycleClient {
private var serviceBound: Boolean = false
private val queuedMessages = LinkedBlockingDeque<Message>(MAX_QUEUED_MESSAGES)
private var curSessionId: String = ""
private var handlerThread: HandlerThread = HandlerThread("FirebaseSessionsClient_HandlerThread")
jrothfeder marked this conversation as resolved.
Show resolved Hide resolved

/**
* The callback class that will be used to receive updated session events from the
* [SessionLifecycleService].
*/
// TODO(rothbutter) should we use the main looper or is there one available in this SDK?
internal class ClientUpdateHandler : Handler(Looper.getMainLooper()) {
internal class ClientUpdateHandler : Handler(handlerThread.looper) {
override fun handleMessage(msg: Message) {
when (msg.what) {
SessionLifecycleService.SESSION_UPDATED ->
Expand Down
Loading