From 4a5d033efb25522ce5e1e7c5836de8076930f738 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Thu, 8 Jun 2017 22:35:30 +0800 Subject: [PATCH] Store data in intent for OTA --- .../java/com/topjohnwu/magisk/receivers/ManagerUpdate.java | 7 +++---- app/src/main/java/com/topjohnwu/magisk/utils/Utils.java | 2 ++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/receivers/ManagerUpdate.java b/app/src/main/java/com/topjohnwu/magisk/receivers/ManagerUpdate.java index 5ff1ea5e7..ae8b77bf4 100644 --- a/app/src/main/java/com/topjohnwu/magisk/receivers/ManagerUpdate.java +++ b/app/src/main/java/com/topjohnwu/magisk/receivers/ManagerUpdate.java @@ -15,9 +15,8 @@ import java.io.File; public class ManagerUpdate extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { - MagiskManager magiskManager = Utils.getMagiskManager(context); Utils.dlAndReceive( - magiskManager, + context, new DownloadReceiver() { @Override public void onDownloadDone(Uri uri) { @@ -36,8 +35,8 @@ public class ManagerUpdate extends BroadcastReceiver { } } }, - magiskManager.managerLink, + intent.getStringExtra("link"), Utils.getLegalFilename("MagiskManager-v" + - magiskManager.remoteManagerVersionString + ".apk")); + intent.getStringExtra("version") + ".apk")); } } diff --git a/app/src/main/java/com/topjohnwu/magisk/utils/Utils.java b/app/src/main/java/com/topjohnwu/magisk/utils/Utils.java index 6c04da075..ba9cecc08 100644 --- a/app/src/main/java/com/topjohnwu/magisk/utils/Utils.java +++ b/app/src/main/java/com/topjohnwu/magisk/utils/Utils.java @@ -237,6 +237,8 @@ public class Utils { .setVibrate(new long[]{0, 100, 100, 100}) .setAutoCancel(true); Intent intent = new Intent(magiskManager, ManagerUpdate.class); + intent.putExtra("link", magiskManager.managerLink); + intent.putExtra("version", magiskManager.remoteManagerVersionString); PendingIntent pendingIntent = PendingIntent.getBroadcast(magiskManager, APK_UPDATE_NOTIFICATION_ID, intent, PendingIntent.FLAG_UPDATE_CURRENT); builder.setContentIntent(pendingIntent);