From c3515644b64bcf81eb3a58c9d1693795908dba8c Mon Sep 17 00:00:00 2001 From: Gabriele M Date: Sun, 16 Jul 2017 22:49:17 +0200 Subject: [PATCH] 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. --- res/values/strings.xml | 4 +++ .../lineageos/updater/UpdatesListAdapter.java | 36 ++++++++++++++++++- .../updater/controller/UpdaterService.java | 11 ------ 3 files changed, 39 insertions(+), 12 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index e5756794..b9d0f398 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -79,4 +79,8 @@ Delete file Delete the selected update file? + + Apply update + You are about to upgrade to %1$s.\n\nIf you press %2$s, the device will restart itself in recovery mode to install the update.\n\nNote: This feature requires a compatible Recovery or updates will need to be installed manually. + You are about to upgrade to %1$s.\n\nIf you press %2$s, the device will begin installing in the background.\n\nOnce completed, you will be prompted to reboot. diff --git a/src/org/lineageos/updater/UpdatesListAdapter.java b/src/org/lineageos/updater/UpdatesListAdapter.java index e43787b0..20d1b354 100644 --- a/src/org/lineageos/updater/UpdatesListAdapter.java +++ b/src/org/lineageos/updater/UpdatesListAdapter.java @@ -21,6 +21,7 @@ import android.support.v7.app.AlertDialog; import android.support.v7.widget.RecyclerView; import android.text.format.DateUtils; import android.text.format.Formatter; +import android.util.Log; import android.util.TypedValue; import android.view.LayoutInflater; import android.view.View; @@ -34,6 +35,7 @@ import org.lineageos.updater.misc.BuildInfoUtils; import org.lineageos.updater.misc.StringGenerator; import org.lineageos.updater.misc.Utils; +import java.io.IOException; import java.text.DateFormat; import java.text.NumberFormat; import java.util.List; @@ -300,7 +302,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter