[DO NOT MERGE] Dump windowing mode in Winscope traces

To be used by Fass in Winscope to automatically detect pip transitions

Bug: 183993924
Test: Existing tests
Change-Id: I066982c9de104acd307b8b016bce167ae9765ac8
(cherry picked from commit 786fe1e128)
This commit is contained in:
Pablo Gamito
2021-09-10 00:17:49 +00:00
committed by Nataniel Borges
parent b88b5349d6
commit 732fa80c97

View File

@@ -28,6 +28,8 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMAR
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY; import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
import static android.app.WindowConfiguration.activityTypeToString; import static android.app.WindowConfiguration.activityTypeToString;
import static android.app.WindowConfiguration.windowingModeToString; import static android.app.WindowConfiguration.windowingModeToString;
import static android.app.WindowConfigurationProto.WINDOWING_MODE;
import static android.content.ConfigurationProto.WINDOW_CONFIGURATION;
import static com.android.server.wm.ConfigurationContainerProto.FULL_CONFIGURATION; import static com.android.server.wm.ConfigurationContainerProto.FULL_CONFIGURATION;
import static com.android.server.wm.ConfigurationContainerProto.MERGED_OVERRIDE_CONFIGURATION; import static com.android.server.wm.ConfigurationContainerProto.MERGED_OVERRIDE_CONFIGURATION;
@@ -695,22 +697,40 @@ public abstract class ConfigurationContainer<E extends ConfigurationContainer> {
@CallSuper @CallSuper
protected void dumpDebug(ProtoOutputStream proto, long fieldId, protected void dumpDebug(ProtoOutputStream proto, long fieldId,
@WindowTraceLogLevel int logLevel) { @WindowTraceLogLevel int logLevel) {
// Critical log level logs only visible elements to mitigate performance overheard final long token = proto.start(fieldId);
if (logLevel != WindowTraceLogLevel.ALL && !mHasOverrideConfiguration) {
return; if (logLevel == WindowTraceLogLevel.ALL || mHasOverrideConfiguration) {
mRequestedOverrideConfiguration.dumpDebug(proto, OVERRIDE_CONFIGURATION,
logLevel == WindowTraceLogLevel.CRITICAL);
} }
final long token = proto.start(fieldId); // Unless trace level is set to `WindowTraceLogLevel.ALL` don't dump anything that isn't
mRequestedOverrideConfiguration.dumpDebug(proto, OVERRIDE_CONFIGURATION, // required to mitigate performance overhead
logLevel == WindowTraceLogLevel.CRITICAL);
if (logLevel == WindowTraceLogLevel.ALL) { if (logLevel == WindowTraceLogLevel.ALL) {
mFullConfiguration.dumpDebug(proto, FULL_CONFIGURATION, false /* critical */); mFullConfiguration.dumpDebug(proto, FULL_CONFIGURATION, false /* critical */);
mMergedOverrideConfiguration.dumpDebug(proto, MERGED_OVERRIDE_CONFIGURATION, mMergedOverrideConfiguration.dumpDebug(proto, MERGED_OVERRIDE_CONFIGURATION,
false /* critical */); false /* critical */);
} }
if (logLevel == WindowTraceLogLevel.TRIM) {
// Required for Fass to automatically detect pip transitions in Winscope traces
dumpDebugWindowingMode(proto);
}
proto.end(token); proto.end(token);
} }
private void dumpDebugWindowingMode(ProtoOutputStream proto) {
final long fullConfigToken = proto.start(FULL_CONFIGURATION);
final long windowConfigToken = proto.start(WINDOW_CONFIGURATION);
int windowingMode = mFullConfiguration.windowConfiguration.getWindowingMode();
proto.write(WINDOWING_MODE, windowingMode);
proto.end(windowConfigToken);
proto.end(fullConfigToken);
}
/** /**
* Dumps the names of this container children in the input print writer indenting each * Dumps the names of this container children in the input print writer indenting each
* level with the input prefix. * level with the input prefix.