转载时请注明出处和作者联系方式
文章出处:http://blog.chinaunix.net/uid/30230931.html
作者联系方式:JonLee

  1. commit 6ff9bba1dfe2c1832543cc5744a8542f36c753c7
  2. Author: JonLee <409775514@qq.com>
  3. Date: Thu Apr 19 10:28:43 2018 +0800

  4.     Android原生浏览器默认主页更改

  5. diff --git a/android/device/softwinner/alpaca/alpaca.mk b/android/device/softwinner/alpaca/alpaca.mk
  6. index 452f4a2..fded693 100755
  7. --- a/android/device/softwinner/alpaca/alpaca.mk
  8. +++ b/android/device/softwinner/alpaca/alpaca.mk
  9. @@ -114,7 +114,8 @@ PRODUCT_PROPERTY_OVERRIDES += \
  10.  PRODUCT_PROPERTY_OVERRIDES += \
  11.      persist.sys.timezone=Asia/Shanghai \
  12.      persist.sys.language=zh \
  13. -    persist.sys.country=CN
  14. +    persist.sys.country=CN \
  15. + persist.sys.browser_homepage=https://www.baidu.com
  16.  
  17.  PRODUCT_PACKAGES += Bluetooth
  18.  
  19. diff --git a/android/packages/apps/Browser/src/com/android/browser/BrowserSettings.java b/android/packages/apps/Browser/src/com/android/browser/BrowserSettings.java
  20. index ed44394..13032fb 100644
  21. --- a/android/packages/apps/Browser/src/com/android/browser/BrowserSettings.java
  22. +++ b/android/packages/apps/Browser/src/com/android/browser/BrowserSettings.java
  23. @@ -51,6 +51,8 @@ import java.lang.ref.WeakReference;
  24.  import java.util.Iterator;
  25.  import java.util.LinkedList;
  26.  import java.util.WeakHashMap;
  27. +import android.os.SystemProperties;
  28. +import android.text.TextUtils;
  29.  
  30.  /**
  31.   * Class for managing settings
  32. @@ -221,6 +223,12 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
  33.              }
  34.  
  35.              sFactoryResetUrl = mContext.getResources().getString(R.string.homepage_base);
  36. + if (TextUtils.isEmpty(SystemProperties.get("persist.sys.browser_homepage"))){
  37. + sFactoryResetUrl = mContext.getResources().getString(R.string.homepage_base);
  38. + }else{
  39. + sFactoryResetUrl =SystemProperties.get("persist.sys.browser_homepage");
  40. + }
  41. +
  42.              if (sFactoryResetUrl.indexOf("{CID}") != -1) {
  43.                  sFactoryResetUrl = sFactoryResetUrl.replace("{CID}",
  44.                      BrowserProvider.getClientId(mContext.getContentResolver()));
如图效果:
Android原生浏览器默认主页更改-LMLPHP
09-07 09:05