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

Commit 5587a439 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
Browse files

AppOps: Don't apply OP_ALARM_WAKEUP to system components

System can freely invoke and manage alarms. Preventing it from doing
so interferes with remote components like the backupmanager (backing up alarms)
due to the mismatched uids between the invoking app and the running
service that takes the action.

Change-Id: I079df8d2522642d6d9194781207df7dd67b715b2
parent 94186f84
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.PowerManager;
import android.os.Process;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.UserHandle;
@@ -598,7 +599,8 @@ class AlarmManagerService extends IAlarmManager.Stub {
        }

        boolean wakeupFiltered = false;
        if ((type == AlarmManager.RTC_WAKEUP
        if (operation.getCreatorUid() >= Process.FIRST_APPLICATION_UID &&
                (type == AlarmManager.RTC_WAKEUP
                        || type == AlarmManager.ELAPSED_REALTIME_WAKEUP)
                && mAppOps.checkOpNoThrow(AppOpsManager.OP_ALARM_WAKEUP,
                        operation.getCreatorUid(),