Loading core/java/android/view/IWindowManager.aidl +15 −0 Original line number Diff line number Diff line Loading @@ -396,4 +396,19 @@ interface IWindowManager * Return the touch region for the current IME window, or an empty region if there is none. */ Region getCurrentImeTouchRegion(); /** * Starts a window trace. */ void startWindowTrace(); /** * Stops a window trace. */ void stopWindowTrace(); /** * Returns true if window trace is enabled. */ boolean isWindowTraceEnabled(); } services/core/java/com/android/server/wm/WindowManagerService.java +19 −0 Original line number Diff line number Diff line Loading @@ -5327,6 +5327,25 @@ public class WindowManagerService extends IWindowManager.Stub reconfigureDisplayLocked(displayContent); } @Override public void startWindowTrace(){ try { mWindowTracing.startTrace(null /* printwriter */); } catch (IOException e) { throw new RuntimeException(e); } } @Override public void stopWindowTrace(){ mWindowTracing.stopTrace(null /* printwriter */); } @Override public boolean isWindowTraceEnabled() { return mWindowTracing.isEnabled(); } // ------------------------------------------------------------- // Internals // ------------------------------------------------------------- Loading services/core/java/com/android/server/wm/WindowTracing.java +8 −5 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.content.Context; import android.os.ShellCommand; import android.os.SystemClock; import android.os.Trace; import android.annotation.Nullable; import android.util.Log; import android.util.proto.ProtoOutputStream; Loading Loading @@ -62,7 +63,7 @@ class WindowTracing { mTraceFile = file; } void startTrace(PrintWriter pw) throws IOException { void startTrace(@Nullable PrintWriter pw) throws IOException { if (IS_USER){ logAndPrintln(pw, "Error: Tracing is not supported on user builds."); return; Loading @@ -81,13 +82,15 @@ class WindowTracing { } } private void logAndPrintln(PrintWriter pw, String msg) { private void logAndPrintln(@Nullable PrintWriter pw, String msg) { Log.i(TAG, msg); if (pw != null) { pw.println(msg); pw.flush(); } } void stopTrace(PrintWriter pw) { void stopTrace(@Nullable PrintWriter pw) { if (IS_USER){ logAndPrintln(pw, "Error: Tracing is not supported on user builds."); return; Loading Loading
core/java/android/view/IWindowManager.aidl +15 −0 Original line number Diff line number Diff line Loading @@ -396,4 +396,19 @@ interface IWindowManager * Return the touch region for the current IME window, or an empty region if there is none. */ Region getCurrentImeTouchRegion(); /** * Starts a window trace. */ void startWindowTrace(); /** * Stops a window trace. */ void stopWindowTrace(); /** * Returns true if window trace is enabled. */ boolean isWindowTraceEnabled(); }
services/core/java/com/android/server/wm/WindowManagerService.java +19 −0 Original line number Diff line number Diff line Loading @@ -5327,6 +5327,25 @@ public class WindowManagerService extends IWindowManager.Stub reconfigureDisplayLocked(displayContent); } @Override public void startWindowTrace(){ try { mWindowTracing.startTrace(null /* printwriter */); } catch (IOException e) { throw new RuntimeException(e); } } @Override public void stopWindowTrace(){ mWindowTracing.stopTrace(null /* printwriter */); } @Override public boolean isWindowTraceEnabled() { return mWindowTracing.isEnabled(); } // ------------------------------------------------------------- // Internals // ------------------------------------------------------------- Loading
services/core/java/com/android/server/wm/WindowTracing.java +8 −5 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.content.Context; import android.os.ShellCommand; import android.os.SystemClock; import android.os.Trace; import android.annotation.Nullable; import android.util.Log; import android.util.proto.ProtoOutputStream; Loading Loading @@ -62,7 +63,7 @@ class WindowTracing { mTraceFile = file; } void startTrace(PrintWriter pw) throws IOException { void startTrace(@Nullable PrintWriter pw) throws IOException { if (IS_USER){ logAndPrintln(pw, "Error: Tracing is not supported on user builds."); return; Loading @@ -81,13 +82,15 @@ class WindowTracing { } } private void logAndPrintln(PrintWriter pw, String msg) { private void logAndPrintln(@Nullable PrintWriter pw, String msg) { Log.i(TAG, msg); if (pw != null) { pw.println(msg); pw.flush(); } } void stopTrace(PrintWriter pw) { void stopTrace(@Nullable PrintWriter pw) { if (IS_USER){ logAndPrintln(pw, "Error: Tracing is not supported on user builds."); return; Loading