am f3882914: Merge "Make policy data enabled flag static." into ics-mr1
* commit 'f3882914e668501ee1dabd42207ed18348050c14': Make policy data enabled flag static.
This commit is contained in:
@@ -225,8 +225,6 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
|
|||||||
|
|
||||||
/** Set of currently active {@link Notification} tags. */
|
/** Set of currently active {@link Notification} tags. */
|
||||||
private HashSet<String> mActiveNotifs = Sets.newHashSet();
|
private HashSet<String> mActiveNotifs = Sets.newHashSet();
|
||||||
/** Current values from {@link #setPolicyDataEnable(int, boolean)}. */
|
|
||||||
private SparseBooleanArray mActiveNetworkEnabled = new SparseBooleanArray();
|
|
||||||
|
|
||||||
/** Foreground at both UID and PID granularity. */
|
/** Foreground at both UID and PID granularity. */
|
||||||
private SparseBooleanArray mUidForeground = new SparseBooleanArray();
|
private SparseBooleanArray mUidForeground = new SparseBooleanArray();
|
||||||
@@ -1519,21 +1517,13 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Control {@link IConnectivityManager#setPolicyDataEnable(int, boolean)},
|
* Control {@link IConnectivityManager#setPolicyDataEnable(int, boolean)}.
|
||||||
* dispatching only when actually changed.
|
|
||||||
*/
|
*/
|
||||||
private void setPolicyDataEnable(int networkType, boolean enabled) {
|
private void setPolicyDataEnable(int networkType, boolean enabled) {
|
||||||
synchronized (mActiveNetworkEnabled) {
|
try {
|
||||||
final boolean prevEnabled = mActiveNetworkEnabled.get(networkType, true);
|
mConnManager.setPolicyDataEnable(networkType, enabled);
|
||||||
if (prevEnabled == enabled) return;
|
} catch (RemoteException e) {
|
||||||
|
// ignored; service lives in system_server
|
||||||
try {
|
|
||||||
mConnManager.setPolicyDataEnable(networkType, enabled);
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
// ignored; service lives in system_server
|
|
||||||
}
|
|
||||||
|
|
||||||
mActiveNetworkEnabled.put(networkType, enabled);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -167,7 +167,9 @@ public abstract class DataConnectionTracker extends Handler {
|
|||||||
// independent of mInternalDataEnabled and requests for APN access
|
// independent of mInternalDataEnabled and requests for APN access
|
||||||
// persisted
|
// persisted
|
||||||
protected boolean mUserDataEnabled = true;
|
protected boolean mUserDataEnabled = true;
|
||||||
protected boolean mPolicyDataEnabled = true;
|
|
||||||
|
// TODO: move away from static state once 5587429 is fixed.
|
||||||
|
protected static boolean sPolicyDataEnabled = true;
|
||||||
|
|
||||||
private boolean[] dataEnabled = new boolean[APN_NUM_TYPES];
|
private boolean[] dataEnabled = new boolean[APN_NUM_TYPES];
|
||||||
|
|
||||||
@@ -766,7 +768,7 @@ public abstract class DataConnectionTracker extends Handler {
|
|||||||
public boolean getAnyDataEnabled() {
|
public boolean getAnyDataEnabled() {
|
||||||
final boolean result;
|
final boolean result;
|
||||||
synchronized (mDataEnabledLock) {
|
synchronized (mDataEnabledLock) {
|
||||||
result = (mInternalDataEnabled && mUserDataEnabled && mPolicyDataEnabled
|
result = (mInternalDataEnabled && mUserDataEnabled && sPolicyDataEnabled
|
||||||
&& (enabledCount != 0));
|
&& (enabledCount != 0));
|
||||||
}
|
}
|
||||||
if (!result && DBG) log("getAnyDataEnabled " + result);
|
if (!result && DBG) log("getAnyDataEnabled " + result);
|
||||||
@@ -1132,8 +1134,8 @@ public abstract class DataConnectionTracker extends Handler {
|
|||||||
protected void onSetPolicyDataEnabled(boolean enabled) {
|
protected void onSetPolicyDataEnabled(boolean enabled) {
|
||||||
synchronized (mDataEnabledLock) {
|
synchronized (mDataEnabledLock) {
|
||||||
final boolean prevEnabled = getAnyDataEnabled();
|
final boolean prevEnabled = getAnyDataEnabled();
|
||||||
if (mPolicyDataEnabled != enabled) {
|
if (sPolicyDataEnabled != enabled) {
|
||||||
mPolicyDataEnabled = enabled;
|
sPolicyDataEnabled = enabled;
|
||||||
if (prevEnabled != getAnyDataEnabled()) {
|
if (prevEnabled != getAnyDataEnabled()) {
|
||||||
if (!prevEnabled) {
|
if (!prevEnabled) {
|
||||||
resetAllRetryCounts();
|
resetAllRetryCounts();
|
||||||
|
|||||||
@@ -549,7 +549,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
@Override
|
@Override
|
||||||
public boolean getAnyDataEnabled() {
|
public boolean getAnyDataEnabled() {
|
||||||
synchronized (mDataEnabledLock) {
|
synchronized (mDataEnabledLock) {
|
||||||
if (!(mInternalDataEnabled && mUserDataEnabled && mPolicyDataEnabled)) return false;
|
if (!(mInternalDataEnabled && mUserDataEnabled && sPolicyDataEnabled)) return false;
|
||||||
for (ApnContext apnContext : mApnContexts.values()) {
|
for (ApnContext apnContext : mApnContexts.values()) {
|
||||||
// Make sure we dont have a context that going down
|
// Make sure we dont have a context that going down
|
||||||
// and is explicitly disabled.
|
// and is explicitly disabled.
|
||||||
|
|||||||
Reference in New Issue
Block a user