SystemUI: Internet tile: Allow long-pressing on mobile network
* The current WiFi network has a setting toggle and also opens the
settings on single click where the mobile network only allows
connecting but not opening settings
* Add a long press listener that goes to the subId's network settings,
allowing for example to disable roaming or change network
Change-Id: Iacc1c64d318b0240da5397f2b4e4dfb59d4834dd
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialog.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialog.java
index c0e4995..3fd12e3 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialog.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialog.java
@@ -288,6 +288,7 @@
mHandler.removeCallbacks(mHideProgressBarRunnable);
mHandler.removeCallbacks(mHideSearchingRunnable);
mMobileNetworkLayout.setOnClickListener(null);
+ mMobileNetworkLayout.setOnLongClickListener(null);
mMobileDataToggle.setOnCheckedChangeListener(null);
mConnectedWifListLayout.setOnClickListener(null);
if (mSecondaryMobileNetworkLayout != null) {
@@ -358,6 +359,13 @@
}
}
});
+ mMobileNetworkLayout.setOnLongClickListener(v -> {
+ if (!mInternetDialogController.isDeviceLocked()) {
+ mInternetDialogController.launchMobileNetworkSettings(v, mDefaultDataSubId);
+ return true;
+ }
+ return false;
+ });
mMobileDataToggle.setOnCheckedChangeListener(
(buttonView, isChecked) -> {
if (!isChecked && shouldShowMobileDialog()) {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialogController.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialogController.java
index 557b718..a779084 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialogController.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialogController.java
@@ -739,6 +739,10 @@
void launchMobileNetworkSettings(View view) {
final int subId = getActiveAutoSwitchNonDdsSubId();
+ launchMobileNetworkSettings(view, subId);
+ }
+
+ void launchMobileNetworkSettings(View view, int subId) {
if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
Log.w(TAG, "launchMobileNetworkSettings fail, invalid subId:" + subId);
return;