将IMEI和MAC地址添加到Genymotion/AndroVM的wlan0

14
有没有办法将IMEI添加到AndroVM(现在是Genymotion)或任何其他Android模拟器中?同时,我想要wlan0端口的MAC地址。我们已经有带有MAC的模拟器,但是不适用于wlan。 我们如何做到这一点? 如果你认识的人已经做到了,请让他们贡献。
详情: 我正在尝试构建基于云的Android应用程序测试中心作为我的大学本科计算机科学学位的部分履行前年项目。我想知道我们如何获得更多的Genymotion配置。 或者如果您可以为我提供更多设备配置,并且是否可能快速为不同设备构建genymotion配置。 其次,如何向构建添加MAC地址和IMEI号码?
我们正试图模拟移动设备(非Google nexus),以建立一个基于云的测试中心。 为此,我们正在尝试使用AndroVM(Genymotion),但我们遇到了一些问题。
到目前为止我们已经做了什么: 1.按照官方Android网站上的步骤从头开始构建androVm源代码,“VBOX86tp-userdebug”模式。 2.在虚拟EC2服务器上构建完源代码后,键入模拟器命令运行,但是返回的是空白。 3.如有可能,能否以“Fastboot”模式运行AndroVm,以便我们可以安装它到设备上。
我们一直在“构建androVm”源代码并尝试完成一些任务,例如: 1.使用构建过程完成后可用的img运行它。 2.使其可移植,即从out目录中创建iso / ova。
到目前为止我们尝试过的有: 下载AndroVm源代码 使用repo init初始化repo 通过repo sync下载源代码 选择lunch菜单 选择vbox86tp-userdebug
其他full-eng菜单不起作用,因此已停用
遇到的一些错误: 制作错误:它们非常简单,因此得以解决。 未生成system.img:再次制作解决 bin / bash jar命令错误:路径错误,通过导出jar命令路径解决
几个问题: 1.OVA文件由什么组成,如何创建?从我看到的内容来看,它包含了几个VMDK和几个附加的配置文件, 2.如何将平台特定的映像文件(system.img ramdisk.img userdata.img)转换为OVA或ISO文件。如果我们确实缺少要提供给模拟器的文件,请只命名它们。 3.如何添加IMEI号码 4.我们已经有eth0/1端口的MAC地址,但我们希望它出现在wlan端口上。
参考图片:“显示eth0和eth1端口的图像”src

其他细节



现在让事情变得有趣

这是我从Genymotion团队收到的回复:

I want my project to cover various configurations but for starters if i can get something like Samsung Galaxy phones and tab or as a

start if I can get Samsung galaxy tab 2.

You can change the screen size and DPI for each virtual device. You can toggle navigation bar and virtual keyboard. However, we cannot provide virtual devices that contains proprietary applications like Samsung.

Now here what we get is the MAC address of eth0/1 port. What if I need wlan MAC.

Unless one of the two network interface have been disabled, there should be 2 interfaces, 2 IP, and 2 MAC addresses: adb shell ip a. 2: eth0: mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 08:00:27:d4:fe:e0 brd ff:ff:ff:ff:ff:ff inet 192.168.56.101/24 brd 192.168.56.255 scope global eth0 inet6 fe80::a00:27ff:fed4:fee0/64 scope link valid_lft forever preferred_lft forever 3: eth1: mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 08:00:27:c8:37:e7 brd ff:ff:ff:ff:ff:ff inet 10.0.3.15/24 brd 10.0.3.255 scope global eth1 inet6 fe80::a00:27ff:fec8:37e7/64 scope link .

Sorry, but we do not provide support for specific ROM. However, I strongly recommend you to visit the community at: https://groups.google.com/forum/#!forum/genymotion-users

1. What an OVA file consits of and how can it be created  ?From what i have seen it contains few VMDK's and few configurations files

attached to it,

