Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/org/adblockplus/android/Starter.java

Issue 9437197: ABP/Android Proxy switch (Closed)
Patch Set: ABP/Android Proxy switch Created March 11, 2013, 7:29 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/org/adblockplus/android/ProxySettings.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/org/adblockplus/android/Starter.java
===================================================================
--- a/src/org/adblockplus/android/Starter.java
+++ b/src/org/adblockplus/android/Starter.java
@@ -32,16 +32,27 @@
String action = intent.getAction();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean enabled = prefs.getBoolean(context.getString(R.string.pref_enabled), false);
+ boolean proxyenabled = prefs.getBoolean(context.getString(R.string.pref_proxyenabled), false);
if (Intent.ACTION_PACKAGE_REPLACED.equals(action))
{
- enabled &= "org.adblockplus.android".equals(intent.getData().getSchemeSpecificPart());
+ String pkg = context.getApplicationInfo().packageName;
+ boolean us = pkg.equals(intent.getData().getSchemeSpecificPart());
+ enabled &= us;
+ proxyenabled &= us;
}
if (Intent.ACTION_BOOT_COMPLETED.equals(action))
{
boolean startAtBoot = prefs.getBoolean(context.getString(R.string.pref_startatboot), context.getResources().getBoolean(R.bool.def_startatboot));
enabled &= startAtBoot;
+ proxyenabled &= startAtBoot;
}
if (enabled)
+ {
+ AdblockPlus application = AdblockPlus.getApplication();
+ application.setFilteringEnabled(true);
+ application.startEngine();
+ }
+ if (proxyenabled)
context.startService(new Intent(context, ProxyService.class));
}
« no previous file with comments | « src/org/adblockplus/android/ProxySettings.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld