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
Loading
Please register or sign in to comment