2.Settings模块中packages/apps/Settings/src/com/Android/settings/LocationSettings.Java文件中修改打开GPS功能
public class LocationSettings extends SettingsPreferenceFragment
mLocationAccess.setOnPreferenceChangeListener(this);
if(!getPackageManager().hasSystemFeature(PackageManager.FEATURE_LOCATION_GPS)) {
root.removePreference(mGps);
root.removePreference(mAssistedGps);
root.removePreference((PreferenceScreen) root.findPreference(KEY_AGPS_CONFIG));
}
3.Settings模块packages/apps/Settings/res/layout/widget.xml对应的widget中添加对应的控件。
<ImageView
android:layout_width="1dip"
android:layout_height="match_parent"
android:background="@drawable/appwidget_settings_divider_holo"
android:contentDescription="@null"
/>
<LinearLayout
android:background="@drawable/appwidget_button_center"
android:clickable="true"
android:focusable="true"
android:orientation="vertical">
<ImageView
android:contentDescription="@null"
/>
</LinearLayout>
4.device/sprd/sp8830ec/base.mk
+ frameworks/native/data/etc/android.hardware.location.gps.xml:system/etc/permissions/android.hardware.location
frameworks/native/data/etc/android.hardware.location.xml:system/etc/permissions/android.hardware.location.xml \
- device/sprd/common/tools/e2fsprogs/e2fsck:root/sbin/e2fsck
+ device/sprd/partner/brcm/gps/glgps:/system/bin/glgps \
+ device/sprd/partner/brcm/gps/gpsconfig_shark.xml:/system/etc/gpsconfig.xml \
+ device/sprd/partner/brcm/gps/gps.default.so:/system/lib/hw/gps.default.so \
+ device/sprd/common/tools/e2fsprogs/e2fsck:root/sbin/e2fsck
5./frameworks/base/data/etc/platform.xml
+ <assign-permission name="android.permission.ACCESS_FINE_LOCATION" uid="shell" />
6.frameworks/native/data/etc/android.hardware.location.gps.xml
<permissions><feature name="android.hardware.location" />
<feature name="android.hardware.location.network" />
<feature name="android.hardware.location.gps" />
</permissions>
7.frameworks/native/data/etc/handheld_core_hardware_8830ec.xml
<permissions>
<feature name="android.hardware.camera" />
<feature name="android.hardware.location" />
+ <feature name="android.hardware.location.network" />
<!-- <feature name="android.hardware.sensor.compass" /> -->
<feature name="android.hardware.sensor.accelerometer" />
< permissions>
8.device/sprd/sp8830ec/prod_sp8830eccmccspecAplus_UUI.mk
添加模块gpstest
9.添加package/app/gpstest源码修改Android.mk去掉依赖的jar。
10.settings模块添加入口到
< PreferenceScreen
android:key="gps_test"
android:title="@string/gps_test">
<intent android:action="android.intent.action.MAIN"
android:targetPackage="com.android.gpstest"
android:targetClass="com.android.gpstest.GpsTestActivity" />
</PreferenceScreen>