settings 问题总结: 1.入口,设置分屏显示 frameworks\base\core\res\res\values\bools.xml 下的 preferences_prefer_dual_pane 为true. <bool name="preferences_prefer_dual_pane">true</bool>
2.top level headers--这里可以去掉左边的headers <settings.java> private void updateHeaderList(List<Header> target) { if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH)) {
target.remove(header);
}
3.默认字体: public void readFontSizePreference(ListPreference pref) { ActivityManagerNative.getDefault().getConfiguration()
系统的Configuration是从ActivityManagerService设置的:
<\frameworks\base\services\java\com\android\server\am\ActivityManagerService.java> mConfiguration.setToDefaults(); fontScale = Float.parseFloat(SystemProperties.get("ro.fontScale","1"));
4.settings的theme: <\packages\apps\Settings\AndroidManifest.xml> <application android:label="@string/settings_label"
android:icon="@mipmap/ic_launcher_settings"
android:taskAffinity=""
android:theme="@android :style/Theme.Holo"
android:uiOpti**="splitActionBarWhenNarrow"
android:hardwareAccelerated="true">
<\frameworks\base\core\res\res\values\themes.xml> <style name="Theme.Holo"> 字体颜色 <item name="textColorPrimary">@android :color/primary_text_holo_dark</item> 加亮框的颜色: <item name="activatedBackgroundIndicator">@android :drawable/activated_background_holo_dark</item> 触摸框的颜色: <item name="listChoiceBackgroundIndicator">@android :drawable/list_selector_holo_dark</item> 左边背景: <item name="windowBackground">@android :drawable/screen_background_selector_dark</item> 右边的背景: <item name="detailsElementBackground">@android :drawable/panel_bg_holo_dark</item>
title的背景: <item name="actionBarStyle">@android :style/Widget.Holo.ActionBar</item>
5.设置--》开发者选项--修改后台进程限制
frameworks/base/services/java/com/android/server$ vi ./am/ActivityManagerService.java 大概839行 把int mProcessLimitOverride = -1;改成4(不得超过4个进程) 标准限制 对应 -1 不允许后台进程 对应 0 不得超过1个进程 对应 1 不得超过2个进程 对应 2 不得超过3个进程 对应 3
6. 默认不要锁屏,设置-安全--屏幕锁定 (无) overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml <bool name="def_lockscreen_disabled">true</bool>
7. 位置服务--- 默认Google的位置服务为勾选 overlay/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> 常用修改
一. 修改默认(Settting.apk 中选项默认值一般存在于 frameworks\base\packages\SettingsProvider\res\values\defaults.xml)
1. 默认勾选 未知来源
<bool name="def_install_non_market_apps">false</bool> 2. 默认铃声, 通知, 闹钟 音乐
可以在system.prop 分别配置 ro.config.ringtone=Playa.ogg (默认铃声设置,文件在/system/media/audio/ringtones 把喜欢的铃声放这里,比如123.MP3放入ringtones文件夹中,这里代码改为ro.config.ringtone=123.mp3) ro.config.notification_sound=regulus.ogg (默认提示音,文件在/system/media/audio/notificati** 修改方法同上) ro.config.alarm_alert=Alarm_Beep_03.ogg (默认闹铃,文件在/system/media/audio/alarms 修改方法同上) 3. 壁纸不跟随滑动
packages/apps/Launcher2/./src/com/android/launcher2/Workspace.java 大概 875行
private float wallpaperOffsetForCurrentScroll()
修改 wallpaperOffsetForCurrentScroll 的返回值。 改成 return 0.5f; 二.隐藏或删除某项
1.去掉设置中Wifi选项
device/amlogic/xxxref/xxxref.mk 文件中
# Device specific system feature description
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/tablet_core_hardware.xml:system/etc/permissi**/tablet_core_hardware.xml \
frameworks/native/data/etc/android.hardware.wifi.xml:system/etc/permissi**/android.hardware.wifi.xml \ (删除) 2.去掉设置中蓝牙选项
参考 wifi。
在 tablet_core_hardware.xml 删除 <feature name="android.hardware.bluetooth" /> 这一行 3. HDMI 部分
1)去掉HDMI选项 在system.prop中 加入 ro.hdmi.autoswitch=false
2)去掉480p 选项 在prop中设置 ro.hdmi480p.enable=false 4. 去掉 powerwidget 中 某一项
以去掉 gps 为例 在 packages\apps\Settings\res\layout\widget.xml 下, 移除 <ImageView android:layout_width="1dip" android:layout_height="match_parent" android:background="@drawable/appwidget_settings_divider_holo" android:contentDescription="@null" />
<LinearLayout android:id="@+id/btn_bluetooth" android:layout_width="0dip" android:layout_weight="1" android:layout_height="match_parent" android:paddingTop="12dp" android:background="@drawable/appwidget_button_center" android:clickable="true" android:focusable="true" android rientation="vertical">
<ImageView android:id="@+id/img_bluetooth" android:layout_width="match_parent" android:layout_height="0dip" android:layout_weight="1" android:scaleType="center" android:contentDescription="@null" />
<ImageView android:id="@+id/ind_bluetooth" android:layout_width="match_parent" android:layout_height="wrap_content" android:scaleType="fitXY" android:contentDescription="@null" />
</LinearLayout> 然后 com.android.settings.widget.SettingsAppWidgetProvider.java
注释 views.setOnClickPendingIntent(R.id.btn_gps, getLaunchPendingIntent(context, BUTTON_GPS)); 这一行。 5. 去掉 Setting widget 中 某一项
以去掉 "网络共享与便携式热点" 为例
根据"网络共享与便携式热点" 这个关键词 在 values-zh_rCN 中搜索 到的 key值, 然后在AndroidManifest.xml 搜索这个 key值。 找到对于的Activity 配置
移除 <category android:name="com.android.settings.SHORTCUT" /> 这一行。
6. 修改浏览器默认浏览器模式 packages\apps\Browser\res\xml-sw600dp\advanced_preferences.xml <ListPreference android:key="user_agent" android:title="@string/pref_development_uastring" android:entries="@array/pref_development_ua_choices" android:entryValues="@array/pref_development_ua_values" android:defaultValue="3"/> 修改 android:defaultValue="3" 具体的值参考一下选项 <string-array name="pref_development_ua_choices" translatable="false"> <item>Android</item> <item>Desktop</item> <item>iPhone</item> <item>iPad</item> <item>Froyo-N1</item> <item>Honeycomb-Xoom</item> </string-array> <!-- Do not tranlsate. Development option --> <string-array name="pref_development_ua_values" translatable="false"> <item>0</item> <item>1</item> <item>2</item> <item>3</item> <item>4</item> <item>5</item>
7. workspace 预置 文件夹 范例 folder 放到最前面。launcher:container 的值是folder的数据库中的id。一般从1开始。 <folder
launcher:screen="2" launcher:x="1" launcher:y="1" launcher:title ="@string/application_name" >
<favorite launcher:className="com.android.settings" launcher:packageName="com.android.settings.Settings" launcher:container="2" launcher:x="0" launcher:y="0" />
<favorite launcher:className="com.fb.FileBrower" launcher:packageName="com.fb.FileBrower.FileBrower" launcher:container="2" launcher:x="0" launcher:y="0" /> </folder>
widget 范例 <appwidget launcher:packageName="com.android.calendar" launcher:className="com.android.calendar.widget.CalendarAppWidgetProvider" launcher:screen="1" launcher:x="0" launcher:y="0" launcher:spanX="2" launcher:spanY="3" />
快捷方式范例 <favorite launcher:packageName="com.android.settings" launcher:className="com.android.settings.Settings" launcher:screen="2" launcher:x="1" launcher:y="3" />
网页快捷方式 <shortcut launcher:title="@string/custom_google" launcher:icon="@drawable/favicon_google" launcher:screen="3" launcher:x="4" launcher:y="1"/> 8. 系统自带LatinIME 高级设置--按键音量设置 修改默认值 java/res/values/keypress-volumes.xml
<string-array name="keypress_volumes" translatable="false"> <!-- Build.HARDWARE,volume --> <item>amlogic,0.3</item> //加入这行。 把0.3改成自己的默认值。0.3代表30% <item>herring,0.5</item> <item>tuna,0.5</item> <item>stingray,0.4</item>
9.lockscreen坐标数字时钟被遮住
请调整红色的数字:
<\frameworks\base\core\res\res\layout-sw600dp\keyguard_screen_tab_unlock_land.xml> <!-- left side: status and music --> <RelativeLayout android:layout_height="match_parent" android:layout_weight="0.5"
<!-- right side --> <RelativeLayout android:layout_height="match_parent" android:layout_weight="0.5"
10.在4.1上修改默认字体大小: 比如改成大: <frameworks\base\packages\SettingsProvider\res\values\defaults.xml> <fraction name="def_font_scale">115%</fraction>
11.没有蓝牙的平台,去掉窗口小部件-设置快捷方式-拉到桌面显示的“蓝牙”选项 <\packages\apps\Settings\src\com\android\settings\OutputSettingsBroadcastReceiver.java> public void onReceive(Context context, Intent intent) { // boot completed if(intent.getAction().equalsIgnoreCase(Intent.ACTION_BOOT_COMPLETED)) {
if(!context.getPackageManager().hasSystemFeature(context.getPackageManager().FEATURE_BLUETOOTH)){ ComponentName componentname = new ComponentName("com.android.settings", "com.android.settings.Settings$BluetoothSettingsActivity"); context.getPackageManager().setComponentEnabledSetting(componentname, 2, 1); } }
11. 修改 浏览器的默认标签 分别在一下资源文件中添加自定义的标签 packages\apps\Browser\res\values\strings.xml <string-array name="bookmarks" translatable="false"> <item>Google</item> <item> icasa</item> <item>Yahoo!</item> <item>MSN</item> <item>Twitter</item> <item>Facebook</item> <item>Wikipedia</item> <item>eBay</item> <item>CNN</item> <item>NY Times</item> <item>ESPN</item> <item>Amazon</item> <item>Weather Channel</item> <item>BBC</item> </string-array>
packages\apps\Browser\res\values\bookmarks_ic**.xml , 注意:这里每个网站对应一个缩略图和一个favicon <array name="bookmark_preloads"> <item>@raw/favicon_google</item> <item>@raw/thumb_google</item> <item>@raw/favicon_picasa</item> <item>@raw/thumb_picasa</item> <item>@raw/favicon_yahoo</item> <item>@raw/thumb_yahoo</item> <item>@raw/favicon_msn</item> <item>@raw/thumb_msn</item> <item>@raw/favicon_twitter</item> <item>@raw/thumb_twitter</item> <item>@raw/favicon_facebook</item> <item>@raw/thumb_facebook</item> <item>@raw/favicon_wikipedia</item> <item>@raw/thumb_wikipedia</item> <item>@raw/favicon_ebay</item> <item>@raw/thumb_ebay</item> <item>@raw/favicon_cnn</item> <item>@raw/thumb_cnn</item> <item>@raw/favicon_nytimes</item> <item>@raw/thumb_nytimes</item> <item>@raw/favicon_espn</item> <item>@raw/thumb_espn</item> <item>@raw/favicon_amazon</item> <item>@raw/thumb_amazon</item> <item>@raw/favicon_weatherchannel</item> <item>@raw/thumb_weatherchannel</item> <item>@raw/favicon_bbc</item> <item>@raw/thumb_bbc</item> </array>
对应的图片在 packages\apps\Browser\res\raw
12. 锁屏界面, 解锁组件增加图标 已增加 VideoPlayer 为例, 在frameworks/base/core/res/res/drawable-hdpi 下面 添加一个对应的png图标 下面红色为增加的部分。 frameworks/core/res/res/values-sw600dp-land/arrays.xml <item>@drawable/ic_lockscreen_unlock</item> <item>@drawable/ic_action_assist_generic</item> <item>@drawable/ic_lockscreen_camera</item> - <item>@null</item> + <item>@drawable/ic_lockscreen_videoplayer</item> </array>
<array name="lockscreen_target_descripti**_with_camera"> frameworks/base/res/res/values/arrays.xml b/core/res/res/values/arrays.xml <item>@drawable/ic_lockscreen_unlock</item> <item>@drawable/ic_action_assist_generic</item> <item>@drawable/ic_lockscreen_camera</item> - <item>@null</item> + <item>@drawable/ic_lockscreen_videoplayer</item> </array>
<array name="lockscreen_target_descripti**_with_camera"> frameworks/base/res/res/values/public.xml b/core/res/res/values/public.xml
index ac0a457..be4257e 100755 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml
<java-symbol type="drawable" name="ic_lockscreen_unlock_phantom" /> <java-symbol type="drawable" name="ic_media_route_on_holo_dark" /> <java-symbol type="drawable" name="ic_media_route_disabled_holo_dark" />
<java-symbol type="drawable" name="ic_lockscreen_videoplayer" />
<java-symbol type="layout" name="action_bar_home" /> <java-symbol type="layout" name="action_bar_title_item" /> <java-symbol type="layout" name="action_menu_item_layout" />
frameworks/base/policy/src/com/android/internal/policy/impl/LockScreen.java
case com.android.internal.R.drawable.ic_lockscreen_camera: launchActivity(new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA)); mCallback.pokeWakelock(); break; case com.android.internal.R.drawable.ic_lockscreen_videoplayer: launchActivity(new Intent().setClassName("com.farcore.videoplayer", "com.farcore.videoplayer.FileList")); mCallback.pokeWakelock(); break; 注意: 在 frameworks/base/core/res/ 中执行mm 。然后在frameworks/base/policy 中执行mm。看看能否编译过。不行的话,在 在根目录下 执行make update-api
13. 休眠策略 修改默认的休眠策略,请参考 frameworks\base\packages\SettingsProvider\res\values\defaults.xml <integer name="def_wifi_sleep_policy">0</integer> <!-- 0 == Never, 1 == Only when plugged in,2 == Always. -->
14. Launcher 半透明
4.0, 4.1 下载附件中的patch集合--- translucent.zip
如果是 4.2.2系统 , 还需修改 Launcher/src/com/android/launcher2/Launcher.java
mLauncherView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); mWorkspaceBackgroundDrawable = getResources().getDrawable(R.drawable.workspace_bg); mBlackBackgroundDrawable = new ColorDrawable(Color.BLACK); // 修改为 mBlackBackgroundDrawable = new ColorDrawable(0x7f000000); packages\amlogic\Launcher2\src\com\android\launcher2\Launcher.java
mStateAnimation.addListener(new AnimatorListenerAdapter() { boolean animationCancelled = false; @Override public void onAnimati**tart(Animator animation) { dispatchOnLauncherTransitionEnd(fromView, animated, false); //add dispatchOnLauncherTransitionEnd(toView, animated, false); //add updateWallpaperVisibility(false); //true 改成false // Prepare the position toView.setTranslationX(0.0f); toView.setTranslationY(0.0f); toView.setVisibility(View.VISIBLE); toView.bringToFront(); }
15. APK 预装时无法找到lib库的问题
(1) 如果log报错是找不到lib库首先可以修改lib的路径
jb4.1\frameworks\base\core\java\android\app\NativeActivity.java public static final String SYSTEM_LIB_PATH = "/system/lib";
if (libraryFile.exists()) { path = libraryFile.getPath(); }else{ File systemLibraryFile = new File(SYSTEM_LIB_PATH,System.mapLibraryName(libname)); if (systemLibraryFile.exists()) { path = systemLibraryFile.getPath(); } }
(2)apk本身会检测检测/data/data/lib路径是否存在资源文件时方法1不适用,用第二种方法:
在项目上的mk文件 /device/amlogic/g18refg/8ref.mk 中,加上 preinstallation
PRODUCT_PACKAGES += \ lights.amlogic \ FileBrowser \ AppInstaller \ VideoPlayer \ HdmiSwitch \ Update \ fw_env \ preinstallation
将网页底部的附件 Preinstallation.zip拷贝到packages\amlogic下面解压 将需要预装安装的apk拷贝到preinstallation目录下面,编辑里面的preinstall.sh文件内容如下:
#!/system/xbin/busybox sh
echo "do preinstall applicati**"
# com.mxtech.videoplayer.ad apk包名
if [ ! -e /data/data/com.mxtech.videoplayer.ad/ ]; then pm install /system/preinstall/com.mxtech.videoplayer.ad.50.apk fi
if [ ! -e /data/data/org.xbmc.xbmc/ ]; then pm install /system/preinstall/xbmc-20130414-e2c3799-Frodo-armeabi-v7a.apk fi 。。。。。。
然后在device\amlogic\common\init\tablet\init.amlogic.rc 中,启动预安装脚本的服务.
MX: service preinstall /system/bin/preinstall.sh class main user root group root oneshot c**ole disabled
M3: service preinstall /system/bin/preinstall.sh user root group root disabled oneshot
在init.amlogic.rc最后一行加上
start preinstall
16. 去掉 hotspot 把红色的部分删掉 device\amlogic\gXXXX\overlay\frameworks\base\core\res\res\values\config.xml <string-array translatable="false" name="config_tether_wifi_regexs"> <item>"wlap0"</item> <item>"wl0.1"</item> <item>"wlan0"</item> </string-array> <integer-array translatable="false" name="config_tether_upstream_types"> <item>0</item> <item>9</item> </integer-array>
|