Tell each VM to flush their DNS cache.
bug:3095357
Change-Id: I93de24e3e5a7d8b94d55f4facfffc863a2b8c202
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 60b2b67..7905dc6 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -959,6 +959,7 @@
static final int CANCEL_HEAVY_NOTIFICATION_MSG = 25;
static final int SHOW_STRICT_MODE_VIOLATION_MSG = 26;
static final int CHECK_EXCESSIVE_WAKE_LOCKS_MSG = 27;
+ static final int CLEAR_DNS_CACHE = 28;
AlertDialog mUidAlert;
@@ -1110,6 +1111,20 @@
}
}
} break;
+ case CLEAR_DNS_CACHE: {
+ synchronized (ActivityManagerService.this) {
+ for (int i = mLruProcesses.size() - 1 ; i >= 0 ; i--) {
+ ProcessRecord r = mLruProcesses.get(i);
+ if (r.thread != null) {
+ try {
+ r.thread.clearDnsCache();
+ } catch (RemoteException ex) {
+ Slog.w(TAG, "Failed to clear dns cache for: " + r.info.processName);
+ }
+ }
+ }
+ }
+ } break;
case SHOW_UID_ERROR_MSG: {
// XXX This is a temporary dialog, no need to localize.
AlertDialog d = new BaseErrorDialog(mContext);
@@ -10373,6 +10388,10 @@
mHandler.sendEmptyMessage(UPDATE_TIME_ZONE);
}
+ if (intent.ACTION_CLEAR_DNS_CACHE.equals(intent.getAction())) {
+ mHandler.sendEmptyMessage(CLEAR_DNS_CACHE);
+ }
+
/*
* Prevent non-system code (defined here to be non-persistent
* processes) from sending protected broadcasts.