"The entire directory can be distributed as an OVA package, which is a tar archive file with the OVF directory inside." (http://en.wikipedia.org/wiki/Open_Virtualization_Format)

2. How to convert the platform specific image files(system.img ramdisk.img userdata.img) into an OVA or ISO file.

If at all we are missing few files to give to the emulator, can you just name them.

Please read the community tutorials

3. Also how to add IMEI number

There is currently no way to add IMEI number. This feature will come in the near future

4. We already have MAC for eth0 port but we want it on wlan port

There is 2 interfaces: eth0 and eth1. Eth0 is used for Genymotion application widgets. If this network connection is broken, Genymotion would not be able to start anymore. Eth1 is used for network current access (fake WiFi connection). You can change this network configuration as you want.

1个回答

11

在移动应用程序中,常见的做法是通过IMSI号码(与SIM卡相关联)或IMEI号码(设备的唯一ID)来识别用户。当然,在Android上也可以实现此功能:

TelehponyManager manager = (TelehponyManager)getSystemService(TELEPHONY_SERVICE);
String imei = manager.getDeviceId();
String imsi = manager.getSubscriberId();

这段代码在真实设备上可以完美执行,然而在模拟器中 IMEI 始终都是全零且无法配置。当调试一个使用 IMEI 作为用户 ID 的网络应用时,这很快就变得尴尬。

为了解决这个问题,我首先查看了 TelephonyManager 服务,结果发现以下片段:

private IPhoneSubInfo getSubscriberInfo() {
// get it each time because that process crashes a lot
return IPhoneSubInfo.Stub.asInterface(ServiceManager.getService("iphonesubinfo"));
}

很公正的评论,是吧?这真的让我的一天变得更美好了 :)

无论如何,代码分析显示IMEI/IMSI请求穿过所有电话层(请见图表),最终到达基带设备。在模拟系统的情况下,rild守护进程与libreference-ril.so一起使用-参考供应商RIL库,该库使用普通的旧AT命令与基带调制解调器设备进行通信。

调制解调器设备本身在Android系统外部进行模拟,作为模拟器的核心qemu的一部分。模拟器和运行在模拟器内部的Android系统之间的通信细节非常有趣(所有通信都通过虚拟串行端口进行,Android系统的qemud守护进程用于(去)复用数据)。我将尽快发布有关该主题的简要介绍。

虚拟调制解调器实现可以在external/qemu/telephony/android_modem.c中找到。文件的最重要部分是这个函数:

const char*  amodem_send( AModem  modem, const char*  cmd );

这个函数会在每次接收到AT命令时被调用。对于每个命令,都会搜索sDefaultResponses数组以获取特定命令,并发送预定义的响应或执行命令处理程序。该数组本身类似于:

static const struct {
const char*      cmd;     /* command coming from libreference-ril.so, if first
                             character is '!', then the rest is a prefix only */

const char*      answer;  /* default answer, NULL if needs specific handling or
                             if OK is good enough */

ResponseHandler  handler; /* specific handler, ignored if 'answer' is not NULL,
                             NULL if OK is good enough */
} sDefaultResponses[] =
{
    /* ... */
    { "+CIMI", OPERATOR_HOME_MCCMNC "000000000", NULL },   /* request internation subscriber identification number */
    { "+CGSN", "000000000000000", NULL },   /* request model version */
    /* ... */
};

上述提到的两个数组行负责检索IMSI和IMEI。正如您所见,这两个值都是硬编码的,没有机会在不重新编译模拟器的情况下进行修改。

然而,一种老派的黑客方法很有用。模拟器二进制文件未加密也未压缩,因此字符串文字应该在模拟器二进制文件中可见。事实上,它们确实是可见的,IMEI号码可以通过几个简单的步骤进行修改:

** backup the emulator binary
** open the binary with your favourite hex editor
** search for +CGSN string followed by a null byte, it should be followed by 15 digits of the IMEI number
** edit the number, be careful not to change the number of digits
** save the file, that’s all!

当然,这不是完美舒适的解决方案,但总比没有好。在下一部分中,我将解释如何将IMEI号码变为可配置选项。享受吧!


这个回答看起来很像我之前看过的一个博客 :D - cafebabe1991
1
这是针对官方模拟器的,不是Genymotion! - V.E.O
添加一个源不会伤害任何人:https://codepainters.wordpress.com/2009/12/11/android-imei-number-and-the-emulator/,这样每个人都可以跟随链接,比如当你看到“查看图表”或者带有新信息的更新版本的文章。 - Jorge Fuentes González

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接