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

Commit cfc21b60 authored by ESWAR MAGATAPALLI (xWF)'s avatar ESWAR MAGATAPALLI (xWF) Committed by Android (Google) Code Review
Browse files

Merge "Revert "Add lock screen content description in coroutine"" into main

parents 207534fa 5c846684
Loading
Loading
Loading
Loading
+35 −52
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import android.view.accessibility.AccessibilityNodeInfo
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.repeatOnLifecycle
import com.android.app.tracing.coroutines.launchTraced as launch
import com.android.systemui.common.ui.view.TouchHandlingView
import com.android.systemui.keyguard.ui.viewmodel.KeyguardTouchHandlingViewModel
import com.android.systemui.lifecycle.WindowLifecycleState
@@ -32,7 +31,6 @@ import com.android.systemui.lifecycle.viewModel
import com.android.systemui.plugins.FalsingManager
import com.android.systemui.res.R
import kotlinx.coroutines.awaitCancellation
import kotlinx.coroutines.flow.MutableStateFlow

object KeyguardTouchViewBinder {
    /**
@@ -58,21 +56,7 @@ object KeyguardTouchViewBinder {
            )

        view.repeatWhenAttached {
            val isLongPressHandlingEnabled = MutableStateFlow(false)

            repeatOnLifecycle(Lifecycle.State.STARTED) {
                launch("$TAG#viewModel.isLongPressHandlingEnabled") {
                    isLongPressHandlingEnabled.collect { isEnabled ->
                        view.contentDescription =
                            if (isEnabled) {
                                view.resources.getString(R.string.accessibility_desc_lock_screen)
                            } else {
                                null
                            }
                    }
                }
            }

                view.viewModel(
                    traceName = "KeyguardTouchViewBinderViewModel",
                    minWindowLifecycleState = WindowLifecycleState.ATTACHED,
@@ -81,8 +65,6 @@ object KeyguardTouchViewBinder {
                    view.setSnapshotBinding {
                        view.setLongPressHandlingEnabled(viewModel.isLongPressHandlingEnabled)
                        view.setDoublePressHandlingEnabled(viewModel.isDoubleTapHandlingEnabled)

                    isLongPressHandlingEnabled.value = viewModel.isLongPressHandlingEnabled
                    }

                    view.listener =
@@ -123,6 +105,7 @@ object KeyguardTouchViewBinder {
                }
            }
        }
    }

    private const val TAG = "KeyguardTouchViewBinder"
}