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

Commit 48fe994f authored by Rupesh Bansal's avatar Rupesh Bansal Committed by Android (Google) Code Review
Browse files

Merge "Update workchain when wakelock uids updated" into main

parents 107fe807 ee0d554c
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1573,6 +1573,13 @@ java_aconfig_library {
    defaults: ["framework-minus-apex-aconfig-java-defaults"],
}

java_aconfig_library {
    name: "power_flags_lib_host",
    aconfig_declarations: "power_flags",
    host_supported: true,
    defaults: ["framework-minus-apex-aconfig-java-defaults"],
}

// Content
aconfig_declarations {
    name: "android.content.flags-aconfig",
+11 −0
Original line number Diff line number Diff line
@@ -4213,6 +4213,17 @@ public final class PowerManager {
            else mFlags &= ~UNIMPORTANT_FOR_LOGGING;
        }

        /** @hide */
        public void updateUids(int[] uids) {
            synchronized (mToken) {
                try {
                    mService.updateWakeLockUids(mToken, uids);
                } catch (RemoteException e) {
                    throw e.rethrowFromSystemServer();
                }
            }
        }

        @Override
        public String toString() {
            synchronized (mToken) {
+13 −4
Original line number Diff line number Diff line
@@ -5979,12 +5979,21 @@ public final class PowerManagerService extends SystemService

            if (uids != null) {
                ws = new WorkSource();
                // XXX should WorkSource have a way to set uids as an int[] instead of adding them
                // one at a time?
                if (mFeatureFlags.isWakelockAttributionViaWorkchainEnabled()) {
                    int callingUid = Binder.getCallingUid();
                    for (int uid : uids) {
                        WorkChain workChain = ws.createWorkChain();
                        workChain.addNode(uid, null);
                        workChain.addNode(callingUid, null);
                    }
                } else {
                    // XXX should WorkSource have a way to set uids as an int[] instead of
                    // adding them one at a time?
                    for (int uid : uids) {
                        ws.add(uid);
                    }
                }
            }
            updateWakeLockWorkSource(lock, ws, null);
        }

+12 −0
Original line number Diff line number Diff line
@@ -63,6 +63,10 @@ public class PowerManagerFlags {
    private final FlagState mMoveWscLoggingToNotifier =
            new FlagState(Flags.FLAG_MOVE_WSC_LOGGING_TO_NOTIFIER, Flags::moveWscLoggingToNotifier);

    private final FlagState mWakelockAttributionViaWorkchain =
            new FlagState(Flags.FLAG_WAKELOCK_ATTRIBUTION_VIA_WORKCHAIN,
                    Flags::wakelockAttributionViaWorkchain);

    /** Returns whether early-screen-timeout-detector is enabled on not. */
    public boolean isEarlyScreenTimeoutDetectorEnabled() {
        return mEarlyScreenTimeoutDetectorFlagState.isEnabled();
@@ -109,6 +113,13 @@ public class PowerManagerFlags {
        return mMoveWscLoggingToNotifier.isEnabled();
    }

    /**
     * @return Whether the wakelock attribution via workchain is enabled
     */
    public boolean isWakelockAttributionViaWorkchainEnabled() {
        return mWakelockAttributionViaWorkchain.isEnabled();
    }

    /**
     * dumps all flagstates
     * @param pw printWriter
@@ -120,6 +131,7 @@ public class PowerManagerFlags {
        pw.println(" " + mPerDisplayWakeByTouch);
        pw.println(" " + mFrameworkWakelockInfo);
        pw.println(" " + mMoveWscLoggingToNotifier);
        pw.println(" " + mWakelockAttributionViaWorkchain);
    }

    private static class FlagState {
+11 −0
Original line number Diff line number Diff line
@@ -22,6 +22,17 @@ flag {
    }
}

flag {
    name: "wakelock_attribution_via_workchain"
    namespace: "power"
    description: "Enables the attribution of wakelocks via WorkChain for updateWakelockUids"
    bug: "331304805"
    is_fixed_read_only: true
    metadata {
      purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "improve_wakelock_latency"
    namespace: "power"
Loading