summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorcodeworkx <codeworkx@cyanogenmod.org>2013-02-10 14:58:27 +0000
committercodeworkx <codeworkx@cyanogenmod.org>2013-02-10 14:58:27 +0000
commit4792c9f7fb4102f9a2f0060b3eb87221fb6dda33 (patch)
tree21af955b9a5486c17013d264efeffcf96a743dc1 /src
parent91c91511c9c3b92e4b3e9b4a66cd03786f267cab (diff)
downloadframeworks_opt_telephony-4792c9f7fb4102f9a2f0060b3eb87221fb6dda33.zip
frameworks_opt_telephony-4792c9f7fb4102f9a2f0060b3eb87221fb6dda33.tar.gz
frameworks_opt_telephony-4792c9f7fb4102f9a2f0060b3eb87221fb6dda33.tar.bz2
telephony: add SamsungQualcommM3RIL for samsung m3 devices
Change-Id: I09fa6ee92f39c84c6a01002c35e15dd9112f618a
Diffstat (limited to 'src')
-rw-r--r--src/java/com/android/internal/telephony/SamsungQualcommM3RIL.java184
1 files changed, 184 insertions, 0 deletions
diff --git a/src/java/com/android/internal/telephony/SamsungQualcommM3RIL.java b/src/java/com/android/internal/telephony/SamsungQualcommM3RIL.java
new file mode 100644
index 0000000..07681de
--- /dev/null
+++ b/src/java/com/android/internal/telephony/SamsungQualcommM3RIL.java
@@ -0,0 +1,184 @@
+/*
+ * Copyright (C) 2013 The CyanogenMod Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.telephony;
+
+import static com.android.internal.telephony.RILConstants.*;
+
+import android.content.Context;
+import android.os.Parcel;
+import android.os.SystemProperties;
+import android.util.Log;
+import com.android.internal.telephony.RILConstants;
+import java.util.Collections;
+import android.telephony.PhoneNumberUtils;
+
+import java.util.ArrayList;
+
+/**
+ * Custom RIL to handle unique behavior of M3 radio
+ *
+ * {@hide}
+ */
+public class SamsungQualcommM3RIL extends SamsungQualcommUiccRIL implements CommandsInterface {
+
+ public SamsungQualcommM3RIL(Context context, int networkMode, int cdmaSubscription) {
+ super(context, networkMode, cdmaSubscription);
+ }
+
+ @Override
+ protected void
+ processUnsolicited (Parcel p) {
+ Object ret;
+ int dataPosition = p.dataPosition();
+ int response = p.readInt();
+
+ switch (response) {
+ case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED: ret = responseVoid(p); break;
+
+ default:
+ // Rewind the Parcel
+ p.setDataPosition(dataPosition);
+
+ // Forward responses that we are not overriding to the super class
+ super.processUnsolicited(p);
+ return;
+ }
+
+ switch (response) {
+ case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED:
+ /* has bonus radio state int */
+ int state = p.readInt();
+ Log.d(LOG_TAG, "Radio state: " + state);
+
+ switch (state) {
+ case 2:
+ // RADIO_UNAVAILABLE
+ state = 1;
+ break;
+ case 3:
+ // RADIO_ON
+ state = 10;
+ break;
+ case 4:
+ // RADIO_ON
+ state = 10;
+ // When SIM is PIN-unlocked, RIL doesn't respond with RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED.
+ // We notify the system here.
+ Log.d(LOG_TAG, "SIM is PIN-unlocked now");
+ if (mIccStatusChangedRegistrants != null) {
+ mIccStatusChangedRegistrants.notifyRegistrants();
+ }
+ break;
+ }
+ RadioState newState = getRadioStateFromInt(state);
+ Log.d(LOG_TAG, "New Radio state: " + state + " (" + newState.toString() + ")");
+ switchToRadioState(newState);
+ break;
+ }
+ }
+
+ @Override
+ protected Object
+ responseCallList(Parcel p) {
+ int num;
+ boolean isVideo;
+ ArrayList<DriverCall> response;
+ DriverCall dc;
+ int dataAvail = p.dataAvail();
+ int pos = p.dataPosition();
+ int size = p.dataSize();
+
+ Log.d(LOG_TAG, "Parcel size = " + size);
+ Log.d(LOG_TAG, "Parcel pos = " + pos);
+ Log.d(LOG_TAG, "Parcel dataAvail = " + dataAvail);
+
+ //Samsung changes
+ num = p.readInt();
+
+ Log.d(LOG_TAG, "num = " + num);
+ response = new ArrayList<DriverCall>(num);
+
+ for (int i = 0 ; i < num ; i++) {
+
+ dc = new DriverCall();
+ dc.state = DriverCall.stateFromCLCC(p.readInt());
+ dc.index = p.readInt();
+ dc.TOA = p.readInt();
+ dc.isMpty = (0 != p.readInt());
+ dc.isMT = (0 != p.readInt());
+ dc.als = p.readInt();
+ dc.isVoice = (0 != p.readInt());
+ isVideo = (0 != p.readInt());
+ dc.isVoicePrivacy = (0 != p.readInt());
+ dc.number = p.readString();
+ int np = p.readInt();
+ dc.numberPresentation = DriverCall.presentationFromCLIP(np);
+ dc.name = p.readString();
+ dc.namePresentation = p.readInt();
+ int uusInfoPresent = p.readInt();
+
+ Log.d(LOG_TAG, "state = " + dc.state);
+ Log.d(LOG_TAG, "index = " + dc.index);
+ Log.d(LOG_TAG, "state = " + dc.TOA);
+ Log.d(LOG_TAG, "isMpty = " + dc.isMpty);
+ Log.d(LOG_TAG, "isMT = " + dc.isMT);
+ Log.d(LOG_TAG, "als = " + dc.als);
+ Log.d(LOG_TAG, "isVoice = " + dc.isVoice);
+ Log.d(LOG_TAG, "isVideo = " + isVideo);
+ Log.d(LOG_TAG, "number = " + dc.number);
+ Log.d(LOG_TAG, "np = " + np);
+ Log.d(LOG_TAG, "name = " + dc.name);
+ Log.d(LOG_TAG, "namePresentation = " + dc.namePresentation);
+ Log.d(LOG_TAG, "uusInfoPresent = " + uusInfoPresent);
+
+ if (uusInfoPresent == 1) {
+ dc.uusInfo = new UUSInfo();
+ dc.uusInfo.setType(p.readInt());
+ dc.uusInfo.setDcs(p.readInt());
+ byte[] userData = p.createByteArray();
+ dc.uusInfo.setUserData(userData);
+ Log
+ .v(LOG_TAG, String.format("Incoming UUS : type=%d, dcs=%d, length=%d",
+ dc.uusInfo.getType(), dc.uusInfo.getDcs(),
+ dc.uusInfo.getUserData().length));
+ Log.v(LOG_TAG, "Incoming UUS : data (string)="
+ + new String(dc.uusInfo.getUserData()));
+ Log.v(LOG_TAG, "Incoming UUS : data (hex): "
+ + IccUtils.bytesToHexString(dc.uusInfo.getUserData()));
+ } else {
+ Log.v(LOG_TAG, "Incoming UUS : NOT present!");
+ }
+
+ // Make sure there's a leading + on addresses with a TOA of 145
+ dc.number = PhoneNumberUtils.stringFromStringAndTOA(dc.number, dc.TOA);
+
+ response.add(dc);
+
+ if (dc.isVoicePrivacy) {
+ mVoicePrivacyOnRegistrants.notifyRegistrants();
+ Log.d(LOG_TAG, "InCall VoicePrivacy is enabled");
+ } else {
+ mVoicePrivacyOffRegistrants.notifyRegistrants();
+ Log.d(LOG_TAG, "InCall VoicePrivacy is disabled");
+ }
+ }
+
+ Collections.sort(response);
+
+ return response;
+ }
+}