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
感謝您的聯繫我得到它的工作。我添加了Settings.apk中的smali文件,但我對smali沒有任何理解。我在我的問題中發佈了我的新smali代碼。如果我能提高效率,你可以看看嗎? – Cilenco