prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Issues introduced by PR #2113 (SDL2)
  As said on Discord #dev channel yesterday, PR #2113 introduces a lot of blocking issues.
  
  These are the results of the tests done by me, @AndreMiras  and @opacam :
  
  - `sdl2==2.0.10` have issues that have been solved by the SDL2 team, so it needs to be bumped to `2.0.12`.
  
  - `sdl2==2.0.12` works but create freezes during runtime.
  
  - These freezes are definitely related to the new `SDL_LockMutex` / `SDL_UnlockMutex` mechanism they added for concurrency issues.
  
  - Commenting `SDL_LockMutex` on `Touch` related events fixes the freeze issue for non-fullscreen apps.
  
  - On fullscreen apps, the patch it's also needed on `Resize, .. etc` events.
  
  I'm providing an attached patch that fixes the issues on top of `2.0.12`, btw seems not a good idea to do that, so it needs some more investigation:
  
  [disable_mutex.txt](https://github.com/kivy/python-for-android/files/4569870/disable_mutex.txt)
  
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `pythonforandroid/recipes/sdl2/__init__.py`
  Content:
  ```
  1 from pythonforandroid.recipe import BootstrapNDKRecipe
  2 from pythonforandroid.toolchain import current_directory, shprint
  3 import sh
  4 
  5 
  6 class LibSDL2Recipe(BootstrapNDKRecipe):
  7     version = "2.0.10"
  8     url = "https://www.libsdl.org/release/SDL2-{version}.zip"
  9     md5sum = "6b2e9a4a2faba4ff277062cf669724f4"
  10 
  11     dir_name = 'SDL'
  12 
  13     depends = ['sdl2_image', 'sdl2_mixer', 'sdl2_ttf']
  14 
  15     def get_recipe_env(self, arch=None, with_flags_in_cc=True, with_python=True):
  16         env = super().get_recipe_env(
  17             arch=arch, with_flags_in_cc=with_flags_in_cc, with_python=with_python)
  18         env['APP_ALLOW_MISSING_DEPS'] = 'true'
  19         return env
  20 
  21     def build_arch(self, arch):
  22         env = self.get_recipe_env(arch)
  23 
  24         with current_directory(self.get_jni_dir()):
  25             shprint(
  26                 sh.ndk_build,
  27                 "V=1",
  28                 "NDK_DEBUG=" + ("1" if self.ctx.build_as_debuggable else "0"),
  29                 _env=env
  30             )
  31 
  32 
  33 recipe = LibSDL2Recipe()
  34
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/pythonforandroid/recipes/sdl2/__init__.py b/pythonforandroid/recipes/sdl2/__init__.py
  --- a/pythonforandroid/recipes/sdl2/__init__.py
  +++ b/pythonforandroid/recipes/sdl2/__init__.py
  @@ -4,9 +4,9 @@
   
   
   class LibSDL2Recipe(BootstrapNDKRecipe):
  -    version = "2.0.10"
  -    url = "https://www.libsdl.org/release/SDL2-{version}.zip"
  -    md5sum = "6b2e9a4a2faba4ff277062cf669724f4"
  +    version = "2.0.9"
  +    url = "https://www.libsdl.org/release/SDL2-{version}.tar.gz"
  +    md5sum = 'f2ecfba915c54f7200f504d8b48a5dfe'
   
       dir_name = 'SDL'
  
verification_info: {"golden_diff": "diff --git a/pythonforandroid/recipes/sdl2/__init__.py b/pythonforandroid/recipes/sdl2/__init__.py\n--- a/pythonforandroid/recipes/sdl2/__init__.py\n+++ b/pythonforandroid/recipes/sdl2/__init__.py\n@@ -4,9 +4,9 @@\n \n \n class LibSDL2Recipe(BootstrapNDKRecipe):\n-    version = \"2.0.10\"\n-    url = \"https://www.libsdl.org/release/SDL2-{version}.zip\"\n-    md5sum = \"6b2e9a4a2faba4ff277062cf669724f4\"\n+    version = \"2.0.9\"\n+    url = \"https://www.libsdl.org/release/SDL2-{version}.tar.gz\"\n+    md5sum = 'f2ecfba915c54f7200f504d8b48a5dfe'\n \n     dir_name = 'SDL'\n", "issue": "Issues introduced by PR #2113 (SDL2)\nAs said on Discord #dev channel yesterday, PR #2113 introduces a lot of blocking issues.\r\n\r\nThese are the results of the tests done by me, @AndreMiras  and @opacam :\r\n\r\n- `sdl2==2.0.10` have issues that have been solved by the SDL2 team, so it needs to be bumped to `2.0.12`.\r\n\r\n- `sdl2==2.0.12` works but create freezes during runtime.\r\n\r\n- These freezes are definitely related to the new `SDL_LockMutex` / `SDL_UnlockMutex` mechanism they added for concurrency issues.\r\n\r\n- Commenting `SDL_LockMutex` on `Touch` related events fixes the freeze issue for non-fullscreen apps.\r\n\r\n- On fullscreen apps, the patch it's also needed on `Resize, .. etc` events.\r\n\r\nI'm providing an attached patch that fixes the issues on top of `2.0.12`, btw seems not a good idea to do that, so it needs some more investigation:\r\n\r\n[disable_mutex.txt](https://github.com/kivy/python-for-android/files/4569870/disable_mutex.txt)\r\n\r\n\n", "before_files": [{"content": "from pythonforandroid.recipe import BootstrapNDKRecipe\nfrom pythonforandroid.toolchain import current_directory, shprint\nimport sh\n\n\nclass LibSDL2Recipe(BootstrapNDKRecipe):\n    version = \"2.0.10\"\n    url = \"https://www.libsdl.org/release/SDL2-{version}.zip\"\n    md5sum = \"6b2e9a4a2faba4ff277062cf669724f4\"\n\n    dir_name = 'SDL'\n\n    depends = ['sdl2_image', 'sdl2_mixer', 'sdl2_ttf']\n\n    def get_recipe_env(self, arch=None, with_flags_in_cc=True, with_python=True):\n        env = super().get_recipe_env(\n            arch=arch, with_flags_in_cc=with_flags_in_cc, with_python=with_python)\n        env['APP_ALLOW_MISSING_DEPS'] = 'true'\n        return env\n\n    def build_arch(self, arch):\n        env = self.get_recipe_env(arch)\n\n        with current_directory(self.get_jni_dir()):\n            shprint(\n                sh.ndk_build,\n                \"V=1\",\n                \"NDK_DEBUG=\" + (\"1\" if self.ctx.build_as_debuggable else \"0\"),\n                _env=env\n            )\n\n\nrecipe = LibSDL2Recipe()\n", "path": "pythonforandroid/recipes/sdl2/__init__.py"}], "after_files": [{"content": "from pythonforandroid.recipe import BootstrapNDKRecipe\nfrom pythonforandroid.toolchain import current_directory, shprint\nimport sh\n\n\nclass LibSDL2Recipe(BootstrapNDKRecipe):\n    version = \"2.0.9\"\n    url = \"https://www.libsdl.org/release/SDL2-{version}.tar.gz\"\n    md5sum = 'f2ecfba915c54f7200f504d8b48a5dfe'\n\n    dir_name = 'SDL'\n\n    depends = ['sdl2_image', 'sdl2_mixer', 'sdl2_ttf']\n\n    def get_recipe_env(self, arch=None, with_flags_in_cc=True, with_python=True):\n        env = super().get_recipe_env(\n            arch=arch, with_flags_in_cc=with_flags_in_cc, with_python=with_python)\n        env['APP_ALLOW_MISSING_DEPS'] = 'true'\n        return env\n\n    def build_arch(self, arch):\n        env = self.get_recipe_env(arch)\n\n        with current_directory(self.get_jni_dir()):\n            shprint(\n                sh.ndk_build,\n                \"V=1\",\n                \"NDK_DEBUG=\" + (\"1\" if self.ctx.build_as_debuggable else \"0\"),\n                _env=env\n            )\n\n\nrecipe = LibSDL2Recipe()\n", "path": "pythonforandroid/recipes/sdl2/__init__.py"}]}