Merge "Fix data attempt while PS is not in-service" into honeycomb-LTE
This commit is contained in:
@@ -31,6 +31,7 @@ import android.os.Bundle;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.os.Messenger;
|
import android.os.Messenger;
|
||||||
|
import android.os.SystemProperties;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.provider.Settings.SettingNotFoundException;
|
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 static final String FAIL_DATA_SETUP_FAIL_CAUSE = "fail_data_setup_fail_cause";
|
||||||
protected FailCause mFailDataSetupFailCause = FailCause.ERROR_UNSPECIFIED;
|
protected FailCause mFailDataSetupFailCause = FailCause.ERROR_UNSPECIFIED;
|
||||||
|
|
||||||
|
protected static final String DEFALUT_DATA_ON_BOOT_PROP = "net.def_data_on_boot";
|
||||||
|
|
||||||
// member variables
|
// member variables
|
||||||
protected PhoneBase mPhone;
|
protected PhoneBase mPhone;
|
||||||
protected Activity mActivity = Activity.NONE;
|
protected Activity mActivity = Activity.NONE;
|
||||||
@@ -384,13 +387,15 @@ public abstract class DataConnectionTracker extends Handler {
|
|||||||
|
|
||||||
// This preference tells us 1) initial condition for "dataEnabled",
|
// This preference tells us 1) initial condition for "dataEnabled",
|
||||||
// and 2) whether the RIL will setup the baseband to auto-PS attach.
|
// and 2) whether the RIL will setup the baseband to auto-PS attach.
|
||||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mPhone.getContext());
|
|
||||||
dataEnabled[APN_DEFAULT_ID] =
|
dataEnabled[APN_DEFAULT_ID] = SystemProperties.getBoolean(DEFALUT_DATA_ON_BOOT_PROP,
|
||||||
!sp.getBoolean(PhoneBase.DATA_DISABLED_ON_BOOT_KEY, false);
|
true);
|
||||||
if (dataEnabled[APN_DEFAULT_ID]) {
|
if (dataEnabled[APN_DEFAULT_ID]) {
|
||||||
enabledCount++;
|
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() {
|
public void dispose() {
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import android.content.ContentResolver;
|
|||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.database.ContentObserver;
|
import android.database.ContentObserver;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
@@ -270,8 +269,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void initApnContextsAndDataConnection() {
|
protected void initApnContextsAndDataConnection() {
|
||||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mPhone.getContext());
|
boolean defaultEnabled = SystemProperties.getBoolean(DEFALUT_DATA_ON_BOOT_PROP, true);
|
||||||
boolean defaultEnabled = !sp.getBoolean(PhoneBase.DATA_DISABLED_ON_BOOT_KEY, false);
|
|
||||||
// Load device network attributes from resources
|
// Load device network attributes from resources
|
||||||
String[] networkConfigStrings = mPhone.getContext().getResources().getStringArray(
|
String[] networkConfigStrings = mPhone.getContext().getResources().getStringArray(
|
||||||
com.android.internal.R.array.networkAttributes);
|
com.android.internal.R.array.networkAttributes);
|
||||||
@@ -585,7 +583,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
boolean desiredPowerState = mPhone.getServiceStateTracker().getDesiredPowerState();
|
boolean desiredPowerState = mPhone.getServiceStateTracker().getDesiredPowerState();
|
||||||
|
|
||||||
boolean allowed =
|
boolean allowed =
|
||||||
gprsState == ServiceState.STATE_IN_SERVICE &&
|
(gprsState == ServiceState.STATE_IN_SERVICE || mAutoAttachOnCreation) &&
|
||||||
mPhone.mIccRecords.getRecordsLoaded() &&
|
mPhone.mIccRecords.getRecordsLoaded() &&
|
||||||
mPhone.getState() == Phone.State.IDLE &&
|
mPhone.getState() == Phone.State.IDLE &&
|
||||||
mInternalDataEnabled &&
|
mInternalDataEnabled &&
|
||||||
@@ -594,7 +592,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
desiredPowerState;
|
desiredPowerState;
|
||||||
if (!allowed && DBG) {
|
if (!allowed && DBG) {
|
||||||
String reason = "";
|
String reason = "";
|
||||||
if (!(gprsState == ServiceState.STATE_IN_SERVICE)) {
|
if (!((gprsState == ServiceState.STATE_IN_SERVICE) || mAutoAttachOnCreation)) {
|
||||||
reason += " - gprs= " + gprsState;
|
reason += " - gprs= " + gprsState;
|
||||||
}
|
}
|
||||||
if (!mPhone.mIccRecords.getRecordsLoaded()) reason += " - SIM not loaded";
|
if (!mPhone.mIccRecords.getRecordsLoaded()) reason += " - SIM not loaded";
|
||||||
|
|||||||
Reference in New Issue
Block a user