Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f62c076f authored by George Lin's avatar George Lin Committed by Android (Google) Code Review
Browse files

Merge "Fix b/306655749" into main

parents fb28cd4e 61bef8d0
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ import javax.inject.Singleton
@Singleton
class AppSessionId @Inject constructor() {

    private val idSequence = InstanceIdSequence(INSTANCE_ID_MAX)

    private var sessionId: InstanceId = newInstanceId()

    fun createNewId(): AppSessionId {
@@ -34,7 +36,7 @@ class AppSessionId @Inject constructor() {
        return sessionId.hashCode()
    }

    private fun newInstanceId(): InstanceId = InstanceIdSequence(INSTANCE_ID_MAX).newInstanceId()
    private fun newInstanceId(): InstanceId = idSequence.newInstanceId()

    companion object {
        // At most 20 bits: ~1m possibilities, ~0.5% probability of collision in 100 values