From 2594b932c07ecf7cb28b99603e95b1b2f346b843 Mon Sep 17 00:00:00 2001 From: Fabian Kozynski Date: Thu, 11 Apr 2019 12:22:39 -0400 Subject: [PATCH] Changed intents for data and saver tiles Changed the intents to point to the right settings. The intent in CellularTile will point to the carrier selected as default for data if there is one. Test: manual, using DSDS Fixes: 122676059 Change-Id: I71a8eac1754eaadda156209315a3a469e7e4f6d0 --- core/java/android/provider/Settings.java | 16 ++++++++++++++++ .../android/systemui/qs/tiles/CellularTile.java | 9 ++++++++- .../android/systemui/qs/tiles/DataSaverTile.java | 3 ++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 3db6b2bcaa895..abbd4c4414967 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -1060,6 +1060,22 @@ public final class Settings { public static final String ACTION_ADD_ACCOUNT = "android.settings.ADD_ACCOUNT_SETTINGS"; + /** + * Activity Action: Show settings for enabling or disabling data saver + *

+ * In some cases, a matching Activity may not exist, so ensure you + * safeguard against this. + *

+ * Input: Nothing. + *

+ * Output: Nothing. + * + * @hide + */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_DATA_SAVER_SETTINGS = + "android.settings.DATA_SAVER_SETTINGS"; + /** * Activity Action: Show settings for selecting the network operator. *

diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java index 38962eb147058..20e002edfe029 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java @@ -25,6 +25,7 @@ import android.content.Intent; import android.content.res.Resources; import android.provider.Settings; import android.service.quicksettings.Tile; +import android.telephony.SubscriptionManager; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; @@ -285,7 +286,13 @@ public class CellularTile extends QSTileImpl { } static Intent getCellularSettingIntent() { - return new Intent(Settings.ACTION_DATA_USAGE_SETTINGS); + Intent intent = new Intent(Settings.ACTION_NETWORK_OPERATOR_SETTINGS); + int dataSub = SubscriptionManager.getDefaultDataSubscriptionId(); + if (dataSub != SubscriptionManager.INVALID_SUBSCRIPTION_ID) { + intent.putExtra(Settings.EXTRA_SUB_ID, + SubscriptionManager.getDefaultDataSubscriptionId()); + } + return intent; } private final class CellularDetailAdapter implements DetailAdapter { diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/DataSaverTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/DataSaverTile.java index c6c6f877ac9bd..79996bcfa8089 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/DataSaverTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/DataSaverTile.java @@ -16,6 +16,7 @@ package com.android.systemui.qs.tiles; import android.content.DialogInterface.OnClickListener; import android.content.Intent; +import android.provider.Settings; import android.service.quicksettings.Tile; import android.widget.Switch; @@ -54,7 +55,7 @@ public class DataSaverTile extends QSTileImpl implements @Override public Intent getLongClickIntent() { - return CellularTile.getCellularSettingIntent(); + return new Intent(Settings.ACTION_DATA_SAVER_SETTINGS); } @Override protected void handleClick() {