Loading core/java/com/android/internal/statusbar/IStatusBar.aidl +0 −5 Original line number Diff line number Diff line Loading @@ -263,11 +263,6 @@ oneway interface IStatusBar */ void stopTracing(); /** * Handles a logging command from the WM shell command. */ void handleWindowManagerLoggingCommand(in String[] args, in ParcelFileDescriptor outFd); /** * If true, suppresses the ambient display from showing. If false, re-enables the ambient * display. Loading libs/WindowManager/Shell/src/com/android/wm/shell/ProtoLogController.java 0 → 100644 +112 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.wm.shell; import com.android.wm.shell.protolog.ShellProtoLogImpl; import com.android.wm.shell.sysui.ShellCommandHandler; import com.android.wm.shell.sysui.ShellInit; import java.io.PrintWriter; import java.util.Arrays; /** * Controls the {@link ShellProtoLogImpl} in WMShell via adb shell commands. * * Use with {@code adb shell dumpsys activity service SystemUIService WMShell protolog ...}. */ public class ProtoLogController implements ShellCommandHandler.ShellCommandActionHandler { private final ShellCommandHandler mShellCommandHandler; private final ShellProtoLogImpl mShellProtoLog; public ProtoLogController(ShellInit shellInit, ShellCommandHandler shellCommandHandler) { shellInit.addInitCallback(this::onInit, this); mShellCommandHandler = shellCommandHandler; mShellProtoLog = ShellProtoLogImpl.getSingleInstance(); } void onInit() { mShellCommandHandler.addCommandCallback("protolog", this, this); } @Override public boolean onShellCommand(String[] args, PrintWriter pw) { switch (args[0]) { case "status": { pw.println(mShellProtoLog.getStatus()); return true; } case "start": { mShellProtoLog.startProtoLog(pw); return true; } case "stop": { mShellProtoLog.stopProtoLog(pw, true /* writeToFile */); return true; } case "enable-text": { String[] groups = Arrays.copyOfRange(args, 1, args.length); int result = mShellProtoLog.startTextLogging(groups, pw); if (result == 0) { pw.println("Starting logging on groups: " + Arrays.toString(groups)); return true; } return false; } case "disable-text": { String[] groups = Arrays.copyOfRange(args, 1, args.length); int result = mShellProtoLog.stopTextLogging(groups, pw); if (result == 0) { pw.println("Stopping logging on groups: " + Arrays.toString(groups)); return true; } return false; } case "enable": { String[] groups = Arrays.copyOfRange(args, 1, args.length); return mShellProtoLog.startTextLogging(groups, pw) == 0; } case "disable": { String[] groups = Arrays.copyOfRange(args, 1, args.length); return mShellProtoLog.stopTextLogging(groups, pw) == 0; } default: { pw.println("Invalid command: " + args[0]); printShellCommandHelp(pw, ""); return false; } } } @Override public void printShellCommandHelp(PrintWriter pw, String prefix) { pw.println(prefix + "status"); pw.println(prefix + " Get current ProtoLog status."); pw.println(prefix + "start"); pw.println(prefix + " Start proto logging."); pw.println(prefix + "stop"); pw.println(prefix + " Stop proto logging and flush to file."); pw.println(prefix + "enable [group...]"); pw.println(prefix + " Enable proto logging for given groups."); pw.println(prefix + "disable [group...]"); pw.println(prefix + " Disable proto logging for given groups."); pw.println(prefix + "enable-text [group...]"); pw.println(prefix + " Enable logcat logging for given groups."); pw.println(prefix + "disable-text [group...]"); pw.println(prefix + " Disable logcat logging for given groups."); } } libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellBaseModule.java +10 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.view.IWindowManager; import com.android.internal.logging.UiEventLogger; import com.android.launcher3.icons.IconProvider; import com.android.wm.shell.ProtoLogController; import com.android.wm.shell.RootDisplayAreaOrganizer; import com.android.wm.shell.RootTaskDisplayAreaOrganizer; import com.android.wm.shell.ShellTaskOrganizer; Loading Loading @@ -699,6 +700,7 @@ public abstract class WMShellBaseModule { Optional<ActivityEmbeddingController> activityEmbeddingOptional, Transitions transitions, StartingWindowController startingWindow, ProtoLogController protoLogController, @ShellCreateTriggerOverride Optional<Object> overriddenCreateTrigger) { return new Object(); } Loading @@ -714,4 +716,12 @@ public abstract class WMShellBaseModule { static ShellCommandHandler provideShellCommandHandler() { return new ShellCommandHandler(); } @WMSingleton @Provides static ProtoLogController provideProtoLogController( ShellInit shellInit, ShellCommandHandler shellCommandHandler) { return new ProtoLogController(shellInit, shellCommandHandler); } } packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java +0 −31 Original line number Diff line number Diff line Loading @@ -52,7 +52,6 @@ import android.os.Looper; import android.os.Message; import android.os.ParcelFileDescriptor; import android.os.RemoteException; import android.util.Log; import android.util.Pair; import android.util.SparseArray; import android.view.InsetsState.InternalInsetsType; Loading @@ -76,7 +75,6 @@ import com.android.systemui.statusbar.policy.CallbackController; import com.android.systemui.tracing.ProtoTracer; import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; Loading Loading @@ -152,7 +150,6 @@ public class CommandQueue extends IStatusBar.Stub implements private static final int MSG_TRACING_STATE_CHANGED = 54 << MSG_SHIFT; private static final int MSG_SUPPRESS_AMBIENT_DISPLAY = 55 << MSG_SHIFT; private static final int MSG_REQUEST_WINDOW_MAGNIFICATION_CONNECTION = 56 << MSG_SHIFT; private static final int MSG_HANDLE_WINDOW_MANAGER_LOGGING_COMMAND = 57 << MSG_SHIFT; //TODO(b/169175022) Update name and when feature name is locked. private static final int MSG_EMERGENCY_ACTION_LAUNCH_GESTURE = 58 << MSG_SHIFT; private static final int MSG_SET_NAVIGATION_BAR_LUMA_SAMPLING_ENABLED = 59 << MSG_SHIFT; Loading Loading @@ -424,11 +421,6 @@ public class CommandQueue extends IStatusBar.Stub implements */ default void requestWindowMagnificationConnection(boolean connect) { } /** * Handles a window manager shell logging command. */ default void handleWindowManagerLoggingCommand(String[] args, ParcelFileDescriptor outFd) {} /** * @see IStatusBar#setNavigationBarLumaSamplingEnabled(int, boolean) */ Loading Loading @@ -1142,17 +1134,6 @@ public class CommandQueue extends IStatusBar.Stub implements } } @Override public void handleWindowManagerLoggingCommand(String[] args, ParcelFileDescriptor outFd) { synchronized (mLock) { SomeArgs internalArgs = SomeArgs.obtain(); internalArgs.arg1 = args; internalArgs.arg2 = outFd; mHandler.obtainMessage(MSG_HANDLE_WINDOW_MANAGER_LOGGING_COMMAND, internalArgs) .sendToTarget(); } } @Override public void suppressAmbientDisplay(boolean suppress) { synchronized (mLock) { Loading Loading @@ -1637,18 +1618,6 @@ public class CommandQueue extends IStatusBar.Stub implements mCallbacks.get(i).requestWindowMagnificationConnection((Boolean) msg.obj); } break; case MSG_HANDLE_WINDOW_MANAGER_LOGGING_COMMAND: args = (SomeArgs) msg.obj; try (ParcelFileDescriptor pfd = (ParcelFileDescriptor) args.arg2) { for (int i = 0; i < mCallbacks.size(); i++) { mCallbacks.get(i).handleWindowManagerLoggingCommand( (String[]) args.arg1, pfd); } } catch (IOException e) { Log.e(TAG, "Failed to handle logging command", e); } args.recycle(); break; case MSG_SET_NAVIGATION_BAR_LUMA_SAMPLING_ENABLED: for (int i = 0; i < mCallbacks.size(); i++) { mCallbacks.get(i).setNavigationBarLumaSamplingEnabled(msg.arg1, Loading packages/SystemUI/src/com/android/systemui/wmshell/WMShell.java +0 −40 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ import android.content.res.Configuration; import android.graphics.Rect; import android.inputmethodservice.InputMethodService; import android.os.IBinder; import android.os.ParcelFileDescriptor; import android.view.KeyEvent; import androidx.annotation.NonNull; Loading Loading @@ -62,12 +61,10 @@ import com.android.wm.shell.onehanded.OneHandedEventCallback; import com.android.wm.shell.onehanded.OneHandedTransitionCallback; import com.android.wm.shell.onehanded.OneHandedUiEventLogger; import com.android.wm.shell.pip.Pip; import com.android.wm.shell.protolog.ShellProtoLogImpl; import com.android.wm.shell.splitscreen.SplitScreen; import com.android.wm.shell.sysui.ShellInterface; import java.io.PrintWriter; import java.util.Arrays; import java.util.List; import java.util.Optional; import java.util.concurrent.Executor; Loading Loading @@ -336,44 +333,7 @@ public final class WMShell extends CoreStartable if (mShell.handleCommand(args, pw)) { return; } // Handle logging commands if provided if (handleLoggingCommand(args, pw)) { return; } // Dump WMShell stuff here if no commands were handled mShell.dump(pw); } @Override public void handleWindowManagerLoggingCommand(String[] args, ParcelFileDescriptor outFd) { PrintWriter pw = new PrintWriter(new ParcelFileDescriptor.AutoCloseOutputStream(outFd)); handleLoggingCommand(args, pw); pw.flush(); pw.close(); } private boolean handleLoggingCommand(String[] args, PrintWriter pw) { ShellProtoLogImpl protoLogImpl = ShellProtoLogImpl.getSingleInstance(); for (int i = 0; i < args.length; i++) { switch (args[i]) { case "enable-text": { String[] groups = Arrays.copyOfRange(args, i + 1, args.length); int result = protoLogImpl.startTextLogging(groups, pw); if (result == 0) { pw.println("Starting logging on groups: " + Arrays.toString(groups)); } return true; } case "disable-text": { String[] groups = Arrays.copyOfRange(args, i + 1, args.length); int result = protoLogImpl.stopTextLogging(groups, pw); if (result == 0) { pw.println("Stopping logging on groups: " + Arrays.toString(groups)); } return true; } } } return false; } } Loading
core/java/com/android/internal/statusbar/IStatusBar.aidl +0 −5 Original line number Diff line number Diff line Loading @@ -263,11 +263,6 @@ oneway interface IStatusBar */ void stopTracing(); /** * Handles a logging command from the WM shell command. */ void handleWindowManagerLoggingCommand(in String[] args, in ParcelFileDescriptor outFd); /** * If true, suppresses the ambient display from showing. If false, re-enables the ambient * display. Loading
libs/WindowManager/Shell/src/com/android/wm/shell/ProtoLogController.java 0 → 100644 +112 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.wm.shell; import com.android.wm.shell.protolog.ShellProtoLogImpl; import com.android.wm.shell.sysui.ShellCommandHandler; import com.android.wm.shell.sysui.ShellInit; import java.io.PrintWriter; import java.util.Arrays; /** * Controls the {@link ShellProtoLogImpl} in WMShell via adb shell commands. * * Use with {@code adb shell dumpsys activity service SystemUIService WMShell protolog ...}. */ public class ProtoLogController implements ShellCommandHandler.ShellCommandActionHandler { private final ShellCommandHandler mShellCommandHandler; private final ShellProtoLogImpl mShellProtoLog; public ProtoLogController(ShellInit shellInit, ShellCommandHandler shellCommandHandler) { shellInit.addInitCallback(this::onInit, this); mShellCommandHandler = shellCommandHandler; mShellProtoLog = ShellProtoLogImpl.getSingleInstance(); } void onInit() { mShellCommandHandler.addCommandCallback("protolog", this, this); } @Override public boolean onShellCommand(String[] args, PrintWriter pw) { switch (args[0]) { case "status": { pw.println(mShellProtoLog.getStatus()); return true; } case "start": { mShellProtoLog.startProtoLog(pw); return true; } case "stop": { mShellProtoLog.stopProtoLog(pw, true /* writeToFile */); return true; } case "enable-text": { String[] groups = Arrays.copyOfRange(args, 1, args.length); int result = mShellProtoLog.startTextLogging(groups, pw); if (result == 0) { pw.println("Starting logging on groups: " + Arrays.toString(groups)); return true; } return false; } case "disable-text": { String[] groups = Arrays.copyOfRange(args, 1, args.length); int result = mShellProtoLog.stopTextLogging(groups, pw); if (result == 0) { pw.println("Stopping logging on groups: " + Arrays.toString(groups)); return true; } return false; } case "enable": { String[] groups = Arrays.copyOfRange(args, 1, args.length); return mShellProtoLog.startTextLogging(groups, pw) == 0; } case "disable": { String[] groups = Arrays.copyOfRange(args, 1, args.length); return mShellProtoLog.stopTextLogging(groups, pw) == 0; } default: { pw.println("Invalid command: " + args[0]); printShellCommandHelp(pw, ""); return false; } } } @Override public void printShellCommandHelp(PrintWriter pw, String prefix) { pw.println(prefix + "status"); pw.println(prefix + " Get current ProtoLog status."); pw.println(prefix + "start"); pw.println(prefix + " Start proto logging."); pw.println(prefix + "stop"); pw.println(prefix + " Stop proto logging and flush to file."); pw.println(prefix + "enable [group...]"); pw.println(prefix + " Enable proto logging for given groups."); pw.println(prefix + "disable [group...]"); pw.println(prefix + " Disable proto logging for given groups."); pw.println(prefix + "enable-text [group...]"); pw.println(prefix + " Enable logcat logging for given groups."); pw.println(prefix + "disable-text [group...]"); pw.println(prefix + " Disable logcat logging for given groups."); } }
libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellBaseModule.java +10 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.view.IWindowManager; import com.android.internal.logging.UiEventLogger; import com.android.launcher3.icons.IconProvider; import com.android.wm.shell.ProtoLogController; import com.android.wm.shell.RootDisplayAreaOrganizer; import com.android.wm.shell.RootTaskDisplayAreaOrganizer; import com.android.wm.shell.ShellTaskOrganizer; Loading Loading @@ -699,6 +700,7 @@ public abstract class WMShellBaseModule { Optional<ActivityEmbeddingController> activityEmbeddingOptional, Transitions transitions, StartingWindowController startingWindow, ProtoLogController protoLogController, @ShellCreateTriggerOverride Optional<Object> overriddenCreateTrigger) { return new Object(); } Loading @@ -714,4 +716,12 @@ public abstract class WMShellBaseModule { static ShellCommandHandler provideShellCommandHandler() { return new ShellCommandHandler(); } @WMSingleton @Provides static ProtoLogController provideProtoLogController( ShellInit shellInit, ShellCommandHandler shellCommandHandler) { return new ProtoLogController(shellInit, shellCommandHandler); } }
packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java +0 −31 Original line number Diff line number Diff line Loading @@ -52,7 +52,6 @@ import android.os.Looper; import android.os.Message; import android.os.ParcelFileDescriptor; import android.os.RemoteException; import android.util.Log; import android.util.Pair; import android.util.SparseArray; import android.view.InsetsState.InternalInsetsType; Loading @@ -76,7 +75,6 @@ import com.android.systemui.statusbar.policy.CallbackController; import com.android.systemui.tracing.ProtoTracer; import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; Loading Loading @@ -152,7 +150,6 @@ public class CommandQueue extends IStatusBar.Stub implements private static final int MSG_TRACING_STATE_CHANGED = 54 << MSG_SHIFT; private static final int MSG_SUPPRESS_AMBIENT_DISPLAY = 55 << MSG_SHIFT; private static final int MSG_REQUEST_WINDOW_MAGNIFICATION_CONNECTION = 56 << MSG_SHIFT; private static final int MSG_HANDLE_WINDOW_MANAGER_LOGGING_COMMAND = 57 << MSG_SHIFT; //TODO(b/169175022) Update name and when feature name is locked. private static final int MSG_EMERGENCY_ACTION_LAUNCH_GESTURE = 58 << MSG_SHIFT; private static final int MSG_SET_NAVIGATION_BAR_LUMA_SAMPLING_ENABLED = 59 << MSG_SHIFT; Loading Loading @@ -424,11 +421,6 @@ public class CommandQueue extends IStatusBar.Stub implements */ default void requestWindowMagnificationConnection(boolean connect) { } /** * Handles a window manager shell logging command. */ default void handleWindowManagerLoggingCommand(String[] args, ParcelFileDescriptor outFd) {} /** * @see IStatusBar#setNavigationBarLumaSamplingEnabled(int, boolean) */ Loading Loading @@ -1142,17 +1134,6 @@ public class CommandQueue extends IStatusBar.Stub implements } } @Override public void handleWindowManagerLoggingCommand(String[] args, ParcelFileDescriptor outFd) { synchronized (mLock) { SomeArgs internalArgs = SomeArgs.obtain(); internalArgs.arg1 = args; internalArgs.arg2 = outFd; mHandler.obtainMessage(MSG_HANDLE_WINDOW_MANAGER_LOGGING_COMMAND, internalArgs) .sendToTarget(); } } @Override public void suppressAmbientDisplay(boolean suppress) { synchronized (mLock) { Loading Loading @@ -1637,18 +1618,6 @@ public class CommandQueue extends IStatusBar.Stub implements mCallbacks.get(i).requestWindowMagnificationConnection((Boolean) msg.obj); } break; case MSG_HANDLE_WINDOW_MANAGER_LOGGING_COMMAND: args = (SomeArgs) msg.obj; try (ParcelFileDescriptor pfd = (ParcelFileDescriptor) args.arg2) { for (int i = 0; i < mCallbacks.size(); i++) { mCallbacks.get(i).handleWindowManagerLoggingCommand( (String[]) args.arg1, pfd); } } catch (IOException e) { Log.e(TAG, "Failed to handle logging command", e); } args.recycle(); break; case MSG_SET_NAVIGATION_BAR_LUMA_SAMPLING_ENABLED: for (int i = 0; i < mCallbacks.size(); i++) { mCallbacks.get(i).setNavigationBarLumaSamplingEnabled(msg.arg1, Loading
packages/SystemUI/src/com/android/systemui/wmshell/WMShell.java +0 −40 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ import android.content.res.Configuration; import android.graphics.Rect; import android.inputmethodservice.InputMethodService; import android.os.IBinder; import android.os.ParcelFileDescriptor; import android.view.KeyEvent; import androidx.annotation.NonNull; Loading Loading @@ -62,12 +61,10 @@ import com.android.wm.shell.onehanded.OneHandedEventCallback; import com.android.wm.shell.onehanded.OneHandedTransitionCallback; import com.android.wm.shell.onehanded.OneHandedUiEventLogger; import com.android.wm.shell.pip.Pip; import com.android.wm.shell.protolog.ShellProtoLogImpl; import com.android.wm.shell.splitscreen.SplitScreen; import com.android.wm.shell.sysui.ShellInterface; import java.io.PrintWriter; import java.util.Arrays; import java.util.List; import java.util.Optional; import java.util.concurrent.Executor; Loading Loading @@ -336,44 +333,7 @@ public final class WMShell extends CoreStartable if (mShell.handleCommand(args, pw)) { return; } // Handle logging commands if provided if (handleLoggingCommand(args, pw)) { return; } // Dump WMShell stuff here if no commands were handled mShell.dump(pw); } @Override public void handleWindowManagerLoggingCommand(String[] args, ParcelFileDescriptor outFd) { PrintWriter pw = new PrintWriter(new ParcelFileDescriptor.AutoCloseOutputStream(outFd)); handleLoggingCommand(args, pw); pw.flush(); pw.close(); } private boolean handleLoggingCommand(String[] args, PrintWriter pw) { ShellProtoLogImpl protoLogImpl = ShellProtoLogImpl.getSingleInstance(); for (int i = 0; i < args.length; i++) { switch (args[i]) { case "enable-text": { String[] groups = Arrays.copyOfRange(args, i + 1, args.length); int result = protoLogImpl.startTextLogging(groups, pw); if (result == 0) { pw.println("Starting logging on groups: " + Arrays.toString(groups)); } return true; } case "disable-text": { String[] groups = Arrays.copyOfRange(args, i + 1, args.length); int result = protoLogImpl.stopTextLogging(groups, pw); if (result == 0) { pw.println("Stopping logging on groups: " + Arrays.toString(groups)); } return true; } } } return false; } }