NotificationSignalExtractor.java revision 470c1accf5a54f9844a779eafab74e63c09342b5
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
17package com.android.server.notification;
18
19import android.content.Context;
20
21import com.android.server.notification.NotificationManagerService.NotificationRecord;
22
23/**
24 * Extracts signals that will be useful to the {@link NotificationComparator} and caches them
25 *  on the {@link NotificationManagerService.NotificationRecord} object. These annotations will
26 *  not be passed on to {@link android.service.notification.NotificationListenerService}s.
27 */
28public interface NotificationSignalExtractor {
29
30    /** One-time initialization. */
31    public void initialize(Context context);
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
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.
40     */
41    public RankingReconsideration process(NotificationRecord notification);
42
43}
44