diff options
author | 2020-01-14 14:56:59 -0800 | |
---|---|---|
committer | 2020-01-16 17:43:10 -0800 | |
commit | b12609a432b4b893e47654aca7637e930260c197 (patch) | |
tree | a7edd3043866051972bba379da67341fd2054da7 | |
parent | a32fcb74e5720bc3ebf7e1f3980f0bd75845b79c (diff) |
Expose NotificationChannel#setBlockableSystem as SystemApi
Expose setBlockableSystem as a module-apps-only SystemApi.
Bug: 138401571
Test: atest android.app.cts.NotificationChannelTest
Change-Id: I0b6a14360e9278a092476ada6533e63a46d4e4fe
Merged-In: I0b6a14360e9278a092476ada6533e63a46d4e4fe
-rw-r--r-- | api/module-app-current.txt | 8 | ||||
-rw-r--r-- | api/test-current.txt | 2 | ||||
-rw-r--r-- | core/java/android/app/NotificationChannel.java | 10 |
3 files changed, 19 insertions, 1 deletions
diff --git a/api/module-app-current.txt b/api/module-app-current.txt index d802177e249b..4307e675e431 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/api/test-current.txt b/api/test-current.txt index a20b75c3355b..416aac5e8159 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -320,8 +320,10 @@ package android.app { } public final class NotificationChannel implements android.os.Parcelable { + method public boolean isBlockableSystem(); method public boolean isImportanceLockedByCriticalDeviceFunction(); method public boolean isImportanceLockedByOEM(); + method public void setBlockableSystem(boolean); method public void setImportanceLockedByCriticalDeviceFunction(boolean); method public void setImportanceLockedByOEM(boolean); } diff --git a/core/java/android/app/NotificationChannel.java b/core/java/android/app/NotificationChannel.java index b1d791b58a79..8ad2b36ae0da 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; @@ -317,9 +319,14 @@ 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; } @@ -639,6 +646,7 @@ public final class NotificationChannel implements Parcelable { /** * @hide */ + @TestApi public boolean isBlockableSystem() { return mBlockableSystem; } |