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

Commit eda2ac9f authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Revert "Adds LongPressHandlingView to KeyguardRootView."" into udc-qpr-dev

parents 42058f12 b0202761
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -89,9 +89,8 @@ class LongPressHandlingView(
    }

    @SuppressLint("ClickableViewAccessibility")
    override fun onTouchEvent(event: MotionEvent): Boolean {
        super.onTouchEvent(event)
        return interactionHandler.onTouchEvent(event.toModel())
    override fun onTouchEvent(event: MotionEvent?): Boolean {
        return interactionHandler.onTouchEvent(event?.toModel())
    }
}

+3 −33
Original line number Diff line number Diff line
@@ -24,15 +24,12 @@ import com.android.keyguard.KeyguardStatusViewController
import com.android.keyguard.dagger.KeyguardStatusViewComponent
import com.android.systemui.CoreStartable
import com.android.systemui.R
import com.android.systemui.animation.view.LaunchableLinearLayout
import com.android.systemui.common.ui.view.LongPressHandlingView
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.flags.FeatureFlags
import com.android.systemui.flags.Flags
import com.android.systemui.keyguard.ui.binder.KeyguardAmbientIndicationAreaViewBinder
import com.android.systemui.keyguard.ui.binder.KeyguardBlueprintViewBinder
import com.android.systemui.keyguard.ui.binder.KeyguardIndicationAreaBinder
import com.android.systemui.keyguard.ui.binder.KeyguardLongPressViewBinder
import com.android.systemui.keyguard.ui.binder.KeyguardQuickAffordanceViewBinder
import com.android.systemui.keyguard.ui.binder.KeyguardRootViewBinder
import com.android.systemui.keyguard.ui.binder.KeyguardSettingsViewBinder
@@ -41,7 +38,6 @@ import com.android.systemui.keyguard.ui.view.layout.KeyguardBlueprintCommandList
import com.android.systemui.keyguard.ui.viewmodel.KeyguardAmbientIndicationViewModel
import com.android.systemui.keyguard.ui.viewmodel.KeyguardBlueprintViewModel
import com.android.systemui.keyguard.ui.viewmodel.KeyguardIndicationAreaViewModel
import com.android.systemui.keyguard.ui.viewmodel.KeyguardLongPressViewModel
import com.android.systemui.keyguard.ui.viewmodel.KeyguardQuickAffordancesCombinedViewModel
import com.android.systemui.keyguard.ui.viewmodel.KeyguardRootViewModel
import com.android.systemui.keyguard.ui.viewmodel.KeyguardSettingsMenuViewModel
@@ -80,7 +76,6 @@ constructor(
    private val falsingManager: FalsingManager,
    private val vibratorHelper: VibratorHelper,
    private val keyguardStateController: KeyguardStateController,
    private val keyguardLongPressViewModel: KeyguardLongPressViewModel,
    private val keyguardSettingsMenuViewModel: KeyguardSettingsMenuViewModel,
    private val activityStarter: ActivityStarter,
    private val occludingAppDeviceEntryMessageViewModel: OccludingAppDeviceEntryMessageViewModel,
@@ -110,7 +105,7 @@ constructor(
        bindLeftShortcut()
        bindRightShortcut()
        bindAmbientIndicationArea()
        bindSettingsPopupMenu(notificationPanel)
        bindSettingsPopupMenu()

        KeyguardBlueprintViewBinder.bind(keyguardRootView, keyguardBlueprintViewModel)
        keyguardBlueprintCommandListener.start()
@@ -199,34 +194,12 @@ constructor(
        }
    }

    private fun bindSettingsPopupMenu(legacyParent: ViewGroup) {
    private fun bindSettingsPopupMenu() {
        if (featureFlags.isEnabled(Flags.MIGRATE_SPLIT_KEYGUARD_BOTTOM_AREA)) {
            // Remove the legacy long-press view from the NotificationPanelView where it used to be
            // before this refactor such that we only have one long-press view at the bottom of
            // KeyguardRootView.
            val legacyLongPressView = legacyParent.requireViewById<View>(R.id.keyguard_long_press)
            legacyParent.removeView(legacyLongPressView)

            val longPressView: LongPressHandlingView =
                keyguardRootView.requireViewById(R.id.keyguard_long_press)
            val settingsMenuView: LaunchableLinearLayout =
                keyguardRootView.requireViewById(R.id.keyguard_settings_button)

            // Bind the long-press view that (1) triggers the showing of the settings popup menu and
            // (2) captures touch events outside of the shown settings popup menu to hide it.
            KeyguardLongPressViewBinder.bind(
                view = longPressView,
                viewModel = keyguardLongPressViewModel,
                onSingleTap = {},
                falsingManager = falsingManager,
                settingsMenuView = settingsMenuView,
            )

            // Bind the settings popup menu.
            settingsPopupMenuHandle?.dispose()
            settingsPopupMenuHandle =
                KeyguardSettingsViewBinder.bind(
                    settingsMenuView,
                    keyguardRootView,
                    keyguardSettingsMenuViewModel,
                    vibratorHelper,
                    activityStarter,
@@ -235,9 +208,6 @@ constructor(
            keyguardRootView.findViewById<View?>(R.id.keyguard_settings_button)?.let {
                keyguardRootView.removeView(it)
            }
            keyguardRootView.findViewById<View?>(R.id.keyguard_long_press)?.let {
                keyguardRootView.removeView(it)
            }
        }
    }

+8 −0
Original line number Diff line number Diff line
@@ -99,3 +99,11 @@ interface KeyguardBlueprint {

    fun apply(constraintSet: ConstraintSet)
}

/**
 * Lower level modules that determine constraints for a particular section in the lockscreen root
 * view.
 */
interface KeyguardSection {
    fun apply(constraintSet: ConstraintSet)
}
+0 −27
Original line number Diff line number Diff line
/*
 * Copyright 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.keyguard.shared.model

import androidx.constraintlayout.widget.ConstraintSet

/**
 * Lower level modules that determine constraints for a particular section in the lockscreen root
 * view.
 */
interface KeyguardSection {
    fun apply(constraintSet: ConstraintSet)
}
+29 −18
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.systemui.keyguard.ui.binder

import android.annotation.SuppressLint
import android.content.Intent
import android.graphics.Rect
import android.graphics.drawable.Animatable2
import android.util.Size
import android.view.View
@@ -118,6 +119,17 @@ object KeyguardBottomAreaViewBinder {

        view.clipChildren = false
        view.clipToPadding = false
        view.setOnTouchListener { _, event ->
            if (settingsMenu.isVisible) {
                val hitRect = Rect()
                settingsMenu.getHitRect(hitRect)
                if (!hitRect.contains(event.x.toInt(), event.y.toInt())) {
                    viewModel.onTouchedOutsideLockScreenSettingsMenu()
                }
            }

            false
        }

        val configurationBasedDimensions = MutableStateFlow(loadFromResources(view))

@@ -373,8 +385,7 @@ object KeyguardBottomAreaViewBinder {
        view.isClickable = viewModel.isClickable
        if (viewModel.isClickable) {
            if (viewModel.useLongPress) {
                val onTouchListener =
                    KeyguardQuickAffordanceOnTouchListener(
                val onTouchListener = KeyguardQuickAffordanceOnTouchListener(
                    view,
                    viewModel,
                    messageDisplayer,
Loading