From 7c4dd3a5efb70d868c6f327e127fd7c450b4fd08 Mon Sep 17 00:00:00 2001 From: Hall Liu Date: Tue, 14 Jan 2020 14:56:59 -0800 Subject: [PATCH] Expose NotificationChannel#setBlockableSystem as SystemApi Expose setBlockableSystem as a module-apps-only SystemApi. Bug: 138401571 Test: atest android.app.cts.NotificationChannelTest Change-Id: I0b6a14360e9278a092476ada6533e63a46d4e4fe --- api/module-app-current.txt | 8 ++++++++ core/java/android/app/NotificationChannel.java | 8 +++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/api/module-app-current.txt b/api/module-app-current.txt index d802177e249b3..4307e675e4312 100644 --- a/api/module-app-current.txt +++ b/api/module-app-current.txt @@ -1 +1,9 @@ // Signature format: 2.0 +package android.app { + + public final class NotificationChannel implements android.os.Parcelable { + method public void setBlockableSystem(boolean); + } + +} + diff --git a/core/java/android/app/NotificationChannel.java b/core/java/android/app/NotificationChannel.java index bdc7b992421a8..6a434659f279e 100644 --- a/core/java/android/app/NotificationChannel.java +++ b/core/java/android/app/NotificationChannel.java @@ -15,6 +15,8 @@ */ package android.app; +import static android.annotation.SystemApi.Client.MODULE_APPS; + import android.annotation.Nullable; import android.annotation.SystemApi; import android.annotation.TestApi; @@ -350,9 +352,13 @@ public final class NotificationChannel implements Parcelable { } /** + * Allows users to block notifications sent through this channel, if this channel belongs to + * a package that is signed with the system signature. If the channel does not belong to a + * package that is signed with the system signature, this method does nothing. + * @param blockableSystem if {@code true}, allows users to block notifications on this channel. * @hide */ - @UnsupportedAppUsage + @SystemApi(client = MODULE_APPS) @TestApi public void setBlockableSystem(boolean blockableSystem) { mBlockableSystem = blockableSystem;