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

Delta Between Two Patch Sets: mobile/android/base/updater/UpdateServiceHelper.java

Issue 4865921483014144: Check adblockplus.org for updates (Closed)
Left Patch Set: Created Dec. 9, 2014, 7:56 p.m.
Right Patch Set: Removed hard coded type=0, changed platform to gecko Created Feb. 23, 2015, 10:23 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | mobile/android/branding/adblockbrowser/configure.sh » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- 1 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public 2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 5
6 package org.mozilla.gecko.updater; 6 package org.mozilla.gecko.updater;
7 7
8 import org.mozilla.gecko.AppConstants; 8 import org.mozilla.gecko.AppConstants;
9 import org.mozilla.gecko.util.GeckoJarReader; 9 import org.mozilla.gecko.util.GeckoJarReader;
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 public static final String EXTRA_UPDATE_FLAGS_NAME = "updateFlags"; 47 public static final String EXTRA_UPDATE_FLAGS_NAME = "updateFlags";
48 48
49 // Name of the Intent extra that holds the APK path, used with ACTION_APPLY_ UPDATE 49 // Name of the Intent extra that holds the APK path, used with ACTION_APPLY_ UPDATE
50 public static final String EXTRA_PACKAGE_PATH_NAME = "packagePath"; 50 public static final String EXTRA_PACKAGE_PATH_NAME = "packagePath";
51 51
52 private static final String LOGTAG = "UpdateServiceHelper"; 52 private static final String LOGTAG = "UpdateServiceHelper";
53 private static final String DEFAULT_UPDATE_LOCALE = "en-US"; 53 private static final String DEFAULT_UPDATE_LOCALE = "en-US";
54 54
55 private static final String UPDATE_URL = 55 private static final String UPDATE_URL =
56 "https://adblockplus.org/devbuilds/adblockbrowser/updates.xml" + 56 "https://adblockplus.org/devbuilds/adblockbrowser/updates.xml" +
57 "?type=0" + 57 "?addonName=adblockbrowser" +
58 "&addonName=adblockbrowser" + 58 "&addonVersion=" + AppConstants.MOZ_APP_VERSION + ".%BUILDID%" +
59 "&addonVersion=%BUILDID%" +
60 "&applicationName=android" + 59 "&applicationName=android" +
61 "&applicationVersion=%OS_VERSION%" + 60 "&applicationVersion=%OS_VERSION%" +
62 "&platform=" + AppConstants.MOZ_APP_BASENAME + 61 "&platform=gecko" +
Felix Dahlke 2014/12/09 19:58:34 This just says "Fennec". We can change it to somet
63 "&platformVersion=" + AppConstants.MOZ_APP_VERSION + 62 "&platformVersion=" + AppConstants.MOZILLA_VERSION +
Felix Dahlke 2014/12/09 19:58:34 We can and probably will change this since it's th
64 "&locale=%LOCALE%"; 63 "&locale=%LOCALE%";
65 64
66 public enum CheckUpdateResult { 65 public enum CheckUpdateResult {
67 // Keep these in sync with mobile/android/chrome/content/about.xhtml 66 // Keep these in sync with mobile/android/chrome/content/about.xhtml
68 NOT_AVAILABLE, 67 NOT_AVAILABLE,
69 AVAILABLE, 68 AVAILABLE,
70 DOWNLOADING, 69 DOWNLOADING,
71 DOWNLOADED 70 DOWNLOADED
72 } 71 }
73 72
(...skipping 11 matching lines...) Expand all
85 locale = locale.trim(); 84 locale = locale.trim();
86 else 85 else
87 locale = DEFAULT_UPDATE_LOCALE; 86 locale = DEFAULT_UPDATE_LOCALE;
88 } catch (android.content.pm.PackageManager.NameNotFoundException e) { 87 } catch (android.content.pm.PackageManager.NameNotFoundException e) {
89 // Shouldn't really be possible, but fallback to default locale 88 // Shouldn't really be possible, but fallback to default locale
90 Log.i(LOGTAG, "Failed to read update locale file, falling back to " + DEFAULT_UPDATE_LOCALE); 89 Log.i(LOGTAG, "Failed to read update locale file, falling back to " + DEFAULT_UPDATE_LOCALE);
91 locale = DEFAULT_UPDATE_LOCALE; 90 locale = DEFAULT_UPDATE_LOCALE;
92 } 91 }
93 92
94 String url = UPDATE_URL.replace("%LOCALE%", locale). 93 String url = UPDATE_URL.replace("%LOCALE%", locale).
95 replace("%OS_VERSION%", String.valueOf(Build.VERSION.SDK_INT)). 94 replace("%OS_VERSION%", String.valueOf(Build.VERSION.SDK_INT)).
Felix Dahlke 2014/12/09 19:58:34 Firefox uses the full version string here, but I f
96 replace("%BUILDID%", force ? "0" : AppConstants.MOZ_APP_BUILDID); 95 replace("%BUILDID%", force ? "0" : AppConstants.MOZ_APP_BUILDID);
97 96
98 try { 97 try {
99 return new URL(url); 98 return new URL(url);
100 } catch (java.net.MalformedURLException e) { 99 } catch (java.net.MalformedURLException e) {
101 Log.e(LOGTAG, "Failed to create update url: ", e); 100 Log.e(LOGTAG, "Failed to create update url: ", e);
102 return null; 101 return null;
103 } 102 }
104 } 103 }
105 104
(...skipping 24 matching lines...) Expand all
130 public static void registerForUpdates(Context context, int policy) { 129 public static void registerForUpdates(Context context, int policy) {
131 if (!isUpdaterEnabled()) 130 if (!isUpdaterEnabled())
132 return; 131 return;
133 132
134 Intent intent = new Intent(UpdateServiceHelper.ACTION_REGISTER_FOR_UPDAT ES, null, context, UpdateService.class); 133 Intent intent = new Intent(UpdateServiceHelper.ACTION_REGISTER_FOR_UPDAT ES, null, context, UpdateService.class);
135 intent.putExtra(EXTRA_AUTODOWNLOAD_NAME, policy); 134 intent.putExtra(EXTRA_AUTODOWNLOAD_NAME, policy);
136 135
137 context.startService(intent); 136 context.startService(intent);
138 } 137 }
139 } 138 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld