android 源码修改

展讯修改方案
[QUESTI
download版本后首次开机慢
[ANSWER]
原因分析:
开机过程中会去做odex优化,这样会加长开机时间,我们将其更改为编译时做odex优化
解决方案:

  1. 在device/sprd/scx35/BoardConfigCommon.mk
    WITH_DEXPREOPT := false
    修改如下:
    ifeq ( ( T A R G E T B U I L D V A R I A N T ) , u s e r ) i f e q ( (TARGET_BUILD_VARIANT),user) ifeq ( (TARGETBUILDVARIANT),user)ifeq((WITH_DEXPREOPT),)
    WITH_DEXPREOPT := true
    WITH_DEXPREOPT_PIC := true
    endif
    endif
    TODO, so much prebuilts in GMS, needs a better solution to control
    the multi-dex condiction
    DONT_DEXPREOPT_PREBUILTS := false
    注:
    1)true后面一定不要有空格
  1. DONT_DEXPREOPT_PREBUILTS为false表示对Android.mk中含有include $(BUILD_PREBUILT)的apk在编译时做odex优化,为true则编译时不会做odex优化,主要影响三方apk和gms包,具体可以根据实际需求做选择
  1. 删除telephony-common2的编译选项,否则可能会编译报错
    具体路径是对应的编译工程的目录下,如下:
    device/sprd/scx35l/features/base/config.mk
    PRODUCT_BOOT_JARS +=
    telephony-common2

FEATURES.PRODUCT_PACKAGES +=
telephony-common2
3. 打开编译时odex优化,会加大system分区的大小,所以要修改system分区大小,具体如下:
文件目录:device/sprd/scx35*****(或其他对应的编译型号)/BoardConfig.mk
修改BOARD_SYSTEMIMAGE_PARTITION_SIZE和BOARD_USERDATAIMAGE_PARTITION_SIZE值的大小,使得这两部分的和和原来大小一样。
1、长按Home键的功能配置,在sourceCode\frameworks\base\core\res\res\values\config.xml 中更改 config_longPressOnHomeBehavior 参数的配置:

<integer name="config_longPressOnHomeBehavior">2</integer>

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

   <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) {

12、[QUESTION]
如何关掉开机震动

[ANSWER]

在默认的版本里,开机是会震动的。
如果想要去掉开机震动,可以在以下代码中做如下修改。
u-boot64/common/loader/boot_mode.c
void normal_mode(void)
{
vibrator_hw_init();
– set_vibrator(1);
vlx_nand_boot(BOOT_PART, BACKLIGHT_ON);
return;
}

去掉set_vibrator(1);或将1修改为0,均可以去掉开机震动。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值