def METHOD_NAME():
    test_d = tempfile.mkdtemp(prefix="p4a-android-ctypes-test-libdir-")
    try:
        with open(os.path.join(test_d, "mymadeuplib.so.5"), "w"):
            pass
        import jnius  # should get us our fake module
        # Test with mActivity returned:
        jnius.autoclass = MagicMock()
        jnius.autoclass().mService = None
        app_context = jnius.autoclass().mActivity.getApplicationContext()
        app_info = app_context.getPackageManager().getApplicationInfo()
        app_info.nativeLibraryDir = '/doesnt-exist-testpath'
        assert android._ctypes_library_finder.find_library(
            "mymadeuplib"
        ) is None
        assert mock.call("org.kivy.android.PythonActivity") in (
            jnius.autoclass.call_args_list
        )
        app_info.nativeLibraryDir = test_d
        assert os.path.normpath(android._ctypes_library_finder.find_library(
            "mymadeuplib"
        )) == os.path.normpath(os.path.join(test_d, "mymadeuplib.so.5"))
        # Test with mService returned:
        jnius.autoclass = MagicMock()
        jnius.autoclass().mActivity = None
        app_context = jnius.autoclass().mService.getApplicationContext()
        app_info = app_context.getPackageManager().getApplicationInfo()
        app_info.nativeLibraryDir = '/doesnt-exist-testpath'
        assert android._ctypes_library_finder.find_library(
            "mymadeuplib"
        ) is None
        app_info.nativeLibraryDir = test_d
        assert os.path.normpath(android._ctypes_library_finder.find_library(
            "mymadeuplib"
        )) == os.path.normpath(os.path.join(test_d, "mymadeuplib.so.5"))
    finally:
        shutil.rmtree(test_d)