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

Commit 79a8c7f0 authored by Liran Binyamin's avatar Liran Binyamin
Browse files

Move WMComponent to wm shell

This change moves WMComponent into the wm shell library and introduces
HasWMComponent interface to allow classes to do member injection
where constructor injection is not possible.

Flag: EXEMPT refactor
Bug: 378075955
Test: m sysuig

Change-Id: Ifb0eb7be39eb663b4af56fe73e9783299984ef83
parent ed9508ed
Loading
Loading
Loading
Loading
+27 −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.dagger

/**
 * An interface implemented by the application that uses [WMComponent].
 *
 * This exposes the component to allow classes to do member injection for bindings where constructor
 * injection is not possible, e.g. views.
 */
interface HasWMComponent {
    fun getWMComponent(): WMComponent
}
+4 −8
Original line number Diff line number Diff line
@@ -14,17 +14,14 @@
 * limitations under the License.
 */

package com.android.systemui.dagger;
package com.android.wm.shell.dagger;

import android.os.HandlerThread;

import androidx.annotation.Nullable;

import com.android.systemui.SystemUIInitializer;
import com.android.wm.shell.back.BackAnimation;
import com.android.wm.shell.bubbles.Bubbles;
import com.android.wm.shell.dagger.WMShellModule;
import com.android.wm.shell.dagger.WMSingleton;
import com.android.wm.shell.desktopmode.DesktopMode;
import com.android.wm.shell.displayareahelper.DisplayAreaHelper;
import com.android.wm.shell.keyguard.KeyguardTransitions;
@@ -45,12 +42,11 @@ import java.util.Optional;

/**
 * Dagger Subcomponent for WindowManager.  This class explicitly describes the interfaces exported
 * from the WM component into the SysUI component (in
 * {@link SystemUIInitializer#init(boolean)}), and references the specific dependencies
 * from the WM component into the SysUI component, and references the specific dependencies
 * provided by its particular device/form-factor SystemUI implementation.
 *
 * ie. {@link WMComponent} includes {@link WMShellModule}
 * and {@code TvWMComponent} includes {@link com.android.wm.shell.dagger.TvWMShellModule}
 * <p> ie. {@link WMComponent} includes {@link WMShellModule} and {@code TvWMComponent} includes
 * {@link TvWMShellModule}
 */
@WMSingleton
@Subcomponent(modules = {WMShellModule.class})
+9 −1
Original line number Diff line number Diff line
@@ -45,6 +45,8 @@ import com.android.systemui.process.ProcessWrapper;
import com.android.systemui.res.R;
import com.android.systemui.statusbar.phone.ConfigurationForwarder;
import com.android.systemui.util.NotificationChannels;
import com.android.wm.shell.dagger.HasWMComponent;
import com.android.wm.shell.dagger.WMComponent;

import java.lang.reflect.InvocationTargetException;
import java.util.ArrayDeque;
@@ -61,7 +63,7 @@ import javax.inject.Provider;
 * Application class for SystemUI.
 */
public class SystemUIApplication extends Application implements
        SystemUIAppComponentFactoryBase.ContextInitializer {
        SystemUIAppComponentFactoryBase.ContextInitializer, HasWMComponent {

    public static final String TAG = "SystemUIService";
    private static final boolean DEBUG = false;
@@ -486,4 +488,10 @@ public class SystemUIApplication extends Application implements

        n.addExtras(extras);
    }

    @NonNull
    @Override
    public WMComponent getWMComponent() {
        return mInitializer.getWMComponent();
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -24,9 +24,9 @@ import android.util.Log;

import com.android.systemui.dagger.GlobalRootComponent;
import com.android.systemui.dagger.SysUIComponent;
import com.android.systemui.dagger.WMComponent;
import com.android.systemui.res.R;
import com.android.systemui.util.InitializationChecker;
import com.android.wm.shell.dagger.WMComponent;
import com.android.wm.shell.dagger.WMShellConcurrencyModule;
import com.android.wm.shell.keyguard.KeyguardTransitions;
import com.android.wm.shell.shared.ShellTransitions;
+1 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.flags.SystemPropertiesHelper;
import com.android.systemui.process.ProcessWrapper;
import com.android.systemui.util.InitializationChecker;
import com.android.wm.shell.dagger.WMComponent;

import dagger.BindsInstance;

Loading