Skip to content

Commit 5f12f03

Browse files
author
Daisuke Miyakawa
committed
Move TelephonyCapabilities from Phone to telephony
- Move the class. - Remove some TODOs mentioning this action : the class should belong to telephony layer instead of to the Phone package - Add private strings used in the class Bug: 6252254 Change-Id: I0d4ca2f8e4d775004d146fe6f9c60165a94366a9
1 parent 58a40a3 commit 5f12f03

File tree

3 files changed

+168
-0
lines changed

3 files changed

+168
-0
lines changed

core/res/res/values/public.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,8 @@
850850
<java-symbol type="string" name="wifi_watchdog_network_disabled" />
851851
<java-symbol type="string" name="wifi_watchdog_network_disabled_detailed" />
852852
<java-symbol type="string" name="yesterday" />
853+
<java-symbol type="string" name="imei" />
854+
<java-symbol type="string" name="meid" />
853855

854856
<java-symbol type="plurals" name="abbrev_in_num_days" />
855857
<java-symbol type="plurals" name="abbrev_in_num_hours" />

core/res/res/values/strings.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@
9797
the SIM card. -->
9898
<string name="needPuk">Your SIM card is PUK-locked. Type the PUK code to unlock it.</string>
9999
<string name="needPuk2">Type PUK2 to unblock SIM card.</string>
100+
<!-- Title for the dialog used to display the user's IMEI number [CHAR LIMIT=10] -->
101+
<string name="imei">IMEI</string>
102+
103+
<!-- Title for the dialog used to display the user's MEID number on CDMA network
104+
[CHAR LIMIT=10] -->
105+
<string name="meid">MEID</string>
100106

