Improve multi user functionality for restricted users
- Restricted users can change their name
- Improved App&Content access screen
- Remove "Turn on phone calls" from restricted user detail page
Doc: http://shortn/_Prb3SJ3xJ3
Bug: 142798722
Test: Run robo tests with this command:
make -j64 RunSettingsRoboTests
Change-Id: I2aadf32aef52ba5ad0db7aa0cd83bac9d9941589
(cherry picked from commit f4759e00d5)
This commit is contained in:
committed by
András Klöczl
parent
ff35a3e641
commit
106431e525
@@ -28,7 +28,9 @@ import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
@@ -62,6 +64,8 @@ public class EditUserInfoControllerTest {
|
||||
@Mock
|
||||
private Drawable mCurrentIcon;
|
||||
|
||||
private boolean mCanChangePhoto;
|
||||
|
||||
private FragmentActivity mActivity;
|
||||
private TestEditUserInfoController mController;
|
||||
|
||||
@@ -78,6 +82,11 @@ public class EditUserInfoControllerTest {
|
||||
mPhotoController = mock(EditUserPhotoController.class, Answers.RETURNS_DEEP_STUBS);
|
||||
return mPhotoController;
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean canChangePhoto(Context context, UserInfo user) {
|
||||
return mCanChangePhoto;
|
||||
}
|
||||
}
|
||||
|
||||
@Before
|
||||
@@ -86,6 +95,7 @@ public class EditUserInfoControllerTest {
|
||||
mActivity = spy(ActivityController.of(new FragmentActivity()).get());
|
||||
when(mFragment.getActivity()).thenReturn(mActivity);
|
||||
mController = new TestEditUserInfoController();
|
||||
mCanChangePhoto = true;
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -256,4 +266,17 @@ public class EditUserInfoControllerTest {
|
||||
verify(dialogCompleteCallback, times(1)).onPositive();
|
||||
verify(dialogCompleteCallback, times(0)).onNegativeOrCancel();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createDialog_canNotChangePhoto_nullPhotoController() {
|
||||
mCanChangePhoto = false;
|
||||
|
||||
mController.createDialog(
|
||||
mFragment, mCurrentIcon, "test",
|
||||
"title", null,
|
||||
android.os.Process.myUserHandle(),
|
||||
null);
|
||||
|
||||
assertThat(mController.mPhotoController).isNull();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user