Gus Prevas | ec9e1f0 | 2018-12-18 15:28:12 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018 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.car; |
| 18 | |
| 19 | import android.content.Context; |
| 20 | |
Mady Mellor | a5813e0 | 2019-08-29 15:46:52 -0700 | [diff] [blame^] | 21 | import com.android.systemui.plugins.statusbar.StatusBarStateController; |
| 22 | import com.android.systemui.statusbar.notification.NotificationFilter; |
Gus Prevas | ec9e1f0 | 2018-12-18 15:28:12 -0500 | [diff] [blame] | 23 | import com.android.systemui.statusbar.notification.NotificationInterruptionStateProvider; |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 24 | import com.android.systemui.statusbar.notification.collection.NotificationEntry; |
Gus Prevas | ec9e1f0 | 2018-12-18 15:28:12 -0500 | [diff] [blame] | 25 | |
Govinda Wasserman | 8d49d0d | 2019-08-22 16:51:48 -0400 | [diff] [blame] | 26 | import javax.inject.Inject; |
| 27 | import javax.inject.Singleton; |
| 28 | |
Gus Prevas | ec9e1f0 | 2018-12-18 15:28:12 -0500 | [diff] [blame] | 29 | /** Auto-specific implementation of {@link NotificationInterruptionStateProvider}. */ |
Govinda Wasserman | 8d49d0d | 2019-08-22 16:51:48 -0400 | [diff] [blame] | 30 | @Singleton |
Gus Prevas | ec9e1f0 | 2018-12-18 15:28:12 -0500 | [diff] [blame] | 31 | public class CarNotificationInterruptionStateProvider extends |
| 32 | NotificationInterruptionStateProvider { |
Govinda Wasserman | 8d49d0d | 2019-08-22 16:51:48 -0400 | [diff] [blame] | 33 | |
| 34 | @Inject |
Mady Mellor | a5813e0 | 2019-08-29 15:46:52 -0700 | [diff] [blame^] | 35 | public CarNotificationInterruptionStateProvider(Context context, |
| 36 | NotificationFilter filter, |
| 37 | StatusBarStateController stateController) { |
| 38 | super(context, filter, stateController); |
Gus Prevas | ec9e1f0 | 2018-12-18 15:28:12 -0500 | [diff] [blame] | 39 | } |
| 40 | |
| 41 | @Override |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 42 | public boolean shouldHeadsUp(NotificationEntry entry) { |
Gus Prevas | ec9e1f0 | 2018-12-18 15:28:12 -0500 | [diff] [blame] | 43 | // Because space is usually constrained in the auto use-case, there should not be a |
| 44 | // pinned notification when the shade has been expanded. Ensure this by not pinning any |
| 45 | // notification if the shade is already opened. |
| 46 | if (!getPresenter().isPresenterFullyCollapsed()) { |
| 47 | return false; |
| 48 | } |
| 49 | |
| 50 | return super.shouldHeadsUp(entry); |
| 51 | } |
| 52 | } |