Merge "Fix style errors in NetworkStats"

This commit is contained in:
Aaron Huang
2022-07-20 09:24:33 +00:00
committed by Gerrit Code Review
2 changed files with 15 additions and 15 deletions

View File

@@ -1,17 +1,17 @@
/** /**
* Copyright (C) 2015 The Android Open Source Project * Copyright (C) 2015 The Android Open Source Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not * Licensed under the Apache License, Version 2.0 (the "License");
* use this file except in compliance with the License. You may obtain a copy * you may not use this file except in compliance with the License.
* of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * distributed under the License is distributed on an "AS IS" BASIS,
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* License for the specific language governing permissions and limitations * See the License for the specific language governing permissions and
* under the License. * limitations under the License.
*/ */
package android.app.usage; package android.app.usage;
@@ -36,11 +36,11 @@ import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList; import java.util.ArrayList;
/** /**
* Class providing enumeration over buckets of network usage statistics. {@link NetworkStats} objects * Class providing enumeration over buckets of network usage statistics. {@link NetworkStats}
* are returned as results to various queries in {@link NetworkStatsManager}. * objects are returned as results to various queries in {@link NetworkStatsManager}.
*/ */
public final class NetworkStats implements AutoCloseable { public final class NetworkStats implements AutoCloseable {
private final static String TAG = "NetworkStats"; private static final String TAG = "NetworkStats";
private final CloseGuard mCloseGuard = CloseGuard.get(); private final CloseGuard mCloseGuard = CloseGuard.get();
@@ -616,7 +616,7 @@ public final class NetworkStats implements AutoCloseable {
/** /**
* Steps to next uid in enumeration and collects history for that. * Steps to next uid in enumeration and collects history for that.
*/ */
private void stepHistory(){ private void stepHistory() {
if (hasNextUid()) { if (hasNextUid()) {
stepUid(); stepUid();
mHistory = null; mHistory = null;
@@ -692,8 +692,8 @@ public final class NetworkStats implements AutoCloseable {
bucketOut.mMetered = Bucket.METERED_ALL; bucketOut.mMetered = Bucket.METERED_ALL;
bucketOut.mRoaming = Bucket.ROAMING_ALL; bucketOut.mRoaming = Bucket.ROAMING_ALL;
bucketOut.mBeginTimeStamp = mRecycledHistoryEntry.bucketStart; bucketOut.mBeginTimeStamp = mRecycledHistoryEntry.bucketStart;
bucketOut.mEndTimeStamp = mRecycledHistoryEntry.bucketStart + bucketOut.mEndTimeStamp = mRecycledHistoryEntry.bucketStart
mRecycledHistoryEntry.bucketDuration; + mRecycledHistoryEntry.bucketDuration;
bucketOut.mRxBytes = mRecycledHistoryEntry.rxBytes; bucketOut.mRxBytes = mRecycledHistoryEntry.rxBytes;
bucketOut.mRxPackets = mRecycledHistoryEntry.rxPackets; bucketOut.mRxPackets = mRecycledHistoryEntry.rxPackets;
bucketOut.mTxBytes = mRecycledHistoryEntry.txBytes; bucketOut.mTxBytes = mRecycledHistoryEntry.txBytes;

View File

@@ -1041,7 +1041,7 @@ public final class NetworkStats implements Parcelable, Iterable<NetworkStats.Ent
*/ */
public long getTotalPackets() { public long getTotalPackets() {
long total = 0; long total = 0;
for (int i = size-1; i >= 0; i--) { for (int i = size - 1; i >= 0; i--) {
total += rxPackets[i] + txPackets[i]; total += rxPackets[i] + txPackets[i];
} }
return total; return total;