Adds LongPressHandlingView to KeyguardRootView.

- The settings popup was previously migrated to KeyguardRootView but the
  long-press handling view that handles the long-press to show the
  settings popup was not.
- The reason is was working is by accident: the KeyguardRootView was
  rendering on top (z order) of the NotificationPanelView and the
  NotificaitonPanelView did contain the original LongPressHandlingView.
  Hence, long-press touches were passing through KeyguardRootView and
  did in fact work to show the settings popup menu.
- This CL moves the LongPressHandlingView into KeyguardRootView and
  removes it from the NotificationPanelView based on the feature flag.

In addition:
- Adding the LongPressHandlingView to KeyguardRootView meant adding an
  additional ConstraintLayout "section":
  DefaultLongPressHandlingSection.
- The interface for KeyguardSection was moved to the shared.model
  package because it was previously in the data layer but referenced
  from the UI layer, which breaks the Clean Architecture Dependnecy Rule.
- The long-press handling view binder was updtes to also monitor for
  interactions on the same view that need to dismiss the settings popup
  menu, greatly simplifying what external invocations need to do to
  connect the long-press to the settings popup bindings.

Fix: 278057014
Test: manually verified that long-pressing empty space on the lock
screen brings up the settings popup with and without the "split bottom
area" feature flag being enabled.
Test: manually verified that tapping/touching outside the popup menu
once it shows up, hides it. Again, with the flag on and off.

Change-Id: I59bb4d54fb92c55266fed71dfa652c8025a6dd6c
Merged-In: I59bb4d54fb92c55266fed71dfa652c8025a6dd6c
This commit is contained in:
Alejandro Nijamkin
2023-08-20 15:17:31 -07:00
committed by Ale Nijamkin
parent 211eeaa269
commit b13030249d
24 changed files with 221 additions and 91 deletions

View File

@@ -89,8 +89,9 @@ class LongPressHandlingView(
}
@SuppressLint("ClickableViewAccessibility")
override fun onTouchEvent(event: MotionEvent?): Boolean {
return interactionHandler.onTouchEvent(event?.toModel())
override fun onTouchEvent(event: MotionEvent): Boolean {
super.onTouchEvent(event)
return interactionHandler.onTouchEvent(event.toModel())
}
}

View File

@@ -24,12 +24,15 @@ 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
@@ -38,6 +41,7 @@ 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
@@ -76,6 +80,7 @@ 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,
@@ -105,7 +110,7 @@ constructor(
bindLeftShortcut()
bindRightShortcut()
bindAmbientIndicationArea()
bindSettingsPopupMenu()
bindSettingsPopupMenu(notificationPanel)
KeyguardBlueprintViewBinder.bind(keyguardRootView, keyguardBlueprintViewModel)
keyguardBlueprintCommandListener.start()
@@ -194,12 +199,34 @@ constructor(
}
}
private fun bindSettingsPopupMenu() {
private fun bindSettingsPopupMenu(legacyParent: ViewGroup) {
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(
keyguardRootView,
settingsMenuView,
keyguardSettingsMenuViewModel,
vibratorHelper,
activityStarter,
@@ -208,6 +235,9 @@ 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)
}
}
}

View File

@@ -99,11 +99,3 @@ 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)
}

View File

