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

Commit 8e804ef6 authored by Fabian Kozynski's avatar Fabian Kozynski Committed by Android (Google) Code Review
Browse files

Merge "Fix Adjustment for API review"

parents 2419c4cb 1d051c27
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -41565,13 +41565,13 @@ package android.service.media {
package android.service.notification {
  public final class Adjustment implements android.os.Parcelable {
    ctor public Adjustment(String, String, android.os.Bundle, CharSequence, int);
    ctor public Adjustment(String, String, android.os.Bundle, CharSequence, android.os.UserHandle);
    method public int describeContents();
    method public CharSequence getExplanation();
    method public String getKey();
    method public String getPackage();
    method public android.os.Bundle getSignals();
    method public int getUser();
    method public android.os.UserHandle getUserHandle();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.service.notification.Adjustment> CREATOR;
    field public static final String KEY_CONTEXTUAL_ACTIONS = "key_contextual_actions";
+2 −0
Original line number Diff line number Diff line
@@ -6574,7 +6574,9 @@ package android.service.euicc {
package android.service.notification {
  public final class Adjustment implements android.os.Parcelable {
    ctor public Adjustment(String, String, android.os.Bundle, CharSequence, int);
    ctor protected Adjustment(android.os.Parcel);
    method public int getUser();
    field public static final String KEY_PEOPLE = "key_people";
  }
+35 −0
Original line number Diff line number Diff line
@@ -20,9 +20,17 @@ import android.app.Notification;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.UserHandle;

/**
 * Ranking updates from the Assistant.
 *
 * The updates are provides as a {@link Bundle} of signals, using the keys provided in this
 * class.
 * Each {@code KEY} specifies what type of data it supports and what kind of Adjustment it
 * realizes on the notification rankings.
 *
 * Notifications affected by the Adjustment will be re-ranked if necessary.
 */
public final class Adjustment implements Parcelable {
    private final String mPackage;
@@ -103,7 +111,9 @@ public final class Adjustment implements Parcelable {
     * @param signals A bundle of signals that should inform notification display, ordering, and
     *                interruptiveness.
     * @param explanation A human-readable justification for the adjustment.
     * @hide
     */
    @SystemApi
    public Adjustment(String pkg, String key, Bundle signals, CharSequence explanation, int user) {
        mPackage = pkg;
        mKey = key;
@@ -112,6 +122,25 @@ public final class Adjustment implements Parcelable {
        mUser = user;
    }

    /**
     * Create a notification adjustment.
     *
     * @param pkg The package of the notification.
     * @param key The notification key.
     * @param signals A bundle of signals that should inform notification display, ordering, and
     *                interruptiveness.
     * @param explanation A human-readable justification for the adjustment.
     * @param userHandle User handle for for whose the adjustments will be applied.
     */
    public Adjustment(String pkg, String key, Bundle signals, CharSequence explanation,
            UserHandle userHandle) {
        mPackage = pkg;
        mKey = key;
        mSignals = signals;
        mExplanation = explanation;
        mUser = userHandle.getIdentifier();
    }

    /**
     * @hide
     */
@@ -164,10 +193,16 @@ public final class Adjustment implements Parcelable {
        return mSignals;
    }

    /** @hide */
    @SystemApi
    public int getUser() {
        return mUser;
    }

    public UserHandle getUserHandle() {
        return UserHandle.of(mUser);
    }

    @Override
    public int describeContents() {
        return 0;