文章出处:http://blog.chinaunix.net/uid/30230931.html
作者联系方式:JonLee
- commit 6ff9bba1dfe2c1832543cc5744a8542f36c753c7
- Author: JonLee <409775514@qq.com>
- Date: Thu Apr 19 10:28:43 2018 +0800
- Android原生浏览器默认主页更改
- diff --git a/android/device/softwinner/alpaca/alpaca.mk b/android/device/softwinner/alpaca/alpaca.mk
- index 452f4a2..fded693 100755
- --- a/android/device/softwinner/alpaca/alpaca.mk
- +++ b/android/device/softwinner/alpaca/alpaca.mk
- @@ -114,7 +114,8 @@ PRODUCT_PROPERTY_OVERRIDES += \
- PRODUCT_PROPERTY_OVERRIDES += \
- persist.sys.timezone=Asia/Shanghai \
- persist.sys.language=zh \
- - persist.sys.country=CN
- + persist.sys.country=CN \
- + persist.sys.browser_homepage=https://www.baidu.com
-
- PRODUCT_PACKAGES += Bluetooth
-
- diff --git a/android/packages/apps/Browser/src/com/android/browser/BrowserSettings.java b/android/packages/apps/Browser/src/com/android/browser/BrowserSettings.java
- index ed44394..13032fb 100644
- --- a/android/packages/apps/Browser/src/com/android/browser/BrowserSettings.java
- +++ b/android/packages/apps/Browser/src/com/android/browser/BrowserSettings.java
- @@ -51,6 +51,8 @@ import java.lang.ref.WeakReference;
- import java.util.Iterator;
- import java.util.LinkedList;
- import java.util.WeakHashMap;
- +import android.os.SystemProperties;
- +import android.text.TextUtils;
-
- /**
- * Class for managing settings
- @@ -221,6 +223,12 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
- }
-
- sFactoryResetUrl = mContext.getResources().getString(R.string.homepage_base);
- + if (TextUtils.isEmpty(SystemProperties.get("persist.sys.browser_homepage"))){
- + sFactoryResetUrl = mContext.getResources().getString(R.string.homepage_base);
- + }else{
- + sFactoryResetUrl =SystemProperties.get("persist.sys.browser_homepage");
- + }
- +
- if (sFactoryResetUrl.indexOf("{CID}") != -1) {
- sFactoryResetUrl = sFactoryResetUrl.replace("{CID}",
- BrowserProvider.getClientId(mContext.getContentResolver()));