Merge "Add permission check for CaptivePortal#reevaluateNetwork" am: 4940da0b98

Change-Id: I2f9de2582025c8fc3782870b8c561ce2002abaf8
This commit is contained in:
Automerger Merge Worker
2020-02-13 06:54:50 +00:00
4 changed files with 5 additions and 2 deletions

View File

@@ -4368,7 +4368,7 @@ package android.net {
public class CaptivePortal implements android.os.Parcelable { public class CaptivePortal implements android.os.Parcelable {
method public void logEvent(int, @NonNull String); method public void logEvent(int, @NonNull String);
method public void reevaluateNetwork(); method @RequiresPermission(android.Manifest.permission.NETWORK_STACK) public void reevaluateNetwork();
method public void useNetwork(); method public void useNetwork();
field public static final int APP_REQUEST_REEVALUATION_REQUIRED = 100; // 0x64 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_DISMISSED = 0; // 0x0

View File

@@ -1398,7 +1398,7 @@ package android.net {
public class CaptivePortal implements android.os.Parcelable { public class CaptivePortal implements android.os.Parcelable {
method public void logEvent(int, @NonNull String); method public void logEvent(int, @NonNull String);
method public void reevaluateNetwork(); method @RequiresPermission(android.Manifest.permission.NETWORK_STACK) public void reevaluateNetwork();
method public void useNetwork(); method public void useNetwork();
field public static final int APP_REQUEST_REEVALUATION_REQUIRED = 100; // 0x64 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_DISMISSED = 0; // 0x0

View File

@@ -16,6 +16,7 @@
package android.net; package android.net;
import android.annotation.NonNull; import android.annotation.NonNull;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi; import android.annotation.SystemApi;
import android.annotation.TestApi; import android.annotation.TestApi;
import android.os.IBinder; import android.os.IBinder;
@@ -153,6 +154,7 @@ public class CaptivePortal implements Parcelable {
*/ */
@SystemApi @SystemApi
@TestApi @TestApi
@RequiresPermission(android.Manifest.permission.NETWORK_STACK)
public void reevaluateNetwork() { public void reevaluateNetwork() {
try { try {
ICaptivePortal.Stub.asInterface(mBinder).appRequest(APP_REQUEST_REEVALUATION_REQUIRED); ICaptivePortal.Stub.asInterface(mBinder).appRequest(APP_REQUEST_REEVALUATION_REQUIRED);

View File

@@ -3739,6 +3739,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
if (nm == null) return; if (nm == null) return;
if (request == CaptivePortal.APP_REQUEST_REEVALUATION_REQUIRED) { if (request == CaptivePortal.APP_REQUEST_REEVALUATION_REQUIRED) {
checkNetworkStackPermission();
nm.forceReevaluation(Binder.getCallingUid()); nm.forceReevaluation(Binder.getCallingUid());
} }
} }