Merge "ADPF hint for NOTIFICATION_SHADE_EXPAND_COLLAPSE" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
5e0aec22fb
@@ -2426,7 +2426,7 @@ public final class ViewRootImpl implements ViewParent,
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
void notifyRendererOfExpensiveFrame() {
|
||||
public void notifyRendererOfExpensiveFrame() {
|
||||
if (mAttachInfo.mThreadedRenderer != null) {
|
||||
mAttachInfo.mThreadedRenderer.notifyExpensiveFrame();
|
||||
}
|
||||
|
||||
@@ -29,13 +29,17 @@ import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.os.StrictMode;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.Trace;
|
||||
import android.view.Choreographer;
|
||||
import android.view.View;
|
||||
import android.view.ViewRootImpl;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.systemui.util.Assert;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Random;
|
||||
import java.util.Stack;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@@ -43,12 +47,14 @@ import java.util.function.Supplier;
|
||||
* Utility class for methods used to dejank the UI.
|
||||
*/
|
||||
public class DejankUtils {
|
||||
private static final String TRACK_NAME = "DejankUtils";
|
||||
|
||||
public static final boolean STRICT_MODE_ENABLED = Build.IS_ENG
|
||||
|| SystemProperties.getBoolean("persist.sysui.strictmode", false);
|
||||
private static final Choreographer sChoreographer = Choreographer.getInstance();
|
||||
private static final Handler sHandler = new Handler();
|
||||
private static final ArrayList<Runnable> sPendingRunnables = new ArrayList<>();
|
||||
private static final Random sRandom = new Random();
|
||||
private static Stack<String> sBlockingIpcs = new Stack<>();
|
||||
private static boolean sTemporarilyIgnoreStrictMode;
|
||||
private static final HashSet<String> sWhitelistedFrameworkClasses = new HashSet<>();
|
||||
@@ -254,4 +260,30 @@ public class DejankUtils {
|
||||
public static void setImmediate(boolean immediate) {
|
||||
sImmediate = immediate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls notifyRendererOfExpensiveFrame on the ViewRootImpl after performing null checks.
|
||||
*/
|
||||
public static void notifyRendererOfExpensiveFrame(View view, String reason) {
|
||||
if (view == null) return;
|
||||
notifyRendererOfExpensiveFrame(view.getViewRootImpl(), reason);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls notifyRendererOfExpensiveFrame on the ViewRootImpl after performing null checks.
|
||||
*/
|
||||
public static void notifyRendererOfExpensiveFrame(ViewRootImpl viewRoot, String reason) {
|
||||
if (viewRoot == null) return;
|
||||
if (Trace.isTagEnabled(Trace.TRACE_TAG_APP)) {
|
||||
int cookie = sRandom.nextInt();
|
||||
Trace.asyncTraceForTrackBegin(
|
||||
Trace.TRACE_TAG_APP,
|
||||
TRACK_NAME,
|
||||
"notifyRendererOfExpensiveFrame (" + reason + ")",
|
||||
cookie);
|
||||
DejankUtils.postAfterTraversal(
|
||||
() -> Trace.asyncTraceForTrackEnd(Trace.TRACE_TAG_APP, TRACK_NAME, cookie));
|
||||
}
|
||||
viewRoot.notifyRendererOfExpensiveFrame();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,6 +222,8 @@ import com.android.systemui.util.Utils;
|
||||
import com.android.systemui.util.time.SystemClock;
|
||||
import com.android.wm.shell.animation.FlingAnimationUtils;
|
||||
|
||||
import kotlin.Unit;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -232,7 +234,6 @@ import java.util.function.Consumer;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Provider;
|
||||
|
||||
import kotlin.Unit;
|
||||
import kotlinx.coroutines.CoroutineDispatcher;
|
||||
|
||||
@CentralSurfacesComponent.CentralSurfacesScope
|
||||
@@ -3450,6 +3451,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
|
||||
@VisibleForTesting
|
||||
void notifyExpandingStarted() {
|
||||
if (!mExpanding) {
|
||||
DejankUtils.notifyRendererOfExpensiveFrame(mView, "notifyExpandingStarted");
|
||||
mExpanding = true;
|
||||
mIsExpandingOrCollapsing = true;
|
||||
mQsController.onExpandingStarted(mQsController.getFullyExpanded());
|
||||
|
||||
@@ -63,6 +63,7 @@ import com.android.internal.policy.ScreenDecorationsUtils;
|
||||
import com.android.internal.policy.SystemBarUtils;
|
||||
import com.android.keyguard.FaceAuthApiRequestReason;
|
||||
import com.android.keyguard.KeyguardUpdateMonitor;
|
||||
import com.android.systemui.DejankUtils;
|
||||
import com.android.systemui.Dumpable;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.classifier.Classifier;
|
||||
@@ -958,6 +959,7 @@ public class QuickSettingsController implements Dumpable {
|
||||
// TODO (b/265193930): remove dependency on NPVC
|
||||
mPanelViewControllerLazy.get().cancelHeightAnimator();
|
||||
// end
|
||||
DejankUtils.notifyRendererOfExpensiveFrame(mPanelView, "onExpansionStarted");
|
||||
|
||||
// Reset scroll position and apply that position to the expanded height.
|
||||
float height = mExpansionHeight;
|
||||
|
||||
@@ -83,7 +83,8 @@ open class BlurUtils @Inject constructor(
|
||||
return
|
||||
}
|
||||
if (lastAppliedBlur == 0 && radius != 0) {
|
||||
Trace.asyncTraceForTrackBegin(TRACE_TAG_APP, TRACK_NAME, EARLY_WAKEUP_SLICE_NAME, 0)
|
||||
Trace.asyncTraceForTrackBegin(
|
||||
TRACE_TAG_APP, TRACK_NAME, "eEarlyWakeup (prepareBlur)", 0)
|
||||
earlyWakeupEnabled = true
|
||||
createTransaction().use {
|
||||
it.setEarlyWakeupStart()
|
||||
@@ -110,7 +111,7 @@ open class BlurUtils @Inject constructor(
|
||||
Trace.asyncTraceForTrackBegin(
|
||||
TRACE_TAG_APP,
|
||||
TRACK_NAME,
|
||||
EARLY_WAKEUP_SLICE_NAME,
|
||||
"eEarlyWakeup (applyBlur)",
|
||||
0
|
||||
)
|
||||
it.setEarlyWakeupStart()
|
||||
@@ -159,6 +160,5 @@ open class BlurUtils @Inject constructor(
|
||||
|
||||
companion object {
|
||||
const val TRACK_NAME = "BlurUtils"
|
||||
const val EARLY_WAKEUP_SLICE_NAME = "eEarlyWakeup"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3677,7 +3677,10 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
|
||||
private void onShadeVisibilityChanged(boolean visible) {
|
||||
if (mVisible != visible) {
|
||||
mVisible = visible;
|
||||
if (!visible) {
|
||||
if (visible) {
|
||||
DejankUtils.notifyRendererOfExpensiveFrame(
|
||||
mNotificationShadeWindowView, "onShadeVisibilityChanged");
|
||||
} else {
|
||||
mGutsManager.closeAndSaveGuts(true /* removeLeavebehind */, true /* force */,
|
||||
true /* removeControls */, -1 /* x */, -1 /* y */, true /* resetMenu */);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user