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

Commit 0576398c authored by Suprabh Shukla's avatar Suprabh Shukla
Browse files

Minor updates to BIND_ALLOW_FREEZE

BIND_ALLOW_FREEZE is not ready for use outside of the system and can
result in apps breaking themselves by mistake.

Also removing it from BIND_REDUCTION_FLAGS as this is no longer meant to
be a dynamic flag. If the client goes through LRU changes, it is better
to have those propagated to the remote service as well.

Test: atest CtsAppTestCases:ServiceTest#testBindAllowFreezeProhibited

Flag: NONE changes are to an existing BIND_FLAG that is not used
anywhere yet.

Bug: 393149737
Change-Id: I3e56755e95962f4c4b60a7732dc99595110eb38e
parent b68ba094
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -760,8 +760,7 @@ public abstract class Context {
     */
    public static final long BIND_REDUCTION_FLAGS =
            Context.BIND_ALLOW_OOM_MANAGEMENT | Context.BIND_WAIVE_PRIORITY
                    | Context.BIND_NOT_PERCEPTIBLE | Context.BIND_NOT_VISIBLE
                    | Context.BIND_ALLOW_FREEZE;
                    | Context.BIND_NOT_PERCEPTIBLE | Context.BIND_NOT_VISIBLE;

    /** @hide */
    @IntDef(flag = true, prefix = { "RECEIVER_VISIBLE" }, value = {
+5 −0
Original line number Diff line number Diff line
@@ -4162,6 +4162,11 @@ public final class ActiveServices {
                    "BIND_ALLOW_FOREGROUND_SERVICE_STARTS_FROM_BACKGROUND");
        }

        if ((flags & Context.BIND_ALLOW_FREEZE) != 0 && !isCallerSystem) {
            throw new SecurityException("Non-system caller (pid=" + callingPid
                    + ") set BIND_ALLOW_FREEZE when binding service " + service);
        }

        final boolean callerFg = callerApp.mState.getSetSchedGroup()
                != ProcessList.SCHED_GROUP_BACKGROUND;
        final boolean isBindExternal =