blob: afd722ba00914701960eb80691593c24f3a86252 [file] [log] [blame]
Gus Prevasec9e1f02018-12-18 15:28:12 -05001/*
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
17package com.android.systemui.car;
18
19import android.content.Context;
20
Mady Mellora5813e02019-08-29 15:46:52 -070021import com.android.systemui.plugins.statusbar.StatusBarStateController;
22import com.android.systemui.statusbar.notification.NotificationFilter;
Gus Prevasec9e1f02018-12-18 15:28:12 -050023import com.android.systemui.statusbar.notification.NotificationInterruptionStateProvider;
Ned Burnsf81c4c42019-01-07 14:10:43 -050024import com.android.systemui.statusbar.notification.collection.NotificationEntry;
Gus Prevasec9e1f02018-12-18 15:28:12 -050025
Govinda Wasserman8d49d0d2019-08-22 16:51:48 -040026import javax.inject.Inject;
27import javax.inject.Singleton;
28
Gus Prevasec9e1f02018-12-18 15:28:12 -050029/** Auto-specific implementation of {@link NotificationInterruptionStateProvider}. */
Govinda Wasserman8d49d0d2019-08-22 16:51:48 -040030@Singleton
Gus Prevasec9e1f02018-12-18 15:28:12 -050031public class CarNotificationInterruptionStateProvider extends
32 NotificationInterruptionStateProvider {
Govinda Wasserman8d49d0d2019-08-22 16:51:48 -040033
34 @Inject
Mady Mellora5813e02019-08-29 15:46:52 -070035 public CarNotificationInterruptionStateProvider(Context context,
36 NotificationFilter filter,
37 StatusBarStateController stateController) {
38 super(context, filter, stateController);
Gus Prevasec9e1f02018-12-18 15:28:12 -050039 }
40
41 @Override
Ned Burnsf81c4c42019-01-07 14:10:43 -050042 public boolean shouldHeadsUp(NotificationEntry entry) {
Gus Prevasec9e1f02018-12-18 15:28:12 -050043 // 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}