0

因为我正在创建自定义 ROM,所以我想从 settings.apk 中删除一些条目因为无法使用 XML 隐藏首选项,所以我必须从 apk 更改源代码,并且必须从 PreferenceScreen 中删除首选项。于是我classes.dex用dex2jar反编译了复制源代码并添加以下行:

getPreferenceScreen().removePreference(findPreference("toggle_wifi"));

现在我的问题是我不知道如何重新编译应用程序。我不能用 Eclipse 编译它,因为它使用了一些系统命名空间(在 Eclipse 中这是一个错误,所以我无法编译) 我怎样才能重新编译应用程序?我只有 *.java 文件。

编辑:我添加到 smali 文件的 smali 代码:

invoke-virtual {p0}, Lcom/android/settings/WirelessSettings;->getPreferenceScreen()Landroid/preference/PreferenceScreen;
move-result-object v12
const-string v13, "toggle_wifi"
invoke-virtual {p0, v13}, Lcom/android/settings/WirelessSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v13
invoke-virtual {v12, v13}, Landroid/preference/PreferenceScreen;->removePreference(Landroid/preference/Preference;)Z

invoke-virtual {p0}, Lcom/android/settings/WirelessSettings;->getPreferenceScreen()Landroid/preference/PreferenceScreen;
move-result-object v12
const-string v13, "wifi_settings"
invoke-virtual {p0, v13}, Lcom/android/settings/WirelessSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v13
invoke-virtual {v12, v13}, Landroid/preference/PreferenceScreen;->removePreference(Landroid/preference/Preference;)Z

invoke-virtual {p0}, Lcom/android/settings/WirelessSettings;->getPreferenceScreen()Landroid/preference/PreferenceScreen;
move-result-object v12
const-string v13, "toggle_bluetooth"
invoke-virtual {p0, v13}, Lcom/android/settings/WirelessSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v13
invoke-virtual {v12, v13}, Landroid/preference/PreferenceScreen;->removePreference(Landroid/preference/Preference;)Z

invoke-virtual {p0}, Lcom/android/settings/WirelessSettings;->getPreferenceScreen()Landroid/preference/PreferenceScreen;
move-result-object v12
const-string v13, "bt_settings"
invoke-virtual {p0, v13}, Lcom/android/settings/WirelessSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v13
invoke-virtual {v12, v13}, Landroid/preference/PreferenceScreen;->removePreference(Landroid/preference/Preference;)Z
4

1 回答 1

0

您可以在以下链接中找到详细的教程:

反编译和重新编译

于 2013-08-18T22:21:49.987 回答