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.preferences.privacy; | 5 package org.chromium.chrome.browser.preferences.privacy; |
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.net.ConnectivityManager; | 9 import android.net.ConnectivityManager; |
10 import android.net.NetworkInfo; | 10 import android.net.NetworkInfo; |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 } | 297 } |
298 | 298 |
299 /** | 299 /** |
300 * Checks whether uploading of usage metrics is currently permitted. | 300 * Checks whether uploading of usage metrics is currently permitted. |
301 * | 301 * |
302 * Note that this function intentionally does not check |mCrashUploadingDisa
bledByCommandLine|. | 302 * Note that this function intentionally does not check |mCrashUploadingDisa
bledByCommandLine|. |
303 * See http://crbug.com/602703 for more details. | 303 * See http://crbug.com/602703 for more details. |
304 * | 304 * |
305 * @return whether uploading usage metrics is currently permitted. | 305 * @return whether uploading usage metrics is currently permitted. |
306 */ | 306 */ |
307 @Override | |
308 public boolean isMetricsUploadPermitted() { | 307 public boolean isMetricsUploadPermitted() { |
309 return isNetworkAvailable() | 308 return isNetworkAvailable() |
310 && (isUsageAndCrashReportingPermittedByUser() || isUploadEnabled
ForTests()); | 309 && (isUsageAndCrashReportingPermittedByUser() || isUploadEnabled
ForTests()); |
311 } | 310 } |
312 | 311 |
313 /** | 312 /** |
314 * Checks whether uploading of usage metrics and crash dumps is currently pe
rmitted, based on | 313 * Checks whether uploading of usage metrics and crash dumps is currently pe
rmitted, based on |
315 * user consent only. This doesn't take network condition or experimental st
ate (i.e. disabling | 314 * user consent only. This doesn't take network condition or experimental st
ate (i.e. disabling |
316 * upload) into consideration. A crash dump may be retried if this check pas
ses. | 315 * upload) into consideration. A crash dump may be retried if this check pas
ses. |
317 * | 316 * |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 /** | 375 /** |
377 * Check whether Physical Web is configured to notify on nearby beacons. | 376 * Check whether Physical Web is configured to notify on nearby beacons. |
378 * | 377 * |
379 * @return boolean {@code true} if the feature is enabled. | 378 * @return boolean {@code true} if the feature is enabled. |
380 */ | 379 */ |
381 public boolean isPhysicalWebEnabled() { | 380 public boolean isPhysicalWebEnabled() { |
382 int state = mSharedPreferences.getInt(PREF_PHYSICAL_WEB, PHYSICAL_WEB_ON
BOARDING); | 381 int state = mSharedPreferences.getInt(PREF_PHYSICAL_WEB, PHYSICAL_WEB_ON
BOARDING); |
383 return (state == PHYSICAL_WEB_ON); | 382 return (state == PHYSICAL_WEB_ON); |
384 } | 383 } |
385 } | 384 } |
OLD | NEW |