redirect RIL_UNSOL_OEM_HOOK_RAW to system app
New Author Steven Liu [Thu, 11 Sep 2014 15:27:55 +0000 (10:27 -0500)]
add notifyOemHookRawEvent

Bug: 17298769
Change-Id: Iaea054d3cc2925eea1e11f8871faabc7bc9dfb2d

src/java/com/android/internal/telephony/CommandsInterface.java
src/java/com/android/internal/telephony/DefaultPhoneNotifier.java
src/java/com/android/internal/telephony/PhoneBase.java
src/java/com/android/internal/telephony/PhoneNotifier.java

index cd61249..6b52ce9 100644 (file)
@@ -1388,6 +1388,11 @@ public interface CommandsInterface {
 
     void invokeOemRilRequestStrings(String[] strings, Message response);
 
+    /**
+     * Fires when RIL_UNSOL_OEM_HOOK_RAW is received from the RIL.
+     */
+    void setOnUnsolOemHookRaw(Handler h, int what, Object obj);
+    void unSetOnUnsolOemHookRaw(Handler h);
 
     /**
      * Send TERMINAL RESPONSE to the SIM, after processing a proactive command
index 83ecfa7..9daa587 100644 (file)
@@ -299,6 +299,15 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
         }
     }
 
+    @Override
+    public void notifyOemHookRawEventForSubscriber(long subId, byte[] rawData) {
+        try {
+            mRegistry.notifyOemHookRawEventForSubscriber(subId, rawData);
+        } catch (RemoteException ex) {
+            // system process is dead
+        }
+    }
+
     /**
      * Convert the {@link PhoneConstants.State} enum into the TelephonyManager.CALL_STATE_*
      * constants for the public API.
index 564c45d..3c7c9af 100644 (file)
@@ -151,7 +151,8 @@ public abstract class PhoneBase extends Handler implements Phone {
     // Single Radio Voice Call Continuity
     protected static final int EVENT_SRVCC_STATE_CHANGED            = 31;
     protected static final int EVENT_INITIATE_SILENT_REDIAL         = 32;
-    protected static final int EVENT_LAST                           = EVENT_INITIATE_SILENT_REDIAL;
+    protected static final int EVENT_UNSOL_OEM_HOOK_RAW             = 33;
+    protected static final int EVENT_LAST                           = EVENT_UNSOL_OEM_HOOK_RAW;
 
     // Key used to read/write current CLIR setting
     public static final String CLIR_KEY = "clir_key";
@@ -401,6 +402,7 @@ public abstract class PhoneBase extends Handler implements Phone {
         mContext.registerReceiver(mImsIntentReceiver, filter);
 
         mCi.registerForSrvccStateChanged(this, EVENT_SRVCC_STATE_CHANGED, null);
+        mCi.setOnUnsolOemHookRaw(this, EVENT_UNSOL_OEM_HOOK_RAW, null);
     }
 
     @Override
@@ -416,6 +418,7 @@ public abstract class PhoneBase extends Handler implements Phone {
             mSmsUsageMonitor.dispose();
             mUiccController.unregisterForIccChanged(this);
             mCi.unregisterForSrvccStateChanged(this);
+            mCi.unSetOnUnsolOemHookRaw(this);
 
             if (mTelephonyTester != null) {
                 mTelephonyTester.dispose();
@@ -518,6 +521,18 @@ public abstract class PhoneBase extends Handler implements Phone {
                 }
                 break;
 
+            case EVENT_UNSOL_OEM_HOOK_RAW:
+                ar = (AsyncResult)msg.obj;
+                if (ar.exception == null) {
+                    byte[] data = (byte[])ar.result;
+                    Rlog.d(LOG_TAG, "EVENT_UNSOL_OEM_HOOK_RAW data="
+                            + IccUtils.bytesToHexString(data));
+                    mNotifier.notifyOemHookRawEventForSubscriber(getSubId(), data);
+                } else {
+                    Rlog.e(LOG_TAG, "OEM hook raw exception: " + ar.exception);
+                }
+                break;
+
             default:
                 throw new RuntimeException("unexpected event not handled");
         }
index da3e305..9d7875e 100644 (file)
@@ -61,4 +61,6 @@ public interface PhoneNotifier {
     public void notifyDataConnectionRealTimeInfo(Phone sender, DataConnectionRealTimeInfo dcRtInfo);
 
     public void notifyVoLteServiceStateChanged(Phone sender, VoLteServiceState lteState);
+
+    public void notifyOemHookRawEventForSubscriber(long subId, byte[] rawData);
 }