Skip to content

Commit

Permalink
AppOps: Don't apply OP_ALARM_WAKEUP to system components
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rmcc authored and Brint E. Kriebel committed May 23, 2014
1 parent 16e75e0 commit 4b06d0d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion services/java/com/android/server/AlarmManagerService.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
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;
Expand Down Expand Up @@ -598,7 +599,8 @@ public void set(int type, long triggerAtTime, long windowLength, long interval,
}

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(),
Expand Down

0 comments on commit 4b06d0d

Please sign in to comment.