Loading apishim/29/com/android/networkstack/apishim/api29/NetworkInformationShimImpl.java +16 −0 Original line number Diff line number Diff line Loading @@ -22,7 +22,9 @@ import android.net.Uri; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import com.android.networkstack.apishim.CaptivePortalDataShim; import com.android.networkstack.apishim.NetworkInformationShim; /** Loading @@ -44,6 +46,14 @@ public class NetworkInformationShimImpl implements NetworkInformationShim { return new NetworkInformationShimImpl(); } /** * Indicates whether the shim can use APIs above the Q SDK. */ @VisibleForTesting public static boolean useApiAboveQ() { return false; } @Nullable @Override public Uri getCaptivePortalApiUrl(@Nullable LinkProperties lp) { Loading @@ -56,6 +66,12 @@ public class NetworkInformationShimImpl implements NetworkInformationShim { // Not supported on this API level: no-op } @Nullable @Override public CaptivePortalDataShim getCaptivePortalData(@Nullable LinkProperties lp) { return null; } @Nullable @Override public String getSSID(@Nullable NetworkCapabilities nc) { Loading apishim/30/com/android/networkstack/apishim/CaptivePortalDataShimImpl.java +5 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,11 @@ public class CaptivePortalDataShimImpl return mData.getUserPortalUrl(); } @Override public Uri getVenueInfoUrl() { return mData.getVenueInfoUrl(); } @Override public void notifyChanged(INetworkMonitorCallbacks cb) throws RemoteException { cb.notifyCaptivePortalDataChanged(mData); Loading apishim/30/com/android/networkstack/apishim/NetworkInformationShimImpl.java +17 −1 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.os.Build; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; /** * Compatibility implementation of {@link NetworkInformationShim}. Loading @@ -35,12 +36,20 @@ public class NetworkInformationShimImpl extends * Get a new instance of {@link NetworkInformationShim}. */ public static NetworkInformationShim newInstance() { if (!ShimUtils.isReleaseOrDevelopmentApiAbove(Build.VERSION_CODES.Q)) { if (!useApiAboveQ()) { return com.android.networkstack.apishim.api29.NetworkInformationShimImpl.newInstance(); } return new NetworkInformationShimImpl(); } /** * Indicates whether the shim can use APIs above the Q SDK. */ @VisibleForTesting public static boolean useApiAboveQ() { return ShimUtils.isReleaseOrDevelopmentApiAbove(Build.VERSION_CODES.Q); } @Nullable @Override public Uri getCaptivePortalApiUrl(@Nullable LinkProperties lp) { Loading @@ -53,6 +62,13 @@ public class NetworkInformationShimImpl extends lp.setCaptivePortalApiUrl(url); } @Nullable @Override public CaptivePortalDataShim getCaptivePortalData(@Nullable LinkProperties lp) { if (lp == null || lp.getCaptivePortalData() == null) return null; return new CaptivePortalDataShimImpl(lp.getCaptivePortalData()); } @Nullable @Override public String getSSID(@Nullable NetworkCapabilities nc) { Loading apishim/common/com/android/networkstack/apishim/CaptivePortalDataShim.java +5 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,11 @@ public interface CaptivePortalDataShim { */ Uri getUserPortalUrl(); /** * @see android.net.CaptivePortalData#getVenueInfoUrl() */ Uri getVenueInfoUrl(); /** * @see INetworkMonitorCallbacks#notifyCaptivePortalDataChanged(android.net.CaptivePortalData) */ Loading apishim/common/com/android/networkstack/apishim/NetworkInformationShim.java +6 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,12 @@ public interface NetworkInformationShim { */ void setCaptivePortalApiUrl(@NonNull LinkProperties lp, @Nullable Uri url); /** * @see LinkProperties#getCaptivePortalData() */ @Nullable CaptivePortalDataShim getCaptivePortalData(@Nullable LinkProperties lp); /** * @see NetworkCapabilities#getSSID() */ Loading Loading
apishim/29/com/android/networkstack/apishim/api29/NetworkInformationShimImpl.java +16 −0 Original line number Diff line number Diff line Loading @@ -22,7 +22,9 @@ import android.net.Uri; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import com.android.networkstack.apishim.CaptivePortalDataShim; import com.android.networkstack.apishim.NetworkInformationShim; /** Loading @@ -44,6 +46,14 @@ public class NetworkInformationShimImpl implements NetworkInformationShim { return new NetworkInformationShimImpl(); } /** * Indicates whether the shim can use APIs above the Q SDK. */ @VisibleForTesting public static boolean useApiAboveQ() { return false; } @Nullable @Override public Uri getCaptivePortalApiUrl(@Nullable LinkProperties lp) { Loading @@ -56,6 +66,12 @@ public class NetworkInformationShimImpl implements NetworkInformationShim { // Not supported on this API level: no-op } @Nullable @Override public CaptivePortalDataShim getCaptivePortalData(@Nullable LinkProperties lp) { return null; } @Nullable @Override public String getSSID(@Nullable NetworkCapabilities nc) { Loading
apishim/30/com/android/networkstack/apishim/CaptivePortalDataShimImpl.java +5 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,11 @@ public class CaptivePortalDataShimImpl return mData.getUserPortalUrl(); } @Override public Uri getVenueInfoUrl() { return mData.getVenueInfoUrl(); } @Override public void notifyChanged(INetworkMonitorCallbacks cb) throws RemoteException { cb.notifyCaptivePortalDataChanged(mData); Loading
apishim/30/com/android/networkstack/apishim/NetworkInformationShimImpl.java +17 −1 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.os.Build; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; /** * Compatibility implementation of {@link NetworkInformationShim}. Loading @@ -35,12 +36,20 @@ public class NetworkInformationShimImpl extends * Get a new instance of {@link NetworkInformationShim}. */ public static NetworkInformationShim newInstance() { if (!ShimUtils.isReleaseOrDevelopmentApiAbove(Build.VERSION_CODES.Q)) { if (!useApiAboveQ()) { return com.android.networkstack.apishim.api29.NetworkInformationShimImpl.newInstance(); } return new NetworkInformationShimImpl(); } /** * Indicates whether the shim can use APIs above the Q SDK. */ @VisibleForTesting public static boolean useApiAboveQ() { return ShimUtils.isReleaseOrDevelopmentApiAbove(Build.VERSION_CODES.Q); } @Nullable @Override public Uri getCaptivePortalApiUrl(@Nullable LinkProperties lp) { Loading @@ -53,6 +62,13 @@ public class NetworkInformationShimImpl extends lp.setCaptivePortalApiUrl(url); } @Nullable @Override public CaptivePortalDataShim getCaptivePortalData(@Nullable LinkProperties lp) { if (lp == null || lp.getCaptivePortalData() == null) return null; return new CaptivePortalDataShimImpl(lp.getCaptivePortalData()); } @Nullable @Override public String getSSID(@Nullable NetworkCapabilities nc) { Loading
apishim/common/com/android/networkstack/apishim/CaptivePortalDataShim.java +5 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,11 @@ public interface CaptivePortalDataShim { */ Uri getUserPortalUrl(); /** * @see android.net.CaptivePortalData#getVenueInfoUrl() */ Uri getVenueInfoUrl(); /** * @see INetworkMonitorCallbacks#notifyCaptivePortalDataChanged(android.net.CaptivePortalData) */ Loading
apishim/common/com/android/networkstack/apishim/NetworkInformationShim.java +6 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,12 @@ public interface NetworkInformationShim { */ void setCaptivePortalApiUrl(@NonNull LinkProperties lp, @Nullable Uri url); /** * @see LinkProperties#getCaptivePortalData() */ @Nullable CaptivePortalDataShim getCaptivePortalData(@Nullable LinkProperties lp); /** * @see NetworkCapabilities#getSSID() */ Loading