mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-30 10:26:58 +01:00
wifi: move setting into build.xml
Control whether wifi direct is enabled from build.xml, a file that's already different for the two variants. The point here is to do a release with permissions changes but without having to fix everything wrong with wifi direct.
This commit is contained in:
parent
ecdec9cfd8
commit
432b738257
5 changed files with 20 additions and 9 deletions
|
@ -58,6 +58,7 @@
|
|||
<property name="INITIAL_CLIENT_VERS" value="8"/>
|
||||
<property name="VARIANT_NAME" value="xw4dbg"/>
|
||||
<property name="APP_NAME" value="CrossDbg"/>
|
||||
<property name="WIDIR_ENABLED" value="true" />
|
||||
|
||||
<target name="-pre-clean">
|
||||
<antcall target="my-pre-clean" />
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
<property name="VARIANT_NAME" value="xw4"/>
|
||||
<property name="APP_NAME" value="Crosswords"/>
|
||||
<property name="SKIP_LANGS" value="values-de"/>
|
||||
<property name="WIDIR_ENABLED" value="false" />
|
||||
|
||||
<target name="-pre-clean">
|
||||
<antcall target="my-pre-clean" />
|
||||
|
|
|
@ -76,7 +76,6 @@ public class WiDirService extends XWService {
|
|||
private static final String MAC_ADDR_KEY = "p2p_mac_addr";
|
||||
private static final String SERVICE_NAME = "srvc_" + BuildConstants.VARIANT;
|
||||
private static final String SERVICE_REG_TYPE = "_presence._tcp";
|
||||
private static final boolean WIFI_DIRECT_ENABLED = true;
|
||||
private static final int OWNER_PORT = 5432;
|
||||
|
||||
private enum P2PAction { _NONE,
|
||||
|
@ -138,7 +137,7 @@ public class WiDirService extends XWService {
|
|||
{
|
||||
int result;
|
||||
|
||||
if ( WIFI_DIRECT_ENABLED && null != intent ) {
|
||||
if ( BuildConstants.WIDIR_ENABLED && null != intent ) {
|
||||
result = Service.START_STICKY;
|
||||
|
||||
int ordinal = intent.getIntExtra( KEY_CMD, -1 );
|
||||
|
@ -205,7 +204,7 @@ public class WiDirService extends XWService {
|
|||
|
||||
public static boolean supported()
|
||||
{
|
||||
return WIFI_DIRECT_ENABLED;
|
||||
return BuildConstants.WIDIR_ENABLED;
|
||||
}
|
||||
|
||||
public static boolean connecting() {
|
||||
|
@ -216,7 +215,7 @@ public class WiDirService extends XWService {
|
|||
|
||||
public static String getMyMacAddress( Context context )
|
||||
{
|
||||
if ( WIFI_DIRECT_ENABLED ) {
|
||||
if ( BuildConstants.WIDIR_ENABLED ) {
|
||||
if ( null == sMacAddress && null != context ) {
|
||||
sMacAddress = DBUtils.getStringFor( context, MAC_ADDR_KEY, null );
|
||||
}
|
||||
|
@ -305,7 +304,7 @@ public class WiDirService extends XWService {
|
|||
|
||||
public static void activityResumed( Activity activity )
|
||||
{
|
||||
if ( WIFI_DIRECT_ENABLED && sHavePermission ) {
|
||||
if ( BuildConstants.WIDIR_ENABLED && sHavePermission ) {
|
||||
if ( initListeners( activity ) ) {
|
||||
activity.registerReceiver( sReceiver, sIntentFilter );
|
||||
DbgUtils.logd( TAG, "activityResumed() done" );
|
||||
|
@ -316,7 +315,7 @@ public class WiDirService extends XWService {
|
|||
|
||||
public static void activityPaused( Activity activity )
|
||||
{
|
||||
if ( WIFI_DIRECT_ENABLED && sHavePermission ) {
|
||||
if ( BuildConstants.WIDIR_ENABLED && sHavePermission ) {
|
||||
Assert.assertNotNull( sReceiver );
|
||||
// No idea why I'm seeing this exception...
|
||||
try {
|
||||
|
@ -345,7 +344,7 @@ public class WiDirService extends XWService {
|
|||
private static boolean initListeners( final Context context )
|
||||
{
|
||||
boolean succeeded = false;
|
||||
if ( WIFI_DIRECT_ENABLED ) {
|
||||
if ( BuildConstants.WIDIR_ENABLED ) {
|
||||
if ( null == sIface ) {
|
||||
try {
|
||||
WifiP2pManager mgr = getMgr();
|
||||
|
@ -593,7 +592,7 @@ public class WiDirService extends XWService {
|
|||
|
||||
private static void setDiscoveryListeners( WifiP2pManager mgr )
|
||||
{
|
||||
if ( WIFI_DIRECT_ENABLED ) {
|
||||
if ( BuildConstants.WIDIR_ENABLED ) {
|
||||
DnsSdServiceResponseListener srl = new DnsSdServiceResponseListener() {
|
||||
@Override
|
||||
public void onDnsSdServiceAvailable(String instanceName,
|
||||
|
@ -1024,7 +1023,7 @@ public class WiDirService extends XWService {
|
|||
|
||||
@Override
|
||||
public void onReceive( Context context, Intent intent ) {
|
||||
if ( WIFI_DIRECT_ENABLED ) {
|
||||
if ( BuildConstants.WIDIR_ENABLED ) {
|
||||
String action = intent.getAction();
|
||||
DbgUtils.logd( TAG, "got intent: " + intent.toString() );
|
||||
|
||||
|
|
|
@ -65,6 +65,8 @@
|
|||
<arg value="${INITIAL_CLIENT_VERS}" />
|
||||
<arg value="--vers-outfile" />
|
||||
<arg value="./assets/gitvers.txt" />
|
||||
<arg value="--widir-enabled" />
|
||||
<arg value="${WIDIR_ENABLED}" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
|
|
|
@ -8,10 +8,13 @@ VARIANT=""
|
|||
CLIENT_VERS_RELAY=""
|
||||
GCM_SENDER_ID=${GCM_SENDER_ID:-""}
|
||||
CRITTERCISM_APP_ID=${CRITTERCISM_APP_ID:-""}
|
||||
WIDIR_ENABLED=false
|
||||
|
||||
usage() {
|
||||
echo "usage: $0 --variant <variant> --client-vers <relay_vers> \\"
|
||||
echo " [--vers-outfile path/to/versout.txt]"
|
||||
echo " [--widir-enabled true|false]"
|
||||
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
@ -30,6 +33,10 @@ while [ $# -gt 0 ]; do
|
|||
OUT_PATH=$2
|
||||
shift
|
||||
;;
|
||||
--widir-enabled)
|
||||
WIDIR_ENABLED=$2
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
|
@ -113,6 +120,7 @@ public class BuildConstants {
|
|||
public static final String VARIANT = "$VARIANT";
|
||||
public static final String GCM_SENDER_ID = "${GCM_SENDER_ID}";
|
||||
public static final String CRITTERCISM_APP_ID = "${CRITTERCISM_APP_ID}";
|
||||
public static final boolean WIDIR_ENABLED = ${WIDIR_ENABLED};
|
||||
}
|
||||
EOF
|
||||
|
||||
|
|
Loading…
Reference in a new issue