Merge "Trace sections for ScreenDecorations" into tm-qpr-dev

This commit is contained in:
TreeHugger Robot
2022-12-07 10:40:08 +00:00
committed by Android (Google) Code Review

View File

@@ -210,8 +210,10 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable {
(FaceScanningOverlay) getOverlayView(mFaceScanningViewId); (FaceScanningOverlay) getOverlayView(mFaceScanningViewId);
if (faceScanningOverlay != null) { if (faceScanningOverlay != null) {
faceScanningOverlay.setHideOverlayRunnable(() -> { faceScanningOverlay.setHideOverlayRunnable(() -> {
Trace.beginSection("ScreenDecorations#hideOverlayRunnable");
updateOverlayWindowVisibilityIfViewExists( updateOverlayWindowVisibilityIfViewExists(
faceScanningOverlay.findViewById(mFaceScanningViewId)); faceScanningOverlay.findViewById(mFaceScanningViewId));
Trace.endSection();
}); });
faceScanningOverlay.enableShowProtection(false); faceScanningOverlay.enableShowProtection(false);
} }
@@ -273,16 +275,18 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable {
if (mOverlays == null || !shouldOptimizeVisibility()) { if (mOverlays == null || !shouldOptimizeVisibility()) {
return; return;
} }
Trace.beginSection("ScreenDecorations#updateOverlayWindowVisibilityIfViewExists");
for (final OverlayWindow overlay : mOverlays) { for (final OverlayWindow overlay : mOverlays) {
if (overlay == null) { if (overlay == null) {
continue; continue;
} }
if (overlay.getView(view.getId()) != null) { if (overlay.getView(view.getId()) != null) {
overlay.getRootView().setVisibility(getWindowVisibility(overlay, true)); overlay.getRootView().setVisibility(getWindowVisibility(overlay, true));
Trace.endSection();
return; return;
} }
} }
Trace.endSection();
}); });
} }
@@ -370,6 +374,7 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable {
} }
private void startOnScreenDecorationsThread() { private void startOnScreenDecorationsThread() {
Trace.beginSection("ScreenDecorations#startOnScreenDecorationsThread");
mWindowManager = mContext.getSystemService(WindowManager.class); mWindowManager = mContext.getSystemService(WindowManager.class);
mDisplayManager = mContext.getSystemService(DisplayManager.class); mDisplayManager = mContext.getSystemService(DisplayManager.class);
mContext.getDisplay().getDisplayInfo(mDisplayInfo); mContext.getDisplay().getDisplayInfo(mDisplayInfo);
@@ -472,6 +477,7 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable {
mDisplayManager.registerDisplayListener(mDisplayListener, mHandler); mDisplayManager.registerDisplayListener(mDisplayListener, mHandler);
updateConfiguration(); updateConfiguration();
Trace.endSection();
} }
@VisibleForTesting @VisibleForTesting
@@ -521,6 +527,12 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable {
} }
private void setupDecorations() { private void setupDecorations() {
Trace.beginSection("ScreenDecorations#setupDecorations");
setupDecorationsInner();
Trace.endSection();
}
private void setupDecorationsInner() {
if (hasRoundedCorners() || shouldDrawCutout() || isPrivacyDotEnabled() if (hasRoundedCorners() || shouldDrawCutout() || isPrivacyDotEnabled()
|| mFaceScanningFactory.getHasProviders()) { || mFaceScanningFactory.getHasProviders()) {
@@ -573,7 +585,11 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable {
return; return;
} }
mMainExecutor.execute(() -> mTunerService.addTunable(this, SIZE)); mMainExecutor.execute(() -> {
Trace.beginSection("ScreenDecorations#addTunable");
mTunerService.addTunable(this, SIZE);
Trace.endSection();
});
// Watch color inversion and invert the overlay as needed. // Watch color inversion and invert the overlay as needed.
if (mColorInversionSetting == null) { if (mColorInversionSetting == null) {
@@ -593,7 +609,11 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable {
mUserTracker.addCallback(mUserChangedCallback, mExecutor); mUserTracker.addCallback(mUserChangedCallback, mExecutor);
mIsRegistered = true; mIsRegistered = true;
} else { } else {
mMainExecutor.execute(() -> mTunerService.removeTunable(this)); mMainExecutor.execute(() -> {
Trace.beginSection("ScreenDecorations#removeTunable");
mTunerService.removeTunable(this);
Trace.endSection();
});
if (mColorInversionSetting != null) { if (mColorInversionSetting != null) {
mColorInversionSetting.setListening(false); mColorInversionSetting.setListening(false);
@@ -939,6 +959,7 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable {
} }
mExecutor.execute(() -> { mExecutor.execute(() -> {
Trace.beginSection("ScreenDecorations#onConfigurationChanged");
int oldRotation = mRotation; int oldRotation = mRotation;
mPendingConfigChange = false; mPendingConfigChange = false;
updateConfiguration(); updateConfiguration();
@@ -951,6 +972,7 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable {
// the updated rotation). // the updated rotation).
updateLayoutParams(); updateLayoutParams();
} }
Trace.endSection();
}); });
} }
@@ -1119,6 +1141,7 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable {
if (mOverlays == null || !SIZE.equals(key)) { if (mOverlays == null || !SIZE.equals(key)) {
return; return;
} }
Trace.beginSection("ScreenDecorations#onTuningChanged");
try { try {
final int sizeFactor = Integer.parseInt(newValue); final int sizeFactor = Integer.parseInt(newValue);
mRoundedCornerResDelegate.setTuningSizeFactor(sizeFactor); mRoundedCornerResDelegate.setTuningSizeFactor(sizeFactor);
@@ -1132,6 +1155,7 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable {
R.id.rounded_corner_bottom_right R.id.rounded_corner_bottom_right
}); });
updateHwLayerRoundedCornerExistAndSize(); updateHwLayerRoundedCornerExistAndSize();
Trace.endSection();
}); });
} }