mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 01:16:49 +00:00
Adding suport for Private Space QsTile fulfillment.
Adding logic to unlock private space and scroll to the container after unlock event is received by Launcher. This change also moves pieces of Private Space Animation to different classes, in order to make it more robust. Bug: 289024009 Test: atest PrivateProfileManagerTest Flag: ACONFIG com.google.android.apps.nexuslauncher.inject_private_space_tile TEAMFOOD Change-Id: Ica2fbc00ff3516ed5aca7fbbfc0bd2aa036a4cee
This commit is contained in:
@@ -22,6 +22,7 @@ import static com.android.launcher3.model.BgDataModel.Callbacks.FLAG_PRIVATE_PRO
|
||||
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.Mockito.doNothing;
|
||||
@@ -81,6 +82,8 @@ public class PrivateProfileManagerTest {
|
||||
@Mock
|
||||
private PackageManager mPackageManager;
|
||||
|
||||
private boolean mRunnableCalled = false;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
@@ -110,7 +113,7 @@ public class PrivateProfileManagerTest {
|
||||
public void unlockPrivateProfile_requestsQuietModeAsFalse() throws Exception {
|
||||
when(mAllAppsStore.hasModelFlag(FLAG_PRIVATE_PROFILE_QUIET_MODE_ENABLED)).thenReturn(true);
|
||||
|
||||
mPrivateProfileManager.unlockPrivateProfile();
|
||||
mPrivateProfileManager.unlockPrivateProfile(() -> {});
|
||||
|
||||
awaitTasksCompleted();
|
||||
Mockito.verify(mUserManager).requestQuietModeEnabled(false, PRIVATE_HANDLE);
|
||||
@@ -132,6 +135,23 @@ public class PrivateProfileManagerTest {
|
||||
assertEquals(STATE_DISABLED, privateProfileManager.getCurrentState());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void transitioningToUnlocked_resetCallsPendingRunnable() throws Exception {
|
||||
PrivateProfileManager privateProfileManager = spy(mPrivateProfileManager);
|
||||
doNothing().when(privateProfileManager).resetPrivateSpaceDecorator(anyInt());
|
||||
when(mAllAppsStore.hasModelFlag(FLAG_PRIVATE_PROFILE_QUIET_MODE_ENABLED))
|
||||
.thenReturn(false);
|
||||
when(privateProfileManager.getCurrentState()).thenReturn(STATE_DISABLED);
|
||||
mRunnableCalled = false;
|
||||
|
||||
privateProfileManager.unlockPrivateProfile(this::testRunnable);
|
||||
privateProfileManager.reset();
|
||||
|
||||
awaitTasksCompleted();
|
||||
Mockito.verify(privateProfileManager).applyUnlockRunnable();
|
||||
assertTrue(mRunnableCalled);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void openPrivateSpaceSettings_triggersSecurityAndPrivacyIntent() {
|
||||
Intent expectedIntent = new Intent(SAFETY_CENTER_INTENT);
|
||||
@@ -150,4 +170,8 @@ public class PrivateProfileManagerTest {
|
||||
private static void awaitTasksCompleted() throws Exception {
|
||||
UI_HELPER_EXECUTOR.submit(() -> null).get();
|
||||
}
|
||||
|
||||
private void testRunnable() {
|
||||
mRunnableCalled = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user