diff --git a/alps/vendor/mediatek/proprietary/packages/apps/EngineerMode/src/com/mediatek/engineermode/GPRS.java b/alps/vendor/mediatek/proprietary/packages/apps/EngineerMode/src/com/mediatek/engineermode/GPRS.java
old mode 100644
new mode 100755
index 4e9a35a..bd70696
--- a/alps/vendor/mediatek/proprietary/packages/apps/EngineerMode/src/com/mediatek/engineermode/GPRS.java
+++ b/alps/vendor/mediatek/proprietary/packages/apps/EngineerMode/src/com/mediatek/engineermode/GPRS.java
@@ -48,6 +48,7 @@ import android.os.SystemProperties;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.telephony.TelephonyManager.MultiSimVariants;
+import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
@@ -147,6 +148,7 @@ public class GPRS extends Activity implements OnClickListener {
public static final int ATTACH_MODE_NOT_SPECIFY = -1;
private static final int PDP_CONTEXT_MAX = 15;
+ private TelephonyManager telephonyManager; //add by odl
@Override
public void onDestroy() {
@@ -162,17 +164,17 @@ public class GPRS extends Activity implements OnClickListener {
super.onCreate(savedInstanceState);
setContentView(R.layout.gprs);
- Elog.v(TAG, "onCreate");
+ Log.v(TAG, "onCreate");
MultiSimVariants config = TelephonyManager.getDefault().getMultiSimConfiguration();
mIsDsds = (config == MultiSimVariants.DSDS || config == MultiSimVariants.DSDA);
- Elog.v(TAG, "onCreate config = " + config + " mIsDsds = " + mIsDsds);
+ Log.v(TAG, "onCreate config = " + config + " mIsDsds = " + mIsDsds);
mAlive = true;
mPhone = PhoneFactory.getDefaultPhone();
mContext = mPhone.getContext();
- Elog.v(TAG, "onCreate mPhone:" + mPhone + " mContext =" + mContext);
+ Log.v(TAG, "onCreate mPhone:" + mPhone + " mContext =" + mContext);
// create ArrayAdapter for Spinner
mSpinnerAdapter = new ArrayAdapter
@@ -195,7 +197,13 @@ public class GPRS extends Activity implements OnClickListener {
mBtnSim2.setVisibility(View.GONE);
}
- String imei = TelephonyManager.getDefault().getDeviceId();
+ // String imei = TelephonyManager.getDefault().getDeviceId();
+ //add by odl start
+ telephonyManager=(TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
+ String imei=telephonyManager.getDeviceId(0);
+ //add by odl end
+ // TextUtils.empty
+ Log.v(TAG, "Default IMEI:" + imei);
mEditImeiValue = (EditText) findViewById(R.id.IMEI_VALUE);
mEditImeiValue.setText(imei);
@@ -203,8 +211,12 @@ public class GPRS extends Activity implements OnClickListener {
mBtnImei.setOnClickListener(this);
// remove IMEI item
- mEditImeiValue.setEnabled(false);
- mBtnImei.setVisibility(View.INVISIBLE);
+ // mEditImeiValue.setEnabled(false);
+ // mBtnImei.setVisibility(View.INVISIBLE);
+ //add by odl start
+ mEditImeiValue.setEnabled(true);
+ mBtnImei.setVisibility(View.VISIBLE);
+ //add by odl end
mBtnAttached = (Button) findViewById(R.id.Attached);
mBtnDetached = (Button) findViewById(R.id.Detached);
@@ -320,7 +332,7 @@ public class GPRS extends Activity implements OnClickListener {
mGprstAttachSelect.check(R.id.GprsWhenNeeded);
}
- showDefaultSim();
+ // showDefaultSim(); //del by odl
AlertDialog.Builder builder = new AlertDialog.Builder(GPRS.this);
mAlertDialog = builder.create();
@@ -359,22 +371,25 @@ public class GPRS extends Activity implements OnClickListener {
}
}
+ private int mSimId = PhoneConstants.SIM_ID_1; //add by odl
@Override
public void onClick(View arg0) {
- Elog.v(TAG, "onClick:" + arg0.getId());
- Elog.v(TAG, "onClick: mPhone = " + mPhone + " mContext = " + mContext);
+ Log.v(TAG, "onClick:" + arg0.getId());
+ Log.v(TAG, "onClick: mPhone = " + mPhone + " mContext = " + mContext);
if (arg0.getId() == mBtnImei.getId()) {
String imeiString[] = { "AT+EGMR=1,", "" };
if (mIsDsds) {
- int simId = getDefaultDataPhoneId();
- if (simId == PhoneConstants.SIM_ID_1) {
+ //modify by odl begin
+ // int simId = getDefaultDataPhoneId();
+ if (mSimId == PhoneConstants.SIM_ID_1) {
imeiString[0] = "AT+EGMR=1,7,\"" + mEditImeiValue.getText()
+ "\"";
- } else if (simId == PhoneConstants.SIM_ID_2) {
+ } else if (mSimId == PhoneConstants.SIM_ID_2) {
imeiString[0] = "AT+EGMR=1,10,\""
+ mEditImeiValue.getText() + "\"";
}
+ //modify by odl end
} else {
imeiString[0] = "AT+EGMR=1,7,\"" + mEditImeiValue.getText()
+ "\"";
@@ -390,23 +405,33 @@ public class GPRS extends Activity implements OnClickListener {
PhoneConstants.SIM_ID_1)[0]);
SubscriptionManager.from(mContext).setDefaultDataSubId(SubscriptionManager
.getSubId(PhoneConstants.SIM_ID_1)[0]);
+ //modify by odl begin
+ mPhone = PhoneFactory.getPhone(PhoneConstants.SIM_ID_1);
+ mSimId = PhoneConstants.SIM_ID_1;
+ }else{
+ mPhone = PhoneFactory.getPhone(getDefaultDataPhoneId());
}
- mPhone = PhoneFactory.getPhone(getDefaultDataPhoneId());
- Elog.v(TAG, "onClick:SIM 1");
- showDefaultSim();
+ // mPhone = PhoneFactory.getPhone(getDefaultDataPhoneId());
+ Log.v(TAG, "onClick:SIM 1");
+ // showDefaultSim();
+ //modify by odl end
String imei = mPhone.getDeviceId();
mEditImeiValue.setText(imei);
}
if (arg0 == mBtnSim2) {
- Elog.v(TAG, "onClick:Phone2 subId = " + SubscriptionManager.getSubId(
+ Log.v(TAG, "onClick:Phone2 subId = " + SubscriptionManager.getSubId(
PhoneConstants.SIM_ID_2)[0]);
SubscriptionManager.from(mContext).setDefaultDataSubId(SubscriptionManager
.getSubId(PhoneConstants.SIM_ID_2)[0]);
- mPhone = PhoneFactory.getPhone(getDefaultDataPhoneId());
- Elog.v(TAG, "onClick:SIM 2");
- showDefaultSim();
+ //modify by odl begin
+ // mPhone = PhoneFactory.getPhone(getDefaultDataPhoneId());
+ mPhone = PhoneFactory.getPhone(PhoneConstants.SIM_ID_2);
+ mSimId = PhoneConstants.SIM_ID_2;
+ Log.v(TAG, "onClick:SIM 2");
+ // showDefaultSim();
+ //modify by odl end
String imei = mPhone.getDeviceId();
mEditImeiValue.setText(imei);
}
@@ -427,7 +452,7 @@ public class GPRS extends Activity implements OnClickListener {
SharedPreferences.Editor editor = preference.edit();
if (arg0 == mBtnAttachedContinue) {
- Elog.v(TAG, "onClick:mBtnAttachedContinue");
+ Log.v(TAG, "onClick:mBtnAttachedContinue");
SystemProperties.set("persist.vendor.radio.gprs.attach.type", "1");
String cmdStr[] = { "AT+EGTYPE=1,1", "" };
((MtkGsmCdmaPhone)mPhone).invokeOemRilRequestStrings(cmdStr, mResponseHander
@@ -435,7 +460,7 @@ public class GPRS extends Activity implements OnClickListener {
editor.putInt(PREF_ATTACH_MODE, ATTACH_MODE_ALWAYS);
} else if (arg0 == mBtnDetachedContinue) {
- Elog.v(TAG, "onClick:mBtnDetachedContinue");
+ Log.v(TAG, "onClick:mBtnDetachedContinue");
SystemProperties.set("persist.vendor.radio.gprs.attach.type", "0");
String cmdStr[] = { "AT+EGTYPE=0,1", "" };
((MtkGsmCdmaPhone)mPhone).invokeOemRilRequestStrings(cmdStr, mResponseHander