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

Delta Between Two Patch Sets: adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/engine/AppInfo.java

Issue 29640558: Issue 6187 - Adjust query string parameters for Yandex (Closed)
Left Patch Set: Added package name of alpha and beta versions of both browsers Created Dec. 18, 2017, 8:42 a.m.
Right Patch Set: Renamed method to isPackageInstalled Created Dec. 18, 2017, 9:29 a.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 | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 public AppInfo build() 131 public AppInfo build()
132 { 132 {
133 return new AppInfo(this.addonName, this.addonVersion, this.application, 133 return new AppInfo(this.addonName, this.addonVersion, this.application,
134 this.applicationVersion, this.platform, this.platformVersion, this.loc ale); 134 this.applicationVersion, this.platform, this.platformVersion, this.loc ale);
135 } 135 }
136 136
137 private String checkForCompatibleInstalledBrowser(final PackageManager packa geManager) 137 private String checkForCompatibleInstalledBrowser(final PackageManager packa geManager)
138 { 138 {
139 StringBuilder installedCompatibleBrowser = new StringBuilder(); 139 StringBuilder installedCompatibleBrowser = new StringBuilder();
140 140
141 if (packageIsInstalled(packageManager, SBROWSER_PACKAGE_NAME) 141 if (isPackageInstalled(packageManager, SBROWSER_PACKAGE_NAME)
142 || packageIsInstalled(packageManager, SBROWSER_BETA_PACKAGE_NAME)) 142 || isPackageInstalled(packageManager, SBROWSER_BETA_PACKAGE_NAME))
143 { 143 {
144 installedCompatibleBrowser.append(SBROWSER_APP_NAME); 144 installedCompatibleBrowser.append(SBROWSER_APP_NAME);
145 } 145 }
146 146
147 if (packageIsInstalled(packageManager, YANDEX_PACKAGE_NAME) 147 if (isPackageInstalled(packageManager, YANDEX_PACKAGE_NAME)
148 || packageIsInstalled(packageManager, YANDEX_ALPHA_PACKAGE_NAME) 148 || isPackageInstalled(packageManager, YANDEX_ALPHA_PACKAGE_NAME)
149 || packageIsInstalled(packageManager, YANDEX_BETA_PACKAGE_NAME)) 149 || isPackageInstalled(packageManager, YANDEX_BETA_PACKAGE_NAME))
150 { 150 {
151 installedCompatibleBrowser.append(YANDEX_APP_NAME); 151 installedCompatibleBrowser.append(YANDEX_APP_NAME);
152 } 152 }
153 153
154 return installedCompatibleBrowser.toString(); 154 return installedCompatibleBrowser.toString();
155 } 155 }
156 156
157 private boolean packageIsInstalled(final PackageManager packageManager, fina l String packageName) 157 private boolean isPackageInstalled(final PackageManager packageManager, fina l String packageName)
diegocarloslima 2017/12/18 09:15:30 I would prefer this method to be called isPackageI
jens 2017/12/18 09:29:48 Acknowledged.
158 { 158 {
159 try 159 try
160 { 160 {
161 packageManager.getPackageInfo(packageName, 0); 161 packageManager.getPackageInfo(packageName, 0);
162 return true; 162 return true;
163 } 163 }
164 catch (PackageManager.NameNotFoundException e) 164 catch (PackageManager.NameNotFoundException e)
165 { 165 {
166 return false; 166 return false;
167 } 167 }
168 } 168 }
169 } 169 }
170 } 170 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld