summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Michael Wright <michaelwr@google.com> 2017-03-23 18:57:57 +0000
committer Michael Wright <michaelwr@google.com> 2017-03-23 18:57:57 +0000
commitbc4d0d923f5db95d7b3560c0aaf72e77ca4a1bf9 (patch)
tree2e0ae5984f9eade316dfffbc4c8e09878053359a
parent2a5b32faec920d8f690c56a61c2f242f438c5f15 (diff)
Ignore notifications with zero-timing vibrations.
It's now an error to create one of these, but we don't want to crash system_server because an app passed us a bad value. Instead just catch the exception and ignore the pattern. Bug: 36552808 Test: App that posts a notification with all 0 timings. Crashes before this patch but not after. Change-Id: I1f8e2d6d3e7df1186c7a1ce3925e5358cb32290d
-rw-r--r--services/core/java/com/android/server/notification/NotificationManagerService.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index 3727a5b79440..7612f872eea0 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -179,6 +179,7 @@ import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.util.ArrayDeque;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -3645,6 +3646,10 @@ public class NotificationManagerService extends SystemService {
mVibrator.vibrate(record.sbn.getUid(), record.sbn.getOpPkg(),
effect, record.getAudioAttributes());
return true;
+ } catch (IllegalArgumentException e) {
+ Slog.e(TAG, "Error creating vibration waveform with pattern: " +
+ Arrays.toString(vibration));
+ return false;
} finally{
Binder.restoreCallingIdentity(identity);
}