定位上篇
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