Add ViewController for KeyguardBottomAreaView.

This CL doesn't do much by itself. It merely adds scaffolding upon
which more work can be built later.

Bug: 218354102
Test: manual
Change-Id: I3945214b2670ddd6a9f48736407ebdb89203c017
This commit is contained in:
Dave Mankoff
2022-02-09 21:16:49 -05:00
parent f933789540
commit 199b699c1e
4 changed files with 59 additions and 3 deletions

View File

@@ -0,0 +1,34 @@
/*
* Copyright (C) 2022 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.statusbar.phone
import com.android.systemui.util.ViewController
import javax.inject.Inject
class KeyguardBottomAreaViewController @Inject constructor(view: KeyguardBottomAreaView) :
ViewController<KeyguardBottomAreaView> (view) {
override fun onViewAttached() {
}
override fun onViewDetached() {
}
fun getView(): KeyguardBottomAreaView {
// TODO: remove this method.
return mView
}
}

View File

@@ -351,6 +351,8 @@ public class NotificationPanelViewController extends PanelViewController {
private LockIconViewController mLockIconViewController; private LockIconViewController mLockIconViewController;
private NotificationsQuickSettingsContainer mNotificationContainerParent; private NotificationsQuickSettingsContainer mNotificationContainerParent;
private NotificationsQSContainerController mNotificationsQSContainerController; private NotificationsQSContainerController mNotificationsQSContainerController;
private final Provider<KeyguardBottomAreaViewController>
mKeyguardBottomAreaViewControllerProvider;
private boolean mAnimateNextPositionUpdate; private boolean mAnimateNextPositionUpdate;
private float mQuickQsHeaderHeight; private float mQuickQsHeaderHeight;
private ScreenOffAnimationController mScreenOffAnimationController; private ScreenOffAnimationController mScreenOffAnimationController;
@@ -768,6 +770,7 @@ public class NotificationPanelViewController extends PanelViewController {
InteractionJankMonitor interactionJankMonitor, InteractionJankMonitor interactionJankMonitor,
QsFrameTranslateController qsFrameTranslateController, QsFrameTranslateController qsFrameTranslateController,
SysUiState sysUiState, SysUiState sysUiState,
Provider<KeyguardBottomAreaViewController> keyguardBottomAreaViewControllerProvider,
KeyguardUnlockAnimationController keyguardUnlockAnimationController, KeyguardUnlockAnimationController keyguardUnlockAnimationController,
NotificationListContainer notificationListContainer, NotificationListContainer notificationListContainer,
PanelEventsEmitter panelEventsEmitter, PanelEventsEmitter panelEventsEmitter,
@@ -808,6 +811,7 @@ public class NotificationPanelViewController extends PanelViewController {
mNotificationsQSContainerController = notificationsQSContainerController; mNotificationsQSContainerController = notificationsQSContainerController;
mNotificationListContainer = notificationListContainer; mNotificationListContainer = notificationListContainer;
mNotificationStackSizeCalculator = notificationStackSizeCalculator; mNotificationStackSizeCalculator = notificationStackSizeCalculator;
mKeyguardBottomAreaViewControllerProvider = keyguardBottomAreaViewControllerProvider;
mNotificationsQSContainerController.init(); mNotificationsQSContainerController.init();
mNotificationStackScrollLayoutController = notificationStackScrollLayoutController; mNotificationStackScrollLayoutController = notificationStackScrollLayoutController;
mNotificationIconAreaController = notificationIconAreaController; mNotificationIconAreaController = notificationIconAreaController;
@@ -1241,8 +1245,7 @@ public class NotificationPanelViewController extends PanelViewController {
int index = mView.indexOfChild(mKeyguardBottomArea); int index = mView.indexOfChild(mKeyguardBottomArea);
mView.removeView(mKeyguardBottomArea); mView.removeView(mKeyguardBottomArea);
KeyguardBottomAreaView oldBottomArea = mKeyguardBottomArea; KeyguardBottomAreaView oldBottomArea = mKeyguardBottomArea;
mKeyguardBottomArea = (KeyguardBottomAreaView) mLayoutInflater.inflate( mKeyguardBottomArea = mKeyguardBottomAreaViewControllerProvider.get().getView();
R.layout.keyguard_bottom_area, mView, false);
mKeyguardBottomArea.initFrom(oldBottomArea); mKeyguardBottomArea.initFrom(oldBottomArea);
mKeyguardBottomArea.setPreviewContainer(mPreviewContainer); mKeyguardBottomArea.setPreviewContainer(mPreviewContainer);
mView.addView(mKeyguardBottomArea, index); mView.addView(mKeyguardBottomArea, index);

View File

@@ -41,6 +41,7 @@ import com.android.systemui.statusbar.OperatorNameViewController;
import com.android.systemui.statusbar.events.SystemStatusAnimationScheduler; import com.android.systemui.statusbar.events.SystemStatusAnimationScheduler;
import com.android.systemui.statusbar.notification.row.dagger.NotificationShelfComponent; import com.android.systemui.statusbar.notification.row.dagger.NotificationShelfComponent;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
import com.android.systemui.statusbar.phone.KeyguardBottomAreaView;
import com.android.systemui.statusbar.phone.NotificationIconAreaController; import com.android.systemui.statusbar.phone.NotificationIconAreaController;
import com.android.systemui.statusbar.phone.NotificationPanelView; import com.android.systemui.statusbar.phone.NotificationPanelView;
import com.android.systemui.statusbar.phone.NotificationPanelViewController; import com.android.systemui.statusbar.phone.NotificationPanelViewController;
@@ -287,4 +288,17 @@ public abstract class StatusBarViewModule {
secureSettings, secureSettings,
mainExecutor); mainExecutor);
} }
/**
* Constructs a new, unattached {@link KeyguardBottomAreaView}.
*
* Note that this is explicitly _not_ a singleton, as we want to be able to reinflate it
*/
@Provides
public static KeyguardBottomAreaView providesKeyguardBottomAreaView(
NotificationPanelView npv, LayoutInflater layoutInflater) {
return (KeyguardBottomAreaView) layoutInflater.inflate(R
.layout.keyguard_bottom_area, npv, false);
}
} }

