Merge "Add traces to aid onScreenTuringOn latency debugging" into tm-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
797572d068
@@ -17,6 +17,7 @@
|
|||||||
package com.android.server.display;
|
package com.android.server.display;
|
||||||
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
|
import android.os.Trace;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
import android.view.Display;
|
import android.view.Display;
|
||||||
import android.view.DisplayAddress;
|
import android.view.DisplayAddress;
|
||||||
@@ -38,6 +39,7 @@ import java.util.function.Consumer;
|
|||||||
*/
|
*/
|
||||||
class DisplayDeviceRepository implements DisplayAdapter.Listener {
|
class DisplayDeviceRepository implements DisplayAdapter.Listener {
|
||||||
private static final String TAG = "DisplayDeviceRepository";
|
private static final String TAG = "DisplayDeviceRepository";
|
||||||
|
private static final Boolean DEBUG = false;
|
||||||
|
|
||||||
public static final int DISPLAY_DEVICE_EVENT_ADDED = 1;
|
public static final int DISPLAY_DEVICE_EVENT_ADDED = 1;
|
||||||
public static final int DISPLAY_DEVICE_EVENT_CHANGED = 2;
|
public static final int DISPLAY_DEVICE_EVENT_CHANGED = 2;
|
||||||
@@ -75,6 +77,11 @@ class DisplayDeviceRepository implements DisplayAdapter.Listener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisplayDeviceEvent(DisplayDevice device, int event) {
|
public void onDisplayDeviceEvent(DisplayDevice device, int event) {
|
||||||
|
String tag = null;
|
||||||
|
if (DEBUG) {
|
||||||
|
tag = "DisplayDeviceRepository#onDisplayDeviceEvent (event=" + event + ")";
|
||||||
|
Trace.beginAsyncSection(tag, 0);
|
||||||
|
}
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case DISPLAY_DEVICE_EVENT_ADDED:
|
case DISPLAY_DEVICE_EVENT_ADDED:
|
||||||
handleDisplayDeviceAdded(device);
|
handleDisplayDeviceAdded(device);
|
||||||
@@ -88,6 +95,9 @@ class DisplayDeviceRepository implements DisplayAdapter.Listener {
|
|||||||
handleDisplayDeviceRemoved(device);
|
handleDisplayDeviceRemoved(device);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (DEBUG) {
|
||||||
|
Trace.endAsyncSection(tag, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -156,7 +166,9 @@ class DisplayDeviceRepository implements DisplayAdapter.Listener {
|
|||||||
Slog.w(TAG, "Attempted to change non-existent display device: " + info);
|
Slog.w(TAG, "Attempted to change non-existent display device: " + info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (DEBUG) {
|
||||||
|
Trace.beginSection("handleDisplayDeviceChanged");
|
||||||
|
}
|
||||||
int diff = device.mDebugLastLoggedDeviceInfo.diff(info);
|
int diff = device.mDebugLastLoggedDeviceInfo.diff(info);
|
||||||
if (diff == DisplayDeviceInfo.DIFF_STATE) {
|
if (diff == DisplayDeviceInfo.DIFF_STATE) {
|
||||||
Slog.i(TAG, "Display device changed state: \"" + info.name
|
Slog.i(TAG, "Display device changed state: \"" + info.name
|
||||||
@@ -176,6 +188,9 @@ class DisplayDeviceRepository implements DisplayAdapter.Listener {
|
|||||||
|
|
||||||
device.applyPendingDisplayDeviceInfoChangesLocked();
|
device.applyPendingDisplayDeviceInfoChangesLocked();
|
||||||
sendEventLocked(device, DISPLAY_DEVICE_EVENT_CHANGED);
|
sendEventLocked(device, DISPLAY_DEVICE_EVENT_CHANGED);
|
||||||
|
if (DEBUG) {
|
||||||
|
Trace.endSection();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -782,7 +782,13 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
|||||||
mDisplayStatsId = mUniqueDisplayId.hashCode();
|
mDisplayStatsId = mUniqueDisplayId.hashCode();
|
||||||
mDisplayDeviceConfig = config;
|
mDisplayDeviceConfig = config;
|
||||||
loadFromDisplayDeviceConfig(token, info);
|
loadFromDisplayDeviceConfig(token, info);
|
||||||
|
if (DEBUG) {
|
||||||
|
Trace.beginAsyncSection("DisplayPowerController#updatePowerState", 0);
|
||||||
|
}
|
||||||
updatePowerState();
|
updatePowerState();
|
||||||
|
if (DEBUG) {
|
||||||
|
Trace.endAsyncSection("DisplayPowerController#updatePowerState", 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.server.display;
|
package com.android.server.display;
|
||||||
|
|
||||||
|
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
|
||||||
import static android.view.Display.Mode.INVALID_MODE_ID;
|
import static android.view.Display.Mode.INVALID_MODE_ID;
|
||||||
|
|
||||||
import android.app.ActivityThread;
|
import android.app.ActivityThread;
|
||||||
@@ -1393,7 +1394,12 @@ final class LocalDisplayAdapter extends DisplayAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean getBootDisplayModeSupport() {
|
public boolean getBootDisplayModeSupport() {
|
||||||
|
Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "getBootDisplayModeSupport");
|
||||||
|
try {
|
||||||
return SurfaceControl.getBootDisplayModeSupport();
|
return SurfaceControl.getBootDisplayModeSupport();
|
||||||
|
} finally {
|
||||||
|
Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBootDisplayMode(IBinder displayToken, int modeId) {
|
public void setBootDisplayMode(IBinder displayToken, int modeId) {
|
||||||
|
|||||||
Reference in New Issue
Block a user