diff options
5 files changed, 70 insertions, 33 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDisplayListener.kt b/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDisplayListener.kt index e9b637230ede..ca479f5e6b5f 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDisplayListener.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDisplayListener.kt @@ -21,6 +21,7 @@ import android.hardware.display.DisplayManager import android.hardware.fingerprint.FingerprintSensorPropertiesInternal import android.os.Handler import android.view.DisplayInfo +import com.android.app.tracing.traceSection import com.android.systemui.biometrics.BiometricDisplayListener.SensorType.Generic /** @@ -42,13 +43,15 @@ class BiometricDisplayListener( override fun onDisplayAdded(displayId: Int) {} override fun onDisplayRemoved(displayId: Int) {} override fun onDisplayChanged(displayId: Int) { - val rotationChanged = didRotationChange() + traceSection({ "BiometricDisplayListener($sensorType)#onDisplayChanged" }) { + val rotationChanged = didRotationChange() - when (sensorType) { - is SensorType.SideFingerprint -> onChanged() - else -> { - if (rotationChanged) { - onChanged() + when (sensorType) { + is SensorType.SideFingerprint -> onChanged() + else -> { + if (rotationChanged) { + onChanged() + } } } } @@ -82,8 +85,8 @@ class BiometricDisplayListener( * biometric prompt (and this object will likely change as multi-mode auth is added). */ sealed class SensorType { - object Generic : SensorType() - object UnderDisplayFingerprint : SensorType() + data object Generic : SensorType() + data object UnderDisplayFingerprint : SensorType() data class SideFingerprint( val properties: FingerprintSensorPropertiesInternal ) : SensorType() diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/data/repository/DisplayStateRepository.kt b/packages/SystemUI/src/com/android/systemui/biometrics/data/repository/DisplayStateRepository.kt index aaccbc1d2f9e..792a7efeb109 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/data/repository/DisplayStateRepository.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/data/repository/DisplayStateRepository.kt @@ -24,6 +24,7 @@ import android.hardware.display.DisplayManager.EVENT_FLAG_DISPLAY_CHANGED import android.os.Handler import android.util.Size import android.view.DisplayInfo +import com.android.app.tracing.traceSection import com.android.internal.util.ArrayUtils import com.android.systemui.biometrics.shared.model.DisplayRotation import com.android.systemui.biometrics.shared.model.toDisplayRotation @@ -130,12 +131,17 @@ constructor( override fun onDisplayAdded(displayId: Int) {} override fun onDisplayChanged(displayId: Int) { - val displayInfo = getDisplayInfo() - trySendWithFailureLogging( - displayInfo, - TAG, - "Error sending displayInfo to $displayInfo" - ) + traceSection( + "DisplayStateRepository" + + ".currentRotationDisplayListener#onDisplayChanged" + ) { + val displayInfo = getDisplayInfo() + trySendWithFailureLogging( + displayInfo, + TAG, + "Error sending displayInfo to $displayInfo" + ) + } } } displayManager.registerDisplayListener( diff --git a/packages/SystemUI/src/com/android/systemui/settings/DisplayTrackerImpl.kt b/packages/SystemUI/src/com/android/systemui/settings/DisplayTrackerImpl.kt index 68cc483fbe80..2ef27a8df117 100644 --- a/packages/SystemUI/src/com/android/systemui/settings/DisplayTrackerImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/settings/DisplayTrackerImpl.kt @@ -23,6 +23,7 @@ import android.view.Display import androidx.annotation.GuardedBy import androidx.annotation.VisibleForTesting import androidx.annotation.WorkerThread +import com.android.app.tracing.traceSection import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.util.Assert import java.lang.ref.WeakReference @@ -46,18 +47,30 @@ internal constructor( val displayChangedListener: DisplayManager.DisplayListener = object : DisplayManager.DisplayListener { override fun onDisplayAdded(displayId: Int) { - val list = synchronized(displayCallbacks) { displayCallbacks.toList() } - onDisplayAdded(displayId, list) + traceSection( + "DisplayTrackerImpl.displayChangedDisplayListener#onDisplayAdded", + ) { + val list = synchronized(displayCallbacks) { displayCallbacks.toList() } + onDisplayAdded(displayId, list) + } } override fun onDisplayRemoved(displayId: Int) { - val list = synchronized(displayCallbacks) { displayCallbacks.toList() } - onDisplayRemoved(displayId, list) + traceSection( + "DisplayTrackerImpl.displayChangedDisplayListener#onDisplayRemoved", + ) { + val list = synchronized(displayCallbacks) { displayCallbacks.toList() } + onDisplayRemoved(displayId, list) + } } override fun onDisplayChanged(displayId: Int) { - val list = synchronized(displayCallbacks) { displayCallbacks.toList() } - onDisplayChanged(displayId, list) + traceSection( + "DisplayTrackerImpl.displayChangedDisplayListener#onDisplayChanged", + ) { + val list = synchronized(displayCallbacks) { displayCallbacks.toList() } + onDisplayChanged(displayId, list) + } } } @@ -69,8 +82,12 @@ internal constructor( override fun onDisplayRemoved(displayId: Int) {} override fun onDisplayChanged(displayId: Int) { - val list = synchronized(brightnessCallbacks) { brightnessCallbacks.toList() } - onDisplayChanged(displayId, list) + traceSection( + "DisplayTrackerImpl.displayBrightnessChangedDisplayListener#onDisplayChanged", + ) { + val list = synchronized(brightnessCallbacks) { brightnessCallbacks.toList() } + onDisplayChanged(displayId, list) + } } } diff --git a/packages/SystemUI/src/com/android/systemui/wallpapers/ImageWallpaper.java b/packages/SystemUI/src/com/android/systemui/wallpapers/ImageWallpaper.java index e57c0e7f1044..9bfc4ce49cc7 100644 --- a/packages/SystemUI/src/com/android/systemui/wallpapers/ImageWallpaper.java +++ b/packages/SystemUI/src/com/android/systemui/wallpapers/ImageWallpaper.java @@ -476,10 +476,15 @@ public class ImageWallpaper extends WallpaperService { @Override public void onDisplayChanged(int displayId) { - // changes the display in the color extractor - // the new display dimensions will be used in the next color computation - if (displayId == getDisplayContext().getDisplayId()) { - getDisplaySizeAndUpdateColorExtractor(); + Trace.beginSection("ImageWallpaper.CanvasEngine#onDisplayChanged"); + try { + // changes the display in the color extractor + // the new display dimensions will be used in the next color computation + if (displayId == getDisplayContext().getDisplayId()) { + getDisplaySizeAndUpdateColorExtractor(); + } + } finally { + Trace.endSection(); } } diff --git a/packages/SystemUI/unfold/src/com/android/systemui/unfold/updates/RotationChangeProvider.kt b/packages/SystemUI/unfold/src/com/android/systemui/unfold/updates/RotationChangeProvider.kt index 82ea362e8049..bb91f9b8cf0b 100644 --- a/packages/SystemUI/unfold/src/com/android/systemui/unfold/updates/RotationChangeProvider.kt +++ b/packages/SystemUI/unfold/src/com/android/systemui/unfold/updates/RotationChangeProvider.kt @@ -20,6 +20,7 @@ import android.content.Context import android.hardware.display.DisplayManager import android.os.Handler import android.os.RemoteException +import android.os.Trace import com.android.systemui.unfold.util.CallbackController import dagger.assisted.Assisted import dagger.assisted.AssistedFactory @@ -86,14 +87,19 @@ constructor( private inner class RotationDisplayListener : DisplayManager.DisplayListener { override fun onDisplayChanged(displayId: Int) { - val display = context.display ?: return - - if (displayId == display.displayId) { - val currentRotation = display.rotation - if (lastRotation == null || lastRotation != currentRotation) { - listeners.forEach { it.onRotationChanged(currentRotation) } - lastRotation = currentRotation + Trace.beginSection("RotationChangeProvider.RotationDisplayListener#onDisplayChanged") + try { + val display = context.display ?: return + + if (displayId == display.displayId) { + val currentRotation = display.rotation + if (lastRotation == null || lastRotation != currentRotation) { + listeners.forEach { it.onRotationChanged(currentRotation) } + lastRotation = currentRotation + } } + } finally { + Trace.endSection() } } |