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

Commit d0bb4223 authored by Jerry Chang's avatar Jerry Chang
Browse files

Implement wm shell module for different sysui branches

Extracts base dependencies of WM shell lib to WMShellBaseModule. Put
other dependencies in WMShellModule to support customizing them in the
other branches of SystemUI.

Bug: 161116823
Bug: 161118569
Test: make ArcSystemUI
Test: atest SystemUITests
Test: atest SystemUIGoogleTests
Test: lunch cf_x86_auto, atest CarSystemUITests
Change-Id: I8bfbc86aadb9f4cee3e2f52a4d2a0d0053941c6e
parent efa54e47
Loading
Loading
Loading
Loading
+3 −45
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import static com.android.systemui.Dependency.LEAK_REPORT_EMAIL_NAME;
import android.content.Context;
import android.os.Handler;
import android.os.PowerManager;
import android.view.IWindowManager;

import com.android.keyguard.KeyguardViewController;
import com.android.systemui.broadcast.BroadcastDispatcher;
@@ -40,8 +39,6 @@ import com.android.systemui.demomode.DemoModeController;
import com.android.systemui.dock.DockManager;
import com.android.systemui.dock.DockManagerImpl;
import com.android.systemui.doze.DozeHost;
import com.android.systemui.pip.phone.PipMenuActivity;
import com.android.systemui.pip.phone.dagger.PipMenuActivityClass;
import com.android.systemui.plugins.qs.QSFactory;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.power.EnhancedEstimates;
@@ -68,11 +65,7 @@ import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
import com.android.systemui.statusbar.policy.HeadsUpManager;
import com.android.systemui.volume.VolumeDialogComponent;
import com.android.systemui.wm.DisplaySystemBarsController;
import com.android.wm.shell.common.DisplayController;
import com.android.wm.shell.common.DisplayImeController;
import com.android.wm.shell.common.SystemWindows;
import com.android.wm.shell.common.TransactionPool;
import com.android.systemui.wmshell.CarWMShellModule;

import javax.inject.Named;

@@ -83,7 +76,8 @@ import dagger.Provides;
@Module(
        includes = {
                DividerModule.class,
                QSModule.class
                QSModule.class,
                CarWMShellModule.class
        })
abstract class CarSystemUIModule {

@@ -120,42 +114,6 @@ abstract class CarSystemUIModule {
        return new Recents(context, recentsImplementation, commandQueue);
    }

    @SysUISingleton
    @Provides
    static TransactionPool provideTransactionPool() {
        return new TransactionPool();
    }

    @SysUISingleton
    @Provides
    static DisplayController providerDisplayController(Context context, @Main Handler handler,
            IWindowManager wmService) {
        return new DisplayController(context, handler, wmService);
    }

    @SysUISingleton
    @Provides
    static SystemWindows provideSystemWindows(DisplayController displayController,
            IWindowManager wmService) {
        return new SystemWindows(displayController, wmService);
    }

    @SysUISingleton
    @Provides
    static DisplayImeController provideDisplayImeController(Context context,
            IWindowManager wmService, DisplayController displayController,
            @Main Handler mainHandler, TransactionPool transactionPool) {
        return new DisplaySystemBarsController.Builder(context, wmService, displayController,
                mainHandler, transactionPool).build();
    }

    @SysUISingleton
    @PipMenuActivityClass
    @Provides
    static Class<?> providePipMenuActivityClass() {
        return PipMenuActivity.class;
    }

    @Binds
    abstract HeadsUpManager bindHeadsUpManagerPhone(HeadsUpManagerPhone headsUpManagerPhone);

+54 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 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.systemui.wmshell;

import android.content.Context;
import android.os.Handler;
import android.view.IWindowManager;

import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.pip.phone.PipMenuActivity;
import com.android.systemui.pip.phone.dagger.PipMenuActivityClass;
import com.android.systemui.wm.DisplaySystemBarsController;
import com.android.wm.shell.common.DisplayController;
import com.android.wm.shell.common.DisplayImeController;
import com.android.wm.shell.common.TransactionPool;

import dagger.Module;
import dagger.Provides;

/** Provides dependencies from {@link com.android.wm.shell} for CarSystemUI. */
@Module(includes = WMShellBaseModule.class)
public class CarWMShellModule {
    @SysUISingleton
    @Provides
    DisplayImeController provideDisplayImeController(Context context,
            IWindowManager wmService, DisplayController displayController,
            @Main Handler mainHandler, TransactionPool transactionPool) {
        return new DisplaySystemBarsController.Builder(context, wmService, displayController,
                mainHandler, transactionPool).build();
    }

    /** TODO(b/150319024): PipMenuActivity will move to a Window */
    @SysUISingleton
    @PipMenuActivityClass
    @Provides
    Class<?> providePipMenuActivityClass() {
        return PipMenuActivity.class;
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
import com.android.systemui.statusbar.policy.DeviceProvisionedControllerImpl;
import com.android.systemui.statusbar.policy.HeadsUpManager;
import com.android.systemui.wmshell.WindowManagerShellModule;
import com.android.systemui.wmshell.WMShellModule;

import javax.inject.Named;

@@ -77,7 +77,7 @@ import dagger.Provides;
@Module(includes = {
            DividerModule.class,
            QSModule.class,
            WindowManagerShellModule.class
            WMShellModule.class
        })
public abstract class SystemUIDefaultModule {

+2 −2
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
import com.android.systemui.statusbar.policy.DeviceProvisionedControllerImpl;
import com.android.systemui.statusbar.policy.HeadsUpManager;
import com.android.systemui.wmshell.WindowManagerShellModule;
import com.android.systemui.wmshell.WMShellModule;

import javax.inject.Named;

@@ -78,7 +78,7 @@ import dagger.Provides;
@Module(includes = {
            DividerModule.class,
            QSModule.class,
            WindowManagerShellModule.class
            WMShellModule.class
        },
        subcomponents = {
        })
+58 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 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.systemui.wmshell;

import android.content.Context;
import android.os.Handler;
import android.view.IWindowManager;

import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.wm.shell.common.DisplayController;
import com.android.wm.shell.common.SystemWindows;
import com.android.wm.shell.common.TransactionPool;

import dagger.Module;
import dagger.Provides;

/**
 * Provides basic dependencies from {@link com.android.wm.shell}, the dependencies declared here
 * should be shared among different branches of SystemUI.
 */
// TODO(b/162923491): Move most of these dependencies into WMSingleton scope.
@Module
public class WMShellBaseModule {
    @SysUISingleton
    @Provides
    static TransactionPool provideTransactionPool() {
        return new TransactionPool();
    }

    @SysUISingleton
    @Provides
    static DisplayController provideDisplayController(Context context, @Main Handler handler,
            IWindowManager wmService) {
        return new DisplayController(context, handler, wmService);
    }

    @SysUISingleton
    @Provides
    static SystemWindows provideSystemWindows(DisplayController displayController,
            IWindowManager wmService) {
        return new SystemWindows(displayController, wmService);
    }
}
Loading