Fix API in CaptivePortal and ConnectivityManager
- Remove CaptivePortal constructor from SystemApi. This constructor was added in Q timeframe and ends up being unnecessary since CaptivePortal creation was refactored to ConnectivityService because of visibility issues on ICaptivePortal. - Rename getAvoidBadWifi to shouldAvoidBadWifi - Add permission annotation for shouldAvoidBadWifi (already merged in internal as: I09545c00af3519dbf141dd5951b28f49e37b3e80) Test: flashed, WiFi and captive portal works Bug: 128935314 Bug: 128935673 Merged-In: I09545c00af3519dbf141dd5951b28f49e37b3e80 Change-Id: I7395d4a4db6a64398a827692aee1956c011873e5
This commit is contained in:
@@ -64,8 +64,6 @@ public class CaptivePortal implements Parcelable {
|
||||
private final IBinder mBinder;
|
||||
|
||||
/** @hide */
|
||||
@SystemApi
|
||||
@TestApi
|
||||
public CaptivePortal(@NonNull IBinder binder) {
|
||||
mBinder = binder;
|
||||
}
|
||||
|
||||
@@ -4101,9 +4101,12 @@ public class ConnectivityManager {
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public boolean getAvoidBadWifi() {
|
||||
@RequiresPermission(anyOf = {
|
||||
NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK,
|
||||
android.Manifest.permission.NETWORK_STACK})
|
||||
public boolean shouldAvoidBadWifi() {
|
||||
try {
|
||||
return mService.getAvoidBadWifi();
|
||||
return mService.shouldAvoidBadWifi();
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ interface IConnectivityManager
|
||||
void startCaptivePortalApp(in Network network);
|
||||
void startCaptivePortalAppInternal(in Network network, in Bundle appExtras);
|
||||
|
||||
boolean getAvoidBadWifi();
|
||||
boolean shouldAvoidBadWifi();
|
||||
int getMultipathPreference(in Network Network);
|
||||
|
||||
NetworkRequest getDefaultRequest();
|
||||
|
||||
@@ -3470,8 +3470,12 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
return mMultinetworkPolicyTracker.getAvoidBadWifi();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getAvoidBadWifi() {
|
||||
/**
|
||||
* Return whether the device should maintain continuous, working connectivity by switching away
|
||||
* from WiFi networks having no connectivity.
|
||||
* @see MultinetworkPolicyTracker#getAvoidBadWifi()
|
||||
*/
|
||||
public boolean shouldAvoidBadWifi() {
|
||||
if (!checkNetworkStackPermission()) {
|
||||
throw new SecurityException("avoidBadWifi requires NETWORK_STACK permission");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user