diff options
author | Robert Greenwalt <rgreenwalt@google.com> | 2010-11-02 14:08:23 -0700 |
---|---|---|
committer | Robert Greenwalt <rgreenwalt@google.com> | 2010-11-04 11:52:35 -0700 |
commit | 03595d01188d88c169e8c9dd51b357fd545e69cc (patch) | |
tree | ddad8c3f64f73ee22248c369cf567d8e036aa26d /core | |
parent | b52907f6be7edb3a8b709348af484dd7d646b13e (diff) | |
download | frameworks_base-03595d01188d88c169e8c9dd51b357fd545e69cc.zip frameworks_base-03595d01188d88c169e8c9dd51b357fd545e69cc.tar.gz frameworks_base-03595d01188d88c169e8c9dd51b357fd545e69cc.tar.bz2 |
Tell each VM to flush their DNS cache.
bug:3095357
Change-Id: I93de24e3e5a7d8b94d55f4facfffc863a2b8c202
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/app/ActivityThread.java | 6 | ||||
-rw-r--r-- | core/java/android/app/ApplicationThreadNative.java | 15 | ||||
-rw-r--r-- | core/java/android/app/IApplicationThread.java | 2 | ||||
-rw-r--r-- | core/java/android/content/Intent.java | 7 | ||||
-rw-r--r-- | core/res/AndroidManifest.xml | 1 |
5 files changed, 30 insertions, 1 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 47efddb..174b6da 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -85,6 +85,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintWriter; import java.lang.ref.WeakReference; +import java.net.InetAddress; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -585,6 +586,11 @@ public final class ActivityThread { TimeZone.setDefault(null); } + public void clearDnsCache() { + // a non-standard API to get this to libcore + InetAddress.clearDnsCache(); + } + public void processInBackground() { mH.removeMessages(H.GC_WHEN_IDLE); mH.sendMessage(mH.obtainMessage(H.GC_WHEN_IDLE)); diff --git a/core/java/android/app/ApplicationThreadNative.java b/core/java/android/app/ApplicationThreadNative.java index 95689fc..b19fb59 100644 --- a/core/java/android/app/ApplicationThreadNative.java +++ b/core/java/android/app/ApplicationThreadNative.java @@ -291,6 +291,12 @@ public abstract class ApplicationThreadNative extends Binder return true; } + case CLEAR_DNS_CACHE_TRANSACTION: { + data.enforceInterface(IApplicationThread.descriptor); + clearDnsCache(); + return true; + } + case PROCESS_IN_BACKGROUND_TRANSACTION: { data.enforceInterface(IApplicationThread.descriptor); processInBackground(); @@ -744,6 +750,14 @@ class ApplicationThreadProxy implements IApplicationThread { data.recycle(); } + public void clearDnsCache() throws RemoteException { + Parcel data = Parcel.obtain(); + data.writeInterfaceToken(IApplicationThread.descriptor); + mRemote.transact(CLEAR_DNS_CACHE_TRANSACTION, data, null, + IBinder.FLAG_ONEWAY); + data.recycle(); + } + public void processInBackground() throws RemoteException { Parcel data = Parcel.obtain(); data.writeInterfaceToken(IApplicationThread.descriptor); @@ -884,4 +898,3 @@ class ApplicationThreadProxy implements IApplicationThread { data.recycle(); } } - diff --git a/core/java/android/app/IApplicationThread.java b/core/java/android/app/IApplicationThread.java index 1f8a7c58..830c702 100644 --- a/core/java/android/app/IApplicationThread.java +++ b/core/java/android/app/IApplicationThread.java @@ -87,6 +87,7 @@ public interface IApplicationThread extends IInterface { void requestThumbnail(IBinder token) throws RemoteException; void scheduleConfigurationChanged(Configuration config) throws RemoteException; void updateTimeZone() throws RemoteException; + void clearDnsCache() throws RemoteException; void processInBackground() throws RemoteException; void dumpService(FileDescriptor fd, IBinder servicetoken, String[] args) throws RemoteException; @@ -146,4 +147,5 @@ public interface IApplicationThread extends IInterface { int SCHEDULE_CRASH_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+34; int DUMP_HEAP_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+35; int DUMP_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+36; + int CLEAR_DNS_CACHE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+37; } diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index ac6b147..4b6333e 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -1223,6 +1223,13 @@ public class Intent implements Parcelable, Cloneable { @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_TIMEZONE_CHANGED = "android.intent.action.TIMEZONE_CHANGED"; /** + * Clear DNS Cache Action: This is broadcast when networks have changed and old + * DNS entries should be tossed. + * @hide + */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_CLEAR_DNS_CACHE = "android.intent.action.CLEAR_DNS_CACHE"; + /** * Alarm Changed Action: This is broadcast when the AlarmClock * application's alarm is set or unset. It is used by the * AlarmClock application and the StatusBar service. diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 3331e1b..43f175f 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -91,6 +91,7 @@ <protected-broadcast android:name="android.nfc.action.TAG_DISCOVERED" /> <protected-broadcast android:name="android.nfc.action.LLCP_LINK_STATE_CHANGED" /> <protected-broadcast android:name="android.nfc.action.TRANSACTION_DETECTED" /> + <protected-broadcast android:name="android.intent.action.CLEAR_DNS_CACHE" /> <!-- ====================================== --> <!-- Permissions for things that cost money --> |