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

Commit 464e2750 authored by Massimo Carli's avatar Massimo Carli Committed by Android (Google) Code Review
Browse files

Merge "[20/n] Create event spy surface in LetterboxInputController" into main

parents d0af9c1d 972c0c3e
Loading
Loading
Loading
Loading
+34 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright 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.wm.shell.common

import android.view.InputChannel
import com.android.wm.shell.dagger.WMSingleton
import java.util.function.Supplier
import javax.inject.Inject

/**
 * An Injectable [Supplier<InputChannel>]. This can be used in place of kotlin default
 * parameters values [builder = ::InputChannel] which requires the [@JvmOverloads] annotation to
 * make this available in Java.
 * This can be used every time a component needs the dependency to the default [Supplier] for
 * [InputChannel]s.
 */
@WMSingleton
class InputChannelSupplier @Inject constructor() : Supplier<InputChannel> {
    override fun get(): InputChannel = InputChannel()
}
+35 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright 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.wm.shell.common

import android.view.IWindowSession
import android.view.WindowManagerGlobal
import com.android.wm.shell.dagger.WMSingleton
import java.util.function.Supplier
import javax.inject.Inject

/**
 * An Injectable [Supplier<IWindowSession>]. This can be used in place of kotlin default
 * parameters values [builder = WindowManagerGlobal::getWindowSession] which requires the
 * [@JvmOverloads] annotation to make this available in Java.
 * This can be used every time a component needs the dependency to the default [Supplier] for
 * [IWindowSession]s.
 */
@WMSingleton
class WindowSessionSupplier @Inject constructor() : Supplier<IWindowSession> {
    override fun get(): IWindowSession = WindowManagerGlobal.getWindowSession()
}
+34 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright 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.wm.shell.common.transition

import android.view.SurfaceControl
import com.android.wm.shell.dagger.WMSingleton
import java.util.function.Supplier
import javax.inject.Inject

/**
 * An Injectable [Supplier<SurfaceControl.Builder>]. This can be used in place of kotlin default
 * parameters values [builder = ::SurfaceControl.Builder] which requires the [@JvmOverloads]
 * annotation to make this available in Java.
 * This can be used every time a component needs the dependency to the default builder for
 * [SurfaceControl]s.
 */
@WMSingleton
class SurfaceBuilderSupplier @Inject constructor() : Supplier<SurfaceControl.Builder> {
    override fun get(): SurfaceControl.Builder = SurfaceControl.Builder()
}
+34 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright 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.wm.shell.common.transition

import android.view.SurfaceControl
import com.android.wm.shell.dagger.WMSingleton
import java.util.function.Supplier
import javax.inject.Inject

/**
 * An Injectable [Supplier<SurfaceControl.Transaction>]. This can be used in place of kotlin default
 * parameters values [builder = ::SurfaceControl.Transaction] which requires the [@JvmOverloads]
 * annotation to make this available in Java.
 * This can be used every time a component needs the dependency to the default builder for
 * [SurfaceControl.Transaction]s.
 */
@WMSingleton
class TransactionSupplier @Inject constructor() : Supplier<SurfaceControl.Transaction> {
    override fun get(): SurfaceControl.Transaction = SurfaceControl.Transaction()
}
+65 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright 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.wm.shell.compatui.letterbox

import android.view.GestureDetector.OnContextClickListener
import android.view.GestureDetector.OnDoubleTapListener
import android.view.GestureDetector.OnGestureListener
import android.view.MotionEvent

/**
 * Interface which unions all the interfaces related to gestures.
 */
interface LetterboxGestureListener : OnGestureListener, OnDoubleTapListener, OnContextClickListener

/**
 * Convenience class which provide an overrideable implementation of
 * {@link LetterboxGestureListener}.
 */
object LetterboxGestureDelegate : LetterboxGestureListener {
    override fun onDown(e: MotionEvent): Boolean = false

    override fun onShowPress(e: MotionEvent) {
    }

    override fun onSingleTapUp(e: MotionEvent): Boolean = false

    override fun onScroll(
        e1: MotionEvent?,
        e2: MotionEvent,
        distanceX: Float,
        distanceY: Float
    ): Boolean = false

    override fun onLongPress(e: MotionEvent) {
    }

    override fun onFling(
        e1: MotionEvent?,
        e2: MotionEvent,
        velocityX: Float,
        velocityY: Float
    ): Boolean = false

    override fun onSingleTapConfirmed(e: MotionEvent): Boolean = false

    override fun onDoubleTap(e: MotionEvent): Boolean = false

    override fun onDoubleTapEvent(e: MotionEvent): Boolean = false

    override fun onContextClick(e: MotionEvent): Boolean = false
}
Loading