您的当前位置:首页Android系统默认修改

Android系统默认修改

2021-01-17 来源:爱问旅游网
Android4.4系统默认设置修改

1.修改默认语言

在build\ools\\buildinfo.sh文件末尾添加如下代码:

echo \"ro.product.locale.language=zh\" echo \"ro.product.locale.region=CN\"

2.修改默认时区

在core_base.mk中添加:

PRODUCT_PROPERTY_OVERRIDES += / persist.sys.timezone= Asia/Shanghai 另外还有一种方法: 在 init.rc 中添加 #set default timezone

setprop persist.sys.timezone Asia/Shanghai

3.修改系统12/24小时制

Android源码中默认使用12小时制,如果想要改成24小时制的话,方法如下: 1)到源码目录 frameworks/base/packages/SettingsProvider/res/values/defaults.xml 文件中增加一行:

24

2)到源码目录

frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java文件中的loadSystemSettings()方法中增加下面一行设置时间格式: loadStringSetting(stmt,Settings.System.TIME_12_24,R.string.time_12_24);

3)可以用以下代码查看系统是否是24小时制: ContentResolver c = getContentResolver();

String strTimeFormat =

android.provider.Settings.System.getString(c,android.provider.Settings.System.TIME_12_24); if(strTimeFormat.equals(\"24\")){

Log.e(\"time\}else{

Log.e(\"time\}

4.设置Android默认锁定屏幕旋转

解决方法:

cat frameworks/base/packages/SettingsProvider/res/values/defaults.xml ......

false ......

5.默认不要锁屏,设置-安全--屏幕锁定 (无)

frameworks/base/packages/SettingsProvider/res/values/defaults.xml true

6. 默认允许 未知来源

true

1. diff --git a/packages/apps/Settings/src/com/android/settings/DevelopmentSettings.java b/packages/apps/Settings/src/com/android/settings/Devel 2. index 0a987df..503270a 100755 3. --- a/packages/apps/Settings/src/com/android/settings/DevelopmentSettings.java

4. +++ b/packages/apps/Settings/src/com/android/settings/DevelopmentSettings.ja

va 5. @@ -508,15 +508,9 @@ public class DevelopmentSettings extends SettingsPreferenceFragment

6. final Context context = getActivity();

7. final ContentResolver cr = context.getContentResolver(); 8. mHaveDebugSettings = false;

9. -

10. /// M: CR ALPS00244115. Lock and unlock screen, the \"USB debugging\" is unchecked.

11. boolean isChecked = (mAdbDialog != null && mAdbDialog.isShowing()) ? true :

12. (Settings.Global.getInt(cr, Settings.Global.ADB_ENABLED, 0) != 0);

13. - //added by ouyang 2015-11-10 set mEnableAdb=true if model is J5 14. - if (android.os.SystemProperties.isJ5Version()) { 15. - isChecked=true;

16. - }

17. - //added by ouyang 2015-11-10 end

18. updateSwitchPreference(mEnableAdb, isChecked); 19. /// M: update usb preference again 20. mExt.customUSBPreference(mEnableAdb);

[html] view plain copy

1. diff --git a/packages/apps/Settings/src/com/android/settings/SecuritySettings.java b/packages/apps/Settings/src/com/android/settings/Security 2. index 4de173a..392e6ee 100755 3. --- a/packages/apps/Settings/src/com/android/settings/SecuritySettings.java 4. +++ b/packages/apps/Settings/src/com/android/settings/SecuritySettings.java 5. @@ -402,14 +402,7 @@ public class SecuritySettings extends SettingsPreferenceFragment

6. root.findPreference(KEY_DEVICE_ADMIN_CATEGORY);

7. mToggleAppInstallation = (SwitchPreference) findPreference( 8. KEY_TOGGLE_INSTALL_APPLICATIONS); 9. -

10. - //added by ouyang 2015-11-10 setChecked(true) if the model is J5

11. - if (android.os.SystemProperties.isJ5Version()) { 12. - setNonMarketAppsAllowed(true); 13. - }

14. mToggleAppInstallation.setChecked(isNonMarketAppsAllowed()); 15. - //added by ouyang 2017-05-09 end 16. -

17. // Side loading of apps.

18. // Disable for restricted profiles. For others, check if policy dis

allows it. 19. mToggleAppInstallation.setEnabled(!um.getUserInfo(UserHandle.myUser

Id()).isRestricted());

7.默认显示“开发者选项”

请修改./packages/apps/Settings/src/com/android/settings/Settings.java private void updateHeaderList(List

target)

/*final boolean showDev = mDevelopmentPreferences.getBoolean( DevelopmentSettings.PREF_SHOW, android.os.Build.TYPE.equals(\"eng\"));*/ 修改为 boolean showDev = true;

8.永不休眠

1)设置默认永不休眠

./frameworks/base/packages/SettingsProvider/res/values/defaults.xml -1

./device/9tripod/x4418/overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml

-1

2)设置英文never项

./packages/apps/Settings/res/values/arrays.xml

15 seconds 30 seconds 1 minute 2 minutes 5 minutes 10 minutes 30 minutes +never

15000 30000 60000 120000 300000 600000 1800000 +-1 3)设置中文永不休眠项

