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

Commit 2ed2d1a3 authored by Chen Bai's avatar Chen Bai Committed by Android (Google) Code Review
Browse files

Merge "draw-wakelock: disable draw wakelock to limit aod animation" into main

parents a5ac6b8e c88729d9
Loading
Loading
Loading
Loading
+17 −0
Original line number Original line 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.forceInvertColor;
import static android.view.accessibility.Flags.reduceWindowContentChangedEventThrottle;
import static android.view.accessibility.Flags.reduceWindowContentChangedEventThrottle;
import static android.view.flags.Flags.addSchandleToVriSurface;
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.sensitiveContentAppProtection;
import static android.view.flags.Flags.sensitiveContentPrematureProtectionRemovedFix;
import static android.view.flags.Flags.sensitiveContentPrematureProtectionRemovedFix;
import static android.view.flags.Flags.toolkitFrameRateFunctionEnablingReadOnly;
import static android.view.flags.Flags.toolkitFrameRateFunctionEnablingReadOnly;
@@ -149,6 +150,8 @@ import android.app.ResourcesManager;
import android.app.WindowConfiguration;
import android.app.WindowConfiguration;
import android.app.compat.CompatChanges;
import android.app.compat.CompatChanges;
import android.app.servertransaction.WindowStateTransactionItem;
import android.app.servertransaction.WindowStateTransactionItem;
import android.compat.annotation.ChangeId;
import android.compat.annotation.EnabledSince;
import android.compat.annotation.UnsupportedAppUsage;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.ClipData;
import android.content.ClipData;
import android.content.ClipDescription;
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_INPUT_FOCUS = 62001;
    private static final int LOGTAG_VIEWROOT_DRAW_EVENT = 60004;
    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
     * 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
     * threaded renderer (aka hardware renderering) is used. Note that by disabling
@@ -2459,6 +2471,11 @@ public final class ViewRootImpl implements ViewParent,
    }
    }
    void pokeDrawLockIfNeeded() {
    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)) {
        if (!Display.isDozeState(mAttachInfo.mDisplayState)) {
            // Only need to acquire wake lock for DOZE state.
            // Only need to acquire wake lock for DOZE state.
            return;
            return;
+8 −0
Original line number Original line Diff line number Diff line
@@ -90,3 +90,11 @@ flag {
        purpose: PURPOSE_BUGFIX
        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