[14/n] Create LetterboxModule

Creates LetterboxModule to reduce merge conflicts in WmShellModule
and to make the code more modular.

Flag: EXEMPT small refactoring
Fix: 381542745
Test: m

Change-Id: If3b1aea0b5c615da699f5d990fcade039df2b135
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/LetterboxModule.java b/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/LetterboxModule.java
new file mode 100644
index 0000000..76279ec
--- /dev/null
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/LetterboxModule.java
@@ -0,0 +1,56 @@
+/*
+ * 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);
+}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellModule.java b/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellModule.java
index 806be8c..f46b955 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellModule.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellModule.java
@@ -71,12 +71,8 @@
 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 @@
  * <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 @@
         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);
 }