定位上篇
Android 5.1 - 7.1 系统(framework)定制、修改、移植、总结 - 上篇
1:Android系统将位置信息模式默认设置为高精确度
GPS位置信息模式默认为“仅限设备”, 应客户的需求,需要默认为“高精确度”
请把 /frameworks/base/packages/SettingsProvider/res/values/defaults.xml
<string name="def_location_providers_allowed" translatable="false">gps</string>
修改成
<string name="def_location_providers_allowed" translatable="false">gps,network</string>
2:Android 5.1 关闭通知栏通能
修改点:\frameworks\base\core\java\android\app\NotificationManager.java
/** * Post a notification to be shown in the status bar. If a notification with * the same id has already been posted by your application and has not yet been canceled, it * will be replaced by the updated information. * * @param id An identifier for this notification unique within your * application. * @param notification A {@link Notification} object describing what to show the user. Must not * be null. */ public void notify(int id, Notification notification) { boolean close=false; if(close) { notify(null, id, notification); } }
3:Android frameworks去掉熄屏前先变暗的功能
设置>显示:这里可以设置自动休眠超时时间。
当设置为30s时,到24s左右屏幕会先变暗,告知用户屏幕快熄灭了,6s以后才会真正熄屏。
现在需要去掉这个功能,在PowerManagerService里可以看到
private int getScreenDimDurationLocked(int screenOffTimeout) { return Math.min(SCREEN_DIM_DURATION, (int)(screenOffTimeout * MAXIMUM_SCREEN_DIM_RATIO)); }
30S是系统里最短的超时时间,也就是说其他screenOffTimeout乘以0.2是比6要大的,所以就不用考虑了。
要想去掉DIM这个Feature,直接把SCREEN_DIM_DURATION设为0,这样getScreenDimDurationLocked()的返回值也就是0,这样就不再有屏幕先变暗这个步骤了。实测可行。
4.屏蔽掉下拉通知栏和状态栏
修改点:frameworks\base\packages\SystemUI\src\com\android\systemui\statusbar\phone\PhoneStatusBarView.java
@Override public void addPanel(PanelView pv) { super.addPanel(pv); // if (pv.getId() == R.id.notification_panel) { // mNotificationPanel = pv; // } else if (pv.getId() == R.id.settings_panel){ // mSettingsPanel = pv; // } pv.setRubberbandingEnabled(!mFullWidthNotifications); }
5 .android 修改MTP在PC端显示的制造商信息
1. 修改build/tools/buildinfo.sh中的 ro.product.manufacturer 2.frameworks\av\media\mtp\MtpServer.cpp 的doGetDeviceInfo() property_get("ro.product.manufacturer", prop_value, "unknown manufacturer"); string.set(prop_value); 修改此处的prop_value