From bd965884f076875312710cea7bb84a4138c9d0ec Mon Sep 17 00:00:00 2001 From: Eric House Date: Sat, 4 Apr 2020 19:36:46 -0700 Subject: [PATCH 01/12] tweaks for logging/debuggin --- .../app/src/main/java/org/eehouse/android/xw4/BTService.java | 2 +- xwords4/android/app/src/main/res/values/strings.xml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTService.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTService.java index e9b35792b..4d583bb4f 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTService.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTService.java @@ -261,7 +261,7 @@ public class BTService extends XWJIService { public static void onACLConnected( Context context ) { - Log.d( TAG, "onACLConnected()" ); + Log.d( TAG, "onACLConnected(); enqueuing work" ); enqueueWork( context, getIntentTo( context, BTAction.ACL_CONN ) ); } diff --git a/xwords4/android/app/src/main/res/values/strings.xml b/xwords4/android/app/src/main/res/values/strings.xml index e0d7e1a41..fbe41ac94 100644 --- a/xwords4/android/app/src/main/res/values/strings.xml +++ b/xwords4/android/app/src/main/res/values/strings.xml @@ -2394,7 +2394,8 @@ Notify when Android\'s slow to process outgoing invitations and moves Message sending is stalled - %1$s could not send outbound messages for %2$d seconds. + %1$s (and others?) could not send outbound messages + for %2$d seconds. \n \nIf it happens again, e-mail the developer logs and info about your device. \n From 0dce768f3610c6a265a18b95c03378eb2787ade1 Mon Sep 17 00:00:00 2001 From: Eric House Date: Sat, 4 Apr 2020 20:01:52 -0700 Subject: [PATCH 02/12] upgrade to latest gradle version Required redoing how I invoke the NDK. The limititations I had to hack around before seem fixed, so this is probably better. But there will be glitches. :-) --- xwords4/android/app/build.gradle | 138 +++++++----------- .../app/src/main/res/layout/lookup.xml | 2 +- xwords4/android/build.gradle | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 4 +- xwords4/common/comms.h | 4 - 5 files changed, 54 insertions(+), 96 deletions(-) diff --git a/xwords4/android/app/build.gradle b/xwords4/android/app/build.gradle index 730d3986f..0fd4aee24 100644 --- a/xwords4/android/app/build.gradle +++ b/xwords4/android/app/build.gradle @@ -8,19 +8,6 @@ def BUILD_INFO_NAME = "build-info.txt" // each other def XW_UUID = '"7be0d084-ff89-4d6d-9c78-594773a6f963"' // from comms.h def XWD_UUID = '"b079b640-35fe-11e5-a432-0002a5d5c51b"' // from comms.h -def BT_UUIDS = [ - 'xw4fdroidDebug' : XW_UUID, - 'xw4fdroidRelease' : XW_UUID, - 'xw4NoSMSDebug' : XW_UUID, - 'xw4NoSMSRelease' : XW_UUID, - 'xw4SMSDebug' : XW_UUID, - 'xw4SMSRelease' : XW_UUID, - - 'xw4dRelease' : XWD_UUID, - 'xw4dDebug' : XWD_UUID, - 'xw4dNoSMSRelease' : XWD_UUID, - 'xw4dNoSMSDebug' : XWD_UUID, -] // AID must start with F (first 4 bits) and be from 5 to 16 bytes long def NFC_AID_XW4 = "FC8FF510B360" @@ -55,7 +42,8 @@ repositories { android { // Specify buildToolsVersion so gradle will inform when the // default changes and .travis.yml can be kept in sync - buildToolsVersion '27.0.3' + buildToolsVersion '28.0.3' + ndkVersion '21.0.6113669' defaultConfig { // HostApduService requires 19. But is it a problem? minSdkVersion 14 @@ -113,6 +101,8 @@ android { buildConfigField "int", "VARIANT_CODE", "1" buildConfigField "String", "NFC_AID", "\"${NFC_AID_XW4}\"" resValue "string", "nfc_aid", "$NFC_AID_XW4" + externalNativeBuild.ndkBuild.cFlags += ['-DVARIANT_xw4NoSMS'] + externalNativeBuild.ndkBuild.arguments += ['XW_BT_UUID=' + XW_UUID] } xw4fdroid { @@ -128,6 +118,8 @@ android { buildConfigField "boolean", "FOR_FDROID", "true" buildConfigField "String", "NFC_AID", "\"${NFC_AID_XW4}\"" resValue "string", "nfc_aid", "$NFC_AID_XW4" + externalNativeBuild.ndkBuild.cFlags += ['-DVARIANT_xw4fdroid'] + externalNativeBuild.ndkBuild.arguments += ['XW_BT_UUID=' + XW_UUID] } xw4d { dimension "variant" @@ -144,6 +136,8 @@ android { buildConfigField "String", "KEY_FCMID", "\"FBMService_fcmid1\"" buildConfigField "String", "NFC_AID", "\"${NFC_AID_XW4d}\"" resValue "string", "nfc_aid", "$NFC_AID_XW4d" + externalNativeBuild.ndkBuild.cFlags += ['-DVARIANT_xw4d'] + externalNativeBuild.ndkBuild.arguments += ['XW_BT_UUID=' + XWD_UUID] } xw4dNoSMS { @@ -160,6 +154,8 @@ android { buildConfigField "boolean", "REPORT_LOCKS", "true" buildConfigField "String", "NFC_AID", "\"${NFC_AID_XW4d}\"" resValue "string", "nfc_aid", "$NFC_AID_XW4d" + externalNativeBuild.ndkBuild.cFlags += ['-DVARIANT_xw4dNoSMS'] + externalNativeBuild.ndkBuild.arguments += ['XW_BT_UUID=' + XWD_UUID] } xw4SMS { @@ -174,6 +170,8 @@ android { buildConfigField "int", "VARIANT_CODE", "5" buildConfigField "String", "NFC_AID", "\"${NFC_AID_XW4}\"" resValue "string", "nfc_aid", "$NFC_AID_XW4" + externalNativeBuild.ndkBuild.cFlags += ['-DVARIANT_xw4SMS'] + externalNativeBuild.ndkBuild.arguments += ['XW_BT_UUID=' + XW_UUID] } // WARNING: "all" breaks things. Seems to be a keyword. Need @@ -210,12 +208,21 @@ android { } buildTypes { + all { + externalNativeBuild { + ndkBuild.arguments += ["INITIAL_CLIENT_VERS=" + INITIAL_CLIENT_VERS] + } + } + release { debuggable false minifyEnabled false // PENDING // proguard crashes when I do this (the optimize part) // proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' resValue "bool", "DEBUG", "false" + externalNativeBuild { + ndkBuild.arguments += ['BUILD_TARGET=release'] + } } debug { debuggable true @@ -224,6 +231,19 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' // This doesn't work on marshmallow: duplicate permission error // applicationIdSuffix ".debug" + + externalNativeBuild { + ndkBuild { + cFlags += ['-DDEBUG'] + arguments += ['BUILD_TARGET=debug'] + } + } + } + } + + externalNativeBuild { + ndkBuild { + path "../jni/Android.mk" } } @@ -330,23 +350,11 @@ task cleanLocStrings(type: Exec) { } clean.dependsOn cleanLocStrings -task ndkSetupDebug(type: Exec) { - workingDir '../' - // remove ', "--arm-only"' for Genymotion builds - - // I'm putting ARM back for a while. It's too much trouble having - // builds, including those built by travis, that don't run on the - // emulator. Maybe remove this change before each release? - commandLine "./scripts/ndksetup.sh", "--with-clang" - // commandLine "./scripts/ndksetup.sh", "--with-clang", "--arm-only" -} - -task ndkSetupRelease(type: Exec) { - workingDir '../' - commandLine "./scripts/ndksetup.sh", "--with-clang", "--arm-only" -} - -task myPreBuild(dependsOn: ['mkImages', 'copyLocStrings', 'mkXml']) { +task myPreBuild(dependsOn: ['mkImages', + 'copyLocStrings', + 'mkXml', + 'copyStringsXw4D', + 'copyStringsXw4DNoSMS']) { } preBuild.dependsOn myPreBuild @@ -357,64 +365,18 @@ task mkXml(type: Exec) { '-t', "debug" } -afterEvaluate { - ArrayList cleanCmdLst = new ArrayList<>(["rm", "-rf"]) - android.applicationVariants.all { variant -> - // print "variant: " + variant.name + "\n" - String BUILD = variant.getBuildType().getName() - // println "type: " + BUILD - String FLAVOR = variant.getFlavorName() - // print "flavor: " + variant.getFlavorName() + "\n" - // print "variant: " + variant + "\n" +task copyStringsXw4D(type: Exec) { + workingDir './' + environment.put('APPNAME', 'CrossDbg') + commandLine 'make', '-f', '../scripts/Variant.mk', + "src/xw4d/res/values/strings.xml" +} - String ndkSetup = "ndkSetup" + BUILD.capitalize() - // println "ndkSetup: " + ndkSetup - - String variantCaps = variant.name.capitalize() - String nameLC = variant.getBuildType().getName().toLowerCase() - String lib = "libs-${variant.name}" - String ndkBuildTask = "ndkBuild${variantCaps}" - String btUUID = BT_UUIDS[variant.name] - task "$ndkBuildTask"(type: Exec) { - workingDir '../' - commandLine './scripts/ndkbuild.sh', '-j3', - "BUILD_TARGET=${nameLC}", "INITIAL_CLIENT_VERS=$INITIAL_CLIENT_VERS", - "VARIANT=${FLAVOR}", "NDK_LIBS_OUT=${lib}", - "NDK_OUT=./obj-${variant.name}", "XW_BT_UUID=\"${btUUID}\"" - } - - String compileTask = "compile${variantCaps}Ndk" - tasks.getByName(ndkBuildTask).dependsOn ndkSetup - tasks.getByName(compileTask).dependsOn ndkBuildTask - - // For clean task - cleanCmdLst.add("libs-${variant.name}") - cleanCmdLst.add("./obj-${variant.name}") - } - - task cleanNDK(type: Exec) { - workingDir '../' - commandLine cleanCmdLst - } - clean.dependsOn 'cleanNDK' - - String copyStringsTask = "copyStringsXw4D" - task "$copyStringsTask"(type: Exec) { - workingDir './' - environment.put('APPNAME', 'CrossDbg') - commandLine 'make', '-f', '../scripts/Variant.mk', - "src/xw4d/res/values/strings.xml" - } - preBuild.dependsOn copyStringsTask - - String copyStringsTaskNoSMS = "copyStringsXw4DNoSMS" - task "$copyStringsTaskNoSMS"(type: Exec) { - workingDir './' - environment.put('APPNAME', 'CrossDbg') - commandLine 'make', '-f', '../scripts/Variant.mk', - "src/xw4dNoSMS/res/values/strings.xml" - } - preBuild.dependsOn copyStringsTaskNoSMS +task copyStringsXw4DNoSMS(type: Exec) { + workingDir './' + environment.put('APPNAME', 'CrossDbg') + commandLine 'make', '-f', '../scripts/Variant.mk', + "src/xw4dNoSMS/res/values/strings.xml" } task makeBuildAssets() { diff --git a/xwords4/android/app/src/main/res/layout/lookup.xml b/xwords4/android/app/src/main/res/layout/lookup.xml index 1a3733291..4375ef1c8 100644 --- a/xwords4/android/app/src/main/res/layout/lookup.xml +++ b/xwords4/android/app/src/main/res/layout/lookup.xml @@ -13,7 +13,7 @@ android:paddingLeft="8dp" /> - Date: Sat, 4 Apr 2020 20:07:11 -0700 Subject: [PATCH 03/12] tweak strings --- xwords4/android/app/src/main/res/values/strings.xml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xwords4/android/app/src/main/res/values/strings.xml b/xwords4/android/app/src/main/res/values/strings.xml index fbe41ac94..38b00986a 100644 --- a/xwords4/android/app/src/main/res/values/strings.xml +++ b/xwords4/android/app/src/main/res/values/strings.xml @@ -2092,6 +2092,7 @@ Your opponent %1$s passed (0 points) + %1$s played %2$s for one point %1$s played %2$s for %3$d points @@ -2103,9 +2104,10 @@ %1$s lost a turn Tiles assigned to %1$s You currently have no paired Bluetooth - devices (or Bluetooth is turned off). Would you like to open the - Android Settings Panel to add one or more?\n\n(You may also need - to open it on the device you want to pair with.) + devices (or Bluetooth is turned off). Would you like to open the + Android Settings Panel to add one or more?\n\n(You may also need + to open the Settings panel on the device you want to pair + with.) Unable to connect via Bluetooth to CrossWords on the device %1$s. Please check that the device is within Bluetooth range and that CrossWords is installed on From 448fafc5c42b63e7c5ddfc4aacb5dad9fc828e7f Mon Sep 17 00:00:00 2001 From: Eric House Date: Sun, 5 Apr 2020 16:54:23 -0700 Subject: [PATCH 04/12] changes generated by AS (moving to androidx) --- xwords4/android/app/build.gradle | 8 ++++---- xwords4/android/app/src/main/AndroidManifest.xml | 2 +- .../java/org/eehouse/android/xw4/AboutAlert.java | 2 -- .../main/java/org/eehouse/android/xw4/DBAlert.java | 7 ------- .../java/org/eehouse/android/xw4/DelegateBase.java | 4 ---- .../java/org/eehouse/android/xw4/DlgDelegate.java | 6 ------ .../org/eehouse/android/xw4/DlgDelegateAlert.java | 2 +- .../main/java/org/eehouse/android/xw4/GameLock.java | 2 +- .../org/eehouse/android/xw4/InviteChoicesAlert.java | 7 ------- .../java/org/eehouse/android/xw4/LookupAlert.java | 3 --- .../java/org/eehouse/android/xw4/MainActivity.java | 8 +++----- .../java/org/eehouse/android/xw4/NotAgainAlert.java | 11 +---------- .../java/org/eehouse/android/xw4/OkOnlyAlert.java | 11 +---------- .../main/java/org/eehouse/android/xw4/Perms23.java | 9 ++------- .../java/org/eehouse/android/xw4/PrefsActivity.java | 1 - .../java/org/eehouse/android/xw4/RelayService.java | 4 +--- .../java/org/eehouse/android/xw4/TilePickAlert.java | 3 --- .../src/main/java/org/eehouse/android/xw4/Utils.java | 9 ++------- .../java/org/eehouse/android/xw4/XWActivity.java | 11 +++++------ .../src/main/java/org/eehouse/android/xw4/XWApp.java | 12 ++++++------ .../org/eehouse/android/xw4/XWDialogFragment.java | 4 +--- .../java/org/eehouse/android/xw4/XWFragment.java | 3 +-- .../java/org/eehouse/android/xw4/XWJIService.java | 3 +-- xwords4/android/gradle.properties | 5 ++++- 24 files changed, 35 insertions(+), 102 deletions(-) diff --git a/xwords4/android/app/build.gradle b/xwords4/android/app/build.gradle index 0fd4aee24..29985fdfa 100644 --- a/xwords4/android/app/build.gradle +++ b/xwords4/android/app/build.gradle @@ -313,11 +313,11 @@ ext { } dependencies { - implementation "com.android.support:support-v4:$SUPPORT_LIB_VERSION" - implementation "com.android.support:support-compat:$SUPPORT_LIB_VERSION" + implementation 'androidx.legacy:legacy-support-v4:1.0.0' + implementation 'androidx.core:core:1.0.0' - implementation "android.arch.lifecycle:extensions:1.1.1" - annotationProcessor "android.arch.lifecycle:compiler:1.1.1" + implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0' + annotationProcessor 'androidx.lifecycle:lifecycle-compiler:2.0.0' // 2.6.8 is probably as far forward as I can go without upping my // min-supported SDK version diff --git a/xwords4/android/app/src/main/AndroidManifest.xml b/xwords4/android/app/src/main/AndroidManifest.xml index 8d1e0d07b..b53bde654 100644 --- a/xwords4/android/app/src/main/AndroidManifest.xml +++ b/xwords4/android/app/src/main/AndroidManifest.xml @@ -43,7 +43,7 @@ android:theme="@style/AppTheme" > - Date: Sun, 5 Apr 2020 18:03:24 -0700 Subject: [PATCH 05/12] force display order on ConnTypes --- .../eehouse/android/xw4/ConnStatusHandler.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/ConnStatusHandler.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/ConnStatusHandler.java index 801cb9346..09d4b3b7a 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/ConnStatusHandler.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/ConnStatusHandler.java @@ -165,6 +165,17 @@ public class ConnStatusHandler { return s_downOnMe && s_rect.contains( xx, yy ); } + + private static final CommsConnType[] sDisplayOrder = { + CommsConnType.COMMS_CONN_RELAY, + CommsConnType.COMMS_CONN_BT, + CommsConnType.COMMS_CONN_IR, + CommsConnType.COMMS_CONN_IP_DIRECT, + CommsConnType.COMMS_CONN_SMS, + CommsConnType.COMMS_CONN_P2P, + CommsConnType.COMMS_CONN_NFC, + }; + public static String getStatusText( Context context, XwJNI.GamePtr gamePtr, CommsConnTypeSet connTypes, CommsAddrRec addr ) @@ -179,7 +190,10 @@ public class ConnStatusHandler { sb.append( LocUtils.getString( context, R.string.connstat_net_fmt, connTypes.toString( context, true ))); - for ( CommsConnType typ : connTypes.getTypes() ) { + for ( CommsConnType typ : sDisplayOrder ) { + if ( !connTypes.contains(typ) ) { + continue; + } SuccessRecord record = recordFor( context, typ, false ); // Don't show e.g. NFC unless it's been used From 74c4593b73ba0b795e592fde3bead715b69b34e1 Mon Sep 17 00:00:00 2001 From: Eric House Date: Sun, 5 Apr 2020 18:30:17 -0700 Subject: [PATCH 06/12] fix linux build --- xwords4/linux/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xwords4/linux/Makefile b/xwords4/linux/Makefile index aa0afa97d..0c7487e4f 100644 --- a/xwords4/linux/Makefile +++ b/xwords4/linux/Makefile @@ -150,7 +150,8 @@ ifeq ($(STANDALONE),) # Bluetooth support ifndef NO_BLUETOOTH -BLUETOOTH = -DXWFEATURE_BLUETOOTH -DBT_USE_L2CAP +BLUETOOTH = -DXWFEATURE_BLUETOOTH -DBT_USE_L2CAP -DXW_BT_UUID=\"7be0d084-ff89-4d6d-9c78-594773a6f963\" + endif #BLUETOOTH = -DXWFEATURE_BLUETOOTH -DBT_USE_RFCOMM # DEFINES += -DXWFEATURE_IR From 4d63604a84aa4e10ff6d239a205e2eb59a43c103 Mon Sep 17 00:00:00 2001 From: Eric House Date: Sun, 5 Apr 2020 19:48:36 -0700 Subject: [PATCH 07/12] show pending name in scoreboard when remote hasn't arrived, show same string in scoreboard as in games list rather than the local player's default name -- duh. --- .../java/org/eehouse/android/xw4/jni/DUtilCtxt.java | 5 +++++ xwords4/android/jni/LocalizedStrIncludes.h | 4 ++-- xwords4/common/scorebdp.c | 10 +++++++++- xwords4/linux/LocalizedStrIncludes.h | 12 ++++++------ xwords4/linux/lindutil.c | 6 ++---- 5 files changed, 24 insertions(+), 13 deletions(-) diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/DUtilCtxt.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/DUtilCtxt.java index 4f2eb923e..a3ea4b68d 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/DUtilCtxt.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/DUtilCtxt.java @@ -121,6 +121,7 @@ public class DUtilCtxt { private static final int STR_DUP_MOVED = 27; private static final int STRD_DUP_TRADED = 28; private static final int STRSD_DUP_ONESCORE = 29; + private static final int STR_PENDING_PLAYER = 30; public String getUserString( int stringCode ) { @@ -207,6 +208,10 @@ public class DUtilCtxt { id = R.string.dup_onescore_fmt; break; + case STR_PENDING_PLAYER: + id = R.string.missing_player; + break; + default: Log.w( TAG, "no such stringCode: %d", stringCode ); } diff --git a/xwords4/android/jni/LocalizedStrIncludes.h b/xwords4/android/jni/LocalizedStrIncludes.h index d9dc9e96e..1eaf98af4 100644 --- a/xwords4/android/jni/LocalizedStrIncludes.h +++ b/xwords4/android/jni/LocalizedStrIncludes.h @@ -33,6 +33,6 @@ # define STR_DUP_MOVED 27 # define STRD_DUP_TRADED 28 # define STRSD_DUP_ONESCORE 29 - -# define N_AND_USER_STRINGS 29 +# define STR_PENDING_PLAYER 30 +# define N_AND_USER_STRINGS 30 #endif diff --git a/xwords4/common/scorebdp.c b/xwords4/common/scorebdp.c index 63b920bc1..42d57ea9d 100644 --- a/xwords4/common/scorebdp.c +++ b/xwords4/common/scorebdp.c @@ -23,6 +23,7 @@ #include "game.h" #include "strutils.h" #include "dbgutil.h" +#include "LocalizedStrIncludes.h" #ifdef CPLUS extern "C" { @@ -244,8 +245,10 @@ drawScoreBoard( BoardCtxt* board ) /* figure spacing for each scoreboard entry */ XP_MEMSET( &datum, 0, sizeof(datum) ); totalDim = 0; + XP_U16 missingPlayers = server_getMissingPlayers( board->server ); for ( dp = datum, ii = 0; ii < nPlayers; ++ii, ++dp ) { LocalPlayer* lp = &board->gi->players[ii]; + XP_Bool isMissing = 0 != ((1 << ii) & missingPlayers); /* This is a hack! */ dp->dsi.lsc = board_ScoreCallback; @@ -258,11 +261,16 @@ drawScoreBoard( BoardCtxt* board ) dp->dsi.playerNum = ii; dp->dsi.totalScore = scores.arr[ii]; dp->dsi.isTurn = server_isPlayersTurn( board->server, ii ); - dp->dsi.name = emptyStringIfNull(lp->name); dp->dsi.selected = board->trayVisState != TRAY_HIDDEN && ii==selPlayer; dp->dsi.isRobot = LP_IS_ROBOT(lp); dp->dsi.isRemote = !lp->isLocal; + XP_ASSERT( !isMissing || dp->dsi.isRemote ); + if ( dp->dsi.isRemote && isMissing ) { + dp->dsi.name = dutil_getUserString( board->dutil, STR_PENDING_PLAYER ); + } else { + dp->dsi.name = emptyStringIfNull( lp->name ); + } dp->dsi.nTilesLeft = (nTilesInPool > 0)? -1: model_getNumTilesTotal( model, ii ); diff --git a/xwords4/linux/LocalizedStrIncludes.h b/xwords4/linux/LocalizedStrIncludes.h index a508b4215..30bcb2a2e 100644 --- a/xwords4/linux/LocalizedStrIncludes.h +++ b/xwords4/linux/LocalizedStrIncludes.h @@ -30,8 +30,7 @@ enum { STR_SUBMIT_CONFIRM, STRD_TURN_SCORE, STR_BONUS_ALL, - STR_NONLOCAL_NAME, - STR_LOCAL_NAME, + STR_PENDING_PLAYER, STRD_TIME_PENALTY_SUB, STRD_CUMULATIVE_SCORE, @@ -46,10 +45,6 @@ enum { STR_ROBOT_MOVED, STRS_REMOTE_MOVED, - STR_LOCALPLAYERS, - STR_TOTALPLAYERS, - STR_REMOTE, - STRS_VALUES_HEADER, STRD_REMAINS_HEADER, STRD_REMAINS_EXPL, @@ -64,6 +59,11 @@ enum { STRD_DUP_TRADED, STRSD_DUP_ONESCORE, + /* These three aren't in Android */ + STR_LOCALPLAYERS, + STR_TOTALPLAYERS, + STR_REMOTE, + STR_LAST }; diff --git a/xwords4/linux/lindutil.c b/xwords4/linux/lindutil.c index d4c372640..492c8238b 100644 --- a/xwords4/linux/lindutil.c +++ b/xwords4/linux/lindutil.c @@ -146,10 +146,8 @@ linux_dutil_getUserString( XW_DUtilCtxt* XP_UNUSED(uc), XP_U16 code ) return (XP_UCHAR*)"Score for turn: %d\n"; case STR_BONUS_ALL: return (XP_UCHAR*)"Bonus for using all tiles: 50\n"; - case STR_LOCAL_NAME: - return (XP_UCHAR*)"%s"; - case STR_NONLOCAL_NAME: - return (XP_UCHAR*)"%s (remote)"; + case STR_PENDING_PLAYER: + return (XP_UCHAR*)"(remote)"; case STRD_TIME_PENALTY_SUB: return (XP_UCHAR*)" - %d [time]"; /* added.... */ From 674b9dbccf0e1e11910f6058a5ec515817cccc01 Mon Sep 17 00:00:00 2001 From: Eric House Date: Mon, 6 Apr 2020 16:34:02 -0700 Subject: [PATCH 08/12] fix logging macro to allow a single argument --- xwords4/common/comms.c | 2 +- xwords4/common/comtypes.h | 2 +- xwords4/common/engine.c | 2 +- xwords4/common/server.c | 8 ++++---- xwords4/common/smsproto.c | 2 +- xwords4/linux/cursesmain.c | 2 +- xwords4/linux/linuxmain.c | 2 +- xwords4/linux/relaycon.c | 2 +- xwords4/linux/xptypes.h | 4 ++-- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/xwords4/common/comms.c b/xwords4/common/comms.c index 464d09f3c..47d492a07 100644 --- a/xwords4/common/comms.c +++ b/xwords4/common/comms.c @@ -964,7 +964,7 @@ comms_writeToStream( CommsCtxt* comms, XWStreamCtxt* stream, static void resetBackoff( CommsCtxt* comms ) { - XP_LOGFF( "%s", "resetting backoff" ); + XP_LOGFF( "resetting backoff" ); comms->resendBackoff = 0; comms->nextResend = 0; } diff --git a/xwords4/common/comtypes.h b/xwords4/common/comtypes.h index 8fe6857aa..7af0ee602 100644 --- a/xwords4/common/comtypes.h +++ b/xwords4/common/comtypes.h @@ -309,7 +309,7 @@ typedef struct _PlayerDicts { #endif -#define LOG_FUNC() XP_LOGFF( "%s", "IN" ) +#define LOG_FUNC() XP_LOGFF( "IN" ) #define LOG_RETURNF(fmt, ...) XP_LOGFF( "OUT: => " fmt, __VA_ARGS__ ) #define LOG_RETURN_VOID() LOG_RETURNF("%s","void") #define XP_LOGLOC() XP_LOGF( "%s(), line %d", __func__, __LINE__ ) diff --git a/xwords4/common/engine.c b/xwords4/common/engine.c index 1fcbe0372..8ba23d751 100644 --- a/xwords4/common/engine.c +++ b/xwords4/common/engine.c @@ -559,7 +559,7 @@ engine_findMove( EngineCtxt* engine, const ModelCtxt* model, engine_reset( engine ); if ( !isRetry ) { isRetry = XP_TRUE; - XP_LOGFF( "%s", "no moves found so retrying" ); + XP_LOGFF( "no moves found so retrying" ); goto retry; } } diff --git a/xwords4/common/server.c b/xwords4/common/server.c index 3ab9cbddc..f1c0c4ed1 100644 --- a/xwords4/common/server.c +++ b/xwords4/common/server.c @@ -2530,7 +2530,7 @@ nextTurn( ServerCtxt* server, XP_S16 nxtTurn ) nxtTurn = model_getNextTurn( server->vol.model ); } } else { - XP_LOGFF( "%s", "turn == -1 so dropping" ); + XP_LOGFF( "turn == -1 so dropping" ); } } else { /* We're doing an undo, and so won't bother figuring out who the @@ -2552,7 +2552,7 @@ nextTurn( ServerCtxt* server, XP_S16 nxtTurn ) SETSTATE( server, XWSTATE_NEEDSEND_ENDGAME ); /* this is it */ moreToDo = XP_TRUE; } else if ( currentTurn >= 0 ) { - XP_LOGFF( "%s", "Doing nothing; waiting for server to end game" ); + XP_LOGFF( "Doing nothing; waiting for server to end game" ); setTurn( server, -1 ); /* I'm the client. Do ++nothing++. */ } @@ -2930,7 +2930,7 @@ reflectMove( ServerCtxt* server, XWStreamCtxt* stream ) XP_LOGFF( "BAD: currentTurn %d < 0", server->nv.currentTurn ); } else if ( ! readMoveInfo( server, stream, &whoMoved, &isTrade, &newTiles, &tradedTiles, &isLegal, &badStack ) ) { /* modifies model */ - XP_LOGFF( "%s", "BAD: readMoveInfo() failed" ); + XP_LOGFF( "BAD: readMoveInfo() failed" ); } else { moveOk = XP_TRUE; } @@ -4072,7 +4072,7 @@ server_receiveMessage( ServerCtxt* server, XWStreamCtxt* incoming ) XP_LOGF( "%s: somebody's registering!!!", __func__ ); accepted = handleRegistrationMsg( server, incoming ); } else { - XP_LOGFF( "%s", "WTF: I'm not a server!!" ); + XP_LOGFF( "WTF: I'm not a server!!" ); } break; case XWPROTO_CLIENT_SETUP: diff --git a/xwords4/common/smsproto.c b/xwords4/common/smsproto.c index 85f81c8d1..e1aefb5e7 100644 --- a/xwords4/common/smsproto.c +++ b/xwords4/common/smsproto.c @@ -648,7 +648,7 @@ savePartials( SMSProto* state ) XP_U16 newSize = stream_getSize( stream ); if ( state->lastStoredSize == 2 && newSize == 2 ) { - XP_LOGFF( "%s", "not storing empty again" ); + XP_LOGFF( "not storing empty again" ); } else { dutil_storeStream( state->dutil, KEY_PARTIALS, stream ); state->lastStoredSize = newSize; diff --git a/xwords4/linux/cursesmain.c b/xwords4/linux/cursesmain.c index c4f370072..4c7436f2d 100644 --- a/xwords4/linux/cursesmain.c +++ b/xwords4/linux/cursesmain.c @@ -1297,7 +1297,7 @@ cursesDevIDReceived( void* closure, const XP_UCHAR* devID, } (void)g_timeout_add_seconds( maxInterval, keepalive_timer, aGlobals ); } else { - XP_LOGFF( "%s", "bad relayid" ); + XP_LOGFF( "bad relayid" ); db_remove( pDb, KEY_RDEVID ); DevIDType typ; diff --git a/xwords4/linux/linuxmain.c b/xwords4/linux/linuxmain.c index b5cf28b75..b954f0cc1 100644 --- a/xwords4/linux/linuxmain.c +++ b/xwords4/linux/linuxmain.c @@ -771,7 +771,7 @@ secondTimerFired( gpointer data ) XP_U16 undoRatio = cGlobals->params->undoRatio; if ( 0 != undoRatio ) { if ( (XP_RANDOM() % 1000) < undoRatio ) { - XP_LOGFF( "%s", "calling server_handleUndo()" ); + XP_LOGFF( "calling server_handleUndo()" ); if ( server_handleUndo( game->server, 1 ) ) { board_draw( game->board ); } diff --git a/xwords4/linux/relaycon.c b/xwords4/linux/relaycon.c index 3bd2f20e9..82c7b7f6d 100644 --- a/xwords4/linux/relaycon.c +++ b/xwords4/linux/relaycon.c @@ -678,7 +678,7 @@ process( RelayConStorage* storage, XP_U8* buf, ssize_t nRead ) break; } case XWPDEV_GOTINVITE: { - XP_LOGFF( "%s", "got XWPDEV_GOTINVITE" ); + XP_LOGFF( "got XWPDEV_GOTINVITE" ); #ifdef DEBUG XP_U32 sender = #endif diff --git a/xwords4/linux/xptypes.h b/xwords4/linux/xptypes.h index 89a50d191..61a38c8be 100644 --- a/xwords4/linux/xptypes.h +++ b/xwords4/linux/xptypes.h @@ -78,7 +78,7 @@ extern void linux_debugf(const char*, ...) extern void linux_debugff(const char* func, const char* file, const char* fmt, ...) __attribute__ ((format (printf, 3, 4))); # define XP_LOGFF( FMT, ... ) \ - linux_debugff( __func__, __FILE__, FMT, __VA_ARGS__ ) + linux_debugff( __func__, __FILE__, FMT, ##__VA_ARGS__ ) #define XP_LOG(STR) \ linux_debugff( __func__, __FILE__, "%s", STR ) @@ -125,7 +125,7 @@ void linux_lowerstr( XP_UCHAR* str ); #define XP_ABS(a) ((a)>=0?(a):-(a)) #ifdef DEBUG -# define XP_ASSERT(B) do { if (!(B)) { XP_LOGFF( "%s", "firing assert"); } assert(B); } while (0) +# define XP_ASSERT(B) do { if (!(B)) { XP_LOGFF( "firing assert"); } assert(B); } while (0) void linux_backtrace( void ); # define XP_BACKTRACE linux_backtrace #else From 0904a5299e26301bd178f57ddef5ebdf5110bbb4 Mon Sep 17 00:00:00 2001 From: Eric House Date: Mon, 6 Apr 2020 17:56:40 -0700 Subject: [PATCH 09/12] specify ABI per-debug/release: no x86 for release This is as it was before I updated my invocation of NDK recently. --- xwords4/android/app/build.gradle | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xwords4/android/app/build.gradle b/xwords4/android/app/build.gradle index 29985fdfa..1693601b2 100644 --- a/xwords4/android/app/build.gradle +++ b/xwords4/android/app/build.gradle @@ -223,6 +223,9 @@ android { externalNativeBuild { ndkBuild.arguments += ['BUILD_TARGET=release'] } + ndk { + abiFilters 'armeabi-v7a', 'arm64-v8a' + } } debug { debuggable true @@ -238,6 +241,10 @@ android { arguments += ['BUILD_TARGET=debug'] } } + + ndk { + abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' + } } } From b74a1c44205c6fcd28ad7feb2dae17ffd4b1ab88 Mon Sep 17 00:00:00 2001 From: Eric House Date: Wed, 8 Apr 2020 14:46:17 -0700 Subject: [PATCH 10/12] change MainActivity's launchMode to "standard" reverse change in 19fa3fce05898965a9227fbe3fe3716d5c8fe0e6 (April 4 2019) making MainActivity singleTask, which caused starting the app to launch the gamesList screen rather than the game that had been open when it was moved to background. Now it's "standard," and I have to hope that doesn't produce new problems. As I wrote back then, we'll see. More quickly I hope. --- xwords4/android/app/src/main/AndroidManifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xwords4/android/app/src/main/AndroidManifest.xml b/xwords4/android/app/src/main/AndroidManifest.xml index b53bde654..bedb9bf1f 100644 --- a/xwords4/android/app/src/main/AndroidManifest.xml +++ b/xwords4/android/app/src/main/AndroidManifest.xml @@ -55,7 +55,7 @@ From 48ed6cbca6fe3ad9ef1916ec324b181f17cb3f21 Mon Sep 17 00:00:00 2001 From: Eric House Date: Thu, 9 Apr 2020 16:50:31 -0700 Subject: [PATCH 11/12] fix failure to collapse The problem appears to be that the new .xml drawable has a greater height for purposes of layout. Specifying dimensions seems to be the way to go, though devices may vary. --- xwords4/android/app/src/main/res/layout/game_list_item.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xwords4/android/app/src/main/res/layout/game_list_item.xml b/xwords4/android/app/src/main/res/layout/game_list_item.xml index 33481df67..6d2d35847 100644 --- a/xwords4/android/app/src/main/res/layout/game_list_item.xml +++ b/xwords4/android/app/src/main/res/layout/game_list_item.xml @@ -39,8 +39,9 @@ android:paddingRight="8dip" > Date: Fri, 10 Apr 2020 07:28:53 -0700 Subject: [PATCH 12/12] remove unused constant --- xwords4/android/app/build.gradle | 4 ---- 1 file changed, 4 deletions(-) diff --git a/xwords4/android/app/build.gradle b/xwords4/android/app/build.gradle index ee9b3270d..9c61d9b5b 100644 --- a/xwords4/android/app/build.gradle +++ b/xwords4/android/app/build.gradle @@ -315,10 +315,6 @@ android { } } -ext { - SUPPORT_LIB_VERSION = '28.0.0' -} - dependencies { implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.core:core:1.0.0'