From 7f65f1aff21ea9600653b18eb5ac4526250cba34 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 --- .../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 5e6a6ce45b467..f742752d80be9 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.os.Handler; import android.os.Looper; +import android.os.UserHandle; import android.provider.Settings; import android.service.quicksettings.Tile; import android.telephony.SubscriptionManager; @@ -244,7 +245,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 {