去除桌面bluetooth快捷键和设置里面gps功能开关。
一:Settings\src\com\android\settings\widget\SettingsAppWidgetProvider.java:
import android.view.View;
static RemoteViews buildUpdate(Context context) {
RemoteViews views = new RemoteViews(context.getPackageName(),
R.layout.widget);
//update the view when some feature is disable
if(!context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH)){
views.setViewVisibility(R.id.btn_bluetooth, View.GONE);
}
if(!context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI)){
views.setViewVisibility(R.id.btn_wifi, View.GONE);
}
if(!context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LOCATION_GPS)){
views.setViewVisibility(R.id.btn_gps, View.GONE);
}
--------------------------------------------------------------------------
}
二:Settings\src\com\android\settings\LocationSettings.java:
private PreferenceScreen createPreferenceHierarchy() {
--------------------------------------------------------------------------
if(!getPackageManager().hasSystemFeature(PackageManager.FEATURE_LOCATION_GPS)){
getPreferenceScreen().removePreference(mGps);
}
return root;
}
二:frameworks\base\core\java\android\content\pm\PackageManager.java:
public static final String FEATURE_BLUETOOTH = "android.hardware.bluetooth";
public static final String FEATURE_LOCATION_GPS = "android.hardware.location.gps";
三:android/frameworks/native/data/etc/xxx.xml TO system/etc/permissons/:
android.hardware.bluetooth.xml
android.hardware.wifi.direct.xml
android.hardware.location.gps.xml
添加了判断条件后,只要把相应的属性文件不要拷贝到system/etc/permissons/下面就OK了!