1 /*
2  * Copyright (C) 2006 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.cat;
18 
19 import android.compat.annotation.UnsupportedAppUsage;
20 import android.os.Build;
21 
22 
23 /**
24  * Enumeration for the return code in TERMINAL RESPONSE.
25  * To get the actual return code for each enum value, call {@link #value}
26  * method.
27  *
28  * {@hide}
29  */
30 @UnsupportedAppUsage(implicitMember = "values()[Lcom/android/internal/telephony/cat/ResultCode;")
31 public enum ResultCode {
32 
33     /*
34      * Results '0X' and '1X' indicate that the command has been performed.
35      */
36 
37     /** Command performed successfully */
38     @UnsupportedAppUsage
39     OK(0x00),
40 
41     /** Command performed with partial comprehension */
42     @UnsupportedAppUsage
43     PRFRMD_WITH_PARTIAL_COMPREHENSION(0x01),
44 
45     /** Command performed, with missing information */
46     @UnsupportedAppUsage
47     PRFRMD_WITH_MISSING_INFO(0x02),
48 
49     /** REFRESH performed with additional EFs read */
50     @UnsupportedAppUsage
51     PRFRMD_WITH_ADDITIONAL_EFS_READ(0x03),
52 
53     /**
54      * Command performed successfully, but requested icon could not be
55      * displayed
56      */
57     @UnsupportedAppUsage
58     PRFRMD_ICON_NOT_DISPLAYED(0x04),
59 
60     /** Command performed, but modified by call control by NAA */
61     @UnsupportedAppUsage
62     PRFRMD_MODIFIED_BY_NAA(0x05),
63 
64     /** Command performed successfully, limited service */
65     @UnsupportedAppUsage
66     PRFRMD_LIMITED_SERVICE(0x06),
67 
68     /** Command performed with modification */
69     @UnsupportedAppUsage
70     PRFRMD_WITH_MODIFICATION(0x07),
71 
72     /** REFRESH performed but indicated NAA was not active */
73     @UnsupportedAppUsage
74     PRFRMD_NAA_NOT_ACTIVE(0x08),
75 
76     /** Command performed successfully, tone not played */
77     @UnsupportedAppUsage
78     PRFRMD_TONE_NOT_PLAYED(0x09),
79 
80     /** Proactive UICC session terminated by the user */
81     @UnsupportedAppUsage
82     UICC_SESSION_TERM_BY_USER(0x10),
83 
84     /** Backward move in the proactive UICC session requested by the user */
85     @UnsupportedAppUsage
86     BACKWARD_MOVE_BY_USER(0x11),
87 
88     /** No response from user */
89     @UnsupportedAppUsage
90     NO_RESPONSE_FROM_USER(0x12),
91 
92     /** Help information required by the user */
93     @UnsupportedAppUsage
94     HELP_INFO_REQUIRED(0x13),
95 
96     /** USSD or SS transaction terminated by the user */
97     USSD_SS_SESSION_TERM_BY_USER(0x14),
98 
99 
100     /*
101      * Results '2X' indicate to the UICC that it may be worth re-trying the
102      * command at a later opportunity.
103      */
104 
105     /** Terminal currently unable to process command */
106     @UnsupportedAppUsage
107     TERMINAL_CRNTLY_UNABLE_TO_PROCESS(0x20),
108 
109     /** Network currently unable to process command */
110     @UnsupportedAppUsage
111     NETWORK_CRNTLY_UNABLE_TO_PROCESS(0x21),
112 
113     /** User did not accept the proactive command */
114     @UnsupportedAppUsage
115     USER_NOT_ACCEPT(0x22),
116 
117     /** User cleared down call before connection or network release */
118     USER_CLEAR_DOWN_CALL(0x23),
119 
120     /** Action in contradiction with the current timer state */
121     CONTRADICTION_WITH_TIMER(0x24),
122 
123     /** Interaction with call control by NAA, temporary problem */
124     NAA_CALL_CONTROL_TEMPORARY(0x25),
125 
126     /** Launch browser generic error code */
127     @UnsupportedAppUsage
128     LAUNCH_BROWSER_ERROR(0x26),
129 
130     /** MMS temporary problem. */
131     MMS_TEMPORARY(0x27),
132 
133 
134     /*
135      * Results '3X' indicate that it is not worth the UICC re-trying with an
136      * identical command, as it will only get the same response. However, the
137      * decision to retry lies with the application.
138      */
139 
140     /** Command beyond terminal's capabilities */
141     @UnsupportedAppUsage
142     BEYOND_TERMINAL_CAPABILITY(0x30),
143 
144     /** Command type not understood by terminal */
145     CMD_TYPE_NOT_UNDERSTOOD(0x31),
146 
147     /** Command data not understood by terminal */
148     @UnsupportedAppUsage
149     CMD_DATA_NOT_UNDERSTOOD(0x32),
150 
151     /** Command number not known by terminal */
152     CMD_NUM_NOT_KNOWN(0x33),
153 
154     /** SS Return Error */
155     SS_RETURN_ERROR(0x34),
156 
157     /** SMS RP-ERROR */
158     SMS_RP_ERROR(0x35),
159 
160     /** Error, required values are missing */
161     @UnsupportedAppUsage
162     REQUIRED_VALUES_MISSING(0x36),
163 
164     /** USSD Return Error */
165     USSD_RETURN_ERROR(0x37),
166 
167     /** MultipleCard commands error */
168     MULTI_CARDS_CMD_ERROR(0x38),
169 
170     /**
171      * Interaction with call control by USIM or MO short message control by
172      * USIM, permanent problem
173      */
174     @UnsupportedAppUsage
175     USIM_CALL_CONTROL_PERMANENT(0x39),
176 
177     /** Bearer Independent Protocol error */
178     @UnsupportedAppUsage
179     BIP_ERROR(0x3a),
180 
181     /** Access Technology unable to process command */
182     ACCESS_TECH_UNABLE_TO_PROCESS(0x3b),
183 
184     /** Frames error */
185     FRAMES_ERROR(0x3c),
186 
187     /** MMS Error */
188     MMS_ERROR(0x3d);
189 
190 
191     private int mCode;
192 
ResultCode(int code)193     ResultCode(int code) {
194         mCode = code;
195     }
196 
197     /**
198      * Retrieves the actual result code that this object represents.
199      * @return Actual result code
200      */
201     @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
value()202     public int value() {
203         return mCode;
204     }
205 
fromInt(int value)206     public static ResultCode fromInt(int value) {
207         for (ResultCode r : ResultCode.values()) {
208             if (r.mCode == value) {
209                 return r;
210             }
211         }
212         return null;
213     }
214 }
215