我可以从我的应用程序中禁用我的 wifi 设备驱动程序吗?

Can I disable my wifi device driver from my application?

我在专有系统上拥有 root 权限。我正在尝试通过重命名或删除文件夹 /system/lib/modules 中的设备驱动程序文件 "wlan.ko" 来 "securely" 禁用 wifi。我想出了如何通过 shell/console 使用命令来做到这一点,基本上是这样的:

su

#first make the partition writable as follows: 
mount -rw -o remount /dev/block/mmcblk0p5 /system

#go to the folder: 
cd /system/lib

# apply permissions
chmod -R 777 modules

cd modules

#rename the driver 
mv wlan.ko wlanko.ok

现在,我需要能够通过在我的 Android 应用程序中执行 shell 命令来做同样的事情。查看 logcat 输出,似乎我无法通过 chmod 命令。

这是权限 and/or 所有权问题吗?我正在尝试的东西可以在应用程序中实现吗?

如果您创建了一个伪造的驱动程序,例如一个纯文本文件,与真实驱动程序同名,以下序列似乎可以完成工作 - 即永久禁用 wifi(直到有人恢复设备驱动程序)。

#!/system/bin/sh
su

# turn off wifi just in case...
svc wifi disable

#first make the partition writable as follows: 
mount -rw -o remount /dev/block/mmcblk0p5 /system
sync

#go to the folder: 
cd /system/lib/modules
sync

# replace the device driver with a bogus one
cp <path_to_bogus_driver>/wlan.ko /system/lib/modules
sync

# add the reboot so /system gets mounted as it should be
reboot