Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c88729d9 authored by Chen Bai's avatar Chen Bai
Browse files

draw-wakelock: disable draw wakelock to limit aod animation

DRAW_WAKE_LOCK is an internal wakelock that is acquired per frame while
DOZE. It was added for ambient transition and per-minute
screen change. However, an loop transition animation could extend the
wakelock infiintely which drains the battery. Since Wear SystemUI now
can manage the animation allowing window by itself, DRAW_WAKE_LOCK will
be disabled starting U.

Flag: android.view.flags.disable_draw_wake_lock
Test: go/verification-limit-aod-animation
Bug: 349153669
Change-Id: Id67cdcd6f22bb8fd3e2db23346d8004da351c54d
parent 153d8555
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -114,6 +114,7 @@ import static android.view.accessibility.Flags.fixMergedContentChangeEventV2;
import static android.view.accessibility.Flags.forceInvertColor;
import static android.view.accessibility.Flags.reduceWindowContentChangedEventThrottle;
import static android.view.flags.Flags.addSchandleToVriSurface;
import static android.view.flags.Flags.disableDrawWakeLock;
import static android.view.flags.Flags.sensitiveContentAppProtection;
import static android.view.flags.Flags.sensitiveContentPrematureProtectionRemovedFix;
import static android.view.flags.Flags.toolkitFrameRateFunctionEnablingReadOnly;
@@ -149,6 +150,8 @@ import android.app.ResourcesManager;
import android.app.WindowConfiguration;
import android.app.compat.CompatChanges;
import android.app.servertransaction.WindowStateTransactionItem;
import android.compat.annotation.ChangeId;
import android.compat.annotation.EnabledSince;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.ClipData;
import android.content.ClipDescription;
@@ -336,6 +339,15 @@ public final class ViewRootImpl implements ViewParent,
    private static final int LOGTAG_INPUT_FOCUS = 62001;
    private static final int LOGTAG_VIEWROOT_DRAW_EVENT = 60004;
    /**
     * This change disables the {@code DRAW_WAKE_LOCK}, an internal wakelock acquired per-frame
     * duration display DOZE. It was added to allow animation during AOD. This wakelock consumes
     * battery severely if the animation is too heavy, so, it will be removed.
     */
    @ChangeId
    @EnabledSince(targetSdkVersion = Build.VERSION_CODES.VANILLA_ICE_CREAM)
    private static final long DISABLE_DRAW_WAKE_LOCK = 349153669L;
    /**
     * Set to false if we do not want to use the multi threaded renderer even though
     * threaded renderer (aka hardware renderering) is used. Note that by disabling
@@ -2459,6 +2471,11 @@ public final class ViewRootImpl implements ViewParent,
    }
    void pokeDrawLockIfNeeded() {
        // Disable DRAW_WAKE_LOCK starting U. Otherwise, only need to acquire it for DOZE state.
        if (CompatChanges.isChangeEnabled(DISABLE_DRAW_WAKE_LOCK) && disableDrawWakeLock()) {
            return;
        }
        if (!Display.isDozeState(mAttachInfo.mDisplayState)) {
            // Only need to acquire wake lock for DOZE state.
            return;
+8 −0
Original line number Diff line number Diff line
@@ -90,3 +90,11 @@ flag {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "disable_draw_wake_lock"
    namespace: "wear_frameworks"
    description: "Disable Draw Wakelock starting U."
    bug: "331698645"
    is_fixed_read_only: true
}
 No newline at end of file