Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

Commit

Permalink
Move check for update intent to update service
Browse files Browse the repository at this point in the history
Refs #1867
  • Loading branch information
M66B committed Aug 16, 2014
1 parent 9319878 commit aa95b32
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@
<action android:name="biz.bokhorst.xprivacy.action.FETCH" />
<action android:name="biz.bokhorst.xprivacy.action.SUBMIT" />
<action android:name="biz.bokhorst.xprivacy.action.TOGGLE" />
<action android:name="biz.bokhorst.xprivacy.action.UPDATE" />

<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
Expand Down Expand Up @@ -191,6 +190,7 @@
android:process=":update" >
<intent-filter>
<action android:name="biz.bokhorst.xprivacy.action.FLUSH" />
<action android:name="biz.bokhorst.xprivacy.action.UPDATE" />
</intent-filter>
</service>
</application>
Expand Down
11 changes: 1 addition & 10 deletions src/biz/bokhorst/xprivacy/ActivityShare.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ 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;
Expand Down Expand Up @@ -168,8 +167,7 @@ protected void onCreate(Bundle savedInstanceState) {
finish();
return;
}
} else if (action.equals(ACTION_FETCH) || action.equals(ACTION_UPDATE)
|| (action.equals(ACTION_TOGGLE) && uids.length > 1)) {
} else if (action.equals(ACTION_FETCH) || (action.equals(ACTION_TOGGLE) && uids.length > 1)) {
if (Util.hasProLicense(this) == null) {
Util.viewUri(this, ActivityMain.cProUri);
finish();
Expand All @@ -183,13 +181,6 @@ 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;
Expand Down
19 changes: 14 additions & 5 deletions src/biz/bokhorst/xprivacy/UpdateService.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
import android.util.Log;

public class UpdateService extends Service {
public static String cAction = "Action";
public static int cActionBoot = 1;
public static int cActionUpdated = 2;
public static String cFlush = "biz.bokhorst.xprivacy.action.FLUSH";
public static final String cAction = "Action";
public static final int cActionBoot = 1;
public static final int cActionUpdated = 2;
public static final String cFlush = "biz.bokhorst.xprivacy.action.FLUSH";
public static final String cUpdate = "biz.bokhorst.xprivacy.action.UPDATE";

private static Thread mWorkerThread;

Expand All @@ -39,7 +40,7 @@ public int onStartCommand(Intent intent, int flags, int startId) {
return 0;
}

// Check intent
// Flush
if (cFlush.equals(intent.getAction())) {
try {
PrivacyService.getClient().flush();
Expand All @@ -50,6 +51,14 @@ public int onStartCommand(Intent intent, int flags, int startId) {
return 0;
}

// Update
if (cUpdate.equals(intent.getAction())) {
if (Util.hasProLicense(this) != null)
new ActivityShare.UpdateTask(this).execute();
stopSelf();
return 0;
}

// Check action
Bundle extras = intent.getExtras();
if (extras.containsKey(cAction)) {
Expand Down

0 comments on commit aa95b32

Please sign in to comment.