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

Side by Side 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.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/org/adblockplus/android/ProxySettings.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 String pkg = context.getApplicationInfo().packageName;
39 boolean us = pkg.equals(intent.getData().getSchemeSpecificPart());
40 enabled &= us;
41 proxyenabled &= us;
38 } 42 }
39 if (Intent.ACTION_BOOT_COMPLETED.equals(action)) 43 if (Intent.ACTION_BOOT_COMPLETED.equals(action))
40 { 44 {
41 boolean startAtBoot = prefs.getBoolean(context.getString(R.string.pref_sta rtatboot), context.getResources().getBoolean(R.bool.def_startatboot)); 45 boolean startAtBoot = prefs.getBoolean(context.getString(R.string.pref_sta rtatboot), context.getResources().getBoolean(R.bool.def_startatboot));
42 enabled &= startAtBoot; 46 enabled &= startAtBoot;
47 proxyenabled &= startAtBoot;
43 } 48 }
44 if (enabled) 49 if (enabled)
50 {
51 AdblockPlus application = AdblockPlus.getApplication();
52 application.setFilteringEnabled(true);
53 application.startEngine();
54 }
55 if (proxyenabled)
45 context.startService(new Intent(context, ProxyService.class)); 56 context.startService(new Intent(context, ProxyService.class));
46 } 57 }
47 58
48 } 59 }
OLDNEW
« 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