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 setImsServiceErrno(int errno)57 public SmsSessionEventBuilder setImsServiceErrno(int errno) { 58 mEvent.imsError = errno; 59 return this; 60 } 61 setSettings(TelephonySettings settings)62 public SmsSessionEventBuilder setSettings(TelephonySettings settings) { 63 mEvent.settings = settings; 64 return this; 65 } 66 setServiceState(TelephonyServiceState state)67 public SmsSessionEventBuilder setServiceState(TelephonyServiceState state) { 68 mEvent.serviceState = state; 69 return this; 70 } 71 setImsConnectionState(ImsConnectionState state)72 public SmsSessionEventBuilder setImsConnectionState(ImsConnectionState state) { 73 mEvent.imsConnectionState = state; 74 return this; 75 } 76 setImsCapabilities(ImsCapabilities capabilities)77 public SmsSessionEventBuilder setImsCapabilities(ImsCapabilities capabilities) { 78 mEvent.imsCapabilities = capabilities; 79 return this; 80 } 81 setDataCalls(RilDataCall[] dataCalls)82 public SmsSessionEventBuilder setDataCalls(RilDataCall[] dataCalls) { 83 mEvent.dataCalls = dataCalls; 84 return this; 85 } 86 setRilRequestId(int id)87 public SmsSessionEventBuilder setRilRequestId(int id) { 88 mEvent.rilRequestId = id; 89 return this; 90 } 91 setFormat(int format)92 public SmsSessionEventBuilder setFormat(int format) { 93 mEvent.format = format; 94 return this; 95 } 96 setCellBroadcastMessage(SmsSession.Event.CBMessage msg)97 public SmsSessionEventBuilder setCellBroadcastMessage(SmsSession.Event.CBMessage msg) { 98 mEvent.cellBroadcastMessage = msg; 99 return this; 100 } 101 102 /** Set details on incomplete SMS */ setIncompleteSms(SmsSession.Event.IncompleteSms msg)103 public SmsSessionEventBuilder setIncompleteSms(SmsSession.Event.IncompleteSms msg) { 104 mEvent.incompleteSms = msg; 105 return this; 106 } 107 108 /** Set indication if SMS was blocked */ setBlocked(boolean blocked)109 public SmsSessionEventBuilder setBlocked(boolean blocked) { 110 mEvent.blocked = blocked; 111 return this; 112 } 113 114 /** Set SMS type */ setSmsType(int type)115 public SmsSessionEventBuilder setSmsType(int type) { 116 mEvent.smsType = type; 117 return this; 118 } 119 120 /** Set message id */ setMessageId(long messageId)121 public SmsSessionEventBuilder setMessageId(long messageId) { 122 mEvent.messageId = messageId; 123 return this; 124 } 125 } 126