1 /*
2  * Copyright (C) 2016 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.internal.telephony.metrics;
18 
19 import com.android.internal.telephony.nano.TelephonyProto.ImsCapabilities;
20 import com.android.internal.telephony.nano.TelephonyProto.ImsConnectionState;
21 import com.android.internal.telephony.nano.TelephonyProto.RilDataCall;
22 import com.android.internal.telephony.nano.TelephonyProto.SmsSession;
23 import com.android.internal.telephony.nano.TelephonyProto.TelephonyServiceState;
24 import com.android.internal.telephony.nano.TelephonyProto.TelephonySettings;
25 
26 public class SmsSessionEventBuilder {
27     SmsSession.Event mEvent = new SmsSession.Event();
28 
build()29     public SmsSession.Event build() {
30         return mEvent;
31     }
32 
SmsSessionEventBuilder(int type)33     public SmsSessionEventBuilder(int type) {
34         mEvent.type = type;
35     }
36 
setDelay(int delay)37     public SmsSessionEventBuilder setDelay(int delay) {
38         mEvent.delay = delay;
39         return this;
40     }
41 
setTech(int tech)42     public SmsSessionEventBuilder setTech(int tech) {
43         mEvent.tech = tech;
44         return this;
45     }
46 
setErrorCode(int code)47     public SmsSessionEventBuilder setErrorCode(int code) {
48         mEvent.errorCode = code;
49         return this;
50     }
51 
setRilErrno(int errno)52     public SmsSessionEventBuilder setRilErrno(int errno) {
53         mEvent.error = errno;
54         return this;
55     }
56 
setSettings(TelephonySettings settings)57     public SmsSessionEventBuilder setSettings(TelephonySettings settings) {
58         mEvent.settings = settings;
59         return this;
60     }
61 
setServiceState(TelephonyServiceState state)62     public SmsSessionEventBuilder setServiceState(TelephonyServiceState state) {
63         mEvent.serviceState = state;
64         return this;
65     }
66 
setImsConnectionState(ImsConnectionState state)67     public SmsSessionEventBuilder setImsConnectionState(ImsConnectionState state) {
68         mEvent.imsConnectionState = state;
69         return this;
70     }
71 
setImsCapabilities(ImsCapabilities capabilities)72     public SmsSessionEventBuilder setImsCapabilities(ImsCapabilities capabilities) {
73         mEvent.imsCapabilities = capabilities;
74         return this;
75     }
76 
setDataCalls(RilDataCall[] dataCalls)77     public SmsSessionEventBuilder setDataCalls(RilDataCall[] dataCalls) {
78         mEvent.dataCalls = dataCalls;
79         return this;
80     }
81 
setRilRequestId(int id)82     public SmsSessionEventBuilder setRilRequestId(int id) {
83         mEvent.rilRequestId = id;
84         return this;
85     }
86 
setFormat(int format)87     public SmsSessionEventBuilder setFormat(int format) {
88         mEvent.format = format;
89         return this;
90     }
91 
setCellBroadcastMessage(SmsSession.Event.CBMessage msg)92     public SmsSessionEventBuilder setCellBroadcastMessage(SmsSession.Event.CBMessage msg) {
93         mEvent.cellBroadcastMessage = msg;
94         return this;
95     }
96 }
97