summaryrefslogtreecommitdiff
path: root/common/networkstackclient/src/android
diff options
context:
space:
mode:
authorRemi NGUYEN VAN <reminv@google.com>2019-12-18 20:57:47 +0900
committerRemi NGUYEN VAN <reminv@google.com>2020-02-14 15:10:01 +0900
commit8282d3c8f1c152f171099b617341f89444a2d92d (patch)
tree40f3cd42205423e2a0f5ae189207d7734fb83262 /common/networkstackclient/src/android
parent5365684ad59e25d3633fc0f5b2a8328cddc0a235 (diff)
Add shims for network info classes
Combine shims for LinkProperties and NetworkCapabilities to avoid too many shim classes, and use static methods as the original types (and not the shims) would generally be used to reference the classes. CaptivePortalData is not available in API29 so CaptivePortalDataShim is used as a wrapper that can hold a reference to it in common code. Sample usage in NetworkMonitor: final CaptivePortalDataShim data; try { data = CaptivePortalDataShimImpl.fromJSON(obj); } catch (UnsupportedApiLevelException | JSONException e) { // Do some fallback return; } // Just to give an idea if (data.isCaptive()) { openCaptivePortalApp(data.getUserPortalUrl()); } data.notifyChanged(mCallbacks); Test: atest NetworkStackTests NetworkStackNextTests Bug: 139269711 Change-Id: I262aaa41013ebe1ec4263a6516bd8cab76509304
Diffstat (limited to 'common/networkstackclient/src/android')
-rw-r--r--common/networkstackclient/src/android/net/INetworkMonitorCallbacks.aidl2
1 files changed, 2 insertions, 0 deletions
diff --git a/common/networkstackclient/src/android/net/INetworkMonitorCallbacks.aidl b/common/networkstackclient/src/android/net/INetworkMonitorCallbacks.aidl
index e2901dd..f57a8f7 100644
--- a/common/networkstackclient/src/android/net/INetworkMonitorCallbacks.aidl
+++ b/common/networkstackclient/src/android/net/INetworkMonitorCallbacks.aidl
@@ -16,6 +16,7 @@
package android.net;
+import android.net.CaptivePortalData;
import android.net.INetworkMonitor;
import android.net.PrivateDnsConfigParcel;
@@ -33,4 +34,5 @@ oneway interface INetworkMonitorCallbacks {
long timestampMillis, in PersistableBundle extras);
void notifyDataStallSuspected(long timestampMillis, int detectionMethod,
in PersistableBundle extras);
+ void notifyCaptivePortalDataChanged(in CaptivePortalData data);
} \ No newline at end of file