Loading src/com/android/documentsui/sidebar/RootsFragment.java +11 −4 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.os.Build; import android.os.Bundle; import android.os.UserManager; import android.os.ext.SdkExtensions; import android.provider.DocumentsContract; import android.provider.MediaStore; Loading Loading @@ -572,16 +573,22 @@ public class RootsFragment extends Fragment { private List<Item> getPresentableListPrivateSpaceEnabled(Context context, State state, List<List<Item>> rootListAllUsers, List<UserId> userIds, UserManagerState userManagerState) { return new UserItemsCombiner(context.getResources(), context.getSystemService(DevicePolicyManager.class), state) return new UserItemsCombiner( context.getResources(), context.getSystemService(UserManager.class), context.getSystemService(DevicePolicyManager.class), state) .setRootListForAllUsers(rootListAllUsers) .createPresentableListForAllUsers(userIds, userManagerState.getUserIdToLabelMap()); } private List<Item> getPresentableListPrivateSpaceDisabled(Context context, State state, List<Item> rootList, List<Item> rootListOtherUser) { return new UserItemsCombiner(context.getResources(), context.getSystemService(DevicePolicyManager.class), state) return new UserItemsCombiner( context.getResources(), context.getSystemService(UserManager.class), context.getSystemService(DevicePolicyManager.class), state) .setRootListForCurrentUser(rootList) .setRootListForOtherUser(rootListOtherUser) .createPresentableList(); Loading src/com/android/documentsui/sidebar/UserItemsCombiner.java +10 −5 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import static com.android.documentsui.util.Material3Config.getRes; import android.app.admin.DevicePolicyManager; import android.content.res.Resources; import android.os.Build; import android.os.UserManager; import androidx.annotation.RequiresApi; import androidx.annotation.VisibleForTesting; Loading @@ -47,14 +48,17 @@ class UserItemsCombiner { private UserId mCurrentUser; private final Resources mResources; private final UserManager mUserManager; private final DevicePolicyManager mDpm; private final State mState; private List<Item> mRootList; private List<Item> mRootListOtherUser; private List<List<Item>> mRootListAllUsers; UserItemsCombiner(Resources resources, DevicePolicyManager dpm, State state) { UserItemsCombiner( Resources resources, UserManager userManager, DevicePolicyManager dpm, State state) { mCurrentUser = UserId.CURRENT_USER; mUserManager = userManager; mResources = checkNotNull(resources); mDpm = dpm; mState = checkNotNull(state); Loading Loading @@ -95,12 +99,13 @@ class UserItemsCombiner { // Identify personal and work root list. final List<Item> personalRootList; final List<Item> workRootList; if (mCurrentUser.isSystem()) { personalRootList = mRootList; workRootList = mRootListOtherUser; } else { if (mCurrentUser.isManagedProfile(mUserManager)) { personalRootList = mRootListOtherUser; workRootList = mRootList; } else { personalRootList = mRootList; workRootList = mRootListOtherUser; } result.add( new HeaderItem( Loading tests/unit/com/android/documentsui/sidebar/UserItemsCombinerTest.java +91 −63 Original line number Diff line number Diff line Loading @@ -18,8 +18,12 @@ package com.android.documentsui.sidebar; import static com.google.common.truth.Truth.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import android.app.admin.DevicePolicyManager; import android.content.res.Resources; import android.os.UserManager; import android.view.View; import androidx.test.filters.MediumTest; Loading Loading @@ -80,6 +84,7 @@ public class UserItemsCombinerTest { private final State mState = new State(); private final Resources mResources = InstrumentationRegistry.getInstrumentation().getTargetContext().getResources(); private final UserManager mMockUserManager = mock(UserManager.class); private final DevicePolicyManager mDpm = InstrumentationRegistry.getInstrumentation().getTargetContext().getSystemService( DevicePolicyManager.class); Loading @@ -106,11 +111,14 @@ public class UserItemsCombinerTest { mState.canForwardToProfileIdMap.put(PRIVATE_USER, true); mTestConfigStore.enablePrivateSpaceInPhotoPicker(); } when(mMockUserManager.isManagedProfile(WORK_USER.getIdentifier())).thenReturn(true); } @Test public void testCreatePresentableList_empty() { mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .setRootListForCurrentUser(Collections.emptyList()) .setRootListForOtherUser(Collections.emptyList()); assertThat(mCombiner.createPresentableList()).isEmpty(); Loading @@ -124,7 +132,8 @@ public class UserItemsCombinerTest { if (SdkLevel.isAtLeastV()) { rootListAllUsers.add(Collections.emptyList()); } mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .setRootListForAllUsers(rootListAllUsers); assertThat( mCombiner.createPresentableListForAllUsers(mUserIds, mUserIdToLabelMap)).isEmpty(); Loading @@ -132,7 +141,8 @@ public class UserItemsCombinerTest { @Test public void testCreatePresentableList_currentIsPersonal_personalItemsOnly() { mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .setRootListForCurrentUser(PERSONAL_ITEMS) .setRootListForOtherUser(Collections.emptyList()); assertThat(mCombiner.createPresentableList()) Loading @@ -143,7 +153,8 @@ public class UserItemsCombinerTest { @Test public void testCreatePresentableList_currentIsWork_personalItemsOnly() { mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .overrideCurrentUserForTest(WORK_USER) .setRootListForCurrentUser(Collections.emptyList()) .setRootListForOtherUser(PERSONAL_ITEMS); Loading @@ -161,7 +172,8 @@ public class UserItemsCombinerTest { if (SdkLevel.isAtLeastV()) { rootListAllUsers.add(Collections.emptyList()); } mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .setRootListForAllUsers(rootListAllUsers); assertThat(mCombiner.createPresentableListForAllUsers(mUserIds, mUserIdToLabelMap)) .comparingElementsUsing(ITEM_CORRESPONDENCE) Loading @@ -177,7 +189,8 @@ public class UserItemsCombinerTest { if (SdkLevel.isAtLeastV()) { rootListAllUsers.add(Collections.emptyList()); } mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .overrideCurrentUserForTest(WORK_USER) .setRootListForAllUsers(rootListAllUsers); assertThat(mCombiner.createPresentableListForAllUsers(mUserIds, mUserIdToLabelMap)) Loading @@ -193,7 +206,8 @@ public class UserItemsCombinerTest { rootListAllUsers.add(Lists.newArrayList(PERSONAL_ITEMS)); rootListAllUsers.add(Collections.emptyList()); rootListAllUsers.add(Collections.emptyList()); mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .overrideCurrentUserForTest(PRIVATE_USER) .setRootListForAllUsers(rootListAllUsers); assertThat(mCombiner.createPresentableListForAllUsers(mUserIds, mUserIdToLabelMap)) Loading @@ -204,7 +218,8 @@ public class UserItemsCombinerTest { @Test public void testCreatePresentableList_currentIsPersonal_workItemsOnly() { mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .setRootListForCurrentUser(Collections.emptyList()) .setRootListForOtherUser(WORK_ITEMS); assertThat(mCombiner.createPresentableList()) Loading @@ -215,7 +230,8 @@ public class UserItemsCombinerTest { @Test public void testCreatePresentableList_currentIsWork_workItemsOnly() { mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .overrideCurrentUserForTest(WORK_USER) .setRootListForCurrentUser(WORK_ITEMS) .setRootListForOtherUser(Collections.emptyList()); Loading @@ -233,7 +249,8 @@ public class UserItemsCombinerTest { if (SdkLevel.isAtLeastV()) { rootListAllUsers.add(Collections.emptyList()); } mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .overrideCurrentUserForTest(PERSONAL_USER) .setRootListForAllUsers(rootListAllUsers); assertThat(mCombiner.createPresentableListForAllUsers(mUserIds, mUserIdToLabelMap)) Loading @@ -250,7 +267,8 @@ public class UserItemsCombinerTest { if (SdkLevel.isAtLeastV()) { rootListAllUsers.add(Collections.emptyList()); } mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .overrideCurrentUserForTest(WORK_USER) .setRootListForAllUsers(rootListAllUsers); assertThat(mCombiner.createPresentableListForAllUsers(mUserIds, mUserIdToLabelMap)) Loading @@ -266,7 +284,8 @@ public class UserItemsCombinerTest { rootListAllUsers.add(Collections.emptyList()); rootListAllUsers.add(Lists.newArrayList(WORK_ITEMS)); rootListAllUsers.add(Collections.emptyList()); mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .overrideCurrentUserForTest(PRIVATE_USER) .setRootListForAllUsers(rootListAllUsers); assertThat(mCombiner.createPresentableListForAllUsers(mUserIds, mUserIdToLabelMap)) Loading @@ -277,7 +296,8 @@ public class UserItemsCombinerTest { @Test public void testCreatePresentableList_currentIsPersonal_personalAndWorkItems() { mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .setRootListForCurrentUser(PERSONAL_ITEMS) .setRootListForOtherUser(WORK_ITEMS); Loading @@ -295,7 +315,8 @@ public class UserItemsCombinerTest { @Test public void testCreatePresentableList_currentIsWork_personalAndWorkItems() { mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .overrideCurrentUserForTest(WORK_USER) .setRootListForCurrentUser(WORK_ITEMS) .setRootListForOtherUser(PERSONAL_ITEMS); Loading @@ -320,7 +341,8 @@ public class UserItemsCombinerTest { if (SdkLevel.isAtLeastV()) { rootListAllUsers.add(PRIVATE_ITEMS); } mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .setRootListForAllUsers(rootListAllUsers); List<Item> expected = Lists.newArrayList(); Loading @@ -347,7 +369,8 @@ public class UserItemsCombinerTest { if (SdkLevel.isAtLeastV()) { rootListAllUsers.add(PRIVATE_ITEMS); } mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .overrideCurrentUserForTest(WORK_USER) .setRootListForAllUsers(rootListAllUsers); Loading Loading @@ -375,7 +398,8 @@ public class UserItemsCombinerTest { if (SdkLevel.isAtLeastV()) { rootListAllUsers.add(PRIVATE_ITEMS); } mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .overrideCurrentUserForTest(PRIVATE_USER) .setRootListForAllUsers(rootListAllUsers); Loading @@ -398,7 +422,8 @@ public class UserItemsCombinerTest { @Test public void testCreatePresentableList_currentIsPersonal_personalAndWorkItems_cannotShare() { mState.canShareAcrossProfile = false; mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .setRootListForCurrentUser(PERSONAL_ITEMS) .setRootListForOtherUser(WORK_ITEMS); Loading @@ -411,7 +436,8 @@ public class UserItemsCombinerTest { @Test public void testCreatePresentableList_currentIsWork_personalItemsOnly_cannotShare() { mState.canShareAcrossProfile = false; mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .overrideCurrentUserForTest(WORK_USER) .setRootListForCurrentUser(Collections.emptyList()) .setRootListForOtherUser(PERSONAL_ITEMS); Loading @@ -429,7 +455,8 @@ public class UserItemsCombinerTest { if (SdkLevel.isAtLeastV()) { rootListAllUsers.add(PRIVATE_ITEMS); } mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .setRootListForAllUsers(rootListAllUsers); List<Item> expected = Lists.newArrayList(); Loading Loading @@ -460,7 +487,8 @@ public class UserItemsCombinerTest { if (SdkLevel.isAtLeastV()) { rootListAllUsers.add(PRIVATE_ITEMS); } mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .overrideCurrentUserForTest(WORK_USER) .setRootListForAllUsers(rootListAllUsers); Loading Loading
src/com/android/documentsui/sidebar/RootsFragment.java +11 −4 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.os.Build; import android.os.Bundle; import android.os.UserManager; import android.os.ext.SdkExtensions; import android.provider.DocumentsContract; import android.provider.MediaStore; Loading Loading @@ -572,16 +573,22 @@ public class RootsFragment extends Fragment { private List<Item> getPresentableListPrivateSpaceEnabled(Context context, State state, List<List<Item>> rootListAllUsers, List<UserId> userIds, UserManagerState userManagerState) { return new UserItemsCombiner(context.getResources(), context.getSystemService(DevicePolicyManager.class), state) return new UserItemsCombiner( context.getResources(), context.getSystemService(UserManager.class), context.getSystemService(DevicePolicyManager.class), state) .setRootListForAllUsers(rootListAllUsers) .createPresentableListForAllUsers(userIds, userManagerState.getUserIdToLabelMap()); } private List<Item> getPresentableListPrivateSpaceDisabled(Context context, State state, List<Item> rootList, List<Item> rootListOtherUser) { return new UserItemsCombiner(context.getResources(), context.getSystemService(DevicePolicyManager.class), state) return new UserItemsCombiner( context.getResources(), context.getSystemService(UserManager.class), context.getSystemService(DevicePolicyManager.class), state) .setRootListForCurrentUser(rootList) .setRootListForOtherUser(rootListOtherUser) .createPresentableList(); Loading
src/com/android/documentsui/sidebar/UserItemsCombiner.java +10 −5 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import static com.android.documentsui.util.Material3Config.getRes; import android.app.admin.DevicePolicyManager; import android.content.res.Resources; import android.os.Build; import android.os.UserManager; import androidx.annotation.RequiresApi; import androidx.annotation.VisibleForTesting; Loading @@ -47,14 +48,17 @@ class UserItemsCombiner { private UserId mCurrentUser; private final Resources mResources; private final UserManager mUserManager; private final DevicePolicyManager mDpm; private final State mState; private List<Item> mRootList; private List<Item> mRootListOtherUser; private List<List<Item>> mRootListAllUsers; UserItemsCombiner(Resources resources, DevicePolicyManager dpm, State state) { UserItemsCombiner( Resources resources, UserManager userManager, DevicePolicyManager dpm, State state) { mCurrentUser = UserId.CURRENT_USER; mUserManager = userManager; mResources = checkNotNull(resources); mDpm = dpm; mState = checkNotNull(state); Loading Loading @@ -95,12 +99,13 @@ class UserItemsCombiner { // Identify personal and work root list. final List<Item> personalRootList; final List<Item> workRootList; if (mCurrentUser.isSystem()) { personalRootList = mRootList; workRootList = mRootListOtherUser; } else { if (mCurrentUser.isManagedProfile(mUserManager)) { personalRootList = mRootListOtherUser; workRootList = mRootList; } else { personalRootList = mRootList; workRootList = mRootListOtherUser; } result.add( new HeaderItem( Loading
tests/unit/com/android/documentsui/sidebar/UserItemsCombinerTest.java +91 −63 Original line number Diff line number Diff line Loading @@ -18,8 +18,12 @@ package com.android.documentsui.sidebar; import static com.google.common.truth.Truth.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import android.app.admin.DevicePolicyManager; import android.content.res.Resources; import android.os.UserManager; import android.view.View; import androidx.test.filters.MediumTest; Loading Loading @@ -80,6 +84,7 @@ public class UserItemsCombinerTest { private final State mState = new State(); private final Resources mResources = InstrumentationRegistry.getInstrumentation().getTargetContext().getResources(); private final UserManager mMockUserManager = mock(UserManager.class); private final DevicePolicyManager mDpm = InstrumentationRegistry.getInstrumentation().getTargetContext().getSystemService( DevicePolicyManager.class); Loading @@ -106,11 +111,14 @@ public class UserItemsCombinerTest { mState.canForwardToProfileIdMap.put(PRIVATE_USER, true); mTestConfigStore.enablePrivateSpaceInPhotoPicker(); } when(mMockUserManager.isManagedProfile(WORK_USER.getIdentifier())).thenReturn(true); } @Test public void testCreatePresentableList_empty() { mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .setRootListForCurrentUser(Collections.emptyList()) .setRootListForOtherUser(Collections.emptyList()); assertThat(mCombiner.createPresentableList()).isEmpty(); Loading @@ -124,7 +132,8 @@ public class UserItemsCombinerTest { if (SdkLevel.isAtLeastV()) { rootListAllUsers.add(Collections.emptyList()); } mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .setRootListForAllUsers(rootListAllUsers); assertThat( mCombiner.createPresentableListForAllUsers(mUserIds, mUserIdToLabelMap)).isEmpty(); Loading @@ -132,7 +141,8 @@ public class UserItemsCombinerTest { @Test public void testCreatePresentableList_currentIsPersonal_personalItemsOnly() { mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .setRootListForCurrentUser(PERSONAL_ITEMS) .setRootListForOtherUser(Collections.emptyList()); assertThat(mCombiner.createPresentableList()) Loading @@ -143,7 +153,8 @@ public class UserItemsCombinerTest { @Test public void testCreatePresentableList_currentIsWork_personalItemsOnly() { mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .overrideCurrentUserForTest(WORK_USER) .setRootListForCurrentUser(Collections.emptyList()) .setRootListForOtherUser(PERSONAL_ITEMS); Loading @@ -161,7 +172,8 @@ public class UserItemsCombinerTest { if (SdkLevel.isAtLeastV()) { rootListAllUsers.add(Collections.emptyList()); } mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .setRootListForAllUsers(rootListAllUsers); assertThat(mCombiner.createPresentableListForAllUsers(mUserIds, mUserIdToLabelMap)) .comparingElementsUsing(ITEM_CORRESPONDENCE) Loading @@ -177,7 +189,8 @@ public class UserItemsCombinerTest { if (SdkLevel.isAtLeastV()) { rootListAllUsers.add(Collections.emptyList()); } mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .overrideCurrentUserForTest(WORK_USER) .setRootListForAllUsers(rootListAllUsers); assertThat(mCombiner.createPresentableListForAllUsers(mUserIds, mUserIdToLabelMap)) Loading @@ -193,7 +206,8 @@ public class UserItemsCombinerTest { rootListAllUsers.add(Lists.newArrayList(PERSONAL_ITEMS)); rootListAllUsers.add(Collections.emptyList()); rootListAllUsers.add(Collections.emptyList()); mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .overrideCurrentUserForTest(PRIVATE_USER) .setRootListForAllUsers(rootListAllUsers); assertThat(mCombiner.createPresentableListForAllUsers(mUserIds, mUserIdToLabelMap)) Loading @@ -204,7 +218,8 @@ public class UserItemsCombinerTest { @Test public void testCreatePresentableList_currentIsPersonal_workItemsOnly() { mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .setRootListForCurrentUser(Collections.emptyList()) .setRootListForOtherUser(WORK_ITEMS); assertThat(mCombiner.createPresentableList()) Loading @@ -215,7 +230,8 @@ public class UserItemsCombinerTest { @Test public void testCreatePresentableList_currentIsWork_workItemsOnly() { mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .overrideCurrentUserForTest(WORK_USER) .setRootListForCurrentUser(WORK_ITEMS) .setRootListForOtherUser(Collections.emptyList()); Loading @@ -233,7 +249,8 @@ public class UserItemsCombinerTest { if (SdkLevel.isAtLeastV()) { rootListAllUsers.add(Collections.emptyList()); } mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .overrideCurrentUserForTest(PERSONAL_USER) .setRootListForAllUsers(rootListAllUsers); assertThat(mCombiner.createPresentableListForAllUsers(mUserIds, mUserIdToLabelMap)) Loading @@ -250,7 +267,8 @@ public class UserItemsCombinerTest { if (SdkLevel.isAtLeastV()) { rootListAllUsers.add(Collections.emptyList()); } mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .overrideCurrentUserForTest(WORK_USER) .setRootListForAllUsers(rootListAllUsers); assertThat(mCombiner.createPresentableListForAllUsers(mUserIds, mUserIdToLabelMap)) Loading @@ -266,7 +284,8 @@ public class UserItemsCombinerTest { rootListAllUsers.add(Collections.emptyList()); rootListAllUsers.add(Lists.newArrayList(WORK_ITEMS)); rootListAllUsers.add(Collections.emptyList()); mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .overrideCurrentUserForTest(PRIVATE_USER) .setRootListForAllUsers(rootListAllUsers); assertThat(mCombiner.createPresentableListForAllUsers(mUserIds, mUserIdToLabelMap)) Loading @@ -277,7 +296,8 @@ public class UserItemsCombinerTest { @Test public void testCreatePresentableList_currentIsPersonal_personalAndWorkItems() { mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .setRootListForCurrentUser(PERSONAL_ITEMS) .setRootListForOtherUser(WORK_ITEMS); Loading @@ -295,7 +315,8 @@ public class UserItemsCombinerTest { @Test public void testCreatePresentableList_currentIsWork_personalAndWorkItems() { mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .overrideCurrentUserForTest(WORK_USER) .setRootListForCurrentUser(WORK_ITEMS) .setRootListForOtherUser(PERSONAL_ITEMS); Loading @@ -320,7 +341,8 @@ public class UserItemsCombinerTest { if (SdkLevel.isAtLeastV()) { rootListAllUsers.add(PRIVATE_ITEMS); } mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .setRootListForAllUsers(rootListAllUsers); List<Item> expected = Lists.newArrayList(); Loading @@ -347,7 +369,8 @@ public class UserItemsCombinerTest { if (SdkLevel.isAtLeastV()) { rootListAllUsers.add(PRIVATE_ITEMS); } mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .overrideCurrentUserForTest(WORK_USER) .setRootListForAllUsers(rootListAllUsers); Loading Loading @@ -375,7 +398,8 @@ public class UserItemsCombinerTest { if (SdkLevel.isAtLeastV()) { rootListAllUsers.add(PRIVATE_ITEMS); } mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .overrideCurrentUserForTest(PRIVATE_USER) .setRootListForAllUsers(rootListAllUsers); Loading @@ -398,7 +422,8 @@ public class UserItemsCombinerTest { @Test public void testCreatePresentableList_currentIsPersonal_personalAndWorkItems_cannotShare() { mState.canShareAcrossProfile = false; mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .setRootListForCurrentUser(PERSONAL_ITEMS) .setRootListForOtherUser(WORK_ITEMS); Loading @@ -411,7 +436,8 @@ public class UserItemsCombinerTest { @Test public void testCreatePresentableList_currentIsWork_personalItemsOnly_cannotShare() { mState.canShareAcrossProfile = false; mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .overrideCurrentUserForTest(WORK_USER) .setRootListForCurrentUser(Collections.emptyList()) .setRootListForOtherUser(PERSONAL_ITEMS); Loading @@ -429,7 +455,8 @@ public class UserItemsCombinerTest { if (SdkLevel.isAtLeastV()) { rootListAllUsers.add(PRIVATE_ITEMS); } mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .setRootListForAllUsers(rootListAllUsers); List<Item> expected = Lists.newArrayList(); Loading Loading @@ -460,7 +487,8 @@ public class UserItemsCombinerTest { if (SdkLevel.isAtLeastV()) { rootListAllUsers.add(PRIVATE_ITEMS); } mCombiner = new UserItemsCombiner(mResources, mDpm, mState) mCombiner = new UserItemsCombiner(mResources, mMockUserManager, mDpm, mState) .overrideCurrentUserForTest(WORK_USER) .setRootListForAllUsers(rootListAllUsers); Loading