Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(473)

Side by Side Diff: components/precache/android/java/src/org/chromium/components/precache/DeviceState.java

Issue 2548013002: Remove redundant field initialization in Java code. (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.components.precache; 5 package org.chromium.components.precache;
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.IntentFilter; 9 import android.content.IntentFilter;
10 import android.os.BatteryManager; 10 import android.os.BatteryManager;
11 11
12 import org.chromium.base.VisibleForTesting; 12 import org.chromium.base.VisibleForTesting;
13 13
14 /** 14 /**
15 * Utility class that provides information about the current state of the device . 15 * Utility class that provides information about the current state of the device .
16 */ 16 */
17 public class DeviceState { 17 public class DeviceState {
18 private static DeviceState sDeviceState = null; 18 private static DeviceState sDeviceState;
19 19
20 // Saved battery level percentage. 20 // Saved battery level percentage.
21 private int mSavedBatteryPercentage = 0; 21 private int mSavedBatteryPercentage;
22 22
23 /** Disallow Construction of DeviceState objects. Use {@link #getInstance()} instead to create 23 /** Disallow Construction of DeviceState objects. Use {@link #getInstance()} instead to create
24 * a singleton instance. 24 * a singleton instance.
25 */ 25 */
26 protected DeviceState() {} 26 protected DeviceState() {}
27 27
28 public static DeviceState getInstance() { 28 public static DeviceState getInstance() {
29 if (sDeviceState == null) sDeviceState = new DeviceState(); 29 if (sDeviceState == null) sDeviceState = new DeviceState();
30 return sDeviceState; 30 return sDeviceState;
31 } 31 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 NetworkInfoDelegate networkInfo = 97 NetworkInfoDelegate networkInfo =
98 mNetworkInfoDelegateFactory.getNetworkInfoDelegate(context); 98 mNetworkInfoDelegateFactory.getNetworkInfoDelegate(context);
99 return (networkInfo.isValid() 99 return (networkInfo.isValid()
100 && networkInfo.isAvailable() 100 && networkInfo.isAvailable()
101 && networkInfo.isConnected() 101 && networkInfo.isConnected()
102 && !networkInfo.isRoaming() 102 && !networkInfo.isRoaming()
103 && !networkInfo.isActiveNetworkMetered()); 103 && !networkInfo.isActiveNetworkMetered());
104 } 104 }
105 } 105 }
106 106
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698