frameworks 开发一点总结

来源:互联网 发布:中俄贸易数据统计 编辑:程序博客网 时间:2024/06/10 04:40
// 紧急呼叫号码要求加入066和112,并要求通话记录里面有紧急电话记录 在注册文件中要加一个权限
/*

frameworks/base/telephony/java/android/telephony/PhoneNumberUtils.java

//注意:可能要加一个权限
        numbers = SystemProperties.get("ril.ecclist1");
        numbers += ",122,066,120";//add
        numbers = SystemProperties.get("ril.ecclist2");
        numbers += ",122,066,120";//add
        numbers = SystemProperties.get("ril.ecclist3");
        numbers += ",122,066,120";//add

          if (bSIMInserted) {
            if (mCustomizedEccList != null) {
                for (EccEntry eccEntry : mCustomizedEccList) {
                    if (!eccEntry.getCondition().equals(EccEntry.ECC_NO_SIM)) {
                        String ecc = eccEntry.getEcc();
                        numberPlus = ecc + "+";
                        if (ecc.equals(number)
                             || numberPlus.equals(number)) {
                            Rlog.d(LOG_TAG, "[isEmergencyNumber] match customized ecc list");
                            return true;
                        }
                    }
                }
            }

 } else {
            //add  for emergencyNumbers
            String []emergencyNumList = {"122", "066", "120"};
            int eccNo = emergencyNumList.length;
            String [] emergencyNumList_cdma = {"122", "066", "120"};
            eccNo = emergencyNumList_cdma.length;
            emergencyNumList = emergencyNumList_cdma;
    
            for (int i = 0; i < eccNo; i++) {
                numberPlus = emergencyNumList[i] + "+";
                if (emergencyNumList[i].equals(number)
                    || numberPlus.equals(number)) {
                    return true;
                }
            }

去掉 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: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)); 这一行。


去掉 Setting widget 中 某一项
以去掉 "网络共享与便携式热点" 为例
根据"网络共享与便携式热点" 这个关键词 在 values-zh_rCN 中搜索 到的 key值, 然后在AndroidManifest.xml 搜索这个 key值。 找到对于的Activity 配置
移除 <category android:name="com.android.settings.SHORTCUT" />  这一行。



系统自带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>

android 4.2改launcher里面的icon横排的数目:
<\packages\apps\Launcher2\res\values-sw720dp\config.xml>
<integer name="cell_count_x">7</integer>


4.2 LockScreen 解锁界面四个方向添加一个setting入口
frameworks\base\core\res\res\values/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>
 
在 frameworks\base\core\res\res\drawable 增加 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>

 frameworks\base\policy\src\com\android\internal\policy\impl\LockScreen.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;
  默认音量修改
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
    };

.来电闪光功能
frameworks/base/core/java/android/provider/Settings.java
frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
 packages/apps/Settings/src/com/android/settings/zf/LedIndicatorSettings.java
packages/apps/Settings/src/com/android/settings/SettingsActivity.java
packages/apps/Settings/res/drawable-hdpi/ic_setting_led.png
packages/apps/Settings/res/values/strings.xml
packages/apps/Settings/res/xml/dashboard_categories.xml
packages/apps/Settings/res/xml/zf_led_indicator_settings.xml



内置缅甸输入法  并默认

M       packages/apps/Launcher3/AndroidManifest.xml
    <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />加这一权限
M       packages/apps/Launcher3/src/com/android/launcher3/Launcher.java

        if(Settings.System.getInt(this.getContentResolver(), Settings.System.SWITCH_REBOOT, 1) == 1){
            if(FeatureOption.CUSTOM_PROJECT_C){
                //change inputmethod
                String myIME = "com.thihaayekyaw.frozenkeyboard/com.example.android.softkeyboard.SoftKeyboard";//输入法的服务名和包名
//                String myIME = "com.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME";
                try{
                        Log.i(TAG, "frozenkeyboard ");    
                    if ( myIME != null && myIME.length() > 0 )

                    {
                        Log.i(TAG, "frozenkeyboard ++++++++++++++++++++++++++++++++++++++");            
                        Settings.Secure.putString( getContentResolver(),
                                    Settings.Secure.DEFAULT_INPUT_METHOD,
                                    myIME );
                        Settings.System.putInt(getContentResolver(), Settings.System.SWITCH_REBOOT, 0);
                    }
                }catch (Exception e) {
                    Log.i(TAG, "frozenkeyboard e = "+e);
                }
            }else{

                    String myIME = "com.android.inputmethod.latin/.LatinIME";
                    try{
                        if ( myIME != null && myIME.length() > 0 )
                        {
                            Settings.Secure.putString( getContentResolver(),
                                        Settings.Secure.DEFAULT_INPUT_METHOD,
                                        myIME );
                            Settings.System.putInt(getContentResolver(), Settings.System.SWITCH_REBOOT, 0);
                            Log.i(TAG, "frozenkeyboard ");    
                            Log.i(TAG, "frozenkeyboard -------------------------------------------");            
                        }
                    }catch (Exception e) {
                        Log.i(TAG, "frozenkeyboard e = "+e);
                    }


            }
        }

顶部颜色与状态栏颜色统一,因此要做如下修改:

在AndroidManifest.xml的风格中添加
<item name="android:colorPrimaryDark">@color/primary_dark</item>

其中:
primary_dark 即为你需要修改的颜色

系统默认日期(还有package/app/setting 下  datetimesetting.java):
1、vendor/mediatek/proprietary/frameworks/base/res/res/values/config.xml
    
    <!-- default year for first power on-->
    <integer name="default_restore_year">2016</integer>
    
2、bootable/bootloader/preloader/custom/gxq6735_35gu_l1/inc/cust_rtc.h

    #define RTC_DEFAULT_YEA        2016
    
3、kernel-3.10/drivers/misc/mediatek/mach/mt6735/gxq6735_35gu_l1/rtc/rtc-mt.h

    #define RTC_DEFAULT_YEA        2016  


关于UI语言问题:

1 默认UI的语言    

修改配置文件  full_gxq6580_weg_l.mk

首先确认 buildinfo.sh 中是否把语言写死 (如果固定了则修改full_gxq6580_weg_l.mk 是不起作用的)

2 非默认UI 的语言

packages/apps/Dialer/src/com/android/dialer/SpecialCharSequenceMgr.java   (在这边控制 )


涉及恢复出厂设在是不同Ui 的语言

/frameworks/base/core/jni/AndroidRuntime.cpp

同时注意不同语言 默认时区不同 launcher.java




0 0
原创粉丝点击