1 /* 2 * Copyright (C) 2020 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.notification.row; 18 19 import android.widget.RemoteViews; 20 21 import androidx.annotation.Nullable; 22 23 import com.android.systemui.statusbar.notification.collection.NotificationEntry; 24 import com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.InflationFlag; 25 26 /** 27 * Caches {@link RemoteViews} for a notification's content views. 28 */ 29 public interface NotifRemoteViewCache { 30 31 /** 32 * Whether the notification has the remote view cached 33 * 34 * @param entry notification 35 * @param flag inflation flag for content view 36 * @return true if the remote view is cached 37 */ hasCachedView(NotificationEntry entry, @InflationFlag int flag)38 boolean hasCachedView(NotificationEntry entry, @InflationFlag int flag); 39 40 /** 41 * Get the remote view for the content flag specified. 42 * 43 * @param entry notification 44 * @param flag inflation flag for the content view 45 * @return the remote view if it is cached, null otherwise 46 */ getCachedView(NotificationEntry entry, @InflationFlag int flag)47 @Nullable RemoteViews getCachedView(NotificationEntry entry, @InflationFlag int flag); 48 49 /** 50 * Cache a remote view for a given content flag on a notification. 51 * 52 * @param entry notification 53 * @param flag inflation flag for the content view 54 * @param remoteView remote view to store 55 */ putCachedView( NotificationEntry entry, @InflationFlag int flag, RemoteViews remoteView)56 void putCachedView( 57 NotificationEntry entry, 58 @InflationFlag int flag, 59 RemoteViews remoteView); 60 61 /** 62 * Remove a cached remote view for a given content flag on a notification. 63 * 64 * @param entry notification 65 * @param flag inflation flag for the content view 66 */ removeCachedView(NotificationEntry entry, @InflationFlag int flag)67 void removeCachedView(NotificationEntry entry, @InflationFlag int flag); 68 69 /** 70 * Clear a notification's remote view cache. 71 * 72 * @param entry notification 73 */ clearCache(NotificationEntry entry)74 void clearCache(NotificationEntry entry); 75 } 76