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

Commit 199b699c authored by Dave Mankoff's avatar Dave Mankoff
Browse files

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
parent f9337895
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
/*
 * 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
    }
}
+5 −2
Original line number Diff line number Diff line
@@ -351,6 +351,8 @@ public class NotificationPanelViewController extends PanelViewController {
    private LockIconViewController mLockIconViewController;
    private NotificationsQuickSettingsContainer mNotificationContainerParent;
    private NotificationsQSContainerController mNotificationsQSContainerController;
    private final Provider<KeyguardBottomAreaViewController>
            mKeyguardBottomAreaViewControllerProvider;
    private boolean mAnimateNextPositionUpdate;
    private float mQuickQsHeaderHeight;
    private ScreenOffAnimationController mScreenOffAnimationController;
@@ -768,6 +770,7 @@ public class NotificationPanelViewController extends PanelViewController {
            InteractionJankMonitor interactionJankMonitor,
            QsFrameTranslateController qsFrameTranslateController,
            SysUiState sysUiState,
            Provider<KeyguardBottomAreaViewController> keyguardBottomAreaViewControllerProvider,
            KeyguardUnlockAnimationController keyguardUnlockAnimationController,
            NotificationListContainer notificationListContainer,
            PanelEventsEmitter panelEventsEmitter,
@@ -808,6 +811,7 @@ public class NotificationPanelViewController extends PanelViewController {
        mNotificationsQSContainerController = notificationsQSContainerController;
        mNotificationListContainer = notificationListContainer;
        mNotificationStackSizeCalculator = notificationStackSizeCalculator;
        mKeyguardBottomAreaViewControllerProvider = keyguardBottomAreaViewControllerProvider;
        mNotificationsQSContainerController.init();
        mNotificationStackScrollLayoutController = notificationStackScrollLayoutController;
        mNotificationIconAreaController = notificationIconAreaController;
@@ -1241,8 +1245,7 @@ public class NotificationPanelViewController extends PanelViewController {
        int index = mView.indexOfChild(mKeyguardBottomArea);
        mView.removeView(mKeyguardBottomArea);
        KeyguardBottomAreaView oldBottomArea = mKeyguardBottomArea;
        mKeyguardBottomArea = (KeyguardBottomAreaView) mLayoutInflater.inflate(
                R.layout.keyguard_bottom_area, mView, false);
        mKeyguardBottomArea = mKeyguardBottomAreaViewControllerProvider.get().getView();
        mKeyguardBottomArea.initFrom(oldBottomArea);
        mKeyguardBottomArea.setPreviewContainer(mPreviewContainer);
        mView.addView(mKeyguardBottomArea, index);
+14 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import com.android.systemui.statusbar.OperatorNameViewController;
import com.android.systemui.statusbar.events.SystemStatusAnimationScheduler;
import com.android.systemui.statusbar.notification.row.dagger.NotificationShelfComponent;
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.NotificationPanelView;
import com.android.systemui.statusbar.phone.NotificationPanelViewController;
@@ -287,4 +288,17 @@ public abstract class StatusBarViewModule {
                secureSettings,
                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);
    }

}
+6 −1
Original line number Diff line number Diff line
@@ -172,6 +172,8 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
    @Mock
    private KeyguardBottomAreaView mKeyguardBottomArea;
    @Mock
    private KeyguardBottomAreaViewController mKeyguardBottomAreaViewController;
    @Mock
    private KeyguardBottomAreaView mQsFrame;
    private KeyguardStatusView mKeyguardStatusView;
    @Mock
@@ -397,6 +399,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
        when(mNotificationStackScrollLayoutController.getHeight()).thenReturn(1000);
        when(mNotificationStackScrollLayoutController.getHeadsUpCallback())
                .thenReturn(mHeadsUpCallback);
        when(mKeyguardBottomAreaViewController.getView()).thenReturn(mKeyguardBottomArea);
        when(mView.findViewById(R.id.keyguard_bottom_area)).thenReturn(mKeyguardBottomArea);
        when(mKeyguardBottomArea.getLeftView()).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());
        mPanelEventsEmitter = new NotificationPanelViewController.PanelEventsEmitter();

        mNotificationPanelViewController = new NotificationPanelViewController(mView,
        mNotificationPanelViewController = new NotificationPanelViewController(
                mView,
                mResources,
                mMainHandler,
                mLayoutInflater,
@@ -534,6 +538,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
                mInteractionJankMonitor,
                mQsFrameTranslateController,
                mSysUiState,
                () -> mKeyguardBottomAreaViewController,
                mKeyguardUnlockAnimationController,
                mNotificationListContainer,
                mPanelEventsEmitter,