2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-31 14:15:14 +00:00

Migrate to Oreo and drop support for APIs < 16

Summary:
- Add a foreground notification to the background service
- Add channel to notifications.
- Remove unneeded permission
- Remove legacy ciphers now that we don't support API<16

Reviewers: #kde_connect

Subscribers: mtijink, nicolasfella, albertvaka, apol, kdeconnect, #kde_connect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D12881
This commit is contained in:
Albert Vaca
2018-05-15 01:10:39 +02:00
parent e617daf356
commit ebf63dd294
3 changed files with 12 additions and 4 deletions

View File

@@ -246,5 +246,6 @@
<string name="dark_theme">Dark theme</string>
<string name="notification_channel_default">Other notifications</string>
<string name="notification_channel_persistent">Persistent indicator</string>
<string name="notification_channel_media_control">Media control</string>
</resources>

View File

@@ -12,6 +12,7 @@ public class NotificationHelper {
public static class Channels {
public final static String PERSISTENT = "persistent";
public final static String DEFAULT = "default";
public final static String MEDIA_CONTROL = "media_control";
}
public static void notifyCompat(NotificationManager notificationManager, int notificationId, Notification notification) {
@@ -40,6 +41,12 @@ public class NotificationHelper {
NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
manager.createNotificationChannel(new NotificationChannel(
Channels.PERSISTENT,
context.getString(R.string.notification_channel_persistent),
NotificationManager.IMPORTANCE_DEFAULT)
);
manager.createNotificationChannel(new NotificationChannel(
Channels.DEFAULT,
context.getString(R.string.notification_channel_default),
@@ -47,9 +54,9 @@ public class NotificationHelper {
);
manager.createNotificationChannel(new NotificationChannel(
Channels.PERSISTENT,
context.getString(R.string.notification_channel_persistent),
NotificationManager.IMPORTANCE_DEFAULT)
Channels.MEDIA_CONTROL,
context.getString(R.string.notification_channel_media_control),
NotificationManager.IMPORTANCE_LOW)
);
}

View File

@@ -308,7 +308,7 @@ public class MprisMediaSession implements SharedPreferences.OnSharedPreferenceCh
final NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
NotificationCompat.Builder notification = new NotificationCompat.Builder(context, NotificationHelper.Channels.DEFAULT);
NotificationCompat.Builder notification = new NotificationCompat.Builder(context, NotificationHelper.Channels.MEDIA_CONTROL);
notification
.setAutoCancel(false)