summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorChiachang Wang <chiachangwang@google.com>2020-01-14 01:42:22 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2020-01-14 01:42:22 +0000
commitba43c13e77cdb84df27fbf2244f50fed87314fa5 (patch)
tree87aad5e1843a35ed8229f90389b32a1786f4585f /core/java/android
parentc0f518b2d344c3cf1be7e0fe8d2656a3c2f0d01e (diff)
parent207b6cff269dde0c52e42caf5602a33d5c4e2bb5 (diff)
Merge "Support reevaluation request from captive portal app"
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/net/CaptivePortal.java25
-rw-r--r--core/java/android/net/ICaptivePortal.aidl1
2 files changed, 26 insertions, 0 deletions
diff --git a/core/java/android/net/CaptivePortal.java b/core/java/android/net/CaptivePortal.java
index a66fcae7d4a2..fb35b4bde303 100644
--- a/core/java/android/net/CaptivePortal.java
+++ b/core/java/android/net/CaptivePortal.java
@@ -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;
@@ -136,6 +148,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.
* @param packageName captive portal application package name.
diff --git a/core/java/android/net/ICaptivePortal.aidl b/core/java/android/net/ICaptivePortal.aidl
index 707b4f699873..fe21905c7002 100644
--- a/core/java/android/net/ICaptivePortal.aidl
+++ b/core/java/android/net/ICaptivePortal.aidl
@@ -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);
}