Loading api/system-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -4281,7 +4281,9 @@ package android.net { public class CaptivePortal implements android.os.Parcelable { method public void logEvent(int, @NonNull String); method public void reevaluateNetwork(); method public void useNetwork(); field public static final int APP_REQUEST_REEVALUATION_REQUIRED = 100; // 0x64 field public static final int APP_RETURN_DISMISSED = 0; // 0x0 field public static final int APP_RETURN_UNWANTED = 1; // 0x1 field public static final int APP_RETURN_WANTED_AS_IS = 2; // 0x2 Loading api/test-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -1350,7 +1350,9 @@ package android.net { public class CaptivePortal implements android.os.Parcelable { method public void logEvent(int, @NonNull String); method public void reevaluateNetwork(); method public void useNetwork(); field public static final int APP_REQUEST_REEVALUATION_REQUIRED = 100; // 0x64 field public static final int APP_RETURN_DISMISSED = 0; // 0x0 field public static final int APP_RETURN_UNWANTED = 1; // 0x1 field public static final int APP_RETURN_WANTED_AS_IS = 2; // 0x2 Loading core/java/android/net/CaptivePortal.java +25 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,18 @@ public class CaptivePortal implements Parcelable { @SystemApi @TestApi public static final int APP_RETURN_WANTED_AS_IS = 2; /** Event offset of request codes from captive portal application. */ private static final int APP_REQUEST_BASE = 100; /** * Request code from the captive portal application, indicating that the network condition may * have changed and the network should be re-validated. * @see ICaptivePortal#appRequest(int) * @see android.net.INetworkMonitor#forceReevaluation(int) * @hide */ @SystemApi @TestApi public static final int APP_REQUEST_REEVALUATION_REQUIRED = APP_REQUEST_BASE + 0; private final IBinder mBinder; Loading Loading @@ -135,6 +147,19 @@ public class CaptivePortal implements Parcelable { } } /** * Request that the system reevaluates the captive portal status. * @hide */ @SystemApi @TestApi public void reevaluateNetwork() { try { ICaptivePortal.Stub.asInterface(mBinder).appRequest(APP_REQUEST_REEVALUATION_REQUIRED); } catch (RemoteException e) { } } /** * Log a captive portal login event. * @param eventId one of the CAPTIVE_PORTAL_LOGIN_* constants in metrics_constants.proto. Loading core/java/android/net/ICaptivePortal.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ package android.net; * @hide */ oneway interface ICaptivePortal { void appRequest(int request); void appResponse(int response); void logEvent(int eventId, String packageName); } services/core/java/com/android/server/ConnectivityService.java +20 −5 Original line number Diff line number Diff line Loading @@ -3609,14 +3609,29 @@ public class ConnectivityService extends IConnectivityManager.Stub enforceSettingsPermission(); } final NetworkMonitorManager nm = getNetworkMonitorManager(mNetwork); if (nm == null) return; nm.notifyCaptivePortalAppFinished(response); } @Override public void appRequest(final int request) { final NetworkMonitorManager nm = getNetworkMonitorManager(mNetwork); if (nm == null) return; if (request == CaptivePortal.APP_REQUEST_REEVALUATION_REQUIRED) { nm.forceReevaluation(Binder.getCallingUid()); } } @Nullable private NetworkMonitorManager getNetworkMonitorManager(final Network network) { // getNetworkAgentInfoForNetwork is thread-safe final NetworkAgentInfo nai = getNetworkAgentInfoForNetwork(mNetwork); if (nai == null) return; final NetworkAgentInfo nai = getNetworkAgentInfoForNetwork(network); if (nai == null) return null; // nai.networkMonitor() is thread-safe final NetworkMonitorManager nm = nai.networkMonitor(); if (nm == null) return; nm.notifyCaptivePortalAppFinished(response); return nai.networkMonitor(); } @Override Loading Loading
api/system-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -4281,7 +4281,9 @@ package android.net { public class CaptivePortal implements android.os.Parcelable { method public void logEvent(int, @NonNull String); method public void reevaluateNetwork(); method public void useNetwork(); field public static final int APP_REQUEST_REEVALUATION_REQUIRED = 100; // 0x64 field public static final int APP_RETURN_DISMISSED = 0; // 0x0 field public static final int APP_RETURN_UNWANTED = 1; // 0x1 field public static final int APP_RETURN_WANTED_AS_IS = 2; // 0x2 Loading
api/test-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -1350,7 +1350,9 @@ package android.net { public class CaptivePortal implements android.os.Parcelable { method public void logEvent(int, @NonNull String); method public void reevaluateNetwork(); method public void useNetwork(); field public static final int APP_REQUEST_REEVALUATION_REQUIRED = 100; // 0x64 field public static final int APP_RETURN_DISMISSED = 0; // 0x0 field public static final int APP_RETURN_UNWANTED = 1; // 0x1 field public static final int APP_RETURN_WANTED_AS_IS = 2; // 0x2 Loading
core/java/android/net/CaptivePortal.java +25 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,18 @@ public class CaptivePortal implements Parcelable { @SystemApi @TestApi public static final int APP_RETURN_WANTED_AS_IS = 2; /** Event offset of request codes from captive portal application. */ private static final int APP_REQUEST_BASE = 100; /** * Request code from the captive portal application, indicating that the network condition may * have changed and the network should be re-validated. * @see ICaptivePortal#appRequest(int) * @see android.net.INetworkMonitor#forceReevaluation(int) * @hide */ @SystemApi @TestApi public static final int APP_REQUEST_REEVALUATION_REQUIRED = APP_REQUEST_BASE + 0; private final IBinder mBinder; Loading Loading @@ -135,6 +147,19 @@ public class CaptivePortal implements Parcelable { } } /** * Request that the system reevaluates the captive portal status. * @hide */ @SystemApi @TestApi public void reevaluateNetwork() { try { ICaptivePortal.Stub.asInterface(mBinder).appRequest(APP_REQUEST_REEVALUATION_REQUIRED); } catch (RemoteException e) { } } /** * Log a captive portal login event. * @param eventId one of the CAPTIVE_PORTAL_LOGIN_* constants in metrics_constants.proto. Loading
core/java/android/net/ICaptivePortal.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ package android.net; * @hide */ oneway interface ICaptivePortal { void appRequest(int request); void appResponse(int response); void logEvent(int eventId, String packageName); }
services/core/java/com/android/server/ConnectivityService.java +20 −5 Original line number Diff line number Diff line Loading @@ -3609,14 +3609,29 @@ public class ConnectivityService extends IConnectivityManager.Stub enforceSettingsPermission(); } final NetworkMonitorManager nm = getNetworkMonitorManager(mNetwork); if (nm == null) return; nm.notifyCaptivePortalAppFinished(response); } @Override public void appRequest(final int request) { final NetworkMonitorManager nm = getNetworkMonitorManager(mNetwork); if (nm == null) return; if (request == CaptivePortal.APP_REQUEST_REEVALUATION_REQUIRED) { nm.forceReevaluation(Binder.getCallingUid()); } } @Nullable private NetworkMonitorManager getNetworkMonitorManager(final Network network) { // getNetworkAgentInfoForNetwork is thread-safe final NetworkAgentInfo nai = getNetworkAgentInfoForNetwork(mNetwork); if (nai == null) return; final NetworkAgentInfo nai = getNetworkAgentInfoForNetwork(network); if (nai == null) return null; // nai.networkMonitor() is thread-safe final NetworkMonitorManager nm = nai.networkMonitor(); if (nm == null) return; nm.notifyCaptivePortalAppFinished(response); return nai.networkMonitor(); } @Override Loading