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

Commit 82b96cd2 authored by Heemin Seog's avatar Heemin Seog
Browse files

Inject StatusBarWindowViewController

Bug: 144378800
Test: manual, atest SystemUITests
Change-Id: I9c957ffc943bcef04a2473e5feaca6d85b26071c
parent 7c93dc5e
Loading
Loading
Loading
Loading
+19 −11
Original line number Diff line number Diff line
@@ -114,6 +114,7 @@ import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.LightBarController;
import com.android.systemui.statusbar.phone.LightsOutNotifController;
import com.android.systemui.statusbar.phone.LockscreenLockIconController;
import com.android.systemui.statusbar.phone.LockscreenWallpaper;
import com.android.systemui.statusbar.phone.NotificationGroupAlertTransferHelper;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
@@ -153,7 +154,10 @@ public class CarStatusBar extends StatusBar implements CarBatteryController.Batt
    private static final float FLING_ANIMATION_MAX_TIME = 0.5f;
    // acceleration rate for the fling animation
    private static final float FLING_SPEED_UP_FACTOR = 0.6f;

    private final ScrimController mScrimController;
    private final StatusBarWindowViewController mStatusBarWindowViewController;
    private final LockscreenLockIconController mLockscreenLockIconController;

    private float mOpeningVelocity = DEFAULT_FLING_VELOCITY;
    private float mClosingVelocity = DEFAULT_FLING_VELOCITY;
@@ -287,7 +291,8 @@ public class CarStatusBar extends StatusBar implements CarBatteryController.Batt
            NotificationListener notificationListener,
            ConfigurationController configurationController,
            StatusBarWindowController statusBarWindowController,
            StatusBarWindowViewController.Builder statusBarWindowViewControllerBuild,
            StatusBarWindowViewController statusBarWindowViewController,
            LockscreenLockIconController lockscreenLockIconController,
            DozeParameters dozeParameters,
            ScrimController scrimController,
            Lazy<LockscreenWallpaper> lockscreenWallpaperLazy,
@@ -363,7 +368,8 @@ public class CarStatusBar extends StatusBar implements CarBatteryController.Batt
                notificationListener,
                configurationController,
                statusBarWindowController,
                statusBarWindowViewControllerBuild,
                statusBarWindowViewController,
                lockscreenLockIconController,
                dozeParameters,
                scrimController,
                null /* keyguardLiftController */,
@@ -385,6 +391,8 @@ public class CarStatusBar extends StatusBar implements CarBatteryController.Batt
                viewMediatorCallback,
                dismissCallbackRegistry);
        mScrimController = scrimController;
        mStatusBarWindowViewController = statusBarWindowViewController;
        mLockscreenLockIconController = lockscreenLockIconController;
        mDeviceProvisionedController = deviceProvisionedController;
        mCarServiceProvider = carServiceProvider;
        mDrivingStateHelperLazy = drivingStateHelperLazy;
