From 8d2e9a9b304f06a13f949d5eb1951f63fbba2cbb Mon Sep 17 00:00:00 2001 From: Akira Oshimi Date: Tue, 24 Jan 2017 16:50:53 +0900 Subject: [PATCH] Add tile information to ACTION_QS_TILE_PREFERENCES intent One application can provide two or more custom Quick Settings tiles. But there is no way to know which tile is long-pressed from application side because ACTION_QS_TILE_PREFERENCES intent that is sent when long-pressed doesn't have any additional information. So the component name and state of the tile should be added to the intent. Bug: 34832801 Test: manual - long press a custom tile Change-Id: Iaa884cd944f19a2f007cbde645e8f8b1198bffb7 --- core/java/android/service/quicksettings/TileService.java | 5 +++++ .../src/com/android/systemui/qs/external/CustomTile.java | 2 ++ 2 files changed, 7 insertions(+) diff --git a/core/java/android/service/quicksettings/TileService.java b/core/java/android/service/quicksettings/TileService.java index 887f4b6577b91..1781c2ac0d788 100644 --- a/core/java/android/service/quicksettings/TileService.java +++ b/core/java/android/service/quicksettings/TileService.java @@ -130,6 +130,11 @@ public class TileService extends Service { */ public static final String EXTRA_COMPONENT = "android.service.quicksettings.extra.COMPONENT"; + /** + * @hide + */ + public static final String EXTRA_STATE = "state"; + private final H mHandler = new H(Looper.getMainLooper()); private boolean mListening = false; diff --git a/packages/SystemUI/src/com/android/systemui/qs/external/CustomTile.java b/packages/SystemUI/src/com/android/systemui/qs/external/CustomTile.java index 484e008b3714a..2fd62f1ebf264 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/external/CustomTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/external/CustomTile.java @@ -232,6 +232,8 @@ public class CustomTile extends QSTile implements TileChangeListen i.setPackage(mComponent.getPackageName()); i = resolveIntent(i); if (i != null) { + i.putExtra(TileService.EXTRA_COMPONENT, mComponent); + i.putExtra(TileService.EXTRA_STATE, mTile.getState()); return i; } return new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).setData(