展讯android 5.1系统部分功能修改学习总结

来源:互联网 发布:spss数据分析游戏 编辑:程序博客网 时间:2024/06/03 18:42

在android系统入门学习的过程中所遇到的一些问题和解决方法,在此做个记录总结,方便日后参考!

1、长按Home键的功能配置,在sourceCode\frameworks\base\core\res\res\values\config.xml 中更改 config_longPressOnHomeBehavior 参数的配置:

<!-- Control the behavior when the user long presses the home button.
         0 - Nothing
            1 - Recent apps view in SystemUI
             2 - Launch assist intent
         This needs to match the constants in
         policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
    -->
    <integer name="config_longPressOnHomeBehavior">2</integer>


2、长按电源键的弹出框功能选项配置,在sourceCode\frameworks\base\core\res\res\values\config.xml 中更改 config_longPressOnHomeBehavior 参数的配置:

<!-- Defines the default set of global actions. Actions may still be disabled or hidden based
         on the current state of the device.
          Each item must be one of the following strings:
         "power" = Power off
         "settings" = An action to launch settings
         "airplane" = Airplane mode toggle
         "bugreport" = Take bug report, if available
          "silent" = silent mode
         "users" = list of users
         -->
   <string-array translatable="false" name="config_globalActionsList">
       <item>power</item>
      <item>bugreport</item>
      <item>users</item>
        <item>airplane</item>
    </string-array>


3、更改默认壁纸 sourceCode\frameworks\base\core\res\res\drawable-nodpi\default_wallpaper.jpg

4、更改型号、版本号等信息sourceCode\build\tools\buildinfo.sh

5、修改默认日期格式/铃声/通知 sourceCode\build\target\product\full_base.mk

PRODUCT_PROPERTY_OVERRIDES := \
    ro.com.android.dateformat=MM-dd-yyyy \
    ro.config.ringtone=Ring_Synth_04.ogg \
     ro.config.notification_sound=pixiedust.ogg

6、支持多卡铃声:sourceCode\device\sprd\XXX(project)\system.prop  增加设置属性 ro.config.support_multiringtone=true

7、不插SIM卡也支持铃声设置:sourceCode\packages\apps\AudioProfile\src\com\sprd\audioprofile\AudioProfileSoundSettings.java

(1)在protected void onCreate(Bundle savedInstanceState)方法中去除如下if的判断

 //if (((TelephonyManagerSprd)TelephonyManager.from(mContext)).hasIccCard(i)) {
                    mRingtonePreference[i].setEnabled(true);
               // } else { 
                  //  mRingtonePreference[i].setEnabled(false);
              //  }  

(2)protected void onCreate(Bundle savedInstanceState)方法的run()中去除如下if的判断

for (int i = 0; i < mPhoneCount; i++) {
                        //if (mRingtonePreference[i] != null && 

((TelephonyManagerSprd)TelephonyManager.from(mContext)).hasIccCard(i)){
                            updateRingtoneName(RingtoneManager.TYPE_RINGTONE,i, mRingtonePreference[i], 

MSG_UPDATE_RINGTONE_SUMMARY);
                       // }     
               }


8、更改蓝牙默认存储路径为内部存储:sourceCode\packages\apps\Bluetooth\src\com\android\bluetooth\opp\BluetoothOppReceiveFileInfo.java

在public static BluetoothOppReceiveFileInfo generateFileInfo(Context context, int id)方法中做如下修改:

(1)String root = Environment.getInternalStoragePath().getAbsolutePath() ;//获取内部存储路径
if (true) {
        //if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
           // String root = Environment.getExternalStorageDirectory().getPath();
(2)if(true){
//if (Environment.getExternalStorageState(Environment.getSecondaryStorageDirectory()).

equals(Environment.MEDIA_MOUNTED)) {
                //String root = Environment.getSecondaryStorageDirectory().getPath();

在 private static boolean safeCanonicalPath(String uniqueFileName)方法中做如下修改:

File receiveFile = new File(uniqueFileName);
            if (mUseSecondCard) {
                sDesiredStoragePath = Environment.getSecondaryStorageDirectory().getPath() + Constants.DEFAULT_STORE_SUBDIR;
            } else {
//modify
start

//sDesiredStoragePath = Environment.getExternalStorageDirectory().getPath() 

+ Constants.DEFAULT_STORE_SUBDIR;

sDesiredStoragePath = Environment.getInternalStoragePath().getAbsolutePath()

 + Constants.DEFAULT_STORE_SUBDIR;
            //modify end

}

9、调用系统的音量控制

mAudioManager = (AudioManager) (mActivity.getSystemService(Context.AUDIO_SERVICE));

           ( KeyEvent.KEYCODE_VOLUME_UP:)
mAudioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE, AudioManager.FLAG_VIBRATE);
            ( KeyEvent.KEYCODE_VOLUME_DOWN:)
mAudioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_LOWER, AudioManager.FLAG_VIBRATE);

10、单击menu键只有只有壁纸和小部件快捷选项,需添加设置快捷项:sourceCode\packages\apps\Launcher3\src\com\android\launcher3\Launcher.java

(1)在protected boolean hasSettings()方法中return true;

(2)protected void onClickSettingsButton(View v)方法做如下修改,添加代码:

    protected void onClickSettingsButton(View v) {
//modify
 ComponentName com = new ComponentName("com.android.settings", "com.android.settings.Settings");    
      Intent  intent = new Intent();
      intent.setComponent(com);
      startActivity(intent);
  //end;
        if (LOGD) Log.d(TAG, "onClickSettingsButton");
        if (mLauncherCallbacks != null) {
            mLauncherCallbacks.onClickSettingsButton(v);
        }
    }
 

11、长按menu键,出现最近使用应用列表(多任务列表): sourceCode\frameworks\base\policy\src\com\android\internal\policy\impl\PhoneWindowManager.java

 public long interceptKeyBeforeDispatching(WindowState win, KeyEvent event, int policyFlags)方法中做如下修改:

else if (keyCode == KeyEvent.KEYCODE_MENU) {
            // Hijack modified menu keys for debugging features
            final int chordBug = KeyEvent.META_SHIFT_ON;
//---start
if(KeyEvent.ACTION_UP == event.getAction()&&

event.getEventTime()-event.getDownTime()>700&&repeatCount == 0){
this.toggleRecentApps();
preloadRecentApps();
recentAppsShowing = true;
return -1;
}
//---end
if (down && repeatCount == 0) {



1 0
原创粉丝点击