Commit graph

10764 commits

Author SHA1 Message Date
Eric House
4a90792dec If game's in Spanish, don't require 7 tiles for trade.
Put up an error message if too many tiles selected for trade
(a condition that couldn't exist when the pool was guaranteed to
have at least 7 in it.) (It's a hack: there's not even an enum
giving Spanish's code, and the lang_locale stuff in info.txt isn't
making it into the .xwd format.)
2018-12-29 18:47:48 -08:00
Eric House
e9ae36f68d fix invite via relayID (linux test app)
I broke it adding SMS invite support?
2018-12-29 07:41:03 -08:00
Eric House
e58f51a523 log, rather than toast, too-frequent debug message 2018-12-28 07:15:40 -08:00
Eric House
bdd92baf55 fix NPE when game isn't connected yet 2018-12-28 07:09:15 -08:00
Eric House
37a853c8a4 oops: use the first *remote* address 2018-12-27 22:10:24 -08:00
Eric House
320db700a9 add opponent address to net stat display
(Debug builds only)
2018-12-27 19:30:34 -08:00
Eric House
24386bd8c9 catch uncaught exception 2018-12-27 18:09:18 -08:00
Eric House
b0805b0b6a use tryLock() to avoid on-ui-thread assertions 2018-12-26 21:41:47 -08:00
Eric House
62cd90c183 remove unused interface 2018-12-26 17:45:42 -08:00
Eric House
0e2af6a836 rewrite GameLock to use wait()/notifyAll()
I've learned a bit about java since writing that class. Should be faster
now without the sleep/polling. Also making it illegal to use blocking
lock() call on UI thread. There may be some assertions to fix in the
next few days.
2018-12-26 17:41:21 -08:00
Eric House
891c73a1b7 make run() wait for gamePtr before starting loop
Was seeing race condition on slowest device where JNIThread init hadn't
finished before the event loop tried to use the gamePtr. So use
wait()/notifyAll() to fix.
2018-12-18 07:07:35 -08:00
Eric House
285f6ad34a revert diagnostic changes 2018-12-17 12:57:17 -08:00
Eric House
acf86a2291 remove diagnostic call 2018-12-17 12:53:03 -08:00
Eric House
cdeace0303 remove git clone depth 2018-12-17 12:48:57 -08:00
Eric House
e10b17cec0 remove logging; diagnose git/travis problem 2018-12-17 12:35:40 -08:00
Eric House
5467941d45 start stuff when package replaced
And: Don't start the foreground service with its user-visible
notification, as that's too obtrusive and the ACL_CONNECTED stuff seems
to work well enough. Launching timers on a new install is mostly for my
own dev use, but won't hurt user experience either.
2018-12-17 08:26:39 -08:00
Eric House
d8d0065e90 remove some logging 2018-12-17 08:26:00 -08:00
Eric House
3b48ee0ed8 try a different command 2018-12-16 18:48:06 -08:00
Eric House
a2fe00368e more diagnosis 2018-12-16 18:11:09 -08:00
Eric House
b88bbcf443 diagnosing travis build problems 2018-12-16 17:53:18 -08:00
Eric House
d31c2f5513 trying another fix for travis 2018-12-16 17:43:12 -08:00
Eric House
02f37009d2 try fixing scp mis-sending filename 2018-12-16 17:19:03 -08:00
Eric House
3b0a523499 send successful pings back as they occur
rather than have the user see no feedback until the slowest-to-respond
paired device times out.
2018-12-16 13:34:28 -08:00
Eric House
2d91c133a8 new file (forgotten earlier) 2018-12-16 10:41:04 -08:00
Eric House
67fa27069a add a hint for when scan shows nothing 2018-12-15 07:20:29 -08:00
Eric House
e3f862a6eb shorten timeout for scan/ping 2018-12-15 07:07:54 -08:00
Eric House
e15fb84005 ask for SMS_RECEIVE on startup if have SMS_SEND
It's free (same group) but required on SDK_26 for invitations to work.
2018-12-14 19:33:03 -08:00
Eric House
f7ef1adcb5 add settings button to foreground service notification
On O and beyond it's possible to tweak notification channels separately,
meaning users can hide the new BT-is-running notification and still get
game event notifications. So add a button that takes you to the right
Settings app page.
2018-12-14 17:12:15 -08:00
Eric House
02897f6e36 use separate channel for background service notification
Since on newer OS versions users might want to hide it
2018-12-14 16:00:36 -08:00
Eric House
2ab04901a7 scan all paired devices at same time
One thread per device: brute force, but the threads live a few seconds
and the user just triggered the action so should be ok with it.
2018-12-12 22:32:14 -08:00
Eric House
61dc8e837e cleanup 2018-12-12 22:21:02 -08:00
Eric House
c2f5949623 use AutoCloseable rather than a hack of my own 2018-12-11 15:14:51 -08:00
Eric House
f7258f29e8 saw a crash, so gather more info if it happens again. 2018-12-11 14:40:57 -08:00
Eric House
68bb8a1268 fix bluetooth bootstrapping
Separate processing of sockets from accepting them so that when an ACL
CONN notification is received and we open a socket (but don't yet have a
Service running because the ACL thing is most likely for some other app)
we can set it aside to be processed once we do have a service. Use the
same block-until-non-null thing as in RelayService to keep that thread
free of NPEs.
2018-12-11 14:38:40 -08:00
Eric House
48c06acef5 new debug util method 2018-12-11 08:28:07 -08:00
Eric House
4f8f14c83b kill thread when wait() fires InterruptedException
Rather than just dropping it and going back to a wait that will likely
last forever. I *think* wait() throwing that exception means the
thread's being killed, in which case the exception should be thrown up
to the containing loop that will then exit.
2018-12-11 06:57:59 -08:00
Eric House
f2322d7e81 cleanup (no behavior change) 2018-12-11 06:57:18 -08:00
Eric House
bfad324bb4 add stop button to notification
And keep the service alive (and the notification present) for 15
minutes.
2018-12-10 19:17:05 -08:00
Eric House
ea03c855e4 cleanup: remove logs and unneeded code
pull too much logging and stuff starting service on going into
background. RelayService isn't that type of Service.
2018-12-10 11:56:40 -08:00
Eric House
e797a28a6d cleanup: use marker instance rather than instanceof 2018-12-10 10:14:17 -08:00
Eric House
0a4b8549cf Don't block UI thread until service instances released
I thought I had to stop using a service instance before returning from
its onDestroy(), but that made the UI incredibly laggy AND appears not
to be necessary. At least in a bit of testing things still work.
2018-12-10 09:45:24 -08:00
Eric House
311768697e Merge branch 'android_branch' of github.com:eehouse/xwords into android_branch 2018-12-09 18:31:15 -08:00
Eric House
fe6996b663 decouple networking threads from RelayService
Oreo's creating a new service instance for every single intent passed to
enqueueWork, meaning a brand new set of threads with a new queue, empty
set of messages to be retried, etc. was created every time, and all
attempts to optimize and retry were broken. So: make the threads a
static singleton that are given a Service instance from onCreate() and
told to drop it from onDestroy(). The threads proceed until they need an
instance, then block until one's available. Seems to work on Oreo and an
older Android as well.
2018-12-09 18:26:59 -08:00
Eric House
a2fa841947 new DebugUtils method 2018-12-09 18:26:59 -08:00
Eric House
c5c081e8bd make RelayService descend from JobIntentService
Required moving most of XWService into a class to which all services
could delegate what they used to inherit.

