• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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 android.telephony.mockmodem;
18 
19 import android.os.Handler;
20 
21 public interface MockModemConfigInterface {
22 
23     // ***** Constants
24     int MAX_NUM_OF_SIM_SLOT = 3; // Change this needs to add more SIM SLOT NVs.
25     int MAX_NUM_OF_LOGICAL_MODEM = 2; // Change this needs to add more MODEM NVs.
26     int RADIO_STATE_UNAVAILABLE = 0;
27     int RADIO_STATE_OFF = 1;
28     int RADIO_STATE_ON = 2;
29 
30     // Default config value
31     String DEFAULT_BASEBAND_VERSION = "mock-modem-service-1.0";
32     String DEFAULT_IMEI = "123456789012345";
33     String DEFAULT_IMEISV = "01";
34     String DEFAULT_ESN = "123456789";
35     String DEFAULT_MEID = "123456789012345";
36     int DEFAULT_RADIO_STATE = RADIO_STATE_UNAVAILABLE;
37     int DEFAULT_NUM_OF_LIVE_MODEM = 1; // Should <= MAX_NUM_OF_MODEM
38     int DEFAULT_MAX_ACTIVE_DATA = 2;
39     int DEFAULT_MAX_ACTIVE_INTERNAL_DATA = 1;
40     boolean DEFAULT_IS_INTERNAL_LINGERING_SUPPORTED = false;
41     int DEFAULT_LOGICAL_MODEM1_ID = 0;
42     int DEFAULT_LOGICAL_MODEM2_ID = 1;
43 
44     // ***** Methods
getMockModemConfigHandler()45     Handler getMockModemConfigHandler();
46 
47     /** Broadcast all notifications */
notifyAllRegistrantNotifications()48     void notifyAllRegistrantNotifications();
49 
50     // ***** IRadioConfig
51     /** Register/unregister notification handler for number of modem changed */
registerForNumOfLiveModemChanged(Handler h, int what, Object obj)52     void registerForNumOfLiveModemChanged(Handler h, int what, Object obj);
53 
unregisterForNumOfLiveModemChanged(Handler h)54     void unregisterForNumOfLiveModemChanged(Handler h);
55 
56     /** Register/unregister notification handler for sim slot status changed */
registerForPhoneCapabilityChanged(Handler h, int what, Object obj)57     void registerForPhoneCapabilityChanged(Handler h, int what, Object obj);
58 
unregisterForPhoneCapabilityChanged(Handler h)59     void unregisterForPhoneCapabilityChanged(Handler h);
60 
61     /** Register/unregister notification handler for sim slot status changed */
registerForSimSlotStatusChanged(Handler h, int what, Object obj)62     void registerForSimSlotStatusChanged(Handler h, int what, Object obj);
63 
unregisterForSimSlotStatusChanged(Handler h)64     void unregisterForSimSlotStatusChanged(Handler h);
65 
66     // ***** IRadioModem
67     /** Register/unregister notification handler for baseband version changed */
registerForBasebandVersionChanged(Handler h, int what, Object obj)68     void registerForBasebandVersionChanged(Handler h, int what, Object obj);
69 
unregisterForBasebandVersionChanged(Handler h)70     void unregisterForBasebandVersionChanged(Handler h);
71 
72     /** Register/unregister notification handler for device identity changed */
registerForDeviceIdentityChanged(Handler h, int what, Object obj)73     void registerForDeviceIdentityChanged(Handler h, int what, Object obj);
74 
unregisterForDeviceIdentityChanged(Handler h)75     void unregisterForDeviceIdentityChanged(Handler h);
76 
77     /** Register/unregister notification handler for radio state changed */
registerForRadioStateChanged(Handler h, int what, Object obj)78     void registerForRadioStateChanged(Handler h, int what, Object obj);
79 
unregisterForRadioStateChanged(Handler h)80     void unregisterForRadioStateChanged(Handler h);
81 
82     // ***** IRadioSim
83     /** Register/unregister notification handler for card status changed */
registerForCardStatusChanged(Handler h, int what, Object obj)84     void registerForCardStatusChanged(Handler h, int what, Object obj);
85 
unregisterForCardStatusChanged(Handler h)86     void unregisterForCardStatusChanged(Handler h);
87 
88     /** Register/unregister notification handler for sim app data changed */
registerForSimAppDataChanged(Handler h, int what, Object obj)89     void registerForSimAppDataChanged(Handler h, int what, Object obj);
90 
unregisterForSimAppDataChanged(Handler h)91     void unregisterForSimAppDataChanged(Handler h);
92 
93     /** Register/unregister notification handler for sim info changed */
registerForSimInfoChanged(Handler h, int what, Object obj)94     void registerForSimInfoChanged(Handler h, int what, Object obj);
95 
unregisterForSimInfoChanged(Handler h)96     void unregisterForSimInfoChanged(Handler h);
97 
98     // ***** IRadioNetwork
99     /** Register/unregister notification handler for service status changed */
registerForServiceStateChanged(Handler h, int what, Object obj)100     void registerForServiceStateChanged(Handler h, int what, Object obj);
101 
unregisterForServiceStateChanged(Handler h)102     void unregisterForServiceStateChanged(Handler h);
103 
104     /**
105      * Sets the latest radio power state of modem
106      *
107      * @param state 0 means "unavailable", 1 means "off", 2 means "on".
108      * @param client for tracking calling client
109      */
setRadioState(int state, String client)110     void setRadioState(int state, String client);
111 
112     /**
113      * Query whether any SIM cards are present or not.
114      *
115      * @param client for tracking calling client
116      * @return boolean true if any sim card inserted, otherwise false.
117      */
isSimCardPresent(String client)118     boolean isSimCardPresent(String client);
119 
120     /**
121      * Change SIM profile
122      *
123      * @param simProfileId The target profile to be switched.
124      * @param client for tracking calling client
125      */
changeSimProfile(int simProfileId, String client)126     void changeSimProfile(int simProfileId, String client);
127 
128     /**
129      * Modify SIM info of the SIM such as MCC/MNC, IMSI, etc.
130      *
131      * @param type the type of SIM info to modify.
132      * @param data to modify for the type of SIM info.
133      * @param client for tracking calling client
134      */
setSimInfo(int type, String[] data, String client)135     void setSimInfo(int type, String[] data, String client);
136 
137     /**
138      * Get SIM info of the SIM slot, e.g. MCC/MNC, IMSI.
139      *
140      * @param type the type of SIM info.
141      * @param client for tracking calling client
142      * @return String the SIM info of the queried type.
143      */
getSimInfo(int type, String client)144     String getSimInfo(int type, String client);
145 }
146