From 26142a66a084b6e7a8ce3ee55e34232d1d7a2041 Mon Sep 17 00:00:00 2001 From: Amin Shaikh Date: Wed, 11 Apr 2018 15:20:32 -0400 Subject: [PATCH] Only show mobile data turn off dialog once. Change-Id: I9eb8c27ea08f67478e2aacfa091a1320bac828ae Fixes: 77909752 Test: manual --- .../android/systemui/qs/tiles/CellularTile.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) 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 2abe9d9285fb2..892d8e9fcc193 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java @@ -108,20 +108,21 @@ public class CellularTile extends QSTileImpl { } if (mDataController.isMobileDataEnabled()) { if (mKeyguardMonitor.isSecure() && !mKeyguardMonitor.canSkipBouncer()) { - mActivityStarter.postQSRunnableDismissingKeyguard(this::showDisableDialog); + mActivityStarter.postQSRunnableDismissingKeyguard(this::maybeShowDisableDialog); } else { - if (Prefs.getBoolean(mContext, QS_HAS_TURNED_OFF_MOBILE_DATA, false)) { - mDataController.setMobileDataEnabled(false); - } else { - mUiHandler.post(this::showDisableDialog); - } + mUiHandler.post(this::maybeShowDisableDialog); } } else { mDataController.setMobileDataEnabled(true); } } - private void showDisableDialog() { + private void maybeShowDisableDialog() { + if (Prefs.getBoolean(mContext, QS_HAS_TURNED_OFF_MOBILE_DATA, false)) { + // Directly turn off mobile data if the user has seen the dialog before. + mDataController.setMobileDataEnabled(false); + return; + } mHost.collapsePanels(); String carrierName = mController.getMobileDataNetworkName(); if (TextUtils.isEmpty(carrierName)) {