diff --git a/res/layout/battery_history_detail.xml b/res/layout/battery_history_detail.xml
index ea758655231..ff838019682 100644
--- a/res/layout/battery_history_detail.xml
+++ b/res/layout/battery_history_detail.xml
@@ -49,7 +49,7 @@
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?android:attr/textColorSecondary"/>
-
-
-
-
-
-
+
diff --git a/src/com/android/settings/datausage/ChartDataUsagePreference.java b/src/com/android/settings/datausage/ChartDataUsagePreference.java
index d02aa88944a..92d5cc80110 100644
--- a/src/com/android/settings/datausage/ChartDataUsagePreference.java
+++ b/src/com/android/settings/datausage/ChartDataUsagePreference.java
@@ -18,9 +18,6 @@ import android.content.Context;
import android.net.NetworkPolicy;
import android.net.NetworkStatsHistory;
import android.net.TrafficStats;
-import androidx.annotation.VisibleForTesting;
-import androidx.preference.Preference;
-import androidx.preference.PreferenceViewHolder;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.format.Formatter;
@@ -30,7 +27,11 @@ import android.util.SparseIntArray;
import com.android.settings.R;
import com.android.settings.Utils;
-import com.android.settings.graph.UsageView;
+import com.android.settings.widget.UsageView;
+
+import androidx.annotation.VisibleForTesting;
+import androidx.preference.Preference;
+import androidx.preference.PreferenceViewHolder;
public class ChartDataUsagePreference extends Preference {
diff --git a/src/com/android/settings/fuelgauge/BatteryHistoryDetail.java b/src/com/android/settings/fuelgauge/BatteryHistoryDetail.java
index 3661467887b..1343fefca60 100644
--- a/src/com/android/settings/fuelgauge/BatteryHistoryDetail.java
+++ b/src/com/android/settings/fuelgauge/BatteryHistoryDetail.java
@@ -25,12 +25,13 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
+
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.os.BatteryStatsHelper;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.fuelgauge.BatteryActiveView.BatteryActiveProvider;
-import com.android.settings.graph.UsageView;
+import com.android.settings.widget.UsageView;
public class BatteryHistoryDetail extends SettingsPreferenceFragment {
public static final String EXTRA_STATS = "stats";
@@ -76,7 +77,7 @@ public class BatteryHistoryDetail extends SettingsPreferenceFragment {
mPhoneParser = new BatteryCellParser();
setHasOptionsMenu(true);
}
-
+
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
diff --git a/src/com/android/settings/fuelgauge/BatteryHistoryPreference.java b/src/com/android/settings/fuelgauge/BatteryHistoryPreference.java
index 6ef09570b6e..89b3eddb1b2 100644
--- a/src/com/android/settings/fuelgauge/BatteryHistoryPreference.java
+++ b/src/com/android/settings/fuelgauge/BatteryHistoryPreference.java
@@ -17,15 +17,17 @@
package com.android.settings.fuelgauge;
import android.content.Context;
-import androidx.annotation.VisibleForTesting;
-import androidx.preference.Preference;
-import androidx.preference.PreferenceViewHolder;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;
+
import com.android.internal.os.BatteryStatsHelper;
import com.android.settings.R;
-import com.android.settings.graph.UsageView;
+import com.android.settings.widget.UsageView;
+
+import androidx.annotation.VisibleForTesting;
+import androidx.preference.Preference;
+import androidx.preference.PreferenceViewHolder;
/**
* Custom preference for displaying power consumption as a bar and an icon on the left for the
diff --git a/src/com/android/settings/fuelgauge/BatteryInfo.java b/src/com/android/settings/fuelgauge/BatteryInfo.java
index 9afaabad395..f642d30fd49 100644
--- a/src/com/android/settings/fuelgauge/BatteryInfo.java
+++ b/src/com/android/settings/fuelgauge/BatteryInfo.java
@@ -24,18 +24,19 @@ import android.os.BatteryStats;
import android.os.BatteryStats.HistoryItem;
import android.os.Bundle;
import android.os.SystemClock;
-import androidx.annotation.WorkerThread;
import android.text.format.Formatter;
import android.util.SparseIntArray;
import com.android.internal.os.BatteryStatsHelper;
import com.android.settings.Utils;
-import com.android.settings.graph.UsageView;
import com.android.settings.overlay.FeatureFactory;
+import com.android.settings.widget.UsageView;
import com.android.settingslib.R;
import com.android.settingslib.utils.PowerUtil;
import com.android.settingslib.utils.StringUtil;
+import androidx.annotation.WorkerThread;
+
public class BatteryInfo {
public CharSequence chargeLabel;
@@ -129,7 +130,7 @@ public class BatteryInfo {
remaining = context.getString(R.string.remaining_length_format,
Formatter.formatShortElapsedTime(context, remainingTimeUs / 1000));
}
- view.setBottomLabels(new CharSequence[]{timeString, remaining});
+ view.setBottomLabels(new CharSequence[] {timeString, remaining});
}
public static void getBatteryInfo(final Context context, final Callback callback) {
@@ -173,7 +174,7 @@ public class BatteryInfo {
if (discharging && provider != null
&& provider.isEnhancedBatteryPredictionEnabled(context)) {
Estimate estimate = provider.getEnhancedBatteryPrediction(context);
- if(estimate != null) {
+ if (estimate != null) {
BatteryUtils
.logRuntime(LOG_TAG, "time for enhanced BatteryInfo", startTime);
return BatteryInfo.getBatteryInfo(context, batteryBroadcast, stats,
diff --git a/src/com/android/settings/graph/BottomLabelLayout.java b/src/com/android/settings/widget/BottomLabelLayout.java
similarity index 98%
rename from src/com/android/settings/graph/BottomLabelLayout.java
rename to src/com/android/settings/widget/BottomLabelLayout.java
index 20d97e5e4d0..dca528f94c0 100644
--- a/src/com/android/settings/graph/BottomLabelLayout.java
+++ b/src/com/android/settings/widget/BottomLabelLayout.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -11,11 +12,9 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- *
*/
-package com.android.settings.graph;
+package com.android.settings.widget;
import android.annotation.Nullable;
import android.content.Context;
diff --git a/src/com/android/settings/graph/UsageGraph.java b/src/com/android/settings/widget/UsageGraph.java
similarity index 96%
rename from src/com/android/settings/graph/UsageGraph.java
rename to src/com/android/settings/widget/UsageGraph.java
index b9d517d5e8d..da61607278f 100644
--- a/src/com/android/settings/graph/UsageGraph.java
+++ b/src/com/android/settings/widget/UsageGraph.java
@@ -1,18 +1,20 @@
/*
* Copyright (C) 2016 The Android Open Source Project
*
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software distributed under the
- * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
-package com.android.settings.graph;
+package com.android.settings.widget;
import android.annotation.Nullable;
import android.content.Context;
diff --git a/src/com/android/settings/graph/UsageView.java b/src/com/android/settings/widget/UsageView.java
similarity index 92%
rename from src/com/android/settings/graph/UsageView.java
rename to src/com/android/settings/widget/UsageView.java
index bcf04414cfe..54e75b39c14 100644
--- a/src/com/android/settings/graph/UsageView.java
+++ b/src/com/android/settings/widget/UsageView.java
@@ -1,18 +1,20 @@
/*
* Copyright (C) 2016 The Android Open Source Project
*
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software distributed under the
- * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
-package com.android.settings.graph;
+package com.android.settings.widget;
import android.content.Context;
import android.content.res.TypedArray;
@@ -24,6 +26,7 @@ import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
+
import com.android.settingslib.R;
public class UsageView extends FrameLayout {
diff --git a/tests/robotests/src/com/android/settings/datausage/ChartDataUsagePreferenceTest.java b/tests/robotests/src/com/android/settings/datausage/ChartDataUsagePreferenceTest.java
index 00d02a3d90b..e053e161a45 100644
--- a/tests/robotests/src/com/android/settings/datausage/ChartDataUsagePreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/ChartDataUsagePreferenceTest.java
@@ -25,8 +25,10 @@ import android.content.Context;
import android.net.NetworkStatsHistory;
import android.net.NetworkStatsHistory.Entry;
import android.util.SparseIntArray;
-import com.android.settings.graph.UsageView;
+
import com.android.settings.testutils.SettingsRobolectricTestRunner;
+import com.android.settings.widget.UsageView;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -65,7 +67,7 @@ public class ChartDataUsagePreferenceTest {
when(mNetworkStatsHistory.getIndexAfter(end)).thenReturn(7);
final UsageView usageView = mock(UsageView.class);
final ArgumentCaptor pointsCaptor =
- ArgumentCaptor.forClass(SparseIntArray.class);
+ ArgumentCaptor.forClass(SparseIntArray.class);
mPreference.calcPoints(usageView);
@@ -84,7 +86,7 @@ public class ChartDataUsagePreferenceTest {
when(mNetworkStatsHistory.getIndexAfter(end)).thenReturn(5);
final UsageView usageView = mock(UsageView.class);
final ArgumentCaptor pointsCaptor =
- ArgumentCaptor.forClass(SparseIntArray.class);
+ ArgumentCaptor.forClass(SparseIntArray.class);
mPreference.calcPoints(usageView);
@@ -113,9 +115,10 @@ public class ChartDataUsagePreferenceTest {
* Create a network entry to be used to calculate the usage chart. In the calculation, we only
* need bucketStart, total bytes (rx + tx), and bucketDuration (which is set when we create
* the NetworkStatsHistory object). Other fields are ignored, so we don't initialize here.
+ *
* @param start the timestamp when this entry begins
- * @param rx the total number of received bytes
- * @param tx the total number of transmitted bytes
+ * @param rx the total number of received bytes
+ * @param tx the total number of transmitted bytes
* @return the network entry with the corresponding start time and data usage
*/
private Entry createEntry(long start, long rx, long tx) {
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/BatteryHistoryPreferenceTest.java b/tests/robotests/src/com/android/settings/fuelgauge/BatteryHistoryPreferenceTest.java
index 0da118abc79..d9e5bc0bc89 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/BatteryHistoryPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/BatteryHistoryPreferenceTest.java
@@ -23,15 +23,14 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import android.content.Context;
-import androidx.preference.PreferenceViewHolder;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import com.android.settings.R;
-import com.android.settings.graph.UsageView;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.testutils.shadow.SettingsShadowResources;
+import com.android.settings.widget.UsageView;
import org.junit.Before;
import org.junit.Test;
@@ -41,6 +40,8 @@ import org.mockito.MockitoAnnotations;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
+import androidx.preference.PreferenceViewHolder;
+
@RunWith(SettingsRobolectricTestRunner.class)
@Config(shadows = SettingsShadowResources.SettingsShadowTheme.class)
public class BatteryHistoryPreferenceTest {
@@ -63,7 +64,7 @@ public class BatteryHistoryPreferenceTest {
MockitoAnnotations.initMocks(this);
final Context context = RuntimeEnvironment.application;
final View itemView =
- LayoutInflater.from(context).inflate(R.layout.battery_usage_graph, null);
+ LayoutInflater.from(context).inflate(R.layout.battery_usage_graph, null);
mBatteryHistoryPreference = new BatteryHistoryPreference(context, null);
mBatteryHistoryPreference.mBatteryInfo = mBatteryInfo;
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/BatteryInfoTest.java b/tests/robotests/src/com/android/settings/fuelgauge/BatteryInfoTest.java
index 99967f78370..44486f80d46 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/BatteryInfoTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/BatteryInfoTest.java
@@ -36,12 +36,11 @@ import android.os.BatteryStats;
import android.os.SystemClock;
import android.util.SparseIntArray;
-import com.android.settings.graph.UsageView;
import com.android.settings.testutils.BatteryTestUtils;
import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
+import com.android.settings.widget.UsageView;
import com.android.settingslib.R;
-import com.android.settingslib.utils.PowerUtil;
import org.junit.Before;
import org.junit.Test;
@@ -172,7 +171,8 @@ public class BatteryInfoTest {
}
@Test
- public void testGetBatteryInfo_basedOnUsageTrueBetweenSevenAndFifteenMinutes_usesCorrectString() {
+ public void
+ testGetBatteryInfo_basedOnUsageTrueBetweenSevenAndFifteenMinutes_usesCorrectString() {
Estimate estimate = new Estimate(Duration.ofMinutes(10).toMillis(),
true /* isBasedOnUsage */,
1000 /* averageDischargeTime */);
diff --git a/tests/robotests/src/com/android/settings/graph/BottomLabelLayoutTest.java b/tests/robotests/src/com/android/settings/widget/BottomLabelLayoutTest.java
similarity index 98%
rename from tests/robotests/src/com/android/settings/graph/BottomLabelLayoutTest.java
rename to tests/robotests/src/com/android/settings/widget/BottomLabelLayoutTest.java
index 6ba22d1b73d..ea0d89ad81f 100644
--- a/tests/robotests/src/com/android/settings/graph/BottomLabelLayoutTest.java
+++ b/tests/robotests/src/com/android/settings/widget/BottomLabelLayoutTest.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -11,11 +12,9 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- *
*/
-package com.android.settings.graph;
+package com.android.settings.widget;
import static com.google.common.truth.Truth.assertThat;
diff --git a/tests/robotests/src/com/android/settings/graph/UsageGraphTest.java b/tests/robotests/src/com/android/settings/widget/UsageGraphTest.java
similarity index 99%
rename from tests/robotests/src/com/android/settings/graph/UsageGraphTest.java
rename to tests/robotests/src/com/android/settings/widget/UsageGraphTest.java
index 788d130d3d8..15658d5aca4 100644
--- a/tests/robotests/src/com/android/settings/graph/UsageGraphTest.java
+++ b/tests/robotests/src/com/android/settings/widget/UsageGraphTest.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 The Android Open Source Project
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -11,11 +12,9 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- *
*/
-package com.android.settings.graph;
+package com.android.settings.widget;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.doReturn;