Skip to content

Change of Android 5.1 source to skip network validation. In China, we can't connect to Google server 204.

Notifications You must be signed in to change notification settings

ferhung/Skip_network_validation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 

Repository files navigation

####Change of Android 5.1 source to skip network validation.

  • In China, we can't connect to Google server 204.
  • If you don't ship network validation, it will always search network to get Google server 204.
  • Then it causes a lower battery life and the icons of signal & wifi on status bar will contain the exclamation marks.

####Path to frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java. #####line 264

  • Add: before "public NetworkMonitor(Context context, Handler handler, NetworkAgentInfo networkAgentInfo".

      //Add. In China, we can't connect to Google server 204.
      private static boolean mSkipNetworkValidation = true;
      //End. 
    

#####line 301

  • Add: following "mCaptivePortalLoggedInResponseToken = String.valueOf(new Random().nextLong());".

      //Add. In China, we can't connect to Google server 204.
      mSkipNetworkValidation = mContext.getResources().getBoolean(
      	com.android.internal.R.bool.config_skip_network_validation);
    

#####line 488

  • Change: "int httpResponseCode = isCaptivePortal();" to following codes.

      //M: Add. In China, we can't connect to Google server 204.
      log("mSkipNetworkValidation ="+mSkipNetworkValidation);
      if (mSkipNetworkValidation) {
      	mConnectivityServiceHandler.sendMessage(obtainMessage(EVENT_NETWORK_TESTED,
      	NETWORK_TEST_RESULT_VALID, 0, mNetworkAgentInfo));
      }
    
      int httpResponseCode = isCaptivePortal();
    
      if (mSkipNetworkValidation) {
      if (httpResponseCode != 204 && httpResponseCode >= 200 && httpResponseCode <= 399){
      	transitionTo(mCaptivePortalState);
      } else {
      	transitionTo(mValidatedState);
      }
      return HANDLED;
      }
      //End: Add. In China, we can't connect to Google server 204.
    

####Path to frameworks/base/res/res/values/config.xml. #####line 2215

  • Add:

      <!-- //M: Add. In China, we can't connect to Google server 204.-->     
      <bool name="config_skip_network_validation">true</bool>
    

####Path to frameworks/base/res/res/values/symbols.xml. #####line 2179

  • Add:

      <!-- //M: Add. In China, we can't connect to Google server 204.-->     
      <java-symbol type="bool" name="config_skip_network_validation" />
    

About

Change of Android 5.1 source to skip network validation. In China, we can't connect to Google server 204.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published