1f953664dc17dca23bd724bd64f89189c16c83263Chris Wren/* 2f953664dc17dca23bd724bd64f89189c16c83263Chris Wren* Copyright (C) 2014 The Android Open Source Project 3f953664dc17dca23bd724bd64f89189c16c83263Chris Wren* 4f953664dc17dca23bd724bd64f89189c16c83263Chris Wren* Licensed under the Apache License, Version 2.0 (the "License"); 5f953664dc17dca23bd724bd64f89189c16c83263Chris Wren* you may not use this file except in compliance with the License. 6f953664dc17dca23bd724bd64f89189c16c83263Chris Wren* You may obtain a copy of the License at 7f953664dc17dca23bd724bd64f89189c16c83263Chris Wren* 8f953664dc17dca23bd724bd64f89189c16c83263Chris Wren* http://www.apache.org/licenses/LICENSE-2.0 9f953664dc17dca23bd724bd64f89189c16c83263Chris Wren* 10f953664dc17dca23bd724bd64f89189c16c83263Chris Wren* Unless required by applicable law or agreed to in writing, software 11f953664dc17dca23bd724bd64f89189c16c83263Chris Wren* distributed under the License is distributed on an "AS IS" BASIS, 12f953664dc17dca23bd724bd64f89189c16c83263Chris Wren* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13f953664dc17dca23bd724bd64f89189c16c83263Chris Wren* See the License for the specific language governing permissions and 14f953664dc17dca23bd724bd64f89189c16c83263Chris Wren* limitations under the License. 15f953664dc17dca23bd724bd64f89189c16c83263Chris Wren*/ 16f953664dc17dca23bd724bd64f89189c16c83263Chris Wren 17f953664dc17dca23bd724bd64f89189c16c83263Chris Wrenpackage com.android.server.notification; 18f953664dc17dca23bd724bd64f89189c16c83263Chris Wren 19f953664dc17dca23bd724bd64f89189c16c83263Chris Wrenimport android.content.Context; 20f953664dc17dca23bd724bd64f89189c16c83263Chris Wren 21f953664dc17dca23bd724bd64f89189c16c83263Chris Wren/** 22f953664dc17dca23bd724bd64f89189c16c83263Chris Wren * Extracts signals that will be useful to the {@link NotificationComparator} and caches them 23333a61c3a5a83fe9c50ebeb5c947317f61385b7bChris Wren * on the {@link NotificationRecord} object. These annotations will 24f953664dc17dca23bd724bd64f89189c16c83263Chris Wren * not be passed on to {@link android.service.notification.NotificationListenerService}s. 25f953664dc17dca23bd724bd64f89189c16c83263Chris Wren */ 26f953664dc17dca23bd724bd64f89189c16c83263Chris Wrenpublic interface NotificationSignalExtractor { 27f953664dc17dca23bd724bd64f89189c16c83263Chris Wren 28f953664dc17dca23bd724bd64f89189c16c83263Chris Wren /** One-time initialization. */ 295eab2b72afe5b20dc66c237b1cceedfc09de2d52Chris Wren public void initialize(Context context, NotificationUsageStats usageStats); 30f953664dc17dca23bd724bd64f89189c16c83263Chris Wren 31f953664dc17dca23bd724bd64f89189c16c83263Chris Wren /** 32f953664dc17dca23bd724bd64f89189c16c83263Chris Wren * Called once per notification that is posted or updated. 33f953664dc17dca23bd724bd64f89189c16c83263Chris Wren * 34f953664dc17dca23bd724bd64f89189c16c83263Chris Wren * @return null if the work is done, or a future if there is more to do. The 35470c1accf5a54f9844a779eafab74e63c09342b5Chris Wren * {@link RankingReconsideration} will be run on a worker thread, and if notifications 36470c1accf5a54f9844a779eafab74e63c09342b5Chris Wren * are re-ordered by that execution, the {@link NotificationManagerService} may send order 37470c1accf5a54f9844a779eafab74e63c09342b5Chris Wren * update events to the {@link android.service.notification.NotificationListenerService}s. 38f953664dc17dca23bd724bd64f89189c16c83263Chris Wren */ 39470c1accf5a54f9844a779eafab74e63c09342b5Chris Wren public RankingReconsideration process(NotificationRecord notification); 40f953664dc17dca23bd724bd64f89189c16c83263Chris Wren 4154bbef435ed857fc68941672799fc8001c101119Chris Wren /** 4254bbef435ed857fc68941672799fc8001c101119Chris Wren * Called whenever the {@link RankingConfig} changes. 4354bbef435ed857fc68941672799fc8001c101119Chris Wren * 4454bbef435ed857fc68941672799fc8001c101119Chris Wren * @param config information about which signals are important. 4554bbef435ed857fc68941672799fc8001c101119Chris Wren */ 4654bbef435ed857fc68941672799fc8001c101119Chris Wren void setConfig(RankingConfig config); 47f953664dc17dca23bd724bd64f89189c16c83263Chris Wren} 48