diff options
| author | 2024-03-14 05:16:23 +0000 | |
|---|---|---|
| committer | 2024-03-14 05:16:23 +0000 | |
| commit | d4e9f6769148e3c73d9a8d974537290b64cdc98f (patch) | |
| tree | 82edc53caf29b6a57886427735d301d9905bfeea | |
| parent | f41ab02de50a53c6ed815bfb73d43bde1b1281f3 (diff) | |
| parent | 8cdacba76f1c8321ad88258ccf63f5e9136a103e (diff) | |
Merge "Clear dns cache when restoring network access" into main am: 8cdacba76f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2999816
Change-Id: I11a8a2763d60c3bc01acc3ca0a56a4b79552b61b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | core/java/android/app/ActivityThread.java | 7 | ||||
| -rw-r--r-- | core/java/android/app/network-policy.aconfig | 11 |
2 files changed, 18 insertions, 0 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 6ddb36a72aa9..0e66010ae2c3 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -4022,6 +4022,13 @@ public final class ActivityThread extends ClientTransactionHandler ActivityManager.getService().waitForNetworkStateUpdate(mNetworkBlockSeq); mNetworkBlockSeq = INVALID_PROC_STATE_SEQ; } catch (RemoteException ignored) {} + if (android.app.Flags.clearDnsCacheOnNetworkRulesUpdate()) { + // InetAddress will cache UnknownHostException failures. If the rules got + // updated and the app has network access now, we need to clear the negative + // cache to ensure valid dns queries can work immediately. + // TODO: b/329133769 - Clear only the negative cache once it is available. + InetAddress.clearDnsCache(); + } } } } diff --git a/core/java/android/app/network-policy.aconfig b/core/java/android/app/network-policy.aconfig new file mode 100644 index 000000000000..88f386f6025d --- /dev/null +++ b/core/java/android/app/network-policy.aconfig @@ -0,0 +1,11 @@ +package: "android.app" + +flag { + namespace: "backstage_power" + name: "clear_dns_cache_on_network_rules_update" + description: "Clears the DNS cache when the network rules update" + bug: "237556596" + metadata { + purpose: PURPOSE_BUGFIX + } +}
\ No newline at end of file |