Skip to content

Commit f388291

Browse files
jsharkeyAndroid (Google) Code Review
authored andcommitted
Merge "Make policy data enabled flag static." into ics-mr1
2 parents da738d6 + 3f3115b commit f388291

File tree

3 files changed

+12
-20
lines changed

3 files changed

+12
-20
lines changed

services/java/com/android/server/net/NetworkPolicyManagerService.java

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,6 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
225225

226226
/** Set of currently active {@link Notification} tags. */
227227
private HashSet<String> mActiveNotifs = Sets.newHashSet();
228-
/** Current values from {@link #setPolicyDataEnable(int, boolean)}. */
229-
private SparseBooleanArray mActiveNetworkEnabled = new SparseBooleanArray();
230228

231229
/** Foreground at both UID and PID granularity. */
232230
private SparseBooleanArray mUidForeground = new SparseBooleanArray();
@@ -1519,21 +1517,13 @@ private void setUidNetworkRules(int uid, boolean rejectOnQuotaInterfaces) {
15191517
}
15201518

15211519
/**
1522-
* Control {@link IConnectivityManager#setPolicyDataEnable(int, boolean)},
1523-
* dispatching only when actually changed.
1520+
* Control {@link IConnectivityManager#setPolicyDataEnable(int, boolean)}.
15241521
*/
15251522
private void setPolicyDataEnable(int networkType, boolean enabled) {
1526-
synchronized (mActiveNetworkEnabled) {
1527-
final boolean prevEnabled = mActiveNetworkEnabled.get(networkType, true);
1528-
if (prevEnabled == enabled) return;
1529-
1530-
try {
1531-
mConnManager.setPolicyDataEnable(networkType, enabled);
1532-
} catch (RemoteException e) {
1533-
// ignored; service lives in system_server
1534-
}
1535-
1536-
mActiveNetworkEnabled.put(networkType, enabled);
1523+
try {
1524+
mConnManager.setPolicyDataEnable(networkType, enabled);
1525+
} catch (RemoteException e) {
1526+
// ignored; service lives in system_server
15371527
}
15381528
}
15391529

telephony/java/com/android/internal/telephony/DataConnectionTracker.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ public enum Activity {
167167
// independent of mInternalDataEnabled and requests for APN access
168168
// persisted
169169
protected boolean mUserDataEnabled = true;
170-
protected boolean mPolicyDataEnabled = true;
170+
171+
// TODO: move away from static state once 5587429 is fixed.
172+
protected static boolean sPolicyDataEnabled = true;
171173

172174
private boolean[] dataEnabled = new boolean[APN_NUM_TYPES];
173175

@@ -766,7 +768,7 @@ public void handleMessage(Message msg) {
766768
public boolean getAnyDataEnabled() {
767769
final boolean result;
768770
synchronized (mDataEnabledLock) {
769-
result = (mInternalDataEnabled && mUserDataEnabled && mPolicyDataEnabled
771+
result = (mInternalDataEnabled && mUserDataEnabled && sPolicyDataEnabled
770772
&& (enabledCount != 0));
771773
}
772774
if (!result && DBG) log("getAnyDataEnabled " + result);
@@ -1132,8 +1134,8 @@ protected void onSetDependencyMet(String apnType, boolean met) {
11321134
protected void onSetPolicyDataEnabled(boolean enabled) {
11331135
synchronized (mDataEnabledLock) {
11341136
final boolean prevEnabled = getAnyDataEnabled();
1135-
if (mPolicyDataEnabled != enabled) {
1136-
mPolicyDataEnabled = enabled;
1137+
if (sPolicyDataEnabled != enabled) {
1138+
sPolicyDataEnabled = enabled;
11371139
if (prevEnabled != getAnyDataEnabled()) {
11381140
if (!prevEnabled) {
11391141
resetAllRetryCounts();

telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ protected boolean isApnTypeAvailable(String type) {
549549
@Override
550550
public boolean getAnyDataEnabled() {
551551
synchronized (mDataEnabledLock) {
552-
if (!(mInternalDataEnabled && mUserDataEnabled && mPolicyDataEnabled)) return false;
552+
if (!(mInternalDataEnabled && mUserDataEnabled && sPolicyDataEnabled)) return false;
553553
for (ApnContext apnContext : mApnContexts.values()) {
554554
// Make sure we dont have a context that going down
555555
// and is explicitly disabled.

0 commit comments

Comments
 (0)