Hide tethering option when in a guest account
- Before this CL, users can share their mobile data through enabling
tethering in the USB menu when in a guest account.
It will cause main users to spend their money unexpectedly.
This CL will hide the tethering option on the USB menu when in the
guest account.
- Add test cases.
Bug: 166125765
Test: 1. make -j42 RunSettingsRoboTests. 2. Switch to a guest account
to verify whether the tethering option is hiding.
Change-Id: I7523b3f3c3a1372bb128a58a6a7fac973d27cfbe
Merged-In: I7523b3f3c3a1372bb128a58a6a7fac973d27cfbe
(cherry picked from commit bde627b263
)
This commit is contained in:
@@ -181,4 +181,24 @@ public class UsbBackendTest {
|
||||
|
||||
assertThat(usbBackend.areFunctionsSupported(UsbManager.FUNCTION_MTP)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void areFunctionsDisallowedByNonAdminUser_isAdminUser_returnFalse() {
|
||||
when(mUserManager.isAdminUser()).thenReturn(true);
|
||||
|
||||
final UsbBackend usbBackend = new UsbBackend(mContext, mUserManager);
|
||||
|
||||
assertThat(usbBackend.areFunctionsDisallowedByNonAdminUser(
|
||||
UsbManager.FUNCTION_RNDIS)).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void areFunctionsDisallowedByNonAdminUser_isNotAdminUser_returnTrue() {
|
||||
when(mUserManager.isAdminUser()).thenReturn(false);
|
||||
|
||||
final UsbBackend usbBackend = new UsbBackend(mContext, mUserManager);
|
||||
|
||||
assertThat(usbBackend.areFunctionsDisallowedByNonAdminUser(
|
||||
UsbManager.FUNCTION_RNDIS)).isTrue();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user