Merge "add a ranking service to the rocket" into nyc-dev am: a82662e3f5

am: 2be6b136a8

* commit '2be6b136a8d0f5de12a8e1f5a3c17c8b4fe27cf1':
  add a ranking service to the rocket
This commit is contained in:
Chris Wren
2016-03-09 16:52:05 +00:00
committed by android-build-merger
9 changed files with 122 additions and 34 deletions

View File

@@ -61,7 +61,7 @@ interface INotificationManager
StatusBarNotification[] getActiveNotifications(String callingPkg);
StatusBarNotification[] getHistoricalNotifications(String callingPkg, int count);
void registerListener(in INotificationListener listener, in ComponentName component, int userid, boolean asRanker);
void registerListener(in INotificationListener listener, in ComponentName component, int userid);
void unregisterListener(in INotificationListener listener, int userid);
void cancelNotificationFromListener(in INotificationListener token, String pkg, String tag, int id);

View File

@@ -145,7 +145,6 @@ public class NotificationManager
public static final String ACTION_INTERRUPTION_FILTER_CHANGED_INTERNAL
= "android.app.action.INTERRUPTION_FILTER_CHANGED_INTERNAL";
/** @hide */
@IntDef({INTERRUPTION_FILTER_NONE, INTERRUPTION_FILTER_PRIORITY, INTERRUPTION_FILTER_ALARMS,
INTERRUPTION_FILTER_ALL, INTERRUPTION_FILTER_UNKNOWN})

View File

@@ -680,18 +680,12 @@ public abstract class NotificationListenerService extends Service {
@SystemApi
public void registerAsSystemService(Context context, ComponentName componentName,
int currentUser) throws RemoteException {
registerAsSystemServiceImpl(context, componentName, currentUser, false /* asRanker */);
}
/** @hide */
protected void registerAsSystemServiceImpl(Context context, ComponentName componentName,
int currentUser, boolean asRanker) throws RemoteException {
mSystemContext = context;
if (mWrapper == null) {
mWrapper = new NotificationListenerWrapper();
}
mSystemContext = context;
INotificationManager noMan = getNotificationInterface();
noMan.registerListener(mWrapper, componentName, currentUser, asRanker);
noMan.registerListener(mWrapper, componentName, currentUser);
mCurrentUser = currentUser;
mHandler = new MyHandler(context.getMainLooper());
}

View File

@@ -37,7 +37,7 @@ import com.android.internal.os.SomeArgs;
*/
@SystemApi
public abstract class NotificationRankerService extends NotificationListenerService {
private static final String TAG = "NotificationRanker";
private static final String TAG = "NotificationRankers";
/**
* The {@link Intent} that must be declared as handled by the service.
@@ -118,9 +118,8 @@ public abstract class NotificationRankerService extends NotificationListenerServ
/** @hide */
@Override
public void registerAsSystemService(Context context, ComponentName componentName,
int currentUser) throws RemoteException {
registerAsSystemServiceImpl(context, componentName, currentUser, true /* as Ranker */);
mHandler = new MyHandler(getContext().getMainLooper());
int currentUser) {
throw new IllegalStateException("the ranker may not start itself.");
}
@Override