From f6f192853d69229137339715ae2a9cb743c40369 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Wed, 5 Jul 2023 11:41:53 -0700 Subject: [PATCH] Cleanup WorkProfileTest logs Fixes: 243688989 Change-Id: Ic3f143062c1a1383d1e79959dae59c45743547e9 --- src/com/android/launcher3/LauncherModel.java | 9 --------- .../allapps/ActivityAllAppsContainerView.java | 10 ---------- .../android/launcher3/allapps/AllAppsStore.java | 6 ------ .../launcher3/allapps/WorkProfileManager.java | 10 ---------- .../launcher3/model/BaseModelUpdateTask.java | 16 +--------------- src/com/android/launcher3/model/LoaderTask.java | 3 --- .../launcher3/model/PackageUpdatedTask.java | 8 -------- .../model/UserLockStateChangedTask.java | 10 ---------- src/com/android/launcher3/pm/UserCache.java | 4 ---- .../launcher3/testing/shared/TestProtocol.java | 1 - .../android/launcher3/ui/WorkProfileTest.java | 6 ------ 11 files changed, 1 insertion(+), 82 deletions(-) diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java index ddafd539af..5f3d27c835 100644 --- a/src/com/android/launcher3/LauncherModel.java +++ b/src/com/android/launcher3/LauncherModel.java @@ -20,9 +20,7 @@ import static android.app.admin.DevicePolicyManager.ACTION_DEVICE_POLICY_RESOURC import static com.android.launcher3.LauncherAppState.ACTION_FORCE_ROLOAD; import static com.android.launcher3.config.FeatureFlags.IS_STUDIO_BUILD; -import static com.android.launcher3.testing.shared.TestProtocol.WORK_TAB_MISSING; import static com.android.launcher3.testing.shared.TestProtocol.sDebugTracing; -import static com.android.launcher3.testing.shared.TestProtocol.testLogD; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.launcher3.util.Executors.MODEL_EXECUTOR; @@ -69,7 +67,6 @@ import com.android.launcher3.pm.InstallSessionTracker; import com.android.launcher3.pm.PackageInstallInfo; import com.android.launcher3.pm.UserCache; import com.android.launcher3.shortcuts.ShortcutRequest; -import com.android.launcher3.testing.shared.TestProtocol; import com.android.launcher3.util.IntSet; import com.android.launcher3.util.ItemInfoMatcher; import com.android.launcher3.util.PackageUserKey; @@ -310,11 +307,6 @@ public class LauncherModel extends LauncherApps.Callback implements InstallSessi * @see UserCache#addUserEventListener */ public void onUserEvent(UserHandle user, String action) { - if (TestProtocol.sDebugTracing) { - Log.d(TestProtocol.WORK_TAB_MISSING, "onBroadcastIntent intentAction: " - + action + " user: " + user); - } - if (Intent.ACTION_MANAGED_PROFILE_AVAILABLE.equals(action) || Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE.equals(action)) { enqueueModelUpdateTask(new PackageUpdatedTask( @@ -562,7 +554,6 @@ public class LauncherModel extends LauncherApps.Callback implements InstallSessi synchronized (mLock) { // Everything loaded bind the data. mModelLoaded = true; - testLogD(WORK_TAB_MISSING, "launcher model loaded"); } } diff --git a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java index cb4012f788..9dc82bdd98 100644 --- a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java @@ -22,7 +22,6 @@ import static com.android.launcher3.config.FeatureFlags.ENABLE_ALL_APPS_RV_PREIN 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; @@ -79,7 +78,6 @@ 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; @@ -209,10 +207,6 @@ public class ActivityAllAppsContainerView mNavBarScrimPaint.setColor(Themes.getNavBarScrimColor(mActivityContext)); AllAppsStore.OnUpdateListener onAppsUpdated = this::onAppsUpdated; - if (TestProtocol.sDebugTracing) { - Log.d(WORK_TAB_MISSING, "ActivityAllAppsContainer#init registeringListener: " + - onAppsUpdated); - } mAllAppsStore.addUpdateListener(onAppsUpdated); // This is a focus listener that proxies focus from a view into the list view. This is to @@ -950,10 +944,6 @@ public class ActivityAllAppsContainerView 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) { diff --git a/src/com/android/launcher3/allapps/AllAppsStore.java b/src/com/android/launcher3/allapps/AllAppsStore.java index ac48709d09..c3d0e6b530 100644 --- a/src/com/android/launcher3/allapps/AllAppsStore.java +++ b/src/com/android/launcher3/allapps/AllAppsStore.java @@ -19,11 +19,9 @@ import static com.android.launcher3.config.FeatureFlags.ENABLE_ALL_APPS_RV_PREIN 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.content.Context; import android.os.UserHandle; -import android.util.Log; import android.view.View; import android.view.ViewGroup; @@ -35,7 +33,6 @@ import com.android.launcher3.BubbleTextView; import com.android.launcher3.model.data.AppInfo; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.recyclerview.AllAppsRecyclerViewPool; -import com.android.launcher3.testing.shared.TestProtocol; import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.PackageUserKey; import com.android.launcher3.views.ActivityContext; @@ -158,9 +155,6 @@ public class AllAppsStore { return; } for (OnUpdateListener listener : mUpdateListeners) { - if (TestProtocol.sDebugTracing) { - Log.d(WORK_TAB_MISSING, "AllAppsStore#notifyUpdate listener: " + listener); - } listener.onAppsUpdated(); } } diff --git a/src/com/android/launcher3/allapps/WorkProfileManager.java b/src/com/android/launcher3/allapps/WorkProfileManager.java index 44c233f557..1ac8d87a77 100644 --- a/src/com/android/launcher3/allapps/WorkProfileManager.java +++ b/src/com/android/launcher3/allapps/WorkProfileManager.java @@ -25,7 +25,6 @@ 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; @@ -47,7 +46,6 @@ 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; @@ -144,10 +142,6 @@ 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(); @@ -166,10 +160,6 @@ 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"); diff --git a/src/com/android/launcher3/model/BaseModelUpdateTask.java b/src/com/android/launcher3/model/BaseModelUpdateTask.java index 866e222592..97f540e1db 100644 --- a/src/com/android/launcher3/model/BaseModelUpdateTask.java +++ b/src/com/android/launcher3/model/BaseModelUpdateTask.java @@ -15,9 +15,6 @@ */ package com.android.launcher3.model; -import static com.android.launcher3.testing.shared.TestProtocol.WORK_TAB_MISSING; -import static com.android.launcher3.testing.shared.TestProtocol.testLogD; - import android.util.Log; import androidx.annotation.NonNull; @@ -33,7 +30,6 @@ import com.android.launcher3.model.BgDataModel.FixedContainerItems; import com.android.launcher3.model.data.AppInfo; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.WorkspaceItemInfo; -import com.android.launcher3.testing.shared.TestProtocol; import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.PackageUserKey; import com.android.launcher3.widget.model.WidgetsListBaseEntry; @@ -77,7 +73,6 @@ public abstract class BaseModelUpdateTask implements ModelUpdateTask { @Override public final void run() { boolean isModelLoaded = Objects.requireNonNull(mModel).isModelLoaded(); - testLogD(WORK_TAB_MISSING, "modelLoaded: " + isModelLoaded + " forTask: " + this); if (!isModelLoaded) { if (DEBUG_TASKS) { Log.d(TAG, "Ignoring model task since loader is pending=" + this); @@ -115,10 +110,6 @@ public abstract class BaseModelUpdateTask implements ModelUpdateTask { List workspaceUpdates = allUpdates.stream() .filter(info -> info.id != ItemInfo.NO_ID) .collect(Collectors.toList()); - if (TestProtocol.sDebugTracing) { - Log.d(WORK_TAB_MISSING, "allUpdates: " + allUpdates.size() + ", workspaceUpdates " - + workspaceUpdates.size()); - } if (!workspaceUpdates.isEmpty()) { scheduleCallbackTask(c -> c.bindWorkspaceItemsChanged(workspaceUpdates)); } @@ -157,12 +148,7 @@ public abstract class BaseModelUpdateTask implements ModelUpdateTask { } public void bindApplicationsIfNeeded() { - boolean changeFlag = mAllAppsList.getAndResetChangeFlag(); - if (TestProtocol.sDebugTracing) { - Log.d(WORK_TAB_MISSING, "bindApplicationsIfNeeded changeFlag? " + - changeFlag); - } - if (changeFlag) { + if (mAllAppsList.getAndResetChangeFlag()) { AppInfo[] apps = mAllAppsList.copyData(); int flags = mAllAppsList.getFlags(); Map packageUserKeytoUidMap = Arrays.stream(apps).collect( diff --git a/src/com/android/launcher3/model/LoaderTask.java b/src/com/android/launcher3/model/LoaderTask.java index 3daf4af159..787ac38c26 100644 --- a/src/com/android/launcher3/model/LoaderTask.java +++ b/src/com/android/launcher3/model/LoaderTask.java @@ -24,8 +24,6 @@ import static com.android.launcher3.model.ModelUtils.filterCurrentWorkspaceItems import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_DISABLED_LOCKED_USER; import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_DISABLED_SAFEMODE; import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_DISABLED_SUSPENDED; -import static com.android.launcher3.testing.shared.TestProtocol.WORK_TAB_MISSING; -import static com.android.launcher3.testing.shared.TestProtocol.testLogD; import static com.android.launcher3.util.Executors.MODEL_EXECUTOR; import static com.android.launcher3.util.PackageManagerHelper.hasShortcutsPermission; import static com.android.launcher3.util.PackageManagerHelper.isSystemApp; @@ -932,7 +930,6 @@ public class LoaderTask implements Runnable { } private List loadAllApps() { - testLogD(WORK_TAB_MISSING, "loadingAllApps"); final List profiles = mUserCache.getUserProfiles(); List allActivityList = new ArrayList<>(); // Clear the list of apps diff --git a/src/com/android/launcher3/model/PackageUpdatedTask.java b/src/com/android/launcher3/model/PackageUpdatedTask.java index 8c938f4124..2591550765 100644 --- a/src/com/android/launcher3/model/PackageUpdatedTask.java +++ b/src/com/android/launcher3/model/PackageUpdatedTask.java @@ -93,11 +93,6 @@ public class PackageUpdatedTask extends BaseModelUpdateTask { mOp = op; mUser = user; mPackages = packages; - if (TestProtocol.sDebugTracing) { - Log.d(TestProtocol.WORK_TAB_MISSING, "PackageUpdatedTask mOp: " + mOp + - " packageCount: " + mPackages.length + " user: " + user); - DEBUG = true; - } } @Override @@ -142,9 +137,6 @@ public class PackageUpdatedTask extends BaseModelUpdateTask { // The update may have changed which shortcuts/widgets are available. // Refresh the widgets for the package if we have an activity running. Launcher launcher = Launcher.ACTIVITY_TRACKER.getCreatedActivity(); - if (TestProtocol.sDebugTracing) { - Log.d(TestProtocol.WORK_TAB_MISSING, "launcher: " + launcher); - } if (launcher != null) { launcher.refreshAndBindWidgetsForPackageUser( new PackageUserKey(packages[i], mUser)); diff --git a/src/com/android/launcher3/model/UserLockStateChangedTask.java b/src/com/android/launcher3/model/UserLockStateChangedTask.java index cb78138459..63ca35b79c 100644 --- a/src/com/android/launcher3/model/UserLockStateChangedTask.java +++ b/src/com/android/launcher3/model/UserLockStateChangedTask.java @@ -16,12 +16,10 @@ package com.android.launcher3.model; import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_DISABLED_LOCKED_USER; -import static com.android.launcher3.testing.shared.TestProtocol.WORK_TAB_MISSING; import android.content.Context; import android.content.pm.ShortcutInfo; import android.os.UserHandle; -import android.util.Log; import androidx.annotation.NonNull; @@ -31,7 +29,6 @@ import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.shortcuts.ShortcutKey; import com.android.launcher3.shortcuts.ShortcutRequest; import com.android.launcher3.shortcuts.ShortcutRequest.QueryResult; -import com.android.launcher3.testing.shared.TestProtocol; import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.ItemInfoMatcher; @@ -63,10 +60,6 @@ public class UserLockStateChangedTask extends BaseModelUpdateTask { if (mIsUserUnlocked) { QueryResult shortcuts = new ShortcutRequest(context, mUser) .query(ShortcutRequest.PINNED); - if (TestProtocol.sDebugTracing) { - Log.d(WORK_TAB_MISSING, "shortcutQuery success? " - + shortcuts.wasSuccess()); - } if (shortcuts.wasSuccess()) { for (ShortcutInfo shortcut : shortcuts) { pinnedShortcuts.put(ShortcutKey.fromInfo(shortcut), shortcut); @@ -89,9 +82,6 @@ public class UserLockStateChangedTask extends BaseModelUpdateTask { if (mIsUserUnlocked) { ShortcutKey key = ShortcutKey.fromItemInfo(si); ShortcutInfo shortcut = pinnedShortcuts.get(key); - if (TestProtocol.sDebugTracing) { - Log.d(WORK_TAB_MISSING, "shortcutInfo: " + shortcut); - } // We couldn't verify the shortcut during loader. If its no longer available // (probably due to clear data), delete the workspace item as well if (shortcut == null) { diff --git a/src/com/android/launcher3/pm/UserCache.java b/src/com/android/launcher3/pm/UserCache.java index c3138865fa..92822ab79a 100644 --- a/src/com/android/launcher3/pm/UserCache.java +++ b/src/com/android/launcher3/pm/UserCache.java @@ -17,8 +17,6 @@ package com.android.launcher3.pm; import static com.android.launcher3.Utilities.ATLEAST_U; -import static com.android.launcher3.testing.shared.TestProtocol.WORK_TAB_MISSING; -import static com.android.launcher3.testing.shared.TestProtocol.testLogD; import static com.android.launcher3.util.Executors.MODEL_EXECUTOR; import android.content.Context; @@ -94,8 +92,6 @@ public class UserCache implements SafeCloseable { @AnyThread private void onUsersChanged(Intent intent) { - testLogD(WORK_TAB_MISSING, "onUsersChanged intent: " + intent); - MODEL_EXECUTOR.execute(this::updateCache); UserHandle user = intent.getParcelableExtra(Intent.EXTRA_USER); if (user == null) { diff --git a/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java b/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java index 84c35557e6..4073517b5e 100644 --- a/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java +++ b/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java @@ -154,7 +154,6 @@ public final class TestProtocol { public static final String REQUEST_MOCK_SENSOR_ROTATION = "mock-sensor-rotation"; public static final String PERMANENT_DIAG_TAG = "TaplTarget"; - public static final String WORK_TAB_MISSING = "b/243688989"; public static final String TWO_TASKBAR_LONG_CLICKS = "b/262282528"; public static final String FLAKY_ACTIVITY_COUNT = "b/260260325"; public static final String ICON_MISSING = "b/282963545"; diff --git a/tests/src/com/android/launcher3/ui/WorkProfileTest.java b/tests/src/com/android/launcher3/ui/WorkProfileTest.java index 026766c7f4..72373875d6 100644 --- a/tests/src/com/android/launcher3/ui/WorkProfileTest.java +++ b/tests/src/com/android/launcher3/ui/WorkProfileTest.java @@ -18,7 +18,6 @@ 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 com.android.launcher3.util.TestUtil.installDummyAppForUser; import static com.android.launcher3.util.rule.TestStabilityRule.LOCAL; import static com.android.launcher3.util.rule.TestStabilityRule.PLATFORM_POSTSUBMIT; @@ -39,7 +38,6 @@ import com.android.launcher3.allapps.WorkEduCard; import com.android.launcher3.allapps.WorkPausedCard; import com.android.launcher3.allapps.WorkProfileManager; import com.android.launcher3.tapl.LauncherInstrumentation; -import com.android.launcher3.testing.shared.TestProtocol; import com.android.launcher3.util.TestUtil; import com.android.launcher3.util.rule.TestStabilityRule.Stability; @@ -78,8 +76,6 @@ public class WorkProfileTest extends AbstractLauncherUiTest { installDummyAppForUser(mProfileUserId); updateWorkProfileSetupSuccessful("am start-user", output); - Log.d(WORK_TAB_MISSING, "workProfileSuccessful? " + mWorkProfileSetupSuccessful + - " shellCmd: " + logStr); if (!mWorkProfileSetupSuccessful) { return; // no need to setup launcher since all tests will skip. } @@ -96,7 +92,6 @@ public class WorkProfileTest extends AbstractLauncherUiTest { @After public void removeWorkProfile() throws Exception { - Log.d(TestProtocol.WORK_TAB_MISSING, "WorkProfileTest teardown"); executeOnLauncher(launcher -> { if (launcher == null || launcher.getAppsView() == null) { return; @@ -112,7 +107,6 @@ public class WorkProfileTest extends AbstractLauncherUiTest { mLauncher.getAllApps(); 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; }