Merge "Fix data attempt while PS is not in-service" into honeycomb-LTE

This commit is contained in:
Wink Saville
2011-05-16 15:47:42 -07:00
committed by Android (Google) Code Review
2 changed files with 12 additions and 9 deletions

View File

@@ -31,6 +31,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.Messenger;
import android.os.SystemProperties;
import android.preference.PreferenceManager;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
@@ -219,6 +220,8 @@ public abstract class DataConnectionTracker extends Handler {
protected static final String FAIL_DATA_SETUP_FAIL_CAUSE = "fail_data_setup_fail_cause";
protected FailCause mFailDataSetupFailCause = FailCause.ERROR_UNSPECIFIED;
protected static final String DEFALUT_DATA_ON_BOOT_PROP = "net.def_data_on_boot";
// member variables
protected PhoneBase mPhone;
protected Activity mActivity = Activity.NONE;
@@ -384,13 +387,15 @@ public abstract class DataConnectionTracker extends Handler {
// This preference tells us 1) initial condition for "dataEnabled",
// and 2) whether the RIL will setup the baseband to auto-PS attach.
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mPhone.getContext());
dataEnabled[APN_DEFAULT_ID] =
!sp.getBoolean(PhoneBase.DATA_DISABLED_ON_BOOT_KEY, false);
dataEnabled[APN_DEFAULT_ID] = SystemProperties.getBoolean(DEFALUT_DATA_ON_BOOT_PROP,
true);
if (dataEnabled[APN_DEFAULT_ID]) {
enabledCount++;
}
mAutoAttachOnCreation = dataEnabled[APN_DEFAULT_ID];
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mPhone.getContext());
mAutoAttachOnCreation = sp.getBoolean(PhoneBase.DATA_DISABLED_ON_BOOT_KEY, false);
}
public void dispose() {

View File

@@ -22,7 +22,6 @@ import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.ContentObserver;
import android.database.Cursor;
import android.net.ConnectivityManager;
@@ -270,8 +269,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
}
protected void initApnContextsAndDataConnection() {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mPhone.getContext());
boolean defaultEnabled = !sp.getBoolean(PhoneBase.DATA_DISABLED_ON_BOOT_KEY, false);
boolean defaultEnabled = SystemProperties.getBoolean(DEFALUT_DATA_ON_BOOT_PROP, true);
// Load device network attributes from resources
String[] networkConfigStrings = mPhone.getContext().getResources().getStringArray(
com.android.internal.R.array.networkAttributes);
@@ -585,7 +583,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
boolean desiredPowerState = mPhone.getServiceStateTracker().getDesiredPowerState();
boolean allowed =
gprsState == ServiceState.STATE_IN_SERVICE &&
(gprsState == ServiceState.STATE_IN_SERVICE || mAutoAttachOnCreation) &&
mPhone.mIccRecords.getRecordsLoaded() &&
mPhone.getState() == Phone.State.IDLE &&
mInternalDataEnabled &&
@@ -594,7 +592,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
desiredPowerState;
if (!allowed && DBG) {
String reason = "";
if (!(gprsState == ServiceState.STATE_IN_SERVICE)) {
if (!((gprsState == ServiceState.STATE_IN_SERVICE) || mAutoAttachOnCreation)) {
reason += " - gprs= " + gprsState;
}
if (!mPhone.mIccRecords.getRecordsLoaded()) reason += " - SIM not loaded";