Fields Summary |
---|
private static final String | LOG_TAG |
protected final android.os.RegistrantList | mPhoneStateRegistrants |
protected final android.os.RegistrantList | mNewRingingConnectionRegistrants |
protected final android.os.RegistrantList | mIncomingRingRegistrants |
protected final android.os.RegistrantList | mDisconnectRegistrants |
protected final android.os.RegistrantList | mServiceStateRegistrants |
protected final android.os.RegistrantList | mMmiCompleteRegistrants |
protected final android.os.RegistrantList | mMmiRegistrants |
protected final android.os.RegistrantList | mUnknownConnectionRegistrants |
protected final android.os.RegistrantList | mSuppServiceFailedRegistrants |
protected android.os.Looper | mLooper |
protected android.content.Context | mContext |
protected PhoneNotifier | mNotifierPhoneNotifier is an abstraction for all system-wide
state change notification. DefaultPhoneNotifier is
used here unless running we're inside a unit test. |
protected com.android.internal.telephony.test.SimulatedRadioControl | mSimulatedRadioControl |
boolean | mUnitTestMode |
Methods Summary |
---|
private void | checkCorrectThread(android.os.Handler h)Verifies the current thread is the same as the thread originally
used in the initialization of this instance. Throws RuntimeException
if not.
if (h.getLooper() != mLooper) {
throw new RuntimeException(
"com.android.internal.telephony.Phone must be used from within one thread");
}
|
public android.content.Context | getContext()
return mContext;
|
public abstract java.util.List | getPendingMmiCodes()Subclasses should override this. See documentation in superclass.
|
public com.android.internal.telephony.test.SimulatedRadioControl | getSimulatedRadioControl()
return mSimulatedRadioControl;
|
public boolean | getUnitTestMode()
return mUnitTestMode;
|
protected void | notifyCallStateChangedP()Notify registrants of a PhoneStateChanged.
Subclasses of Phone probably want to replace this with a
version scoped to their packages
AsyncResult ar = new AsyncResult(null, this, null);
mPhoneStateRegistrants.notifyRegistrants(ar);
|
protected void | notifyDisconnectP(Connection cn)To be invoked when a voice call Connection disconnects.
Subclasses of Phone probably want to replace this with a
version scoped to their packages
AsyncResult ar = new AsyncResult(null, cn, null);
mDisconnectRegistrants.notifyRegistrants(ar);
|
protected void | notifyNewRingingConnectionP(Connection cn)Notifiy registrants of a new ringing Connection.
Subclasses of Phone probably want to replace this with a
version scoped to their packages
AsyncResult ar = new AsyncResult(null, cn, null);
mNewRingingConnectionRegistrants.notifyRegistrants(ar);
|
protected void | notifyServiceStateChangedP(android.telephony.ServiceState ss)Subclasses of Phone probably want to replace this with a
version scoped to their packages
AsyncResult ar = new AsyncResult(null, ss, null);
mServiceStateRegistrants.notifyRegistrants(ar);
mNotifier.notifyServiceState(this);
|
public void | registerForDisconnect(android.os.Handler h, int what, java.lang.Object obj)
checkCorrectThread(h);
mDisconnectRegistrants.addUnique(h, what, obj);
|
public void | registerForIncomingRing(android.os.Handler h, int what, java.lang.Object obj)
checkCorrectThread(h);
mIncomingRingRegistrants.addUnique(h, what, obj);
|
public void | registerForMmiComplete(android.os.Handler h, int what, java.lang.Object obj)
checkCorrectThread(h);
mMmiCompleteRegistrants.addUnique(h, what, obj);
|
public void | registerForMmiInitiate(android.os.Handler h, int what, java.lang.Object obj)
checkCorrectThread(h);
mMmiRegistrants.addUnique(h, what, obj);
|
public void | registerForNewRingingConnection(android.os.Handler h, int what, java.lang.Object obj)
checkCorrectThread(h);
mNewRingingConnectionRegistrants.addUnique(h, what, obj);
|
public void | registerForPhoneStateChanged(android.os.Handler h, int what, java.lang.Object obj)
checkCorrectThread(h);
mPhoneStateRegistrants.addUnique(h, what, obj);
|
public void | registerForServiceStateChanged(android.os.Handler h, int what, java.lang.Object obj)
checkCorrectThread(h);
mServiceStateRegistrants.add(h, what, obj);
|
public void | registerForSuppServiceFailed(android.os.Handler h, int what, java.lang.Object obj)
checkCorrectThread(h);
mSuppServiceFailedRegistrants.addUnique(h, what, obj);
|
public void | registerForUnknownConnection(android.os.Handler h, int what, java.lang.Object obj)
checkCorrectThread(h);
mUnknownConnectionRegistrants.addUnique(h, what, obj);
|
private void | setLocaleByCarrier()Set the locale by matching the carrier string in
a string-array resource
String carrier = SystemProperties.get("ro.carrier");
if (null == carrier || 0 == carrier.length()) {
return;
}
CharSequence[] carrierLocales = mContext.
getResources().getTextArray(R.array.carrier_locales);
for (int i = 0; i < carrierLocales.length-1; i+=2) {
String c = carrierLocales[i].toString();
String l = carrierLocales[i+1].toString();
if (carrier.equals(c)) {
String language = l.substring(0, 2);
String country = "";
if (l.length() >=5) {
country = l.substring(3, 5);
}
setSystemLocale(language, country);
return;
}
}
|
public void | setSystemLocale(java.lang.String language, java.lang.String country)Utility code to set the system locale if it's not set already
String l = SystemProperties.get("persist.sys.language");
String c = SystemProperties.get("persist.sys.country");
if (null == language) {
return; // no match possible
}
language.toLowerCase();
if (null == country) {
country = "";
}
country = country.toUpperCase();
if((null == l || 0 == l.length()) && (null == c || 0 == c.length())) {
try {
// try to find a good match
String[] locales = mContext.getAssets().getLocales();
final int N = locales.length;
String bestMatch = null;
for(int i = 0; i < N; i++) {
if (locales[i]!=null && locales[i].length() >= 2 &&
locales[i].substring(0,2).equals(language)) {
if (locales[i].length() >= 5) {
if (locales[i].substring(3,5).equals(country)) {
bestMatch = locales[i];
break;
}
} else if (null == bestMatch) {
bestMatch = locales[i];
}
}
}
if (null != bestMatch) {
IActivityManager am = ActivityManagerNative.getDefault();
Configuration config = am.getConfiguration();
if (bestMatch.length() >= 5) {
config.locale = new Locale(bestMatch.substring(0,2),
bestMatch.substring(3,5));
} else {
config.locale = new Locale(bestMatch.substring(0,2));
}
config.userSetLocale = true;
am.updateConfiguration(config);
}
} catch (Exception e) {
// Intentionally left blank
}
}
|
public void | setUnitTestMode(boolean f)
mUnitTestMode = f;
|
public void | unregisterForDisconnect(android.os.Handler h)
mDisconnectRegistrants.remove(h);
|
public void | unregisterForIncomingRing(android.os.Handler h)
mIncomingRingRegistrants.remove(h);
|
public void | unregisterForMmiComplete(android.os.Handler h)
checkCorrectThread(h);
mMmiCompleteRegistrants.remove(h);
|
public void | unregisterForMmiInitiate(android.os.Handler h)
mMmiRegistrants.remove(h);
|
public void | unregisterForNewRingingConnection(android.os.Handler h)
mNewRingingConnectionRegistrants.remove(h);
|
public void | unregisterForPhoneStateChanged(android.os.Handler h)
mPhoneStateRegistrants.remove(h);
|
public void | unregisterForServiceStateChanged(android.os.Handler h)
mServiceStateRegistrants.remove(h);
|
public void | unregisterForSuppServiceFailed(android.os.Handler h)
mSuppServiceFailedRegistrants.remove(h);
|
public void | unregisterForUnknownConnection(android.os.Handler h)
mUnknownConnectionRegistrants.remove(h);
|