[Central Surfaces] Make NotificationShadeWindowView a singleton.
Bug: 277762009 Test: compiles; notification shade still works Change-Id: I58546516fe6daa3efb9ab0879fd962caf08d8b00
This commit is contained in:
@@ -71,6 +71,7 @@ import com.android.systemui.screenshot.dagger.ScreenshotModule;
|
||||
import com.android.systemui.security.data.repository.SecurityRepositoryModule;
|
||||
import com.android.systemui.settings.DisplayTracker;
|
||||
import com.android.systemui.shade.ShadeController;
|
||||
import com.android.systemui.shade.ShadeModule;
|
||||
import com.android.systemui.shade.transition.LargeScreenShadeInterpolator;
|
||||
import com.android.systemui.shade.transition.LargeScreenShadeInterpolatorImpl;
|
||||
import com.android.systemui.smartspace.dagger.SmartspaceModule;
|
||||
@@ -174,6 +175,7 @@ import javax.inject.Named;
|
||||
SecurityRepositoryModule.class,
|
||||
ScreenRecordModule.class,
|
||||
SettingsUtilModule.class,
|
||||
ShadeModule.class,
|
||||
SmartRepliesInflationModule.class,
|
||||
SmartspaceModule.class,
|
||||
StatusBarPipelineModule.class,
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (C) 2023 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.shade
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import com.android.systemui.R
|
||||
import com.android.systemui.dagger.SysUISingleton
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
|
||||
/** Module for classes related to the notification shade. */
|
||||
@Module
|
||||
abstract class ShadeModule {
|
||||
companion object {
|
||||
@Provides
|
||||
@SysUISingleton
|
||||
// TODO(b/277762009): Do something similar to
|
||||
// {@link StatusBarWindowModule.InternalWindowView} so that only
|
||||
// {@link NotificationShadeWindowViewController} can inject this view.
|
||||
fun providesNotificationShadeWindowView(
|
||||
layoutInflater: LayoutInflater,
|
||||
): NotificationShadeWindowView {
|
||||
return layoutInflater.inflate(R.layout.super_notification_shade, /* root= */ null)
|
||||
as NotificationShadeWindowView?
|
||||
?: throw IllegalStateException(
|
||||
"R.layout.super_notification_shade could not be properly inflated"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1637,6 +1637,8 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
|
||||
mNotificationShadeWindowView = mCentralSurfacesComponent.getNotificationShadeWindowView();
|
||||
mNotificationShadeWindowViewController = mCentralSurfacesComponent
|
||||
.getNotificationShadeWindowViewController();
|
||||
// TODO(b/277762009): Inject [NotificationShadeWindowView] directly into the controller.
|
||||
// (Right now, there's a circular dependency.)
|
||||
mNotificationShadeWindowController.setNotificationShadeView(mNotificationShadeWindowView);
|
||||
mNotificationShadeWindowViewController.setupExpandedStatusBar();
|
||||
NotificationPanelViewController npvc =
|
||||
|
||||
@@ -95,21 +95,6 @@ public abstract class StatusBarViewModule {
|
||||
public static final String SHADE_HEADER = "large_screen_shade_header";
|
||||
public static final String STATUS_BAR_FRAGMENT = "status_bar_fragment";
|
||||
|
||||
/** */
|
||||
@Provides
|
||||
@CentralSurfacesComponent.CentralSurfacesScope
|
||||
public static NotificationShadeWindowView providesNotificationShadeWindowView(
|
||||
LayoutInflater layoutInflater) {
|
||||
NotificationShadeWindowView notificationShadeWindowView = (NotificationShadeWindowView)
|
||||
layoutInflater.inflate(R.layout.super_notification_shade, /* root= */ null);
|
||||
if (notificationShadeWindowView == null) {
|
||||
throw new IllegalStateException(
|
||||
"R.layout.super_notification_shade could not be properly inflated");
|
||||
}
|
||||
|
||||
return notificationShadeWindowView;
|
||||
}
|
||||
|
||||
/** */
|
||||
@Provides
|
||||
@CentralSurfacesComponent.CentralSurfacesScope
|
||||
|
||||
Reference in New Issue
Block a user