Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a82662e3 authored by Chris Wren's avatar Chris Wren Committed by Android (Google) Code Review
Browse files

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

parents c2970366 0efdb88c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);
+0 −1
Original line number Diff line number Diff line
@@ -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})
+2 −8
Original line number Diff line number Diff line
@@ -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());
    }
+3 −4
Original line number Diff line number Diff line
@@ -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
+10 −1
Original line number Diff line number Diff line
@@ -15,18 +15,27 @@
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    package="android.ext.services"
    android:versionCode="1"
    android:versionName="1"
    coreApp="true">

    <application android:label="@string/app_name"
        android:allowBackup="false"
        android:forceDeviceEncrypted="true"
        android:encryptionAware="true">

        <library android:name="android.ext.services"/>

        <service android:name=".notification.Ranker"
                android:label="@string/notification_ranker"
                android:permission="android.permission.BIND_NOTIFICATION_RANKER_SERVICE"
                android:exported="true">
            <intent-filter>
                <action android:name="android.service.notification.NotificationRankerService" />
            </intent-filter>
        </service>

    </application>

</manifest>
Loading