| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.SharedPreferences; | 8 import android.content.SharedPreferences; |
| 9 import android.os.AsyncTask; | 9 import android.os.AsyncTask; |
| 10 | 10 |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 * The Physical Web state includes: | 222 * The Physical Web state includes: |
| 223 * - The location provider | 223 * - The location provider |
| 224 * - The location permission | 224 * - The location permission |
| 225 * - The bluetooth status | 225 * - The bluetooth status |
| 226 * - The data connection status | 226 * - The data connection status |
| 227 * - The Physical Web preference status | 227 * - The Physical Web preference status |
| 228 */ | 228 */ |
| 229 public static void recordPhysicalWebState(Context context, String actionName
) { | 229 public static void recordPhysicalWebState(Context context, String actionName
) { |
| 230 LocationUtils locationUtils = LocationUtils.getInstance(); | 230 LocationUtils locationUtils = LocationUtils.getInstance(); |
| 231 handleEnum(context, createStateString(LOCATION_SERVICES, actionName), | 231 handleEnum(context, createStateString(LOCATION_SERVICES, actionName), |
| 232 locationUtils.isSystemLocationSettingEnabled(context) ? 1 : 0, B
OOLEAN_BOUNDARY); | 232 locationUtils.isSystemLocationSettingEnabled() ? 1 : 0, BOOLEAN_
BOUNDARY); |
| 233 handleEnum(context, createStateString(LOCATION_PERMISSION, actionName), | 233 handleEnum(context, createStateString(LOCATION_PERMISSION, actionName), |
| 234 locationUtils.hasAndroidLocationPermission(context) ? 1 : 0, BOO
LEAN_BOUNDARY); | 234 locationUtils.hasAndroidLocationPermission() ? 1 : 0, BOOLEAN_BO
UNDARY); |
| 235 handleEnum(context, createStateString(BLUETOOTH, actionName), | 235 handleEnum(context, createStateString(BLUETOOTH, actionName), |
| 236 Utils.getBluetoothEnabledStatus(context), TRISTATE_BOUNDARY); | 236 Utils.getBluetoothEnabledStatus(context), TRISTATE_BOUNDARY); |
| 237 handleEnum(context, createStateString(DATA_CONNECTION, actionName), | 237 handleEnum(context, createStateString(DATA_CONNECTION, actionName), |
| 238 Utils.isDataConnectionActive(context) ? 1 : 0, BOOLEAN_BOUNDARY)
; | 238 Utils.isDataConnectionActive(context) ? 1 : 0, BOOLEAN_BOUNDARY)
; |
| 239 int preferenceState = 2; | 239 int preferenceState = 2; |
| 240 if (!PhysicalWeb.isOnboarding()) { | 240 if (!PhysicalWeb.isOnboarding()) { |
| 241 preferenceState = PhysicalWeb.isPhysicalWebPreferenceEnabled() ? 1 :
0; | 241 preferenceState = PhysicalWeb.isPhysicalWebPreferenceEnabled() ? 1 :
0; |
| 242 } | 242 } |
| 243 handleEnum(context, createStateString(PREFERENCE, actionName), | 243 handleEnum(context, createStateString(PREFERENCE, actionName), |
| 244 preferenceState, TRISTATE_BOUNDARY); | 244 preferenceState, TRISTATE_BOUNDARY); |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 if (values == null) { | 450 if (values == null) { |
| 451 Log.e(TAG, "Error reporting " + key + " with values: " + jsonEnu
msStr); | 451 Log.e(TAG, "Error reporting " + key + " with values: " + jsonEnu
msStr); |
| 452 return; | 452 return; |
| 453 } | 453 } |
| 454 for (Integer value: values) { | 454 for (Integer value: values) { |
| 455 RecordHistogram.recordEnumeratedHistogram(key, value, boundary); | 455 RecordHistogram.recordEnumeratedHistogram(key, value, boundary); |
| 456 } | 456 } |
| 457 } | 457 } |
| 458 } | 458 } |
| 459 } | 459 } |
| OLD | NEW |