Skip to content

Instantly share code, notes, and snippets.

@udit217
Forked from pawitp/msim_frameworks_base.diff
Created August 28, 2014 13:00
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 udit217/45173c417cdf6c52b19d to your computer and use it in GitHub Desktop.
Save udit217/45173c417cdf6c52b19d to your computer and use it in GitHub Desktop.
From f651ac399d259a6bd301414737b9a78a62f2bfae Mon Sep 17 00:00:00 2001
From: Pawit Pornkitprasan <p.pawit@gmail.com>
Date: Sat, 8 Mar 2014 19:45:44 +0700
Subject: [PATCH 1/2] MSimTelephonyManager: set properties in Broadcom-style as
expected by RIL
Change-Id: I64b37ac34fdec096ea77ccb7afc4b3cfccadcd3d
---
.../android/telephony/MSimTelephonyManager.java | 43 +++-------------------
1 file changed, 6 insertions(+), 37 deletions(-)
diff --git a/telephony/java/android/telephony/MSimTelephonyManager.java b/telephony/java/android/telephony/MSimTelephonyManager.java
index 3f4c067..3081af8 100644
--- a/telephony/java/android/telephony/MSimTelephonyManager.java
+++ b/telephony/java/android/telephony/MSimTelephonyManager.java
@@ -953,35 +953,10 @@ public class MSimTelephonyManager {
* @hide
*/
public static void setTelephonyProperty(String property, int index, String value) {
- String propVal = "";
- String p[] = null;
- String prop = SystemProperties.get(property);
-
- if (value == null) {
- value = "";
- }
-
- if (prop != null) {
- p = prop.split(",");
- }
-
- if (index < 0) return;
-
- for (int i = 0; i < index; i++) {
- String str = "";
- if ((p != null) && (i < p.length)) {
- str = p[i];
- }
- propVal = propVal + str + ",";
+ if (index != 0) {
+ property += "_" + index;
}
-
- propVal = propVal + value;
- if (p != null) {
- for (int i = index+1; i < p.length; i++) {
- propVal = propVal + "," + p[i];
- }
- }
- SystemProperties.set(property, propVal);
+ SystemProperties.set(property, value);
}
/**
@@ -990,16 +965,10 @@ public class MSimTelephonyManager {
* @hide
*/
public static String getTelephonyProperty(String property, int index, String defaultVal) {
- String propVal = null;
- String prop = SystemProperties.get(property);
-
- if ((prop != null) && (prop.length() > 0)) {
- String values[] = prop.split(",");
- if ((index >= 0) && (index < values.length) && (values[index] != null)) {
- propVal = values[index];
- }
+ if (index != 0) {
+ property += "_" + index;
}
- return propVal == null ? defaultVal : propVal;
+ return SystemProperties.get(property, defaultVal);
}
/**
--
1.8.5.2 (Apple Git-48)
From 9a475bd551c65fffdab0b9823e737e25839774e3 Mon Sep 17 00:00:00 2001
From: Pawit Pornkitprasan <p.pawit@gmail.com>
Date: Sat, 8 Mar 2014 19:47:03 +0700
Subject: [PATCH 2/2] PhoneStatusBar: MSim: use carrier label as subs label
subs label is not hidden correctly, and most of the information
overlaps with the carrier label.
Change-Id: I4be61e4e32c11d9e882f85fcd7dbbe5a461c016e
---
packages/SystemUI/res/layout/status_bar_expanded.xml | 7 -------
.../src/com/android/systemui/statusbar/phone/PhoneStatusBar.java | 5 +----
2 files changed, 1 insertion(+), 11 deletions(-)
diff --git a/packages/SystemUI/res/layout/status_bar_expanded.xml b/packages/SystemUI/res/layout/status_bar_expanded.xml
index 65f9fd2..0d60d53 100644
--- a/packages/SystemUI/res/layout/status_bar_expanded.xml
+++ b/packages/SystemUI/res/layout/status_bar_expanded.xml
@@ -45,13 +45,6 @@
android:animateLayoutChanges="false"
>
<include
- layout="@layout/subs_label"
- android:layout_height="@dimen/carrier_label_height"
- android:layout_width="match_parent"
- android:layout_gravity="bottom"
- />
-
- <include
layout="@layout/carrier_label"
android:layout_height="@dimen/carrier_label_height"
android:layout_width="match_parent"
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 898448f..8d93250 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -807,7 +807,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
mCarrierLabel = (TextView)mStatusBarWindow.findViewById(R.id.carrier_label);
- mSubsLabel = (TextView)mStatusBarWindow.findViewById(R.id.subs_label);
mShowCarrierInPanel = (mCarrierLabel != null);
if (DEBUG) Log.v(TAG, "carrierlabel=" + mCarrierLabel + " show=" +
@@ -818,12 +817,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
// for mobile devices, we always show mobile connection info here (SPN/PLMN)
// for other devices, we show whatever network is connected
if (mMSimNetworkController.hasMobileDataFeature()) {
- mMSimNetworkController.addMobileLabelView(mCarrierLabel);
+ mMSimNetworkController.addSubsLabelView(mCarrierLabel);
} else {
mMSimNetworkController.addCombinedLabelView(mCarrierLabel);
}
- mSubsLabel.setVisibility(View.VISIBLE);
- mMSimNetworkController.addSubsLabelView(mSubsLabel);
// set up the dynamic hide/show of the label
mPile.setOnSizeChangedListener(new OnSizeChangedListener() {
@Override
--
1.8.5.2 (Apple Git-48)
From 32c2ac0573c72427362af731e2d6b94ee2a41650 Mon Sep 17 00:00:00 2001
From: Pawit Pornkitprasan <p.pawit@gmail.com>
Date: Wed, 9 Jul 2014 13:40:27 +0900
Subject: [PATCH] Revert "Add support for SIM availability in Flight Mode."
Not supported on Broadcom RILs
This reverts commit 5418f0f57bc7769acff7a86b756e665f8a895fb3.
Conflicts:
frameworks/src/com/codeaurora/telephony/msim/MSimCDMALTEPhone.java
frameworks/src/com/codeaurora/telephony/msim/MSimGSMPhone.java
Change-Id: I5b920dd42a7838b18418fe55a4ea6c2b6acd56a5
---
.../telephony/msim/CardSubscriptionManager.java | 69 ++++++++++++++++++++--
.../telephony/msim/MSimCDMALTEPhone.java | 1 -
.../codeaurora/telephony/msim/MSimGSMPhone.java | 1 -
.../telephony/msim/MSimUiccController.java | 2 +-
.../telephony/msim/SubscriptionManager.java | 52 +++++++++++++++-
5 files changed, 115 insertions(+), 10 deletions(-)
diff --git a/frameworks/src/com/codeaurora/telephony/msim/CardSubscriptionManager.java b/frameworks/src/com/codeaurora/telephony/msim/CardSubscriptionManager.java
index a9bd10f..4e48880 100644
--- a/frameworks/src/com/codeaurora/telephony/msim/CardSubscriptionManager.java
+++ b/frameworks/src/com/codeaurora/telephony/msim/CardSubscriptionManager.java
@@ -140,11 +140,13 @@ public class CardSubscriptionManager extends Handler {
//***** Events
- private static final int EVENT_RADIO_NOT_AVAILABLE = 1;
+ private static final int EVENT_RADIO_OFF_OR_NOT_AVAILABLE = 0;
+ private static final int EVENT_RADIO_ON = 1;
private static final int EVENT_ICC_CHANGED = 2;
private static final int EVENT_GET_ICCID_DONE = 3;
private static final int EVENT_UPDATE_UICC_STATUS = 4;
private static final int EVENT_SIM_REFRESH = 5;
+ private static final int EVENT_RADIO_NOT_AVAILABLE = 6;
//***** Class Variables
private static CardSubscriptionManager sCardSubscriptionManager;
@@ -153,6 +155,7 @@ public class CardSubscriptionManager extends Handler {
private CommandsInterface[] mCi;
private MSimUiccController mUiccController;
private int mNumPhones = MSimTelephonyManager.getDefault().getPhoneCount();
+ private boolean[] mRadioOn = new boolean[mNumPhones];
private boolean[] mSubActivated = new boolean[mNumPhones];
private int mUpdateUiccStatusContext = 0;
@@ -193,10 +196,13 @@ public class CardSubscriptionManager extends Handler {
for (int i = 0; i < mCi.length; i++) {
// Register for Subscription ready event for both the subscriptions.
Integer slot = new Integer(i);
+ mCi[i].registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, slot);
mCi[i].registerForNotAvailable(this, EVENT_RADIO_NOT_AVAILABLE, slot);
+ mCi[i].registerForOn(this, EVENT_RADIO_ON, slot);
// Register for SIM Refresh events
mCi[i].registerForIccRefresh(this, EVENT_SIM_REFRESH, new Integer(i));
+ mRadioOn[i] = false;
mSubActivated[i] = false;
}
@@ -221,6 +227,16 @@ public class CardSubscriptionManager extends Handler {
@Override
public void handleMessage(Message msg) {
switch(msg.what) {
+ case EVENT_RADIO_OFF_OR_NOT_AVAILABLE:
+ logd("EVENT_RADIO_OFF_OR_NOT_AVAILABLE");
+ processRadioOffOrNotAvailable((AsyncResult)msg.obj);
+ break;
+
+ case EVENT_RADIO_ON:
+ logd("EVENT_RADIO_ON");
+ processRadioOn((AsyncResult)msg.obj);
+ break;
+
case EVENT_RADIO_NOT_AVAILABLE:
logd("EVENT_RADIO_NOT_AVAILABLE");
processRadioNotAvailable((AsyncResult)msg.obj);
@@ -270,12 +286,35 @@ public class CardSubscriptionManager extends Handler {
}
}
+ private void processRadioOffOrNotAvailable(AsyncResult ar) {
+ Integer cardIndex = (Integer)ar.userObj;
+
+ logd("processRadioOffOrNotAvailable on cardIndex = " + cardIndex);
+
+ if (cardIndex >= 0 && cardIndex < mRadioOn.length) {
+ mRadioOn[cardIndex] = false;
+ //If sub is deactivated then reset card info.
+ if (mSubActivated[cardIndex] == false) {
+ resetCardInfo(cardIndex);
+ //CardInfo is not valid. Inform others that card info not available.
+ notifyCardInfoNotAvailable(cardIndex,
+ CardUnavailableReason.REASON_RADIO_UNAVAILABLE);
+ // Reset the flag card info available to false, so that
+ // next time it notifies all cards info available.
+ mAllCardsInfoAvailable = false;
+ }
+ } else {
+ logd("Invalid Index!!!");
+ }
+ }
+
private void processRadioNotAvailable(AsyncResult ar) {
Integer cardIndex = (Integer)ar.userObj;
logd("processRadioNotAvailable on cardIndex = " + cardIndex);
- if (cardIndex >= 0 && cardIndex < mNumPhones) {
+ if (cardIndex >= 0 && cardIndex < mRadioOn.length) {
+ mRadioOn[cardIndex] = false;
//Radio unavailable comes in case of rild crash or Modem SSR.
//reset card info in case of radio Unavailable in order to send SET_UICC later.
resetCardInfo(cardIndex);
@@ -291,6 +330,18 @@ public class CardSubscriptionManager extends Handler {
}
}
+ private void processRadioOn(AsyncResult ar) {
+ Integer cardIndex = (Integer)ar.userObj;
+
+ logd("processRadioOn on cardIndex = " + cardIndex);
+
+ if (cardIndex >= 0 && cardIndex < mRadioOn.length) {
+ mRadioOn[cardIndex] = true;
+ } else {
+ logd("Invalid Index!!!");
+ }
+ }
+
/**
* Process the ICC_CHANGED notification.
*/
@@ -302,6 +353,10 @@ public class CardSubscriptionManager extends Handler {
if ((ar.exception == null) && (ar.result != null)) {
Integer cardIndex = (Integer) ar.result;
+ if (!mRadioOn[cardIndex]) {
+ logd("handleIccChanged: radio not available - EXIT");
+ return;
+ }
UiccCard uiccCard = mUiccController.getUiccCards()[cardIndex];
UiccCard card = mUiccCardList.get(cardIndex).getUiccCard();
@@ -441,6 +496,11 @@ public class CardSubscriptionManager extends Handler {
logd("handleGetIccIdDone: cardIndex = " + cardIndex);
+ if (!mRadioOn[cardIndex]) {
+ logd("handleGetIccIdDone: radio not available - EXIT");
+ return;
+ }
+
String iccId = null;
if (ar.exception != null) {
@@ -577,7 +637,8 @@ public class CardSubscriptionManager extends Handler {
uiccCard = cardInfo.getUiccCard();
}
- if (uiccCard == null) {
+ if (uiccCard == null || mRadioOn[cardIndex] == false) {
+ logd("onUpdateUiccStatus(): mRadioOn[" + cardIndex + "] = " + mRadioOn[cardIndex]);
logd("onUpdateUiccStatus(): NO Card!!!!! at index : " + cardIndex);
if (mCardSubData[cardIndex] != null) {
// Card is removed.
@@ -689,7 +750,7 @@ public class CardSubscriptionManager extends Handler {
// Required to notify only once!!!
// Notify if all card info is available.
- if (isValidCards() && !mAllCardsInfoAvailable) {
+ if (isValidCards() && !mAllCardsInfoAvailable && mRadioOn[cardIndex]) {
mAllCardsInfoAvailable = true;
notifyAllCardsInfoAvailable();
}
diff --git a/frameworks/src/com/codeaurora/telephony/msim/MSimCDMALTEPhone.java b/frameworks/src/com/codeaurora/telephony/msim/MSimCDMALTEPhone.java
index 1e59103..4ef8c59 100644
--- a/frameworks/src/com/codeaurora/telephony/msim/MSimCDMALTEPhone.java
+++ b/frameworks/src/com/codeaurora/telephony/msim/MSimCDMALTEPhone.java
@@ -99,7 +99,6 @@ public class MSimCDMALTEPhone extends CDMALTEPhone {
this, EVENT_SUBSCRIPTION_ACTIVATED, null);
subMgr.registerForSubscriptionDeactivated(mSubscription,
this, EVENT_SUBSCRIPTION_DEACTIVATED, null);
- mSubscriptionData = subMgr.getCurrentSubscription(mSubscription);
}
@Override
diff --git a/frameworks/src/com/codeaurora/telephony/msim/MSimGSMPhone.java b/frameworks/src/com/codeaurora/telephony/msim/MSimGSMPhone.java
index c968593..81c21f3 100644
--- a/frameworks/src/com/codeaurora/telephony/msim/MSimGSMPhone.java
+++ b/frameworks/src/com/codeaurora/telephony/msim/MSimGSMPhone.java
@@ -85,7 +85,6 @@ public class MSimGSMPhone extends GSMPhone {
this, EVENT_SUBSCRIPTION_ACTIVATED, null);
subMgr.registerForSubscriptionDeactivated(mSubscription,
this, EVENT_SUBSCRIPTION_DEACTIVATED, null);
- mSubscriptionData = subMgr.getCurrentSubscription(mSubscription);
setProperties();
}
diff --git a/frameworks/src/com/codeaurora/telephony/msim/MSimUiccController.java b/frameworks/src/com/codeaurora/telephony/msim/MSimUiccController.java
index 8c163ae..fba03fe 100644
--- a/frameworks/src/com/codeaurora/telephony/msim/MSimUiccController.java
+++ b/frameworks/src/com/codeaurora/telephony/msim/MSimUiccController.java
@@ -157,7 +157,7 @@ public class MSimUiccController extends UiccController {
Integer index = new Integer(i);
mCis[i].registerForIccStatusChanged(this, EVENT_ICC_STATUS_CHANGED, index);
// TODO remove this once modem correctly notifies the unsols
- mCis[i].registerForAvailable(this, EVENT_ICC_STATUS_CHANGED, index);
+ mCis[i].registerForOn(this, EVENT_ICC_STATUS_CHANGED, index);
mCis[i].registerForNotAvailable(this, EVENT_RADIO_UNAVAILABLE, index);
}
}
diff --git a/frameworks/src/com/codeaurora/telephony/msim/SubscriptionManager.java b/frameworks/src/com/codeaurora/telephony/msim/SubscriptionManager.java
index 9ccc2a2..0ee18ac 100644
--- a/frameworks/src/com/codeaurora/telephony/msim/SubscriptionManager.java
+++ b/frameworks/src/com/codeaurora/telephony/msim/SubscriptionManager.java
@@ -164,6 +164,7 @@ public class SubscriptionManager extends Handler {
private boolean[] mCardInfoAvailable = new boolean[mNumPhones];
private boolean[] mIsNewCard = new boolean[mNumPhones];
+ private boolean[] mRadioOn = new boolean[mNumPhones];
private HashMap<SubscriptionId, Subscription> mActivatePending;
private HashMap<SubscriptionId, Subscription> mDeactivatePending;
@@ -272,6 +273,7 @@ public class SubscriptionManager extends Handler {
mCardInfoAvailable[i] = false;
mIsNewCard[i] = false;
+ mRadioOn[i] = false;
}
mSubDeactivatedRegistrants = new RegistrantList[mNumPhones];
@@ -323,15 +325,21 @@ public class SubscriptionManager extends Handler {
ar = (AsyncResult)msg.obj;
subId = (Integer)ar.userObj;
logd("EVENT_RADIO_OFF_OR_NOT_AVAILABLE on SUB: " + subId);
- mSetSubscriptionInProgress = false;
- mSetDdsRequired = true;
+ mRadioOn[subId] = false;
+ if (!isAllRadioOn()) {
+ mSetSubscriptionInProgress = false;
+ mSetDdsRequired = true;
+ }
break;
case EVENT_RADIO_ON:
ar = (AsyncResult)msg.obj;
subId = (Integer)ar.userObj;
logd("EVENT_RADIO_ON on SUB: " + subId);
- sendDefaultSubsInfo();
+ mRadioOn[subId] = true;
+ if (isAllRadioOn()) {
+ sendDefaultSubsInfo();
+ }
break;
case EVENT_CARD_INFO_AVAILABLE:
@@ -581,6 +589,11 @@ public class SubscriptionManager extends Handler {
* @param ar
*/
private void processCleanupDataConnectionDone(Integer subId) {
+ if (!mRadioOn[subId]) {
+ logd("processCleanupDataConnectionDone: Radio Not Available on subId = " + subId);
+ return;
+ }
+
// Cleanup data connection is done! Start processing the
// pending deactivate requests now.
mDataActive = false;
@@ -599,6 +612,11 @@ public class SubscriptionManager extends Handler {
logd("processSubscriptionStatusChanged sub = " + subId
+ " actStatus = " + actStatus);
+ if (!mRadioOn[subId]) {
+ logd("processSubscriptionStatusChanged: Radio Not Available on subId = " + subId);
+ return;
+ }
+
if ((isSubReady == true && actStatus == SUB_STATUS_ACTIVATED) ||
(isSubReady == false && actStatus == SUB_STATUS_DEACTIVATED)) {
logd("processSubscriptionStatusChanged: CurrentSubStatus and NewSubStatus are same" +
@@ -662,6 +680,12 @@ public class SubscriptionManager extends Handler {
SubscriptionStatus subStatus = SubscriptionStatus.SUB_INVALID;
Subscription currentSub = null;
+ if (!mRadioOn[setSubParam.subId]) {
+ logd("processSetUiccSubscriptionDone: Radio Not Available on subId = "
+ + setSubParam.subId);
+ return;
+ }
+
if (setSubParam.appType.equals("GLOBAL") &&
(setSubParam.subStatus == SubscriptionStatus.SUB_ACTIVATE)) {
if ((mCardSubMgr.is3gppApp(setSubParam.subId, setSubParam.app3gppId)) &&
@@ -999,6 +1023,11 @@ public class SubscriptionManager extends Handler {
* Handles EVENT_ALL_CARDS_INFO_AVAILABLE.
*/
private void processAllCardsInfoAvailable() {
+ if (!isAllRadioOn()) {
+ logd("processAllCardsInfoAvailable: Radio Not Available ");
+ return;
+ }
+
int availableCards = 0;
mAllCardsStatusAvailable = true;
@@ -1027,6 +1056,10 @@ public class SubscriptionManager extends Handler {
* Handles EVENT_PROCESS_AVAILABLE_CARDS
*/
private void processAvailableCards() {
+ if (!isAllRadioOn()) {
+ logd("processAvailableCards: Radio Not Available ");
+ return;
+ }
if (mSetSubscriptionInProgress) {
logd("processAvailableCards: set subscription in progress!!");
return;
@@ -1143,6 +1176,11 @@ public class SubscriptionManager extends Handler {
private void processCardInfoAvailable(AsyncResult ar) {
Integer cardIndex = (Integer)ar.userObj;
+ if (!mRadioOn[cardIndex]) {
+ logd("processCardInfoAvailable: Radio Not Available on cardIndex = " + cardIndex);
+ return;
+ }
+
mCardInfoAvailable[cardIndex] = true;
logd("processCardInfoAvailable: CARD:" + cardIndex + " is available");
@@ -1195,6 +1233,14 @@ public class SubscriptionManager extends Handler {
mContext.startActivity(setSubscriptionIntent);
}
+ private boolean isAllRadioOn() {
+ boolean result = true;
+ for (boolean radioOn : mRadioOn) {
+ result = result && radioOn;
+ }
+ return result;
+ }
+
private boolean isAllCardsInfoAvailable() {
boolean result = true;
for (boolean available : mCardInfoAvailable) {
--
1.8.5.2 (Apple Git-48)
From 879d04dbd6da85468e7616af9e232184e9284e5d Mon Sep 17 00:00:00 2001
From: Pawit Pornkitprasan <p.pawit@gmail.com>
Date: Wed, 13 Aug 2014 12:58:19 +0700
Subject: [PATCH] telephony: HACK: fix call waiting audio on Dual-SIM
Change-Id: I9978f97cf893512fcce05458d8e5da170aae3fee
---
src/java/com/android/internal/telephony/ExtCallManager.java | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/java/com/android/internal/telephony/ExtCallManager.java b/src/java/com/android/internal/telephony/ExtCallManager.java
index 0a91eb9..646bd04 100644
--- a/src/java/com/android/internal/telephony/ExtCallManager.java
+++ b/src/java/com/android/internal/telephony/ExtCallManager.java
@@ -331,6 +331,18 @@ public class ExtCallManager extends CallManager {
case RINGING:
if (VDBG) Rlog.d(LOG_TAG, "setAudioMode RINGING");
int curAudioMode = mAudioManager.getMode();
+
+ // HACK: When Dual-SIM is enabled and call waiting occurs,
+ // com.android.phone.CallCommandService.setActiveSubscription
+ // will cause setAudioMode to be called, causing the audio
+ // mode to be chagned to "MODE_RINGTONE", rendering the active
+ // conversation to be inaudiable.
+ // (The setAudioMode() call does not occur without Dual-SIM.)
+ if (curAudioMode == AudioManager.MODE_IN_CALL) {
+ Rlog.d(LOG_TAG, "Skip MODE_IN_CALL -> MODE_RINGTONE (assume call waiting)");
+ return;
+ }
+
if (curAudioMode != AudioManager.MODE_RINGTONE) {
// only request audio focus if the ringtone is going to be heard
if (mAudioManager.getStreamVolume(AudioManager.STREAM_RING) > 0) {
--
1.8.5.2 (Apple Git-48)
From 44dee519bd09ed06ecc66b5bd7984c2d9bcf8901 Mon Sep 17 00:00:00 2001
From: Pawit Pornkitprasan <p.pawit@gmail.com>
Date: Sat, 8 Mar 2014 19:34:18 +0700
Subject: [PATCH] Settings: MSim: remove settings not used on I9082
Change-Id: Ic33db5e60db34cf707116082b1f738918b3a395f
---
res/xml/multi_sim_settings.xml | 10 ----------
src/com/android/settings/MultiSimSettings.java | 13 -------------
2 files changed, 23 deletions(-)
diff --git a/res/xml/multi_sim_settings.xml b/res/xml/multi_sim_settings.xml
index 9a7a258..87f1ab9 100644
--- a/res/xml/multi_sim_settings.xml
+++ b/res/xml/multi_sim_settings.xml
@@ -31,16 +31,6 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
- <PreferenceScreen
- android:key="config_sub"
- android:title="@string/sel_sub_title"
- android:summary="@string/sel_sub_summary"
- android:persistent="false">
- <intent android:action="android.intent.action.MAIN"
- android:targetPackage="com.android.phone"
- android:targetClass="com.android.phone.SetSubscription" />
- </PreferenceScreen>
-
<CheckBoxPreference
android:key="tune_away"
android:title="@string/tune_away_title"
diff --git a/src/com/android/settings/MultiSimSettings.java b/src/com/android/settings/MultiSimSettings.java
index 646337c..b620c40 100644
--- a/src/com/android/settings/MultiSimSettings.java
+++ b/src/com/android/settings/MultiSimSettings.java
@@ -100,7 +100,6 @@ public class MultiSimSettings extends PreferenceActivity implements DialogInterf
private ListPreference mVoice;
private ListPreference mData;
private ListPreference mSms;
- private PreferenceScreen mConfigSub;
private CharSequence[] entries; // Used for entries like Subscription1, Subscription2 ...
private CharSequence[] entryValues; // Used for entryValues like 0, 1 ,2 ...
private CharSequence[] summaries; // Used for Summaries like Aubscription1, Subscription2....
@@ -141,8 +140,6 @@ public class MultiSimSettings extends PreferenceActivity implements DialogInterf
mData.setOnPreferenceChangeListener(this);
mSms = (ListPreference) findPreference(KEY_SMS);
mSms.setOnPreferenceChangeListener(this);
- mConfigSub = (PreferenceScreen) findPreference(KEY_CONFIG_SUB);
- mConfigSub.getIntent().putExtra(CONFIG_SUB, true);
mTuneAway = (CheckBoxPreference) findPreference(TUNE_AWAY);
mTuneAway.setOnPreferenceChangeListener(this);
mPrioritySub = (ListPreference) findPreference(PRIORITY_SUB);
@@ -224,14 +221,9 @@ public class MultiSimSettings extends PreferenceActivity implements DialogInterf
Log.d(TAG, "mIccCardCount = " + mIccCardCount);
if (mIccCardCount == 0) {
- mConfigSub.setEnabled(false);
- mConfigSub.setSelectable(false);
displayAlertDialog(getResources().getString(R.string.no_sim_info));
configureMSimMenu(false);
} else if (mIccCardCount == 1) {
- //1 SIM card is present. Config sub must be accessible
- mConfigSub.setEnabled(true);
- mConfigSub.setSelectable(true);
configureMSimMenu(false);
} else if ( (mIccCardCount > 1) && (mIccCardCount <= MAX_SUBSCRIPTIONS) ) {
configureMSimMenu(true);
@@ -605,11 +597,6 @@ public class MultiSimSettings extends PreferenceActivity implements DialogInterf
}
break;
- case EVENT_SUBSCRIPTION_ACTIVATED:
- case EVENT_SUBSCRIPTION_DEACTIVATED:
- updateMultiSimEntriesForVoice();
- updateMultiSimEntriesForSms();
- break;
case EVENT_SET_VOICE_SUBSCRIPTION:
if (!mHasTuneAway) {
--
1.8.5.2 (Apple Git-48)
From 900a5334b79be5e300927788acd721a5c86bfda3 Mon Sep 17 00:00:00 2001
From: Pawit Pornkitprasan <p.pawit@gmail.com>
Date: Sat, 8 Mar 2014 16:21:45 +0700
Subject: [PATCH 1/2] Telephony: MSim: enable preferred mode button for all
phones
HACK to allow changing network mode on multi-SIM
Change-Id: I28ac8d7915b86d4f2b558bb2a4c3872824a98661
---
res/values/cm_arrays.xml | 20 -----------
res/values/strings.xml | 40 ----------------------
.../phone/MSimMobileNetworkSubSettings.java | 27 +++++----------
3 files changed, 8 insertions(+), 79 deletions(-)
diff --git a/res/values/cm_arrays.xml b/res/values/cm_arrays.xml
index fb329f3..7eff8d7 100644
--- a/res/values/cm_arrays.xml
+++ b/res/values/cm_arrays.xml
@@ -16,26 +16,6 @@
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string-array name="preferred_network_mode_choices_cm" translatable="false">
- <item>@string/preferred_network_mode_td_scdma_lte_cdma_evdo_gsm_wcdma</item>
- <item>@string/preferred_network_mode_td_scdma_cdma_evdo_gsm_wcdma</item>
- <item>@string/preferred_network_mode_td_scdma_gsm_wcdma_lte</item>
- <item>@string/preferred_network_mode_td_scdma_wcdma_lte</item>
- <item>@string/preferred_network_mode_td_scdma_gsm_wcdma</item>
- <item>@string/preferred_network_mode_td_scdma_gsm_lte</item>
- <item>@string/preferred_network_mode_td_scdma_gsm</item>
- <item>@string/preferred_network_mode_td_scdma_lte</item>
- <item>@string/preferred_network_mode_td_scdma_wcdma</item>
- <item>@string/preferred_network_mode_td_scdma_only</item>
- <item>@string/preferred_network_mode_lte_wcdma</item>
- <item>@string/preferred_network_mode_lte</item>
- <item>@string/preferred_network_mode_global</item>
- <item>@string/preferred_network_mode_gsm_wcdma_lte</item>
- <item>@string/preferred_network_mode_cdma_lte_evdo</item>
- <item>@string/preferred_network_mode_cdma_evdo_gsm_wcdma</item>
- <item>@string/preferred_network_mode_evdo_only</item>
- <item>@string/preferred_network_mode_cdma_without_evdo</item>
- <item>@string/preferred_network_mode_cdma_evdo_auto</item>
- <item>@string/preferred_network_mode_gsm_wcdma_auto</item>
<item>@string/preferred_network_mode_wcdma_only</item>
<item>@string/preferred_network_mode_gsm_only</item>
<item>@string/preferred_network_mode_gsm_wcdma_preferred</item>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 65ee972..3eb136c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -452,51 +452,11 @@
<string-array name="preferred_network_mode_choices">
- <item>TD-SCDMA/LTE/GSM/WCDMA/CDMA/EVDO </item>
- <item>TD-SCDMA/GSM/WCDMA/CDMA/EVDO </item>
- <item>TD-SCDMA/GSM/WCDMA/LTE</item>
- <item>TD-SCDMA/WCDMA/LTE</item>
- <item>TD-SCDMA/GSM/WCDMA</item>
- <item>TD-SCDMA/GSM/LTE</item>
- <item>TD-SCDMA/GSM</item>
- <item>TD-SCDMA/LTE</item>
- <item>TD-SCDMA/WCDMA</item>
- <item>TD-SCDMA only</item>
- <item>LTE / WCDMA</item>
- <item>LTE</item>
- <item>Global</item>
- <item>GSM/WCDMA/LTE</item>
- <item>CDMA + LTE/EvDo</item>
- <item>CDMA/EvDo/GSM/WCDMA</item>
- <item>EvDo only</item>
- <item>CDMA w/o EvDo</item>
- <item>CDMA/EvDo auto</item>
- <item>GSM/WCDMA auto</item>
<item>WCDMA only</item>
<item>GSM only</item>
<item>GSM/WCDMA preferred</item>
</string-array>
<string-array name="preferred_network_mode_values" translatable="false">
- <item>"22"</item>
- <item>"21"</item>
- <item>"20"</item>
- <item>"19"</item>
- <item>"18"</item>
- <item>"17"</item>
- <item>"16"</item>
- <item>"15"</item>
- <item>"14"</item>
- <item>"13"</item>
- <item>"12"</item>
- <item>"11"</item>
- <item>"10"</item>
- <item>"9"</item>
- <item>"8"</item>
- <item>"7"</item>
- <item>"6"</item>
- <item>"5"</item>
- <item>"4"</item>
- <item>"3"</item>
<item>"2"</item>
<item>"1"</item>
<item>"0"</item>
diff --git a/src/com/android/phone/MSimMobileNetworkSubSettings.java b/src/com/android/phone/MSimMobileNetworkSubSettings.java
index f54153f..21a8030 100644
--- a/src/com/android/phone/MSimMobileNetworkSubSettings.java
+++ b/src/com/android/phone/MSimMobileNetworkSubSettings.java
@@ -211,32 +211,21 @@ public class MSimMobileNetworkSubSettings extends PreferenceActivity
mButtonPreferredNetworkMode = (ListPreference) prefSet.findPreference(
BUTTON_PREFERED_NETWORK_MODE);
- boolean isLteOnCdma = mPhone.getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE;
- if (getResources().getBoolean(R.bool.world_phone) == true) {
- // set the listener for the mButtonPreferredNetworkMode list preference so we can issue
- // change Preferred Network Mode.
- mButtonPreferredNetworkMode.setOnPreferenceChangeListener(this);
+ // set the listener for the mButtonPreferredNetworkMode list preference so we can issue
+ // change Preferred Network Mode.
+ mButtonPreferredNetworkMode.setOnPreferenceChangeListener(this);
- //Get the networkMode from Settings.System and displays it
- int settingsNetworkMode = getPreferredNetworkMode();
- mButtonPreferredNetworkMode.setValue(Integer.toString(settingsNetworkMode));
+ //Get the networkMode from Settings.System and displays it
+ int settingsNetworkMode = getPreferredNetworkMode();
+ mButtonPreferredNetworkMode.setValue(Integer.toString(settingsNetworkMode));
+
+ if (getResources().getBoolean(R.bool.world_phone) == true) {
mCdmaOptions = new CdmaOptions(this, prefSet, mPhone);
mGsmUmtsOptions = new GsmUmtsOptions(this, prefSet, mSubscription);
} else {
- if (!isLteOnCdma) {
- prefSet.removePreference(mButtonPreferredNetworkMode);
- }
int phoneType = mPhone.getPhoneType();
if (phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
mCdmaOptions = new CdmaOptions(this, prefSet, mPhone);
- if (isLteOnCdma) {
- mButtonPreferredNetworkMode.setOnPreferenceChangeListener(this);
-
- int settingsNetworkMode = getPreferredNetworkMode();
- mButtonPreferredNetworkMode.setValue(
- Integer.toString(settingsNetworkMode));
- }
-
} else if (phoneType == PhoneConstants.PHONE_TYPE_GSM) {
mGsmUmtsOptions = new GsmUmtsOptions(this, prefSet, mSubscription);
} else {
--
1.8.5.2 (Apple Git-48)
From 84536d1a66a02f01f8941fb87525b62a055522b4 Mon Sep 17 00:00:00 2001
From: Pawit Pornkitprasan <p.pawit@gmail.com>
Date: Wed, 9 Jul 2014 10:54:05 +0900
Subject: [PATCH 2/2] HACK: fix crash when pressing back on top left of FDN
setting on MSim
Change-Id: Id809495b847792e73104eea3fc015ac2b86699a0
---
src/com/android/phone/CallFeaturesSetting.java | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index 310ca1b..08a7774 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -57,6 +57,7 @@ import android.provider.ContactsContract.CommonDataKinds;
import android.provider.MediaStore;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
+import android.telephony.MSimTelephonyManager;
import android.telephony.PhoneNumberUtils;
import android.text.Spannable;
import android.text.SpannableString;
@@ -2419,10 +2420,15 @@ public class CallFeaturesSetting extends PreferenceActivity
* This is useful for implementing "HomeAsUp" capability for second-level Settings.
*/
public static void goUpToTopLevelSetting(Activity activity) {
- Intent intent = new Intent(activity, CallFeaturesSetting.class);
- intent.setAction(Intent.ACTION_MAIN);
- intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
- activity.startActivity(intent);
+ if (!MSimTelephonyManager.getDefault().isMultiSimEnabled()) {
+ // HACK: This doesn't work on multi-SIM (and we have multiple)
+ // hierachy (MSimCallFeaturesSetting and MSimCallFeatureSubSetting)
+ // so let just allow this to act like "back" button
+ Intent intent = new Intent(activity, CallFeaturesSetting.class);
+ intent.setAction(Intent.ACTION_MAIN);
+ intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ activity.startActivity(intent);
+ }
activity.finish();
}
}
--
1.8.5.2 (Apple Git-48)
@udit217
Copy link
Author

udit217 commented Aug 28, 2014

how to install this code in the rooted android phone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment