changeset 3018:758bee45612b

plugin android: catch and log exception when using the vibrator: vibrator is currently not working with plyer, this patch avoid a crash and log the issue. rel 332
author Goffi <goffi@goffi.org>
date Sat, 20 Jul 2019 20:53:52 +0200
parents e7cbe662838b
children c9f03b1eb64d
files sat/plugins/plugin_misc_android.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/sat/plugins/plugin_misc_android.py	Sat Jul 20 16:03:28 2019 +0200
+++ b/sat/plugins/plugin_misc_android.py	Sat Jul 20 20:53:52 2019 +0200
@@ -243,7 +243,12 @@
             if self.host.memory.getParamA(
                 PARAM_VIBRATE_NAME, PARAM_VIBRATE_CATEGORY, profile_key=client.profile
             ):
-                vibrator.vibrate()
+                try:
+                    vibrator.vibrate()
+                except Exception as e:
+                    # FIXME: vibrator is currently not working,
+                    # cf. https://github.com/kivy/plyer/issues/509
+                    log.warning(u"Can't use vibrator: {e}".format(e=e))
         return mess_data
 
     def messageReceivedTrigger(self, client, message_elt, post_treat):