Unhide Activity Launch for TileService API
Test: ag/20708784
Bug: 241766793
Change-Id: I7202f58f3473555ff61801de25928a055ca5e049
diff --git a/core/api/current.txt b/core/api/current.txt
index 5bb6652..a54f567 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -40195,12 +40195,14 @@
public final class Tile implements android.os.Parcelable {
method public int describeContents();
+ method @Nullable public android.app.PendingIntent getActivityLaunchForClick();
method public CharSequence getContentDescription();
method public android.graphics.drawable.Icon getIcon();
method public CharSequence getLabel();
method public int getState();
method @Nullable public CharSequence getStateDescription();
method @Nullable public CharSequence getSubtitle();
+ method public void setActivityLaunchForClick(@Nullable android.app.PendingIntent);
method public void setContentDescription(CharSequence);
method public void setIcon(android.graphics.drawable.Icon);
method public void setLabel(CharSequence);
@@ -40229,6 +40231,7 @@
method public static final void requestListeningState(android.content.Context, android.content.ComponentName);
method public final void showDialog(android.app.Dialog);
method public final void startActivityAndCollapse(android.content.Intent);
+ method public final void startActivityAndCollapse(@NonNull android.app.PendingIntent);
method public final void unlockAndRun(Runnable);
field public static final String ACTION_QS_TILE = "android.service.quicksettings.action.QS_TILE";
field public static final String ACTION_QS_TILE_PREFERENCES = "android.service.quicksettings.action.QS_TILE_PREFERENCES";
diff --git a/core/java/android/service/quicksettings/Tile.java b/core/java/android/service/quicksettings/Tile.java
index 289b0e0..910fc44 100644
--- a/core/java/android/service/quicksettings/Tile.java
+++ b/core/java/android/service/quicksettings/Tile.java
@@ -227,7 +227,6 @@
/**
* Gets the Activity {@link PendingIntent} to be launched when the tile is clicked.
- * @hide
*/
@Nullable
public PendingIntent getActivityLaunchForClick() {
@@ -243,7 +242,6 @@
* (This is the default behavior if this method is never called.)
* @param pendingIntent a PendingIntent for an activity to be launched onclick, or {@code null}
* to handle the clicks in the `TileService`.
- * @hide
*/
public void setActivityLaunchForClick(@Nullable PendingIntent pendingIntent) {
if (pendingIntent != null && !pendingIntent.isActivity()) {
diff --git a/core/java/android/service/quicksettings/TileService.java b/core/java/android/service/quicksettings/TileService.java
index 506b3b8..7b6ff97 100644
--- a/core/java/android/service/quicksettings/TileService.java
+++ b/core/java/android/service/quicksettings/TileService.java
@@ -15,6 +15,7 @@
*/
package android.service.quicksettings;
+import android.annotation.NonNull;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SystemApi;
@@ -41,6 +42,8 @@
import com.android.internal.R;
+import java.util.Objects;
+
/**
* A TileService provides the user a tile that can be added to Quick Settings.
* Quick Settings is a space provided that allows the user to change settings and
@@ -341,9 +344,9 @@
* Will collapse Quick Settings after launching.
*
* @param pendingIntent A PendingIntent for an Activity to be launched immediately.
- * @hide
*/
- public void startActivityAndCollapse(PendingIntent pendingIntent) {
+ public final void startActivityAndCollapse(@NonNull PendingIntent pendingIntent) {
+ Objects.requireNonNull(pendingIntent);
try {
mService.startActivity(mTileToken, pendingIntent);
} catch (RemoteException e) {