1 /*
2  * Copyright (C) 2018 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.settingslib.net;
18 
19 import java.util.concurrent.TimeUnit;
20 
21 /**
22  * Usage data in a billing cycle for a specific Uid.
23  */
24 public class NetworkCycleDataForUid extends NetworkCycleData {
25 
26     private long mBackgroudUsage;
27     private long mForegroudUsage;
28 
NetworkCycleDataForUid()29     private NetworkCycleDataForUid() {
30     }
31 
getBackgroudUsage()32     public long getBackgroudUsage() {
33         return mBackgroudUsage;
34     }
35 
getForegroudUsage()36     public long getForegroudUsage() {
37         return mForegroudUsage;
38     }
39 
40     public static class Builder extends NetworkCycleData.Builder {
41 
42         private NetworkCycleDataForUid mObject = new NetworkCycleDataForUid();
43 
setBackgroundUsage(long backgroundUsage)44         public Builder setBackgroundUsage(long backgroundUsage) {
45             getObject().mBackgroudUsage = backgroundUsage;
46             return this;
47         }
48 
setForegroundUsage(long foregroundUsage)49         public Builder setForegroundUsage(long foregroundUsage) {
50             getObject().mForegroudUsage = foregroundUsage;
51             return this;
52         }
53 
54         @Override
getObject()55         public NetworkCycleDataForUid getObject() {
56             return mObject;
57         }
58 
59         @Override
build()60         public NetworkCycleDataForUid build() {
61             return getObject();
62         }
63     }
64 
65 }
66