Methods Summary |
---|
public static Phone | getDefaultPhone()
if (!sMadeDefaults) {
throw new IllegalStateException("Default phones haven't been made yet!");
}
if (sLooper != Looper.myLooper()) {
throw new RuntimeException(
"PhoneFactory.getDefaultPhone must be called from Looper thread");
}
synchronized (sPhones) {
return sPhones.isEmpty() ? null : sPhones.get(0);
}
|
public static void | makeDefaultPhones(android.content.Context context)FIXME replace this with some other way of making these
instances
synchronized(Phone.class) {
if (!sMadeDefaults) {
sLooper = Looper.myLooper();
if (sLooper == null) {
throw new RuntimeException(
"PhoneFactory.makeDefaultPhones must be called from Looper thread");
}
int retryCount = 0;
for(;;) {
boolean hasException = false;
retryCount ++;
try {
// use UNIX domain socket to
// prevent subsequent initialization
new LocalServerSocket("com.android.internal.telephony");
} catch (java.io.IOException ex) {
hasException = true;
}
if ( !hasException ) {
break;
} else if (retryCount > SOCKET_OPEN_MAX_RETRY) {
throw new RuntimeException("PhoneFactory probably already running");
}else {
try {
Thread.sleep(SOCKET_OPEN_RETRY_MILLIS);
} catch (InterruptedException er) {
}
}
}
sPhoneNotifier = new DefaultPhoneNotifier();
if ((SystemProperties.get("ro.radio.noril","")).equals("")) {
useNewRIL(context);
} else {
GSMPhone phone;
phone = new GSMPhone(context, new SimulatedCommands(), sPhoneNotifier);
registerPhone (phone);
}
sMadeDefaults = true;
}
}
|
public static void | registerPhone(Phone p)
if (sLooper != Looper.myLooper()) {
throw new RuntimeException(
"PhoneFactory.getDefaultPhone must be called from Looper thread");
}
synchronized (sPhones) {
sPhones.add(p);
}
|
private static void | useNewRIL(android.content.Context context)
//***** Class Methods
ModelInterpreter mi = null;
GSMPhone phone;
try {
if (false) {
mi = new ModelInterpreter(new InetSocketAddress("127.0.0.1", 6502));
}
phone = new GSMPhone(context, new RIL(context), sPhoneNotifier);
registerPhone (phone);
} catch (IOException ex) {
Log.e(LOG_TAG, "Error creating ModelInterpreter", ex);
}
|