Skip to content

Instantly share code, notes, and snippets.

@codekidX
Created June 19, 2014 08:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codekidX/140eadfc8f2ee0c9558b to your computer and use it in GitHub Desktop.
Save codekidX/140eadfc8f2ee0c9558b to your computer and use it in GitHub Desktop.
diff --git a/ril/com/android/internal/telephony/SamsungBCMRIL.java b/ril/com/android/internal/telephony/SamsungBCMRIL.java
index c38a22a..12c27fc 100644
--- a/ril/com/android/internal/telephony/SamsungBCMRIL.java
+++ b/ril/com/android/internal/telephony/SamsungBCMRIL.java
@@ -37,8 +37,13 @@ import java.util.ArrayList;
*/
public class SamsungBCMRIL extends RIL implements CommandsInterface {
public SamsungBCMRIL(Context context, int networkMode, int cdmaSubscription) {
- super(context, networkMode, cdmaSubscription);
- mQANElements = 5;
+ this(context, networkMode, cdmaSubscription, null);
+ }
+
+ public SamsungBCMRIL(Context context, int networkMode,
+ int cdmaSubscription, Integer instanceId) {
+ super(context, networkMode, cdmaSubscription, instanceId);
+ mQANElements = 6;
}
public void
@@ -63,10 +68,65 @@ public class SamsungBCMRIL extends RIL implements CommandsInterface {
send(rr);
}
- protected void
+ public void setUiccSubscription(int slotId, int appIndex, int subId,
+ int subStatus, Message result) {
+ if (RILJ_LOGD) riljLog("setUiccSubscription" + slotId + " " + appIndex + " " + subId + " " + subStatus);
+
+ // Fake response (note: should be sent before mSubscriptionStatusRegistrants or
+ // SubscriptionManager might not set the readiness correctly)
+ AsyncResult.forMessage(result, 0, null);
+ result.sendToTarget();
+
+ // TODO: Actually turn off/on the radio (and don't fight with the ServiceStateTracker)
+ if (subStatus == 1 /* ACTIVATE */) {
+ // Subscription changed: enabled
+ if (mSubscriptionStatusRegistrants != null) {
+ mSubscriptionStatusRegistrants.notifyRegistrants(
+ new AsyncResult (null, new int[] {1}, null));
+ }
+ } else if (subStatus == 0 /* DEACTIVATE */) {
+ // Subscription changed: disabled
+ if (mSubscriptionStatusRegistrants != null) {
+ mSubscriptionStatusRegistrants.notifyRegistrants(
+ new AsyncResult (null, new int[] {0}, null));
+ }
+ }
+ }
+
+ public void setDataSubscription(Message result) {
+ int simId = mInstanceId == null ? 0 : mInstanceId;
+ if (RILJ_LOGD) riljLog("Setting data subscription to " + simId);
+ invokeOemRilRequestBrcm((byte) 0, (byte)(0x30 + simId), result);
+ }
+
+ public void setDefaultVoiceSub(int subIndex, Message response) {
+ // No need to inform the RIL on Broadcom
+ AsyncResult.forMessage(response, 0, null);
+ response.sendToTarget();
+ }
+
+ @Override
+ protected void notifyRegistrantsRilConnectionChanged(int rilVer) {
+ super.notifyRegistrantsRilConnectionChanged(rilVer);
+ if (rilVer != -1) {
+ if (mInstanceId != null) {
+ // Enable simultaneous data/voice on Multi-SIM
+ invokeOemRilRequestBrcm((byte) 3, (byte) 1, null);
+ } else {
+ // Set data subscription to allow data in either SIM slot when using single SIM mode
+ setDataSubscription(null);
+ }
+ }
+ }
+
+ private void invokeOemRilRequestBrcm(byte key, byte value, Message response) {
+ invokeOemRilRequestRaw(new byte[] { 'B', 'R', 'C', 'M', key, value }, response);
+ }
+
+ protected RILRequest
processSolicited (Parcel p) {
int serial, error;
- boolean found = false;
+
serial = p.readInt();
error = p.readInt();
@@ -98,7 +158,7 @@ public class SamsungBCMRIL extends RIL implements CommandsInterface {
case RIL_REQUEST_ENTER_SIM_PUK2: ret = responseInts(p); break;
case RIL_REQUEST_CHANGE_SIM_PIN: ret = responseInts(p); break;
case RIL_REQUEST_CHANGE_SIM_PIN2: ret = responseInts(p); break;
- case RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION: ret = responseInts(p); break;
+ case RIL_REQUEST_ENTER_DEPERSONALIZATION_CODE: ret = responseInts(p); break;
case RIL_REQUEST_GET_CURRENT_CALLS: ret = responseCallList(p); break;
case RIL_REQUEST_DIAL: ret = responseVoid(p); break;
case RIL_REQUEST_GET_IMSI: ret = responseString(p); break;
@@ -222,8 +282,7 @@ public class SamsungBCMRIL extends RIL implements CommandsInterface {
AsyncResult.forMessage(rr.mResult, null, tr);
rr.mResult.sendToTarget();
}
- rr.release();
- return;
+ return rr;
}
}
@@ -251,8 +310,7 @@ public class SamsungBCMRIL extends RIL implements CommandsInterface {
if (error != 0) {
rr.onError(error, ret);
- rr.release();
- return;
+ return rr;
}
if (RILJ_LOGD) riljLog(rr.serialString() + "< " + requestToString(rr.mRequest)
@@ -263,7 +321,7 @@ public class SamsungBCMRIL extends RIL implements CommandsInterface {
rr.mResult.sendToTarget();
}
- rr.release();
+ return rr;
}
diff --git a/system.prop b/system.prop
index 0cfefb8..4bfcac3 100644
--- a/system.prop
+++ b/system.prop
@@ -14,4 +14,6 @@ ro.kernel.qemu=0
ro.tvout.enable=false
persist.sys.storage_preload=1
+ro.telephony.ril_class=SamsungBCMRIL
+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment