zoukankan      html  css  js  c++  java
  • Android framework系统默认设置修改

    Launcher 总结:

    1、launcher的布局太居中,要想两边拉伸

    <packagesappsLauncher2 esvaluesdimens.xml>

        <dimen name="  apps_customize_pageLayoutPaddingLeft">40dp</dimen>

        <dimen name="  apps_customize_pageLayoutPaddingRight">40dp</dimen>

    apps tab栏的宽度( Launcher2 icon 数目、大小)

    packagesappsLauncher2 eslayout-sw720dpworkspace.xml>

        launcher:cellCountX="10"
        launcher:cellCountY="6"

    2、或者不想改数目:

    <packagesappsLauncher2srccomandroidlauncher2AppsCustomizeTabHost.java>

        protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {

              mTabs.getLayoutParams().width = contentWidth   + 108;

    3、workspace、AppsCustomize的cell大小:

    <packagesappsLauncher2 esvalues-sw600dpdimens.xml>

        <dimen name="workspace_cell_width">110dip</dimen>
        <dimen name="workspace_cell_height">110dip</dimen>

        <dimen name="apps_customize_cell_width">110dp</dimen>
        <dimen name="apps_customize_cell_height">110dp</dimen>


    4、里面icon的大小:

    <packagesappsLauncher2 esvalues-sw600dpdimens.xml>

         <dimen name="app_icon_size">80dp</dimen>

    5、workspace没有拖动,第二页第一个icon出现在第一页的最右边:

    加大workspace的宽度,或间距:

    workspace的paddingLeft、paddingRight:

    <packagesappsLauncher2 esvalues-sw600dp-landdimens.xml>

        <dimen name="workspace_left_padding">50dip</dimen>
        <dimen name="workspace_right_padding">50dip</dimen>

    workspace两屏间距:

    <dimen name="workspace_page_spacing">100dp</dimen>

    修改workspace的字体大小:

    如果没有就添加:

    <packagesappsLauncher2 esvalues-sw480dpstyles.xml>

        <style name="WorkspaceIcon.Landscape">

            <item name="android:textSize">13sp</item>

        </style>

    6、加wallpaper:

    1.<packagesappsLauncher2 esvalues-sw600dpwallpapers.xml>

       加wallpaper的名字

    2.<packagesappsLauncher2 esdrawable-nodpi>

       加如wallpaper

    7、gallery的widget默认添加到workspace上:

    <packagesappsLauncher2 esxmldefault_workspace.xml>

        <!-- Middle screen [2] -->
        <appwidget
            launcher:packageName="com.android.gallery3d"
            launcher:className="com.android.gallery3d.gadget.PhotoAppWidgetProvider"
            launcher:screen="2"
            launcher:x="1"
            launcher:y="0"
            launcher:spanX="3"
            launcher:spanY="3" />

    <packagesappsGallery2srccomandroidgallery3dgadgetPhotoAppWidgetProvider.java>

        @Override
        public void onUpdate(Context context,  
                for (int id : appWidgetIds) {
                    if(id == 2){ 

                        helper.setWidget(id,WidgetDatabaseHelper.TYPE_SHUFFLE, null);                  
                    }
            
        }

    8、在桌面上添加网页的快捷方式:

    <packagesappsLauncher2 esxmldefault_workspace.xml> 

        <shortcut

            launcher:title="@string/application_name"
            launcher:icon="@drawable/ic_no_applications"
            launcher:uri="http://www.aaa.com"
            launcher:screen="0"
            launcher:x="0"
            launcher:y="3" />

    9、在桌面上默认放文件夹:

    <packagesappsLauncher2 esxmldefault_workspace.xml>

         <folder
              launcher:screen="2"
              launcher:x="2"
              launcher:y="2"
              launcher:title = "@string/application_name" >
             
             
         <favorite
              launcher:className="com.android.deskclock.DeskClock"
              launcher:packageName="com.android.deskclock"
              launcher:container="1"
              launcher:x="0"
              launcher:y="0" />

         <favorite
              launcher:className="com.android.calculator2.Calculator"
              launcher:packageName="com.android.calculator2"
              launcher:container="1"
              launcher:x="0"
              launcher:y="0" />
        
         </folder>    

    10、桌面上添加快捷方式,点击播放视频:

    <packagesappsLauncher2 esxml-sw720dpdefault_workspace.xml>

     <shortcut launcher:title="@string/application_name" 

    launcher:icon="@drawable/ic_launcher_application" 

    launcher:uri="file:///mnt/sdcard/external_sdcard/1...playermenu;end

    launcher:screen="2" 

       launcher:x="1" 

    launcher:y="1" />

    11、安装apk,显示隐藏的google play:

    1.写google显示的apk:

    GooglePlayShow的activity:

            ComponentName componentname = new ComponentName("com.android.vending", "com.android.vending.AssetBrowserActivity");
            packagemanager.setComponentEnabledSetting(componentname, 1, 1);
             
            componentname = new ComponentName("com.example.googleplayshow", "com.example.googleplayshow.MainActivity");
            packagemanager.setComponentEnabledSetting(componentname, 2, 1);

    2.<packagesappsLauncher2srccomandroidlauncher2LauncherModel.java>

                } else if (Intent.ACTION_PACKAGE_ADDED.equals(action)) {
                    if (!replacing) {
                             if(packageName.equals("com.example.googleplayshow")){
                                  context.startActivity(new Intent().setComponent(new ComponentName("com.example.googleplayshow", "com.example.googleplayshow.MainActivity")).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
                             }

                        op = PackageUpdatedTask.OP_ADD;
                    } else {
                        op = PackageUpdatedTask.OP_UPDATE;
                    }
                }

    隐藏google search:

    <packagesappsLauncher2srccomandroidlauncher2Launcher.java>

        private void setupViews() {

            mSearchDropTargetBar = (SearchDropTargetBar) mDragLayer.findViewById(R.id.qsb_bar);
            mSearchDropTargetBar.hideSearchBar(false);

        void showWorkspace(boolean animated, Runnable onCompleteRunnable) {

            //mSearchDropTargetBar.showSearchBar(wasInSpringLoadedMode);

    12、widget中隐藏google play:

    <packagesappsLauncher2srccomandroidlauncher2AppsCustomizePagedView.java>

    updatePackages里面添加:

    if(!widget.provider.getPackageName().equals("com.android.vending") && !widget.provider.getPackageName().equals("com.android.vending.MarketWidgetProvider")){

        mWidgets.add(widget);

    }

    13、clock的widget下部分显示不全,向上调

    <packagesamlogicLauncher2 esvaluesdimens.xml>

    <dimen name="app_widget_preview_padding_top">10dp</dimen>

    修改widget的text的size:

    <packagesamlogicLauncher2 eslayoutapps_customize_widget.xml>

      <TextView xmlns:android="http://schemas.android.com/apk/res/android"

         android:id="@+id/widget_name"

         android:textSize="20sp" />

    14、launcher中隐藏一个app:

    需要该app的packageName,例如要隐藏settings:

    <packagesappsLauncher2srccomandroidlauncher2LauncherModel.java>

            private void loadAllAppsByBatch() { 

                        apps = packageManager.queryIntentActivities(mainIntent, 0); 

                        ResolveInfo removeApp = null;

                        for(ResolveInfo info:apps){

                            if(info.activityInfo.packageName.equals("com.android.settings")){

                                    removeApp = info;

                            }

     

                        }

     

                        if(removeApp != null){

                            apps.remove(removeApp);

                        }

    15、launcher中隐藏多个app: 红色为改动部分

    <packagesappsLauncher2srccomandroidlauncher2LauncherModel.java>

          private void loadAllAppsByBatch() {  

       final PackageManager packageManager = mContext.getPackageManager();

                List<ResolveInfo> apps = new ArrayList<ResolveInfo>();

                List<ResolveInfo> allApps = null;

                int N = Integer.MAX_VALUE;

                int startIndex;

                int i=0;

                int batchSize = -1;

                while (i < N && !mStopped) {

                    if (i == 0) {

                        mAllAppsList.clear();

                        final long qiaTime = DEBUG_LOADERS ? SystemClock.uptimeMillis() : 0;

                        allApps = packageManager.queryIntentActivities(mainIntent, 0);

                        for(ResolveInfo info : allApps){

                            if(info.activityInfo != null 

                                    && !info.activityInfo.packageName.equalsIgnoreCase("com.android.email")

                                    && !info.activityInfo.packageName.equalsIgnoreCase("com.android.providers.downloads.ui")

                                    && !info.activityInfo.packageName.equalsIgnoreCase("com.adobe.flashplayer")){

                                apps.add(info);

                            }

                        }


    settings 问题总结:

    1.入口,设置分屏显示

    frameworksasecore es esvaluesools.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设置的:

    <frameworksaseservicesjavacomandroidserveramActivityManagerService.java>

    mConfiguration.setToDefaults();

    fontScale = Float.parseFloat(SystemProperties.get("ro.fontScale","1"));

    4.settings的theme:

    <packagesappsSettingsAndroidManifest.xml>

        <application android:label="@string/settings_label"
                android:icon="@mipmap/ic_launcher_settings"
                android:taskAffinity=""
                android:theme="@android :style/Theme.Holo"
                android:uiOptions="splitActionBarWhenNarrow"
                android:hardwareAccelerated="true">

    <frameworksasecore es esvalues hemes.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 中选项默认值一般存在于 frameworksasepackagesSettingsProvider esvaluesdefaults.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/notifications 修改方法同上)

    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/permissions/tablet_core_hardware.xml
    frameworks/native/data/etc/android.hardware.wifi.xml:system/etc/permissions/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 为例

    在 packagesappsSettings eslayoutwidget.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:orientation="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. 修改浏览器默认浏览器模式

    packagesappsBrowser esxml-sw600dpadvanced_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:uri="http://www.google.com/"

            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坐标数字时钟被遮住

    请调整红色的数字:

     
    <frameworksasecore es eslayout-sw600dpkeyguard_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上修改默认字体大小:

      比如改成大:

      <frameworksasepackagesSettingsProvider esvaluesdefaults.xml>

    <fraction name="def_font_scale">115%</fraction>

    11.没有蓝牙的平台,去掉窗口小部件-设置快捷方式-拉到桌面显示的“蓝牙”选项

    <packagesappsSettingssrccomandroidsettingsOutputSettingsBroadcastReceiver.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. 修改 浏览器的默认标签

    分别在一下资源文件中添加自定义的标签

    packagesappsBrowser esvaluesstrings.xml

    <string-array name="bookmarks" translatable="false">

            <item>Google</item>

            <item>http://www.google.com/</item>

            <item>Picasa</item>

            <item>http://picasaweb.google.com/</item>

            <item>Yahoo!</item>

            <item>http://www.yahoo.com/</item>

            <item>MSN</item>

            <item>http://www.msn.com/</item>

            <item>Twitter</item>

            <item>http://twitter.com/</item>

            <item>Facebook</item>

            <item>http://www.facebook.com/</item>

            <item>Wikipedia</item>

            <item>http://www.wikipedia.org/</item>

            <item>eBay</item>

            <item>http://www.ebay.com/</item>

            <item>CNN</item>

            <item>http://www.cnn.com/</item>

            <item>NY Times</item>

            <item>http://www.nytimes.com/</item>

            <item>ESPN</item>

            <item>http://espn.com/</item>

            <item>Amazon</item>

            <item>http://www.amazon.com/</item>

            <item>Weather Channel</item>

            <item>http://www.weather.com/</item>

            <item>BBC</item>

            <item>http://www.bbc.co.uk/</item>

        </string-array>

    packagesappsBrowser esvaluesookmarks_icons.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>
    对应的图片在 packagesappsBrowser es aw

    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_descriptions_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_descriptions_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. 休眠策略

    修改默认的休眠策略,请参考

    frameworksasepackagesSettingsProvider esvaluesdefaults.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);    

      packagesamlogicLauncher2srccomandroidlauncher2Launcher.java

             mStateAnimation.addListener(new AnimatorListenerAdapter() {

                    boolean animationCancelled = false;

                    @Override

                    public void onAnimationStart(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.1frameworksasecorejavaandroidappNativeActivity.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拷贝到packagesamlogic下面解压   将需要预装安装的apk拷贝到preinstallation目录下面,编辑里面的preinstall.sh文件内容如下:

    #!/system/xbin/busybox sh

    echo "do preinstall applications"

    # 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

    。。。。。。

    然后在deviceamlogiccommoninit abletinit.amlogic.rc 中,启动预安装脚本的服务.

    MX:

    service preinstall /system/bin/preinstall.sh

             class main

             user root

             group root

             oneshot

             console

             disabled     

    M3:

    service preinstall /system/bin/preinstall.sh

    user root

            group root

            disabled

            oneshot

    在init.amlogic.rc最后一行加上

    start preinstall

    16. 去掉 hotspot

    把红色的部分删掉

    deviceamlogicgXXXXoverlayframeworksasecore es esvaluesconfig.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>

    17.桌面上添加快捷方式,点击播放视频:

    <packagesappsLauncher2 esxml-sw720dpdefault_workspace.xml>

     <shortcut

    launcher:title="@string/application_name"

    launcher:icon="@drawable/ic_launcher_application" launcher:uri="file:///mnt/sdcard/external_sdcard/1...playermenu;end"

    launcher:screen="2" launcher:x="1" launcher:y="1" />

    添加网页的快捷方式:

    <packagesappsLauncher2 esxml-sw720dpdefault_workspace.xml> 

        <shortcut

            launcher:title="@string/application_name"
            launcher:icon="@drawable/ic_no_applications"
            launcher:uri="http://www.aaa.com"
            launcher:screen="0"
            launcher:x="0"
            launcher:y="3" />

    18.去掉camera的全景icon:

    4.1:

    <packagesappsCamera eslayout-sw600dp-landmode_picker.xml>

            <com.android.camera.ui.RotateImageView android:id="@+id/mode_panorama"

                    android:contentDescription="@string/accessibility_switch_to_panorama"

                    android:layout_width="match_parent"

                    android:layout_height="wrap_content"

                    android:layout_weight="1"

    android:visibility="gone"

                    android:scaleType="center"

                    android:background="@drawable/bg_pressed"

                    android:src="@drawable/ic_switch_pan_holo_light" />

    4.2:

    <packagesappsCamerasrccomandroidcameraCameraActivity.java>

    加上红色加亮的地方:

        public void init() {

            for (int i = 0; i < mDrawables.length; i++) {

                if ((i == LIGHTCYCLE_MODULE_INDEX && !LightCycleHelper.hasLightCycleCapture(this))||i == PANORAMA_MODULE_INDEX) {

                    continue; // not enabled, so don't add to UI

                }

                drawids[ix++] = DRAW_IDS[i];

            }

    <packagesappsCamerasrccomandroidcameraCameraActivity.java>

        public void init() {

            int[] drawids = new int[LightCycleHelper.hasLightCycleCapture(this)

                                    ? DRAW_IDS.length -1 : DRAW_IDS.length - 2];

    19.锁屏左边clock太大显示不全:

    <frameworksasecore es eslayout-sw600dpkeyguard_screen_status_land.xml>

            <TextView android:id="@+id/timeDisplayBackground"

    android:textSize="@dimen/keyguard_pattern_unlock_clock_font_size"

    <TextView android:id="@+id/timeDisplayForeground"

    android:textSize="@dimen/keyguard_pattern_unlock_clock_font_size"

    //dimens.xml里的keyguard_pattern_unlock_clock_font_size调小

    可以把clock调成居中显示,不要靠右,造成右边显示不全

    <LinearLayout

            xmlns:android="http://schemas.android.com/apk/res/android"

            android:orientation="vertical"

            android:layout_width="wrap_content"

            android:layout_height="wrap_content"

            android:gravity="right">

    //改成center

    20. 去掉settings的battery里面的mobile network signal显示

    加上红色语句:

    <packagesappsSettingssrccomandroidsettingsfuelgaugeBatteryHistoryChart.java>

            if (!com.android.settings.Utils.isWifiOnly(getContext())) {

                mHavePhoneSignal = true;

            }

            mHavePhoneSignal = false;      

    21. 去掉待机的CRT动画

    把自己项目overlay中的

    frameworks/base/core/res/res/values/config.xml

    <bool name="config_animateScreenLights">false</bool> 删掉 就可以了


    22. 添加格式化内部sdcard

    jb4.1packagesamlogicSettingssrccomandroidsettingsdeviceinfoStorageVolumePreferenceCategory.java

           public StorageVolumePreferenceCategory(Context context, Resources resources, StorageVolume storageVolume, StorageManager storageManager, boolean isPrimary) {

    // Cannot format emulated storage

            mAllowFormat = mStorageVolume != null && !mStorageVolume.isEmulated()&&mStorageVolume.isRemovable();

            // For now we are disabling reformatting secondary external storage

            // until some interoperability problems with MTP are fixed

            //if (!isPrimary) mAllowFormat = false;

          

    +        if(mStorageVolume != null && mStorageVolume.getPath().equals("/storage/sdcard0")){

    +            mAllowFormat = true;

    +        }

    23. 4.2 LockScreen 任何方向都可以解锁, 修改成只有向右才能解锁

    4.2 Lockscreen 对应的java 文件不再是 Lockscreen, 而是KeyguardSelectorView.java

    frameworks/base/core/res/res/values/arrays.xml b/core/res/res/values/arrays.xml

         <array name="lockscreen_targets_unlock_only">

             <item>@*android:drawable/ic_lockscreen_unlock</item>

    +       <item>@null</item>

    +       <item>@null</item>

    +       <item>@null</item>

         </array>

         <array name="lockscreen_target_descriptions_unlock_only">

             <item>@*android:string/description_target_unlock</item>

    +       <item>@null</item>

    +       <item>@null</item>

    +       <item>@null</item>

         </array>

    24.android 4.2改launcher里面的icon横排的数目:

    <packagesappsLauncher2 esvalues-sw720dpconfig.xml>

    <integer name="cell_count_x">7</integer>

    如果改成7,hotseat里面第8个icon不见了,可以往第8个槽里面放进去,但是重启后,icon又不见了,可以这样修改:

    <packagesappsLauncher2srccomandroidlauncher2LauncherModel.java>
                    final ItemInfo occupied[][][] =
                            new ItemInfo[Launcher.SCREEN_COUNT + 1][mCellCountX + 2][mCellCountY + 1]; //原来这里是+1

    25. 4.2 LockScreen 解锁界面四个方向添加一个setting入口

    frameworksasecore es esvalues/arrays.xml

        <array name="lockscreen_targets_with_camera">

            <item>@drawable/ic_lockscreen_unlock</item>

            <item>@drawable/ic_action_assist_generic</item>

            <item>@drawable/ic_lockscreen_camera</item>

            <item>@drawable/ic_lockscreen_settings</item>

        </array>

    在 frameworksasecore es esdrawable 增加 ic_lockscreen_settings.xml 文件 并添加 ic_lockscreen_settings_normal.phg ic_lockscreen_settings_activated.png 资源文件

    <selector xmlns:android="http://schemas.android.com/apk/res/android">

     <item

            android:state_enabled="true"

            android:state_active="false"

            android:state_focused="false"

            android:drawable="@drawable/ic_lockscreen_settings_normal" />

        <item

            android:state_enabled="true"

            android:state_active="true"

            android:state_focused="false"

            android:drawable="@drawable/ic_lockscreen_settings_activated" />

        <item

            android:state_enabled="true"

            android:state_active="false"

            android:state_focused="true"

            android:drawable="@drawable/ic_lockscreen_settings_activated" />

    </selector>


     frameworksasepolicysrccomandroidinternalpolicyimplLockScreen.java

         public void onTrigger(View v, int target) {

                final int resId = mGlowPadView.getResourceIdForTarget(target);

                switch (resId) {

                   

                     case com.android.internal.R.drawable.ic_lockscreen_settings: //启动setting 应用

                        launchActivity(new Intent().setComponent(new ComponentName("com.android.settings","com.android.settings.Settings")));   

                        mCallback.pokeWakelock();

                        break;

    26. 4.2 上隐藏 Wifi Display 

      去掉项目overlay/frameworks/base/core/res/res/config.xml 中的config_enableWifiDisplay 

    27. 默认音量修改

    frameworks/base/media/java/android/media/AudioService.java

    private final int[] MAX_STREAM_VOLUME = new int[] {

            5,  // STREAM_VOICE_CALL

            7,  // STREAM_SYSTEM

            7,  // STREAM_RING

            15, // STREAM_MUSIC

            7,  // STREAM_ALARM

            7,  // STREAM_NOTIFICATION

            15, // STREAM_BLUETOOTH_SCO

            7,  // STREAM_SYSTEM_ENFORCED

            15, // STREAM_DTMF

            15  // STREAM_TTS

        };

    frameworks/base/media/java/android/media/AudioManager.java

    /**  @hide  Default volume index values for audio streams */

        public static final int[] DEFAULT_STREAM_VOLUME = new int[] {

            4,  // STREAM_VOICE_CALL

            7,  // STREAM_SYSTEM

            5,  // STREAM_RING

            11, // STREAM_MUSIC

            6,  // STREAM_ALARM

            5,  // STREAM_NOTIFICATION

            7,  // STREAM_BLUETOOTH_SCO

            7,  // STREAM_SYSTEM_ENFORCED

            11, // STREAM_DTMF

            11  // STREAM_TTS

        };

    28.widget中隐藏google play:

    <packagesappsLauncher2srccomandroidlauncher2AppsCustomizePagedView.java>

    updatePackages里面添加:

    if(!widget.provider.getPackageName().equals("com.android.vending") && !widget.provider.getPackageName().equals("com.android.vending.MarketWidgetProvider")){

        mWidgets.add(widget);

    }

    29.去掉设置-->显示-->亮度里的“自动调整亮度”选项

    <packagesappsSettings eslayoutpreference_dialog_brightness.xml>

            <CheckBox android:id="@+id/automatic_mode"

    加上

        android:visibility="invisible"

    30.设置-位置信息访问权限默认关闭

    <frameworksasepackagesSettingsProvider esvaluesdefaults.xml>

    <string name="def_location_providers_allowed" translatable="false"></string>

    这里不要填写gps或者network,清空

    31.设置-安全-验证应用默认不勾允

    <frameworksasepackagesSettingsProvider esvaluesdefaults.xml>

    <bool name="def_package_verifier_enable">false</bool>

    32.设置-声音-触摸提示音与锁屏提示音默认不勾允状态

    <frameworksasepackagesSettingsProvider esvaluesdefaults.xml>

    <integer name="def_lockscreen_sounds_enabled">0</integer>

    <bool name="def_sound_effects_enabled">false</bool>

    33.设置-以太网菜单请移动“更多”菜单下

    请用附件ethernet.patch,开关是ro.ethernet.more,设置为true,ethernet移到more里面

    在settings的git下打这个patch

    34.窗口小部件“指针时钟”显示不全

    把clock的widget向上调,下面的值改小:

    <packagesamlogicLauncher2 esvaluesdimens.xml>

    <dimen name="app_widget_preview_padding_top">10dp</dimen>

    35.去掉settings的more里面的网络共享与便携式热点

    ro.tether.denied=true

    36.平台主界面底部工具栏上的图标全部居中显示,从左至右的图标依次为:vol-、back、home、窗口切换、vol+

    1.在prop里面将ro.statusbar.volume设置为true

    2.<frameworksasepackagesSystemUI eslayout-sw600dp avigation_bar.xml>

    <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/sub"

    ……

    />

    这段放到

    <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/back"

    ……

    />

    这段之前

    <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/add"

    ……

    />

    这段放到

    <com.android.systemui.statusbar.policy.KeyButtonView

    android:id="@+id/recent_apps"

    ……

    />

    这段之后

    注意这个文件有两处需要调换上面的

    37.主界面模拟时钟改成数字时钟

    default_workspace.xml里面加上:

    <appwidget

        launcher:packageName="com.android.deskclock"

        launcher:className="com.android.alarmclock.DigitalAppWidgetProvider"

    38、settings中的developer options的开关打开,debug关掉:

    <frameworksasepackagesSettingsProvidersrccomandroidproviderssettingsDatabaseHelper.java>

        private void loadSecureSettings(SQLiteDatabase db) {

           loadSetting(stmt, Settings.Secure.ADB_ENABLED, 0);
           loadSetting(stmt, Settings.Secure.DEVELOPMENT_SETTINGS_ENABLED, 1);

    39、改桌面icon行、列数:

    <packagesappsLauncher2 eslayout-sw***dpworkspace.xml>

        launcher:cellCountX="10"

        launcher:cellCountY="6"

    40、more里面morebile data项默认不选:

    1.<frameworksasepackagesSettingsProvidersrccomandroidproviderssettingsDatabaseHelper.java>

        private void loadSecureSettings(SQLiteDatabase db) {

            SQLiteStatement stmt = null;

            try {

                stmt = db.compileStatement("INSERT OR IGNORE INTO secure(name,value)"

                        + " VALUES(?,?);");

    添加:

                loadIntegerSetting(stmt, Settings.Secure.MOBILE_DATA,

                        R.integer.def_mobile_data);

    2.<frameworksasepackagesSettingsProvider esvaluesdefaults.xml>

    <integer name="def_mobile_data">0</integer>

    41.secure的unknown的设置默认打开:

    <frameworksasepackagesSettingsProvider esvaluesdefaults.xml>

       <bool name="def_install_non_market_apps">true</bool>

    42、修改app list的背景:

    <packagesappsLauncher2 eslayoutapps_customize_pane.xml>

    <com.android.launcher2.AppsCustomizeTabHost

        xmlns:android="http://schemas.android.com/apk/res/android"

        xmlns:launcher="http://schemas.android.com/apk/res/c...droid.launcher"

        android:background="@drawable/wallpaper_03">

    43、bluetooth tethering的checkbox去掉:

    overlay里面的

     <frameworksasecore es esvaluesconfig.xml>

         <string-array translatable="false" name="config_tether_bluetooth_regexs">
            <item>"bt-pan"</item>
        </string-array> 

    去掉<item>"bt-pan"</item>

    44. Google play 不是内置, 而是安装,导致出问题的解决办法

    frameworks/baseservices/java/com/android/server/pm/PackageManagerService.java

    @@ -4594,6 +4594,9 @@ public class PackageManagerService extends IPackageManager.Stub {

                                 }

                             }

                         }

    +                   if (pkg.packageName.equals("com.android.vending")){

    +                       allowed = true;

    +                   }

                         if (!allowed && (bp.protectionLevel

                                 & PermissionInfo.PROTECTION_FLAG_DEVELOPMENT) != 0) {

                             // For development permissions, a development permission


    45.以太网设置问题

    以太网在settings.db中的条目是"eth_on", 默认值由系统属性 ro.ethernet.default_on 决定,

    ro.ethernet.default_on=false 默认关闭

    ro.ethernet.default_on=true默认打开

    不定义该属性默认关闭

    46.开机不停震动 
    手机开机,马达一直震动,应该是uboot正常启动后,没有设置震动关闭 
    解决:在震动200ms后关闭马达 
    u-boot/property/normal_mode.c 
    void normal_mode(void) 

    //MMU_Init(CONFIG_MMU_TABLE_ADDR); 
    vibrator_hw_init(); 


    set_vibrator(1); 
    udelay(200*1000); 
    set_vibrator(0); 
    ... 



    47.关机震动时间设置 
    frameworks/base/core/java/com/android/internal/app/ShutdownThread.java中 
    private static final int SHUTDOWN_VIBRATE_MS = 500;   //默认震动0.5秒,修改这个参数 




    48.设置系统默认音量 
    修改文件:frameworks/base/media/java/android/media/AudioManager.java 
    public static final int[] DEFAULT_STREAM_VOLUME = new int[] { 
             4,  // STREAM_VOICE_CALL 
             7,  // STREAM_SYSTEM 
             5,  // STREAM_RING 
             11, // STREAM_MUSIC 
             6,  // STREAM_ALARM 
             5,  // STREAM_NOTIFICATION 
             7,  // STREAM_BLUETOOTH_SCO 
             11, // STREAM_FM 
             11, // STREAM_DTMF 
             11, // STREAM_TTS 
             7  // STREAM_SYSTEM_ENFORCED 
         }; 
    根据需要进行修改即可。 
    注意:如果在3rdparty里面有同名文件最好一起修改。 


    49.如何调节音量档位 
    需要根据自己的情况来调整index to volume的算法。 
    相关实现的模块是 AudioPolicy。基类 AudioPolicyManagerBase 文件位于 
    framework/base/services/audioflinger/AudioPolicyManagerBase.cpp 
    实现类 AudioPolicyManagerALSA,位于 
    external/sprd/alsa/alsa_sound/AudioPolicyManagerALSA.cpp 
    函数 computeVolume: 
    这个方法平台目前没有用子类实现,所以走的是基类方法。如果客户需要修改,建议在子类中重载这 
    个方法。 
    再讲下基类方法: 
    1 通过 index 算出一个百分比; 
    2 通过这个百分比经过一个对数转换换成音量的百分比; 
    3 特殊情况的一些转换; 
    修改建议是子类的方法应该调用基类的方法并且做微调。 
    比如对 1,将 index 到百分比的对应关系略微修改。 
    比如对 3,可以把基类方法处理的结果在根据需要调整。 


    50.电池相关 
    若手机界面的电池进度条显示不够准确,请根据实际测试值调整kerneldrivers powercharge.c 的voltage_capacity_table表格中的值 15%对应的是低电告警电压,而0%是自动关机电压。 
    电池的报警电压调整:frameworksasecore es esvaluesconfig.xml, 
    config_lowBatteryWarningLevel:15----->百分比,可以动态调整该数值来调整低电电压。 
    过压保护的逻辑在: 
    Kerneldriverspowersprd_power.c里 
    charge_handler()函数中有个battery_data->over_voltage用于电压保护逻辑。 
    这个数值的来源是Kernelarcharmmach-sc8810includemachchg_drvapi.h 
    #define OVP_OVER_VOL 6500 


    51.修改系统默认时间: 
    修改idh.codekerneldrivers tc rtc-sprd.c 
    static int __init sprd_rtc_init(void) 

    ...... 
    sec_2011_to_1970 = mktime(2011, 1, 1, 0, 0, 0); 
    return 0; 

    mktime函数的参数即是修改点。 
    同时还要同步修改闹钟时间,否则闹钟会有问题。 
    packagesappsDeskClocksrccomandroiddeskclockAlarms.java 
    private static void alarm_flag_setup(final long alarmTimeInMillis) { 
    Calendar c = Calendar.getInstance(); 
    c.set(2011, 0, 1, 0, 0, 0);//注意这里月份是0代表1月 
    ...... 


    52.如何设置版本号 
    定义 android 版本号的地方在 build/tools/buildinfo.sh 内,可以修改此文件。 
    ro.build.display.id=$BUILD_DISPLAY_ID 改为 ro.build.display.id= $BUILD_D ISPLAY_ID_CUSTOM, 然 后 在customize/custom_cfg/proj_name/res/boardconfig.mk 
    下 定 义 宏BUILD_DISPLAY_ID_CUSTOM 就可以为自己的项目定义版本号. 
    显示硬件版本在设置->关于手机->硬件版本里看到: 
    packages/apps/Settings/res/xml/device_info_settings.xml 
    <Preference android:key="hardware_number" 
    style="?android:preferenceInformationStyle" 
    android:title="@string/hard_version" 
    android:summary="1.1.0"/> 


    53.无接近传感器,如何在开始通话后关闭屏幕 
    在 Phone 应用的 phoneApp 这个类中。找到下边这段代码: 
    mProximityWakeLock = 
    pm.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, LOG_TAG); 
    然后注释掉。这个是获取了接近传感器的 WakeLock。然后在 updatePokeLock 这个方法中。将 
    //pokeLockSetting |= LocalPowerManager.POKE_LOCK_MEDIUM_TIMEOUT; 
    改为 
    pokeLockSetting |= LocalPowerManager.POKE_LOCK_SHORT_TIMEOUT; 
    将updateWakeState 方法中 
    setScreenTimeout(ScreenTimeoutDuration.DEFAULT); 
    改为 
    setScreenTimeout(ScreenTimeoutDuration.SHORT); 
    这个是将默认延时时间设置为SHORT(5秒)。如果需要改为其他时间需要去改 setScreenTimeout 
    这个方法。 


    54.ms,mms,contact 容量限制 
    [适用版本]2.3.5 
    1.只要在容量允许的情况下,sms,mms 接收条数是没有限制的,但是每个会话的条数是有限 
    制的,默认情况下,每个会话的短信限存 200 条,彩信限存 20 条,但是能调整到 5000 条。 
    MmsConfig.java 代码中做了如下限制: 
    private static int mDefaultSMSMessagesPerThread = 200;// default value 
    private static int mMinMessageCountPerThread = 2; // default value 
    private static int mMaxMessageCountPerThread = 5000; // default value 
    private static int mDefaultMMSMessagesPerThread = 20; // default value 
    2.contact 的记录总数目前没有限制。 


    55.单摄像头进入时间较长如何解决 
    在customize/customer_cfg/project.../kernel/camera/camera_cfg.c中main_sensor_infor_tab和sub_sensor_infor_tab里会放很多sensor的结构体;camera启动初始化时,底层驱动会匹配相关的菜单,删除没有的sensor,能加快启动 


    56.客户定制开/关机铃声 
    开机:替换 3rdparty/anim/poweranim/special/bin/startupsound 
    关机:替换 3rdparty/anim/poweranim/special/bin/shutdownsound 
    注:这里的startupsound/shutdownsound可以是mp3或者ogg格式的,替换时不需要扩展名 


    57.背光亮度,静音等默认值修改 
    修改frameworksasepackagesSettingsProvider esvaluesdefaults.xml中的默认值即可。 


    58.浏览器如何修改内置的“搜索引擎” 
    修改packagesappsrowser esvaluesdonoottranslate-search_engines,xml文件,中 
    “search_engines”的string-arry中的item项即可。如下事例为内置了 139/百度/google 三个搜索引 
    擎。 
    <item>search139</item> 
    <item>baidu</item> 
    </string-array> 
    <item>google</item> 
    <string-array name="search_engines" translatable="false"> 
    注意:如果支持多种语言,其他文件下的同名文件donoottranslate-search_engines,xml也需要 
    修改。 


    59.关机充电动画修改 
    关机充电动画的资源路径是: 
    external/sprd/charge/res/images/(展讯平台) 
    将这个目录下的 png 图片文件修改客户需要的文件就可以了。 


    60.如何设置默认动态壁纸 
    找到 /frameworks/base/core/res/res/values/config.xml 文件中 
    <string name="default_wallpaper_component">@null</string> 
    为设置默认壁纸的代码如若想要更换成为动态壁纸。只需将“@null”更改为动态壁纸的路径即可,例如:将默认壁纸更改为“线性光幕效果”的动态壁纸,则更改成如下代码: 
    <string name="default_wallpaper_component">com.android.wallpaper/com.android.wallpaper.nexus.NexusWallpaper</string>
    com.android.wallpaper 在 AndroidManifest 文件中的 packagename 
    com.android.wallpaper.nexus.NexusWallpaper 在 AndroidManifest 文件中的 service name 
    需要注意的是:静态的图片壁纸和 live wallpaper 是两个系统,加载的时候是完全两套机制,静态图片 
    通过 launcher 里面的一个 xml 文件配置来管理系统默认静态壁纸,live wallpaper 则是通过 intent 机制向系统搜寻所有匹配 Activity,所以,这里的默认值为 null,而不是那个系统默认静态壁纸的地址,系统是读 config.xml 文件的设置,若为 null 才继续查找静态壁纸配置内容. 没有效果的话,恢复下出厂设置即可。 


    61.如何设置系统默认壁纸 
    如果只需要修改动态壁纸,替换 frameworks/base/core/res/res/drawable/default_wallpaper.jpg即可,或者在源码中修改对应 default_wallpaper地址。 


    62.关机菜单中如何添加重启选项 
    /frameworks/base/policy/src/com/android/internal/policy/impl/GlobalActions.java" 文件添加如下修改部分即可: 
    mItems = Lists.newArrayList( 
    // silent mode 
    mSilentModeToggle, 
    // next: airplane mode 
    mAirplaneModeOn, 
    new SinglePressAction( 
                             com.android.internal.R.drawable.ic_lock_power_off, 
                             R.string.global_action_power_off) { 
                         public void onPress() { 
               // shutdown by making sure radio and power are handled accordingly. 
                             ShutdownThread.shutdown(mContext, true); 
                         } 


                        public boolean showDuringKeyguard() { 
                             return true; 
                         } 


                        public boolean showBeforeProvisioning() { 
                             return true; 
                         } 
                     }, 
    // add for reboot 
    new SinglePressAction( 
              com.android.internal.R.drawable.ic_lock_power_off, //替换成相应的图 
              R.string.global_action_power_off) { //替换成相应的提示文字 
              public void onPress() { 
                ShutdownThread.reboot(mContext, null, true); 
              } 


             public boolean showDuringKeyguard() { 
                return true; 
              } 


             public boolean showBeforeProvisioning() { 
                return true; 
              } 
           }); 
    //end add 


    63.如何修改系统默认输入法 
    下面将以“谷歌拼音输入法”为例,进行解释和说明。 
    第一步 修改/frameworks/base/packages/SettingsProvider/res/values/defaults.xml 添加如下代码: 
    <string name="config_default_input_method" 
    translatable="false">com.android.inputmethod.pinyin/.PinyinIME</string> 


    com.android.inputmethod.pinyin 在 AndroidManifest 文件中的 packagename 
    .PinyinIME 在 AndroidManifest 文件中的service name 
    第二步:修改 
    /frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java 
    在 private void loadSecureSettings(SQLiteDatabase db) 方法中,添加如下代码: 
    loadStringSetting( stmt, Settings.Secure.DEFAULT_INPUT_METHOD, 
    R.string.config_default_input_method ); 


    64.如何在桌面预置应用程序图标 
    桌面预制的图标:是在 launcher2 的 default_workspace.xml中配置的,文件路径: 
    Launcher2 esxmldefault_workspace.xml 


    65.添加搜索引擎 
    以添加139搜索引擎为例 
    a) 在packages/apps/Browser/res/values/all_search_engines.xml 
    <string-array name="search139" translatable="false"> 
    <item>139</item> 
    <item></item> 
    <item>http://s.139.com/favicon.ico</item> 
    <item>http://s.139.com/search.do?q={searchTerms}&amp;category=downloadable|web|browseable&amp;tid=2123,2124,2125,2126&amp;fr=portalcustom2</item>
    <item>UTF-8</item> 
    <item></item> 
    </string-array> 
    这6个<item>从上到下依次表示显示标签,关键字,搜索图标,搜索引擎地址,编码方式,搜索提示地址。 
    b) 在packages/apps/Browser/res/values/donottranslate-search_engines.xml 
    <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> 
    <string-array name="search_engines" translatable="false"> 
    <item>search139</item> 
    <item>baidu</item> 
    <item>google</item> 
    <item>yahoo</item> 
    <item>bing</item> 
    </string-array> 
    </resources> 
    在这边将139搜索引擎添加进来。 
    这边添加的搜索引擎是将1中的添加的搜索引擎变成设置中选择搜索引擎的选项。 


    66.修改 idle 界面搜索引擎的链接地址 
    packages/apps/quicksearchbox/res/values/strings.xml 下修改: 
    www.google.com为www.google.com.hk 


    67.linux下ADB安装后增加设备权限: 
    /etc/udev/rules.d/51-Android.rules 
    SUBSYSTEM=="usb", SYSFS{"huawei"}=="12d1", MODE="0666"   //华为设备号 
    SUBSYSTEM=="usb", SYSFS{"Samsung"}=="04e8", MODE="0666"  //三星设备号




  • 相关阅读:
    通过避免下列 10 个常见 ASP.NET 缺陷使网站平稳运行 from MSDN
    编写自己的dojo扩展zt
    Adding an IE7 Browser Template for use by Web Tests
    MAC地址与IP地址绑定策略的破解zt
    .net 中string 的应用特点(转贴)让我豁然开朗
    全国最佳医院排名(供参考)
    小心你的Page_Load重复执行(转贴)
    A780知识总汇zt
    [Quoted] Writing HighPerformance Managed Applications : A Primer
    [网络摘录学习]常用的Linux系统监控命令
  • 原文地址:https://www.cnblogs.com/liulaolaiu/p/11744527.html
Copyright © 2011-2022 走看看