android系统默认值的设置


 

1开机图片:

  android-logo-mask.png
  android-logo-shine.png
  这两个图片一个在上一个在下
  ./out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/classes/assets/images/android-logo-shine.png
  ./frameworks/base/core/res/assets/images/android-logo-shine.png
  注意:如果源码没有make可以直接更改frameworks里的的图片就可以了
  然后直接make否则必须全更改并且不能make只能make firmwar

2默认开机墙纸的位置:
  default_wallpaper.jpg
  ./out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/classes/res/drawable/default_wallpaper.jpg
  ./frameworks/base/core/res/res/drawable/default_wallpaper.jpg
  注意:这个设置和上面的一样这俩个都不能更改文件名
  3更改PC机器删除硬件的文字kernel中
  drivers/usb/gadget/f_mass_storage.c
  fsg->vendor = "XXXXXXXXXXXXX";

4更改卷标:
  bootable/recovery/etc/init.rc
  setprop UserVolumeLabel "XXXXXXXXXXXXX"
  直接打包

5修改屏幕锁:
  (1)
  frameworks/base/packages/SettingsProvider/res/values/defaults.xml
  60000
  60000改成想要的时间如果是不锁为-1
  (2)
  frameworks/policies/base/phone/com/android/internal/policy/impl/KeyguardViewMediator.java
  private boolean mExternallyEnabled = true;
  将其修改成false
  这样更改就不会再进入休眠状态了

6初始化语言:
  参考下篇文章

7设定初始化主页:
  package/app/Browser/res/values/String.xml
  655行
  后面的应该是书签里的  

8设定亮度0~255:
  frameworks/base/packages/SettingsProvider/res/values/defaults.xml
  def_screen_brightness-->这个值初始化好像是100多

9音量:
  frameworks/base/media/java/android/media/AudioManager.java
  数组DEFAULT_STREAM_VOLUME第4个值(最大我设置到30但是还是差2格才到最大--默认是11
  建议将数组里的所有的数值都设为最大就OK了)
  mm frameworks/base

       AudioService.Java中定义了每一种音频流的最大音量级别:

[java] view plain copy
  1. /** @hide Maximum volume index values for audio streams */   
  2.     private int[] MAX_STREAM_VOLUME = new int[] {   
  3.         5 // STREAM_VOICE_CALL   
  4.         7 // STREAM_SYSTEM   
  5.         7 // STREAM_RING   
  6.         15, // STREAM_MUSIC   
  7.         7 // STREAM_ALARM   
  8.         7 // STREAM_NOTIFICATION   
  9.         15, // STREAM_BLUETOOTH_SCO   
  10.         7 // STREAM_SYSTEM_ENFORCED   
  11.         15, // STREAM_DTMF   
  12.         15  // STREAM_TTS   
  13.     };   


10设置Google帐户,左上角提示“正在设置RK2818SDK”,要求改成“正在设置W9”:
  out\target\product\sdkDemo\root 中default.prop文件第13行
      ro.product.model=rk2818sdk  改为 ro.product.model=W9

11录音没有小时显示。要求增加:
   packages\apps\SoundRecorder\src\com\android\soundrecorder
      (1)SoundRecorder.java中: private void updateTimerView()
       把 String timeStr = String.format(mTimerFormat, time/60, time%60);       
       改为:long hour=time/3600;
           String timeStr = String.format(mTimerFormat, hour, (time-hour*3600)/60, time%60);
      (2)  \res\values中strings.xml改为:
           %02d:%02d:%02d

12去掉Bluetooth:
      (主界面->添加文件夹->Bluetooth received)
       ic_launcher_folder_bluetooth.png(72*72):
        在\packages\apps\Bluetooth\res\drawable-hdpi
        解决方法:删除\out\target\product\sdkDemo\system\app下的Bluetooth.apk

13充电锁屏时图片:
      frameworks\base\core\res\res\drawable-hdpi:ic_lock_idle_charging.png

14去掉锁屏时显示充电百分比在:
      frameworks\base\core\res\res\values-zh-rCN中strings.xml 的lockscreen_plugged_in 括号中的内容及括号 !!

15去掉动态桌面背景选项:
      packages\wallpapers\Basic 中AndroidManifest.xml的这些,如星系注释掉如下这些:
                                    android:label="@string/wallpaper_galaxy"
                   android:name="com.android.wallpaper.galaxy.GalaxyWallpaper"
                   android:permission="android.permission.BIND_WALLPAPER">
                   
                      
                   

                  
                 

16更改版本号:
    build/core/Makefile
    79行
    RK_VER := xxx
17更改界面布局
  位置:package/app/Launcher2/res/xml/default_workspace.xml
  注意:adb shell 里当你点击任意的一个apk的时候,在后台会输出
  I/ActivityManager(  728): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000     cmp=com.estrongs.android.pop/.view.FileExplorerActivity bnds=[294,373][393,478] }
I/WindowManager(  728): Setting rotation to 1, animFlags=0
      看蓝色的部分就可以找到/前是包名/后面是类名-->这个是在default_workspace.xml里面需要用到的
  launcher:packageName="com.android.browser"            
      launcher:className="com.android.browser.BrowserActivity"
18如何将pdf类的文件放到桌面上
  客户要求将他们自己制作的pdf帮助文档放置到桌面上使客人可以直接点击就浏览
    String urlString = "/system/app/Nvsbl P4Dv2 English Manual.pdf";
        Intent intent = new Intent();
        intent.setAction(android.content.Intent.ACTION_VIEW);
        intent.setDataAndType(Uri.fromFile(new File(urlString)),"application/pdf");
        startActivity(intent);
        finish();
   解释下:
   首先将pdf文档放到out/target/product/sdkDemo/system/app下
   将固定地址给出urlString,使用Intent
   intent.setAction(android.content.Intent.ACTION_VIEW);启动View
   intent.setDataAndType(Uri.fromFile(new File(urlString)),"application/pdf");   
   application/pdf可以指定别的格式包括音频,视频,图片等等但是没有试过有需要可以试试
   注意:这个方法很不到如果只放置一些图片还可以但是如果放置文件比较大那么打包出来的
   system.img文件会很大也就是占用本身的系统内存----->所以不推荐使用!!!!!!!!!!!
