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

Commit cbc45e71 authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Address api council feedback

Fixes: 127282522
Fixes: 126702741
Fixes: 126699773
Test: make, cts
Change-Id: I06e78d4c7067835017c5326f1d53923776d3fc42
parent b14ac6e9
Loading
Loading
Loading
Loading
+4 −5
Original line number Original line Diff line number Diff line
@@ -4453,7 +4453,7 @@ package android.app {
    ctor public AutomaticZenRule(android.os.Parcel);
    ctor public AutomaticZenRule(android.os.Parcel);
    method public int describeContents();
    method public int describeContents();
    method public android.net.Uri getConditionId();
    method public android.net.Uri getConditionId();
    method public android.content.ComponentName getConfigurationActivity();
    method @Nullable public android.content.ComponentName getConfigurationActivity();
    method public long getCreationTime();
    method public long getCreationTime();
    method public int getInterruptionFilter();
    method public int getInterruptionFilter();
    method public String getName();
    method public String getName();
@@ -4461,7 +4461,7 @@ package android.app {
    method public android.service.notification.ZenPolicy getZenPolicy();
    method public android.service.notification.ZenPolicy getZenPolicy();
    method public boolean isEnabled();
    method public boolean isEnabled();
    method public void setConditionId(android.net.Uri);
    method public void setConditionId(android.net.Uri);
    method public void setConfigurationActivity(android.content.ComponentName);
    method public void setConfigurationActivity(@Nullable android.content.ComponentName);
    method public void setEnabled(boolean);
    method public void setEnabled(boolean);
    method public void setInterruptionFilter(int);
    method public void setInterruptionFilter(int);
    method public void setName(String);
    method public void setName(String);
@@ -5818,10 +5818,9 @@ package android.app {
    method public void notify(String, int, android.app.Notification);
    method public void notify(String, int, android.app.Notification);
    method public void notifyAsPackage(@NonNull String, @NonNull String, int, @NonNull android.app.Notification);
    method public void notifyAsPackage(@NonNull String, @NonNull String, int, @NonNull android.app.Notification);
    method public boolean removeAutomaticZenRule(String);
    method public boolean removeAutomaticZenRule(String);
    method public void revokeNotificationDelegate();
    method public void setAutomaticZenRuleState(@NonNull String, @NonNull android.service.notification.Condition);
    method public void setAutomaticZenRuleState(@NonNull String, @NonNull android.service.notification.Condition);
    method public final void setInterruptionFilter(int);
    method public final void setInterruptionFilter(int);
    method public void setNotificationDelegate(@NonNull String);
    method public void setNotificationDelegate(@Nullable String);
    method public void setNotificationPolicy(@NonNull android.app.NotificationManager.Policy);
    method public void setNotificationPolicy(@NonNull android.app.NotificationManager.Policy);
    method public boolean shouldHideSilentStatusBarIcons();
    method public boolean shouldHideSilentStatusBarIcons();
    method public boolean updateAutomaticZenRule(String, android.app.AutomaticZenRule);
    method public boolean updateAutomaticZenRule(String, android.app.AutomaticZenRule);
@@ -41758,7 +41757,7 @@ package android.service.notification {
    method public int getId();
    method public int getId();
    method public String getKey();
    method public String getKey();
    method public android.app.Notification getNotification();
    method public android.app.Notification getNotification();
    method public String getOpPkg();
    method @NonNull public String getOpPkg();
    method public String getOverrideGroupKey();
    method public String getOverrideGroupKey();
    method public String getPackageName();
    method public String getPackageName();
    method public long getPostTime();
    method public long getPostTime();
+4 −3
Original line number Original line Diff line number Diff line
@@ -136,7 +136,7 @@ public final class AutomaticZenRule implements Parcelable {
     * Returns the {@link ComponentName} of the activity that shows configuration options
     * Returns the {@link ComponentName} of the activity that shows configuration options
     * for this rule.
     * for this rule.
     */
     */
    public ComponentName getConfigurationActivity() {
    public @Nullable ComponentName getConfigurationActivity() {
        return configurationActivity;
        return configurationActivity;
    }
    }


@@ -237,9 +237,10 @@ public final class AutomaticZenRule implements Parcelable {
    /**
    /**
     * Sets the configuration activity - an activity that handles
     * Sets the configuration activity - an activity that handles
     * {@link NotificationManager#ACTION_AUTOMATIC_ZEN_RULE} that shows the user more information
     * {@link NotificationManager#ACTION_AUTOMATIC_ZEN_RULE} that shows the user more information
     * about this rule and/or allows them to configure it.
     * about this rule and/or allows them to configure it. This is required to be non-null for rules
     * that are not backed by {@link android.service.notification.ConditionProviderService}.
     */
     */
    public void setConfigurationActivity(ComponentName componentName) {
    public void setConfigurationActivity(@Nullable ComponentName componentName) {
        this.configurationActivity = componentName;
        this.configurationActivity = componentName;
    }
    }


+0 −1
Original line number Original line Diff line number Diff line
@@ -192,7 +192,6 @@ interface INotificationManager
    ParceledListSlice getAppActiveNotifications(String callingPkg, int userId);
    ParceledListSlice getAppActiveNotifications(String callingPkg, int userId);


    void setNotificationDelegate(String callingPkg, String delegate);
    void setNotificationDelegate(String callingPkg, String delegate);
    void revokeNotificationDelegate(String callingPkg);
    String getNotificationDelegate(String callingPkg);
    String getNotificationDelegate(String callingPkg);
    boolean canNotifyAsPackage(String callingPkg, String targetPkg);
    boolean canNotifyAsPackage(String callingPkg, String targetPkg);


+2 −16
Original line number Original line Diff line number Diff line
@@ -589,11 +589,11 @@ public class NotificationManager {
     * received on your behalf from the cloud, without your process having to wake up.
     * received on your behalf from the cloud, without your process having to wake up.
     *
     *
     * You can check if you have an allowed delegate with {@link #getNotificationDelegate()} and
     * You can check if you have an allowed delegate with {@link #getNotificationDelegate()} and
     * revoke your delegate with {@link #revokeNotificationDelegate()}.
     * revoke your delegate by passing null to this method.
     *
     *
     * @param delegate Package name of the app which can send notifications on your behalf.
     * @param delegate Package name of the app which can send notifications on your behalf.
     */
     */
    public void setNotificationDelegate(@NonNull String delegate) {
    public void setNotificationDelegate(@Nullable String delegate) {
        INotificationManager service = getService();
        INotificationManager service = getService();
        String pkg = mContext.getPackageName();
        String pkg = mContext.getPackageName();
        if (localLOGV) Log.v(TAG, pkg + ": cancelAll()");
        if (localLOGV) Log.v(TAG, pkg + ": cancelAll()");
@@ -604,20 +604,6 @@ public class NotificationManager {
        }
        }
    }
    }


    /**
     * Revokes permission for your {@link #setNotificationDelegate(String) notification delegate}
     * to post notifications on your behalf.
     */
    public void revokeNotificationDelegate() {
        INotificationManager service = getService();
        String pkg = mContext.getPackageName();
        try {
            service.revokeNotificationDelegate(pkg);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
    /**
     * Returns the {@link #setNotificationDelegate(String) delegate} that can post notifications on
     * Returns the {@link #setNotificationDelegate(String) delegate} that can post notifications on
     * your behalf, if there currently is one.
     * your behalf, if there currently is one.
+2 −1
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


package android.service.notification;
package android.service.notification;


import android.annotation.NonNull;
import android.annotation.UnsupportedAppUsage;
import android.annotation.UnsupportedAppUsage;
import android.app.Notification;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.NotificationManager;
@@ -299,7 +300,7 @@ public class StatusBarNotification implements Parcelable {
     * Might be different from {@link #getPackageName()} if the app owning the notification has
     * Might be different from {@link #getPackageName()} if the app owning the notification has
     * a {@link NotificationManager#setNotificationDelegate(String) notification delegate}.
     * a {@link NotificationManager#setNotificationDelegate(String) notification delegate}.
     */
     */
    public String getOpPkg() {
    public @NonNull String getOpPkg() {
        return opPkg;
        return opPkg;
    }
    }


Loading