-
反编译小米的TeleService.apk,查看smali代码得知有一个getPreferredDataSlotId方法,相关代码:
invoke-static {}, Lmiui/telephony/MultiSimManager;->getInstance()Lmiui/telephony/MultiSimManager; move-result-object v1 invoke-virtual {v1}, Lmiui/telephony/MultiSimManager;->getPreferredDataSlotId()I;
使用java反射方法调用:
try { Class<?> clazz = Class.forName("miui.telephony.MultiSimManager"); Method method = clazz.getDeclaredMethod("getInstance"); Object obj = (Object) method.invoke(null); Method method2 = clazz.getDeclaredMethod("getPreferredDataSlotId"); Integer val = (Integer) method2.invoke(obj); Log.e("pmtoam", "[sam] val = " + val); } catch (Exception e) { e.printStackTrace(); }
反射机制
http://www.cnblogs.com/mengdd/archive/2013/01/26/2877972.html
http://blog.csdn.net/liujiahan629629/article/details/18013523
反射
最新推荐文章于 2018-08-25 18:46:59 发布