1 /* 2 * Copyright (C) 2014 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.server.notification; 18 19 import android.content.Context; 20 import com.android.internal.compat.IPlatformCompat; 21 22 /** 23 * Extracts signals that will be useful to the {@link NotificationComparator} and caches them 24 * on the {@link NotificationRecord} object. These annotations will 25 * not be passed on to {@link android.service.notification.NotificationListenerService}s. 26 * 27 * If you add a new Extractor be sure to add it to R.array.config_notificationSignalExtractors. 28 */ 29 public interface NotificationSignalExtractor { 30 31 /** One-time initialization. */ initialize(Context context, NotificationUsageStats usageStats)32 public void initialize(Context context, NotificationUsageStats usageStats); 33 34 /** 35 * Called once per notification that is posted or updated. 36 * 37 * @return null if the work is done, or a future if there is more to do. The 38 * {@link RankingReconsideration} will be run on a worker thread, and if notifications 39 * are re-ordered by that execution, the {@link NotificationManagerService} may send order 40 * update events to the {@link android.service.notification.NotificationListenerService}s. 41 */ process(NotificationRecord notification)42 public RankingReconsideration process(NotificationRecord notification); 43 44 /** 45 * Called whenever the {@link RankingConfig} changes. 46 * 47 * @param config information about which signals are important. 48 */ setConfig(RankingConfig config)49 void setConfig(RankingConfig config); 50 51 /** 52 * @param helper Helper to determine what components of notifications should be blocked due to 53 * DND. 54 */ setZenHelper(ZenModeHelper helper)55 void setZenHelper(ZenModeHelper helper); 56 setCompatChangeLogger(IPlatformCompat platformCompat)57 default void setCompatChangeLogger(IPlatformCompat platformCompat){}; 58 } 59