Merge "Add traces to latency sensitive points"

This commit is contained in:
Nicolò Mazzucato
2022-02-11 10:08:36 +00:00
committed by Android (Google) Code Review
5 changed files with 29 additions and 5 deletions

View File

@@ -31,6 +31,7 @@ import android.hardware.display.DisplayManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.RemoteException;
import android.os.Trace;
import android.os.UserHandle;
import android.provider.Settings;
import android.util.Log;
@@ -215,9 +216,11 @@ public class NavigationBarController implements
/** @return {@code true} if taskbar is enabled, false otherwise */
private boolean initializeTaskbarIfNecessary() {
if (mIsTablet) {
Trace.beginSection("NavigationBarController#initializeTaskbarIfNecessary");
// Remove navigation bar when taskbar is showing
removeNavigationBar(mContext.getDisplayId());
mTaskbarDelegate.init(mContext.getDisplayId());
Trace.endSection();
} else {
mTaskbarDelegate.destroy();
}

View File

@@ -37,6 +37,7 @@ import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
import android.os.Parcelable;
import android.os.Trace;
import android.os.UserHandle;
import android.service.notification.StatusBarNotification;
import android.text.TextUtils;
@@ -371,10 +372,13 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi
}
Drawable drawable;
try {
Trace.beginSection("StatusBarIconView#updateDrawable()");
drawable = getIcon(mIcon);
} catch (OutOfMemoryError e) {
Log.w(TAG, "OOM while inflating " + mIcon.icon + " for slot " + mSlot);
return false;
} finally {
Trace.endSection();
}
if (drawable == null) {

View File

@@ -1110,6 +1110,12 @@ public class StatusBar extends CoreStartable implements
}
private void onFoldedStateChanged(boolean isFolded, boolean willGoToSleep) {
Trace.beginSection("StatusBar#onFoldedStateChanged");
onFoldedStateChangedInternal(isFolded, willGoToSleep);
Trace.endSection();
}
private void onFoldedStateChangedInternal(boolean isFolded, boolean willGoToSleep) {
// Folded state changes are followed by a screen off event.
// By default turning off the screen also closes the shade.
// We want to make sure that the shade status is kept after
@@ -3672,6 +3678,7 @@ public class StatusBar extends CoreStartable implements
@Override
public void onScreenTurnedOff() {
Trace.beginSection("StatusBar#onScreenTurnedOff");
mFalsingCollector.onScreenOff();
mScrimController.onScreenTurnedOff();
if (mCloseQsBeforeScreenOff) {
@@ -3679,6 +3686,7 @@ public class StatusBar extends CoreStartable implements
mCloseQsBeforeScreenOff = false;
}
updateIsKeyguard();
Trace.endSection();
}
};

View File

@@ -21,6 +21,7 @@ import static android.provider.Settings.Secure.DEVICE_STATE_ROTATION_LOCK_LOCKED
import android.annotation.Nullable;
import android.hardware.devicestate.DeviceStateManager;
import android.os.Trace;
import android.util.Log;
import com.android.settingslib.devicestate.DeviceStateRotationLockSettingsManager;
@@ -117,11 +118,16 @@ public final class DeviceStateRotationLockSettingController
private void updateDeviceState(int state) {
Log.v(TAG, "updateDeviceState [state=" + state + "]");
if (mDeviceState == state) {
return;
}
Trace.beginSection("updateDeviceState [state=" + state + "]");
try {
if (mDeviceState == state) {
return;
}
readPersistedSetting(state);
readPersistedSetting(state);
} finally {
Trace.endSection();
}
}
private void readPersistedSetting(int state) {

View File

@@ -21,6 +21,7 @@ import android.provider.Settings.Secure.CAMERA_AUTOROTATE
import com.android.internal.view.RotationPolicy
import com.android.internal.view.RotationPolicy.RotationPolicyListener
import com.android.systemui.util.settings.SecureSettings
import com.android.systemui.util.traceSection
import javax.inject.Inject
/**
@@ -44,7 +45,9 @@ class RotationPolicyWrapperImpl @Inject constructor(
RotationPolicyWrapper {
override fun setRotationLock(enabled: Boolean) {
RotationPolicy.setRotationLock(context, enabled)
traceSection("RotationPolicyWrapperImpl#setRotationLock") {
RotationPolicy.setRotationLock(context, enabled)
}
}
override fun setRotationLockAtAngle(enabled: Boolean, rotation: Int) {