no need for IPC on Android, removes the need for the cache-hack

removing the cache on each launch prevented opening files via intents
(i.e. from your mail application) unless the viewer was already running,
as it also deleted the temporary file that was created from the intent.

Change-Id: I0a4d9432f475e8434902ae11fc2b0c35fd25a71f
This commit is contained in:
Christian Lohmaier
2016-03-23 15:21:09 +01:00
parent 9f6d7d40b0
commit f6a74ce9bb
2 changed files with 5 additions and 25 deletions

View File

@@ -64,8 +64,7 @@ public final class LibreOfficeKit
Log.i(LOGTAG, String.format("Initializing LibreOfficeKit, dataDir=%s\n", dataDir)); Log.i(LOGTAG, String.format("Initializing LibreOfficeKit, dataDir=%s\n", dataDir));
redirectStdio(true); redirectStdio(true);
// ToDo: ugly workaround - find out why it segfaults with existing cachedir
deleteRecursive(activity.getApplication().getCacheDir());
String cacheDir = activity.getApplication().getCacheDir().getAbsolutePath(); String cacheDir = activity.getApplication().getCacheDir().getAbsolutePath();
String apkFile = activity.getApplication().getPackageResourcePath(); String apkFile = activity.getApplication().getPackageResourcePath();
@@ -93,20 +92,6 @@ public final class LibreOfficeKit
} }
initializeDone = true; initializeDone = true;
} }
/**
* Deletes files and recursively deletes directories.
*
* @param file
* File or directory to be deleted.
*/
private static void deleteRecursive(File file) {
Log.d(LOGTAG, "deleting cacheDir recursively - this is only a workaround - fixme please");
if (file.isDirectory()) {
for (File child : file.listFiles())
deleteRecursive(child);
}
file.delete();
}
// Now with static loading we always have all native code in one native // Now with static loading we always have all native code in one native
// library which we always call liblo-native-code.so, regardless of the // library which we always call liblo-native-code.so, regardless of the

View File

@@ -54,7 +54,7 @@ using namespace ::com::sun::star::frame;
namespace { namespace {
#if HAVE_FEATURE_DESKTOP || defined(ANDROID) #if HAVE_FEATURE_DESKTOP
static char const ARGUMENT_PREFIX[] = "InternalIPC::Arguments"; static char const ARGUMENT_PREFIX[] = "InternalIPC::Arguments";
static char const SEND_ARGUMENTS[] = "InternalIPC::SendArguments"; static char const SEND_ARGUMENTS[] = "InternalIPC::SendArguments";
@@ -101,7 +101,7 @@ namespace desktop
namespace { namespace {
#if HAVE_FEATURE_DESKTOP || defined(ANDROID) #if HAVE_FEATURE_DESKTOP
class Parser: public CommandLineArgs::Supplier { class Parser: public CommandLineArgs::Supplier {
public: public:
@@ -435,7 +435,7 @@ OfficeIPCThread::Status OfficeIPCThread::EnableOfficeIPCThread()
if( pGlobalOfficeIPCThread.is() ) if( pGlobalOfficeIPCThread.is() )
return IPC_STATUS_OK; return IPC_STATUS_OK;
#if HAVE_FEATURE_DESKTOP || defined(ANDROID) #if HAVE_FEATURE_DESKTOP
OUString aUserInstallPath; OUString aUserInstallPath;
OUString aDummy; OUString aDummy;
@@ -443,8 +443,6 @@ OfficeIPCThread::Status OfficeIPCThread::EnableOfficeIPCThread()
PipeMode nPipeMode = PIPEMODE_DONTKNOW; PipeMode nPipeMode = PIPEMODE_DONTKNOW;
#ifndef ANDROID // On Android it might be that we still for some reason need the pipe?
// In LibreOfficeKit-based programs we want to be totally independent from any other LibreOffice // In LibreOfficeKit-based programs we want to be totally independent from any other LibreOffice
// instance or LOKit-using program. Certainly no need for any IPC pipes by definition, as we // instance or LOKit-using program. Certainly no need for any IPC pipes by definition, as we
// don't have any reason to do any IPC. Why we even call this EnableOfficeIPCThread function // don't have any reason to do any IPC. Why we even call this EnableOfficeIPCThread function
@@ -459,7 +457,6 @@ OfficeIPCThread::Status OfficeIPCThread::EnableOfficeIPCThread()
nPipeMode = PIPEMODE_CREATED; nPipeMode = PIPEMODE_CREATED;
} }
else else
#endif
{ {
// The name of the named pipe is created with the hashcode of the user installation directory (without /user). We have to retrieve // The name of the named pipe is created with the hashcode of the user installation directory (without /user). We have to retrieve
// this information from a unotools implementation. // this information from a unotools implementation.
@@ -685,12 +682,10 @@ bool OfficeIPCThread::IsEnabled()
void OfficeIPCThread::execute() void OfficeIPCThread::execute()
{ {
#if HAVE_FEATURE_DESKTOP || defined(ANDROID) #if HAVE_FEATURE_DESKTOP
#ifndef ANDROID
if (comphelper::LibreOfficeKit::isActive()) if (comphelper::LibreOfficeKit::isActive())
return; return;
#endif
do do
{ {