API review: access field by method

- InvalidPacketException, public field should be a method so
  add getter to get error code.
- KeepalivePacketData, public fields should be methods so
   add getter for fields.

Bug: 151322799
Test: atest FrameworksNetTests
      atest FrameworksWifiTests
      atest FrameworksTelephonyTests: some failure in CarrierAppUtilsTest
Change-Id: Id01e6135193716cc21bba11da529bf1507a954f7
This commit is contained in:
Aaron Huang 2020-03-18 19:24:31 +08:00
commit 410236b92e

View file

@ -28,7 +28,7 @@ import java.lang.annotation.RetentionPolicy;
*/
@SystemApi
public class InvalidPacketException extends Exception {
public final int error;
private final int mError;
// Must match SocketKeepalive#ERROR_INVALID_IP_ADDRESS.
/** Invalid IP address. */
@ -56,6 +56,11 @@ public class InvalidPacketException extends Exception {
* See the error code for details.
*/
public InvalidPacketException(@ErrorCode final int error) {
this.error = error;
this.mError = error;
}
/** Get error code. */
public int getError() {
return mError;
}
}