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 commit 3b9f3f4a0f)
Merged-In: Id5e94d44ac9ab24870a8213ec7583da0f592a5ff
This commit is contained in:
@@ -75,6 +75,7 @@ import android.text.format.DateFormat;
|
||||
import android.text.format.DateUtils;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.ArraySet;
|
||||
import android.util.EventLog;
|
||||
import android.util.KeyValueListParser;
|
||||
import android.util.Log;
|
||||
import android.util.LongArrayQueue;
|
||||
@@ -1768,7 +1769,11 @@ class AlarmManagerService extends SystemService {
|
||||
mHandler.obtainMessage(AlarmHandler.UNREGISTER_CANCEL_LISTENER,
|
||||
operation).sendToTarget();
|
||||
Slog.w(TAG, errorMsg);
|
||||
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,
|
||||
interval, operation, directReceiver, listenerTag, flags, true, workSource,
|
||||
|
||||
Reference in New Issue
Block a user