diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 777e89d145b2d..c7d05f856c2b2 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -1788,10 +1788,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) {