diff options
25 files changed, 91 insertions, 221 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/common/ui/view/LongPressHandlingView.kt b/packages/SystemUI/src/com/android/systemui/common/ui/view/LongPressHandlingView.kt index 03d787bc6c8f..323070a84863 100644 --- a/packages/SystemUI/src/com/android/systemui/common/ui/view/LongPressHandlingView.kt +++ b/packages/SystemUI/src/com/android/systemui/common/ui/view/LongPressHandlingView.kt @@ -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()) } } diff --git a/packages/SystemUI/src/com/android/systemui/communal/ui/view/layout/sections/DefaultCommunalWidgetSection.kt b/packages/SystemUI/src/com/android/systemui/communal/ui/view/layout/sections/DefaultCommunalWidgetSection.kt index 09383842a31e..b0e3132a1fc7 100644 --- a/packages/SystemUI/src/com/android/systemui/communal/ui/view/layout/sections/DefaultCommunalWidgetSection.kt +++ b/packages/SystemUI/src/com/android/systemui/communal/ui/view/layout/sections/DefaultCommunalWidgetSection.kt @@ -22,7 +22,7 @@ import androidx.constraintlayout.widget.ConstraintSet.BOTTOM import androidx.constraintlayout.widget.ConstraintSet.END import androidx.constraintlayout.widget.ConstraintSet.PARENT_ID import com.android.systemui.R -import com.android.systemui.keyguard.shared.model.KeyguardSection +import com.android.systemui.keyguard.data.repository.KeyguardSection import javax.inject.Inject class DefaultCommunalWidgetSection @Inject constructor() : KeyguardSection { diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewConfigurator.kt b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewConfigurator.kt index 9e63be5d0042..9b323ee9a3f3 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewConfigurator.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewConfigurator.kt @@ -24,8 +24,6 @@ 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.communal.ui.adapter.CommunalWidgetViewAdapter import com.android.systemui.communal.ui.binder.CommunalWidgetViewBinder import com.android.systemui.communal.ui.viewmodel.CommunalWidgetViewModel @@ -36,7 +34,6 @@ import com.android.systemui.keyguard.domain.interactor.KeyguardBlueprintInteract 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 @@ -45,7 +42,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 @@ -84,7 +80,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, @@ -117,7 +112,7 @@ constructor( bindLeftShortcut() bindRightShortcut() bindAmbientIndicationArea() - bindSettingsPopupMenu(notificationPanel) + bindSettingsPopupMenu() bindCommunalWidgetArea() KeyguardBlueprintViewBinder.bind(keyguardRootView, keyguardBlueprintViewModel) @@ -207,34 +202,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, @@ -243,9 +216,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) - } } } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardBlueprintRepository.kt b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardBlueprintRepository.kt index 2fb40a4f1b51..7234757081e2 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardBlueprintRepository.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardBlueprintRepository.kt @@ -110,3 +110,11 @@ interface KeyguardBlueprint { .forEach { constraintSet.setVisibility(it, View.GONE) } } } + +/** + * Lower level modules that determine constraints for a particular section in the lockscreen root + * view. + */ +interface KeyguardSection { + fun apply(constraintSet: ConstraintSet) +} diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/KeyguardSection.kt b/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/KeyguardSection.kt deleted file mode 100644 index 405d75e3de7d..000000000000 --- a/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/KeyguardSection.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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) -} diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt index 1669f4460461..44acf4f0fd2d 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt @@ -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 @@ -75,7 +76,7 @@ object KeyguardBottomAreaViewBinder { * Users of the [KeyguardBottomAreaViewBinder] class should use this to control the binder after * it is bound. */ - // If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] + //If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] @Deprecated("Deprecated as part of b/278057014") interface Binding { /** @@ -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)) @@ -125,7 +137,7 @@ object KeyguardBottomAreaViewBinder { view.repeatWhenAttached { repeatOnLifecycle(Lifecycle.State.STARTED) { - // If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] + //If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] launch { viewModel.startButton.collect { buttonModel -> updateButton( @@ -138,7 +150,7 @@ object KeyguardBottomAreaViewBinder { } } - // If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] + //If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] launch { viewModel.endButton.collect { buttonModel -> updateButton( @@ -176,7 +188,7 @@ object KeyguardBottomAreaViewBinder { } } - // If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] + //If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] launch { updateButtonAlpha( view = startButton, @@ -185,7 +197,7 @@ object KeyguardBottomAreaViewBinder { ) } - // If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] + //If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] launch { updateButtonAlpha( view = endButton, @@ -211,7 +223,7 @@ object KeyguardBottomAreaViewBinder { } } - // If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] + //If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] launch { configurationBasedDimensions.collect { dimensions -> startButton.updateLayoutParams<ViewGroup.LayoutParams> { @@ -373,14 +385,13 @@ object KeyguardBottomAreaViewBinder { view.isClickable = viewModel.isClickable if (viewModel.isClickable) { if (viewModel.useLongPress) { - val onTouchListener = - KeyguardQuickAffordanceOnTouchListener( - view, - viewModel, - messageDisplayer, - vibratorHelper, - falsingManager, - ) + val onTouchListener = KeyguardQuickAffordanceOnTouchListener( + view, + viewModel, + messageDisplayer, + vibratorHelper, + falsingManager, + ) view.setOnTouchListener(onTouchListener) view.onLongClickListener = OnLongClickListener(falsingManager, viewModel, vibratorHelper, onTouchListener) @@ -397,7 +408,7 @@ object KeyguardBottomAreaViewBinder { } @Deprecated("Deprecated as part of b/278057014") - // If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] + //If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] private suspend fun updateButtonAlpha( view: View, viewModel: Flow<KeyguardQuickAffordanceViewModel>, @@ -428,7 +439,7 @@ object KeyguardBottomAreaViewBinder { } @Deprecated("Deprecated as part of b/278057014") - // If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] + //If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] private class OnLongClickListener( private val falsingManager: FalsingManager?, private val viewModel: KeyguardQuickAffordanceViewModel, @@ -465,7 +476,7 @@ object KeyguardBottomAreaViewBinder { } @Deprecated("Deprecated as part of b/278057014") - // If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] + //If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] private class OnClickListener( private val viewModel: KeyguardQuickAffordanceViewModel, private val falsingManager: FalsingManager, @@ -521,7 +532,7 @@ object KeyguardBottomAreaViewBinder { } @Deprecated("Deprecated as part of b/278057014") - // If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] + //If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] private data class ConfigurationBasedDimensions( val defaultBurnInPreventionYOffsetPx: Int, val buttonSizePx: Size, diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardLongPressViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardLongPressViewBinder.kt index 48fd24acdb34..9cc503c07955 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardLongPressViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardLongPressViewBinder.kt @@ -17,11 +17,7 @@ package com.android.systemui.keyguard.ui.binder -import android.annotation.SuppressLint -import android.graphics.Rect -import android.view.MotionEvent import android.view.View -import androidx.core.view.isVisible import androidx.lifecycle.Lifecycle import androidx.lifecycle.repeatOnLifecycle import com.android.systemui.common.ui.view.LongPressHandlingView @@ -39,9 +35,6 @@ object KeyguardLongPressViewBinder { * @param onSingleTap A callback to invoke when the system decides that there was a single tap. * @param falsingManager [FalsingManager] for making sure the long-press didn't just happen in * the user's pocket. - * @param settingsMenuView The [View] for the settings menu that shows up when the long-press is - * detected. The [view] will be monitored for all touch to know when to actually hide the - * settings menu after it had been shown due to an outside touch. */ @JvmStatic fun bind( @@ -49,7 +42,6 @@ object KeyguardLongPressViewBinder { viewModel: KeyguardLongPressViewModel, onSingleTap: () -> Unit, falsingManager: FalsingManager, - settingsMenuView: View, ) { view.listener = object : LongPressHandlingView.Listener { @@ -70,12 +62,6 @@ object KeyguardLongPressViewBinder { } } - listenForTouchOutsideDismissals( - outsideView = view, - settingsMenuView = settingsMenuView, - onTouchedOutsideSettingsMenu = viewModel::onTouchedOutside, - ) - view.repeatWhenAttached { repeatOnLifecycle(Lifecycle.State.STARTED) { launch { @@ -86,27 +72,4 @@ object KeyguardLongPressViewBinder { } } } - - /** Listens for and handles touches outside the settings menu view, to dismiss it. */ - @SuppressLint("ClickableViewAccessibility") - private fun listenForTouchOutsideDismissals( - outsideView: View, - settingsMenuView: View, - onTouchedOutsideSettingsMenu: () -> Unit, - ) { - outsideView.setOnTouchListener { _, event -> - if (event.actionMasked == MotionEvent.ACTION_DOWN && settingsMenuView.isVisible) { - val hitRect = Rect() - settingsMenuView.getHitRect(hitRect) - if (!hitRect.contains(event.x.toInt(), event.y.toInt())) { - onTouchedOutsideSettingsMenu() - true - } else { - false - } - } else { - false - } - } - } } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardSettingsViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardSettingsViewBinder.kt index 95569f6ad4f2..82610e6ea59d 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardSettingsViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardSettingsViewBinder.kt @@ -38,11 +38,13 @@ import kotlinx.coroutines.launch object KeyguardSettingsViewBinder { fun bind( - view: LaunchableLinearLayout, + parentView: View, viewModel: KeyguardSettingsMenuViewModel, vibratorHelper: VibratorHelper, activityStarter: ActivityStarter ): DisposableHandle { + val view = parentView.requireViewById<LaunchableLinearLayout>(R.id.keyguard_settings_button) + val disposableHandle = view.repeatWhenAttached { repeatOnLifecycle(Lifecycle.State.STARTED) { @@ -125,4 +127,5 @@ object KeyguardSettingsViewBinder { } .start() } -} + +}
\ No newline at end of file diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/KeyguardRootView.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/KeyguardRootView.kt index a69a9d5d07b5..a94874176a34 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/KeyguardRootView.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/KeyguardRootView.kt @@ -20,7 +20,6 @@ package com.android.systemui.keyguard.ui.view import android.content.Context import android.util.AttributeSet import android.view.LayoutInflater -import android.view.MotionEvent import android.view.View import android.widget.ImageView import androidx.constraintlayout.widget.ConstraintLayout @@ -29,7 +28,6 @@ import com.android.keyguard.KeyguardStatusView import com.android.keyguard.LockIconView import com.android.systemui.R import com.android.systemui.animation.view.LaunchableImageView -import com.android.systemui.common.ui.view.LongPressHandlingView /** Provides a container for all keyguard ui content. */ class KeyguardRootView( @@ -41,11 +39,9 @@ class KeyguardRootView( attrs, ) { - var motionEventSpy: ((MotionEvent) -> Unit)? = null private var statusView: KeyguardStatusView? = null init { - addLongPressHandlingView() addIndicationTextArea() addLockIconView() addAmbientIndicationArea() @@ -55,15 +51,6 @@ class KeyguardRootView( addStatusView() } - override fun onInterceptTouchEvent(event: MotionEvent): Boolean { - motionEventSpy?.invoke(event) - return super.onInterceptTouchEvent(event) - } - - private fun addLongPressHandlingView() { - addView(LongPressHandlingView(context, attrs).apply { id = R.id.keyguard_long_press }) - } - private fun addIndicationTextArea() { val view = KeyguardIndicationArea(context, attrs) addView(view) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/blueprints/DefaultKeyguardBlueprint.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/blueprints/DefaultKeyguardBlueprint.kt index 5ae30c1afc31..518df0719aaa 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/blueprints/DefaultKeyguardBlueprint.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/blueprints/DefaultKeyguardBlueprint.kt @@ -23,7 +23,6 @@ import com.android.systemui.keyguard.data.repository.KeyguardBlueprint import com.android.systemui.keyguard.ui.view.layout.sections.DefaultAmbientIndicationAreaSection import com.android.systemui.keyguard.ui.view.layout.sections.DefaultIndicationAreaSection import com.android.systemui.keyguard.ui.view.layout.sections.DefaultLockIconSection -import com.android.systemui.keyguard.ui.view.layout.sections.DefaultLongPressHandlingSection import com.android.systemui.keyguard.ui.view.layout.sections.DefaultSettingsPopupMenuSection import com.android.systemui.keyguard.ui.view.layout.sections.DefaultShortcutsSection import com.android.systemui.keyguard.ui.view.layout.sections.DefaultStatusViewSection @@ -44,7 +43,6 @@ constructor( private val defaultLockIconSection: DefaultLockIconSection, private val defaultShortcutsSection: DefaultShortcutsSection, private val defaultAmbientIndicationAreaSection: DefaultAmbientIndicationAreaSection, - private val defaultLongPressHandlingSection: DefaultLongPressHandlingSection, private val defaultSettingsPopupMenuSection: DefaultSettingsPopupMenuSection, private val defaultStatusViewSection: DefaultStatusViewSection, private val splitShadeGuidelines: SplitShadeGuidelines, @@ -56,7 +54,6 @@ constructor( defaultLockIconSection.apply(constraintSet) defaultShortcutsSection.apply(constraintSet) defaultAmbientIndicationAreaSection.apply(constraintSet) - defaultLongPressHandlingSection.apply(constraintSet) defaultSettingsPopupMenuSection.apply(constraintSet) defaultStatusViewSection.apply(constraintSet) splitShadeGuidelines.apply(constraintSet) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/blueprints/ShortcutsBesideUdfpsKeyguardBlueprint.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/blueprints/ShortcutsBesideUdfpsKeyguardBlueprint.kt index 7a1f030fa70a..54c27960db3c 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/blueprints/ShortcutsBesideUdfpsKeyguardBlueprint.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/blueprints/ShortcutsBesideUdfpsKeyguardBlueprint.kt @@ -25,7 +25,6 @@ import com.android.systemui.keyguard.ui.view.layout.sections.AlignShortcutsToUdf import com.android.systemui.keyguard.ui.view.layout.sections.DefaultAmbientIndicationAreaSection import com.android.systemui.keyguard.ui.view.layout.sections.DefaultIndicationAreaSection import com.android.systemui.keyguard.ui.view.layout.sections.DefaultLockIconSection -import com.android.systemui.keyguard.ui.view.layout.sections.DefaultLongPressHandlingSection import com.android.systemui.keyguard.ui.view.layout.sections.DefaultSettingsPopupMenuSection import com.android.systemui.keyguard.ui.view.layout.sections.DefaultShortcutsSection import com.android.systemui.keyguard.ui.view.layout.sections.DefaultStatusViewSection @@ -41,7 +40,6 @@ constructor( private val defaultIndicationAreaSection: DefaultIndicationAreaSection, private val defaultLockIconSection: DefaultLockIconSection, private val defaultAmbientIndicationAreaSection: DefaultAmbientIndicationAreaSection, - private val defaultLongPressHandlingSection: DefaultLongPressHandlingSection, private val defaultSettingsPopupMenuSection: DefaultSettingsPopupMenuSection, private val alignShortcutsToUdfpsSection: AlignShortcutsToUdfpsSection, private val defaultShortcutsSection: DefaultShortcutsSection, @@ -54,7 +52,6 @@ constructor( defaultIndicationAreaSection.apply(constraintSet) defaultLockIconSection.apply(constraintSet) defaultAmbientIndicationAreaSection.apply(constraintSet) - defaultLongPressHandlingSection.apply(constraintSet) defaultSettingsPopupMenuSection.apply(constraintSet) if (keyguardUpdateMonitor.isUdfpsSupported) { alignShortcutsToUdfpsSection.apply(constraintSet) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/AlignShortcutsToUdfpsSection.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/AlignShortcutsToUdfpsSection.kt index f7c27ffd936c..156b9f3e5f48 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/AlignShortcutsToUdfpsSection.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/AlignShortcutsToUdfpsSection.kt @@ -26,7 +26,7 @@ import androidx.constraintlayout.widget.ConstraintSet.RIGHT import androidx.constraintlayout.widget.ConstraintSet.TOP import com.android.systemui.R import com.android.systemui.dagger.qualifiers.Main -import com.android.systemui.keyguard.shared.model.KeyguardSection +import com.android.systemui.keyguard.data.repository.KeyguardSection import javax.inject.Inject class AlignShortcutsToUdfpsSection @Inject constructor(@Main private val resources: Resources) : diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultAmbientIndicationAreaSection.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultAmbientIndicationAreaSection.kt index 937674e51421..abf25a23439f 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultAmbientIndicationAreaSection.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultAmbientIndicationAreaSection.kt @@ -28,7 +28,7 @@ import androidx.constraintlayout.widget.ConstraintSet.TOP import androidx.constraintlayout.widget.ConstraintSet.WRAP_CONTENT import com.android.keyguard.KeyguardUpdateMonitor import com.android.systemui.R -import com.android.systemui.keyguard.shared.model.KeyguardSection +import com.android.systemui.keyguard.data.repository.KeyguardSection import javax.inject.Inject class DefaultAmbientIndicationAreaSection diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultIndicationAreaSection.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultIndicationAreaSection.kt index 93c1ef70466d..dee7ed570b05 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultIndicationAreaSection.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultIndicationAreaSection.kt @@ -21,7 +21,7 @@ import android.content.Context import android.view.ViewGroup import androidx.constraintlayout.widget.ConstraintSet import com.android.systemui.R -import com.android.systemui.keyguard.shared.model.KeyguardSection +import com.android.systemui.keyguard.data.repository.KeyguardSection import javax.inject.Inject class DefaultIndicationAreaSection @Inject constructor(private val context: Context) : diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultLockIconSection.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultLockIconSection.kt index f69f9c71141c..461faec217ca 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultLockIconSection.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultLockIconSection.kt @@ -27,7 +27,7 @@ import androidx.constraintlayout.widget.ConstraintSet import com.android.keyguard.KeyguardUpdateMonitor import com.android.systemui.R import com.android.systemui.biometrics.AuthController -import com.android.systemui.keyguard.shared.model.KeyguardSection +import com.android.systemui.keyguard.data.repository.KeyguardSection import javax.inject.Inject class DefaultLockIconSection diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultLongPressHandlingSection.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultLongPressHandlingSection.kt deleted file mode 100644 index 5470b4119b96..000000000000 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultLongPressHandlingSection.kt +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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.ui.view.layout.sections - -import androidx.annotation.IdRes -import androidx.constraintlayout.widget.ConstraintSet -import com.android.systemui.R -import com.android.systemui.keyguard.shared.model.KeyguardSection -import javax.inject.Inject - -/** Positions the long-press handling view in the keyguard. */ -class DefaultLongPressHandlingSection @Inject constructor() : KeyguardSection { - override fun apply(constraintSet: ConstraintSet) { - constraintSet.fillMaxSize(R.id.keyguard_long_press) - } - - private fun ConstraintSet.fillMaxSize(@IdRes viewId: Int) { - listOf( - ConstraintSet.START, - ConstraintSet.TOP, - ConstraintSet.END, - ConstraintSet.BOTTOM, - ) - .forEach { side -> - connect( - viewId, - side, - ConstraintSet.PARENT_ID, - side, - ) - } - } -} diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultSettingsPopupMenuSection.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultSettingsPopupMenuSection.kt index 631d20db95dd..ad1e4f8b98b4 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultSettingsPopupMenuSection.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultSettingsPopupMenuSection.kt @@ -26,7 +26,7 @@ import androidx.constraintlayout.widget.ConstraintSet.START import androidx.constraintlayout.widget.ConstraintSet.WRAP_CONTENT import com.android.systemui.R import com.android.systemui.dagger.qualifiers.Main -import com.android.systemui.keyguard.shared.model.KeyguardSection +import com.android.systemui.keyguard.data.repository.KeyguardSection import javax.inject.Inject class DefaultSettingsPopupMenuSection @Inject constructor(@Main private val resources: Resources) : diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultShortcutsSection.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultShortcutsSection.kt index c349664c94af..db4653defd34 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultShortcutsSection.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultShortcutsSection.kt @@ -25,7 +25,7 @@ import androidx.constraintlayout.widget.ConstraintSet.PARENT_ID import androidx.constraintlayout.widget.ConstraintSet.RIGHT import com.android.systemui.R import com.android.systemui.dagger.qualifiers.Main -import com.android.systemui.keyguard.shared.model.KeyguardSection +import com.android.systemui.keyguard.data.repository.KeyguardSection import javax.inject.Inject class DefaultShortcutsSection @Inject constructor(@Main private val resources: Resources) : diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultStatusViewSection.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultStatusViewSection.kt index 5e832f6cc89c..3f319ba2d0e4 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultStatusViewSection.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultStatusViewSection.kt @@ -18,18 +18,20 @@ package com.android.systemui.keyguard.ui.view.layout.sections import android.content.Context -import android.view.ViewGroup.LayoutParams.WRAP_CONTENT +import android.view.ViewGroup import androidx.constraintlayout.widget.ConstraintSet -import androidx.constraintlayout.widget.ConstraintSet.END +import com.android.systemui.R +import com.android.systemui.keyguard.data.repository.KeyguardSection +import javax.inject.Inject +import android.view.ViewGroup.LayoutParams.WRAP_CONTENT import androidx.constraintlayout.widget.ConstraintSet.MATCH_CONSTRAINT import androidx.constraintlayout.widget.ConstraintSet.PARENT_ID import androidx.constraintlayout.widget.ConstraintSet.START import androidx.constraintlayout.widget.ConstraintSet.TOP -import com.android.systemui.R -import com.android.systemui.keyguard.shared.model.KeyguardSection -import javax.inject.Inject +import androidx.constraintlayout.widget.ConstraintSet.END -class DefaultStatusViewSection @Inject constructor(private val context: Context) : KeyguardSection { +class DefaultStatusViewSection @Inject constructor(private val context: Context) : + KeyguardSection { private val statusViewId = R.id.keyguard_status_view override fun apply(constraintSet: ConstraintSet) { diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/SplitShadeGuidelines.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/SplitShadeGuidelines.kt index 92e37b75e53a..668b17ffeba0 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/SplitShadeGuidelines.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/SplitShadeGuidelines.kt @@ -18,13 +18,21 @@ package com.android.systemui.keyguard.ui.view.layout.sections import android.content.Context +import android.view.ViewGroup import androidx.constraintlayout.widget.ConstraintSet -import androidx.constraintlayout.widget.ConstraintSet.VERTICAL import com.android.systemui.R -import com.android.systemui.keyguard.shared.model.KeyguardSection +import com.android.systemui.keyguard.data.repository.KeyguardSection import javax.inject.Inject +import android.view.ViewGroup.LayoutParams.WRAP_CONTENT +import androidx.constraintlayout.widget.ConstraintSet.MATCH_CONSTRAINT +import androidx.constraintlayout.widget.ConstraintSet.PARENT_ID +import androidx.constraintlayout.widget.ConstraintSet.START +import androidx.constraintlayout.widget.ConstraintSet.TOP +import androidx.constraintlayout.widget.ConstraintSet.END +import androidx.constraintlayout.widget.ConstraintSet.VERTICAL -class SplitShadeGuidelines @Inject constructor(private val context: Context) : KeyguardSection { +class SplitShadeGuidelines @Inject constructor(private val context: Context) : + KeyguardSection { override fun apply(constraintSet: ConstraintSet) { constraintSet.apply { diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBottomAreaViewModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBottomAreaViewModel.kt index 74eb85640341..3e6f8e68891a 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBottomAreaViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBottomAreaViewModel.kt @@ -157,6 +157,14 @@ constructor( selectedPreviewSlotId.value = slotId } + /** + * Notifies that some input gesture has started somewhere in the bottom area that's outside of + * the lock screen settings menu item pop-up. + */ + fun onTouchedOutsideLockScreenSettingsMenu() { + longPressViewModel.onTouchedOutside() + } + private fun button( position: KeyguardQuickAffordancePosition ): Flow<KeyguardQuickAffordanceViewModel> { diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java index 32a5fdfb3e7b..014093de62bd 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java @@ -546,7 +546,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump private final NPVCDownEventState.Buffer mLastDownEvents; private final KeyguardBottomAreaViewModel mKeyguardBottomAreaViewModel; private final KeyguardBottomAreaInteractor mKeyguardBottomAreaInteractor; - private final KeyguardLongPressViewModel mKeyguardLongPressViewModel; private float mMinExpandHeight; private boolean mPanelUpdateWhenAnimatorEnds; private boolean mHasVibratedOnOpen = false; @@ -950,7 +949,14 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump updateUserSwitcherFlags(); mKeyguardBottomAreaViewModel = keyguardBottomAreaViewModel; mKeyguardBottomAreaInteractor = keyguardBottomAreaInteractor; - mKeyguardLongPressViewModel = keyguardLongPressViewModel; + KeyguardLongPressViewBinder.bind( + mView.requireViewById(R.id.keyguard_long_press), + keyguardLongPressViewModel, + () -> { + onEmptySpaceClick(); + return Unit.INSTANCE; + }, + mFalsingManager); mActivityStarter = activityStarter; onFinishInflate(); keyguardUnlockAnimationController.addKeyguardUnlockAnimationListener( @@ -1494,16 +1500,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump @Deprecated private void setKeyguardBottomArea(KeyguardBottomAreaView keyguardBottomArea) { mKeyguardBottomArea = keyguardBottomArea; - - KeyguardLongPressViewBinder.bind( - mView.requireViewById(R.id.keyguard_long_press), - mKeyguardLongPressViewModel, - () -> { - onEmptySpaceClick(); - return Unit.INSTANCE; - }, - mFalsingManager, - mKeyguardBottomArea.requireViewById(R.id.keyguard_settings_button)); } @Override diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/view/layout/blueprints/DefaultKeyguardBlueprintTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/view/layout/blueprints/DefaultKeyguardBlueprintTest.kt index d00fe9d309b8..addb1815cead 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/view/layout/blueprints/DefaultKeyguardBlueprintTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/view/layout/blueprints/DefaultKeyguardBlueprintTest.kt @@ -26,7 +26,6 @@ import com.android.systemui.keyguard.ui.view.KeyguardRootView import com.android.systemui.keyguard.ui.view.layout.sections.DefaultAmbientIndicationAreaSection import com.android.systemui.keyguard.ui.view.layout.sections.DefaultIndicationAreaSection import com.android.systemui.keyguard.ui.view.layout.sections.DefaultLockIconSection -import com.android.systemui.keyguard.ui.view.layout.sections.DefaultLongPressHandlingSection import com.android.systemui.keyguard.ui.view.layout.sections.DefaultSettingsPopupMenuSection import com.android.systemui.keyguard.ui.view.layout.sections.DefaultShortcutsSection import com.android.systemui.keyguard.ui.view.layout.sections.DefaultStatusViewSection @@ -49,7 +48,6 @@ class DefaultKeyguardBlueprintTest : SysuiTestCase() { @Mock private lateinit var defaultShortcutsSection: DefaultShortcutsSection @Mock private lateinit var defaultAmbientIndicationAreaSection: DefaultAmbientIndicationAreaSection - @Mock private lateinit var defaultLongPressHandlingSection: DefaultLongPressHandlingSection @Mock private lateinit var defaultSettingsPopupMenuSection: DefaultSettingsPopupMenuSection @Mock private lateinit var defaultStatusViewSection: DefaultStatusViewSection @Mock private lateinit var splitShadeGuidelines: SplitShadeGuidelines @@ -64,7 +62,6 @@ class DefaultKeyguardBlueprintTest : SysuiTestCase() { defaultLockIconSection, defaultShortcutsSection, defaultAmbientIndicationAreaSection, - defaultLongPressHandlingSection, defaultSettingsPopupMenuSection, defaultStatusViewSection, splitShadeGuidelines, diff --git a/packages/SystemUI/tests/src/com/android/systemui/notetask/NoteTaskControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/notetask/NoteTaskControllerTest.kt index c4a80bff29d7..1536c1737de6 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/notetask/NoteTaskControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/notetask/NoteTaskControllerTest.kt @@ -69,6 +69,7 @@ import com.android.wm.shell.bubbles.Bubble import com.android.wm.shell.bubbles.Bubbles import com.google.common.truth.Truth.assertThat import java.util.Optional +import kotlin.test.assertNotNull import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.UnconfinedTestDispatcher @@ -672,7 +673,7 @@ internal class NoteTaskControllerTest : SysuiTestCase() { extras().bool(EXTRA_USE_STYLUS_MODE).isTrue() } iconCaptor.value?.let { icon -> - assertThat(icon).isNotNull() + assertNotNull(icon) assertThat(icon.resId).isEqualTo(R.drawable.ic_note_task_shortcut_widget) } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java index 270fa7a5c85d..981e44bea846 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java @@ -80,7 +80,6 @@ import com.android.keyguard.dagger.KeyguardUserSwitcherComponent; import com.android.keyguard.logging.KeyguardLogger; import com.android.systemui.R; import com.android.systemui.SysuiTestCase; -import com.android.systemui.animation.view.LaunchableLinearLayout; import com.android.systemui.biometrics.AuthController; import com.android.systemui.bouncer.domain.interactor.AlternateBouncerInteractor; import com.android.systemui.classifier.FalsingCollectorFake; @@ -412,8 +411,6 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { when(mKeyguardBottomAreaViewController.getView()).thenReturn(mKeyguardBottomArea); when(mView.findViewById(R.id.keyguard_bottom_area)).thenReturn(mKeyguardBottomArea); when(mKeyguardBottomArea.animate()).thenReturn(mViewPropertyAnimator); - when(mKeyguardBottomArea.requireViewById(R.id.keyguard_settings_button)) - .thenReturn(mock(LaunchableLinearLayout.class)); when(mView.animate()).thenReturn(mViewPropertyAnimator); when(mKeyguardStatusView.animate()).thenReturn(mViewPropertyAnimator); when(mViewPropertyAnimator.translationX(anyFloat())).thenReturn(mViewPropertyAnimator); |