From 376060d1d74326255cfa10e0fc0cffeb05c478c2 Mon Sep 17 00:00:00 2001 From: Torbjorn Eklund Date: Wed, 26 Feb 2020 13:53:42 +0100 Subject: [PATCH] Prevent guest user from toggling mobile data Quick Setting Prevents the guest user from toggling mobile data on/off by using the mobile data quick setting. The guest user is not able to access the network settings menu where mobile data is usually toggled. The guest user should therefore not be able to toggle mobile data on/off by using quick settings. Bug: 150262422 Test: atest SystemUITests Change-Id: I24262d4580fa5d7414d5d3e7e0e42873432ab74f Merged-In: I24262d4580fa5d7414d5d3e7e0e42873432ab74f --- .../src/com/android/systemui/qs/tiles/CellularTile.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 bc03ca617deab..077c7aacd7fbf 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java @@ -23,6 +23,7 @@ import android.app.AlertDialog.Builder; import android.content.Context; import android.content.Intent; import android.content.res.Resources; +import android.os.UserHandle; import android.provider.Settings; import android.service.quicksettings.Tile; import android.telephony.SubscriptionManager; @@ -230,7 +231,8 @@ public class CellularTile extends QSTileImpl { @Override public boolean isAvailable() { - return mController.hasMobileDataFeature(); + return mController.hasMobileDataFeature() + && mHost.getUserContext().getUserId() == UserHandle.USER_SYSTEM; } private static final class CallbackInfo {