HI i have this codes regarding dual sim
i got this from a friend.
<
im hoping for a fast response thank you
i got this from a friend.
<
B4X:
package com.jb.gosms.h;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.database.Cursor;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Bundle;
import android.provider.Settings.System;
import android.telephony.SmsMessage;
import com.jb.gosms.util.dk;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
public class f
implements a
{
private static int H = -1;
private static int J = -1;
private final Class A;
private Class[] B;
private final Method C;
private Class Code = Class.forName("android.telephony.gemini.GeminiSmsManager");
private BroadcastReceiver D;
private final Method E;
private IntentFilter F;
private final Method G;
private final Method I;
private boolean L = false;
private final Method S;
private Class[] V;
private Class Z;
private boolean a = false;
private ArrayList b;
private final Class c;
private final Field d;
private final Field e;
private final Field f;
private final Field g;
private final Class h;
private final Class[] i;
private final Class[] j;
private final Method k;
private final Method l;
private final Field m;
private final Class n;
private final Field o;
private final Field p;
private final Field q;
private final Class r;
private final Field s;
private final Field t;
private final Class u;
private final Class[] v;
private final Method w;
private final Class x;
private final Class[] y;
private final Method z;
f()
{
Class[] arrayOfClass1 = new Class[6];
arrayOfClass1[0] = String.class;
arrayOfClass1[1] = String.class;
arrayOfClass1[2] = ArrayList.class;
arrayOfClass1[3] = Integer.TYPE;
arrayOfClass1[4] = ArrayList.class;
arrayOfClass1[5] = ArrayList.class;
this.V = arrayOfClass1;
this.I = this.Code.getMethod("sendMultipartTextMessageGemini", this.V);
this.Z = Class.forName("android.net.ConnectivityManager");
Class[] arrayOfClass2 = new Class[3];
arrayOfClass2[0] = Integer.TYPE;
arrayOfClass2[1] = String.class;
arrayOfClass2[2] = Integer.TYPE;
this.B = arrayOfClass2;
this.C = this.Z.getMethod("startUsingNetworkFeatureGemini", this.B);
this.S = this.Z.getMethod("stopUsingNetworkFeatureGemini", this.B);
this.c = Class.forName("com.android.internal.telephony.IccCard");
this.d = this.c.getField("INTENT_KEY_ICC_STATE");
this.e = this.c.getField("INTENT_VALUE_ICC_READY");
this.f = this.c.getField("INTENT_VALUE_ICC_IMSI");
this.g = this.c.getField("INTENT_VALUE_ICC_LOADED");
this.h = Class.forName("android.telephony.TelephonyManager");
this.i = new Class[0];
Class[] arrayOfClass3 = new Class[1];
arrayOfClass3[0] = Integer.TYPE;
this.j = arrayOfClass3;
this.k = this.h.getMethod("getDefault", this.i);
this.l = this.h.getMethod("getSimStateGemini", this.j);
this.m = this.h.getField("SIM_STATE_READY");
this.n = Class.forName("com.android.internal.telephony.Phone");
this.o = this.n.getField("GEMINI_SIM_1");
this.p = this.n.getField("GEMINI_SIM_2");
this.q = this.n.getField("GEMINI_SIM_ID_KEY");
this.r = Class.forName("android.provider.Settings$System");
this.s = this.r.getField("GPRS_CONNECTION_SETTING");
this.t = this.r.getField("GPRS_CONNECTION_SETTING_DEFAULT");
this.u = Class.forName("android.telephony.SmsMessage");
this.v = new Class[0];
this.w = this.u.getMethod("getMessageSimId", this.v);
this.x = Class.forName("android.provider.Telephony$Sms$Intents");
this.y = new Class[] { Intent.class };
this.z = this.x.getMethod("getMessagesFromIntent", this.y);
this.A = Class.forName("android.telephony.ServiceState");
this.E = this.A.getMethod("newFromBundle", new Class[] { Bundle.class });
this.G = this.A.getMethod("getMySimId", new Class[0]);
Object localObject = this.k.invoke(null, new Object[0]);
Method localMethod1 = this.l;
Object[] arrayOfObject1 = new Object[1];
arrayOfObject1[0] = Integer.valueOf(this.o.getInt(this.n));
int i1 = ((Integer)localMethod1.invoke(localObject, arrayOfObject1)).intValue();
Method localMethod2 = this.l;
Object[] arrayOfObject2 = new Object[1];
arrayOfObject2[0] = Integer.valueOf(this.p.getInt(this.n));
int i2 = ((Integer)localMethod2.invoke(localObject, arrayOfObject2)).intValue();
if (this.m.getInt(localObject) == i1)
this.L = true;
if (this.m.getInt(localObject) == i2)
this.a = true;
}
public static int Code(NetworkInfo paramNetworkInfo)
{
Object[] arrayOfObject = new Object[0];
try
{
int i2 = ((Integer)Class.forName("android.net.NetworkInfo").getMethod("getSimId", new Class[0]).invoke(paramNetworkInfo, arrayOfObject)).intValue();
i1 = i2;
if (i1 == 0)
{
i1 = H;
return i1;
}
}
catch (Exception localException)
{
int i1;
do
while (true)
{
dk.B("LenovoApi", dk.Code(localException));
i1 = -1;
}
while (i1 != 1);
}
return J;
}
private void I(Context paramContext)
{
Uri localUri = Uri.parse("content://telephony/siminfo");
Cursor localCursor = paramContext.getContentResolver().query(localUri, null, null, null, null);
if (localCursor != null)
while (true)
{
long l1;
int i1;
try
{
if (!localCursor.moveToNext())
break;
l1 = localCursor.getLong(localCursor.getColumnIndexOrThrow("_id"));
i1 = localCursor.getInt(localCursor.getColumnIndexOrThrow("slot"));
if (i1 == 0)
{
H = (int)l1;
continue;
}
}
finally
{
if (localCursor != null)
localCursor.close();
}
if (i1 == 1)
{
int i2 = (int)l1;
J = i2;
}
}
if (localCursor != null)
localCursor.close();
}
private void Z(Context paramContext)
{
this.b = new ArrayList();
this.F = new IntentFilter("android.intent.action.SIM_STATE_CHANGED");
this.D = new g(this);
paramContext.registerReceiver(this.D, this.F);
}
public static boolean a()
{
try
{
Class localClass = Class.forName("com.lenovo.lenovofeatureoption.LenovoFeatureOption");
boolean bool = ((String)localClass.getField("LENOVO_PROJECT_NAME_STR").get(localClass)).contentEquals("A2");
if (bool)
return true;
}
catch (Exception localException)
{
}
return false;
}
public int B()
{
return J;
}
public String C()
{
return "pending_sim_id";
}
public int Code(int paramInt)
{
if (paramInt == H)
return 0;
if (paramInt == J)
return 1;
return -1;
}
public int Code(int paramInt1, int paramInt2)
{
switch (paramInt1)
{
case 774:
case 775:
default:
return -1;
case 772:
if (paramInt2 == Z())
return 2130838694;
if (paramInt2 == B())
return 2130838695;
return -1;
case 769:
if (paramInt2 == Z())
return 2130838133;
if (paramInt2 == B())
return 2130838134;
return 2130838132;
case 771:
if (paramInt2 == Z())
return 2130838284;
if (paramInt2 == B())
return 2130838285;
return 2130838137;
case 770:
if (paramInt2 == Z())
return 2130838145;
if (paramInt2 == B())
return 2130838146;
return 2130838143;
case 773:
if (paramInt2 == Z())
return 2130903548;
return 2130903549;
case 776:
}
if (paramInt2 == Z())
return 2131428374;
if (paramInt2 == B())
return 2131428375;
return -1;
}
public int Code(Cursor paramCursor, int paramInt)
{
int i1;
if (paramInt == -1)
i1 = paramCursor.getColumnIndex(L());
while (i1 != -1)
{
return paramCursor.getInt(i1);
if (paramInt == -2)
i1 = paramCursor.getColumnIndex(I());
else
i1 = paramInt;
}
dk.B("LenovoApi", "getSimIDFromCursor idx == -1");
return -1;
}
public int Code(ConnectivityManager paramConnectivityManager, int paramInt1, String paramString, int paramInt2)
{
try
{
int i1 = Code(paramInt2);
Object[] arrayOfObject = new Object[3];
arrayOfObject[0] = Integer.valueOf(paramInt1);
arrayOfObject[1] = paramString;
arrayOfObject[2] = Integer.valueOf(i1);
int i2 = ((Integer)this.C.invoke(paramConnectivityManager, arrayOfObject)).intValue();
return i2;
}
catch (Exception localException)
{
dk.B("LenovoApi", dk.Code(localException));
}
return -1;
}
public int Code(Bundle paramBundle)
{
try
{
Object localObject = this.E.invoke(null, new Object[] { paramBundle });
int i1 = V(Integer.valueOf(this.G.invoke(localObject, new Object[0]).toString()).intValue());
return i1;
}
catch (Exception localException)
{
}
return -1;
}
public int Code(SmsMessage paramSmsMessage)
{
Object[] arrayOfObject = new Object[0];
try
{
int i2 = ((Integer)this.w.invoke(paramSmsMessage, arrayOfObject)).intValue();
i1 = i2;
if (i1 == 0)
{
i1 = H;
return i1;
}
}
catch (Exception localException)
{
int i1;
do
while (true)
{
dk.B("LenovoApi", dk.Code(localException));
i1 = -1;
}
while (i1 != 1);
}
return J;
}
public String Code()
{
return "simId";
}
public void Code(Context paramContext)
{
Z(paramContext);
I(paramContext);
}
public void Code(c paramc)
{
this.b.add(paramc);
}
public void Code(String paramString1, String paramString2, ArrayList paramArrayList1, ArrayList paramArrayList2, ArrayList paramArrayList3, int paramInt)
{
int i1 = Code(paramInt);
Object[] arrayOfObject = new Object[6];
arrayOfObject[0] = paramString1;
arrayOfObject[1] = paramString2;
arrayOfObject[2] = paramArrayList1;
arrayOfObject[3] = Integer.valueOf(i1);
arrayOfObject[4] = paramArrayList2;
arrayOfObject[5] = paramArrayList3;
try
{
this.I.invoke(null, arrayOfObject);
return;
}
catch (Exception localException)
{
dk.B("LenovoApi", dk.Code(localException));
}
}
public SmsMessage[] Code(Intent paramIntent)
{
try
{
Object[] arrayOfObject = { paramIntent };
SmsMessage[] arrayOfSmsMessage = (SmsMessage[])this.z.invoke(this.x, arrayOfObject);
return arrayOfSmsMessage;
}
catch (Exception localException)
{
dk.B("LenovoApi", dk.Code(localException));
}
return null;
}
public boolean D()
{
return this.a;
}
public boolean F()
{
return this.L;
}
public String I()
{
return "sim_id";
}
public String L()
{
return "sim_id";
}
public Uri S()
{
return Uri.parse("content://telephony/carriers_gemini");
}
public int V(int paramInt)
{
if (paramInt == 0)
return H;
if (paramInt == 1)
return J;
return -1;
}
public int V(int paramInt1, int paramInt2)
{
switch (paramInt1)
{
default:
return -1;
case 774:
if (paramInt2 == 1025)
return 2131428244;
return 2131428245;
case 775:
if (paramInt2 == 1025)
return 2131428217;
return 2131428218;
case 776:
}
if (paramInt2 == 1025)
return 2131428374;
return 2131428375;
}
public int V(Context paramContext)
{
try
{
int i1 = Settings.System.getInt(paramContext.getContentResolver(), (String)this.s.get(this.r), this.t.getInt(this.r));
return i1;
}
catch (Exception localException)
{
dk.B("LenovoApi", dk.Code(localException));
}
return -1;
}
public int V(ConnectivityManager paramConnectivityManager, int paramInt1, String paramString, int paramInt2)
{
try
{
int i1 = Code(paramInt2);
Object[] arrayOfObject = new Object[3];
arrayOfObject[0] = Integer.valueOf(paramInt1);
arrayOfObject[1] = paramString;
arrayOfObject[2] = Integer.valueOf(i1);
int i2 = ((Integer)this.S.invoke(paramConnectivityManager, arrayOfObject)).intValue();
return i2;
}
catch (Exception localException)
{
dk.B("LenovoApi", dk.Code(localException));
}
return -1;
}
public String V()
{
return "sim_id";
}
public void V(c paramc)
{
this.b.remove(paramc);
}
public int Z()
{
return H;
}
}
im hoping for a fast response thank you