summaryrefslogtreecommitdiffstats
path: root/services/java
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2012-05-24 10:21:16 -0700
committerJeff Sharkey <jsharkey@android.com>2012-05-24 10:21:16 -0700
commite19f39b79c831aea4d51a3309025acdf69d1e609 (patch)
tree60305af623efdc2bce8adeec5097e280d3fccc1d /services/java
parentd525baa3a84928e16973fcf7f3d464adac513c1d (diff)
downloadframeworks_base-e19f39b79c831aea4d51a3309025acdf69d1e609.zip
frameworks_base-e19f39b79c831aea4d51a3309025acdf69d1e609.tar.gz
frameworks_base-e19f39b79c831aea4d51a3309025acdf69d1e609.tar.bz2
Advise persist threshold outside NPMS lock.
Bug: 6492166 Change-Id: Ibebdc7e9b8cae27c12fd7b61b53ab60287a0364d
Diffstat (limited to 'services/java')
-rw-r--r--services/java/com/android/server/net/NetworkPolicyManagerService.java24
1 files changed, 15 insertions, 9 deletions
diff --git a/services/java/com/android/server/net/NetworkPolicyManagerService.java b/services/java/com/android/server/net/NetworkPolicyManagerService.java
index 1b8c9cb..c82f37c 100644
--- a/services/java/com/android/server/net/NetworkPolicyManagerService.java
+++ b/services/java/com/android/server/net/NetworkPolicyManagerService.java
@@ -118,7 +118,6 @@ import android.telephony.TelephonyManager;
import android.text.format.Formatter;
import android.text.format.Time;
import android.util.Log;
-import android.util.MathUtils;
import android.util.NtpTrustedTime;
import android.util.Slog;
import android.util.SparseArray;
@@ -225,6 +224,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
private static final int MSG_PROCESS_DIED = 4;
private static final int MSG_LIMIT_REACHED = 5;
private static final int MSG_RESTRICT_BACKGROUND_CHANGED = 6;
+ private static final int MSG_ADVISE_PERSIST_THRESHOLD = 7;
private final Context mContext;
private final IActivityManager mActivityManager;
@@ -1032,14 +1032,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
}
}
- try {
- // make sure stats are recorded frequently enough; we aim for 2MB
- // threshold for 2GB/month rules.
- final long persistThreshold = lowestRule / 1000;
- mNetworkStats.advisePersistThreshold(persistThreshold);
- } catch (RemoteException e) {
- // ignored; service lives in system_server
- }
+ mHandler.obtainMessage(MSG_ADVISE_PERSIST_THRESHOLD, lowestRule).sendToTarget();
// remove quota on any trailing interfaces
for (String iface : mMeteredIfaces) {
@@ -1861,6 +1854,19 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
}
}
mListeners.finishBroadcast();
+ return true;
+ }
+ case MSG_ADVISE_PERSIST_THRESHOLD: {
+ final long lowestRule = (Long) msg.obj;
+ try {
+ // make sure stats are recorded frequently enough; we aim
+ // for 2MB threshold for 2GB/month rules.
+ final long persistThreshold = lowestRule / 1000;
+ mNetworkStats.advisePersistThreshold(persistThreshold);
+ } catch (RemoteException e) {
+ // ignored; service lives in system_server
+ }
+ return true;
}
default: {
return false;