Add debug logs for WorkTabExists test

Bug: 243688989
Change-Id: Iafec4cae86f1527acac9a25fceb501609ca308f6
This commit is contained in:
Vinit Nayak
2023-02-22 17:04:18 -08:00
parent f1a0bd61f4
commit 7a68378fe4
5 changed files with 36 additions and 1 deletions

View File

@@ -18,6 +18,7 @@ package com.android.launcher3.ui;
import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.allapps.AllAppsStore.DEFER_UPDATES_TEST;
import static com.android.launcher3.testing.shared.TestProtocol.WORK_TAB_MISSING;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -65,8 +66,13 @@ public class WorkProfileTest extends AbstractLauncherUiTest {
String[] tokens = output.split("\\s+");
mProfileUserId = Integer.parseInt(tokens[tokens.length - 1]);
output = mDevice.executeShellCommand("am start-user " + mProfileUserId);
StringBuilder logStr = new StringBuilder().append("profileId: ").append(mProfileUserId);
for (String str : tokens) {
logStr.append(str).append("\n");
}
updateWorkProfileSetupSuccessful("am start-user", output);
Log.d(WORK_TAB_MISSING, "workProfileSuccessful? " + mWorkProfileSetupSuccessful);
if (!mWorkProfileSetupSuccessful) {
return; // no need to setup launcher since all tests will skip.
}
@@ -99,6 +105,7 @@ public class WorkProfileTest extends AbstractLauncherUiTest {
private void waitForWorkTabSetup() {
waitForLauncherCondition("Work tab not setup", launcher -> {
if (launcher.getAppsView().getContentView() instanceof AllAppsPagedView) {
Log.d(WORK_TAB_MISSING, "Deferring AppsStore updates");
launcher.getAppsView().getAppsStore().enableDeferUpdates(DEFER_UPDATES_TEST);
return true;
}