Merge "Tell each VM to flush their DNS cache."

This commit is contained in:
Robert Greenwalt
2010-11-04 17:02:44 -07:00
committed by Android (Google) Code Review
7 changed files with 55 additions and 1 deletions

View File

@@ -1596,6 +1596,12 @@ public class ConnectivityService extends IConnectivityManager.Stub {
} catch (NumberFormatException e) {}
}
SystemProperties.set("net.dnschange", "" + (n+1));
/*
* Tell the VMs to toss their DNS caches
*/
Intent intent = new Intent(Intent.ACTION_CLEAR_DNS_CACHE);
intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
mContext.sendBroadcast(intent);
}
private void handleDnsConfigurationChange(int netType) {

View File

@@ -959,6 +959,7 @@ public final class ActivityManagerService extends ActivityManagerNative
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 @@ public final class ActivityManagerService extends ActivityManagerNative
}
}
} 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 @@ public final class ActivityManagerService extends ActivityManagerNative
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.