Merge "Reduce unnecessary invocation of pokeDrawLock"

This commit is contained in:
Riddle Hsu
2022-02-11 06:42:56 +00:00
committed by Android (Google) Code Review

View File

@@ -1794,10 +1794,16 @@ public final class ViewRootImpl implements ViewParent,
}
void pokeDrawLockIfNeeded() {
final int displayState = mAttachInfo.mDisplayState;
if (mView != null && mAdded && mTraversalScheduled
&& (displayState == Display.STATE_DOZE
|| displayState == Display.STATE_DOZE_SUSPEND)) {
if (!Display.isDozeState(mAttachInfo.mDisplayState)) {
// Only need to acquire wake lock for DOZE state.
return;
}
if (mWindowAttributes.type != WindowManager.LayoutParams.TYPE_BASE_APPLICATION) {
// Non-activity windows should be responsible to hold wake lock by themself, because
// usually they are system windows.
return;
}
if (mAdded && mTraversalScheduled && mAttachInfo.mHasWindowFocus) {
try {
mWindowSession.pokeDrawLock(mWindow);
} catch (RemoteException ex) {