summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Nishi <dhnishi@google.com>2017-05-11 17:17:22 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2017-05-11 17:17:22 +0000
commitfba28b719163121d163a01266b9913030c8fff46 (patch)
tree3df00c8b801dfdb65bbb31e59c5c75a919ac46f4 /src
parent45097627fa4167ccb0774514fc9706488e57f019 (diff)
parentb8047c838a5e4dcd50606a316820990608744a0f (diff)
downloadStorageManager-fba28b719163121d163a01266b9913030c8fff46.tar.gz
Merge "Fix notification bug." into oc-dev
Diffstat (limited to 'src')
-rw-r--r--src/com/android/storagemanager/automatic/NotificationController.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/com/android/storagemanager/automatic/NotificationController.java b/src/com/android/storagemanager/automatic/NotificationController.java
index b8b67b6..99c5b32 100644
--- a/src/com/android/storagemanager/automatic/NotificationController.java
+++ b/src/com/android/storagemanager/automatic/NotificationController.java
@@ -25,10 +25,10 @@ import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Resources;
-import android.os.Build;
import android.os.SystemProperties;
import android.provider.Settings;
import android.support.annotation.VisibleForTesting;
+import android.support.v4.os.BuildCompat;
import com.android.storagemanager.R;
@@ -193,7 +193,10 @@ public class NotificationController extends BroadcastReceiver {
PendingIntent.FLAG_ONE_SHOT);
Notification.Builder builder;
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ // We really should only have the path with the notification channel set. The other path is
+ // only for legacy Robolectric reasons -- Robolectric does not have the Notification
+ // builder with a channel id, so it crashes when it hits that code path.
+ if (BuildCompat.isAtLeastO()) {
makeNotificationChannel(context);
builder = new Notification.Builder(context, CHANNEL_ID);
} else {