Store data in intent for OTA

This commit is contained in:
topjohnwu 2017-06-08 22:35:30 +08:00
parent 343161b195
commit 4a5d033efb
2 changed files with 5 additions and 4 deletions

View File

@ -15,9 +15,8 @@ import java.io.File;
public class ManagerUpdate extends BroadcastReceiver { public class ManagerUpdate extends BroadcastReceiver {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
MagiskManager magiskManager = Utils.getMagiskManager(context);
Utils.dlAndReceive( Utils.dlAndReceive(
magiskManager, context,
new DownloadReceiver() { new DownloadReceiver() {
@Override @Override
public void onDownloadDone(Uri uri) { public void onDownloadDone(Uri uri) {
@ -36,8 +35,8 @@ public class ManagerUpdate extends BroadcastReceiver {
} }
} }
}, },
magiskManager.managerLink, intent.getStringExtra("link"),
Utils.getLegalFilename("MagiskManager-v" + Utils.getLegalFilename("MagiskManager-v" +
magiskManager.remoteManagerVersionString + ".apk")); intent.getStringExtra("version") + ".apk"));
} }
} }

View File

@ -237,6 +237,8 @@ public class Utils {
.setVibrate(new long[]{0, 100, 100, 100}) .setVibrate(new long[]{0, 100, 100, 100})
.setAutoCancel(true); .setAutoCancel(true);
Intent intent = new Intent(magiskManager, ManagerUpdate.class); Intent intent = new Intent(magiskManager, ManagerUpdate.class);
intent.putExtra("link", magiskManager.managerLink);
intent.putExtra("version", magiskManager.remoteManagerVersionString);
PendingIntent pendingIntent = PendingIntent.getBroadcast(magiskManager, PendingIntent pendingIntent = PendingIntent.getBroadcast(magiskManager,
APK_UPDATE_NOTIFICATION_ID, intent, PendingIntent.FLAG_UPDATE_CURRENT); APK_UPDATE_NOTIFICATION_ID, intent, PendingIntent.FLAG_UPDATE_CURRENT);
builder.setContentIntent(pendingIntent); builder.setContentIntent(pendingIntent);