Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f6f19285 authored by Vinit Nayak's avatar Vinit Nayak
Browse files

Cleanup WorkProfileTest logs

Fixes: 243688989
Change-Id: Ic3f143062c1a1383d1e79959dae59c45743547e9
parent 1e3d799f
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -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");
            }
        }

+0 −10
Original line number Diff line number Diff line
@@ -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<T extends Context & ActivityContext>
        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<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) {
+0 −6
Original line number Diff line number Diff line
@@ -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<T extends Context & ActivityContext> {
            return;
        }
        for (OnUpdateListener listener : mUpdateListeners) {
            if (TestProtocol.sDebugTracing) {
                Log.d(WORK_TAB_MISSING, "AllAppsStore#notifyUpdate listener: " + listener);
            }
            listener.onAppsUpdated();
        }
    }
+0 −10
Original line number Diff line number Diff line
@@ -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");
+1 −15
Original line number Diff line number Diff line
@@ -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<WorkspaceItemInfo> 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<PackageUserKey, Integer> packageUserKeytoUidMap = Arrays.stream(apps).collect(
Loading