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

Commit b3678aa7 authored by Orhan Uysal's avatar Orhan Uysal Committed by Android (Google) Code Review
Browse files

Merge "Add DesktopImeHandler" into main

parents 80a651a4 2fc7bb68
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -90,6 +90,7 @@ import com.android.wm.shell.desktopmode.DefaultDragToDesktopTransitionHandler;
import com.android.wm.shell.desktopmode.DesktopActivityOrientationChangeHandler;
import com.android.wm.shell.desktopmode.DesktopDisplayEventHandler;
import com.android.wm.shell.desktopmode.DesktopDisplayModeController;
import com.android.wm.shell.desktopmode.DesktopImeHandler;
import com.android.wm.shell.desktopmode.DesktopImmersiveController;
import com.android.wm.shell.desktopmode.DesktopMinimizationTransitionHandler;
import com.android.wm.shell.desktopmode.DesktopMixedTransitionHandler;
@@ -1526,6 +1527,18 @@ public abstract class WMShellModule {
                        mainHandler));
    }

    @WMSingleton
    @Provides
    static Optional<DesktopImeHandler> provideDesktopImeHandler(
            DisplayImeController displayImeController,
            Context context,
            ShellInit shellInit) {
        if (!DesktopModeStatus.canEnterDesktopMode(context)) {
            return Optional.empty();
        }
        return Optional.of(new DesktopImeHandler(displayImeController, shellInit));
    }

    //
    // App zoom out
    //
+51 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 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.desktopmode

import android.view.SurfaceControl
import com.android.window.flags.Flags
import com.android.wm.shell.common.DisplayImeController
import com.android.wm.shell.common.DisplayImeController.ImePositionProcessor.IME_ANIMATION_DEFAULT
import com.android.wm.shell.sysui.ShellInit

/** Handles the interactions between IME and desktop tasks */
class DesktopImeHandler(
    private val displayImeController: DisplayImeController,
    shellInit: ShellInit,
) : DisplayImeController.ImePositionProcessor {

    init {
        shellInit.addInitCallback(::onInit, this)
    }

    private fun onInit() {
        if (Flags.enableDesktopImeBugfix()) {
            displayImeController.addPositionProcessor(this)
        }
    }

    override fun onImeStartPositioning(
        displayId: Int,
        hiddenTop: Int,
        shownTop: Int,
        showing: Boolean,
        isFloating: Boolean,
        t: SurfaceControl.Transaction?,
    ): Int {
        return IME_ANIMATION_DEFAULT
    }
}