@@ -0,0 +1,27 @@
/*
* 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)
}

View File

@@ -18,7 +18,6 @@ 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
@@ -76,7 +75,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 {
/**
@@ -119,17 +118,6 @@ 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))
@@ -137,7 +125,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(
@@ -150,7 +138,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(
@@ -188,7 +176,7 @@ object KeyguardBottomAreaViewBinder {
}
}
//If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt]
// If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt]
launch {
updateButtonAlpha(
view = startButton,
@@ -197,7 +185,7 @@ object KeyguardBottomAreaViewBinder {
)
}
//If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt]
// If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt]
launch {
updateButtonAlpha(
view = endButton,
@@ -223,7 +211,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> {
@@ -385,13 +373,14 @@ 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)
@@ -408,7 +397,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>,
@@ -439,7 +428,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,
@@ -476,7 +465,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,
@@ -532,7 +521,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,

View File

@@ -17,7 +17,11 @@
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
@@ -35,6 +39,9 @@ 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(
@@ -42,6 +49,7 @@ object KeyguardLongPressViewBinder {
viewModel: KeyguardLongPressViewModel,
onSingleTap: () -> Unit,
falsingManager: FalsingManager,
settingsMenuView: View,
) {
view.listener =
object : LongPressHandlingView.Listener {
@@ -62,6 +70,12 @@ object KeyguardLongPressViewBinder {
}
}
listenForTouchOutsideDismissals(
outsideView = view,
settingsMenuView = settingsMenuView,
onTouchedOutsideSettingsMenu = viewModel::onTouchedOutside,
)
view.repeatWhenAttached {
repeatOnLifecycle(Lifecycle.State.STARTED) {
launch {
@@ -72,4 +86,27 @@ 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
}
}
}
}

View File

@@ -38,13 +38,11 @@ import kotlinx.coroutines.launch
object KeyguardSettingsViewBinder {
fun bind(
parentView: View,
view: LaunchableLinearLayout,
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) {
@@ -127,5 +125,4 @@ object KeyguardSettingsViewBinder {
}
.start()
}
}
}

View File

@@ -20,6 +20,7 @@ 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
@@ -28,6 +29,7 @@ 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(
@@ -39,9 +41,11 @@ class KeyguardRootView(
attrs,
) {
var motionEventSpy: ((MotionEvent) -> Unit)? = null
private var statusView: KeyguardStatusView? = null
init {
addLongPressHandlingView()
addIndicationTextArea()
addLockIconView()
addAmbientIndicationArea()
@@ -51,6 +55,15 @@ 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)

View File

@@ -23,6 +23,7 @@ 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
@@ -43,6 +44,7 @@ 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,
@@ -54,6 +56,7 @@ constructor(
defaultLockIconSection.apply(constraintSet)
defaultShortcutsSection.apply(constraintSet)
defaultAmbientIndicationAreaSection.apply(constraintSet)
defaultLongPressHandlingSection.apply(constraintSet)
defaultSettingsPopupMenuSection.apply(constraintSet)
defaultStatusViewSection.apply(constraintSet)
splitShadeGuidelines.apply(constraintSet)

View File

@@ -25,6 +25,7 @@ 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
@@ -40,6 +41,7 @@ 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,
@@ -52,6 +54,7 @@ constructor(
defaultIndicationAreaSection.apply(constraintSet)
defaultLockIconSection.apply(constraintSet)
defaultAmbientIndicationAreaSection.apply(constraintSet)
defaultLongPressHandlingSection.apply(constraintSet)
defaultSettingsPopupMenuSection.apply(constraintSet)
if (keyguardUpdateMonitor.isUdfpsSupported) {
alignShortcutsToUdfpsSection.apply(constraintSet)

View File

@@ -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.data.repository.KeyguardSection
import com.android.systemui.keyguard.shared.model.KeyguardSection
import javax.inject.Inject
class AlignShortcutsToUdfpsSection @Inject constructor(@Main private val resources: Resources) :

View File

@@ -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.data.repository.KeyguardSection
import com.android.systemui.keyguard.shared.model.KeyguardSection
import javax.inject.Inject
class DefaultAmbientIndicationAreaSection

View File

@@ -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.data.repository.KeyguardSection
import com.android.systemui.keyguard.shared.model.KeyguardSection
import javax.inject.Inject
class DefaultIndicationAreaSection @Inject constructor(private val context: Context) :

View File

@@ -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.data.repository.KeyguardSection
import com.android.systemui.keyguard.shared.model.KeyguardSection
import javax.inject.Inject
class DefaultLockIconSection

View File

@@ -0,0 +1,47 @@
/*
* 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,
)
}
}
}

View File

@@ -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.data.repository.KeyguardSection
import com.android.systemui.keyguard.shared.model.KeyguardSection
import javax.inject.Inject
class DefaultSettingsPopupMenuSection @Inject constructor(@Main private val resources: Resources) :

View File

@@ -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.data.repository.KeyguardSection
import com.android.systemui.keyguard.shared.model.KeyguardSection
import javax.inject.Inject
class DefaultShortcutsSection @Inject constructor(@Main private val resources: Resources) :

View File

@@ -18,20 +18,18 @@
package com.android.systemui.keyguard.ui.view.layout.sections
import android.content.Context
import android.view.ViewGroup
import androidx.constraintlayout.widget.ConstraintSet
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
import androidx.constraintlayout.widget.ConstraintSet.END
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 com.android.systemui.R
import com.android.systemui.keyguard.shared.model.KeyguardSection
import javax.inject.Inject
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) {

View File

@@ -18,21 +18,13 @@
package com.android.systemui.keyguard.ui.view.layout.sections
import android.content.Context
import android.view.ViewGroup
import androidx.constraintlayout.widget.ConstraintSet
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 androidx.constraintlayout.widget.ConstraintSet.END
import androidx.constraintlayout.widget.ConstraintSet.VERTICAL
import com.android.systemui.R
import com.android.systemui.keyguard.shared.model.KeyguardSection
import javax.inject.Inject
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 {

View File

@@ -157,14 +157,6 @@ 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> {

View File

@@ -546,6 +546,7 @@ 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;
@@ -949,14 +950,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
updateUserSwitcherFlags();
mKeyguardBottomAreaViewModel = keyguardBottomAreaViewModel;
mKeyguardBottomAreaInteractor = keyguardBottomAreaInteractor;
KeyguardLongPressViewBinder.bind(
mView.requireViewById(R.id.keyguard_long_press),
keyguardLongPressViewModel,
() -> {
onEmptySpaceClick();
return Unit.INSTANCE;
},
mFalsingManager);
mKeyguardLongPressViewModel = keyguardLongPressViewModel;
mActivityStarter = activityStarter;
onFinishInflate();
keyguardUnlockAnimationController.addKeyguardUnlockAnimationListener(
@@ -1492,6 +1486,16 @@ 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

View File

@@ -26,6 +26,7 @@ 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
@@ -48,6 +49,7 @@ 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
@@ -62,6 +64,7 @@ class DefaultKeyguardBlueprintTest : SysuiTestCase() {
defaultLockIconSection,
defaultShortcutsSection,
defaultAmbientIndicationAreaSection,
defaultLongPressHandlingSection,
defaultSettingsPopupMenuSection,
defaultStatusViewSection,
splitShadeGuidelines,

View File

@@ -69,7 +69,6 @@ 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
@@ -673,7 +672,7 @@ internal class NoteTaskControllerTest : SysuiTestCase() {
extras().bool(EXTRA_USE_STYLUS_MODE).isTrue()
}
iconCaptor.value?.let { icon ->
assertNotNull(icon)
assertThat(icon).isNotNull()
assertThat(icon.resId).isEqualTo(R.drawable.ic_note_task_shortcut_widget)
}
}

View File

@@ -80,6 +80,7 @@ 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;
@@ -411,6 +412,8 @@ 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);