Home | History | Annotate | Download | only in metrics
      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.ImsReasonInfo;
     22 import com.android.internal.telephony.nano.TelephonyProto.RilDataCall;
     23 import com.android.internal.telephony.nano.TelephonyProto.TelephonyCallSession;
     24 import com.android.internal.telephony.nano.TelephonyProto.TelephonyCallSession.Event.RilCall;
     25 import com.android.internal.telephony.nano.TelephonyProto.TelephonyServiceState;
     26 import com.android.internal.telephony.nano.TelephonyProto.TelephonySettings;
     27 
     28 public class CallSessionEventBuilder {
     29     private final TelephonyCallSession.Event mEvent = new TelephonyCallSession.Event();
     30 
     31     public TelephonyCallSession.Event build() {
     32         return mEvent;
     33     }
     34 
     35     public CallSessionEventBuilder(int type) {
     36         mEvent.type = type;
     37     }
     38 
     39     public CallSessionEventBuilder setDelay(int delay) {
     40         mEvent.delay = delay;
     41         return this;
     42     }
     43 
     44     public CallSessionEventBuilder setRilRequest(int rilRequestType) {
     45         mEvent.rilRequest = rilRequestType;
     46         return this;
     47     }
     48 
     49     public CallSessionEventBuilder setRilRequestId(int rilRequestId) {
     50         mEvent.rilRequestId = rilRequestId;
     51         return this;
     52     }
     53 
     54     public CallSessionEventBuilder setRilError(int rilError) {
     55         mEvent.error = rilError;
     56         return this;
     57     }
     58 
     59     public CallSessionEventBuilder setCallIndex(int callIndex) {
     60         mEvent.callIndex = callIndex;
     61         return this;
     62     }
     63 
     64     public CallSessionEventBuilder setCallState(int state) {
     65         mEvent.callState = state;
     66         return this;
     67     }
     68 
     69     public CallSessionEventBuilder setSrvccState(int srvccState) {
     70         mEvent.srvccState = srvccState;
     71         return this;
     72     }
     73 
     74     public CallSessionEventBuilder setImsCommand(int imsCommand) {
     75         mEvent.imsCommand = imsCommand;
     76         return this;
     77     }
     78 
     79     public CallSessionEventBuilder setImsReasonInfo(ImsReasonInfo reasonInfo) {
     80         mEvent.reasonInfo = reasonInfo;
     81         return this;
     82     }
     83 
     84     public CallSessionEventBuilder setSrcAccessTech(int tech) {
     85         mEvent.srcAccessTech = tech;
     86         return this;
     87     }
     88 
     89     public CallSessionEventBuilder setTargetAccessTech(int tech) {
     90         mEvent.targetAccessTech = tech;
     91         return this;
     92     }
     93 
     94     public CallSessionEventBuilder setSettings(TelephonySettings settings) {
     95         mEvent.settings = settings;
     96         return this;
     97     }
     98 
     99     public CallSessionEventBuilder setServiceState(TelephonyServiceState state) {
    100         mEvent.serviceState = state;
    101         return this;
    102     }
    103 
    104     public CallSessionEventBuilder setImsConnectionState(ImsConnectionState state) {
    105         mEvent.imsConnectionState = state;
    106         return this;
    107     }
    108 
    109     public CallSessionEventBuilder setImsCapabilities(ImsCapabilities capabilities) {
    110         mEvent.imsCapabilities = capabilities;
    111         return this;
    112     }
    113 
    114     public CallSessionEventBuilder setDataCalls(RilDataCall[] dataCalls) {
    115         mEvent.dataCalls = dataCalls;
    116         return this;
    117     }
    118 
    119     public CallSessionEventBuilder setPhoneState(int phoneState) {
    120         mEvent.phoneState = phoneState;
    121         return this;
    122     }
    123 
    124     public CallSessionEventBuilder setNITZ(long timestamp) {
    125         mEvent.nitzTimestampMillis = timestamp;
    126         return this;
    127     }
    128 
    129     public CallSessionEventBuilder setRilCalls(RilCall[] rilCalls) {
    130         mEvent.calls = rilCalls;
    131         return this;
    132     }
    133 }
    134