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

Commit 5086c853 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add ViewController for KeyguardBottomAreaView." into tm-qpr-dev

parents 6abc4e06 5a3fe13f
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
@@ -343,6 +343,8 @@ public final class NotificationPanelViewController extends PanelViewController {
    private final LockIconViewController mLockIconViewController;
    private NotificationsQuickSettingsContainer mNotificationContainerParent;
    private final NotificationsQSContainerController mNotificationsQSContainerController;
    private final Provider<KeyguardBottomAreaViewController>
            mKeyguardBottomAreaViewControllerProvider;
    private boolean mAnimateNextPositionUpdate;
    private float mQuickQsHeaderHeight;
    private final ScreenOffAnimationController mScreenOffAnimationController;
@@ -741,6 +743,7 @@ public final class NotificationPanelViewController extends PanelViewController {
            InteractionJankMonitor interactionJankMonitor,
            QsFrameTranslateController qsFrameTranslateController,
            SysUiState sysUiState,
            Provider<KeyguardBottomAreaViewController> keyguardBottomAreaViewControllerProvider,
            KeyguardUnlockAnimationController keyguardUnlockAnimationController,
            NotificationListContainer notificationListContainer,
            PanelEventsEmitter panelEventsEmitter,
@@ -782,6 +785,7 @@ public final class NotificationPanelViewController extends PanelViewController {
        mNotificationsQSContainerController = notificationsQSContainerController;
        mNotificationListContainer = notificationListContainer;
        mNotificationStackSizeCalculator = notificationStackSizeCalculator;
        mKeyguardBottomAreaViewControllerProvider = keyguardBottomAreaViewControllerProvider;
        mNotificationsQSContainerController.init();
        mNotificationStackScrollLayoutController = notificationStackScrollLayoutController;
        mNotificationIconAreaController = notificationIconAreaController;
@@ -1222,8 +1226,7 @@ public final 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);
        mView.addView(mKeyguardBottomArea, index);
        initBottomArea();
+14 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ import com.android.systemui.statusbar.connectivity.NetworkController;
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;
@@ -290,4 +291,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
@@ -173,6 +173,8 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
    @Mock
    private KeyguardBottomAreaView mKeyguardBottomArea;
    @Mock
    private KeyguardBottomAreaViewController mKeyguardBottomAreaViewController;
    @Mock
    private KeyguardBottomAreaView mQsFrame;
    private KeyguardStatusView mKeyguardStatusView;
    @Mock
@@ -400,6 +402,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.animate()).thenReturn(mock(ViewPropertyAnimator.class));
        when(mView.findViewById(R.id.qs_frame)).thenReturn(mQsFrame);
@@ -482,7 +485,8 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
        mMainHandler = new Handler(Looper.getMainLooper());
        mPanelEventsEmitter = new NotificationPanelViewController.PanelEventsEmitter();

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