Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

packages-apps-Eleven: 提交

packages/apps/Eleven


Commit MetaInfo

修订版fd343429a1377d0b5b95e3b9fc9f7c4f0d3a91b1 (tree)
时间2018-08-18 20:07:14
作者Joey <joey@line...>
CommiterJoey Rizzoli

Log Message

Eleven: bump to api26

Change-Id: Ib2099cf0852ce2194fbd1058ab74c0710746c7d8
Signed-off-by: Joey <joey@lineageos.org>

更改概述

差异

--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -21,7 +21,7 @@
2121
2222 <uses-sdk
2323 android:minSdkVersion="24"
24- android:targetSdkVersion="24" />
24+ android:targetSdkVersion="26" />
2525
2626 <original-package android:name="com.cyanogenmod.eleven" />
2727
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -207,4 +207,6 @@
207207 <string name="search_title_playlists">All \"%s\" playlists</string>
208208
209209 <string name="duration_format"><xliff:g id="hours">%1$s</xliff:g> <xliff:g id="minutes">%2$s</xliff:g></string>
210+
211+ <string name="channel_music">Music playback</string>
210212 </resources>
--- a/src/org/lineageos/eleven/MusicPlaybackService.java
+++ b/src/org/lineageos/eleven/MusicPlaybackService.java
@@ -18,6 +18,7 @@ import android.annotation.NonNull;
1818 import android.annotation.SuppressLint;
1919 import android.app.AlarmManager;
2020 import android.app.Notification;
21+import android.app.NotificationChannel;
2122 import android.app.NotificationManager;
2223 import android.app.PendingIntent;
2324 import android.app.Service;
@@ -56,6 +57,7 @@ import android.os.SystemClock;
5657 import android.provider.MediaStore;
5758 import android.provider.MediaStore.Audio.AlbumColumns;
5859 import android.provider.MediaStore.Audio.AudioColumns;
60+import android.support.v4.os.BuildCompat;
5961 import android.text.TextUtils;
6062 import android.util.Log;
6163 import android.util.LongSparseArray;
@@ -337,6 +339,8 @@ public class MusicPlaybackService extends Service {
337339 */
338340 public static final int MAX_HISTORY_SIZE = 1000;
339341
342+ private static final String CHANNEL_NAME = "eleven_playback";
343+
340344 public interface TrackErrorExtra {
341345 /**
342346 * Name of the track that was unable to play
@@ -1645,7 +1649,7 @@ public class MusicPlaybackService extends Service {
16451649 mNotificationPostTime = System.currentTimeMillis();
16461650 }
16471651
1648- Notification.Builder builder = new Notification.Builder(this)
1652+ Notification.Builder builder = new Notification.Builder(this, CHANNEL_NAME)
16491653 .setSmallIcon(R.drawable.ic_notification)
16501654 .setLargeIcon(artwork.getBitmap())
16511655 .setContentIntent(clickIntent)
@@ -1666,6 +1670,24 @@ public class MusicPlaybackService extends Service {
16661670
16671671 builder.setColor(artwork.getVibrantDarkColor());
16681672
1673+ if (BuildCompat.isAtLeastO()) {
1674+ NotificationChannel channel = mNotificationManager
1675+ .getNotificationChannel(CHANNEL_NAME);
1676+
1677+ if (channel == null) {
1678+ String name = getString(R.string.channel_music);
1679+
1680+ channel = new NotificationChannel(CHANNEL_NAME, name,
1681+ mNotificationManager.IMPORTANCE_DEFAULT);
1682+ channel.setShowBadge(false);
1683+ channel.enableVibration(false);
1684+ channel.setSound(null, null);
1685+ mNotificationManager.createNotificationChannel(channel);
1686+ }
1687+
1688+ builder.setChannelId(channel.getId());
1689+ }
1690+
16691691 return builder.build();
16701692 }
16711693
Show on old repository browser