Fix API errors

APIs that were @SystemApi in the last release cannot be changed.

Test: atest CtsSystemApiSignatureTestCases
Bug: 124209375
Change-Id: I631b7dea09e723f509581f82a85da99344b42a09
This commit is contained in:
Julia Reynolds
2019-02-15 11:38:48 -05:00
parent fc6e5674b7
commit 79f0277f29
6 changed files with 39 additions and 11 deletions

View File

@@ -41546,6 +41546,7 @@ package android.service.notification {
field public static final android.os.Parcelable.Creator<android.service.notification.Adjustment> CREATOR;
field public static final String KEY_CONTEXTUAL_ACTIONS = "key_contextual_actions";
field public static final String KEY_IMPORTANCE = "key_importance";
field public static final String KEY_SNOOZE_CRITERIA = "key_snooze_criteria";
field public static final String KEY_TEXT_REPLIES = "key_text_replies";
field public static final String KEY_USER_SENTIMENT = "key_user_sentiment";
}
@@ -41603,12 +41604,14 @@ package android.service.notification {
method public void onActionInvoked(@NonNull String, @NonNull android.app.Notification.Action, int);
method public final android.os.IBinder onBind(android.content.Intent);
method public void onNotificationDirectReplied(@NonNull String);
method public android.service.notification.Adjustment onNotificationEnqueued(android.service.notification.StatusBarNotification);
method public abstract android.service.notification.Adjustment onNotificationEnqueued(android.service.notification.StatusBarNotification);
method public android.service.notification.Adjustment onNotificationEnqueued(android.service.notification.StatusBarNotification, android.app.NotificationChannel);
method public void onNotificationExpansionChanged(@NonNull String, boolean, boolean);
method public void onNotificationRemoved(android.service.notification.StatusBarNotification, android.service.notification.NotificationListenerService.RankingMap, android.service.notification.NotificationStats, int);
method public abstract void onNotificationSnoozedUntilContext(android.service.notification.StatusBarNotification, String);
method public void onNotificationsSeen(java.util.List<java.lang.String>);
method public void onSuggestedReplySent(@NonNull String, @NonNull CharSequence, int);
method public final void unsnoozeNotification(String);
field public static final String SERVICE_INTERFACE = "android.service.notification.NotificationAssistantService";
field public static final int SOURCE_FROM_APP = 0; // 0x0
field public static final int SOURCE_FROM_ASSISTANT = 1; // 0x1

View File

@@ -6500,6 +6500,15 @@ package android.service.euicc {
package android.service.notification {
public final class Adjustment implements android.os.Parcelable {
ctor protected Adjustment(android.os.Parcel);
field public static final String KEY_PEOPLE = "key_people";
}
public final class NotificationStats implements android.os.Parcelable {
ctor protected NotificationStats(android.os.Parcel);
}
public final class SnoozeCriterion implements android.os.Parcelable {
ctor public SnoozeCriterion(String, CharSequence, CharSequence);
ctor protected SnoozeCriterion(android.os.Parcel);

View File

@@ -15,6 +15,7 @@
*/
package android.service.notification;
import android.annotation.SystemApi;
import android.app.Notification;
import android.os.Bundle;
import android.os.Parcel;
@@ -36,13 +37,13 @@ public final class Adjustment implements Parcelable {
* See {@link android.app.Notification.Builder#addPerson(String)}.
* @hide
*/
@SystemApi
public static final String KEY_PEOPLE = "key_people";
/**
* Parcelable {@code ArrayList} of {@link SnoozeCriterion}. These criteria may be visible to
* users. If a user chooses to snooze a notification until one of these criterion, the
* assistant will be notified via
* {@link NotificationAssistantService#onNotificationSnoozedUntilContext}.
* @hide
*/
public static final String KEY_SNOOZE_CRITERIA = "key_snooze_criteria";
/**
@@ -111,7 +112,11 @@ public final class Adjustment implements Parcelable {
mUser = user;
}
private Adjustment(Parcel in) {
/**
* @hide
*/
@SystemApi
protected Adjustment(Parcel in) {
if (in.readInt() == 1) {
mPackage = in.readString();
} else {

View File

@@ -21,6 +21,7 @@ import static java.lang.annotation.RetentionPolicy.SOURCE;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.SdkConstant;
import android.annotation.SystemApi;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.admin.DevicePolicyManager;
@@ -103,7 +104,6 @@ public abstract class NotificationAssistantService extends NotificationListenerS
*
* @param sbn the notification to snooze
* @param snoozeCriterionId the {@link SnoozeCriterion#getId()} representing a device context.
* @hide
*/
abstract public void onNotificationSnoozedUntilContext(StatusBarNotification sbn,
String snoozeCriterionId);
@@ -111,12 +111,13 @@ public abstract class NotificationAssistantService extends NotificationListenerS
/**
* A notification was posted by an app. Called before post.
*
* <p>Note: this method is only called if you don't override
* {@link #onNotificationEnqueued(StatusBarNotification, NotificationChannel)}.</p>
*
* @param sbn the new notification
* @return an adjustment or null to take no action, within 100ms.
*/
public Adjustment onNotificationEnqueued(StatusBarNotification sbn) {
return null;
}
abstract public Adjustment onNotificationEnqueued(StatusBarNotification sbn);
/**
* A notification was posted by an app. Called before post.
@@ -240,12 +241,11 @@ public abstract class NotificationAssistantService extends NotificationListenerS
/**
* Inform the notification manager about un-snoozing a specific notification.
* <p>
* This should only be used for notifications snoozed by this listener using
* {@link #snoozeNotification(String, String)}. Once un-snoozed, you will get a
* This should only be used for notifications snoozed because of a contextual snooze suggestion
* you provided via {@link Adjustment#KEY_SNOOZE_CRITERIA}. Once un-snoozed, you will get a
* {@link #onNotificationPosted(StatusBarNotification, RankingMap)} callback for the
* notification.
* @param key The key of the notification to snooze
* @hide
*/
public final void unsnoozeNotification(String key) {
if (!isBound()) return;

View File

@@ -16,6 +16,7 @@
package android.service.notification;
import android.annotation.IntDef;
import android.annotation.SystemApi;
import android.app.RemoteInput;
import android.os.Parcel;
import android.os.Parcelable;
@@ -98,7 +99,11 @@ public final class NotificationStats implements Parcelable {
public NotificationStats() {
}
private NotificationStats(Parcel in) {
/**
* @hide
*/
@SystemApi
protected NotificationStats(Parcel in) {
mSeen = in.readByte() != 0;
mExpanded = in.readByte() != 0;
mDirectReplied = in.readByte() != 0;

View File

@@ -220,6 +220,12 @@ public class Assistant extends NotificationAssistantService {
out.endDocument();
}
@Override
public Adjustment onNotificationEnqueued(StatusBarNotification sbn) {
// we use the version with channel, so this is never called.
return null;
}
@Override
public Adjustment onNotificationEnqueued(StatusBarNotification sbn,
NotificationChannel channel) {