Index: src/org/adblockplus/android/Starter.java |
diff --git a/src/org/adblockplus/android/Starter.java b/src/org/adblockplus/android/Starter.java |
index 42532ad4f7606cca9506f82ecfd3698a0d29603f..b56fe8c5d6849630982c77c401d56fe3bae94a61 100644 |
--- a/src/org/adblockplus/android/Starter.java |
+++ b/src/org/adblockplus/android/Starter.java |
@@ -25,36 +25,39 @@ import android.preference.PreferenceManager; |
public class Starter extends BroadcastReceiver |
{ |
+ private final static String TAG = Utils.getTag(BroadcastReceiver.class); |
@Override |
- public void onReceive(Context context, Intent intent) |
+ public void onReceive(final Context context, final Intent intent) |
{ |
- String action = intent.getAction(); |
- SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); |
+ final String action = intent.getAction(); |
+ final 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), true); |
- boolean autoconfigured = prefs.getBoolean(context.getString(R.string.pref_proxyautoconfigured), false); |
+ final boolean autoconfigured = prefs.getBoolean(context.getString(R.string.pref_proxyautoconfigured), false); |
if (Intent.ACTION_PACKAGE_REPLACED.equals(action)) |
{ |
- String pkg = context.getApplicationInfo().packageName; |
- boolean us = pkg.equals(intent.getData().getSchemeSpecificPart()); |
+ final String pkg = context.getApplicationInfo().packageName; |
+ final 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)); |
+ final 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(); |
+ final AdblockPlus application = AdblockPlus.getApplication(); |
application.setFilteringEnabled(true); |
application.startEngine(); |
} |
if (enabled || (proxyenabled && !autoconfigured)) |
+ { |
context.startService(new Intent(context, ProxyService.class)); |
+ } |
} |
- |
} |