Heemin Seog | ba6337f | 2019-12-10 15:34:37 -0800 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package com.android.systemui.statusbar.car; |
| 18 | |
| 19 | import android.view.View; |
| 20 | import android.view.WindowManager; |
| 21 | |
| 22 | import com.android.car.notification.CarNotificationView; |
| 23 | import com.android.systemui.assist.AssistManager; |
| 24 | import com.android.systemui.bubbles.BubbleController; |
| 25 | import com.android.systemui.plugins.statusbar.StatusBarStateController; |
| 26 | import com.android.systemui.statusbar.CommandQueue; |
| 27 | import com.android.systemui.statusbar.phone.ShadeControllerImpl; |
| 28 | import com.android.systemui.statusbar.phone.StatusBar; |
| 29 | import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; |
| 30 | import com.android.systemui.statusbar.phone.StatusBarWindowController; |
| 31 | |
| 32 | import javax.inject.Inject; |
| 33 | import javax.inject.Singleton; |
| 34 | |
| 35 | import dagger.Lazy; |
| 36 | |
| 37 | /** Car specific implementation of {@link com.android.systemui.statusbar.phone.ShadeController}. */ |
| 38 | @Singleton |
| 39 | public 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 | } |