OSDN Git Service

Allow hasIccCard to be useable by any processes.
authorWink Saville <wink@google.com>
Thu, 3 Sep 2009 20:34:04 +0000 (13:34 -0700)
committerWink Saville <wink@google.com>
Thu, 3 Sep 2009 20:34:04 +0000 (13:34 -0700)
This is accomplished by adding hasIccCard to ITelephony and do
the implemenation in PhoneInterfaceManager.java. Then change
TelephonyManager to use getITelephony().hasIccCard().

Change-Id: I26970fdf92a058502b8156a4f52c14e213217fc6

telephony/java/android/telephony/TelephonyManager.java
telephony/java/com/android/internal/telephony/ITelephony.aidl

index a690e3c..a744486 100644 (file)
@@ -484,7 +484,12 @@ public class TelephonyManager {
      * @return true if a ICC card is present
      */
     public boolean hasIccCard() {
-        return PhoneFactory.getDefaultPhone().getIccCard().hasIccCard();
+        try {
+            return getITelephony().hasIccCard();
+        } catch (RemoteException ex) {
+            // Assume no ICC card if remote exception which shouldn't happen
+            return false;
+        }
     }
 
     /**
index 63c23ae..2328717 100644 (file)
@@ -252,5 +252,10 @@ interface ITelephony {
       * Returns the network type
       */
     int getNetworkType();
+    
+    /**
+     * Return true if an ICC card is present
+     */
+    boolean hasIccCard();
 }