diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 6100a1e95..e096017cc 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -149,6 +149,7 @@ + diff --git a/CHANGELOG.md b/CHANGELOG.md index fd5c2fa32..44456cf63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ Version 2.99.x and version 3.x will be available with a [pro license](http://www **Next release** * Added application specific quirks ([issue](/../../issues/1844)) +* Added intent for update check ([issue](/../../issues/1867)) * Updated Simplified Chinese translation [Open issues](https://github.com/M66B/XPrivacy/issues?state=open) diff --git a/README.md b/README.md index 548c595fc..1ea048b2b 100644 --- a/README.md +++ b/README.md @@ -1076,7 +1076,7 @@ am start -a biz.bokhorst.xprivacy.action.USAGE am start -a biz.bokhorst.xprivacy.action.USAGE --ei Uid 10123 ``` -* Export, import, submit, fetch, toggle +* Export, import, submit, fetch, toggle, update ``` am start -a biz.bokhorst.xprivacy.action.EXPORT @@ -1086,6 +1086,7 @@ am start -a biz.bokhorst.xprivacy.action.IMPORT --eia UidList 10123,10124 --ez I am start -a biz.bokhorst.xprivacy.action.SUBMIT --eia UidList 10123,10124 --ez Interactive true am start -a biz.bokhorst.xprivacy.action.FETCH --eia UidList 10123,10124 --ez Interactive true am start -a biz.bokhorst.xprivacy.action.TOGGLE --eia UidList 10123,10124 --ez Interactive true +am start -a biz.bokhorst.xprivacy.action.UPDATE ``` With Tasker, you can create shortcuts on your homescreen: diff --git a/src/biz/bokhorst/xprivacy/ActivityMain.java b/src/biz/bokhorst/xprivacy/ActivityMain.java index 7ab07f7da..a9fb69c98 100644 --- a/src/biz/bokhorst/xprivacy/ActivityMain.java +++ b/src/biz/bokhorst/xprivacy/ActivityMain.java @@ -1,9 +1,6 @@ package biz.bokhorst.xprivacy; -import java.io.ByteArrayOutputStream; import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -15,24 +12,9 @@ import java.util.concurrent.ThreadFactory; import java.util.concurrent.atomic.AtomicInteger; -import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; -import org.apache.http.StatusLine; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.ByteArrayEntity; -import org.apache.http.impl.client.DefaultHttpClient; -import org.apache.http.params.BasicHttpParams; -import org.apache.http.params.HttpConnectionParams; -import org.apache.http.params.HttpParams; -import org.json.JSONObject; - import android.annotation.SuppressLint; import android.app.AlertDialog; import android.app.Dialog; -import android.app.Notification; -import android.app.NotificationManager; -import android.app.PendingIntent; import android.app.ProgressDialog; import android.content.BroadcastReceiver; import android.content.Context; @@ -55,7 +37,6 @@ import android.os.Environment; import android.os.Handler; import android.os.Process; -import android.support.v4.app.NotificationCompat; import android.text.Editable; import android.text.TextWatcher; import android.util.Log; diff --git a/src/biz/bokhorst/xprivacy/ActivityShare.java b/src/biz/bokhorst/xprivacy/ActivityShare.java index c5ae7c17e..dd7bb681e 100644 --- a/src/biz/bokhorst/xprivacy/ActivityShare.java +++ b/src/biz/bokhorst/xprivacy/ActivityShare.java @@ -124,6 +124,7 @@ public class ActivityShare extends ActivityBase { public static final String ACTION_FETCH = "biz.bokhorst.xprivacy.action.FETCH"; public static final String ACTION_SUBMIT = "biz.bokhorst.xprivacy.action.SUBMIT"; public static final String ACTION_TOGGLE = "biz.bokhorst.xprivacy.action.TOGGLE"; + public static final String ACTION_UPDATE = "biz.bokhorst.xprivacy.action.UPDATE"; public static final int CHOICE_CLEAR = 1; public static final int CHOICE_TEMPLATE = 2; @@ -161,14 +162,14 @@ protected void onCreate(Bundle savedInstanceState) { mFileName = (extras != null && extras.containsKey(cFileName) ? extras.getString(cFileName) : null); // License check - if (action.equals(ACTION_IMPORT) || action.equals(ACTION_EXPORT) - || (action.equals(ACTION_TOGGLE) && uids.length > 1)) { + if (action.equals(ACTION_IMPORT) || action.equals(ACTION_EXPORT)) { if (!Util.isProEnabled() && Util.hasProLicense(this) == null) { Util.viewUri(this, ActivityMain.cProUri); finish(); return; } - } else if (action.equals(ACTION_FETCH)) { + } else if (action.equals(ACTION_FETCH) || action.equals(ACTION_UPDATE) + || (action.equals(ACTION_TOGGLE) && uids.length > 1)) { if (Util.hasProLicense(this) == null) { Util.viewUri(this, ActivityMain.cProUri); finish(); @@ -182,6 +183,13 @@ protected void onCreate(Bundle savedInstanceState) { return; } + // Update + if (action.equals(ACTION_UPDATE)) { + new UpdateTask(getApplicationContext()).executeOnExecutor(mExecutor); + finish(); + return; + } + // Check whether we need a user interface if (extras != null && extras.containsKey(cInteractive) && extras.getBoolean(cInteractive, false)) mInteractive = true; @@ -1826,12 +1834,12 @@ public void onClick(DialogInterface dialog, int which) { } public static class UpdateTask extends AsyncTask { - private ActivityBase mContext; + private Context mContext; private NotificationCompat.Builder builder; private Notification notification; private NotificationManager notificationManager; - public UpdateTask(ActivityBase context) { + public UpdateTask(Context context) { mContext = context; builder = new NotificationCompat.Builder(context); notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);