squash me
2018-12-09 18:26:59 -08:00
Eric House
5f7e4aa1b9 refactor a tiny bit 2018-12-09 18:26:59 -08:00
Eric House
9c501b19a8 get RECEIVE_SMS permission with SEND_SMS
Apparently one of the newer Android SDK levels adds the requirement to
have RECEIVE_SMS permission in order for a broadcast receiver to get
called. Meaning receipt didn't work even if SEND_SMS had been
granted. Since they're both in the same group (for now) the OS will
grant the second silently if the first has been granted, but it still
has to be requested. So request both at the same time. This still leaves
the problem that a user who's never tried to create an SMS game won't
have been asked for either permission and so won't receive SMS
invitations, but fixing that is for a later release.
2018-12-09 18:26:59 -08:00
Eric House
3c861166de use TAG format that doesn't break logcat filtering 2018-12-09 18:26:59 -08:00
Eric House
e30466e096 include flavor in logged TAG
Tired of not being to tell variants' logs apart.
2018-12-09 18:26:59 -08:00
Eric House
7c804b9aad don't drop potential duplicate invitations after 5 seconds
Other code will take care of duplicates. This was meant to avoid a race
condition, for which 5 seconds is enough. Blocking forever complicates
testing.
2018-12-09 18:26:59 -08:00