Chris Wren | f953664 | 2014-04-17 10:01:54 -0400 | [diff] [blame] | 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 | |
| 21 | /** |
| 22 | * Extracts signals that will be useful to the {@link NotificationComparator} and caches them |
Chris Wren | 333a61c | 2014-05-28 16:40:57 -0400 | [diff] [blame] | 23 | * on the {@link NotificationRecord} object. These annotations will |
Chris Wren | f953664 | 2014-04-17 10:01:54 -0400 | [diff] [blame] | 24 | * not be passed on to {@link android.service.notification.NotificationListenerService}s. |
Julia Reynolds | c861a3d | 2018-02-15 10:34:49 -0500 | [diff] [blame] | 25 | * |
| 26 | * If you add a new Extractor be sure to add it to R.array.config_notificationSignalExtractors. |
Chris Wren | f953664 | 2014-04-17 10:01:54 -0400 | [diff] [blame] | 27 | */ |
| 28 | public interface NotificationSignalExtractor { |
| 29 | |
| 30 | /** One-time initialization. */ |
Chris Wren | 5eab2b7 | 2015-06-16 13:56:22 -0400 | [diff] [blame] | 31 | public void initialize(Context context, NotificationUsageStats usageStats); |
Chris Wren | f953664 | 2014-04-17 10:01:54 -0400 | [diff] [blame] | 32 | |
| 33 | /** |
| 34 | * Called once per notification that is posted or updated. |
| 35 | * |
| 36 | * @return null if the work is done, or a future if there is more to do. The |
Chris Wren | 470c1ac | 2014-05-21 15:28:10 -0400 | [diff] [blame] | 37 | * {@link RankingReconsideration} will be run on a worker thread, and if notifications |
| 38 | * are re-ordered by that execution, the {@link NotificationManagerService} may send order |
| 39 | * update events to the {@link android.service.notification.NotificationListenerService}s. |
Chris Wren | f953664 | 2014-04-17 10:01:54 -0400 | [diff] [blame] | 40 | */ |
Chris Wren | 470c1ac | 2014-05-21 15:28:10 -0400 | [diff] [blame] | 41 | public RankingReconsideration process(NotificationRecord notification); |
Chris Wren | f953664 | 2014-04-17 10:01:54 -0400 | [diff] [blame] | 42 | |
Chris Wren | 54bbef4 | 2014-07-09 18:37:56 -0400 | [diff] [blame] | 43 | /** |
| 44 | * Called whenever the {@link RankingConfig} changes. |
| 45 | * |
| 46 | * @param config information about which signals are important. |
| 47 | */ |
| 48 | void setConfig(RankingConfig config); |
Julia Reynolds | c861a3d | 2018-02-15 10:34:49 -0500 | [diff] [blame] | 49 | |
| 50 | /** |
| 51 | * @param helper Helper to determine what components of notifications should be blocked due to |
| 52 | * DND. |
| 53 | */ |
| 54 | void setZenHelper(ZenModeHelper helper); |
Chris Wren | f953664 | 2014-04-17 10:01:54 -0400 | [diff] [blame] | 55 | } |