开发者

Is it possible to hide the 'USB Debugging' toggle on a rooted Android phone?

The use case here is deploying the Nexus S as part of an enterprise platform. Users of the phones should not be able to enable USB debugging -- but administrators should be, with a password or something similar.开发者_运维问答

It seems like this should be possible by deploying custom versions of Settings.apk=com.android.settings and/or SettingsProvider.apk=com.android.providers.settings? Are there any lighter-weight options?


Not sure if this is a development-related question. Anyway, here is how I would do it:

  1. Get Settings.apk from /system/app
  2. Rename Settings.apk to Settings.zip
  3. Now get ./res/xml/development_prefs.xml (an example of this xml is here)
  4. You need to convert this development_prefs.xml from binary to text (you'll need to figure that out yourself, I've never tried it myself).
  5. Remove preference item with key "enable_adb".
  6. Convert development_prefs.xml back to binary format.
  7. Copy it into Settings.zip archive
  8. Rename Settings.zip to Settings.apk
  9. Copy this modified Settings.zip to your phone

One additional note: there are number of folder of format "xml-[locale]", like "xml-ru", "xml-zh-TW" and so on. You should modify all development_prefs.xml from those folder too. Or as another option, you can remove all thos folders altogether, provided you don't need multilingual support.

And if your admins would need to enable adb, they could copy original Settings.apk over to the phone. Or you can write small .apk yourself with this feature alone and just install it side-by-side with modified Settings.apk.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