I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit d3a1910b authored by str4d's avatar str4d
Browse files

Return null on unknown State in Parcel

parent aa43d960
No related branches found
No related tags found
No related merge requests found
......@@ -27,8 +27,13 @@ interface IRouterState {
boolean isStarted();
/**
* Get the state of the I2P router
**/
* Get the state of the I2P router.
*
* @return null if the State is not known, e.g. a new state has been added
* to State.aidl in I2P Android. Client app devs should update their client
* library, or their copy of State.aidl, if they are getting null States.
* Future State.aidl versions will be backwards-compatible.
*/
State getState();
}
......@@ -9,7 +9,10 @@ import net.i2p.android.router.service.State;
*/
oneway interface IRouterStateCallback {
/**
* Called when the state of the I2P router changes
* Called when the state of the I2P router changes.
*
* @param newState may be null if the State is not known. See
* {@link net.i2p.android.router.service.IRouterState#getState()}.
*/
void stateChanged(in State newState);
}
......@@ -34,7 +34,12 @@ public enum State implements Parcelable {
public static final Creator<State> CREATOR = new Creator<State>() {
@Override
public State createFromParcel(final Parcel source) {
return State.valueOf(source.readString());
try {
return State.valueOf(source.readString());
} catch (IllegalArgumentException e) {
// Parcel is from a newer version of State with new states.
return null;
}
}
@Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment