Stop crashing the system on hitting the alarm limit
Exempting the system as a runtime restart is not clearly better than extreme memory and computation pressure that can result from the originating spam. Callers in the system should guard against any spammy requests that lead them to create a lot of alarms. Test: Builds, boots and existing tests should pass. atest CtsAlarmManagerTestCases:UidCapTests atest FrameworksMockingServicesTests:AlarmManagerServiceTest Bug: 234441463 Change-Id: Id5e94d44ac9ab24870a8213ec7583da0f592a5ff (cherry picked from commit3b9f3f4a0f) Merged-In: Id5e94d44ac9ab24870a8213ec7583da0f592a5ff (cherry picked from commitc010da3a46)
This commit is contained in:
@@ -75,6 +75,7 @@ import android.text.format.DateFormat;
|
|||||||
import android.text.format.DateUtils;
|
import android.text.format.DateUtils;
|
||||||
import android.util.ArrayMap;
|
import android.util.ArrayMap;
|
||||||
import android.util.ArraySet;
|
import android.util.ArraySet;
|
||||||
|
import android.util.EventLog;
|
||||||
import android.util.KeyValueListParser;
|
import android.util.KeyValueListParser;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.LongArrayQueue;
|
import android.util.LongArrayQueue;
|
||||||
@@ -1776,7 +1777,11 @@ class AlarmManagerService extends SystemService {
|
|||||||
if (DEBUG_PER_UID_LIMIT && UserHandle.isCore(callingUid)) {
|
if (DEBUG_PER_UID_LIMIT && UserHandle.isCore(callingUid)) {
|
||||||
logAllAlarmsForUidLocked(callingUid);
|
logAllAlarmsForUidLocked(callingUid);
|
||||||
}
|
}
|
||||||
throw new IllegalStateException(errorMsg);
|
if (callingUid != Process.SYSTEM_UID) {
|
||||||
|
throw new IllegalStateException(errorMsg);
|
||||||
|
} else {
|
||||||
|
EventLog.writeEvent(0x534e4554, "234441463", -1, errorMsg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
setImplLocked(type, triggerAtTime, triggerElapsed, windowLength, maxElapsed,
|
setImplLocked(type, triggerAtTime, triggerElapsed, windowLength, maxElapsed,
|
||||||
interval, operation, directReceiver, listenerTag, flags, true, workSource,
|
interval, operation, directReceiver, listenerTag, flags, true, workSource,
|
||||||
|
|||||||
Reference in New Issue
Block a user