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

Commit e0ed3577 authored by Nicolò Mazzucato's avatar Nicolò Mazzucato Committed by Android (Google) Code Review
Browse files

Merge "Forward key events in KeyguardPresentation to SysUIKeyEventHandler" into main

parents e4fd8950 a3883e80
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -21,10 +21,12 @@ import android.content.Context
import android.graphics.Color
import android.os.Bundle
import android.view.Display
import android.view.KeyEvent
import android.view.View
import android.view.WindowManager
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.constraintlayout.widget.ConstraintSet
import com.android.systemui.keyevent.domain.interactor.SysUIKeyEventHandler
import com.android.systemui.plugins.keyguard.ui.clocks.ClockController
import com.android.systemui.plugins.keyguard.ui.clocks.ClockFaceController
import com.android.systemui.plugins.keyguard.ui.clocks.ClockFaceLayout
@@ -48,6 +50,7 @@ constructor(
    context: Context,
    private val clockRegistry: ClockRegistry,
    private val clockEventController: ClockEventController,
    private val sysuiKeyEventHandler: SysUIKeyEventHandler,
) :
    Presentation(
        context,
@@ -77,6 +80,10 @@ constructor(
        setShowWallpaperFlagOnWindow()
    }

    override fun dispatchKeyEvent(event: KeyEvent): Boolean {
        return sysuiKeyEventHandler.dispatchKeyEvent(event)
    }

    private fun onCreateInternal() {
        constraintLayoutRootView =
            ConstraintLayout(context).apply {
+56 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 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.shade

/**
 * No-op implementation of [QuickSettingsController], for SysUI variants that don't use it but
 * inject code that depends on it.s
 */
class NoOpQuickSettingsController : QuickSettingsController {
    override val expanded: Boolean
        get() = false

    override val isCustomizing: Boolean
        get() = false

    @Deprecated("specific to legacy touch handling")
    override fun shouldQuickSettingsIntercept(x: Float, y: Float, yDiff: Float): Boolean {
        return false
    }

    override fun closeQsCustomizer() {}

    @Deprecated("specific to legacy split shade") override fun closeQs() {}

    @Deprecated("specific to legacy DebugDrawable")
    override fun calculateNotificationsTopPadding(
        isShadeExpanding: Boolean,
        keyguardNotificationStaticPadding: Int,
        expandedFraction: Float,
    ): Float {
        return 0f
    }

    @Deprecated("specific to legacy DebugDrawable")
    override fun calculatePanelHeightExpanded(stackScrollerPadding: Int): Int {
        return 0
    }

    override fun setPanelExpanded(panelExpanded: Boolean) {
        return
    }
}
+13 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import com.android.systemui.common.ui.view.ChoreographerUtils
import com.android.systemui.common.ui.view.ChoreographerUtilsImpl
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.keyevent.domain.interactor.SysUIKeyEventHandler
import com.android.systemui.log.LogBuffer
import com.android.systemui.log.LogBufferFactory
import com.android.systemui.res.R
@@ -399,6 +400,18 @@ object ShadeDisplayAwareWindowWithoutShadeModule {
            override val pendingDisplayId: StateFlow<Int> =
                MutableStateFlow(Display.DEFAULT_DISPLAY)
        }

    /**
     * [QuickSettingsController] is needed by [SysUIKeyEventHandler] dependencies.
     * [SysUIKeyEventHandler] is used from [ConnectedDisplayConstraintLayoutKeyguardPresentation],
     * that seems to be injected also in the Wear sysui variant. Ideally Wear code should be
     * restructured to remove this dep from their dagger graph, but in the meantime this allows the
     * target to compile.
     */
    @Provides
    @SysUISingleton
    fun providesQuickSettingsControllerNoOp(): QuickSettingsController =
        NoOpQuickSettingsController()
}

/**