Ask for confirmation before installing updates

Since there's no quick and clean way to show a dialog from a
serivice, don't allow to install updates from the notification.
This commit is contained in:
Gabriele M
2017-07-16 22:49:17 +02:00
parent 12688ba761
commit c3515644b6
3 changed files with 39 additions and 12 deletions

View File

@@ -269,9 +269,6 @@ public class UpdaterService extends Service {
mNotificationBuilder.setProgress(100, 100, false);
String text = getString(R.string.download_completed_notification);
mNotificationStyle.bigText(text);
mNotificationBuilder.addAction(R.drawable.ic_tab_install,
getString(R.string.install_button),
getInstallPendingIntent(update.getDownloadId()));
mNotificationBuilder.setTicker(text);
mNotificationBuilder.setOngoing(false);
mNotificationManager.notify(NOTIFICATION_ID, mNotificationBuilder.build());
@@ -384,14 +381,6 @@ public class UpdaterService extends Service {
PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_UPDATE_CURRENT);
}
private PendingIntent getInstallPendingIntent(String downloadId) {
final Intent intent = new Intent(this, UpdaterService.class);
intent.setAction(ACTION_INSTALL_UPDATE);
intent.putExtra(EXTRA_DOWNLOAD_ID, downloadId);
return PendingIntent.getService(this, 0, intent,
PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_UPDATE_CURRENT);
}
private PendingIntent getRebootPendingIntent() {
final Intent intent = new Intent(this, UpdaterReceiver.class);
intent.setAction(UpdaterReceiver.ACTION_INSTALL_REBOOT);