Merge "Add ViewController for KeyguardBottomAreaView." into tm-qpr-dev am: 5086c853e1

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19279468

Change-Id: I252be0b62edc4f6c9a8fdabc56f74e8be7ca344c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
TreeHugger Robot
2022-07-14 00:13:03 +00:00
committed by Automerger Merge Worker
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

@@ -343,6 +343,8 @@ public final class NotificationPanelViewController extends PanelViewController {
private final LockIconViewController mLockIconViewController; private final LockIconViewController mLockIconViewController;
private NotificationsQuickSettingsContainer mNotificationContainerParent; private NotificationsQuickSettingsContainer mNotificationContainerParent;
private final NotificationsQSContainerController mNotificationsQSContainerController; private final NotificationsQSContainerController mNotificationsQSContainerController;
private final Provider<KeyguardBottomAreaViewController>
mKeyguardBottomAreaViewControllerProvider;
private boolean mAnimateNextPositionUpdate; private boolean mAnimateNextPositionUpdate;
private float mQuickQsHeaderHeight; private float mQuickQsHeaderHeight;
private final ScreenOffAnimationController mScreenOffAnimationController; private final ScreenOffAnimationController mScreenOffAnimationController;
@@ -741,6 +743,7 @@ public final 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,
@@ -782,6 +785,7 @@ public final 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;
@@ -1222,8 +1226,7 @@ public final 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);
mView.addView(mKeyguardBottomArea, index); mView.addView(mKeyguardBottomArea, index);
initBottomArea(); initBottomArea();

View File

@@ -42,6 +42,7 @@ import com.android.systemui.statusbar.connectivity.NetworkController;
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;
@@ -290,4 +291,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

@@ -173,6 +173,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
@@ -400,6 +402,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.animate()).thenReturn(mock(ViewPropertyAnimator.class)); when(mKeyguardBottomArea.animate()).thenReturn(mock(ViewPropertyAnimator.class));
when(mView.findViewById(R.id.qs_frame)).thenReturn(mQsFrame); when(mView.findViewById(R.id.qs_frame)).thenReturn(mQsFrame);
@@ -482,7 +485,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,
mMainHandler, mMainHandler,
mLayoutInflater, mLayoutInflater,
mFeatureFlags, mFeatureFlags,
@@ -533,6 +537,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
mInteractionJankMonitor, mInteractionJankMonitor,
mQsFrameTranslateController, mQsFrameTranslateController,
mSysUiState, mSysUiState,
() -> mKeyguardBottomAreaViewController,
mKeyguardUnlockAnimationController, mKeyguardUnlockAnimationController,
mNotificationListContainer, mNotificationListContainer,
mPanelEventsEmitter, mPanelEventsEmitter,