blob: d1d352a08908dcaf0a2c6c3e2a12daf3b7b93bcf [file] [log] [blame]
Heemin Seogba6337f2019-12-10 15:34:37 -08001/*
2 * Copyright (C) 2019 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.systemui.statusbar.car;
18
19import android.view.View;
20import android.view.WindowManager;
21
22import com.android.car.notification.CarNotificationView;
23import com.android.systemui.assist.AssistManager;
24import com.android.systemui.bubbles.BubbleController;
25import com.android.systemui.plugins.statusbar.StatusBarStateController;
26import com.android.systemui.statusbar.CommandQueue;
27import com.android.systemui.statusbar.phone.ShadeControllerImpl;
28import com.android.systemui.statusbar.phone.StatusBar;
29import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
30import com.android.systemui.statusbar.phone.StatusBarWindowController;
31
32import javax.inject.Inject;
33import javax.inject.Singleton;
34
35import dagger.Lazy;
36
37/** Car specific implementation of {@link com.android.systemui.statusbar.phone.ShadeController}. */
38@Singleton
39public class CarShadeControllerImpl extends ShadeControllerImpl {
40
41 @Inject
42 public CarShadeControllerImpl(CommandQueue commandQueue,
43 StatusBarStateController statusBarStateController,
44 StatusBarWindowController statusBarWindowController,
45 StatusBarKeyguardViewManager statusBarKeyguardViewManager,
46 WindowManager windowManager,
47 Lazy<StatusBar> statusBarLazy,
48 Lazy<AssistManager> assistManagerLazy,
49 Lazy<BubbleController> bubbleControllerLazy) {
50 super(commandQueue, statusBarStateController, statusBarWindowController,
51 statusBarKeyguardViewManager, windowManager,
52 statusBarLazy, assistManagerLazy, bubbleControllerLazy);
53 }
54
55 @Override
56 public void animateCollapsePanels(int flags, boolean force, boolean delayed,
57 float speedUpFactor) {
58 super.animateCollapsePanels(flags, force, delayed, speedUpFactor);
59 if (!getCarStatusBar().isPanelExpanded()
60 || getCarNotificationView().getVisibility() == View.INVISIBLE) {
61 return;
62 }
63
64 mStatusBarWindowController.setStatusBarFocusable(false);
65 getCarStatusBar().getStatusBarWindowViewController().cancelExpandHelper();
66 getStatusBarView().collapsePanel(true /* animate */, delayed, speedUpFactor);
67
68 getCarStatusBar().animateNotificationPanel(getCarStatusBar().getClosingVelocity(), true);
69
70 if (!getCarStatusBar().isTracking()) {
71 mStatusBarWindowController.setPanelVisible(false);
72 getCarNotificationView().setVisibility(View.INVISIBLE);
73 }
74
75 getCarStatusBar().setPanelExpanded(false);
76 }
77
78 private CarStatusBar getCarStatusBar() {
79 return (CarStatusBar) mStatusBarLazy.get();
80 }
81
82 private CarNotificationView getCarNotificationView() {
83 return getCarStatusBar().getCarNotificationView();
84 }
85}