Loading apishim/29/com/android/networkstack/apishim/api29/CaptivePortalDataShimImpl.java +30 −2 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.networkstack.apishim.api29; import android.net.CaptivePortalData; import android.net.Uri; import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; Loading Loading @@ -56,6 +57,12 @@ public abstract class CaptivePortalDataShimImpl implements CaptivePortalDataShim return null; } @Override public int getUserPortalUrlSource() { // Not supported in API level 29 return ConstantsShim.CAPTIVE_PORTAL_DATA_SOURCE_OTHER; } @VisibleForTesting public static boolean isSupported() { return false; Loading @@ -67,8 +74,29 @@ public abstract class CaptivePortalDataShimImpl implements CaptivePortalDataShim * @param friendlyName The friendly name to set * @return a {@link CaptivePortalData} object with a friendly name set */ public CaptivePortalData withVenueFriendlyName(String friendlyName) { @Override public CaptivePortalData withVenueFriendlyName(String friendlyName) throws UnsupportedApiLevelException { // Not supported in API level 29 return null; throw new UnsupportedApiLevelException("CaptivePortalData not supported on API 29"); } /** * Generate a {@link CaptivePortalData} object with a friendly name and Passpoint external URLs * set * * @param friendlyName The friendly name to set * @param venueInfoUrl Venue information URL * @param termsAndConditionsUrl Terms and conditions URL * * @return a {@link CaptivePortalData} object with friendly name, venue info URL and terms * and conditions URL set */ @Override public CaptivePortalData withPasspointInfo(@NonNull String friendlyName, @NonNull Uri venueInfoUrl, @NonNull Uri termsAndConditionsUrl) throws UnsupportedApiLevelException { // Not supported in API level 29 throw new UnsupportedApiLevelException("CaptivePortalData not supported on API 29"); } } apishim/29/com/android/networkstack/apishim/api29/ConstantsShim.java +4 −0 Original line number Diff line number Diff line Loading @@ -34,4 +34,8 @@ public class ConstantsShim { // Constants defined in android.net.ConnectivityDiagnosticsManager. public static final int DETECTION_METHOD_DNS_EVENTS = 1; public static final int DETECTION_METHOD_TCP_METRICS = 2; // Constants defined in android.net.CaptivePortalData. public static final int CAPTIVE_PORTAL_DATA_SOURCE_OTHER = 0; public static final int CAPTIVE_PORTAL_DATA_SOURCE_PASSPOINT = 1; } apishim/30/com/android/networkstack/apishim/api30/CaptivePortalDataShimImpl.java +32 −0 Original line number Diff line number Diff line Loading @@ -116,4 +116,36 @@ public class CaptivePortalDataShimImpl public void notifyChanged(INetworkMonitorCallbacks cb) throws RemoteException { cb.notifyCaptivePortalDataChanged(mData); } /** * Generate a {@link CaptivePortalData} object with a friendly name set * * @param friendlyName The friendly name to set * @return a {@link CaptivePortalData} object with a friendly name set */ @Override public CaptivePortalData withVenueFriendlyName(String friendlyName) throws UnsupportedApiLevelException { // Not supported in API level 29 throw new UnsupportedApiLevelException("FriendlyName not supported on API 30"); } /** * Generate a {@link CaptivePortalData} object with a friendly name and Passpoint external URLs * set * * @param friendlyName The friendly name to set * @param venueInfoUrl Venue information URL * @param termsAndConditionsUrl Terms and conditions URL * * @return a {@link CaptivePortalData} object with friendly name, venue info URL and terms * and conditions URL set */ @Override public CaptivePortalData withPasspointInfo(@NonNull String friendlyName, @NonNull Uri venueInfoUrl, @NonNull Uri termsAndConditionsUrl) throws UnsupportedApiLevelException { // Not supported in API level 29 throw new UnsupportedApiLevelException("PasspointInfo not supported on API 30"); } } apishim/31/com/android/networkstack/apishim/CaptivePortalDataShimImpl.java +33 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.networkstack.apishim; import android.net.CaptivePortalData; import android.net.Uri; import androidx.annotation.NonNull; Loading @@ -36,15 +37,47 @@ public class CaptivePortalDataShimImpl return mData.getVenueFriendlyName(); } /** * Get the information source of the User portal * @return The source that the User portal was obtained from */ @Override public int getUserPortalUrlSource() { return mData.getUserPortalUrlSource(); } /** * Generate a {@link CaptivePortalData} object with a friendly name set * * @param friendlyName The friendly name to set * @return a {@link CaptivePortalData} object with a friendly name set */ @Override public CaptivePortalData withVenueFriendlyName(String friendlyName) { return new CaptivePortalData.Builder(mData) .setVenueFriendlyName(friendlyName) .build(); } /** * Generate a {@link CaptivePortalData} object with a friendly name and Passpoint external * URLs set * * @param friendlyName The friendly name to set * @param venueInfoUrl Venue information URL * @param termsAndConditionsUrl Terms and conditions URL * * @return a {@link CaptivePortalData} object with friendly name, venue info URL and terms * and conditions URL set */ @Override public CaptivePortalData withPasspointInfo(@NonNull String friendlyName, @NonNull Uri venueInfoUrl, @NonNull Uri termsAndConditionsUrl) { return new CaptivePortalData.Builder(mData) .setVenueFriendlyName(friendlyName) .setVenueInfoUrl(venueInfoUrl, ConstantsShim.CAPTIVE_PORTAL_DATA_SOURCE_PASSPOINT) .setUserPortalUrl(termsAndConditionsUrl, ConstantsShim.CAPTIVE_PORTAL_DATA_SOURCE_PASSPOINT) .build(); } } apishim/common/com/android/networkstack/apishim/common/CaptivePortalDataShim.java +24 −1 Original line number Diff line number Diff line Loading @@ -56,6 +56,11 @@ public interface CaptivePortalDataShim { */ String getVenueFriendlyName(); /** * @see CaptivePortalData#getUserPortalUrlSource() */ int getUserPortalUrlSource(); /** * @see INetworkMonitorCallbacks#notifyCaptivePortalDataChanged(android.net.CaptivePortalData) */ Loading @@ -65,7 +70,25 @@ public interface CaptivePortalDataShim { * Generate a {@link CaptivePortalData} object with a friendly name set * * @param friendlyName The friendly name to set * @throws UnsupportedApiLevelException when used with API level lower than 31 * @return a {@link CaptivePortalData} object with a friendly name set */ CaptivePortalData withVenueFriendlyName(@NonNull String friendlyName); CaptivePortalData withVenueFriendlyName(@NonNull String friendlyName) throws UnsupportedApiLevelException; /** * Generate a {@link CaptivePortalData} object with a friendly name and Passpoint external URLs * set * * @param friendlyName The friendly name to set * @param venueInfoUrl Venue information URL * @param termsAndConditionsUrl Terms and conditions URL * * @throws UnsupportedApiLevelException when used with API level lower than 31 * @return a {@link CaptivePortalData} object with friendly name, venue info URL and terms * and conditions URL set */ CaptivePortalData withPasspointInfo(@NonNull String friendlyName, @NonNull Uri venueInfoUrl, @NonNull Uri termsAndConditionsUrl) throws UnsupportedApiLevelException; } Loading
apishim/29/com/android/networkstack/apishim/api29/CaptivePortalDataShimImpl.java +30 −2 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.networkstack.apishim.api29; import android.net.CaptivePortalData; import android.net.Uri; import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; Loading Loading @@ -56,6 +57,12 @@ public abstract class CaptivePortalDataShimImpl implements CaptivePortalDataShim return null; } @Override public int getUserPortalUrlSource() { // Not supported in API level 29 return ConstantsShim.CAPTIVE_PORTAL_DATA_SOURCE_OTHER; } @VisibleForTesting public static boolean isSupported() { return false; Loading @@ -67,8 +74,29 @@ public abstract class CaptivePortalDataShimImpl implements CaptivePortalDataShim * @param friendlyName The friendly name to set * @return a {@link CaptivePortalData} object with a friendly name set */ public CaptivePortalData withVenueFriendlyName(String friendlyName) { @Override public CaptivePortalData withVenueFriendlyName(String friendlyName) throws UnsupportedApiLevelException { // Not supported in API level 29 return null; throw new UnsupportedApiLevelException("CaptivePortalData not supported on API 29"); } /** * Generate a {@link CaptivePortalData} object with a friendly name and Passpoint external URLs * set * * @param friendlyName The friendly name to set * @param venueInfoUrl Venue information URL * @param termsAndConditionsUrl Terms and conditions URL * * @return a {@link CaptivePortalData} object with friendly name, venue info URL and terms * and conditions URL set */ @Override public CaptivePortalData withPasspointInfo(@NonNull String friendlyName, @NonNull Uri venueInfoUrl, @NonNull Uri termsAndConditionsUrl) throws UnsupportedApiLevelException { // Not supported in API level 29 throw new UnsupportedApiLevelException("CaptivePortalData not supported on API 29"); } }
apishim/29/com/android/networkstack/apishim/api29/ConstantsShim.java +4 −0 Original line number Diff line number Diff line Loading @@ -34,4 +34,8 @@ public class ConstantsShim { // Constants defined in android.net.ConnectivityDiagnosticsManager. public static final int DETECTION_METHOD_DNS_EVENTS = 1; public static final int DETECTION_METHOD_TCP_METRICS = 2; // Constants defined in android.net.CaptivePortalData. public static final int CAPTIVE_PORTAL_DATA_SOURCE_OTHER = 0; public static final int CAPTIVE_PORTAL_DATA_SOURCE_PASSPOINT = 1; }
apishim/30/com/android/networkstack/apishim/api30/CaptivePortalDataShimImpl.java +32 −0 Original line number Diff line number Diff line Loading @@ -116,4 +116,36 @@ public class CaptivePortalDataShimImpl public void notifyChanged(INetworkMonitorCallbacks cb) throws RemoteException { cb.notifyCaptivePortalDataChanged(mData); } /** * Generate a {@link CaptivePortalData} object with a friendly name set * * @param friendlyName The friendly name to set * @return a {@link CaptivePortalData} object with a friendly name set */ @Override public CaptivePortalData withVenueFriendlyName(String friendlyName) throws UnsupportedApiLevelException { // Not supported in API level 29 throw new UnsupportedApiLevelException("FriendlyName not supported on API 30"); } /** * Generate a {@link CaptivePortalData} object with a friendly name and Passpoint external URLs * set * * @param friendlyName The friendly name to set * @param venueInfoUrl Venue information URL * @param termsAndConditionsUrl Terms and conditions URL * * @return a {@link CaptivePortalData} object with friendly name, venue info URL and terms * and conditions URL set */ @Override public CaptivePortalData withPasspointInfo(@NonNull String friendlyName, @NonNull Uri venueInfoUrl, @NonNull Uri termsAndConditionsUrl) throws UnsupportedApiLevelException { // Not supported in API level 29 throw new UnsupportedApiLevelException("PasspointInfo not supported on API 30"); } }
apishim/31/com/android/networkstack/apishim/CaptivePortalDataShimImpl.java +33 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.networkstack.apishim; import android.net.CaptivePortalData; import android.net.Uri; import androidx.annotation.NonNull; Loading @@ -36,15 +37,47 @@ public class CaptivePortalDataShimImpl return mData.getVenueFriendlyName(); } /** * Get the information source of the User portal * @return The source that the User portal was obtained from */ @Override public int getUserPortalUrlSource() { return mData.getUserPortalUrlSource(); } /** * Generate a {@link CaptivePortalData} object with a friendly name set * * @param friendlyName The friendly name to set * @return a {@link CaptivePortalData} object with a friendly name set */ @Override public CaptivePortalData withVenueFriendlyName(String friendlyName) { return new CaptivePortalData.Builder(mData) .setVenueFriendlyName(friendlyName) .build(); } /** * Generate a {@link CaptivePortalData} object with a friendly name and Passpoint external * URLs set * * @param friendlyName The friendly name to set * @param venueInfoUrl Venue information URL * @param termsAndConditionsUrl Terms and conditions URL * * @return a {@link CaptivePortalData} object with friendly name, venue info URL and terms * and conditions URL set */ @Override public CaptivePortalData withPasspointInfo(@NonNull String friendlyName, @NonNull Uri venueInfoUrl, @NonNull Uri termsAndConditionsUrl) { return new CaptivePortalData.Builder(mData) .setVenueFriendlyName(friendlyName) .setVenueInfoUrl(venueInfoUrl, ConstantsShim.CAPTIVE_PORTAL_DATA_SOURCE_PASSPOINT) .setUserPortalUrl(termsAndConditionsUrl, ConstantsShim.CAPTIVE_PORTAL_DATA_SOURCE_PASSPOINT) .build(); } }
apishim/common/com/android/networkstack/apishim/common/CaptivePortalDataShim.java +24 −1 Original line number Diff line number Diff line Loading @@ -56,6 +56,11 @@ public interface CaptivePortalDataShim { */ String getVenueFriendlyName(); /** * @see CaptivePortalData#getUserPortalUrlSource() */ int getUserPortalUrlSource(); /** * @see INetworkMonitorCallbacks#notifyCaptivePortalDataChanged(android.net.CaptivePortalData) */ Loading @@ -65,7 +70,25 @@ public interface CaptivePortalDataShim { * Generate a {@link CaptivePortalData} object with a friendly name set * * @param friendlyName The friendly name to set * @throws UnsupportedApiLevelException when used with API level lower than 31 * @return a {@link CaptivePortalData} object with a friendly name set */ CaptivePortalData withVenueFriendlyName(@NonNull String friendlyName); CaptivePortalData withVenueFriendlyName(@NonNull String friendlyName) throws UnsupportedApiLevelException; /** * Generate a {@link CaptivePortalData} object with a friendly name and Passpoint external URLs * set * * @param friendlyName The friendly name to set * @param venueInfoUrl Venue information URL * @param termsAndConditionsUrl Terms and conditions URL * * @throws UnsupportedApiLevelException when used with API level lower than 31 * @return a {@link CaptivePortalData} object with friendly name, venue info URL and terms * and conditions URL set */ CaptivePortalData withPasspointInfo(@NonNull String friendlyName, @NonNull Uri venueInfoUrl, @NonNull Uri termsAndConditionsUrl) throws UnsupportedApiLevelException; }