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

Commit 3e25f291 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add log dumps for taskbar state"

parents 072b1f01 fa0bfee9
Loading
Loading
Loading
Loading
+40 −1
Original line number Diff line number Diff line
@@ -73,15 +73,18 @@ import com.android.quickstep.AnimatedFloat;
import com.android.systemui.shared.rotation.FloatingRotationButton;
import com.android.systemui.shared.rotation.RotationButton;
import com.android.systemui.shared.rotation.RotationButtonController;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.ViewTreeObserverWrapper;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringJoiner;
import java.util.function.IntPredicate;

/**
 * Controller for managing nav bar buttons in taskbar
 */
public class NavbarButtonsViewController {
public class NavbarButtonsViewController implements TaskbarControllers.LoggableTaskbarController {

    private final Rect mTempRect = new Rect();

@@ -631,6 +634,42 @@ public class NavbarButtonsViewController {
        insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION);
    }

    @Override
    public void dumpLogs(String prefix, PrintWriter pw) {
        pw.println(prefix + "NavbarButtonsViewController:");

        pw.println(String.format("%s\tmState=%s", prefix, getStateString(mState)));
        pw.println(String.format(
                "%s\tmLightIconColor=0x%s", prefix, Integer.toHexString(mLightIconColor)));
        pw.println(String.format(
                "%s\tmDarkIconColor=0x%s", prefix, Integer.toHexString(mDarkIconColor)));
        pw.println(String.format(
                "%s\tmFloatingRotationButtonBounds=%s", prefix, mFloatingRotationButtonBounds));
        pw.println(String.format(
                "%s\tmSysuiStateFlags=%s",
                prefix,
                QuickStepContract.getSystemUiStateString(mSysuiStateFlags)));
    }

    private static String getStateString(int flags) {
        StringJoiner str = new StringJoiner("|");
        str.add((flags & FLAG_SWITCHER_SUPPORTED) != 0 ? "FLAG_SWITCHER_SUPPORTED" : "");
        str.add((flags & FLAG_IME_VISIBLE) != 0 ? "FLAG_IME_VISIBLE" : "");
        str.add((flags & FLAG_ROTATION_BUTTON_VISIBLE) != 0 ? "FLAG_ROTATION_BUTTON_VISIBLE" : "");
        str.add((flags & FLAG_A11Y_VISIBLE) != 0 ? "FLAG_A11Y_VISIBLE" : "");
        str.add((flags & FLAG_ONLY_BACK_FOR_BOUNCER_VISIBLE) != 0
                ? "FLAG_ONLY_BACK_FOR_BOUNCER_VISIBLE" : "");
        str.add((flags & FLAG_KEYGUARD_VISIBLE) != 0 ? "FLAG_KEYGUARD_VISIBLE" : "");
        str.add((flags & FLAG_KEYGUARD_OCCLUDED) != 0 ? "FLAG_KEYGUARD_OCCLUDED" : "");
        str.add((flags & FLAG_DISABLE_HOME) != 0 ? "FLAG_DISABLE_HOME" : "");
        str.add((flags & FLAG_DISABLE_RECENTS) != 0 ? "FLAG_DISABLE_RECENTS" : "");
        str.add((flags & FLAG_DISABLE_BACK) != 0 ? "FLAG_DISABLE_BACK" : "");
        str.add((flags & FLAG_NOTIFICATION_SHADE_EXPANDED) != 0
                ? "FLAG_NOTIFICATION_SHADE_EXPANDED" : "");
        str.add((flags & FLAG_SCREEN_PINNING_ACTIVE) != 0 ? "FLAG_SCREEN_PINNING_ACTIVE" : "");
        return str.toString();
    }

