| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * This file is part of the Adblock Plus, | 2 * This file is part of the Adblock Plus, |
| 3 * Copyright (C) 2006-2012 Eyeo GmbH | 3 * Copyright (C) 2006-2012 Eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 | 25 |
| 26 public class Starter extends BroadcastReceiver | 26 public class Starter extends BroadcastReceiver |
| 27 { | 27 { |
| 28 | 28 |
| 29 @Override | 29 @Override |
| 30 public void onReceive(Context context, Intent intent) | 30 public void onReceive(Context context, Intent intent) |
| 31 { | 31 { |
| 32 String action = intent.getAction(); | 32 String action = intent.getAction(); |
| 33 SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(cont ext); | 33 SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(cont ext); |
| 34 boolean enabled = prefs.getBoolean(context.getString(R.string.pref_enabled), false); | 34 boolean enabled = prefs.getBoolean(context.getString(R.string.pref_enabled), false); |
| 35 boolean proxyenabled = prefs.getBoolean(context.getString(R.string.pref_prox yenabled), false); | |
| 35 if (Intent.ACTION_PACKAGE_REPLACED.equals(action)) | 36 if (Intent.ACTION_PACKAGE_REPLACED.equals(action)) |
| 36 { | 37 { |
| 37 enabled &= "org.adblockplus.android".equals(intent.getData().getSchemeSpec ificPart()); | 38 boolean us = "org.adblockplus.android".equals(intent.getData().getSchemeSp ecificPart()); |
|
Felix Dahlke
2013/03/11 06:57:38
Any idea how we could not hard code the package he
Andrey Novikov
2013/03/11 07:32:55
Done.
Andrey Novikov
2013/03/11 07:32:55
Done.
| |
| 39 enabled &= us; | |
| 40 proxyenabled &= us; | |
| 38 } | 41 } |
| 39 if (Intent.ACTION_BOOT_COMPLETED.equals(action)) | 42 if (Intent.ACTION_BOOT_COMPLETED.equals(action)) |
| 40 { | 43 { |
| 41 boolean startAtBoot = prefs.getBoolean(context.getString(R.string.pref_sta rtatboot), context.getResources().getBoolean(R.bool.def_startatboot)); | 44 boolean startAtBoot = prefs.getBoolean(context.getString(R.string.pref_sta rtatboot), context.getResources().getBoolean(R.bool.def_startatboot)); |
| 42 enabled &= startAtBoot; | 45 enabled &= startAtBoot; |
| 46 proxyenabled &= startAtBoot; | |
| 43 } | 47 } |
| 44 if (enabled) | 48 if (enabled) |
| 49 { | |
| 50 AdblockPlus application = AdblockPlus.getApplication(); | |
| 51 application.setFilteringEnabled(true); | |
| 52 application.startEngine(); | |
| 53 } | |
| 54 if (proxyenabled) | |
| 45 context.startService(new Intent(context, ProxyService.class)); | 55 context.startService(new Intent(context, ProxyService.class)); |
| 46 } | 56 } |
| 47 | 57 |
| 48 } | 58 } |
| OLD | NEW |