View File

@@ -172,6 +172,8 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
@Mock @Mock
private KeyguardBottomAreaView mKeyguardBottomArea; private KeyguardBottomAreaView mKeyguardBottomArea;
@Mock @Mock
private KeyguardBottomAreaViewController mKeyguardBottomAreaViewController;
@Mock
private KeyguardBottomAreaView mQsFrame; private KeyguardBottomAreaView mQsFrame;
private KeyguardStatusView mKeyguardStatusView; private KeyguardStatusView mKeyguardStatusView;
@Mock @Mock
@@ -397,6 +399,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
when(mNotificationStackScrollLayoutController.getHeight()).thenReturn(1000); when(mNotificationStackScrollLayoutController.getHeight()).thenReturn(1000);
when(mNotificationStackScrollLayoutController.getHeadsUpCallback()) when(mNotificationStackScrollLayoutController.getHeadsUpCallback())
.thenReturn(mHeadsUpCallback); .thenReturn(mHeadsUpCallback);
when(mKeyguardBottomAreaViewController.getView()).thenReturn(mKeyguardBottomArea);
when(mView.findViewById(R.id.keyguard_bottom_area)).thenReturn(mKeyguardBottomArea); when(mView.findViewById(R.id.keyguard_bottom_area)).thenReturn(mKeyguardBottomArea);
when(mKeyguardBottomArea.getLeftView()).thenReturn(mock(KeyguardAffordanceView.class)); when(mKeyguardBottomArea.getLeftView()).thenReturn(mock(KeyguardAffordanceView.class));
when(mKeyguardBottomArea.getRightView()).thenReturn(mock(KeyguardAffordanceView.class)); when(mKeyguardBottomArea.getRightView()).thenReturn(mock(KeyguardAffordanceView.class));
@@ -480,7 +483,8 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
mMainHandler = new Handler(Looper.getMainLooper()); mMainHandler = new Handler(Looper.getMainLooper());
mPanelEventsEmitter = new NotificationPanelViewController.PanelEventsEmitter(); mPanelEventsEmitter = new NotificationPanelViewController.PanelEventsEmitter();
mNotificationPanelViewController = new NotificationPanelViewController(mView, mNotificationPanelViewController = new NotificationPanelViewController(
mView,
mResources, mResources,
mMainHandler, mMainHandler,
mLayoutInflater, mLayoutInflater,
@@ -534,6 +538,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
mInteractionJankMonitor, mInteractionJankMonitor,
mQsFrameTranslateController, mQsFrameTranslateController,
mSysUiState, mSysUiState,
() -> mKeyguardBottomAreaViewController,
mKeyguardUnlockAnimationController, mKeyguardUnlockAnimationController,
mNotificationListContainer, mNotificationListContainer,
mPanelEventsEmitter, mPanelEventsEmitter,