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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 sb.append(String.format("<font color=\"%s\">%s</font><br/>", color, mess
age)); | 97 sb.append(String.format("<font color=\"%s\">%s</font><br/>", color, mess
age)); |
98 } | 98 } |
99 | 99 |
100 private void appendPrerequisitesReport(StringBuilder sb) { | 100 private void appendPrerequisitesReport(StringBuilder sb) { |
101 boolean isSdkVersionCorrect = isSdkVersionCorrect(); | 101 boolean isSdkVersionCorrect = isSdkVersionCorrect(); |
102 boolean isDataConnectionActive = Utils.isDataConnectionActive(mContext); | 102 boolean isDataConnectionActive = Utils.isDataConnectionActive(mContext); |
103 int bluetoothStatus = Utils.getBluetoothEnabledStatus(mContext); | 103 int bluetoothStatus = Utils.getBluetoothEnabledStatus(mContext); |
104 LocationUtils locationUtils = LocationUtils.getInstance(); | 104 LocationUtils locationUtils = LocationUtils.getInstance(); |
105 boolean isLocationServicesEnabled = locationUtils.isSystemLocationSettin
gEnabled(mContext); | 105 boolean isLocationServicesEnabled = locationUtils.isSystemLocationSettin
gEnabled(mContext); |
106 boolean isLocationPermissionGranted = locationUtils.hasAndroidLocationPe
rmission(mContext); | 106 boolean isLocationPermissionGranted = locationUtils.hasAndroidLocationPe
rmission(mContext); |
107 boolean isPreferenceEnabled = PhysicalWeb.isPhysicalWebPreferenceEnabled
(mContext); | 107 boolean isPreferenceEnabled = PhysicalWeb.isPhysicalWebPreferenceEnabled
(); |
108 boolean isOnboarding = PhysicalWeb.isOnboarding(mContext); | 108 boolean isOnboarding = PhysicalWeb.isOnboarding(); |
109 | 109 |
110 int prerequisitesResult = Utils.RESULT_SUCCESS; | 110 int prerequisitesResult = Utils.RESULT_SUCCESS; |
111 if (!isSdkVersionCorrect | 111 if (!isSdkVersionCorrect |
112 || !isDataConnectionActive | 112 || !isDataConnectionActive |
113 || bluetoothStatus == Utils.RESULT_FAILURE | 113 || bluetoothStatus == Utils.RESULT_FAILURE |
114 || !isLocationServicesEnabled | 114 || !isLocationServicesEnabled |
115 || !isLocationPermissionGranted | 115 || !isLocationPermissionGranted |
116 || !isPreferenceEnabled) { | 116 || !isPreferenceEnabled) { |
117 prerequisitesResult = Utils.RESULT_FAILURE; | 117 prerequisitesResult = Utils.RESULT_FAILURE; |
118 } else if (bluetoothStatus == Utils.RESULT_INDETERMINATE) { | 118 } else if (bluetoothStatus == Utils.RESULT_INDETERMINATE) { |
(...skipping 30 matching lines...) Expand all Loading... |
149 | 149 |
150 // Append instructions for how to verify Bluetooth is enabled when we ar
e unable to check | 150 // Append instructions for how to verify Bluetooth is enabled when we ar
e unable to check |
151 // programmatically. | 151 // programmatically. |
152 if (bluetoothStatus == Utils.RESULT_INDETERMINATE) { | 152 if (bluetoothStatus == Utils.RESULT_INDETERMINATE) { |
153 sb.append("<br/>To verify Bluetooth is enabled on this device, check
that the " | 153 sb.append("<br/>To verify Bluetooth is enabled on this device, check
that the " |
154 + "Bluetooth icon is shown in the status bar."); | 154 + "Bluetooth icon is shown in the status bar."); |
155 } | 155 } |
156 } | 156 } |
157 | 157 |
158 private void appendUrlManagerReport(StringBuilder sb) { | 158 private void appendUrlManagerReport(StringBuilder sb) { |
159 UrlManager urlManager = UrlManager.getInstance(mContext); | 159 UrlManager urlManager = UrlManager.getInstance(); |
160 | 160 |
161 Set<String> nearbyUrls = new HashSet<>(urlManager.getNearbyUrls()); | 161 Set<String> nearbyUrls = new HashSet<>(urlManager.getNearbyUrls()); |
162 Set<String> resolvedUrls = new HashSet<>(urlManager.getResolvedUrls()); | 162 Set<String> resolvedUrls = new HashSet<>(urlManager.getResolvedUrls()); |
163 Set<String> union = new HashSet<>(nearbyUrls); | 163 Set<String> union = new HashSet<>(nearbyUrls); |
164 union.addAll(resolvedUrls); | 164 union.addAll(resolvedUrls); |
165 | 165 |
166 sb.append("<h2>Nearby web pages</h2>"); | 166 sb.append("<h2>Nearby web pages</h2>"); |
167 | 167 |
168 if (union.isEmpty()) { | 168 if (union.isEmpty()) { |
169 sb.append("No nearby web pages found<br/>"); | 169 sb.append("No nearby web pages found<br/>"); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 @Override | 240 @Override |
241 public String getHost() { | 241 public String getHost() { |
242 return UrlConstants.PHYSICAL_WEB_HOST; | 242 return UrlConstants.PHYSICAL_WEB_HOST; |
243 } | 243 } |
244 | 244 |
245 @Override | 245 @Override |
246 public void updateForUrl(String url) { | 246 public void updateForUrl(String url) { |
247 // nothing to do | 247 // nothing to do |
248 } | 248 } |
249 } | 249 } |
OLD | NEW |