+5 −2
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.LightBarController;
import com.android.systemui.statusbar.phone.LightsOutNotifController;
import com.android.systemui.statusbar.phone.LockscreenLockIconController;
import com.android.systemui.statusbar.phone.LockscreenWallpaper;
import com.android.systemui.statusbar.phone.NotificationGroupAlertTransferHelper;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
@@ -160,7 +161,8 @@ public class CarStatusBarModule {
            NotificationListener notificationListener,
            ConfigurationController configurationController,
            StatusBarWindowController statusBarWindowController,
            StatusBarWindowViewController.Builder statusBarWindowViewControllerBuilder,
            StatusBarWindowViewController statusBarWindowViewController,
            LockscreenLockIconController lockscreenLockIconController,
            DozeParameters dozeParameters,
            ScrimController scrimController,
            Lazy<LockscreenWallpaper> lockscreenWallpaperLazy,
@@ -235,7 +237,8 @@ public class CarStatusBarModule {
                notificationListener,
                configurationController,
                statusBarWindowController,
                statusBarWindowViewControllerBuilder,
                statusBarWindowViewController,
                lockscreenLockIconController,
                dozeParameters,
                scrimController,
                lockscreenWallpaperLazy,
+6 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.view.LayoutInflater;
import android.view.ViewGroup;

import com.android.systemui.R;
import com.android.systemui.statusbar.phone.LockIcon;
import com.android.systemui.statusbar.phone.StatusBarWindowView;
import com.android.systemui.util.InjectionInflationController;

@@ -66,6 +67,11 @@ public class SuperStatusBarViewFactory {
        return mStatusBarWindowView;
    }

    /** Gets the {@link LockIcon} inside of {@link R.layout#super_status_bar}. */
    public LockIcon getLockIcon() {
        return getStatusBarWindowView().findViewById(R.id.lock_icon);
    }

    /**
     * Gets the inflated {@link NotificationShelf} from
     * {@link R.layout#status_bar_notification_shelf}.
+8 −5
Original line number Diff line number Diff line
@@ -88,8 +88,9 @@ public final class DozeServiceHost implements DozeHost {
    private final PulseExpansionHandler mPulseExpansionHandler;
    private final StatusBarWindowController mStatusBarWindowController;
    private final NotificationWakeUpCoordinator mNotificationWakeUpCoordinator;
    private final StatusBarWindowViewController mStatusBarWindowViewController;
    private final LockscreenLockIconController mLockscreenLockIconController;
    private NotificationIconAreaController mNotificationIconAreaController;
    private StatusBarWindowViewController mStatusBarWindowViewController;
    private StatusBarWindowView mStatusBarWindow;
    private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
    private NotificationPanelView mNotificationPanel;
@@ -110,7 +111,9 @@ public final class DozeServiceHost implements DozeHost {
            VisualStabilityManager visualStabilityManager,
            PulseExpansionHandler pulseExpansionHandler,
            StatusBarWindowController statusBarWindowController,
            NotificationWakeUpCoordinator notificationWakeUpCoordinator) {
            NotificationWakeUpCoordinator notificationWakeUpCoordinator,
            StatusBarWindowViewController statusBarWindowViewController,
            LockscreenLockIconController lockscreenLockIconController) {
        super();
        mDozeLog = dozeLog;
        mPowerManager = powerManager;
@@ -129,6 +132,8 @@ public final class DozeServiceHost implements DozeHost {
        mPulseExpansionHandler = pulseExpansionHandler;
        mStatusBarWindowController = statusBarWindowController;
        mNotificationWakeUpCoordinator = notificationWakeUpCoordinator;
        mStatusBarWindowViewController = statusBarWindowViewController;
        mLockscreenLockIconController = lockscreenLockIconController;
    }

    // TODO: we should try to not pass status bar in here if we can avoid it.
@@ -138,13 +143,11 @@ public final class DozeServiceHost implements DozeHost {
     */
    public void initialize(StatusBar statusBar,
            NotificationIconAreaController notificationIconAreaController,
            StatusBarWindowViewController statusBarWindowViewController,
            StatusBarWindowView statusBarWindow,
            StatusBarKeyguardViewManager statusBarKeyguardViewManager,
            NotificationPanelView notificationPanel, View ambientIndicationContainer) {
        mStatusBar = statusBar;
        mNotificationIconAreaController = notificationIconAreaController;
        mStatusBarWindowViewController = statusBarWindowViewController;
        mStatusBarWindow = statusBarWindow;
        mStatusBarKeyguardViewManager = statusBarKeyguardViewManager;
        mNotificationPanel = notificationPanel;
@@ -262,7 +265,7 @@ public final class DozeServiceHost implements DozeHost {
                mKeyguardViewMediator.setPulsing(pulsing);
                mNotificationPanel.setPulsing(pulsing);
                mVisualStabilityManager.setPulsing(pulsing);
                mStatusBarWindowViewController.setPulsing(pulsing);
                mLockscreenLockIconController.setPulsing(pulsing);
                mIgnoreTouchWhilePulsing = false;
                if (mKeyguardUpdateMonitor != null && passiveAuthInterrupt) {
                    mKeyguardUpdateMonitor.onAuthInterruptDetected(pulsing /* active */);
+89 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 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.statusbar.SuperStatusBarViewFactory;

import javax.inject.Inject;
import javax.inject.Singleton;

/** Controls the {@link LockIcon} in the lockscreen. */
@Singleton
public class LockscreenLockIconController {

    private final LockIcon mLockIcon;

    @Inject
    public LockscreenLockIconController(SuperStatusBarViewFactory superStatusBarViewFactory) {
        mLockIcon = superStatusBarViewFactory.getLockIcon();
    }

    /**
     * Called whenever the scrims become opaque, transparent or semi-transparent.
     */
    public void onScrimVisibilityChanged(Integer scrimsVisible) {
        if (mLockIcon != null) {
            mLockIcon.onScrimVisibilityChanged(scrimsVisible);
        }
    }

    /**
     * Propagate {@link StatusBar} pulsing state.
     */
    public void setPulsing(boolean pulsing) {
        if (mLockIcon != null) {
            mLockIcon.setPulsing(pulsing);
        }
    }

    /**
     * Called when the biometric authentication mode changes.
     *
     * @param wakeAndUnlock If the type is {@link BiometricUnlockController#isWakeAndUnlock()}
     * @param isUnlock      If the type is {@link BiometricUnlockController#isBiometricUnlock()} ()
     */
    public void onBiometricAuthModeChanged(boolean wakeAndUnlock, boolean isUnlock) {
        if (mLockIcon != null) {
            mLockIcon.onBiometricAuthModeChanged(wakeAndUnlock, isUnlock);
        }
    }

    /**
     * When we're launching an affordance, like double pressing power to open camera.
     */
    public void onShowingLaunchAffordanceChanged(Boolean showing) {
        if (mLockIcon != null) {
            mLockIcon.onShowingLaunchAffordanceChanged(showing);
        }
    }

    /** Sets whether the bouncer is showing. */
    public void setBouncerShowingScrimmed(boolean bouncerShowing) {
        if (mLockIcon != null) {
            mLockIcon.setBouncerShowingScrimmed(bouncerShowing);
        }
    }

    /**
     * When {@link KeyguardBouncer} starts to be dismissed and starts to play its animation.
     */
    public void onBouncerPreHideAnimation() {
        if (mLockIcon != null) {
            mLockIcon.onBouncerPreHideAnimation();
        }
    }
}
Loading