1 /*
2  * Copyright (C) 2019 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;
18 
19 import android.annotation.NonNull;
20 import android.telephony.CellIdentity;
21 import android.telephony.NetworkRegistrationInfo;
22 
23 /**
24  * Event fired to notify of a registration failure.
25  */
26 public class RegistrationFailedEvent {
27     /** The Cell Identity of the cell on which registration failed */
28     public final CellIdentity cellIdentity;
29 
30     /** The PLMN for that cell on which registration failed */
31     public final String chosenPlmn;
32 
33     /** The registration domain(s) for this registration attempt */
34     @NetworkRegistrationInfo.Domain public final int domain;
35 
36     /** The registration cause code */
37     public final int causeCode;
38 
39     /** The additional cause code in case of a combined procedure */
40     public final int additionalCauseCode;
41 
42     /** Constructor for this event */
RegistrationFailedEvent(@onNull CellIdentity cellIdentity, @NonNull String chosenPlmn, int domain, int causeCode, int additionalCauseCode)43     public RegistrationFailedEvent(@NonNull CellIdentity cellIdentity,
44             @NonNull String chosenPlmn, int domain, int causeCode, int additionalCauseCode) {
45         this.cellIdentity = cellIdentity;
46         this.chosenPlmn = chosenPlmn;
47         this.domain = domain;
48         this.causeCode = causeCode;
49         this.additionalCauseCode = additionalCauseCode;
50     }
51 
52     @Override
toString()53     public String toString() {
54         return new StringBuilder()
55                 .append("{CellIdentity=")
56                 .append(cellIdentity)
57                 .append(", chosenPlmn=")
58                 .append(chosenPlmn)
59                 .append(", domain=")
60                 .append(domain)
61                 .append(", causeCode=")
62                 .append(causeCode)
63                 .append(", additionalCauseCode=")
64                 .append(additionalCauseCode)
65                 .toString();
66     }
67 }
68