1 /* 2 * Copyright (C) 2017 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 package com.android.systemui.car; 17 18 import android.content.Context; 19 import android.service.notification.StatusBarNotification; 20 21 import com.android.systemui.statusbar.ExpandableNotificationRow; 22 import com.android.systemui.statusbar.NotificationData; 23 import com.android.systemui.statusbar.NotificationEntryManager; 24 25 public class CarNotificationEntryManager extends NotificationEntryManager { CarNotificationEntryManager(Context context)26 public CarNotificationEntryManager(Context context) { 27 super(context); 28 } 29 30 /** 31 * Returns the 32 * {@link com.android.systemui.statusbar.ExpandableNotificationRow.LongPressListener} that will 33 * be triggered when a notification card is long-pressed. 34 */ 35 @Override getNotificationLongClicker()36 public ExpandableNotificationRow.LongPressListener getNotificationLongClicker() { 37 // For the automative use case, we do not want to the user to be able to interact with 38 // a notification other than a regular click. As a result, just return null for the 39 // long click listener. 40 return null; 41 } 42 43 @Override shouldPeek(NotificationData.Entry entry, StatusBarNotification sbn)44 public boolean shouldPeek(NotificationData.Entry entry, StatusBarNotification sbn) { 45 // Because space is usually constrained in the auto use-case, there should not be a 46 // pinned notification when the shade has been expanded. Ensure this by not pinning any 47 // notification if the shade is already opened. 48 if (!mPresenter.isPresenterFullyCollapsed()) { 49 return false; 50 } 51 52 return super.shouldPeek(entry, sbn); 53 } 54 } 55