Merge "Tell each VM to flush their DNS cache."
This commit is contained in:
committed by
Android (Google) Code Review
commit
1678246710
@@ -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) {
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user