Updater: Add notification channels

Change-Id: I2f538fb47fe90e1008bf286739d33c829123353a
This commit is contained in:
Harry Youd
2017-09-27 22:33:00 +01:00
committed by LuK1337
parent 0e79b791f0
commit ff53035537
4 changed files with 39 additions and 5 deletions

View File

@@ -15,6 +15,7 @@
*/
package org.lineageos.updater;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
@@ -43,6 +44,9 @@ public class ExportUpdateService extends Service {
public static final String EXTRA_SOURCE_FILE = "source_file";
public static final String EXTRA_DEST_FILE = "dest_file";
private static final String EXPORT_NOTIFICATION_CHANNEL =
"export_notification_channel";
private volatile boolean mIsExporting = false;
private Thread mExportThread;
@@ -133,8 +137,14 @@ public class ExportUpdateService extends Service {
private void startExporting(File source, File destination) {
NotificationManager notificationManager =
(NotificationManager) getSystemService(NOTIFICATION_SERVICE);
NotificationChannel notificationChannel = new NotificationChannel(
EXPORT_NOTIFICATION_CHANNEL,
getString(R.string.export_channel_title),
NotificationManager.IMPORTANCE_LOW);
notificationManager.createNotificationChannel(notificationChannel);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this,
EXPORT_NOTIFICATION_CHANNEL);
NotificationCompat.BigTextStyle notificationStyle = new NotificationCompat.BigTextStyle();
notificationBuilder.setContentTitle(getString(R.string.dialog_export_title));
notificationStyle.setBigContentTitle(getString(R.string.dialog_export_title));