19.发现PIN解锁界面出现5秒之后就会自动进入睡眠,之后将无法再次解锁。目前解决方法:
  修改文件 frameworks\policies\base\phone\com\android\internal\policy\impl\KeyguardViewMediator.java

将如下这行:
protected static final int AWAKE_INTERVAL_DEFAULT_MS = 5000;
修改为:
protected static final int AWAKE_INTERVAL_DEFAULT_MS = 1000 * 60 * 5;

 

 

Launcher 总结:

 

1、launcher的布局太居中,要想两边拉伸
<\packages\apps\Launcher2\res\values\dimens.xml>
    40dp
    40dp
apps tab栏的宽度( Launcher2 icon 数目、大小)
\packages\apps\Launcher2\res\layout-sw720dp\workspace.xml>
    launcher:cellCountX="10"
    launcher:cellCountY="6"
2、或者不想改数目:
<\packages\apps\Launcher2\src\com\android\launcher2\AppsCustomizeTabHost.java>
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
          mTabs.getLayoutParams().width = contentWidth + 108;
3、workspace、AppsCustomize的cell大小:
<\packages\apps\Launcher2\res\values-sw600dp\dimens.xml>
    110dip
    110dip
    110dp
    110dp

4、里面icon的大小:
<\packages\apps\Launcher2\res\values-sw600dp\dimens.xml>
     80dp
5、workspace没有拖动,第二页第一个icon出现在第一页的最右边:
加大workspace的宽度,或间距:
workspace的paddingLeft、paddingRight:
<\packages\apps\Launcher2\res\values-sw600dp-land\dimens.xml>
    50dip
    50dip
workspace两屏间距:
100dp
修改workspace的字体大小:
如果没有就添加:
<\packages\apps\Launcher2\res\values-sw480dp\styles.xml>
   
6、加wallpaper:
1.<\packages\apps\Launcher2\res\values-sw600dp\wallpapers.xml>
   加wallpaper的名字
2.<\packages\apps\Launcher2\res\drawable-nodpi>
   加如wallpaper
7、gallery的widget默认添加到workspace上:
<\packages\apps\Launcher2\res\xml\default_workspace.xml>
   
            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" />
<\packages\apps\Gallery2\src\com\android\gallery3d\gadget\PhotoAppWidgetProvider.java>
    @Override
    public void onUpdate(Context context, 
            for (int id : appWidgetIds) {
                if(id == 2){
                    helper.setWidget(id,WidgetDatabaseHelper.TYPE_SHUFFLE, null);                 
                }
       
    }
8、在桌面上添加网页的快捷方式:
<\packages\apps\Launcher2\res\xml\default_workspace.xml>
   
        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、在桌面上默认放文件夹:
<\packages\apps\Launcher2\res\xml\default_workspace.xml>
               launcher:screen="2"
          launcher:x="2"
          launcher:y="2"
          launcher:title = "@string/application_name" >
        
        
               launcher:className="com.android.deskclock.DeskClock"
          launcher:packageName="com.android.deskclock"
          launcher:container="1"
          launcher:x="0"
          launcher:y="0" />

               launcher:className="com.android.calculator2.Calculator"
          launcher:packageName="com.android.calculator2"
          launcher:container="1"
          launcher:x="0"
          launcher:y="0" />
   
    
   
10、桌面上添加快捷方式,点击播放视频:
<\packages\apps\Launcher2\res\xml-sw720dp\default_workspace.xml>
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.<\packages\apps\Launcher2\src\com\android\launcher2\LauncherModel.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:
<\packages\apps\Launcher2\src\com\android\launcher2\Launcher.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:
<\packages\apps\Launcher2\src\com\android\launcher2\AppsCustomizePagedView.java>
updatePackages里面添加:
if(!widget.provider.getPackageName().equals("com.android.vending") && !widget.provider.getPackageName().equals("com.android.vending.MarketWidgetProvider")){
    mWidgets.add(widget);
}
13、clock的widget下部分显示不全,向上调
<\packages\amlogic\Launcher2\res\values\dimens.xml>
10dp
修改widget的text的size:
<\packages\amlogic\Launcher2\res\layout\apps_customize_widget.xml>
 
     android:id="@+id/widget_name"
     android:textSize="20sp" />
14、launcher中隐藏一个app:
需要该app的packageName,例如要隐藏settings:
<\packages\apps\Launcher2\src\com\android\launcher2\LauncherModel.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: 红色为改动部分
<\packages\apps\Launcher2\src\com\android\launcher2\LauncherModel.java>
      private void loadAllAppsByBatch() { 
   final PackageManager packageManager = mContext.getPackageManager();
            List apps = new ArrayList();
            List 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.入口,设置分屏显示
frameworks\base\core\res\res\values\bools.xml 下的 preferences_prefer_dual_pane 为true.
true
2.top level headers--这里可以去掉左边的headers
private void updateHeaderList(List
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>
                android:icon="@mipmap/ic_launcher_settings"
            android:taskAffinity=""
            android:theme="@android:style/ Theme.Holo"
            android:uiOptions="splitActionBarWhenNarrow"
            android:hardwareAccelerated="true">
<\frameworks\base\core\res\res\values\themes.xml>