diff --git a/app/src/main/java/be/ugent/zeus/hydra/urgent/MediaNotificationBuilder.java b/app/src/main/java/be/ugent/zeus/hydra/urgent/MediaNotificationBuilder.java index ec748ee39..efc71eea4 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/urgent/MediaNotificationBuilder.java +++ b/app/src/main/java/be/ugent/zeus/hydra/urgent/MediaNotificationBuilder.java @@ -52,6 +52,10 @@ class MediaNotificationBuilder { Notification buildNotification(MediaSessionCompat mediaSession) { MediaControllerCompat controller = mediaSession.getController(); + var playbackState = controller.getPlaybackState(); + if (playbackState == null) { + return null; // Nothing we can do currently. + } // Construct the actual notification NotificationCompat.Builder builder = new NotificationCompat.Builder(context, ChannelCreator.URGENT_CHANNEL); @@ -65,10 +69,10 @@ Notification buildNotification(MediaSessionCompat mediaSession) { .setShowActionsInCompactView(0); // Construct the play/pause button. - boolean isPlaying = controller.getPlaybackState().getState() == PlaybackStateCompat.STATE_PLAYING; - boolean isConnecting = controller.getPlaybackState().getState() == PlaybackStateCompat.STATE_CONNECTING - || controller.getPlaybackState().getState() == PlaybackStateCompat.STATE_BUFFERING; - boolean isError = controller.getPlaybackState().getState() == PlaybackStateCompat.STATE_ERROR; + boolean isPlaying = playbackState.getState() == PlaybackStateCompat.STATE_PLAYING; + boolean isConnecting = playbackState.getState() == PlaybackStateCompat.STATE_CONNECTING + || playbackState.getState() == PlaybackStateCompat.STATE_BUFFERING; + boolean isError = playbackState.getState() == PlaybackStateCompat.STATE_ERROR; if (isPlaying || isConnecting) { builder.addAction(new NotificationCompat.Action( R.drawable.noti_ic_stop, diff --git a/flake.lock b/flake.lock index 38c5dee1d..4b8943aec 100644 --- a/flake.lock +++ b/flake.lock @@ -8,11 +8,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1695973661, - "narHash": "sha256-BP2H4c42GThPIhERtTpV1yCtwQHYHEKdRu7pjrmQAwo=", + "lastModified": 1701787589, + "narHash": "sha256-ce+oQR4Zq9VOsLoh9bZT8Ip9PaMLcjjBUHVPzW5d7Cw=", "owner": "numtide", "repo": "devshell", - "rev": "cd4e2fda3150dd2f689caeac07b7f47df5197c31", + "rev": "44ddedcbcfc2d52a76b64fb6122f209881bd3e1e", "type": "github" }, "original": { @@ -26,11 +26,11 @@ "systems": "systems_2" }, "locked": { - "lastModified": 1694529238, - "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", "owner": "numtide", "repo": "flake-utils", - "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", "type": "github" }, "original": { @@ -41,11 +41,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1698134075, - "narHash": "sha256-foCD+nuKzfh49bIoiCBur4+Fx1nozo+4C/6k8BYk4sg=", + "lastModified": 1702151865, + "narHash": "sha256-9VAt19t6yQa7pHZLDbil/QctAgVsA66DLnzdRGqDisg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "8efd5d1e283604f75a808a20e6cde0ef313d07d4", + "rev": "666fc80e7b2afb570462423cb0e1cf1a3a34fedd", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 8c90800c1..0a85b588e 100644 --- a/flake.nix +++ b/flake.nix @@ -25,10 +25,13 @@ toolsVersion = null; platformToolsVersion = androidVersions.platformToolsVersion; buildToolsVersions = [ androidVersions.buildToolsVersions ]; - includeEmulator = false; + includeEmulator = true; + emulatorVersion = "34.1.9"; + includeSystemImages = true; + systemImageTypes = [ "google_apis_playstore" ]; + abiVersions = [ "x86_64" ]; platformVersions = [ androidVersions.platformVersions ]; - # Enable once nixpkgs is fixed... - includeSources = false; + includeSources = true; includeNDK = false; useGoogleAPIs = true; includeExtras = [ diff --git a/gradle.properties b/gradle.properties index b9cd10eba..a5e1a0d32 100644 --- a/gradle.properties +++ b/gradle.properties @@ -20,7 +20,6 @@ # SOFTWARE. # -android.defaults.buildfeatures.buildconfig=true android.nonFinalResIds=false android.nonTransitiveRClass=false android.useAndroidX=true