Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 03595d01 authored by Robert Greenwalt's avatar Robert Greenwalt
Browse files

Tell each VM to flush their DNS cache.

bug:3095357
Change-Id: I93de24e3e5a7d8b94d55f4facfffc863a2b8c202
parent b52907f6
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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));
+14 −1
Original line number Diff line number Diff line
@@ -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();
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -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;
}
+7 −0
Original line number Diff line number Diff line
@@ -1222,6 +1222,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
+1 −0
Original line number Diff line number Diff line
@@ -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 -->
Loading