Loading apishim/29/com/android/networkstack/apishim/api29/NetworkInformationShimImpl.java +22 −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,10 +66,22 @@ 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) { // Not supported on this API level return null; } @NonNull @Override public LinkProperties makeSensitiveFieldsParcelingCopy(@NonNull final LinkProperties lp) { return new LinkProperties(lp); } } apishim/30/com/android/networkstack/apishim/CaptivePortalDataShimImpl.java +5 −2 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import android.os.Build; import android.os.RemoteException; import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; import org.json.JSONException; import org.json.JSONObject; Loading Loading @@ -70,7 +69,6 @@ public class CaptivePortalDataShimImpl .build()); } @VisibleForTesting public static boolean isSupported() { return ShimUtils.isReleaseOrDevelopmentApiAbove(Build.VERSION_CODES.Q); } Loading @@ -95,6 +93,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 +23 −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,10 +62,23 @@ 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) { if (nc == null) return null; return nc.getSSID(); } @NonNull @Override public LinkProperties makeSensitiveFieldsParcelingCopy(@NonNull final LinkProperties lp) { return lp.makeSensitiveFieldsParcelingCopy(); } } 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 +12 −0 Original line number Diff line number Diff line Loading @@ -39,9 +39,21 @@ public interface NetworkInformationShim { */ void setCaptivePortalApiUrl(@NonNull LinkProperties lp, @Nullable Uri url); /** * @see LinkProperties#getCaptivePortalData() */ @Nullable CaptivePortalDataShim getCaptivePortalData(@Nullable LinkProperties lp); /** * @see NetworkCapabilities#getSSID() */ @Nullable String getSSID(@Nullable NetworkCapabilities nc); /** * @see LinkProperties#makeSensitiveFieldsParcelingCopy() */ @NonNull LinkProperties makeSensitiveFieldsParcelingCopy(@NonNull LinkProperties lp); } Loading
apishim/29/com/android/networkstack/apishim/api29/NetworkInformationShimImpl.java +22 −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,10 +66,22 @@ 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) { // Not supported on this API level return null; } @NonNull @Override public LinkProperties makeSensitiveFieldsParcelingCopy(@NonNull final LinkProperties lp) { return new LinkProperties(lp); } }
apishim/30/com/android/networkstack/apishim/CaptivePortalDataShimImpl.java +5 −2 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import android.os.Build; import android.os.RemoteException; import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; import org.json.JSONException; import org.json.JSONObject; Loading Loading @@ -70,7 +69,6 @@ public class CaptivePortalDataShimImpl .build()); } @VisibleForTesting public static boolean isSupported() { return ShimUtils.isReleaseOrDevelopmentApiAbove(Build.VERSION_CODES.Q); } Loading @@ -95,6 +93,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 +23 −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,10 +62,23 @@ 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) { if (nc == null) return null; return nc.getSSID(); } @NonNull @Override public LinkProperties makeSensitiveFieldsParcelingCopy(@NonNull final LinkProperties lp) { return lp.makeSensitiveFieldsParcelingCopy(); } }
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 +12 −0 Original line number Diff line number Diff line Loading @@ -39,9 +39,21 @@ public interface NetworkInformationShim { */ void setCaptivePortalApiUrl(@NonNull LinkProperties lp, @Nullable Uri url); /** * @see LinkProperties#getCaptivePortalData() */ @Nullable CaptivePortalDataShim getCaptivePortalData(@Nullable LinkProperties lp); /** * @see NetworkCapabilities#getSSID() */ @Nullable String getSSID(@Nullable NetworkCapabilities nc); /** * @see LinkProperties#makeSensitiveFieldsParcelingCopy() */ @NonNull LinkProperties makeSensitiveFieldsParcelingCopy(@NonNull LinkProperties lp); }