    private class RotationButtonListener implements RotationButton.RotationButtonUpdatesCallback {
        @Override
        public void onVisibilityChanged(boolean isVisible) {
+14 −1
Original line number Diff line number Diff line
@@ -34,10 +34,12 @@ import com.android.launcher3.util.MultiValueAlpha;
import com.android.quickstep.AnimatedFloat;
import com.android.systemui.shared.navigationbar.RegionSamplingHelper;

import java.io.PrintWriter;

/**
 * Handles properties/data collection, then passes the results to our stashed handle View to render.
 */
public class StashedHandleViewController {
public class StashedHandleViewController implements TaskbarControllers.LoggableTaskbarController {

    public static final int ALPHA_INDEX_STASHED = 0;
    public static final int ALPHA_INDEX_HOME_DISABLED = 1;
@@ -200,4 +202,15 @@ public class StashedHandleViewController {
    public boolean isStashedHandleVisible() {
        return mStashedHandleView.getVisibility() == View.VISIBLE;
    }

    @Override
    public void dumpLogs(String prefix, PrintWriter pw) {
        pw.println(prefix + "StashedHandleViewController:");

        pw.println(String.format(
                "%s\tisStashedHandleVisible=%b", prefix, isStashedHandleVisible()));
        pw.println(String.format("%s\tmStashedHandleWidth=%dpx", prefix, mStashedHandleWidth));
        pw.println(String.format("%s\tmStashedHandleHeight=%dpx", prefix, mStashedHandleHeight));
        mRegionSamplingHelper.dump(prefix, pw);
    }
}
+14 −0
Original line number Diff line number Diff line
@@ -83,6 +83,8 @@ import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.WindowManagerWrapper;
import com.android.systemui.unfold.util.ScopedUnfoldTransitionProgressProvider;

import java.io.PrintWriter;

/**
 * The {@link ActivityContext} with which we inflate Taskbar-related Views. This allows UI elements
 * that are used by both Launcher and Taskbar (such as Folder) to reference a generic
@@ -670,4 +672,16 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ
        setTaskbarWindowFullscreen(true);
        btv.post(() -> mControllers.taskbarPopupController.showForIcon(btv));
    }

    protected void dumpLogs(String prefix, PrintWriter pw) {
        pw.println(prefix + "TaskbarActivityContext:");

        pw.println(String.format(
                "%s\tmNavMode=%s", prefix, mNavMode));
        pw.println(String.format(
                "%s\tmIsUserSetupComplete=%b", prefix, mIsUserSetupComplete));
        pw.println(String.format(
                "%s\tmWindowLayoutParams.height=%dpx", prefix, mWindowLayoutParams.height));
        mControllers.dumpLogs(prefix + "\t", pw);
    }
}
+22 −1
Original line number Diff line number Diff line
@@ -19,17 +19,21 @@ import androidx.annotation.IntDef;

import com.android.quickstep.SystemUiProxy;

import java.io.PrintWriter;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.StringJoiner;

/**
 * Normally Taskbar will auto-hide when entering immersive (fullscreen) apps. This controller allows
 * us to suspend that behavior in certain cases (e.g. opening a Folder or dragging an icon).
 */
public class TaskbarAutohideSuspendController {
public class TaskbarAutohideSuspendController implements
        TaskbarControllers.LoggableTaskbarController {

    public static final int FLAG_AUTOHIDE_SUSPEND_FULLSCREEN = 1 << 0;
    public static final int FLAG_AUTOHIDE_SUSPEND_DRAGGING = 1 << 1;

    @IntDef(flag = true, value = {
            FLAG_AUTOHIDE_SUSPEND_FULLSCREEN,
            FLAG_AUTOHIDE_SUSPEND_DRAGGING,
@@ -60,4 +64,21 @@ public class TaskbarAutohideSuspendController {
        }
        mSystemUiProxy.notifyTaskbarAutohideSuspend(mAutohideSuspendFlags != 0);
    }

    @Override
    public void dumpLogs(String prefix, PrintWriter pw) {
        pw.println(prefix + "TaskbarAutohideSuspendController:");

        pw.println(String.format(
                "%s\tmAutohideSuspendFlags=%s", prefix, getStateString(mAutohideSuspendFlags)));
    }

    private static String getStateString(int flags) {
        StringJoiner str = new StringJoiner("|");
        str.add((flags & FLAG_AUTOHIDE_SUSPEND_FULLSCREEN) != 0
                ? "FLAG_AUTOHIDE_SUSPEND_FULLSCREEN" : "");
        str.add((flags & FLAG_AUTOHIDE_SUSPEND_DRAGGING) != 0
                ? "FLAG_AUTOHIDE_SUSPEND_DRAGGING" : "");
        return str.toString();
    }
}
+34 −0
Original line number Diff line number Diff line
@@ -18,9 +18,11 @@ package com.android.launcher3.taskbar;
import android.content.pm.ActivityInfo.Config;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.android.systemui.shared.rotation.RotationButtonController;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;

@@ -30,6 +32,7 @@ import java.util.List;
public class TaskbarControllers {

    public final TaskbarActivityContext taskbarActivityContext;

    public final TaskbarDragController taskbarDragController;
    public final TaskbarNavButtonController navButtonController;
    public final NavbarButtonsViewController navbarButtonsViewController;
@@ -45,6 +48,8 @@ public class TaskbarControllers {
    public final TaskbarAutohideSuspendController taskbarAutohideSuspendController;
    public final TaskbarPopupController taskbarPopupController;

    @Nullable private LoggableTaskbarController[] mControllersToLog = null;

    /** Do not store this controller, as it may change at runtime. */
    @NonNull public TaskbarUIController uiController = TaskbarUIController.DEFAULT;

@@ -104,6 +109,14 @@ public class TaskbarControllers {
        taskbarEduController.init(this);
        taskbarPopupController.init(this);

        mControllersToLog = new LoggableTaskbarController[] {
                taskbarDragController, navButtonController, navbarButtonsViewController,
                taskbarDragLayerController, taskbarScrimViewController, taskbarViewController,
                taskbarUnfoldAnimationController, taskbarKeyguardController,
                stashedHandleViewController, taskbarStashController, taskbarEduController,
                taskbarAutohideSuspendController, taskbarPopupController
        };

        mAreAllControllersInitialized = true;
        for (Runnable postInitCallback : mPostInitCallbacks) {
            postInitCallback.run();
@@ -129,6 +142,8 @@ public class TaskbarControllers {
        stashedHandleViewController.onDestroy();
        taskbarAutohideSuspendController.onDestroy();
        taskbarPopupController.onDestroy();

        mControllersToLog = null;
    }

    /**
@@ -143,4 +158,23 @@ public class TaskbarControllers {
            mPostInitCallbacks.add(callback);
        }
    }

    protected void dumpLogs(String prefix, PrintWriter pw) {
        pw.println(prefix + "TaskbarControllers:");

        if (mControllersToLog == null) {
            pw.println(String.format(
                    "%s\t%s", prefix, "All taskbar controllers have already been destroyed."));
            return;
        }

        for (LoggableTaskbarController controller : mControllersToLog) {
            controller.dumpLogs(prefix + "\t", pw);
        }
        rotationButtonController.dumpLogs(prefix + "\t", pw);
    }

    protected interface LoggableTaskbarController {
        void dumpLogs(String prefix, PrintWriter pw);
    }
}
Loading