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

Commit 23c63190 authored by Sam Mortimer's avatar Sam Mortimer Committed by Roman Birg
Browse files

Frameworks AppOps: Enable MODE_IGNORED for OP_WAKE_LOCK

  *) Kitkat commit log highlights that the current
     implementation state is for auditing only
     https://android.googlesource.com/platform/frameworks/base/+/713df150b92a0a5eea877f99405e31eefbf93a09

  *) We go one step further and honour MODE_IGNORED
     for OP_WAKE_LOCK.

Change-Id: I889227ca24a508a0d96bd43594c5179ba758ae3d
parent 221a7eef
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -3287,6 +3287,20 @@ public final class PowerManagerService extends SystemService

            final int uid = Binder.getCallingUid();
            final int pid = Binder.getCallingPid();

            try {
                if (mAppOps != null &&
                        mAppOps.checkOperation(AppOpsManager.OP_WAKE_LOCK, uid, packageName)
                        != AppOpsManager.MODE_ALLOWED) {
                    Slog.d(TAG, "acquireWakeLock: ignoring request from " + packageName);
                    // For (ignore) accounting purposes
                    mAppOps.noteOperation(AppOpsManager.OP_WAKE_LOCK, uid, packageName);
                    // silent return
                    return;
                }
            } catch (RemoteException e) {
            }

            final long ident = Binder.clearCallingIdentity();
            try {
                acquireWakeLockInternal(lock, flags, tag, packageName, ws, historyTag, uid, pid);