Loading src/java/com/android/internal/telephony/PhoneFactory.java +13 −6 Original line number Original line Diff line number Diff line Loading @@ -117,19 +117,18 @@ public class PhoneFactory { Rlog.i(LOG_TAG, "Cdma Subscription set to " + cdmaSubscription); Rlog.i(LOG_TAG, "Cdma Subscription set to " + cdmaSubscription); //reads the system properties and makes commandsinterface //reads the system properties and makes commandsinterface String sRILClassname = SystemProperties.get("ro.telephony.ril_class", "RIL"); String sRILClassname = SystemProperties.get("ro.telephony.ril_class", "RIL").trim(); Rlog.i(LOG_TAG, "RILClassname is " + sRILClassname); Rlog.i(LOG_TAG, "RILClassname is " + sRILClassname); // Use reflection to construct the RIL class (defaults to RIL) // Use reflection to construct the RIL class (defaults to RIL) try { try { Class<?> classDefinition = Class.forName("com.android.internal.telephony." + sRILClassname); sCommandsInterface = instantiateCustomRIL( Constructor<?> constructor = classDefinition.getConstructor(new Class[] {Context.class, int.class, int.class}); sRILClassname, context, networkMode, cdmaSubscription); sCommandsInterface = (RIL) constructor.newInstance(new Object[] {context, networkMode, cdmaSubscription}); } catch (Exception e) { } catch (Exception e) { // 6 different types of exceptions are thrown here that it's // 6 different types of exceptions are thrown here that it's // easier to just catch Exception as our "error handling" is the same. // easier to just catch Exception as our "error handling" is the same. Rlog.i(LOG_TAG, "Unable to construct command interface", e); Rlog.e(LOG_TAG, "Unable to construct custom RIL class", e); throw new RuntimeException(e); sCommandsInterface = new RIL(context, networkMode, cdmaSubscription); } } // Instantiate UiccController so that all other classes can just call getInstance() // Instantiate UiccController so that all other classes can just call getInstance() Loading Loading @@ -174,6 +173,14 @@ public class PhoneFactory { } } } } private static <T> T instantiateCustomRIL( String sRILClassname, Context context, int networkMode, int cdmaSubscription) throws Exception { Class<?> clazz = Class.forName("com.android.internal.telephony." + sRILClassname); Constructor<?> constructor = clazz.getConstructor(Context.class, int.class, int.class); return (T) clazz.cast(constructor.newInstance(context, networkMode, cdmaSubscription)); } public static Phone getDefaultPhone() { public static Phone getDefaultPhone() { if (sLooper != Looper.myLooper()) { if (sLooper != Looper.myLooper()) { throw new RuntimeException( throw new RuntimeException( Loading Loading
src/java/com/android/internal/telephony/PhoneFactory.java +13 −6 Original line number Original line Diff line number Diff line Loading @@ -117,19 +117,18 @@ public class PhoneFactory { Rlog.i(LOG_TAG, "Cdma Subscription set to " + cdmaSubscription); Rlog.i(LOG_TAG, "Cdma Subscription set to " + cdmaSubscription); //reads the system properties and makes commandsinterface //reads the system properties and makes commandsinterface String sRILClassname = SystemProperties.get("ro.telephony.ril_class", "RIL"); String sRILClassname = SystemProperties.get("ro.telephony.ril_class", "RIL").trim(); Rlog.i(LOG_TAG, "RILClassname is " + sRILClassname); Rlog.i(LOG_TAG, "RILClassname is " + sRILClassname); // Use reflection to construct the RIL class (defaults to RIL) // Use reflection to construct the RIL class (defaults to RIL) try { try { Class<?> classDefinition = Class.forName("com.android.internal.telephony." + sRILClassname); sCommandsInterface = instantiateCustomRIL( Constructor<?> constructor = classDefinition.getConstructor(new Class[] {Context.class, int.class, int.class}); sRILClassname, context, networkMode, cdmaSubscription); sCommandsInterface = (RIL) constructor.newInstance(new Object[] {context, networkMode, cdmaSubscription}); } catch (Exception e) { } catch (Exception e) { // 6 different types of exceptions are thrown here that it's // 6 different types of exceptions are thrown here that it's // easier to just catch Exception as our "error handling" is the same. // easier to just catch Exception as our "error handling" is the same. Rlog.i(LOG_TAG, "Unable to construct command interface", e); Rlog.e(LOG_TAG, "Unable to construct custom RIL class", e); throw new RuntimeException(e); sCommandsInterface = new RIL(context, networkMode, cdmaSubscription); } } // Instantiate UiccController so that all other classes can just call getInstance() // Instantiate UiccController so that all other classes can just call getInstance() Loading Loading @@ -174,6 +173,14 @@ public class PhoneFactory { } } } } private static <T> T instantiateCustomRIL( String sRILClassname, Context context, int networkMode, int cdmaSubscription) throws Exception { Class<?> clazz = Class.forName("com.android.internal.telephony." + sRILClassname); Constructor<?> constructor = clazz.getConstructor(Context.class, int.class, int.class); return (T) clazz.cast(constructor.newInstance(context, networkMode, cdmaSubscription)); } public static Phone getDefaultPhone() { public static Phone getDefaultPhone() { if (sLooper != Looper.myLooper()) { if (sLooper != Looper.myLooper()) { throw new RuntimeException( throw new RuntimeException( Loading