Loading src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java +12 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ import static com.android.launcher3.allapps.ActivityAllAppsContainerView.Adapter import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_COUNT; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_TAP_ON_PERSONAL_TAB; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_TAP_ON_WORK_TAB; import static com.android.launcher3.testing.shared.TestProtocol.WORK_TAB_MISSING; import static com.android.launcher3.util.ScrollableLayoutManager.PREDICTIVE_BACK_MIN_SCALE; import android.animation.Animator; Loading Loading @@ -73,6 +74,7 @@ import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.keyboard.FocusedItemDecorator; import com.android.launcher3.model.StringCache; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.testing.shared.TestProtocol; import com.android.launcher3.util.ItemInfoMatcher; import com.android.launcher3.util.Themes; import com.android.launcher3.views.ActivityContext; Loading Loading @@ -183,7 +185,12 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext> mNavBarScrimPaint = new Paint(); mNavBarScrimPaint.setColor(Themes.getAttrColor(context, R.attr.allAppsNavBarScrimColor)); mAllAppsStore.addUpdateListener(this::onAppsUpdated); AllAppsStore.OnUpdateListener onAppsUpdated = this::onAppsUpdated; if (TestProtocol.sDebugTracing) { Log.d(WORK_TAB_MISSING, "ActivityAllAppsContainer#init registeringListener: " + onAppsUpdated); } mAllAppsStore.addUpdateListener(onAppsUpdated); mActivityContext.addOnDeviceProfileChangeListener(this); // This is a focus listener that proxies focus from a view into the list view. This is to Loading Loading @@ -809,6 +816,10 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext> private void onAppsUpdated() { mHasWorkApps = Stream.of(mAllAppsStore.getApps()).anyMatch(mWorkManager.getMatcher()); if (TestProtocol.sDebugTracing) { Log.d(WORK_TAB_MISSING, "ActivityAllAppsContainerView#onAppsUpdated hasWorkApps: " + mHasWorkApps + " allApps: " + mAllAppsStore.getApps().length); } if (!isSearching()) { rebindAdapters(); if (mHasWorkApps) { Loading src/com/android/launcher3/allapps/AllAppsStore.java +6 −0 Original line number Diff line number Diff line Loading @@ -18,7 +18,9 @@ package com.android.launcher3.allapps; import static com.android.launcher3.model.data.AppInfo.COMPONENT_KEY_COMPARATOR; import static com.android.launcher3.model.data.AppInfo.EMPTY_ARRAY; import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_SHOW_DOWNLOAD_PROGRESS_MASK; import static com.android.launcher3.testing.shared.TestProtocol.WORK_TAB_MISSING; import android.util.Log; import android.view.View; import android.view.ViewGroup; Loading @@ -27,6 +29,7 @@ import androidx.annotation.Nullable; import com.android.launcher3.BubbleTextView; import com.android.launcher3.model.data.AppInfo; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.testing.shared.TestProtocol; import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.PackageUserKey; Loading Loading @@ -119,6 +122,9 @@ public class AllAppsStore { return; } for (OnUpdateListener listener : mUpdateListeners) { if (TestProtocol.sDebugTracing) { Log.d(WORK_TAB_MISSING, "AllAppsStore#notifyUpdate listener: " + listener); } listener.onAppsUpdated(); } } Loading src/com/android/launcher3/allapps/WorkProfileManager.java +10 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH import static com.android.launcher3.model.BgDataModel.Callbacks.FLAG_HAS_SHORTCUT_PERMISSION; import static com.android.launcher3.model.BgDataModel.Callbacks.FLAG_QUIET_MODE_CHANGE_PERMISSION; import static com.android.launcher3.model.BgDataModel.Callbacks.FLAG_QUIET_MODE_ENABLED; import static com.android.launcher3.testing.shared.TestProtocol.WORK_TAB_MISSING; import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import android.os.Build; Loading @@ -46,6 +47,7 @@ import com.android.launcher3.Utilities; import com.android.launcher3.allapps.BaseAllAppsAdapter.AdapterItem; import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.testing.shared.TestProtocol; import com.android.launcher3.workprofile.PersonalWorkSlidingTabStrip; import java.lang.annotation.Retention; Loading Loading @@ -137,6 +139,10 @@ public class WorkProfileManager implements PersonalWorkSlidingTabStrip.OnActiveP } private void updateCurrentState(@WorkProfileState int currentState) { if (TestProtocol.sDebugTracing) { Log.d(WORK_TAB_MISSING, "WorkProfileManager#updateCurrentState: " + currentState, new Throwable()); } mCurrentState = currentState; if (getAH() != null) { getAH().mAppsList.updateAdapterItems(); Loading @@ -155,6 +161,10 @@ public class WorkProfileManager implements PersonalWorkSlidingTabStrip.OnActiveP * Creates and attaches for profile toggle button to {@link ActivityAllAppsContainerView} */ public boolean attachWorkModeSwitch() { if (TestProtocol.sDebugTracing) { Log.d(WORK_TAB_MISSING, "ActivityAllAppsContainerView#attachWorkModeSwitch " + "mWorkModeSwitch: " + mWorkModeSwitch); } if (!mAllApps.getAppsStore().hasModelFlag( FLAG_HAS_SHORTCUT_PERMISSION | FLAG_QUIET_MODE_CHANGE_PERMISSION)) { Log.e(TAG, "unable to attach work mode switch; Missing required permissions"); Loading tests/shared/com/android/launcher3/testing/shared/TestProtocol.java +1 −0 Original line number Diff line number Diff line Loading @@ -157,6 +157,7 @@ public final class TestProtocol { public static final String NPE_TRANSIENT_TASKBAR = "b/257549303"; public static final String FLAKY_BINDING = "b/270216650"; public static final String VIEW_AND_ACTIVITY_LEAKS = "b/260260325"; public static final String WORK_TAB_MISSING = "b/243688989"; public static final String REQUEST_EMULATE_DISPLAY = "emulate-display"; public static final String REQUEST_STOP_EMULATE_DISPLAY = "stop-emulate-display"; Loading tests/src/com/android/launcher3/ui/WorkProfileTest.java +7 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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. } Loading Loading @@ -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; } Loading Loading
src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java +12 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ import static com.android.launcher3.allapps.ActivityAllAppsContainerView.Adapter import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_COUNT; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_TAP_ON_PERSONAL_TAB; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_TAP_ON_WORK_TAB; import static com.android.launcher3.testing.shared.TestProtocol.WORK_TAB_MISSING; import static com.android.launcher3.util.ScrollableLayoutManager.PREDICTIVE_BACK_MIN_SCALE; import android.animation.Animator; Loading Loading @@ -73,6 +74,7 @@ import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.keyboard.FocusedItemDecorator; import com.android.launcher3.model.StringCache; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.testing.shared.TestProtocol; import com.android.launcher3.util.ItemInfoMatcher; import com.android.launcher3.util.Themes; import com.android.launcher3.views.ActivityContext; Loading Loading @@ -183,7 +185,12 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext> mNavBarScrimPaint = new Paint(); mNavBarScrimPaint.setColor(Themes.getAttrColor(context, R.attr.allAppsNavBarScrimColor)); mAllAppsStore.addUpdateListener(this::onAppsUpdated); AllAppsStore.OnUpdateListener onAppsUpdated = this::onAppsUpdated; if (TestProtocol.sDebugTracing) { Log.d(WORK_TAB_MISSING, "ActivityAllAppsContainer#init registeringListener: " + onAppsUpdated); } mAllAppsStore.addUpdateListener(onAppsUpdated); mActivityContext.addOnDeviceProfileChangeListener(this); // This is a focus listener that proxies focus from a view into the list view. This is to Loading Loading @@ -809,6 +816,10 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext> private void onAppsUpdated() { mHasWorkApps = Stream.of(mAllAppsStore.getApps()).anyMatch(mWorkManager.getMatcher()); if (TestProtocol.sDebugTracing) { Log.d(WORK_TAB_MISSING, "ActivityAllAppsContainerView#onAppsUpdated hasWorkApps: " + mHasWorkApps + " allApps: " + mAllAppsStore.getApps().length); } if (!isSearching()) { rebindAdapters(); if (mHasWorkApps) { Loading
src/com/android/launcher3/allapps/AllAppsStore.java +6 −0 Original line number Diff line number Diff line Loading @@ -18,7 +18,9 @@ package com.android.launcher3.allapps; import static com.android.launcher3.model.data.AppInfo.COMPONENT_KEY_COMPARATOR; import static com.android.launcher3.model.data.AppInfo.EMPTY_ARRAY; import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_SHOW_DOWNLOAD_PROGRESS_MASK; import static com.android.launcher3.testing.shared.TestProtocol.WORK_TAB_MISSING; import android.util.Log; import android.view.View; import android.view.ViewGroup; Loading @@ -27,6 +29,7 @@ import androidx.annotation.Nullable; import com.android.launcher3.BubbleTextView; import com.android.launcher3.model.data.AppInfo; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.testing.shared.TestProtocol; import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.PackageUserKey; Loading Loading @@ -119,6 +122,9 @@ public class AllAppsStore { return; } for (OnUpdateListener listener : mUpdateListeners) { if (TestProtocol.sDebugTracing) { Log.d(WORK_TAB_MISSING, "AllAppsStore#notifyUpdate listener: " + listener); } listener.onAppsUpdated(); } } Loading
src/com/android/launcher3/allapps/WorkProfileManager.java +10 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH import static com.android.launcher3.model.BgDataModel.Callbacks.FLAG_HAS_SHORTCUT_PERMISSION; import static com.android.launcher3.model.BgDataModel.Callbacks.FLAG_QUIET_MODE_CHANGE_PERMISSION; import static com.android.launcher3.model.BgDataModel.Callbacks.FLAG_QUIET_MODE_ENABLED; import static com.android.launcher3.testing.shared.TestProtocol.WORK_TAB_MISSING; import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import android.os.Build; Loading @@ -46,6 +47,7 @@ import com.android.launcher3.Utilities; import com.android.launcher3.allapps.BaseAllAppsAdapter.AdapterItem; import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.testing.shared.TestProtocol; import com.android.launcher3.workprofile.PersonalWorkSlidingTabStrip; import java.lang.annotation.Retention; Loading Loading @@ -137,6 +139,10 @@ public class WorkProfileManager implements PersonalWorkSlidingTabStrip.OnActiveP } private void updateCurrentState(@WorkProfileState int currentState) { if (TestProtocol.sDebugTracing) { Log.d(WORK_TAB_MISSING, "WorkProfileManager#updateCurrentState: " + currentState, new Throwable()); } mCurrentState = currentState; if (getAH() != null) { getAH().mAppsList.updateAdapterItems(); Loading @@ -155,6 +161,10 @@ public class WorkProfileManager implements PersonalWorkSlidingTabStrip.OnActiveP * Creates and attaches for profile toggle button to {@link ActivityAllAppsContainerView} */ public boolean attachWorkModeSwitch() { if (TestProtocol.sDebugTracing) { Log.d(WORK_TAB_MISSING, "ActivityAllAppsContainerView#attachWorkModeSwitch " + "mWorkModeSwitch: " + mWorkModeSwitch); } if (!mAllApps.getAppsStore().hasModelFlag( FLAG_HAS_SHORTCUT_PERMISSION | FLAG_QUIET_MODE_CHANGE_PERMISSION)) { Log.e(TAG, "unable to attach work mode switch; Missing required permissions"); Loading
tests/shared/com/android/launcher3/testing/shared/TestProtocol.java +1 −0 Original line number Diff line number Diff line Loading @@ -157,6 +157,7 @@ public final class TestProtocol { public static final String NPE_TRANSIENT_TASKBAR = "b/257549303"; public static final String FLAKY_BINDING = "b/270216650"; public static final String VIEW_AND_ACTIVITY_LEAKS = "b/260260325"; public static final String WORK_TAB_MISSING = "b/243688989"; public static final String REQUEST_EMULATE_DISPLAY = "emulate-display"; public static final String REQUEST_STOP_EMULATE_DISPLAY = "stop-emulate-display"; Loading
tests/src/com/android/launcher3/ui/WorkProfileTest.java +7 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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. } Loading Loading @@ -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; } Loading