./packages/apps/Settings/res/values-zh-rCN/arrays.xml

\"15 秒\" \"30 秒\" \"1 分钟\" \"2 分钟\" \"5 分钟\" \"10 分钟\" \"30 分钟\"

\"永不休眠\"

4)设置电源管理服务

./frameworks/base/services/java/com/android/server/power/PowerManagerService.java

private int getScreenOffTimeoutLocked() { int DonotSleeptimeout;

int timeout =mScreenOffTimeoutSetting;

if(isMaximumScreenOffTimeoutFromDeviceAdminEnforcedLocked()) {

timeout = Math.min(timeout,mMaximumScreenOffTimeoutFromDeviceAdmin);

if(mUserActivityTimeoutOverrideFromWindowManager >= 0) {

timeout = (int)Math.min(timeout,mUserActivityTimeoutOverrideFromWindowManager); }

DonotSleeptimeout = mScreenOffTimeoutSetting; if(DonotSleeptimeout < 0) {

DonotSleeptimeout= mMaximumScreenOffTimeoutFromDeviceAdmin ;

returnMath.max(DonotSleeptimeout, mMaximumScreenOffTimeoutFromDeviceAdmin); }

return Math.max(timeout,MINIMUM_SCREEN_OFF_TIMEOUT); }

privatevoid updateUserActivitySummaryLocked(long now, int dirty) { // Update the status of the useractivity timeout timer.

if ((dirty & (DIRTY_USER_ACTIVITY |DIRTY_WAKEFULNESS | DIRTY_SETTINGS)) != 0) {

mHandler.removeMessages(MSG_USER_ACTIVITY_TIMEOUT);

long nextTimeout = 0;

if (mWakefulness !=WAKEFULNESS_ASLEEP) {

final int screenOffTimeout =getScreenOffTimeoutLocked();

final int screenDimDuration =getScreenDimDurationLocked(screenOffTimeout);

mUserActivitySummary = 0;

if (mLastUserActivityTime >=mLastWakeTime) { nextTimeout =mLastUserActivityTime + screenOffTimeout- screenDimDuration; if (now < nextTimeout) {

mUserActivitySummary |=USER_ACTIVITY_SCREEN_BRIGHT; } else {

nextTimeout =mLastUserActivityTime + screenOffTimeout; if (now mUserActivitySummary|= USER_ACTIVITY_SCREEN_DIM; } } }

if (mUserActivitySummary == 0

&&mLastUserActivityTimeNoChangeLights >= mLastWakeTime) { nextTimeout =mLastUserActivityTimeNoChangeLights + screenOffTimeout; if (now < nextTimeout

&&mDisplayPowerRequest.screenState

!=DisplayPowerRequest.SCREEN_STATE_OFF) { mUserActivitySummary =mDisplayPowerRequest.screenState ==DisplayPowerRequest.SCREEN_STATE_BRIGHT ?

USER_ACTIVITY_SCREEN_BRIGHT : USER_ACTIVITY_SCREEN_DIM; } }

if (mUserActivitySummary != 0&&mScreenOffTimeoutSetting > 0) {

Message msg =mHandler.obtainMessage(MSG_USER_ACTIVITY_TIMEOUT); msg.setAsynchronous(true);

mHandler.sendMessageAtTime(msg,nextTimeout); } } else {

mUserActivitySummary = 0; }

if (DEBUG_SPEW) {

Slog.d(TAG,\"updateUserActivitySummaryLocked: mWakefulness=\" +wakefulnessToString(mWakefulness)

+ \ + \ } } }

5)设置显示配置

./packages/apps/Settings/src/com/android/settings/DisplaySettings.java privatevoid updateTimeoutPreferenceDescription(long currentTimeout) { ListPreference preference =mScreenTimeoutPreference; String summary; if (currentTimeout < -1) { // Unsupported value

summary = \"\"; } else {

final CharSequence[] entries =preference.getEntries(); final CharSequence[] values =preference.getEntryValues(); if (entries == null ||entries.length == 0) { summary = \"\"; } else { int best = 0;

for (int i = 0; i long timeout =Long.parseLong(values[i].toString()); if (currentTimeout >=timeout) { best = i; } }

summary = preference.getContext().getString(R.string.screen_timeout_summary, entries[best]);

if(currentTimeout < 0)summary =entries[best].toString(); } }

preference.setSummary(summary); }

6)修改系统设置

修改./packages/apps/Settings/src/com/android/settings/DisplaySettings.java文件,

将: private static final int FALLBACK_SCREEN_TIMEOUT_VALUE = 30000; 改为: private static final int FALLBACK_SCREEN_TIMEOUT_VALUE = -1;

9.修改默认亮度

修改./frameworks/base/packages/SettingsProvider/res/values/defaults.xml中的 51

255

./frameworks/base/core/java/android/os/PowerManager.java

设置进度条的范围,BRIGHTNESS_DIM = 20 BRIGHTNESS_ON=255.

因篇幅问题不能全部显示,请点此查看更多更全内容