jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx | 2 sal/Package_inc.mk | 1 sal/android/lo-bootstrap.c | 2 sal/inc/osl/detail/android-bootstrap.h | 80 ++++++++++++++++++++ sal/osl/unx/file.cxx | 2 sal/osl/unx/file_misc.cxx | 4 - sal/osl/unx/module.c | 2 sal/osl/unx/process_impl.cxx | 2 sal/osl/unx/thread.c | 18 ++++ sal/osl/unx/uunxapi.cxx | 2 solenv/inc/unxandr/lo-bootstrap.h | 77 ------------------- vcl/android/androidinst.cxx | 26 ++++-- vcl/inc/android/androidinst.hxx | 1 13 files changed, 126 insertions(+), 93 deletions(-)
New commits: commit 7c4c1832ccd4830f903d7d647466f96aa6755711 Author: Michael Meeks <michael.me...@suse.com> Date: Thu Jan 26 10:29:38 2012 +0000 android: move lo-bootstrap to osl/detail, Attach threads as created diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx index a8d8258..f288821 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx @@ -65,7 +65,7 @@ #include "diagnostics.h" #ifdef ANDROID -#include <lo-bootstrap.h> +#include <osl/detail/android-bootstrap.h> #endif #if defined HAVE_VALGRIND_H diff --git a/sal/Package_inc.mk b/sal/Package_inc.mk index e43de3e..304ab9d 100644 --- a/sal/Package_inc.mk +++ b/sal/Package_inc.mk @@ -65,6 +65,7 @@ $(eval $(call gb_Package_add_file,sal_inc,inc/osl/time.h,osl/time.h)) $(eval $(call gb_Package_add_file,sal_inc,inc/osl/util.h,osl/util.h)) $(eval $(call gb_Package_add_file,sal_inc,inc/osl/detail/file.h,osl/detail/file.h)) $(eval $(call gb_Package_add_file,sal_inc,inc/osl/detail/android_native_app_glue.h,osl/detail/android_native_app_glue.h)) +$(eval $(call gb_Package_add_file,sal_inc,inc/osl/detail/android-bootstrap.h,osl/detail/android-bootstrap.h)) $(eval $(call gb_Package_add_file,sal_inc,inc/rtl/allocator.hxx,rtl/allocator.hxx)) $(eval $(call gb_Package_add_file,sal_inc,inc/rtl/alloc.h,rtl/alloc.h)) $(eval $(call gb_Package_add_file,sal_inc,inc/rtl/bootstrap.h,rtl/bootstrap.h)) diff --git a/sal/android/lo-bootstrap.c b/sal/android/lo-bootstrap.c index 55bc643..98db089 100644 --- a/sal/android/lo-bootstrap.c +++ b/sal/android/lo-bootstrap.c @@ -48,7 +48,7 @@ #include "uthash.h" -#include "lo-bootstrap.h" +#include "osl/detail/android-bootstrap.h" #pragma GCC diagnostic ignored "-Wdeclaration-after-statement" diff --git a/sal/inc/osl/detail/android-bootstrap.h b/sal/inc/osl/detail/android-bootstrap.h new file mode 100644 index 0000000..6539687 --- /dev/null +++ b/sal/inc/osl/detail/android-bootstrap.h @@ -0,0 +1,80 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http: *www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * Copyright (C) 2011 Tor Lillqvist <t...@iki.fi> (initial developer) + * Copyright (C) 2011 SUSE Linux http://suse.com (initial developer's employer) + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#ifndef ANDROID_BOOSTRAP_H +#define ANDROID_BOOSTRAP_H +#if defined(ANDROID) + +#include <jni.h> +#include <dlfcn.h> +#include <dirent.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct lo_apk_dir lo_apk_dir; + +char **lo_dlneeds(const char *library); + +void *lo_dlopen(const char *library); + +void *lo_dlsym(void *handle, + const char *symbol); + +int lo_dladdr(void *addr, + Dl_info *info); + +void *lo_apkentry(const char *filename, + size_t *size); + +lo_apk_dir *lo_apk_opendir(const char *dirname); + +struct dirent *lo_apk_readdir(lo_apk_dir *dirp); + +int lo_apk_closedir(lo_apk_dir *dirp); + +int lo_apk_lstat(const char *path, struct stat *statp); + +int lo_dlcall_argc_argv(void *function, + int argc, + const char **argv); + +JavaVM *lo_get_javavm(void); + +struct android_app *lo_get_app(void); + +#ifdef __cplusplus +} +#endif + +#endif // ANDROID +#endif // ANDROID_BOOTSTRAP_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx index 63e9775..b8a851f 100644 --- a/sal/osl/unx/file.cxx +++ b/sal/osl/unx/file.cxx @@ -59,7 +59,7 @@ #endif /* MACOSX */ #ifdef ANDROID -#include <lo-bootstrap.h> +#include <osl/detail/android-bootstrap.h> #endif #ifdef DEBUG_OSL_FILE diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx index 260b711..962d7bf 100644 --- a/sal/osl/unx/file_misc.cxx +++ b/sal/osl/unx/file_misc.cxx @@ -55,7 +55,7 @@ #include <algorithm> #ifdef ANDROID -#include <lo-bootstrap.h> +#include <osl/detail/android-bootstrap.h> #endif /************************************************************************ @@ -774,7 +774,7 @@ static oslFileError osl_psz_removeFile( const sal_Char* pszPath ) int nRet=0; struct stat aStat; - nRet = lstat(pszPath,&aStat); + nRet = lstat_c(pszPath,&aStat); if ( nRet < 0 ) { nRet=errno; diff --git a/sal/osl/unx/module.c b/sal/osl/unx/module.c index 2889a77..792f0cd 100644 --- a/sal/osl/unx/module.c +++ b/sal/osl/unx/module.c @@ -44,7 +44,7 @@ #endif #ifdef ANDROID -#include <lo-bootstrap.h> +#include <osl/detail/android-bootstrap.h> #endif /* implemented in file.c */ diff --git a/sal/osl/unx/process_impl.cxx b/sal/osl/unx/process_impl.cxx index 83c5c88..d90fdea 100644 --- a/sal/osl/unx/process_impl.cxx +++ b/sal/osl/unx/process_impl.cxx @@ -60,7 +60,7 @@ #include "uunxapi.h" #ifdef ANDROID -#include <lo-bootstrap.h> +#include <osl/detail/android-bootstrap.h> #endif /*************************************** diff --git a/sal/osl/unx/thread.c b/sal/osl/unx/thread.c index 4128d08..59a0514 100644 --- a/sal/osl/unx/thread.c +++ b/sal/osl/unx/thread.c @@ -37,6 +37,10 @@ #include <rtl/textenc.h> #include <rtl/alloc.h> #include <sal/macros.h> +#ifdef ANDROID +#include <jni.h> +#include <osl/detail/android-bootstrap.h> +#endif #if defined LINUX && ! defined __FreeBSD_kernel__ #include <sys/prctl.h> @@ -288,8 +292,22 @@ static void* osl_thread_start_Impl (void* pData) if (!terminate) { +#ifdef ANDROID + { + JNIEnv* env = 0; + int res = (*lo_get_javavm())->AttachCurrentThread(lo_get_javavm(), &env, NULL); // res == 0 + fprintf (stderr, "new sal thread started and attached %d!\n", res); + } +#endif /* call worker function */ pImpl->m_WorkerFunction(pImpl->m_pData); + +#ifdef ANDROID + { + int res = (*lo_get_javavm())->DetachCurrentThread(lo_get_javavm()); + fprintf (stderr, "detached finished sal thread %d!\n", res); + } +#endif } /* call cleanup handler and leave */ diff --git a/sal/osl/unx/uunxapi.cxx b/sal/osl/unx/uunxapi.cxx index 8abe57f..270f5c3 100644 --- a/sal/osl/unx/uunxapi.cxx +++ b/sal/osl/unx/uunxapi.cxx @@ -48,7 +48,7 @@ #endif #ifdef ANDROID - #include <lo-bootstrap.h> + #include <osl/detail/android-bootstrap.h> #endif //########################### diff --git a/solenv/inc/unxandr/lo-bootstrap.h b/solenv/inc/unxandr/lo-bootstrap.h deleted file mode 100644 index d78d88b..0000000 --- a/solenv/inc/unxandr/lo-bootstrap.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Version: MPL 1.1 / GPLv3+ / LGPLv3+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License or as specified alternatively below. You may obtain a copy of - * the License at http: *www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * Major Contributor(s): - * Copyright (C) 2011 Tor Lillqvist <t...@iki.fi> (initial developer) - * Copyright (C) 2011 SUSE Linux http://suse.com (initial developer's employer) - * - * All Rights Reserved. - * - * For minor contributions see the git repository. - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 3 or later (the "GPLv3+"), or - * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), - * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable - * instead of those above. - */ - -#if defined(ANDROID) - -#include <jni.h> -#include <dlfcn.h> -#include <dirent.h> - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct lo_apk_dir lo_apk_dir; - -char **lo_dlneeds(const char *library); - -void *lo_dlopen(const char *library); - -void *lo_dlsym(void *handle, - const char *symbol); - -int lo_dladdr(void *addr, - Dl_info *info); - -void *lo_apkentry(const char *filename, - size_t *size); - -lo_apk_dir *lo_apk_opendir(const char *dirname); - -struct dirent *lo_apk_readdir(lo_apk_dir *dirp); - -int lo_apk_closedir(lo_apk_dir *dirp); - -int lo_apk_lstat(const char *path, struct stat *statp); - -int lo_dlcall_argc_argv(void *function, - int argc, - const char **argv); - -JavaVM *lo_get_javavm(void); - -struct android_app *lo_get_app(void); - -#ifdef __cplusplus -} -#endif - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index 4772a74..d867fa8 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -29,9 +29,10 @@ #include <android/androidinst.hxx> #include <headless/svpdummies.hxx> #include <generic/gendata.hxx> +#include <jni.h> #include <android/log.h> #include <android/looper.h> -#include <lo-bootstrap.h> +#include <osl/detail/android-bootstrap.h> #include <osl/detail/android_native_app_glue.h> #include <rtl/strbuf.hxx> @@ -78,12 +79,13 @@ static void BlitFrameRegionToWindow(ANativeWindow *pWindow, const ARect &rSrcRect, int nDestX, int nDestY) { - fprintf (stderr, "Blit frame src %d,%d->%d,%d to position %d, %d\n", + fprintf (stderr, "Blit frame #2 src %d,%d->%d,%d to position %d, %d\n", rSrcRect.left, rSrcRect.top, rSrcRect.right, rSrcRect.bottom, nDestX, nDestY); ARect aRect; ANativeWindow_Buffer aOutBuffer; memset ((void *)&aOutBuffer, 0, sizeof (aOutBuffer)); + fprintf (stderr, "pre lock\n"); int32_t nRet = ANativeWindow_lock(pWindow, &aOutBuffer, &aRect); fprintf (stderr, "locked window %d returned rect: %d,%d->%d,%d " "buffer: %dx%d stride %d, format %d, bits %p\n", @@ -110,6 +112,7 @@ static void BlitFrameRegionToWindow(ANativeWindow *pWindow, unsigned char *dp = ( (unsigned char *)aOutBuffer.bits + aOutBuffer.stride * (y + nDestY) + nDestX * 4 /* dest pixel size */ ); + fprintf (stderr, "y %d, sp %p dp %p\n", y, sp, dp); for (unsigned int x = 0; x < (unsigned int)(aSrcRect.right - aSrcRect.left); x++) { dp[x*4 + 0] = sp[x*3 + 0]; // B @@ -164,8 +167,7 @@ void AndroidSalInstance::onAppCmd (struct android_app* app, int32_t cmd) fprintf (stderr, "we have an app window ! %p %dx%x (%d)\n", pWindow, aRect.right, aRect.bottom, ANativeWindow_getFormat(pWindow)); - - RedrawWindows(pWindow); + mbQueueReDraw = true; break; } case APP_CMD_WINDOW_RESIZED: @@ -176,13 +178,13 @@ void AndroidSalInstance::onAppCmd (struct android_app* app, int32_t cmd) fprintf (stderr, "app window resized to ! %p %dx%x (%d)\n", pWindow, aRect.right, aRect.bottom, ANativeWindow_getFormat(pWindow)); - RedrawWindows(pWindow); + mbQueueReDraw = true; break; } case APP_CMD_WINDOW_REDRAW_NEEDED: { - RedrawWindows(pWindow); + mbQueueReDraw = true; break; } @@ -259,6 +261,8 @@ extern "C" { AndroidSalInstance::AndroidSalInstance( SalYieldMutex *pMutex ) : SvpSalInstance( pMutex ) + , mpApp( NULL ) + , mbQueueReDraw( false ) { mpApp = lo_get_app(); fprintf (stderr, "created Android Sal Instance for app %p window %p\n", @@ -297,8 +301,12 @@ void AndroidSalInstance::DoReleaseYield (int nTimeoutMS) fprintf (stderr, "DoReleaseYield #2 %d ms\n", nTimeoutMS); void *outData = NULL; int outFd = 0, outEvents = 0; + + if (mbQueueReDraw) + nTimeoutMS = 0; + int nRet = ALooper_pollAll(nTimeoutMS, &outFd, &outEvents, &outData); - fprintf (stderr, "ret %d %d %d %p\n", nRet, outFd, outEvents, outData); + fprintf (stderr, "ret #3 %d %d %d %p\n", nRet, outFd, outEvents, outData); // acquire yield mutex again AcquireYieldMutex(nAcquireCount); @@ -307,8 +315,10 @@ void AndroidSalInstance::DoReleaseYield (int nTimeoutMS) // set a callback in the native app glue's ALooper_addFd ? if (nRet == LOOPER_ID_MAIN) mpApp->cmdPollSource.process(mpApp, &mpApp->cmdPollSource); - if (nRet == LOOPER_ID_INPUT) + else if (nRet == LOOPER_ID_INPUT) mpApp->inputPollSource.process(mpApp, &mpApp->inputPollSource); + else if (mbQueueReDraw) + RedrawWindows (mpApp->window); } bool AndroidSalInstance::AnyInput( sal_uInt16 nType ) diff --git a/vcl/inc/android/androidinst.hxx b/vcl/inc/android/androidinst.hxx index aec2735..e39f147 100644 --- a/vcl/inc/android/androidinst.hxx +++ b/vcl/inc/android/androidinst.hxx @@ -57,6 +57,7 @@ public: protected: virtual void DoReleaseYield( int nTimeoutMS ); struct android_app *mpApp; + bool mbQueueReDraw; }; #endif // ANDROID_SALINST_H _______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits