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

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

Merge "[14/n] Create LetterboxModule" into main

parents e8c6f249 6ccdb48a
Loading
Loading
Loading
Loading
+56 −0
Original line number Diff line number Diff line
/*
 * Copyright 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.dagger;

import android.annotation.NonNull;

import com.android.wm.shell.common.transition.TransitionStateHolder;
import com.android.wm.shell.compatui.letterbox.LetterboxController;
import com.android.wm.shell.compatui.letterbox.LetterboxControllerStrategy;
import com.android.wm.shell.compatui.letterbox.LetterboxTransitionObserver;
import com.android.wm.shell.compatui.letterbox.MixedLetterboxController;
import com.android.wm.shell.sysui.ShellInit;
import com.android.wm.shell.transition.Transitions;

import dagger.Binds;
import dagger.Module;
import dagger.Provides;

/**
 * Provides Letterbox Shell implementation components to Dagger dependency Graph.
 */
@Module
public abstract class LetterboxModule {

    @WMSingleton
    @Provides
    static LetterboxTransitionObserver provideLetterboxTransitionObserver(
            @NonNull ShellInit shellInit,
            @NonNull Transitions transitions,
            @NonNull LetterboxController letterboxController,
            @NonNull TransitionStateHolder transitionStateHolder,
            @NonNull LetterboxControllerStrategy letterboxControllerStrategy
    ) {
        return new LetterboxTransitionObserver(shellInit, transitions, letterboxController,
                transitionStateHolder, letterboxControllerStrategy);
    }

    @WMSingleton
    @Binds
    abstract LetterboxController bindsLetterboxController(
            MixedLetterboxController letterboxController);
}
+2 −26
Original line number Diff line number Diff line
@@ -71,12 +71,8 @@ import com.android.wm.shell.common.ShellExecutor;
import com.android.wm.shell.common.SyncTransactionQueue;
import com.android.wm.shell.common.TaskStackListenerImpl;
import com.android.wm.shell.common.split.SplitState;
import com.android.wm.shell.common.transition.TransitionStateHolder;
import com.android.wm.shell.compatui.letterbox.LetterboxCommandHandler;
import com.android.wm.shell.compatui.letterbox.LetterboxController;
import com.android.wm.shell.compatui.letterbox.LetterboxControllerStrategy;
import com.android.wm.shell.compatui.letterbox.LetterboxTransitionObserver;
import com.android.wm.shell.compatui.letterbox.MixedLetterboxController;
import com.android.wm.shell.dagger.back.ShellBackAnimationModule;
import com.android.wm.shell.dagger.pip.PipModule;
import com.android.wm.shell.desktopmode.CloseDesktopTaskTransitionHandler;
@@ -182,7 +178,8 @@ import java.util.Optional;
 * <p>This module only defines Shell dependencies for handheld SystemUI implementation. Common
 * dependencies should go into {@link WMShellBaseModule}.
 */
@Module(includes = {WMShellBaseModule.class, PipModule.class, ShellBackAnimationModule.class})
@Module(includes = {WMShellBaseModule.class, PipModule.class, ShellBackAnimationModule.class,
        LetterboxModule.class})
public abstract class WMShellModule {

    //
@@ -1329,25 +1326,4 @@ public abstract class WMShellModule {
        return new Object();
    }

    //
    // App Compat
    //

    @WMSingleton
    @Provides
    static LetterboxTransitionObserver provideLetterboxTransitionObserver(
            @NonNull ShellInit shellInit,
            @NonNull Transitions transitions,
            @NonNull LetterboxController letterboxController,
            @NonNull TransitionStateHolder transitionStateHolder,
            @NonNull LetterboxControllerStrategy letterboxControllerStrategy
    ) {
        return new LetterboxTransitionObserver(shellInit, transitions, letterboxController,
                transitionStateHolder, letterboxControllerStrategy);
    }

    @WMSingleton
    @Binds
    abstract LetterboxController bindsLetterboxController(
            MixedLetterboxController letterboxController);
}