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

Commit a79d4607 authored by Mike Schneider's avatar Mike Schneider
Browse files

Add optional debug logging to on flag changes

FlagDebugUtils.formatFlagChange() utility to always write the set of
updated flags, with a list of actual changes applied. Examples:

[allow_gesture|device_dozing] +[device_dozing]
[] -[state_started]

Additionally, moved the appendFlag utility to the new FlagDebugUtils

Test: manually verifed the output in logcat
Bug: 261418621
Change-Id: Ie4f2cfcd4b34f0a816db7845e1df4331babed07a
parent 51a86489
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_IM
import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_RECENTS;
import static com.android.launcher3.taskbar.TaskbarViewController.ALPHA_INDEX_KEYGUARD;
import static com.android.launcher3.taskbar.TaskbarViewController.ALPHA_INDEX_SMALL_SCREEN;
import static com.android.launcher3.taskbar.Utilities.appendFlag;
import static com.android.launcher3.util.FlagDebugUtils.appendFlag;
import static com.android.launcher3.util.MultiPropertyFactory.MULTI_PROPERTY_VALUE;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A11Y_BUTTON_CLICKABLE;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE;
+1 −1
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
 */
package com.android.launcher3.taskbar;

import static com.android.launcher3.taskbar.Utilities.appendFlag;
import static com.android.launcher3.util.FlagDebugUtils.appendFlag;

import androidx.annotation.IntDef;

+9 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL;

import static com.android.launcher3.util.DisplayController.CHANGE_DENSITY;
import static com.android.launcher3.util.DisplayController.CHANGE_NAVIGATION_MODE;
import static com.android.launcher3.util.FlagDebugUtils.formatFlagChange;

import android.content.ComponentCallbacks;
import android.content.Context;
@@ -32,6 +33,7 @@ import android.net.Uri;
import android.os.Handler;
import android.os.SystemProperties;
import android.provider.Settings;
import android.util.Log;
import android.view.Display;

import androidx.annotation.NonNull;
@@ -51,6 +53,7 @@ import com.android.launcher3.util.SimpleBroadcastReceiver;
import com.android.quickstep.RecentsActivity;
import com.android.quickstep.SystemUiProxy;
import com.android.quickstep.TouchInteractionService;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.unfold.UnfoldTransitionProgressProvider;
import com.android.systemui.unfold.util.ScopedUnfoldTransitionProgressProvider;

@@ -60,6 +63,8 @@ import java.io.PrintWriter;
 * Class to manage taskbar lifecycle
 */
public class TaskbarManager {
    private static final String TAG = "TaskbarManager";
    private static final boolean DEBUG = false;

    public static final boolean FLAG_HIDE_NAVBAR_WINDOW =
            SystemProperties.getBoolean("persist.wm.debug.hide_navbar_window", false);
@@ -320,6 +325,10 @@ public class TaskbarManager {
    }

    public void onSystemUiFlagsChanged(int systemUiStateFlags) {
        if (DEBUG) {
            Log.d(TAG, "SysUI flags changed: " + formatFlagChange(systemUiStateFlags,
                    mSharedState.sysuiStateFlags, QuickStepContract::getSystemUiStateString));
        }
        mSharedState.sysuiStateFlags = systemUiStateFlags;
        if (mTaskbarActivityContext != null) {
            mTaskbarActivityContext.updateSysuiStateFlags(systemUiStateFlags, false /* fromInit */);
+15 −2
Original line number Diff line number Diff line
@@ -27,7 +27,8 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_LONGPRESS_SHOW;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TRANSIENT_TASKBAR_HIDE;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TRANSIENT_TASKBAR_SHOW;
import static com.android.launcher3.taskbar.Utilities.appendFlag;
import static com.android.launcher3.util.FlagDebugUtils.appendFlag;
import static com.android.launcher3.util.FlagDebugUtils.formatFlagChange;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BOUNCER_SHOWING;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_SHOWING;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_SWITCHER_SHOWING;
@@ -75,6 +76,8 @@ import java.util.function.IntPredicate;
 * create a cohesive animation between stashed/unstashed states.
 */
public class TaskbarStashController implements TaskbarControllers.LoggableTaskbarController {
    private static final String TAG = TaskbarStashController.class.getSimpleName();
    private static final boolean DEBUG = false;

    public static final int FLAG_IN_APP = 1 << 0;
    public static final int FLAG_STASHED_IN_APP_MANUAL = 1 << 1; // long press, persisted
@@ -1095,12 +1098,22 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
         */
        @Nullable
        public Animator createSetStateAnimator(int flags, long duration) {
            boolean isStashed = mStashCondition.test(flags);

            if (DEBUG) {
                String stateString = formatFlagChange(flags, mPrevFlags,
                            TaskbarStashController::getStateString);
                Log.d(TAG, "createSetStateAnimator: flags: " + stateString
                        + ", duration: " + duration
                        + ", isStashed: " + isStashed
                        + ", mIsStashed: " + mIsStashed);
            }

            int changedFlags = mPrevFlags ^ flags;
            if (mPrevFlags != flags) {
                onStateChangeApplied(changedFlags);
                mPrevFlags = flags;
            }
            boolean isStashed = mStashCondition.test(flags);
            boolean isHotseatIconOnTopWhenAligned =
                    mControllers.uiController.isHotseatIconOnTopWhenAligned();
            // If an animation has started and mIsHotseatIconOnTopWhenAligned is changed, we need
+0 −8
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package com.android.launcher3.taskbar;

import java.util.StringJoiner;

/**
 * Various utilities shared amongst the Taskbar's classes.
 */
@@ -25,12 +23,6 @@ public final class Utilities {

    private Utilities() {}

    static void appendFlag(StringJoiner str, int flags, int flag, String flagName) {
        if ((flags & flag) != 0) {
            str.add(flagName);
        }
    }

    /**
     * Sets drag, long-click, and split selection behavior on 1P and 3P launchers with Taskbar
     */
Loading