Annotate public methods in ConnectivityService.
Ensure every public method is annotated with why it's public. This can be either an @Override or @VisibleForTesting annotation or a comment explaining why it's public. Bug: 29927488 Change-Id: I3582aef7997dc0d723718ca5e3dd115647d22979
This commit is contained in:
@@ -1083,6 +1083,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
return nai != null ? nai.network : null;
|
return nai != null ? nai.network : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Public because it's used by mLockdownTracker.
|
||||||
public NetworkInfo getActiveNetworkInfoUnfiltered() {
|
public NetworkInfo getActiveNetworkInfoUnfiltered() {
|
||||||
enforceAccessPermission();
|
enforceAccessPermission();
|
||||||
final int uid = Binder.getCallingUid();
|
final int uid = Binder.getCallingUid();
|
||||||
@@ -1338,6 +1339,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
* desired
|
* desired
|
||||||
* @return {@code true} on success, {@code false} on failure
|
* @return {@code true} on success, {@code false} on failure
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean requestRouteToHostAddress(int networkType, byte[] hostAddress) {
|
public boolean requestRouteToHostAddress(int networkType, byte[] hostAddress) {
|
||||||
enforceChangePermission();
|
enforceChangePermission();
|
||||||
if (mProtectedNetworks.contains(networkType)) {
|
if (mProtectedNetworks.contains(networkType)) {
|
||||||
@@ -1546,6 +1548,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
mContext.enforceCallingOrSelfPermission(KeepaliveTracker.PERMISSION, "ConnectivityService");
|
mContext.enforceCallingOrSelfPermission(KeepaliveTracker.PERMISSION, "ConnectivityService");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Public because it's used by mLockdownTracker.
|
||||||
public void sendConnectedBroadcast(NetworkInfo info) {
|
public void sendConnectedBroadcast(NetworkInfo info) {
|
||||||
enforceConnectivityInternalPermission();
|
enforceConnectivityInternalPermission();
|
||||||
sendGeneralBroadcast(info, CONNECTIVITY_ACTION);
|
sendGeneralBroadcast(info, CONNECTIVITY_ACTION);
|
||||||
@@ -2513,6 +2516,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setAcceptUnvalidated(Network network, boolean accept, boolean always) {
|
public void setAcceptUnvalidated(Network network, boolean accept, boolean always) {
|
||||||
enforceConnectivityInternalPermission();
|
enforceConnectivityInternalPermission();
|
||||||
mHandler.sendMessage(mHandler.obtainMessage(EVENT_SET_ACCEPT_UNVALIDATED,
|
mHandler.sendMessage(mHandler.obtainMessage(EVENT_SET_ACCEPT_UNVALIDATED,
|
||||||
@@ -2696,6 +2700,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
// javadoc from interface
|
// javadoc from interface
|
||||||
|
@Override
|
||||||
public int tether(String iface) {
|
public int tether(String iface) {
|
||||||
ConnectivityManager.enforceTetherChangePermission(mContext);
|
ConnectivityManager.enforceTetherChangePermission(mContext);
|
||||||
if (isTetheringSupported()) {
|
if (isTetheringSupported()) {
|
||||||
@@ -2713,6 +2718,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
// javadoc from interface
|
// javadoc from interface
|
||||||
|
@Override
|
||||||
public int untether(String iface) {
|
public int untether(String iface) {
|
||||||
ConnectivityManager.enforceTetherChangePermission(mContext);
|
ConnectivityManager.enforceTetherChangePermission(mContext);
|
||||||
|
|
||||||
@@ -2731,6 +2737,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
// javadoc from interface
|
// javadoc from interface
|
||||||
|
@Override
|
||||||
public int getLastTetherError(String iface) {
|
public int getLastTetherError(String iface) {
|
||||||
enforceTetherAccessPermission();
|
enforceTetherAccessPermission();
|
||||||
|
|
||||||
@@ -2742,6 +2749,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO - proper iface API for selection by property, inspection, etc
|
// TODO - proper iface API for selection by property, inspection, etc
|
||||||
|
@Override
|
||||||
public String[] getTetherableUsbRegexs() {
|
public String[] getTetherableUsbRegexs() {
|
||||||
enforceTetherAccessPermission();
|
enforceTetherAccessPermission();
|
||||||
if (isTetheringSupported()) {
|
if (isTetheringSupported()) {
|
||||||
@@ -2751,6 +2759,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String[] getTetherableWifiRegexs() {
|
public String[] getTetherableWifiRegexs() {
|
||||||
enforceTetherAccessPermission();
|
enforceTetherAccessPermission();
|
||||||
if (isTetheringSupported()) {
|
if (isTetheringSupported()) {
|
||||||
@@ -2760,6 +2769,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String[] getTetherableBluetoothRegexs() {
|
public String[] getTetherableBluetoothRegexs() {
|
||||||
enforceTetherAccessPermission();
|
enforceTetherAccessPermission();
|
||||||
if (isTetheringSupported()) {
|
if (isTetheringSupported()) {
|
||||||
@@ -2769,6 +2779,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int setUsbTethering(boolean enable) {
|
public int setUsbTethering(boolean enable) {
|
||||||
ConnectivityManager.enforceTetherChangePermission(mContext);
|
ConnectivityManager.enforceTetherChangePermission(mContext);
|
||||||
if (isTetheringSupported()) {
|
if (isTetheringSupported()) {
|
||||||
@@ -2780,21 +2791,25 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
|
|
||||||
// TODO - move iface listing, queries, etc to new module
|
// TODO - move iface listing, queries, etc to new module
|
||||||
// javadoc from interface
|
// javadoc from interface
|
||||||
|
@Override
|
||||||
public String[] getTetherableIfaces() {
|
public String[] getTetherableIfaces() {
|
||||||
enforceTetherAccessPermission();
|
enforceTetherAccessPermission();
|
||||||
return mTethering.getTetherableIfaces();
|
return mTethering.getTetherableIfaces();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String[] getTetheredIfaces() {
|
public String[] getTetheredIfaces() {
|
||||||
enforceTetherAccessPermission();
|
enforceTetherAccessPermission();
|
||||||
return mTethering.getTetheredIfaces();
|
return mTethering.getTetheredIfaces();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String[] getTetheringErroredIfaces() {
|
public String[] getTetheringErroredIfaces() {
|
||||||
enforceTetherAccessPermission();
|
enforceTetherAccessPermission();
|
||||||
return mTethering.getErroredIfaces();
|
return mTethering.getErroredIfaces();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String[] getTetheredDhcpRanges() {
|
public String[] getTetheredDhcpRanges() {
|
||||||
enforceConnectivityInternalPermission();
|
enforceConnectivityInternalPermission();
|
||||||
return mTethering.getTetheredDhcpRanges();
|
return mTethering.getTetheredDhcpRanges();
|
||||||
@@ -2853,12 +2868,14 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 100 percent is full good, 0 is full bad.
|
// 100 percent is full good, 0 is full bad.
|
||||||
|
@Override
|
||||||
public void reportInetCondition(int networkType, int percentage) {
|
public void reportInetCondition(int networkType, int percentage) {
|
||||||
NetworkAgentInfo nai = mLegacyTypeTracker.getNetworkForType(networkType);
|
NetworkAgentInfo nai = mLegacyTypeTracker.getNetworkForType(networkType);
|
||||||
if (nai == null) return;
|
if (nai == null) return;
|
||||||
reportNetworkConnectivity(nai.network, percentage > 50);
|
reportNetworkConnectivity(nai.network, percentage > 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void reportNetworkConnectivity(Network network, boolean hasConnectivity) {
|
public void reportNetworkConnectivity(Network network, boolean hasConnectivity) {
|
||||||
enforceAccessPermission();
|
enforceAccessPermission();
|
||||||
enforceInternetPermission();
|
enforceInternetPermission();
|
||||||
@@ -2903,6 +2920,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ProxyInfo getProxyForNetwork(Network network) {
|
public ProxyInfo getProxyForNetwork(Network network) {
|
||||||
if (network == null) return getDefaultProxy();
|
if (network == null) return getDefaultProxy();
|
||||||
final ProxyInfo globalProxy = getGlobalProxy();
|
final ProxyInfo globalProxy = getGlobalProxy();
|
||||||
|
|||||||
Reference in New Issue
Block a user