Loading res/values/strings.xml +4 −0 Original line number Diff line number Diff line Loading @@ -127,4 +127,8 @@ <string name="blocked_update_dialog_title">Update blocked</string> <string name="blocked_update_dialog_message">This update cannot be installed using the updater app. Please read <xliff:g id="info_url">%1$s</xliff:g> for more information.</string> <string name="blocked_update_info_url" translatable="false">http://wiki.lineageos.org/upgrading.html</string> <string name="export_channel_title">Export completion</string> <string name="new_updates_channel_title">New updates</string> <string name="ongoing_channel_title">Ongoing downloads</string> </resources> src/org/lineageos/updater/ExportUpdateService.java +12 −2 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ */ package org.lineageos.updater; import android.app.NotificationChannel; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.Service; Loading Loading @@ -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; Loading Loading @@ -133,8 +137,14 @@ public class ExportUpdateService extends Service { private void startExporting(File source, File destination) { NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this); 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, 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)); Loading src/org/lineageos/updater/UpdatesCheckReceiver.java +12 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package org.lineageos.updater; import android.app.AlarmManager; import android.app.NotificationChannel; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.BroadcastReceiver; Loading @@ -24,7 +25,7 @@ import android.content.Intent; import android.content.SharedPreferences; import android.os.SystemClock; import android.preference.PreferenceManager; import android.support.v7.app.NotificationCompat; import android.support.v4.app.NotificationCompat; import android.util.Log; import org.json.JSONException; Loading @@ -46,6 +47,9 @@ public class UpdatesCheckReceiver extends BroadcastReceiver { private static final String DAILY_CHECK_ACTION = "daily_check_action"; private static final String ONESHOT_CHECK_ACTION = "oneshot_check_action"; private static final String NEW_UPDATES_NOTIFICATION_CHANNEL = "new_updates_notification_channel"; @Override public void onReceive(final Context context, Intent intent) { if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) { Loading Loading @@ -121,7 +125,12 @@ public class UpdatesCheckReceiver extends BroadcastReceiver { private static void showNotification(Context context) { NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context); NotificationChannel notificationChannel = new NotificationChannel( NEW_UPDATES_NOTIFICATION_CHANNEL, context.getString(R.string.new_updates_channel_title), NotificationManager.IMPORTANCE_LOW); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context, NEW_UPDATES_NOTIFICATION_CHANNEL); notificationBuilder.setSmallIcon(R.drawable.ic_system_update); Intent notificationIntent = new Intent(context, UpdatesActivity.class); PendingIntent intent = PendingIntent.getActivity(context, 0, notificationIntent, Loading @@ -129,6 +138,7 @@ public class UpdatesCheckReceiver extends BroadcastReceiver { notificationBuilder.setContentIntent(intent); notificationBuilder.setContentTitle(context.getString(R.string.new_updates_found_title)); notificationBuilder.setAutoCancel(true); notificationManager.createNotificationChannel(notificationChannel); notificationManager.notify(0, notificationBuilder.build()); } Loading src/org/lineageos/updater/controller/UpdaterService.java +12 −2 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ */ package org.lineageos.updater.controller; import android.app.NotificationChannel; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.Service; Loading @@ -25,8 +26,8 @@ import android.content.IntentFilter; import android.os.Binder; import android.os.Bundle; import android.os.IBinder; import android.support.v4.app.NotificationCompat; import android.support.v4.content.LocalBroadcastManager; import android.support.v7.app.NotificationCompat; import android.text.format.Formatter; import android.util.Log; Loading @@ -53,6 +54,9 @@ public class UpdaterService extends Service { public static final String ACTION_INSTALL_UPDATE = "action_install_update"; public static final String ACTION_INSTALL_STOP = "action_install_stop"; private static final String ONGOING_NOTIFICATION_CHANNEL = "ongoing_notification_channel"; public static final int DOWNLOAD_RESUME = 0; public static final int DOWNLOAD_PAUSE = 1; Loading @@ -75,7 +79,13 @@ public class UpdaterService extends Service { mUpdaterController = UpdaterController.getInstance(this); mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); mNotificationBuilder = new NotificationCompat.Builder(this); NotificationChannel notificationChannel = new NotificationChannel( ONGOING_NOTIFICATION_CHANNEL, getString(R.string.ongoing_channel_title), NotificationManager.IMPORTANCE_LOW); mNotificationManager.createNotificationChannel(notificationChannel); mNotificationBuilder = new NotificationCompat.Builder(this, ONGOING_NOTIFICATION_CHANNEL); mNotificationBuilder.setSmallIcon(R.drawable.ic_system_update); mNotificationBuilder.setShowWhen(false); mNotificationStyle = new NotificationCompat.BigTextStyle(); Loading Loading
res/values/strings.xml +4 −0 Original line number Diff line number Diff line Loading @@ -127,4 +127,8 @@ <string name="blocked_update_dialog_title">Update blocked</string> <string name="blocked_update_dialog_message">This update cannot be installed using the updater app. Please read <xliff:g id="info_url">%1$s</xliff:g> for more information.</string> <string name="blocked_update_info_url" translatable="false">http://wiki.lineageos.org/upgrading.html</string> <string name="export_channel_title">Export completion</string> <string name="new_updates_channel_title">New updates</string> <string name="ongoing_channel_title">Ongoing downloads</string> </resources>
src/org/lineageos/updater/ExportUpdateService.java +12 −2 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ */ package org.lineageos.updater; import android.app.NotificationChannel; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.Service; Loading Loading @@ -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; Loading Loading @@ -133,8 +137,14 @@ public class ExportUpdateService extends Service { private void startExporting(File source, File destination) { NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this); 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, 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)); Loading
src/org/lineageos/updater/UpdatesCheckReceiver.java +12 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package org.lineageos.updater; import android.app.AlarmManager; import android.app.NotificationChannel; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.BroadcastReceiver; Loading @@ -24,7 +25,7 @@ import android.content.Intent; import android.content.SharedPreferences; import android.os.SystemClock; import android.preference.PreferenceManager; import android.support.v7.app.NotificationCompat; import android.support.v4.app.NotificationCompat; import android.util.Log; import org.json.JSONException; Loading @@ -46,6 +47,9 @@ public class UpdatesCheckReceiver extends BroadcastReceiver { private static final String DAILY_CHECK_ACTION = "daily_check_action"; private static final String ONESHOT_CHECK_ACTION = "oneshot_check_action"; private static final String NEW_UPDATES_NOTIFICATION_CHANNEL = "new_updates_notification_channel"; @Override public void onReceive(final Context context, Intent intent) { if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) { Loading Loading @@ -121,7 +125,12 @@ public class UpdatesCheckReceiver extends BroadcastReceiver { private static void showNotification(Context context) { NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context); NotificationChannel notificationChannel = new NotificationChannel( NEW_UPDATES_NOTIFICATION_CHANNEL, context.getString(R.string.new_updates_channel_title), NotificationManager.IMPORTANCE_LOW); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context, NEW_UPDATES_NOTIFICATION_CHANNEL); notificationBuilder.setSmallIcon(R.drawable.ic_system_update); Intent notificationIntent = new Intent(context, UpdatesActivity.class); PendingIntent intent = PendingIntent.getActivity(context, 0, notificationIntent, Loading @@ -129,6 +138,7 @@ public class UpdatesCheckReceiver extends BroadcastReceiver { notificationBuilder.setContentIntent(intent); notificationBuilder.setContentTitle(context.getString(R.string.new_updates_found_title)); notificationBuilder.setAutoCancel(true); notificationManager.createNotificationChannel(notificationChannel); notificationManager.notify(0, notificationBuilder.build()); } Loading
src/org/lineageos/updater/controller/UpdaterService.java +12 −2 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ */ package org.lineageos.updater.controller; import android.app.NotificationChannel; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.Service; Loading @@ -25,8 +26,8 @@ import android.content.IntentFilter; import android.os.Binder; import android.os.Bundle; import android.os.IBinder; import android.support.v4.app.NotificationCompat; import android.support.v4.content.LocalBroadcastManager; import android.support.v7.app.NotificationCompat; import android.text.format.Formatter; import android.util.Log; Loading @@ -53,6 +54,9 @@ public class UpdaterService extends Service { public static final String ACTION_INSTALL_UPDATE = "action_install_update"; public static final String ACTION_INSTALL_STOP = "action_install_stop"; private static final String ONGOING_NOTIFICATION_CHANNEL = "ongoing_notification_channel"; public static final int DOWNLOAD_RESUME = 0; public static final int DOWNLOAD_PAUSE = 1; Loading @@ -75,7 +79,13 @@ public class UpdaterService extends Service { mUpdaterController = UpdaterController.getInstance(this); mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); mNotificationBuilder = new NotificationCompat.Builder(this); NotificationChannel notificationChannel = new NotificationChannel( ONGOING_NOTIFICATION_CHANNEL, getString(R.string.ongoing_channel_title), NotificationManager.IMPORTANCE_LOW); mNotificationManager.createNotificationChannel(notificationChannel); mNotificationBuilder = new NotificationCompat.Builder(this, ONGOING_NOTIFICATION_CHANNEL); mNotificationBuilder.setSmallIcon(R.drawable.ic_system_update); mNotificationBuilder.setShowWhen(false); mNotificationStyle = new NotificationCompat.BigTextStyle(); Loading