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

Commit 57c34cb2 authored by Kweku Adams's avatar Kweku Adams
Browse files

Make sure only the system uses BIND_ALMOST_PERCEPTIBLE.

Bug: 223437753
Change-Id: I68cff7c10e804952f3ace987bb42bb65db21be93
Test: Android builds
parent 2e92c6b7
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -2789,6 +2789,11 @@ public final class ActiveServices {
                            + ") set BIND_ALLOW_INSTANT when binding service " + service);
        }

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

        if ((flags & Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS) != 0) {
            mAm.enforceCallingPermission(
                    android.Manifest.permission.START_ACTIVITIES_FROM_BACKGROUND,