OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.physicalweb; | 5 package org.chromium.chrome.browser.physicalweb; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.content.Intent; | 8 import android.content.Intent; |
9 import android.content.res.Resources; | 9 import android.content.res.Resources; |
10 import android.os.Build; | 10 import android.os.Build; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 sb.append(String.format("<font color=\"%s\">%s</font><br/>", color, mess
age)); | 96 sb.append(String.format("<font color=\"%s\">%s</font><br/>", color, mess
age)); |
97 } | 97 } |
98 | 98 |
99 private void appendPrerequisitesReport(StringBuilder sb) { | 99 private void appendPrerequisitesReport(StringBuilder sb) { |
100 boolean isSdkVersionCorrect = isSdkVersionCorrect(); | 100 boolean isSdkVersionCorrect = isSdkVersionCorrect(); |
101 boolean isDataConnectionActive = Utils.isDataConnectionActive(mContext); | 101 boolean isDataConnectionActive = Utils.isDataConnectionActive(mContext); |
102 int bluetoothStatus = Utils.getBluetoothEnabledStatus(mContext); | 102 int bluetoothStatus = Utils.getBluetoothEnabledStatus(mContext); |
103 boolean isLocationServicesEnabled = Utils.isLocationServicesEnabled(mCon
text); | 103 boolean isLocationServicesEnabled = Utils.isLocationServicesEnabled(mCon
text); |
104 boolean isLocationPermissionGranted = Utils.isLocationPermissionGranted(
mContext); | 104 boolean isLocationPermissionGranted = Utils.isLocationPermissionGranted(
mContext); |
105 boolean isPreferenceEnabled = PhysicalWeb.isPhysicalWebPreferenceEnabled
(mContext); | 105 boolean isPreferenceEnabled = PhysicalWeb.isPhysicalWebPreferenceEnabled
(); |
106 boolean isOnboarding = PhysicalWeb.isOnboarding(mContext); | 106 boolean isOnboarding = PhysicalWeb.isOnboarding(); |
107 | 107 |
108 int prerequisitesResult = Utils.RESULT_SUCCESS; | 108 int prerequisitesResult = Utils.RESULT_SUCCESS; |
109 if (!isSdkVersionCorrect | 109 if (!isSdkVersionCorrect |
110 || !isDataConnectionActive | 110 || !isDataConnectionActive |
111 || bluetoothStatus == Utils.RESULT_FAILURE | 111 || bluetoothStatus == Utils.RESULT_FAILURE |
112 || !isLocationServicesEnabled | 112 || !isLocationServicesEnabled |
113 || !isLocationPermissionGranted | 113 || !isLocationPermissionGranted |
114 || !isPreferenceEnabled) { | 114 || !isPreferenceEnabled) { |
115 prerequisitesResult = Utils.RESULT_FAILURE; | 115 prerequisitesResult = Utils.RESULT_FAILURE; |
116 } else if (bluetoothStatus == Utils.RESULT_INDETERMINATE) { | 116 } else if (bluetoothStatus == Utils.RESULT_INDETERMINATE) { |
(...skipping 30 matching lines...) Expand all Loading... |
147 | 147 |
148 // Append instructions for how to verify Bluetooth is enabled when we ar
e unable to check | 148 // Append instructions for how to verify Bluetooth is enabled when we ar
e unable to check |
149 // programmatically. | 149 // programmatically. |
150 if (bluetoothStatus == Utils.RESULT_INDETERMINATE) { | 150 if (bluetoothStatus == Utils.RESULT_INDETERMINATE) { |
151 sb.append("<br/>To verify Bluetooth is enabled on this device, check
that the " | 151 sb.append("<br/>To verify Bluetooth is enabled on this device, check
that the " |
152 + "Bluetooth icon is shown in the status bar."); | 152 + "Bluetooth icon is shown in the status bar."); |
153 } | 153 } |
154 } | 154 } |
155 | 155 |
156 private void appendUrlManagerReport(StringBuilder sb) { | 156 private void appendUrlManagerReport(StringBuilder sb) { |
157 UrlManager urlManager = UrlManager.getInstance(mContext); | 157 UrlManager urlManager = UrlManager.getInstance(); |
158 | 158 |
159 Set<String> nearbyUrls = new HashSet<>(urlManager.getNearbyUrls()); | 159 Set<String> nearbyUrls = new HashSet<>(urlManager.getNearbyUrls()); |
160 Set<String> resolvedUrls = new HashSet<>(urlManager.getResolvedUrls()); | 160 Set<String> resolvedUrls = new HashSet<>(urlManager.getResolvedUrls()); |
161 Set<String> union = new HashSet<>(nearbyUrls); | 161 Set<String> union = new HashSet<>(nearbyUrls); |
162 union.addAll(resolvedUrls); | 162 union.addAll(resolvedUrls); |
163 | 163 |
164 sb.append("<h2>Nearby web pages</h2>"); | 164 sb.append("<h2>Nearby web pages</h2>"); |
165 | 165 |
166 if (union.isEmpty()) { | 166 if (union.isEmpty()) { |
167 sb.append("No nearby web pages found<br/>"); | 167 sb.append("No nearby web pages found<br/>"); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 @Override | 238 @Override |
239 public String getHost() { | 239 public String getHost() { |
240 return UrlConstants.PHYSICAL_WEB_HOST; | 240 return UrlConstants.PHYSICAL_WEB_HOST; |
241 } | 241 } |
242 | 242 |
243 @Override | 243 @Override |
244 public void updateForUrl(String url) { | 244 public void updateForUrl(String url) { |
245 // nothing to do | 245 // nothing to do |
246 } | 246 } |
247 } | 247 } |
OLD | NEW |