use of com.android.launcher3.allapps.WorkProfileManager in project android_packages_apps_Launcher3 by ProtonAOSP.
the class WorkProfileTest method toggleWorks.
@Test
public void toggleWorks() {
waitForWorkTabSetup();
executeOnLauncher(launcher -> {
AllAppsPagedView pagedView = (AllAppsPagedView) launcher.getAppsView().getContentView();
pagedView.setCurrentPage(WORK_PAGE);
});
WorkProfileManager manager = getFromLauncher(l -> l.getAppsView().getWorkManager());
waitForLauncherCondition("work profile initial state check failed", launcher -> manager.getWorkModeSwitch() != null && manager.getCurrentState() == WorkProfileManager.STATE_ENABLED && manager.getWorkModeSwitch().isEnabled(), LauncherInstrumentation.WAIT_TIME_MS);
// start work profile toggle OFF test
executeOnLauncher(l -> l.getAppsView().getWorkManager().getWorkModeSwitch().performClick());
waitForLauncherCondition("Work profile toggle OFF failed", launcher -> {
// pulls current state from system
manager.reset();
return manager.getCurrentState() == WorkProfileManager.STATE_DISABLED;
}, LauncherInstrumentation.WAIT_TIME_MS);
// start work profile toggle ON test
executeOnLauncher(l -> {
AllAppsContainerView allApps = l.getAppsView();
assertEquals("Work tab is not focused", allApps.getCurrentPage(), WORK_PAGE);
View workPausedCard = allApps.getActiveRecyclerView().findViewHolderForAdapterPosition(0).itemView;
workPausedCard.findViewById(R.id.enable_work_apps).performClick();
});
waitForLauncherCondition("Work profile toggle ON failed", launcher -> {
// pulls current state from system
manager.reset();
return manager.getCurrentState() == WorkProfileManager.STATE_ENABLED;
}, LauncherInstrumentation.WAIT_TIME_MS);
}
use of com.android.launcher3.allapps.WorkProfileManager in project android_packages_apps_404Launcher by P-404.
the class WorkProfileTest method toggleWorks.
@Test
public void toggleWorks() {
waitForWorkTabSetup();
executeOnLauncher(launcher -> {
AllAppsPagedView pagedView = (AllAppsPagedView) launcher.getAppsView().getContentView();
pagedView.setCurrentPage(WORK_PAGE);
});
WorkProfileManager manager = getFromLauncher(l -> l.getAppsView().getWorkManager());
waitForLauncherCondition("work profile initial state check failed", launcher -> manager.getWorkModeSwitch() != null && manager.getCurrentState() == WorkProfileManager.STATE_ENABLED && manager.getWorkModeSwitch().isEnabled(), LauncherInstrumentation.WAIT_TIME_MS);
// start work profile toggle OFF test
executeOnLauncher(l -> l.getAppsView().getWorkManager().getWorkModeSwitch().performClick());
waitForLauncherCondition("Work profile toggle OFF failed", launcher -> {
// pulls current state from system
manager.reset();
return manager.getCurrentState() == WorkProfileManager.STATE_DISABLED;
}, LauncherInstrumentation.WAIT_TIME_MS);
// start work profile toggle ON test
executeOnLauncher(l -> {
AllAppsContainerView allApps = l.getAppsView();
assertEquals("Work tab is not focused", allApps.getCurrentPage(), WORK_PAGE);
View workPausedCard = allApps.getActiveRecyclerView().findViewHolderForAdapterPosition(0).itemView;
workPausedCard.findViewById(R.id.enable_work_apps).performClick();
});
waitForLauncherCondition("Work profile toggle ON failed", launcher -> {
// pulls current state from system
manager.reset();
return manager.getCurrentState() == WorkProfileManager.STATE_ENABLED;
}, LauncherInstrumentation.WAIT_TIME_MS);
}
use of com.android.launcher3.allapps.WorkProfileManager in project android_packages_apps_Launcher3 by ArrowOS.
the class WorkProfileTest method toggleWorks.
@Test
public void toggleWorks() {
waitForWorkTabSetup();
executeOnLauncher(launcher -> {
AllAppsPagedView pagedView = (AllAppsPagedView) launcher.getAppsView().getContentView();
pagedView.setCurrentPage(WORK_PAGE);
});
WorkProfileManager manager = getFromLauncher(l -> l.getAppsView().getWorkManager());
waitForLauncherCondition("work profile initial state check failed", launcher -> manager.getWorkModeSwitch() != null && manager.getCurrentState() == WorkProfileManager.STATE_ENABLED && manager.getWorkModeSwitch().isEnabled(), LauncherInstrumentation.WAIT_TIME_MS);
// start work profile toggle OFF test
executeOnLauncher(l -> l.getAppsView().getWorkManager().getWorkModeSwitch().performClick());
waitForLauncherCondition("Work profile toggle OFF failed", launcher -> {
// pulls current state from system
manager.reset();
return manager.getCurrentState() == WorkProfileManager.STATE_DISABLED;
}, LauncherInstrumentation.WAIT_TIME_MS);
// start work profile toggle ON test
executeOnLauncher(l -> {
AllAppsContainerView allApps = l.getAppsView();
assertEquals("Work tab is not focused", allApps.getCurrentPage(), WORK_PAGE);
View workPausedCard = allApps.getActiveRecyclerView().findViewHolderForAdapterPosition(0).itemView;
workPausedCard.findViewById(R.id.enable_work_apps).performClick();
});
waitForLauncherCondition("Work profile toggle ON failed", launcher -> {
// pulls current state from system
manager.reset();
return manager.getCurrentState() == WorkProfileManager.STATE_ENABLED;
}, LauncherInstrumentation.WAIT_TIME_MS);
}
use of com.android.launcher3.allapps.WorkProfileManager in project android_packages_apps_Launcher3 by AOSPA.
the class WorkProfileTest method toggleWorks.
@Test
public void toggleWorks() {
waitForWorkTabSetup();
executeOnLauncher(launcher -> {
AllAppsPagedView pagedView = (AllAppsPagedView) launcher.getAppsView().getContentView();
pagedView.setCurrentPage(WORK_PAGE);
});
WorkProfileManager manager = getFromLauncher(l -> l.getAppsView().getWorkManager());
waitForLauncherCondition("work profile initial state check failed", launcher -> manager.getWorkModeSwitch() != null && manager.getCurrentState() == WorkProfileManager.STATE_ENABLED && manager.getWorkModeSwitch().isEnabled(), LauncherInstrumentation.WAIT_TIME_MS);
// start work profile toggle OFF test
executeOnLauncher(l -> l.getAppsView().getWorkManager().getWorkModeSwitch().performClick());
waitForLauncherCondition("Work profile toggle OFF failed", launcher -> {
// pulls current state from system
manager.reset();
return manager.getCurrentState() == WorkProfileManager.STATE_DISABLED;
}, LauncherInstrumentation.WAIT_TIME_MS);
// start work profile toggle ON test
executeOnLauncher(l -> {
AllAppsContainerView allApps = l.getAppsView();
assertEquals("Work tab is not focused", allApps.getCurrentPage(), WORK_PAGE);
View workPausedCard = allApps.getActiveRecyclerView().findViewHolderForAdapterPosition(0).itemView;
workPausedCard.findViewById(R.id.enable_work_apps).performClick();
});
waitForLauncherCondition("Work profile toggle ON failed", launcher -> {
// pulls current state from system
manager.reset();
return manager.getCurrentState() == WorkProfileManager.STATE_ENABLED;
}, LauncherInstrumentation.WAIT_TIME_MS);
}
Aggregations