移除建议设置(推荐设置)
通过阅读源码packages/apps/Settings/src/com/android/settings/dashboard/DashboardSummary.java#SuggestionLoader
private class SuggestionLoader extends AsyncTask<Void, Void, List<Tile>> {
@Override
protected List<Tile> doInBackground(Void... params) {
....
if (mSuggestionsChecks.isSuggestionComplete(suggestion)) {
mAdapter.disableSuggestion(suggestion);
suggestions.remove(i--);
}
....
}
}
可以得出若isSuggestionComplete
返回true时则该项不会出现在推荐设置中,因此在packages/apps/Settings/src/com/android/settings/dashboard/SuggestionsChecks.java#isSuggestionComplete
直接返回true
public boolean isSuggestionComplete(Tile suggestion) {
return true;
}
移除蓝牙设置项
Settings使用以下代码判断设备是否支持蓝牙若不支持蓝牙则将其隐藏
packages/apps/Settings/src/com/android/settings/SettingsActivity.java#doUpdateTilesList
private void doUpdateTilesList() {
....
setTileEnabled(new ComponentName(packageName,
Settings.BluetoothSettingsActivity.class.getName()),
pm.hasSystemFeature(PackageManager.FEATURE_BLUETOOTH), isAdmin, pm);
...
}
因此通过分析hasSystemFeature
可以得出将/system/etc/permissions/android.hardware.bluetooth.xml
中<feature name="android.hardware.bluetooth" />
注释即可屏蔽,其对应在系统中的目录为:
frameworks/native/data/etc/android.hardware.bluetooth.xml
<permissions>
<!-- <feature name="android.hardware.bluetooth" />-->
</permissions>