MTKプラットフォームは手動でIMEI号を修正し、工場出荷時の設置を回復した後、最新の修正したIMEI号を保留することができず、保留することを要求した.
27826 ワード
3大部分
1.NVramにIMEIを記録する2つのデータを設定します.1つは手動で書いた816831で、1つは前回ツールで書いた866851を記録します.また、NVramには64-72と74-82という位置を占めているツールがあります.後で、この3つのデータを読み込んでIMEIを比較します.
2.3646633のGPRSにIMEIと書いたところに手動で書いた816831のIMEI番号を格納します.
3.設定内で放送を受信することは、起動放送であってもよく、IMEIを処理することができる.
問題を残して手書きIMEI号を書いた後、2分後に*06#で調べることができます--回避方法、直接816831の号を調べます
5.1システムコード上で処理する
1.\alps\frameworks\base\core\java\android\os\NvRAMPROINFOUtils.java
2.alps\packages\apps\Settings\src\com\android\settings\MyReceiver.java
3.\alps\vendor\mediatek\proprietary\packages\apps\EngineerMode\src\com\mediatek\engineermode\GPRS.java
1.NVramにIMEIを記録する2つのデータを設定します.1つは手動で書いた816831で、1つは前回ツールで書いた866851を記録します.また、NVramには64-72と74-82という位置を占めているツールがあります.後で、この3つのデータを読み込んでIMEIを比較します.
2.3646633のGPRSにIMEIと書いたところに手動で書いた816831のIMEI番号を格納します.
3.設定内で放送を受信することは、起動放送であってもよく、IMEIを処理することができる.
問題を残して手書きIMEI号を書いた後、2分後に*06#で調べることができます--回避方法、直接816831の号を調べます
5.1システムコード上で処理する
1.\alps\frameworks\base\core\java\android\os\NvRAMPROINFOUtils.java
package android.os;
/** pro_info cyrus start */
public final class NvRAMPROINFOUtils {
public static final String TAG = "NvRAMPROINFOUtils";
/**
* key: 104-->1024
*/
public static final int key_logo = 104;
public static final int key_storagetype = 105;
public static final int key_bluetooth = 106;
public static final int key_wifi = 107;
public static final int key_ramtype = 108;
public static final int key_wifissid = 109;
//add by wst start
public static final int key_fontcamera_value = 668;
public static final int key_backcamera_value = 669;
//add by wst end
public static final int key_fingerprint_keyguard = 808;
public static final int ADDRESS_OFFSET = 0;
public static final int ADDRESS_IMEI = 65;
public static final int ADDRESS_IMEI_2 = 81;
public static final int key_save_imei1_1 = 816;
public static final int key_save_imei1_2 = 817;
public static final int key_save_imei1_3 = 818;
public static final int key_save_imei1_4 = 819;
public static final int key_save_imei1_5 = 820;
public static final int key_save_imei1_6 = 821;
public static final int key_save_imei1_7 = 822;
public static final int key_save_imei1_8 = 823;
public static final int key_save_imei1_9 = 824;
public static final int key_save_imei1_10 = 825;
public static final int key_save_imei1_11 = 826;
public static final int key_save_imei1_12 = 827;
public static final int key_save_imei1_13= 828;
public static final int key_save_imei1_14 = 829;
public static final int key_save_imei1_15 = 830;
public static final int key_save_imei2_1 = 831;
public static final int key_save_imei2_2 = 832;
public static final int key_save_imei2_3 = 833;
public static final int key_save_imei2_4 = 834;
public static final int key_save_imei2_5 = 835;
public static final int key_save_imei2_6 = 836;
public static final int key_save_imei2_7 = 837;
public static final int key_save_imei2_8 = 838;
public static final int key_save_imei2_9 = 839;
public static final int key_save_imei2_10 = 840;
public static final int key_save_imei2_11 = 841;
public static final int key_save_imei2_12 = 842;
public static final int key_save_imei2_13= 843;
public static final int key_save_imei2_14 = 844;
public static final int key_save_imei2_15 = 845;
public static final int imie_flag = 847;
public static final int key_imei1_1 = 866;
public static final int key_imei1_2 = 867;
public static final int key_imei1_3 = 868;
public static final int key_imei1_4 = 869;
public static final int key_imei1_5 = 870;
public static final int key_imei1_6 = 871;
public static final int key_imei1_7 = 872;
public static final int key_imei1_8 = 873;
public static final int key_imei1_9 = 874;
public static final int key_imei1_10 = 875;
public static final int key_imei1_11 = 876;
public static final int key_imei1_12 = 877;
public static final int key_imei1_13= 878;
public static final int key_imei1_14 = 879;
public static final int key_imei1_15 = 880;
public static final int key_imei2_1 = 881;
public static final int key_imei2_2 = 882;
public static final int key_imei2_3 = 883;
public static final int key_imei2_4 = 884;
public static final int key_imei2_5 = 885;
public static final int key_imei2_6 = 886;
public static final int key_imei2_7 = 887;
public static final int key_imei2_8 = 888;
public static final int key_imei2_9 = 889;
public static final int key_imei2_10 = 890;
public static final int key_imei2_11 = 891;
public static final int key_imei2_12 = 892;
public static final int key_imei2_13= 893;
public static final int key_imei2_14 = 894;
public static final int key_imei2_15 = 895;
public static final int key_imei1_front = 896;
public static final int key_imei1_back = 897;
public static final int key_imei2_front = 898;
public static final int key_imei2_back = 899 ;
//add by yanzhiwei start for sale message support
/*KST_SYSTEM_SALE_MESSEGE_SUPPORT
public static final int key_sale = 918;
public static final int key_sms_dialog_show = 1010;
KST_SYSTEM_SALE_MESSEGE_SUPPORT*/
//add by yanzhiwei end for sale message support
public static final int read(int key){
int result = 0;
try{
result = android.os.NvRAMAgent.Stub.asInterface (android.os.ServiceManager.getService("NvRAMAgent")).readFileByName("/data/nvram/APCFG/APRDEB/PRODUCT_INFO")[key];
}catch(Exception e){
android.util.Log.i(TAG, "logstart:
" + e.getMessage());
}
return result;
}
public static final boolean write(int key, int value){
int result = 0;
if(key == key_logo){
if(!android.os.KSTHandleCharsCheck.handleChars()){
return false;
}
}
try{
android.os.NvRAMAgent agent = android.os.NvRAMAgent.Stub.asInterface (android.os.ServiceManager.getService("NvRAMAgent"));
byte[] buff = agent.readFileByName("/data/nvram/APCFG/APRDEB/PRODUCT_INFO");
buff[key] = (byte) value;
result = agent.writeFileByName("/data/nvram/APCFG/APRDEB/PRODUCT_INFO",buff);
}catch(Exception e){
android.util.Log.i(TAG, "logstart:
" + e.getMessage());
}
return result == 1;
}
}
2.alps\packages\apps\Settings\src\com\android\settings\MyReceiver.java
public class MyReceiver extends BroadcastReceiver {
private static final int EVENT_WRITE_IMEI = 7;
private static final int EVENT_WRITE_IMEI2 = 8;
public int key_imei1_1 = android.os.NvRAMPROINFOUtils.key_imei1_1;
public int key_save_imei1_1 = android.os.NvRAMPROINFOUtils.key_save_imei1_1;
public int key_imei2_1 = android.os.NvRAMPROINFOUtils.key_imei2_1;
public int key_save_imei2_1 = android.os.NvRAMPROINFOUtils.key_save_imei2_1;
public int ADDRESS_IMEI = android.os.NvRAMPROINFOUtils.ADDRESS_IMEI;
public int ADDRESS_IMEI_2 = android.os.NvRAMPROINFOUtils.ADDRESS_IMEI_2;
private Phone mPhone = null;
private final boolean KST_SYSTEM_SMARTWAKE_DEFAULT_ON = false;
@Override
public void onReceive(Context context, Intent intent) {
if(intent.getAction().equals("wzsd.intent.action.WRITE_IMIE") ){
setImei(context) ;
android.util.Log.e("odlimie","- getAction = " + intent.getAction() );
}
}
private void setImei(Context context) {
android.util.Log.e("odlimie"," MyReceiver setImei() ----" );
Phone mPhone2 = PhoneFactory.getPhone(PhoneConstants.SIM_ID_2);
String nv_imei = readIMEIBySIM(true) ; //phone imei 1
String nv_imei2 = readIMEIBySIM(false) ; //phone imei 2
String imei = TelephonyManager.getDefault().getDeviceId(); //get imei 1
String imei2 = mPhone2.getDeviceId(); //get imei 2
String tool_imei = readToolIMEIBySIM(true) ; //tool imei
String tool_imei2 = readToolIMEIBySIM(false) ;//tool imei 2
String save_imie1=readSaveIMEIBySIM(true);//tool last imei 1
String save_imie2=readSaveIMEIBySIM(false);//tool last imei 2
String imeiString[] = { "AT+EGMR=1,", "" };
android.util.Log.e("odlimie"," MyReceiver nv_imei == " + nv_imei );
android.util.Log.e("odlimie"," MyReceiver nv_imei2 == " + nv_imei2 );
android.util.Log.e("odlimie"," MyReceiver imei == " + imei );
android.util.Log.e("odlimie"," MyReceiver imei22 == " + imei2);
android.util.Log.e("odlimie"," MyReceiver save_imie1 == " + save_imie1 );
android.util.Log.e("odlimie"," MyReceiver save_imie2 == " + save_imie2 );
android.util.Log.e("odlimie"," MyReceiver tool_imei == " + tool_imei );
android.util.Log.e("odlimie"," MyReceiver tool_imei2 == " + tool_imei2 );
// int flag = android.os.NvRAMPROINFOUtils.read(847);
// android.util.Log.e("odlimie","if flag = " + flag );
if(!TextUtils.isEmpty(nv_imei)){
android.util.Log.e("qxp"," MyReceiver 000 158 write imei1 ---" );
if("0000000000000000".equals(tool_imei) &&"0000000000000000".equals(tool_imei2) ) {
if(!TextUtils.isEmpty(nv_imei)){
imeiString[0] = "AT+EGMR=1,7,\"" + nv_imei+ "\"";
mPhone = PhoneFactory.getPhone(PhoneConstants.SIM_ID_1) ;
mPhone.invokeOemRilRequestStrings(imeiString, mResponseHander.obtainMessage(EVENT_WRITE_IMEI));
android.util.Log.e("qxp"," MyReceiver 000 write imei1 ---" );
SubscriptionManager.from(context).setDefaultDataSubId(SubscriptionManager.getSubId(PhoneConstants.SIM_ID_1)[0]);
//modify by tangxiaoyong begin
Phone mPhone1 = PhoneFactory.getPhone(PhoneConstants.SIM_ID_1);
String imei1 = mPhone1.getDeviceId();
android.util.Log.e("qxp"," MyReceiver get imei1 ---"+imei1 );
}
if(!TextUtils.isEmpty(nv_imei2)){
imeiString[0] = "AT+EGMR=1,10,\"" + nv_imei2 + "\"";
mPhone = PhoneFactory.getPhone(PhoneConstants.SIM_ID_2) ;
android.util.Log.e("qxp"," MyReceiver000 mPhone =" + mPhone );
mPhone.invokeOemRilRequestStrings(imeiString, mResponseHander.obtainMessage(EVENT_WRITE_IMEI2));
android.util.Log.e("qxp"," MyReceiver00 write imei2 ---" );
SubscriptionManager.from(context).setDefaultDataSubId(SubscriptionManager.getSubId(PhoneConstants.SIM_ID_2)[0]);
//modify by tangxiaoyong begin
imei2 = mPhone2.getDeviceId();
android.util.Log.e("qxp"," MyReceiver00 get imei2 ---"+imei2 );
}
}
}
if( !(save_imie1.equals(tool_imei)) && !(save_imie2.equals(tool_imei2))){
saveIMEIByphone(tool_imei2,false);
saveIMEIByphone(tool_imei,true);
saveIMEIByhand(tool_imei,true);
saveIMEIByhand(tool_imei2,false);
}else{
imeiString[0] = "AT+EGMR=1,7,\"" + nv_imei+ "\"";
mPhone = PhoneFactory.getPhone(PhoneConstants.SIM_ID_1);
mPhone.invokeOemRilRequestStrings(imeiString, mResponseHander.obtainMessage(EVENT_WRITE_IMEI));
android.util.Log.e("odlimie"," MyReceiver write imei1 ---" );
SubscriptionManager.from(context).setDefaultDataSubId(SubscriptionManager.getSubId(PhoneConstants.SIM_ID_1)[0]);
Phone mPhone1 = PhoneFactory.getPhone(PhoneConstants.SIM_ID_1);
String imei1 = mPhone1.getDeviceId();
android.util.Log.e("odlimie"," MyReceiver get imei1 ---"+imei1 );
imeiString[0] = "AT+EGMR=1,10,\""+ nv_imei2 + "\"";
mPhone = PhoneFactory.getPhone(PhoneConstants.SIM_ID_2);
mPhone.invokeOemRilRequestStrings(imeiString, mResponseHander.obtainMessage(EVENT_WRITE_IMEI2));
android.util.Log.e("odlimie"," MyReceiver write imei2 ---" );
SubscriptionManager.from(context).setDefaultDataSubId(SubscriptionManager.getSubId(PhoneConstants.SIM_ID_2)[0]);
imei2 = mPhone2.getDeviceId();
android.util.Log.e("odlimie"," MyReceiver get imei2 ---"+imei2 );
//android.os.NvRAMPROINFOUtils.write(847,1);
// android.util.Log.e("odlimie","else flag = " + flag );
android.util.Log.e("odlimie"," MyReceiver 171 saveimi1 not equals imei1 ---"+imei );
}
if(!TextUtils.isEmpty(nv_imei)){
if(nv_imei.equals(imei)){
android.util.Log.e("odlimie"," MyReceiver write nv_imei == imei" );
}else {
if(TextUtils.isEmpty(imei)){
android.util.Log.e("odlimie"," MyReceiver write by hand reset factory" );
//String imeiString[] = { "AT+EGMR=1,", "" };
if(!TextUtils.isEmpty(nv_imei)){
imeiString[0] = "AT+EGMR=1,7,\"" + nv_imei+ "\"";
mPhone = PhoneFactory.getPhone(PhoneConstants.SIM_ID_1) ;
mPhone.invokeOemRilRequestStrings(imeiString, mResponseHander.obtainMessage(EVENT_WRITE_IMEI));
android.util.Log.e("odlimie"," MyReceiver write imei1 ---" );
SubscriptionManager.from(context).setDefaultDataSubId(SubscriptionManager.getSubId(PhoneConstants.SIM_ID_1)[0]);
//modify by tangxiaoyong begin
Phone mPhone1 = PhoneFactory.getPhone(PhoneConstants.SIM_ID_1);
String imei1 = mPhone1.getDeviceId();
android.util.Log.e("odlimie"," MyReceiver get imei1 ---"+imei1 );
}
if(!TextUtils.isEmpty(nv_imei2)){
imeiString[0] = "AT+EGMR=1,10,\"" + nv_imei2 + "\"";
mPhone = PhoneFactory.getPhone(PhoneConstants.SIM_ID_2) ;
android.util.Log.e("odlimie"," MyReceiver mPhone =" + mPhone );
mPhone.invokeOemRilRequestStrings(imeiString, mResponseHander.obtainMessage(EVENT_WRITE_IMEI2));
android.util.Log.e("odlimie"," MyReceiver write imei2 ---" );
SubscriptionManager.from(context).setDefaultDataSubId(SubscriptionManager.getSubId(PhoneConstants.SIM_ID_2)[0]);
//modify by tangxiaoyong begin
imei2 = mPhone2.getDeviceId();
android.util.Log.e("odlimie"," MyReceiver get imei2 ---"+imei2 );
}
}
}
}
}
private String readIMEIBySIM(boolean isSIM1) {
android.util.Log.e("odlimie","readIMEIBySIM isSIM1 = " + isSIM1 );
String result = "" ;
if(isSIM1){
StringBuffer sb = new StringBuffer() ;
key_imei1_1 = 866 ;
for(int i = 0 ; i < 15 ; i++){
int a = android.os.NvRAMPROINFOUtils.read(key_imei1_1);
sb.append(a) ;
key_imei1_1 += 1 ;
}
result = sb.toString() ;
}else {
StringBuffer sb = new StringBuffer() ;
key_imei2_1 = 881 ;
for(int i = 0 ; i < 15 ; i++){
int a = android.os.NvRAMPROINFOUtils.read(key_imei2_1);
sb.append(a) ;
key_imei2_1 += 1 ;
}
result = sb.toString() ;
}
// android.util.Log.e("odlimie","readIMEIBySIM result = " + result );
if(result.equals("000000000000000")){
result = "" ;
}
return result ;
}
private String readToolIMEIBySIM(boolean isSIM1) {
android.util.Log.e("odlimie","readToolIMEIBySIM --- isSIM1 = " + isSIM1 );
String result = "" ;
if(isSIM1){
StringBuffer sb = new StringBuffer() ;
key_save_imei1_1 = 64 ;
for(int i = 0 ; i < 8 ; i++){
int a = android.os.NvRAMPROINFOUtils.read(key_save_imei1_1);
// String h = Integer.toHexString(a); // 68
// String h = IntToHex(a); // 68
String h = Integer.toHexString((a & 0x000000FF) | 0xFFFFFF00).substring(6);
android.util.Log.e("odlimie","readToolIMEIBySIM3 h = " + h );
String b=h.substring(0,1);
String c=h.substring(1,h.length());
if(!("f".equals(c))){
sb.append(c);
}
if(!("f".equals(b))){
sb.append(b);
}
key_save_imei1_1 += 1 ;
}
result = sb.toString() ;
android.util.Log.e("odlimie","readToolIMEIBySIM result = " + result );
}else {
StringBuffer sb = new StringBuffer() ;
key_save_imei2_1 = 74 ;
for(int i = 0 ; i < 8 ; i++){
int a = android.os.NvRAMPROINFOUtils.read(key_save_imei2_1);
// String h = Integer.toHexString(a); // 68
String h = Integer.toHexString((a & 0x000000FF) | 0xFFFFFF00).substring(6);
// String h = IntToHex(a); // 68
String b=h.substring(0,1);
String c=h.substring(1,h.length());
android.util.Log.e("odlimie","readToolIMEIBySIM b = " + b );
android.util.Log.e("odlimie","readToolIMEIBySIM c = " + c );
if(!("f".equals(c))){
sb.append(c);
}
if(!("f".equals(b))){
sb.append(b);
}
key_save_imei2_1 += 1 ;
}
result = sb.toString() ;
android.util.Log.e("odlimie","readToolIMEIBySIM4 result = " + result );
}
return result ;
}
private String readSaveIMEIBySIM(boolean isSIM1) {
// android.util.Log.e("odlimie","readIMEIBySIM isSIM1 = " + isSIM1 );
String result = "" ;
if(isSIM1){
StringBuffer sb = new StringBuffer() ;
key_save_imei1_1 = 816 ;
for(int i = 0 ; i < 15 ; i++){
int a = android.os.NvRAMPROINFOUtils.read(key_save_imei1_1);
sb.append(a) ;
key_save_imei1_1 += 1 ;
}
result = sb.toString() ;
}else {
StringBuffer sb = new StringBuffer() ;
key_save_imei2_1 = 831 ;
for(int i = 0 ; i < 15 ; i++){
int a = android.os.NvRAMPROINFOUtils.read(key_save_imei2_1);
sb.append(a) ;
key_save_imei2_1 += 1 ;
}
result = sb.toString() ;
}
// android.util.Log.e("odlimie","readIMEIBySIM result = " + result );
if(result.equals("000000000000000")){
result = "" ;
}
return result ;
}
private void saveIMEIByphone(String sss,boolean isSIM1) {
android.util.Log.e("odlimie","saveIMEIByphone sss = " + sss + ", isSIM1 = " + isSIM1 );
if (!TextUtils.isEmpty(sss) && sss.length() == 15 ) {
String [] ch = sss.split("") ;
if(isSIM1){
key_save_imei1_1 = 816 ;
for(int i = 1 ; i <= 15 ; i++){
int a = Integer.valueOf(ch[i]) ;
// android.util.Log.e("odlimie","saveIMEIByphone = " + a );
android.os.NvRAMPROINFOUtils.write(key_save_imei1_1, a);
key_save_imei1_1 += 1 ;
}
// android.util.Log.e("odlimie","saveIMEIByphone = " + readSaveIMEIBySIM(true) + ", isSIM1 = " + isSIM1 );
}else {
key_save_imei2_1 = 831 ;
for(int i = 1 ; i <= 15 ; i++){
int a = Integer.valueOf(ch[i]) ;
// android.util.Log.e("odlimie","saveIMEIByphone = " + a );
android.os.NvRAMPROINFOUtils.write(key_save_imei2_1, a);
key_save_imei2_1 += 1 ;
}
// android.util.Log.e("odlimie","saveIMEIByphone2 = " + readSaveIMEIBySIM(false) + ", isSIM2 = " + isSIM1 );
}
}
}
private void saveIMEIByhand(String sss,boolean isSIM1) {
android.util.Log.e("odlimie","saveIMEIByhand sss = " + sss + ", isSIM1 = " + isSIM1 );
if (!TextUtils.isEmpty(sss) && sss.length() == 15 ) {
String [] ch = sss.split("") ;
if(isSIM1){
key_imei1_1 = 866 ;
for(int i = 1 ; i <= 15 ; i++){
int a = Integer.valueOf(ch[i]) ;
// android.util.Log.e("odlimie","saveIMEIByhand = " + a );
android.os.NvRAMPROINFOUtils.write(key_imei1_1, a);
key_imei1_1 += 1 ;
}
// android.util.Log.e("odlimie","saveIMEIByhand readIMEIBySIM = " + readIMEIBySIM(true) + ", isSIM1 = " + isSIM1 );
}else {
key_imei2_1 = 881 ;
for(int i = 1 ; i <= 15 ; i++){
int a = Integer.valueOf(ch[i]) ;
// android.util.Log.e("odlimie","saveIMEIByhand = " + a );
android.os.NvRAMPROINFOUtils.write(key_imei2_1, a);
key_imei2_1 += 1 ;
}
// android.util.Log.e("odlimie","saveIMEIByhand readIMEIBySIM = " + readIMEIBySIM(false) + ", isSIM1 = " + isSIM1 );
}
}
}
private Handler mResponseHander = new Handler() {
@Override
public void handleMessage(Message msg) {
AsyncResult ar;
switch (msg.what) {
case EVENT_WRITE_IMEI:
ar = (AsyncResult) msg.obj;
if (ar.exception == null) {
android.util.Log.e("odlimie","The IMEI is writen successfully.");
} else {
android.util.Log.e("odlimie","Fail to write IMEI due to radio unavailable or something else.");
}
break;
case EVENT_WRITE_IMEI2:
ar = (AsyncResult) msg.obj;
if (ar.exception == null) {
android.util.Log.e("odlimie","The IMEI2 is writen successfully.");
} else {
android.util.Log.e("odlimie","Fail to write IMEI2 due to radio unavailable or something else.");
}
break;
}
}
};
3.\alps\vendor\mediatek\proprietary\packages\apps\EngineerMode\src\com\mediatek\engineermode\GPRS.java
private String readIMEIBySIM(boolean isSIM1) {
String result = "" ;
if(isSIM1){
StringBuffer sb = new StringBuffer() ;
key_imei1_1 = 866 ;
for(int i = 0 ; i < 15 ; i++){
int a = android.os.NvRAMPROINFOUtils.read(key_imei1_1);
sb.append(a) ;
key_imei1_1 += 1 ;
}
result = sb.toString() ;
}else {
StringBuffer sb = new StringBuffer() ;
key_imei2_1 = 881 ;
for(int i = 0 ; i < 15 ; i++){
int a = android.os.NvRAMPROINFOUtils.read(key_imei2_1);
sb.append(a) ;
key_imei2_1 += 1 ;
}
result = sb.toString() ;
}
android.util.Log.e("111","readIMEIBySIM 0-- ---result = " + result + ", isSIM1 = " + isSIM1 );
return result ;
}
private void saveIMEIByhand(String sss,boolean isSIM1) {
android.util.Log.e("11","saveIMEIByhand2 sss = " + sss + ", isSIM1 = " + isSIM1 );
if (!TextUtils.isEmpty(sss) && sss.length() == 15) {
String [] ch = sss.split("") ;
if(isSIM1){
key_imei1_1 = 866 ;
for(int i = 1 ; i <= 15 ; i++){
int a = Integer.valueOf(ch[i]) ;
android.util.Log.e("111","saveIMEIByhand3 = " + a );
android.os.NvRAMPROINFOUtils.write(key_imei1_1, a);
key_imei1_1 += 1 ;
}
android.util.Log.e("qxp","---saveIMEIByhand4 sss readIMEIBySIM = " + readIMEIBySIM(true) + ", isSIM1 = " + isSIM1 );
}else {
key_imei2_1 = 881 ;
for(int i = 1 ; i <= 15 ; i++){
int a = Integer.valueOf(ch[i]) ;
android.util.Log.e("111","saveIMEIByhand = " + a );
android.os.NvRAMPROINFOUtils.write(key_imei2_1, a);
key_imei2_1 += 1 ;
}
android.util.Log.e("111","---saveIMEIByhand5 sss readIMEIBySIM = " + readIMEIBySIM(false) + ", isSIM1 = " + isSIM1 );
}
}
}
String editimei1 ;
String editimei2;
private int mSimId = PhoneConstants.SIM_ID_1; //add by
@Override
public void onClick(View arg0) {
Log.v(LOG_TAG, "onClick:" + arg0.getId());
Log.v(LOG_TAG, "onClick: mPhone = " + mPhone + " mContext = " + mContext);
if (arg0.getId() == mBtnImei.getId()) {
String imeiString[] = { "AT+EGMR=1,", "" };
if (MTK_GEMINI_SUPPORT) {
//modify by tangxiaoyong begin
//int simId = getDefaultDataPhoneId();
if (mSimId == PhoneConstants.SIM_ID_1) {
imeiString[0] = "AT+EGMR=1,7,\"" + mEditImeiValue.getText()
+ "\"";
saveIMEIByhand(mEditImeiValue.getText().toString(),true) ;
SubscriptionManager.from(mContext).setDefaultDataSubId(SubscriptionManager
.getSubId(PhoneConstants.SIM_ID_1)[0]);
//modify by begin
Phone mPhone1 = PhoneFactory.getPhone(PhoneConstants.SIM_ID_1);
String imei1 = mPhone1.getDeviceId();
android.util.Log.e("111"," MyReceiver ggg 111 get imei1 ---"+imei1 );
//modify by end
} else if (mSimId == PhoneConstants.SIM_ID_2) {
imeiString[0] = "AT+EGMR=1,10,\""
+ mEditImeiValue.getText() + "\"";
saveIMEIByhand(mEditImeiValue.getText().toString(),false) ;
SubscriptionManager.from(mContext).setDefaultDataSubId(SubscriptionManager
.getSubId(PhoneConstants.SIM_ID_1)[0]);
//modify by begin
Phone mPhone2 = PhoneFactory.getPhone(PhoneConstants.SIM_ID_2);
String imei2 = mPhone2.getDeviceId();
android.util.Log.e("111"," MyReceiver ggggg get imei2 ---"+imei2 );
//modify by tangxiaoyong end
}
android.os.NvRAMPROINFOUtils.write(847,0);
} else {
imeiString[0] = "AT+EGMR=1,7,\"" + mEditImeiValue.getText()
+ "\"";
}
Log.v(LOG_TAG, "IMEI String:" + imeiString[0]);
mPhone.invokeOemRilRequestStrings(imeiString, mResponseHander
.obtainMessage(EVENT_WRITE_IMEI));
}
if (arg0.getId() == mBtnSim1.getId()) {
if (MTK_GEMINI_SUPPORT) {
Log.v(LOG_TAG, "mContext = " + mContext);
SubscriptionManager.from(mContext).setDefaultDataSubId(SubscriptionManager
.getSubId(PhoneConstants.SIM_ID_1)[0]);
//modify by tangxiaoyong begin
mPhone = PhoneFactory.getPhone(PhoneConstants.SIM_ID_1);
mSimId = PhoneConstants.SIM_ID_1;
}else{
mPhone = PhoneFactory.getPhone(getDefaultDataPhoneId());
}
//showDefaultSim();
//modify by end
String imei = mPhone.getDeviceId();
mEditImeiValue.setText(imei);
}
if (arg0.getId() == mBtnSim2.getId()) {
SubscriptionManager.from(mContext).setDefaultDataSubId(SubscriptionManager
.getSubId(PhoneConstants.SIM_ID_2)[0]);
//modify by begin
mPhone = PhoneFactory.getPhone(PhoneConstants.SIM_ID_2);
mSimId = PhoneConstants.SIM_ID_2;
Log.v(LOG_TAG, "SIM 2");
//showDefaultSim();
//modify by tangxiaoyong end
String imei = mPhone.getDeviceId();
mEditImeiValue.setText(imei);
}
if (arg0.getId() == mBtnAttached.getId()) {
String attachedAT[] = { "AT+CGATT=1", "" };
mPhone.invokeOemRilRequestStrings(attachedAT, mResponseHander
.obtainMessage(EVENT_GPRS_ATTACHED));
}