diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayService.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayService.java index db576a6bc..0ffa26df8 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayService.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayService.java @@ -598,23 +598,23 @@ public class RelayService extends XWService { private String getDevID( byte[] typp ) { - byte typ; + UtilCtxt.DevIDType typ; String devid = XWPrefs.getRelayDevID( this ); if ( null != devid && 0 < devid.length() ) { - typ = UtilCtxt.ID_TYPE_RELAY; + typ = UtilCtxt.DevIDType.ID_TYPE_RELAY; } else { devid = XWPrefs.getGCMDevID( this ); if ( null != devid && 0 < devid.length() ) { - typ = UtilCtxt.ID_TYPE_ANDROID_GCM; + typ = UtilCtxt.DevIDType.ID_TYPE_ANDROID_GCM; } else { devid = ""; - typ = UtilCtxt.ID_TYPE_ANON; + typ = UtilCtxt.DevIDType.ID_TYPE_ANON; } } if ( null != typp ) { - typp[0] = typ; + typp[0] = (byte)typ.ordinal(); } else { - Assert.assertTrue( typ == UtilCtxt.ID_TYPE_RELAY ); + Assert.assertTrue( typ == UtilCtxt.DevIDType.ID_TYPE_RELAY ); } return devid; } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxt.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxt.java index ebf8b9a53..9d62b62c5 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxt.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxt.java @@ -57,14 +57,15 @@ public interface UtilCtxt { void setIsServer( boolean isServer ); // Possible values for typ[0], these must match enum in xwrelay.sh - public static final int ID_TYPE_NONE = 0; - public static final int ID_TYPE_RELAY = 1; - public static final int ID_TYPE_ANDROID_GCM = 3; - public static final int ID_TYPE_ANDROID_OTHER = 4; - public static final int ID_TYPE_ANON = 5; + public enum DevIDType { ID_TYPE_NONE + , ID_TYPE_RELAY + , ID_TYPE_ANDROID_GCM + , ID_TYPE_ANDROID_OTHER + , ID_TYPE_ANON + } String getDevID( /*out*/ byte[] typ ); - void deviceRegistered( int devIDType, String idRelay ); + void deviceRegistered( DevIDType devIDType, String idRelay ); void bonusSquareHeld( int bonus ); void playerScoreHeld( int player ); diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxtImpl.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxtImpl.java index b4ad0eb6a..0b6f67219 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxtImpl.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxtImpl.java @@ -96,29 +96,29 @@ public class UtilCtxtImpl implements UtilCtxt { public String getDevID( /*out*/ byte[] typa ) { - byte typ = UtilCtxt.ID_TYPE_NONE; + UtilCtxt.DevIDType typ = UtilCtxt.DevIDType.ID_TYPE_NONE; String result = XWPrefs.getRelayDevID( m_context ); if ( null != result ) { - typ = UtilCtxt.ID_TYPE_RELAY; + typ = UtilCtxt.DevIDType.ID_TYPE_RELAY; } else { result = XWPrefs.getGCMDevID( m_context ); if ( result.equals("") ) { result = null; } else { - typ = UtilCtxt.ID_TYPE_ANDROID_GCM; + typ = UtilCtxt.DevIDType.ID_TYPE_ANDROID_GCM; } } - typa[0] = typ; + typa[0] = (byte)typ.ordinal(); return result; } - public void deviceRegistered( int devIDType, String idRelay ) + public void deviceRegistered( UtilCtxt.DevIDType devIDType, String idRelay ) { switch ( devIDType ) { - case UtilCtxt.ID_TYPE_RELAY: + case ID_TYPE_RELAY: XWPrefs.setRelayDevID( m_context, idRelay ); break; - case UtilCtxt.ID_TYPE_NONE: + case ID_TYPE_NONE: XWPrefs.clearRelayDevID( m_context ); break; default: