/* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.car.notification; import static android.view.ViewTreeObserver.InternalInsetsInfo; import static android.view.ViewTreeObserver.OnComputeInternalInsetsListener; import static android.view.ViewTreeObserver.OnGlobalFocusChangeListener; import static android.view.ViewTreeObserver.OnGlobalLayoutListener; import static com.android.car.assist.client.CarAssistUtils.isCarCompatibleMessagingNotification; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.app.ActivityTaskManager; import android.app.KeyguardManager; import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationManager; import android.car.drivingstate.CarUxRestrictions; import android.car.drivingstate.CarUxRestrictionsManager; import android.content.Context; import android.os.Build; import android.service.notification.NotificationListenerService; import android.util.Log; import android.util.Pair; import android.view.LayoutInflater; import android.view.View; import android.view.ViewTreeObserver; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.UiThread; import androidx.annotation.VisibleForTesting; import com.android.car.notification.headsup.CarHeadsUpNotificationContainer; import com.android.car.notification.headsup.animationhelper.HeadsUpNotificationAnimationHelper; import com.android.car.notification.template.MessageNotificationViewHolder; import java.time.Clock; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ScheduledThreadPoolExecutor; /** * Notification Manager for heads-up notifications in car. */ public class CarHeadsUpNotificationManager implements CarUxRestrictionsManager.OnUxRestrictionsChangedListener { /** * Callback that will be issued after a Heads up notification state is changed. */ public interface OnHeadsUpNotificationStateChange { /** * Will be called if a new notification added/updated changes the heads up state for that * notification. */ void onStateChange(AlertEntry alertEntry, HeadsUpState headsUpState); } /** * Captures HUN State with following values: *