101107
<!-- Displayed as the title for a success/failure report enabling/disabling caller ID. -->
102108
<string name="ClipMmi">Incoming Caller ID</string>
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
/*
2+
* Copyright (C) 2010 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.util.Log;
20+
21+
import com.android.internal.telephony.Phone;
22+
23+
/**
24+
* Utilities that check if the phone supports specified capabilities.
25+
*/
26+
public class TelephonyCapabilities {
27+
private static final String LOG_TAG = "TelephonyCapabilities";
28+
29+
/** This class is never instantiated. */
30+
private TelephonyCapabilities() {
31+
}
32+
33+
/**
34+
* Return true if the current phone supports ECM ("Emergency Callback
35+
* Mode"), which is a feature where the device goes into a special
36+
* state for a short period of time after making an outgoing emergency
37+
* call.
38+
*
39+
* (On current devices, that state lasts 5 minutes. It prevents data
40+
* usage by other apps, to avoid conflicts with any possible incoming
41+
* calls. It also puts up a notification in the status bar, showing a
42+
* countdown while ECM is active, and allowing the user to exit ECM.)
43+
*
44+
* Currently this is assumed to be true for CDMA phones, and false
45+
* otherwise.
46+
*/
47+
public static boolean supportsEcm(Phone phone) {
48+
return (phone.getPhoneType() == Phone.PHONE_TYPE_CDMA);
49+
}
50+
51+
/**
52+
* Return true if the current phone supports Over The Air Service
53+
* Provisioning (OTASP)
54+
*
55+
* Currently this is assumed to be true for CDMA phones, and false
56+
* otherwise.
57+
*
58+
* TODO: Watch out: this is also highly carrier-specific, since the
59+
* OTASP procedure is different from one carrier to the next, *and* the
60+
* different carriers may want very different onscreen UI as well.
61+
* The procedure may even be different for different devices with the
62+
* same carrier.
63+
*
64+
* So we eventually will need a much more flexible, pluggable design.
65+
* This method here is just a placeholder to reduce hardcoded
66+
* "if (CDMA)" checks sprinkled throughout the phone app.
67+
*/
68+
public static boolean supportsOtasp(Phone phone) {
69+
return (phone.getPhoneType() == Phone.PHONE_TYPE_CDMA);
70+
}
71+
72+
/**
73+
* Return true if the current phone can retrieve the voice message count.
74+
*
75+
* Currently this is assumed to be true on CDMA phones and false otherwise.
76+
*/
77+
public static boolean supportsVoiceMessageCount(Phone phone) {
78+
return (phone.getPhoneType() == Phone.PHONE_TYPE_CDMA);
79+
}
80+
81+
/**
82+
* Return true if this phone allows the user to select which
83+
* network to use.
84+
*
85+
* Currently this is assumed to be true only on GSM phones.
86+
*
87+
* TODO: Should CDMA phones allow this as well?
88+
*/
89+
public static boolean supportsNetworkSelection(Phone phone) {
90+
return (phone.getPhoneType() == Phone.PHONE_TYPE_GSM);
91+
}
92+
93+
/**
94+
* Returns a resource ID for a label to use when displaying the
95+
* "device id" of the current device. (This is currently used as the
96+
* title of the "device id" dialog.)
97+
*
98+
* This is specific to the device's telephony technology: the device
99+
* id is called "IMEI" on GSM phones and "MEID" on CDMA phones.
100+
*/
101+
public static int getDeviceIdLabel(Phone phone) {
102+
if (phone.getPhoneType() == Phone.PHONE_TYPE_GSM) {
103+
return com.android.internal.R.string.imei;
104+
} else if (phone.getPhoneType() == Phone.PHONE_TYPE_CDMA) {
105+
return com.android.internal.R.string.meid;
106+
} else {
107+
Log.w(LOG_TAG, "getDeviceIdLabel: no known label for phone "
108+
+ phone.getPhoneName());
109+
return 0;
110+
}
111+
}
112+
113+
/**
114+
* Return true if the current phone supports the ability to explicitly
115+
* manage the state of a conference call (i.e. view the participants,
116+
* and hangup or separate individual callers.)
117+
*
118+
* The in-call screen's "Manage conference" UI is available only on
119+
* devices that support this feature.
120+
*
121+
* Currently this is assumed to be true on GSM phones and false otherwise.
122+
*/
123+
public static boolean supportsConferenceCallManagement(Phone phone) {
124+
return ((phone.getPhoneType() == Phone.PHONE_TYPE_GSM)
125+
|| (phone.getPhoneType() == Phone.PHONE_TYPE_SIP));
126+
}
127+
128+
/**
129+
* Return true if the current phone supports explicit "Hold" and
130+
* "Unhold" actions for an active call. (If so, the in-call UI will
131+
* provide onscreen "Hold" / "Unhold" buttons.)
132+
*
133+
* Currently this is assumed to be true on GSM phones and false
134+
* otherwise. (In particular, CDMA has no concept of "putting a call
135+
* on hold.")
136+
*/
137+
public static boolean supportsHoldAndUnhold(Phone phone) {
138+
return ((phone.getPhoneType() == Phone.PHONE_TYPE_GSM)
139+
|| (phone.getPhoneType() == Phone.PHONE_TYPE_SIP));
140+
}
141+
142+
/**
143+
* Return true if the current phone supports distinct "Answer & Hold"
144+
* and "Answer & End" behaviors in the call-waiting scenario. If so,
145+
* the in-call UI may provide separate buttons or menu items for these
146+
* two actions.
147+
*
148+
* Currently this is assumed to be true on GSM phones and false
149+
* otherwise. (In particular, CDMA has no concept of explicitly
150+
* managing the background call, or "putting a call on hold.")
151+
*
152+
* TODO: It might be better to expose this capability in a more
153+
* generic form, like maybe "supportsExplicitMultipleLineManagement()"
154+
* rather than focusing specifically on call-waiting behavior.
155+
*/
156+
public static boolean supportsAnswerAndHold(Phone phone) {
157+
return ((phone.getPhoneType() == Phone.PHONE_TYPE_GSM)
158+
|| (phone.getPhoneType() == Phone.PHONE_TYPE_SIP));
159+
}
160+
}

0 commit comments

Comments
 (0)