Merge "get group identifier level1 (Gid1)"
diff --git a/src/java/com/android/internal/telephony/uicc/IccConstants.java b/src/java/com/android/internal/telephony/uicc/IccConstants.java
index c689539..26ae602 100644
--- a/src/java/com/android/internal/telephony/uicc/IccConstants.java
+++ b/src/java/com/android/internal/telephony/uicc/IccConstants.java
@@ -23,6 +23,7 @@
     // GSM SIM file ids from TS 51.011
     static final int EF_ADN = 0x6F3A;
     static final int EF_FDN = 0x6F3B;
+    static final int EF_GID1 = 0x6F3E;
     static final int EF_SDN = 0x6F49;
     static final int EF_EXT1 = 0x6F4A;
     static final int EF_EXT2 = 0x6F4B;
diff --git a/src/java/com/android/internal/telephony/uicc/IccRecords.java b/src/java/com/android/internal/telephony/uicc/IccRecords.java
index 38da633..23f04b4 100644
--- a/src/java/com/android/internal/telephony/uicc/IccRecords.java
+++ b/src/java/com/android/internal/telephony/uicc/IccRecords.java
@@ -72,6 +72,8 @@
 
     protected String spn;
 
+    protected String gid1;
+
     // ***** Constants
 
     // Markers for mncLength
@@ -214,6 +216,14 @@
     }
 
     /**
+     * Get the Group Identifier Level 1 (GID1) on a SIM for GSM.
+     * @return null if SIM is not yet ready
+     */
+    public String getGid1() {
+        return null;
+    }
+
+    /**
      * Set subscriber number to SIM record
      *
      * The subscriber number is stored in EF_MSISDN (TS 51.011)
diff --git a/src/java/com/android/internal/telephony/uicc/SIMFileHandler.java b/src/java/com/android/internal/telephony/uicc/SIMFileHandler.java
index 797a085..ed899ea 100644
--- a/src/java/com/android/internal/telephony/uicc/SIMFileHandler.java
+++ b/src/java/com/android/internal/telephony/uicc/SIMFileHandler.java
@@ -55,6 +55,7 @@
         case EF_SPDI:
         case EF_SST:
         case EF_CFIS:
+        case EF_GID1:
             return MF_SIM + DF_GSM;
 
         case EF_MAILBOX_CPHS:
diff --git a/src/java/com/android/internal/telephony/uicc/SIMRecords.java b/src/java/com/android/internal/telephony/uicc/SIMRecords.java
old mode 100755
new mode 100644
index 66eaf6a..0854512
--- a/src/java/com/android/internal/telephony/uicc/SIMRecords.java
+++ b/src/java/com/android/internal/telephony/uicc/SIMRecords.java
@@ -147,6 +147,7 @@
     private static final int EVENT_SIM_REFRESH = 31;
     private static final int EVENT_GET_CFIS_DONE = 32;
     private static final int EVENT_GET_CSP_CPHS_DONE = 33;
+    private static final int EVENT_GET_GID1_DONE = 34;
 
     // Lookup table for carriers known to produce SIMs which incorrectly indicate MNC length.
 
@@ -220,6 +221,7 @@
         efCPHS_MWI = null;
         spdiNetworks = null;
         pnnHomeName = null;
+        gid1 = null;
 
         adnCache.reset();
 
@@ -250,6 +252,11 @@
     }
 
     @Override
+    public String getGid1() {
+        return gid1;
+    }
+
+    @Override
     public UsimServiceTable getUsimServiceTable() {
         return mUsimServiceTable;
     }
@@ -1105,6 +1112,22 @@
                 handleEfCspData(data);
                 break;
 
+            case EVENT_GET_GID1_DONE:
+                isRecordLoadResponse = true;
+
+                ar = (AsyncResult)msg.obj;
+                data =(byte[])ar.result;
+
+                if (ar.exception != null) {
+                    loge("Exception in get GID1 " + ar.exception);
+                    gid1 = null;
+                    break;
+                }
+                gid1 = IccUtils.bytesToHexString(data);
+                log("GID1: " + gid1);
+
+                break;
+
             default:
                 super.handleMessage(msg);   // IccRecords handles generic record load responses
 
@@ -1374,7 +1397,10 @@
         mFh.loadEFTransparent(EF_INFO_CPHS, obtainMessage(EVENT_GET_INFO_CPHS_DONE));
         recordsToLoad++;
 
-        mFh.loadEFTransparent(EF_CSP_CPHS,obtainMessage(EVENT_GET_CSP_CPHS_DONE));
+        mFh.loadEFTransparent(EF_CSP_CPHS, obtainMessage(EVENT_GET_CSP_CPHS_DONE));
+        recordsToLoad++;
+
+        mFh.loadEFTransparent(EF_GID1, obtainMessage(EVENT_GET_GID1_DONE));
         recordsToLoad++;
 
         // XXX should seek instead of examining them all
@@ -1696,6 +1722,7 @@
         pw.println(" spdiNetworks[]=" + spdiNetworks);
         pw.println(" pnnHomeName=" + pnnHomeName);
         pw.println(" mUsimServiceTable=" + mUsimServiceTable);
+        pw.println(" gid1=" + gid1);
         pw.flush();
     }
-}
\ No newline at end of file
+}
diff --git a/src/java/com/android/internal/telephony/uicc/UsimFileHandler.java b/src/java/com/android/internal/telephony/uicc/UsimFileHandler.java
index f219153..4e7369d 100644
--- a/src/java/com/android/internal/telephony/uicc/UsimFileHandler.java
+++ b/src/java/com/android/internal/telephony/uicc/UsimFileHandler.java
@@ -57,6 +57,7 @@
         case EF_EXT2:
         case EF_INFO_CPHS:
         case EF_CSP_CPHS:
+        case EF_GID1:
             return MF_SIM + DF_ADF;
 
         case EF_PBR: