[Libreoffice-commits] online.git: 26 commits - android/app android/Makefile.am android/templates configure.ac kit/Kit.cpp loleaflet/js loleaflet/Makefile.am Makefile.am net/FakeSocket.cpp
Jan Holesovsky (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jun 20 12:17:14 UTC 2019
Makefile.am | 4
android/Makefile.am | 12 +
android/app/build.gradle | 99 +++------
android/app/liboSettings.gradle.in | 6
android/app/proguard-rules.pro | 16 +
android/app/src/main/assets/html/index.html | 18 -
android/app/src/main/assets/js/hello.js | 12 -
android/app/src/main/cpp/androidapp.cpp | 97 +++++---
android/app/src/main/java/org/libreoffice/androidapp/MainActivity.java | 6
android/app/src/main/java/org/libreoffice/androidapp/ui/LibreOfficeUIActivity.java | 102 +++++----
android/app/src/main/res/layout/dialog_create_file.xml | 35 +++
android/app/src/main/res/values/strings.xml | 8
configure.ac | 45 +++-
kit/Kit.cpp | 6
loleaflet/Makefile.am | 5
loleaflet/js/global.js | 2
net/FakeSocket.cpp | 109 +++++-----
17 files changed, 332 insertions(+), 250 deletions(-)
New commits:
commit 0ce797606c43642441176c18c16e6bb9330d5257
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Thu Jun 20 12:06:50 2019 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Jun 20 14:15:25 2019 +0200
android: Create New File dialog rework.
Use a xml layout instead of ad-hoc creation of widgets for better look
(the widgets are not styled when created using 'new') and maintainability.
Update the label of the positive button based on whether the file will
be just created or overwritten (or hide it completely when the input is
empty).
Change-Id: I8cba88402dc4167ff053612b6101a3d7cf57b8c0
diff --git a/android/app/src/main/java/org/libreoffice/androidapp/ui/LibreOfficeUIActivity.java b/android/app/src/main/java/org/libreoffice/androidapp/ui/LibreOfficeUIActivity.java
index 3c462fe52..cc0bb1bc9 100644
--- a/android/app/src/main/java/org/libreoffice/androidapp/ui/LibreOfficeUIActivity.java
+++ b/android/app/src/main/java/org/libreoffice/androidapp/ui/LibreOfficeUIActivity.java
@@ -48,6 +48,7 @@ import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.OvershootInterpolator;
+import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
@@ -603,63 +604,75 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings
// Opens an Input dialog to get the name of new file
private void createNewFileInputDialog(final String defaultFileName, final String newDocumentType, final String extension) {
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setTitle(R.string.create_new_document_title);
-
- LinearLayout layout = new LinearLayout(this);
- layout.setOrientation(LinearLayout.VERTICAL);
+ LayoutInflater inflater = getLayoutInflater();
+ View view = inflater.inflate(R.layout.dialog_create_file, null);
- //file name input
- final EditText input = new EditText(this);
- input.setInputType(InputType.TYPE_CLASS_TEXT);
+ // file name input
+ final EditText input = (EditText)view.findViewById(R.id.fileName);
input.setText(defaultFileName);
- layout.addView(input);
- //warning text to notify the user that such a file already exists
- final TextView warningText = new TextView(this);
- warningText.setText(getString(R.string.file_exists_warning));
- layout.addView(warningText);
- //check if the file exists when showing the create dialog
+ // warning text to notify the user that such a file already exists
+ final TextView warningText = (TextView)view.findViewById(R.id.overwriteWarning);
+
+ // check if the file exists when showing the create dialog
File tempFile = new File(currentDirectory.getUri().getPath() + input.getText().toString());
warningText.setVisibility(tempFile.exists() ? View.VISIBLE : View.GONE);
- builder.setView(layout);
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ builder.setTitle(R.string.create_new_document_title)
+ .setView(view)
+ .setPositiveButton(tempFile.exists() ? R.string.action_overwrite : R.string.action_create, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ final String path = currentDirectory.getUri().getPath() + input.getText().toString();
+ Uri newDocUri = createNewFile(path, extension);
+ if (newDocUri != null) {
+ Intent i = new Intent(Intent.ACTION_VIEW, newDocUri);
- builder.setPositiveButton(R.string.action_create, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- final String path = currentDirectory.getUri().getPath() + input.getText().toString();
- Uri newDocUri = createNewFile(path, extension);
- if (newDocUri != null) {
- Intent i = new Intent(Intent.ACTION_VIEW, newDocUri);
- String packageName = getApplicationContext().getPackageName();
- ComponentName componentName = new ComponentName(packageName,
- MainActivity.class.getName());
- i.setComponent(componentName);
- i.putExtra("org.libreoffice.document_provider_id",
- documentProvider.getId());
- i.putExtra("org.libreoffice.document_uri",
- newDocUri);
- startActivity(i);
- } else {
- Toast.makeText(LibreOfficeUIActivity.this, getString(R.string.file_creation_failed), Toast.LENGTH_SHORT).show();
+ String packageName = getApplicationContext().getPackageName();
+ ComponentName componentName = new ComponentName(packageName, MainActivity.class.getName());
+ i.setComponent(componentName);
+
+ i.putExtra("org.libreoffice.document_provider_id", documentProvider.getId());
+ i.putExtra("org.libreoffice.document_uri", newDocUri);
+
+ startActivity(i);
+ } else {
+ Toast.makeText(LibreOfficeUIActivity.this, getString(R.string.file_creation_failed), Toast.LENGTH_SHORT).show();
+ }
}
- }
- });
+ })
+ .setNegativeButton(R.string.action_cancel, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ dialog.cancel();
+ }
+ });
- builder.setNegativeButton(R.string.action_cancel, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- dialog.cancel();
- }
- });
+ final AlertDialog alertDialog = builder.show();
- //check if a file with this name already exists and notify the user
+ // check if a file with this name already exists and notify the user
input.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence c, int start, int before, int count) {
+ Button positiveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
+ boolean emptyInput = input.getText().toString().isEmpty();
+
File tempFile = new File(currentDirectory.getUri().getPath() + input.getText().toString());
- warningText.setVisibility(tempFile.exists() ? View.VISIBLE : View.GONE);
+ if (!emptyInput && tempFile.exists()) {
+ warningText.setVisibility(View.VISIBLE);
+ positiveButton.setText(R.string.action_overwrite);
+ }
+ else {
+ warningText.setVisibility(View.GONE);
+ positiveButton.setText(R.string.action_create);
+ }
+
+ // hide the button completely if empty
+ if (emptyInput)
+ positiveButton.setVisibility(View.GONE);
+ else
+ positiveButton.setVisibility(View.VISIBLE);
}
@Override
@@ -670,11 +683,8 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
});
-
- builder.show();
}
-
/**
* Creates a new file at the specified path, by copying an empty template to that location.
*
diff --git a/android/app/src/main/res/layout/dialog_create_file.xml b/android/app/src/main/res/layout/dialog_create_file.xml
new file mode 100644
index 000000000..816513300
--- /dev/null
+++ b/android/app/src/main/res/layout/dialog_create_file.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:padding="18dp">
+
+ <TextView
+ android:id="@+id/label"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:labelFor="@id/fileName"
+ android:text="@string/enter_filename" />
+
+ <EditText
+ android:id="@+id/fileName"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="12dp"
+ android:layout_weight="1"
+ android:autofillHints=""
+ android:ems="10"
+ android:inputType="text" />
+
+ <TextView
+ android:id="@+id/overwriteWarning"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="12dp"
+ android:layout_weight="1"
+ android:text="@string/file_exists_warning"
+ android:visibility="gone" />
+</LinearLayout>
diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml
index c79b44d57..aa73bec01 100644
--- a/android/app/src/main/res/values/strings.xml
+++ b/android/app/src/main/res/values/strings.xml
@@ -9,7 +9,7 @@
<string name="no_recent_items">No recent items</string>
<string name="no_items">No items</string>
<string name="temp_file_saving_disabled">This file is read-only, saving is disabled.</string>
- <string name="file_exists_warning">A file with this name already exists, and it will be overwritten.</string>
+ <string name="file_exists_warning">A file with this name already exists, and will be overwritten.</string>
<string name="file_creation_failed">File creation failed</string>
<string name="storage_permission_required">Storage permission is required</string>
<string name="failed_to_load_file">Failed to determine the file to load</string>
@@ -120,8 +120,10 @@
<string name="action_cancel">Cancel</string>
<!-- Create New Document Dialog Strings -->
- <string name="create_new_document_title">Enter file name</string>
- <string name="action_create">CREATE</string>
+ <string name="create_new_document_title">Create New Document</string>
+ <string name="enter_filename">Please enter the file name:</string>
+ <string name="action_create">Create</string>
+ <string name="action_overwrite">Overwrite</string>
<!-- Loading SlideShow Dialog Strings -->
<string name="loading">Loading...</string>
commit 008b189cc892a615ce34bd523f1b60d03a8cc020
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Wed Jun 19 22:27:09 2019 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Jun 20 14:15:13 2019 +0200
android: Actually let's disable the obfuscation for the moment.
The rules apparently still need improvements.
Change-Id: I606a5c526df3500f964de5b3a9f2e2c577a0b25b
diff --git a/android/app/build.gradle b/android/app/build.gradle
index fb28b7f1c..ec472b91d 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -30,8 +30,8 @@ android {
ndk {
abiFilters "armeabi-v7a"
}
- minifyEnabled true
- shrinkResources true
+ minifyEnabled false // FIXME disabled before we get a good proguardRules for callFakeWebsocketOnMessage calling from C++
+ shrinkResources false // FIXME cannot be enabled when minifyEnabled is turned off
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
commit 8f8e997e1bad3ddb579d6c239b12b530b7413ef3
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Wed Jun 19 22:16:33 2019 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Jun 20 14:14:59 2019 +0200
android: The JNI callbacks must not change names during obfuscation.
Otherwise they are not found when attempting to call them. Particularly
problematic was the callFakeWebsocketOnMessage that is called from C++.
Change-Id: I9c99733d63583e7c568f0f708e7efbd92497b5fb
diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro
index b7420a70b..7ebb4ddae 100644
--- a/android/app/proguard-rules.pro
+++ b/android/app/proguard-rules.pro
@@ -12,6 +12,16 @@
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
+-keepclassmembers class LOOLMessageHandler {
+ public *;
+}
+
+# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
+-keepclasseswithmembernames class * {
+ native <methods>;
+}
+
+# Keep also method that we are calling back from the JNI
+-keepclassmembers class MainActivity {
+ void callFakeWebsocketOnMessage(java.lang.String);
+}
commit fe9b3d69d52c6c9e9c5958471b9aee5c66fda4bb
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Wed Jun 19 21:12:41 2019 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Jun 20 14:14:50 2019 +0200
android: We also need to DetachCurrentThread().
And clean the exceptions too, otherwise we get failures in GetMethodID.
Change-Id: Id636002dd9d32cb7ea0db8ad906b11619f38ef36
diff --git a/android/app/src/main/cpp/androidapp.cpp b/android/app/src/main/cpp/androidapp.cpp
index 7ea8beb3f..5ff2f4dbb 100644
--- a/android/app/src/main/cpp/androidapp.cpp
+++ b/android/app/src/main/cpp/androidapp.cpp
@@ -112,7 +112,7 @@ static void send2JS(jclass mainActivityClz, jobject mainActivityObj, const std::
JNIEnv *env;
jint res = javaVM->GetEnv((void**)&env, JNI_VERSION_1_6);
- if (res != JNI_OK) {
+ if (res == JNI_EDETACHED) {
LOG_DBG("GetEnv need to attach thread");
res = javaVM->AttachCurrentThread(&env, nullptr);
if (JNI_OK != res) {
@@ -120,10 +120,23 @@ static void send2JS(jclass mainActivityClz, jobject mainActivityObj, const std::
return;
}
}
+ else if (res == JNI_EVERSION) {
+ LOG_DBG("GetEnv version not supported");
+ return;
+ }
+ else if (res != JNI_OK) {
+ LOG_DBG("GetEnv another error");
+ return;
+ }
jstring jstr = env->NewStringUTF(js.c_str());
jmethodID callFakeWebsocket = env->GetMethodID(mainActivityClz, "callFakeWebsocketOnMessage", "(Ljava/lang/String;)V");
env->CallVoidMethod(mainActivityObj, callFakeWebsocket, jstr);
+
+ if (env->ExceptionCheck())
+ env->ExceptionDescribe();
+
+ javaVM->DetachCurrentThread();
}
/// Handle a message from JavaScript.
commit 297a4857ad7ead34d0159baae7cfde7892118e44
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Wed Jun 19 20:50:11 2019 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Jun 20 14:14:39 2019 +0200
android: Explicitly enable unipoll.
Change-Id: If48dc344bbe07a8633c05fc95c2e7ccd1719c288
diff --git a/android/app/src/main/cpp/androidapp.cpp b/android/app/src/main/cpp/androidapp.cpp
index 49caa35cd..7ea8beb3f 100644
--- a/android/app/src/main/cpp/androidapp.cpp
+++ b/android/app/src/main/cpp/androidapp.cpp
@@ -45,6 +45,8 @@ JNI_OnLoad(JavaVM* vm, void*) {
return JNI_ERR; // JNI version not supported.
}
+ setenv("SAL_LOK_OPTIONS", "unipoll", 0);
+
Log::initialize("Mobile", "debug", false, false, {});
return JNI_VERSION_1_6;
commit 5b10be08f2a3fa7c778290428f06e92c05045067
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Wed Jun 19 11:43:44 2019 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Jun 20 14:14:23 2019 +0200
android: Remove also the build/ subdir during make clean.
Change-Id: I62d3840f26f5a9be2fc5d02aece50813b7eda30b
diff --git a/android/Makefile.am b/android/Makefile.am
index 278f5737b..9d27873df 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -1,5 +1,6 @@
clean-local:
rm -rf $(abs_top_srcdir)/android/app/src/main/assets/*
+ rm -rf app/build
all-local: app/src/main/assets/templates/untitled.odg \
app/src/main/assets/templates/untitled.odp \
commit f77c8cd967546b74c14a27386276ff48d4167620
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Wed Jun 19 11:21:40 2019 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Jun 20 14:14:00 2019 +0200
android: make clean should clean the assets too.
Change-Id: I1cb2ddb1a7ed71234a5ffc9bdf3631d701df6e5c
diff --git a/Makefile.am b/Makefile.am
index 9df919489..0b5e64ea5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,8 +5,12 @@ if ENABLE_MOBILEAPP
if ENABLE_GTKAPP
SUBDIRS = gtk loleaflet
else
+if ENABLE_ANDROIDAPP
+SUBDIRS = android loleaflet
+else
SUBDIRS = loleaflet
endif
+endif
else
diff --git a/android/Makefile.am b/android/Makefile.am
new file mode 100644
index 000000000..278f5737b
--- /dev/null
+++ b/android/Makefile.am
@@ -0,0 +1,11 @@
+clean-local:
+ rm -rf $(abs_top_srcdir)/android/app/src/main/assets/*
+
+all-local: app/src/main/assets/templates/untitled.odg \
+ app/src/main/assets/templates/untitled.odp \
+ app/src/main/assets/templates/untitled.ods \
+ app/src/main/assets/templates/untitled.odt
+
+app/src/main/assets/templates/untitled.%: templates/untitled.%
+ @mkdir -p $(dir $@)
+ @cp -a $< $@
diff --git a/android/app/src/main/assets/html/index.html b/android/app/src/main/assets/html/index.html
deleted file mode 100644
index 5f61e5f83..000000000
--- a/android/app/src/main/assets/html/index.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<!DOCTYPE html>
-<head>
- <script src="file:///android_asset/js/hello.js"></script>
-</head>
-<html>
- <body>
- <div align="center">
- <h1>Welcome</h1>
- <button type="button" onclick="sayHello()"> Click here </button>
- <p id="answer"></p>
-
- <h2>Call java code from javascript</h2>
- <button type="button" onclick="callGetStringIndirect()"> Click here </button>
- <p id="string1"></p>
- <p id="string2"></p>
- </div>
- </body>
-</html>
diff --git a/android/app/src/main/assets/js/hello.js b/android/app/src/main/assets/js/hello.js
deleted file mode 100644
index d26787f4b..000000000
--- a/android/app/src/main/assets/js/hello.js
+++ /dev/null
@@ -1,12 +0,0 @@
-function sayHello(){
- document.getElementById("answer").innerHTML = "Hello there";
-}
-
-function callGetStringIndirect(){
- string = window.MainHandler.getString("test");
- document.getElementById('string1').innerHTML = string;
-}
-
-function helloFromJavascript(){
- document.getElementById('string2').innerHTML = "Hello from javascript";
-}
diff --git a/android/app/src/main/assets/templates/untitled.odg b/android/templates/untitled.odg
similarity index 100%
rename from android/app/src/main/assets/templates/untitled.odg
rename to android/templates/untitled.odg
diff --git a/android/app/src/main/assets/templates/untitled.odp b/android/templates/untitled.odp
similarity index 100%
rename from android/app/src/main/assets/templates/untitled.odp
rename to android/templates/untitled.odp
diff --git a/android/app/src/main/assets/templates/untitled.ods b/android/templates/untitled.ods
similarity index 100%
rename from android/app/src/main/assets/templates/untitled.ods
rename to android/templates/untitled.ods
diff --git a/android/app/src/main/assets/templates/untitled.odt b/android/templates/untitled.odt
similarity index 100%
rename from android/app/src/main/assets/templates/untitled.odt
rename to android/templates/untitled.odt
diff --git a/configure.ac b/configure.ac
index 10751e294..7d1928b2e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -778,6 +778,7 @@ AC_SUBST(IOSAPP_FONTS)
AC_CONFIG_FILES([Makefile
android/app/liboSettings.gradle
android/app/src/main/cpp/CMakeLists.txt
+ android/Makefile
gtk/Makefile
ios/config.h
ios/Mobile/Info.plist
commit 22720ee7d12b2d4567567f59a367251ba5f1f721
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Wed Jun 19 09:48:54 2019 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Jun 20 14:13:29 2019 +0200
Avoid a TypeError.
I've been getting this on Android, but suspect it can be a general
problem:
loleaflet.html?file_path=/storage/emulated/0/Documents/untitled.odt&closebutton=1&permission=edit:165 Uncaught TypeError: Right-hand side of 'instanceof' is not an object
at global.FakeWebSocket.global.socket.onmessage (loleaflet.html?file_path=/storage/emulated/0/Documents/untitled.odt&closebutton=1&permission=edit:165)
at <anonymous>:1:25
Change-Id: Ifa6a6b15843e0c8235b920cea07324db59282074
diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index 344ada470..c1d6b9f9e 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -127,7 +127,7 @@
}
global.socket.onmessage = function (event) {
- if (global.L && global.socket instanceof global.L.Socket) {
+ if (typeof global.socket._onMessage === 'function') {
global.socket._onMessage(event);
} else {
global.queueMsg.push(event.data);
commit f485b2ea978f1ba508ae0395d0158693f398c7fa
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Tue Jun 18 16:10:26 2019 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Jun 20 14:13:09 2019 +0200
android/ios: Turn the --with-iosapp-branding into --with-app-branding.
This is needed for the Android app too, so generalize the switch.
Kill copying of the example documents into the APK when at that...
Change-Id: I5b575ade3e40cc0becd5c739077acff5299d3312
diff --git a/configure.ac b/configure.ac
index 3fe6c9035..10751e294 100644
--- a/configure.ac
+++ b/configure.ac
@@ -82,8 +82,8 @@ AC_ARG_WITH([iosapp-fonts],
[Point to a directory containing .ttf or .otf files to be bundled in the iOS app (and
thus installed on the device for use of the LO core code).]))
-AC_ARG_WITH([iosapp-branding],
- AS_HELP_STRING([--with-iosapp-branding=<path>],
+AC_ARG_WITH([app-branding],
+ AS_HELP_STRING([--with-app-branding=<path>],
[Point to a directory containing a branding.css file and possibly other files it references,
to be bundled and used by the iOS app. The directory structure is copied to
"loleaflet/dist/branding" and that directory ends upp in the app bundle as "branding".]))
@@ -740,6 +740,12 @@ AC_CONFIG_LINKS([loolkitconfig.xcu:loolkitconfig.xcu])
AC_CONFIG_LINKS([loleaflet/package.json:loleaflet/package.json])
AC_LINK_FILES([loleaflet/archived-packages], [loleaflet/archived-packages])
+APP_BRANDING_DIR=
+if test "$with_app_branding" != no -a -d "$with_app_branding"; then
+ APP_BRANDING_DIR="$with_app_branding"
+fi
+AC_SUBST(APP_BRANDING_DIR)
+
AS_IF([test "$ENABLE_IOSAPP" = "true"],
[
if test `uname -s` = "Darwin"; then
@@ -755,10 +761,10 @@ AS_IF([test "$ENABLE_IOSAPP" = "true"],
fi
rm -rf ios/Mobile/Branding
mkdir ios/Mobile/Branding
- if test "$with_iosapp_branding" != no -a -d "$with_iosapp_branding"; then
+ if test -n "$APP_BRANDING_DIR" ; then
AC_MSG_NOTICE([copying branding files])
mkdir -p loleaflet/dist/branding
- (cd "$with_iosapp_branding" && tar cf - .) | (cd ios/Mobile/Branding && tar xf -)
+ (cd "$APP_BRANDING_DIR" && tar cf - .) | (cd ios/Mobile/Branding && tar xf -)
else
# A Branding/branding.css file must exist, it is
# referenced unconditionally in loleaflet.html in the
diff --git a/loleaflet/Makefile.am b/loleaflet/Makefile.am
index cb7282248..1df4350aa 100644
--- a/loleaflet/Makefile.am
+++ b/loleaflet/Makefile.am
@@ -151,9 +151,8 @@ build-loleaflet: | $(LOLEAFLET_L10N_DST) \
if ENABLE_ANDROIDAPP
@rm -rf $(abs_top_srcdir)/android/app/src/main/assets/dist
@cp -a $(builddir)/dist $(abs_top_srcdir)/android/app/src/main/assets/
- @cp -a $(abs_top_srcdir)/test/data/hello.odt $(abs_top_srcdir)/android/app/src/main/assets/hello-world.odt
- @cp -a $(abs_top_srcdir)/test/data/hello.ods $(abs_top_srcdir)/android/app/src/main/assets/hello-world.ods
- @cp -a $(abs_top_srcdir)/test/data/hello.odp $(abs_top_srcdir)/android/app/src/main/assets/hello-world.odp
+ @if test -d "$(APP_BRANDING_DIR)" ; then cp -a "$(APP_BRANDING_DIR)/branding.css" "$(APP_BRANDING_DIR)/branding.js" $(abs_top_srcdir)/android/app/src/main/assets/dist/ ; fi
+ @if test -d "$(APP_BRANDING_DIR)" ; then cp -a "$(APP_BRANDING_DIR)/toolbar-bg-logo.svg" $(abs_top_srcdir)/android/app/src/main/assets/dist/images/toolbar-bg.svg ; fi
@echo
@echo "Copied JS, HTML and CSS to the Android project (android/app/src/main/assets/dist)."
@echo
commit 61f6189a997130bf06c44f5ee735260df20f05e0
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Tue Jun 18 14:41:42 2019 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Jun 20 14:12:55 2019 +0200
android: Allow providing the package name via --with-android-package-name.
And when at that, tweak some settings for the release configuration.
Change-Id: Ib8dab481fb7734637076603347f8fde453455fda
diff --git a/android/app/build.gradle b/android/app/build.gradle
index eef10a4d4..fb28b7f1c 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -19,6 +19,8 @@ android {
//abiFilters "x86", "armeabi-v7a", "armeabi"
abiFilters "armeabi-v7a"
}
+ applicationIdSuffix '.debug'
+ versionNameSuffix '-debug'
debuggable true
}
release {
@@ -28,7 +30,8 @@ android {
ndk {
abiFilters "armeabi-v7a"
}
- minifyEnabled false
+ minifyEnabled true
+ shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
diff --git a/android/app/liboSettings.gradle.in b/android/app/liboSettings.gradle.in
index e4f4f3a61..80234582b 100644
--- a/android/app/liboSettings.gradle.in
+++ b/android/app/liboSettings.gradle.in
@@ -16,7 +16,7 @@ ext {
liboInfoURL = '@INFO_URL@'
}
android.defaultConfig {
- applicationId 'org.libreoffice.androidapp'
+ applicationId '@ANDROID_PACKAGE_NAME@'
versionCode 1
versionName '@LOOLWSD_VERSION@'
}
diff --git a/configure.ac b/configure.ac
index 9fd6bfaee..3fe6c9035 100644
--- a/configure.ac
+++ b/configure.ac
@@ -100,6 +100,11 @@ AC_ARG_ENABLE([androidapp],
to work similarly to the iOS app, from the JavaScript and the pseudo WebSocket
message plumbing point of view.]))
+AC_ARG_WITH(android-package-name,
+ AS_HELP_STRING([--with-android-package-name="org.libreoffice.androidapp"],
+ [Set Android package name of the build.]),
+,)
+
AC_ARG_WITH([app-name],
AS_HELP_STRING([--with-app-name=<name>],
[Set the user-visible name of the app you build.]))
@@ -336,6 +341,24 @@ AC_SUBST(LIBPNG_INCLUDES)
AC_SUBST(LIBPNG_LIBS)
AC_SUBST(LOKIT_PATH)
+ENABLE_ANDROIDAPP=
+ANDROID_PACKAGE_NAME=
+if test "$enable_androidapp" = "yes"; then
+ ENABLE_ANDROIDAPP=true
+
+ AC_MSG_CHECKING([for Android package name])
+ if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
+ ANDROID_PACKAGE_NAME="org.libreoffice.androidapp"
+ AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
+ else
+ ANDROID_PACKAGE_NAME="$with_android_package_name"
+ AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
+ fi
+fi
+AC_SUBST(ENABLE_ANDROIDAPP)
+AM_CONDITIONAL([ENABLE_ANDROIDAPP], [test "$ENABLE_ANDROIDAPP" = "true"])
+AC_SUBST(ANDROID_PACKAGE_NAME)
+
APP_NAME="LOOL"
if test -n "$with_app_name"; then
APP_NAME="$with_app_name"
@@ -497,13 +520,6 @@ AC_SUBST(JAILS_PATH)
AC_SUBST(SYSTEMPLATE_PATH)
AM_CONDITIONAL(HAVE_LO_PATH,[test "$have_lo_path" = "true"])
-ENABLE_ANDROIDAPP=
-if test "$enable_androidapp" = "yes"; then
- ENABLE_ANDROIDAPP=true
-fi
-AC_SUBST(ENABLE_ANDROIDAPP)
-AM_CONDITIONAL([ENABLE_ANDROIDAPP], [test "$ENABLE_ANDROIDAPP" = "true"])
-
AS_IF([test -n "$with_poco_includes"],
[CPPFLAGS="$CPPFLAGS -isystem ${with_poco_includes}"])
commit 8b349d589f75a58bbb75a9effe988ead41d8c1f0
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Tue Jun 18 13:26:07 2019 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Jun 20 14:12:46 2019 +0200
android: Move versionCode to liboSettings.gradle.in.
Change-Id: I32ab573831d4b0d5ef08787ae6c8234b3caad0ee
diff --git a/android/app/build.gradle b/android/app/build.gradle
index 7c0513fa0..eef10a4d4 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -6,11 +6,9 @@ apply from: 'liboSettings.gradle'
android {
compileSdkVersion 28
defaultConfig {
- // applicationId defined in liboSettings.gradle
+ // applicationId, versionCode and versionName are defined in liboSettings.gradle
minSdkVersion 21
targetSdkVersion 28
- versionCode 1
- // versionName defined in liboSettings.gradle
}
buildTypes {
debug {
diff --git a/android/app/liboSettings.gradle.in b/android/app/liboSettings.gradle.in
index b3a0abf61..e4f4f3a61 100644
--- a/android/app/liboSettings.gradle.in
+++ b/android/app/liboSettings.gradle.in
@@ -17,6 +17,6 @@ ext {
}
android.defaultConfig {
applicationId 'org.libreoffice.androidapp'
- //versionCode project.hasProperty('cmdVersionCode') ? cmdVersionCode.toInteger() : 1
- versionName '1.0/@LOOLWSD_VERSION@'
+ versionCode 1
+ versionName '@LOOLWSD_VERSION@'
}
commit 9b7b2a7590c2c6a1e10d31c0c3fd9a0ed83af3a6
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Tue Jun 18 11:29:38 2019 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Jun 20 14:12:36 2019 +0200
android: Use the full main.xcd and registry_en-US.xcd.
The current mobile-config.py filters out the sidebar-related entries
there. Let's focus on the functionality first and optimize later...
Change-Id: Ia86d11ae1aea24c5ba7d7f1e238c9194e544508a
diff --git a/android/app/build.gradle b/android/app/build.gradle
index f1470fd58..7c0513fa0 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -129,8 +129,6 @@ task copyAssets(type: Copy) {
from "${liboInstdir}/share"
// Filter data is needed by e.g. the drawingML preset shape import.
includes = ['registry/**', 'filter/**']
- // those two get processed by mobile-config.py
- excludes = ['registry/main.xcd', 'registry/res/registry_en-US.xcd']
}
}
@@ -155,26 +153,6 @@ task createStrippedConfig {
}
}
-
-task createStrippedConfigMain(type: Exec) {
- dependsOn 'createStrippedConfig'
- inputs.files "${liboInstdir}/share/registry/main.xcd", "${liboSrcRoot}/android/mobile-config.py"
- outputs.file "src/main/assets/share/registry/main.xcd"
- executable "${liboSrcRoot}/android/mobile-config.py"
- args = ["${liboInstdir}/share/registry/main.xcd", "src/main/assets/share/registry/main.xcd"]
-}
-
-task createStrippedConfigRegistry(type: Exec) {
- dependsOn 'createStrippedConfig'
- inputs.files "${liboInstdir}/share/registry/res/registry_en-US.xcd", "${liboSrcRoot}/android/mobile-config.py"
- outputs.file "src/main/assets/share/registry/res/registry_en-US.xcd"
- executable "${liboSrcRoot}/android/mobile-config.py"
- args = ["${liboInstdir}/share/registry/res/registry_en-US.xcd", "src/main/assets/share/registry/res/registry_en-US.xcd"]
- doFirst {
- file('src/main/assets/share/registry/res').mkdirs()
- }
-}
-
task createRCfiles {
inputs.file "liboSettings.gradle"
dependsOn copyUnpackAssets, copyAssets
@@ -231,6 +209,4 @@ ReferenceOOoMajorMinor=4.1
// creating the UI stuff is cheap, don't bother only applying it for the flavor..
preBuild.dependsOn 'createRCfiles',
- 'createStrippedConfigMain',
- 'createStrippedConfigRegistry',
'createFullConfig'
commit 546f721699f5292bebadd379aa570175d850546f
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Mon Jun 17 23:16:15 2019 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Jun 20 14:12:26 2019 +0200
android: Kill the extremely verbose FakeSocket logging.
This stuff seems to work fine, no need to spam the logcat this much.
Change-Id: I5e09ffe56f5b545fe755e06c17be1ef1c37ab7a1
diff --git a/net/FakeSocket.cpp b/net/FakeSocket.cpp
index e230428aa..c31f6c0b8 100644
--- a/net/FakeSocket.cpp
+++ b/net/FakeSocket.cpp
@@ -90,6 +90,13 @@ static std::string flush()
return "";
}
+#ifdef __ANDROID__
+// kill the verbose logging on Android
+#define FAKESOCKET_LOG(arg)
+#else
+#define FAKESOCKET_LOG(arg) loggingBuffer << arg
+#endif
+
void fakeSocketSetLoggingCallback(void (*callback)(const std::string&))
{
loggingCallback = callback;
@@ -112,7 +119,7 @@ int fakeSocketSocket()
result.fd[0] = i*2;
- loggingBuffer << "FakeSocket Create #" << i*2 << flush();
+ FAKESOCKET_LOG("FakeSocket Create #" << i*2 << flush());
return i*2;
}
@@ -132,7 +139,7 @@ int fakeSocketPipe2(int pipefd[2])
pair.fd[1] = pair.fd[0] + 1;
pipefd[1] = pair.fd[1];
- loggingBuffer << "FakeSocket Pipe created (#" << pipefd[0] << ",#" << pipefd[1] << ")" << flush();
+ FAKESOCKET_LOG("FakeSocket Pipe created (#" << pipefd[0] << ",#" << pipefd[1] << ")" << flush());
return 0;
}
@@ -235,14 +242,14 @@ static bool checkForPoll(std::vector<FakeSocketPair>& fds, struct pollfd *pollfd
int fakeSocketPoll(struct pollfd *pollfds, int nfds, int timeout)
{
- loggingBuffer << "FakeSocket Poll ";
+ FAKESOCKET_LOG("FakeSocket Poll ");
for (int i = 0; i < nfds; i++)
{
if (i > 0)
- loggingBuffer << ",";
- loggingBuffer << "#" << pollfds[i].fd << ":" << pollBits(pollfds[i].events);
+ FAKESOCKET_LOG(",");
+ FAKESOCKET_LOG("#" << pollfds[i].fd << ":" << pollBits(pollfds[i].events));
}
- loggingBuffer << ", timeout:" << timeout << flush();
+ FAKESOCKET_LOG(", timeout:" << timeout << flush());
std::vector<FakeSocketPair>& fds = getFds();
std::unique_lock<std::mutex> lock(theMutex);
@@ -255,7 +262,7 @@ int fakeSocketPoll(struct pollfd *pollfds, int nfds, int timeout)
while (!checkForPoll(fds, pollfds, nfds))
if (theCV.wait_until(lock, end) == std::cv_status::timeout)
{
- loggingBuffer << "FakeSocket Poll timeout: 0" << flush();
+ FAKESOCKET_LOG("FakeSocket Poll timeout: 0" << flush());
return 0;
}
}
@@ -276,14 +283,14 @@ int fakeSocketPoll(struct pollfd *pollfds, int nfds, int timeout)
result++;
}
- loggingBuffer << "FakeSocket Poll result: ";
+ FAKESOCKET_LOG("FakeSocket Poll result: ");
for (int i = 0; i < nfds; i++)
{
if (i > 0)
- loggingBuffer << ",";
- loggingBuffer << "#" << pollfds[i].fd << ":" << pollBits(pollfds[i].revents);
+ FAKESOCKET_LOG(",");
+ FAKESOCKET_LOG("#" << pollfds[i].fd << ":" << pollBits(pollfds[i].revents));
}
- loggingBuffer << ": " << result << flush();
+ FAKESOCKET_LOG(": " << result << flush());
return result;
}
@@ -294,7 +301,7 @@ int fakeSocketListen(int fd)
std::unique_lock<std::mutex> lock(theMutex);
if (fd < 0 || static_cast<unsigned>(fd/2) >= fds.size() || fds[fd/2].fd[fd&1] == -1)
{
- loggingBuffer << "FakeSocket EBADF: Listening on #" << fd << flush();
+ FAKESOCKET_LOG("FakeSocket EBADF: Listening on #" << fd << flush());
errno = EBADF;
return -1;
}
@@ -303,14 +310,14 @@ int fakeSocketListen(int fd)
if (fd&1 || pair.fd[1] != -1)
{
- loggingBuffer << "FakeSocket EISCONN: Listening on #" << fd << flush();
+ FAKESOCKET_LOG("FakeSocket EISCONN: Listening on #" << fd << flush());
errno = EISCONN;
return -1;
}
if (pair.listening)
{
- loggingBuffer << "FakeSocket EIO: Listening on #" << fd << flush();
+ FAKESOCKET_LOG("FakeSocket EIO: Listening on #" << fd << flush());
errno = EIO;
return -1;
}
@@ -318,7 +325,7 @@ int fakeSocketListen(int fd)
pair.listening = true;
pair.connectingFd = -1;
- loggingBuffer << "FakeSocket Listen #" << fd << flush();
+ FAKESOCKET_LOG("FakeSocket Listen #" << fd << flush());
return 0;
}
@@ -329,13 +336,13 @@ int fakeSocketConnect(int fd1, int fd2)
std::unique_lock<std::mutex> lock(theMutex);
if (fd1 < 0 || fd2 < 0 || static_cast<unsigned>(fd1/2) >= fds.size() || static_cast<unsigned>(fd2/2) >= fds.size())
{
- loggingBuffer << "FakeSocket EBADF: Connect #" << fd1 << " to #" << fd2 << flush();
+ FAKESOCKET_LOG("FakeSocket EBADF: Connect #" << fd1 << " to #" << fd2 << flush());
errno = EBADF;
return -1;
}
if (fd1/2 == fd2/2)
{
- loggingBuffer << "FakeSocket EBADF: Connect #" << fd1 << " to #" << fd2 << flush();
+ FAKESOCKET_LOG("FakeSocket EBADF: Connect #" << fd1 << " to #" << fd2 << flush());
errno = EBADF;
return -1;
}
@@ -345,14 +352,14 @@ int fakeSocketConnect(int fd1, int fd2)
if ((fd1&1) || (fd2&1))
{
- loggingBuffer << "FakeSocket EISCONN: Connect #" << fd1 << " to #" << fd2 << flush();
+ FAKESOCKET_LOG("FakeSocket EISCONN: Connect #" << fd1 << " to #" << fd2 << flush());
errno = EISCONN;
return -1;
}
if (!pair2.listening || pair2.connectingFd != -1)
{
- loggingBuffer << "FakeSocket ECONNREFUSED: Connect #" << fd1 << " to #" << fd2 << flush();
+ FAKESOCKET_LOG("FakeSocket ECONNREFUSED: Connect #" << fd1 << " to #" << fd2 << flush());
errno = ECONNREFUSED;
return -1;
}
@@ -365,7 +372,7 @@ int fakeSocketConnect(int fd1, int fd2)
assert(pair1.fd[1] == pair1.fd[0] + 1);
- loggingBuffer << "FakeSocket Connect #" << fd1 << " to #" << fd2 << ": #" << pair1.fd[1] << flush();
+ FAKESOCKET_LOG("FakeSocket Connect #" << fd1 << " to #" << fd2 << ": #" << pair1.fd[1] << flush());
return 0;
}
@@ -376,14 +383,14 @@ int fakeSocketAccept4(int fd)
std::unique_lock<std::mutex> lock(theMutex);
if (fd < 0 || static_cast<unsigned>(fd/2) >= fds.size())
{
- loggingBuffer << "FakeSocket EBADF: Accept #" << fd << flush();
+ FAKESOCKET_LOG("FakeSocket EBADF: Accept #" << fd << flush());
errno = EBADF;
return -1;
}
if (fd & 1)
{
- loggingBuffer << "FakeSocket EISCONN: Accept #" << fd << flush();
+ FAKESOCKET_LOG("FakeSocket EISCONN: Accept #" << fd << flush());
errno = EISCONN;
return -1;
}
@@ -392,7 +399,7 @@ int fakeSocketAccept4(int fd)
if (!pair.listening)
{
- loggingBuffer << "FakeSocket EIO: Accept #" << fd << flush();
+ FAKESOCKET_LOG("FakeSocket EIO: Accept #" << fd << flush());
errno = EIO;
return -1;
}
@@ -415,7 +422,7 @@ int fakeSocketAccept4(int fd)
theCV.notify_all();
- loggingBuffer << "FakeSocket Accept #" << fd << ": #" << pair2.fd[1] << flush();
+ FAKESOCKET_LOG("FakeSocket Accept #" << fd << ": #" << pair2.fd[1] << flush());
return pair2.fd[1];
}
@@ -426,7 +433,7 @@ int fakeSocketPeer(int fd)
std::unique_lock<std::mutex> lock(theMutex);
if (fd < 0 || static_cast<unsigned>(fd/2) >= fds.size())
{
- loggingBuffer << "FakeSocket EBADF: Peer of #" << fd << flush();
+ FAKESOCKET_LOG("FakeSocket EBADF: Peer of #" << fd << flush());
errno = EBADF;
return -1;
}
@@ -436,7 +443,7 @@ int fakeSocketPeer(int fd)
const int K = (fd&1);
const int N = 1 - K;
- loggingBuffer << "FakeSocket Peer of #" << fd << ": #" << pair.fd[N] << flush();
+ FAKESOCKET_LOG("FakeSocket Peer of #" << fd << ": #" << pair.fd[N] << flush());
return pair.fd[N];
}
@@ -458,7 +465,7 @@ ssize_t fakeSocketAvailableDataLength(int fd)
if (!pair.readable[K])
{
- loggingBuffer << "FakeSocket EAGAIN: Available data on #" << fd << flush();
+ FAKESOCKET_LOG("FakeSocket EAGAIN: Available data on #" << fd << flush());
errno = EAGAIN;
return -1;
}
@@ -467,7 +474,7 @@ ssize_t fakeSocketAvailableDataLength(int fd)
if (pair.buffer[K].size() > 0)
result = pair.buffer[K][0].size();
- loggingBuffer << "FakeSocket Available data on #" << fd << ": " << result << flush();
+ FAKESOCKET_LOG("FakeSocket Available data on #" << fd << ": " << result << flush());
return result;
}
@@ -478,7 +485,7 @@ ssize_t fakeSocketRead(int fd, void *buf, size_t nbytes)
std::unique_lock<std::mutex> lock(theMutex);
if (fd < 0 || static_cast<unsigned>(fd/2) >= fds.size())
{
- loggingBuffer << "FakeSocket EBADF: Read from #" << fd << ", " << nbytes << (nbytes == 1 ? " byte" : " bytes") << flush();
+ FAKESOCKET_LOG("FakeSocket EBADF: Read from #" << fd << ", " << nbytes << (nbytes == 1 ? " byte" : " bytes") << flush());
errno = EBADF;
return -1;
}
@@ -492,20 +499,20 @@ ssize_t fakeSocketRead(int fd, void *buf, size_t nbytes)
if (pair.fd[K] == -1)
{
- loggingBuffer << "FakeSocket EBADF: Read from #" << fd << ", " << nbytes << (nbytes == 1 ? " byte" : " bytes") << flush();
+ FAKESOCKET_LOG("FakeSocket EBADF: Read from #" << fd << ", " << nbytes << (nbytes == 1 ? " byte" : " bytes") << flush());
errno = EBADF;
return -1;
}
if (pair.shutdown[K])
{
- loggingBuffer << "FakeSocket Read from #" << fd << " (shut down) got 0 bytes" << flush();
+ FAKESOCKET_LOG("FakeSocket Read from #" << fd << " (shut down) got 0 bytes" << flush());
return 0;
}
if (!pair.readable[K])
{
- loggingBuffer << "FakeSocket EAGAIN: Read from #" << fd << ", " << nbytes << (nbytes == 1 ? " byte" : " bytes") << flush();
+ FAKESOCKET_LOG("FakeSocket EAGAIN: Read from #" << fd << ", " << nbytes << (nbytes == 1 ? " byte" : " bytes") << flush());
errno = EAGAIN;
return -1;
}
@@ -518,7 +525,7 @@ ssize_t fakeSocketRead(int fd, void *buf, size_t nbytes)
result = pair.buffer[K][0].size();
if (nbytes < static_cast<unsigned>(result))
{
- loggingBuffer << "FakeSocket EAGAIN: Read from #" << fd << ", " << nbytes << (nbytes == 1 ? " byte" : " bytes") << flush();
+ FAKESOCKET_LOG("FakeSocket EAGAIN: Read from #" << fd << ", " << nbytes << (nbytes == 1 ? " byte" : " bytes") << flush());
errno = EAGAIN; // Not the right errno, but what would be?
return -1;
}
@@ -535,7 +542,7 @@ ssize_t fakeSocketRead(int fd, void *buf, size_t nbytes)
theCV.notify_all();
- loggingBuffer << "FakeSocket Read from #" << fd << " got " << result << (result == 1 ? " byte" : " bytes") << flush();
+ FAKESOCKET_LOG("FakeSocket Read from #" << fd << " got " << result << (result == 1 ? " byte" : " bytes") << flush());
return result;
}
@@ -546,7 +553,7 @@ ssize_t fakeSocketWrite(int fd, const void *buf, size_t nbytes)
std::unique_lock<std::mutex> lock(theMutex);
if (fd < 0 || static_cast<unsigned>(fd/2) >= fds.size())
{
- loggingBuffer << "FakeSocket EBADF: Write to #" << fd << ", " << nbytes << (nbytes == 1 ? " byte" : " bytes") << flush();
+ FAKESOCKET_LOG("FakeSocket EBADF: Write to #" << fd << ", " << nbytes << (nbytes == 1 ? " byte" : " bytes") << flush());
errno = EBADF;
return -1;
}
@@ -560,7 +567,7 @@ ssize_t fakeSocketWrite(int fd, const void *buf, size_t nbytes)
if (pair.fd[K] == -1)
{
- loggingBuffer << "FakeSocket EBADF: Write to #" << fd << ", " << nbytes << (nbytes == 1 ? " byte" : " bytes") << flush();
+ FAKESOCKET_LOG("FakeSocket EBADF: Write to #" << fd << ", " << nbytes << (nbytes == 1 ? " byte" : " bytes") << flush());
errno = EBADF;
return -1;
}
@@ -568,7 +575,7 @@ ssize_t fakeSocketWrite(int fd, const void *buf, size_t nbytes)
if (pair.shutdown[K])
{
// Should we raise(SIGPIPE)? Probably not, Online code does not expect SIGPIPE at all...
- loggingBuffer << "FakeSocket EPIPE: Write to #" << fd << " (shut down), " << nbytes << (nbytes == 1 ? " byte" : " bytes") << flush();
+ FAKESOCKET_LOG("FakeSocket EPIPE: Write to #" << fd << " (shut down), " << nbytes << (nbytes == 1 ? " byte" : " bytes") << flush());
errno = EPIPE;
return -1;
}
@@ -579,7 +586,7 @@ ssize_t fakeSocketWrite(int fd, const void *buf, size_t nbytes)
theCV.notify_all();
- loggingBuffer << "FakeSocket Write to #" << fd << ": " << nbytes << (nbytes == 1 ? " byte" : " bytes") << flush();
+ FAKESOCKET_LOG("FakeSocket Write to #" << fd << ": " << nbytes << (nbytes == 1 ? " byte" : " bytes") << flush());
return nbytes;
}
@@ -589,7 +596,7 @@ int fakeSocketShutdown(int fd)
std::unique_lock<std::mutex> lock(theMutex);
if (fd < 0 || static_cast<unsigned>(fd/2) >= fds.size())
{
- loggingBuffer << "FakeSocket EBADF: Shutdown #" << fd << flush();
+ FAKESOCKET_LOG("FakeSocket EBADF: Shutdown #" << fd << flush());
errno = EBADF;
return -1;
}
@@ -601,14 +608,14 @@ int fakeSocketShutdown(int fd)
if (pair.fd[K] == -1)
{
- loggingBuffer << "FakeSocket EBADF: Shutdown #" << fd << flush();
+ FAKESOCKET_LOG("FakeSocket EBADF: Shutdown #" << fd << flush());
errno = EBADF;
return -1;
}
if (pair.fd[N] == -1)
{
- loggingBuffer << "FakeSocket ENOTCONN: Shutdown #" << fd << flush();
+ FAKESOCKET_LOG("FakeSocket ENOTCONN: Shutdown #" << fd << flush());
errno = ENOTCONN;
return -1;
}
@@ -616,7 +623,7 @@ int fakeSocketShutdown(int fd)
pair.shutdown[K] = true;
pair.readable[K] = true;
- loggingBuffer << "FakeSocket Shutdown #" << fd << flush();
+ FAKESOCKET_LOG("FakeSocket Shutdown #" << fd << flush());
return 0;
}
@@ -627,7 +634,7 @@ int fakeSocketClose(int fd)
std::unique_lock<std::mutex> lock(theMutex);
if (fd < 0 || static_cast<unsigned>(fd/2) >= fds.size())
{
- loggingBuffer << "FakeSocket EBADF: Close #" << fd << flush();
+ FAKESOCKET_LOG("FakeSocket EBADF: Close #" << fd << flush());
errno = EBADF;
return -1;
}
@@ -639,7 +646,7 @@ int fakeSocketClose(int fd)
if (pair.fd[K] == -1)
{
- loggingBuffer << "FakeSocket EBADF: Close #" << fd << flush();
+ FAKESOCKET_LOG("FakeSocket EBADF: Close #" << fd << flush());
errno = EBADF;
return -1;
}
@@ -652,7 +659,7 @@ int fakeSocketClose(int fd)
theCV.notify_all();
- loggingBuffer << "FakeSocket Close #" << fd << flush();
+ FAKESOCKET_LOG("FakeSocket Close #" << fd << flush());
return 0;
}
@@ -662,30 +669,30 @@ void fakeSocketDumpState()
std::vector<FakeSocketPair>& fds = getFds();
std::unique_lock<std::mutex> lock(theMutex);
- loggingBuffer << "FakeSocket open sockets:" << flush();
+ FAKESOCKET_LOG("FakeSocket open sockets:" << flush());
for (int i = 0; i < static_cast<int>(fds.size()); i++)
{
if (fds[i].fd[0] != -1)
{
assert(fds[i].fd[0] == i*2);
- loggingBuffer << " #" << fds[i].fd[0];
+ FAKESOCKET_LOG(" #" << fds[i].fd[0]);
if (fds[i].fd[1] != -1)
{
assert(fds[i].fd[1] == i*2+1);
assert(!fds[i].listening);
- loggingBuffer << " <=> #" << fds[i].fd[1];
+ FAKESOCKET_LOG(" <=> #" << fds[i].fd[1]);
}
else if (fds[i].listening)
{
- loggingBuffer << " listening";
+ FAKESOCKET_LOG(" listening");
}
- loggingBuffer << flush();
+ FAKESOCKET_LOG(flush());
}
else if (fds[i].fd[1] != -1)
{
assert(fds[i].fd[1] == i*2+1);
assert(!fds[i].listening);
- loggingBuffer << " #" << fds[i].fd[1] << flush();
+ FAKESOCKET_LOG(" #" << fds[i].fd[1] << flush());
}
}
}
commit 001c8ee24c97da1f0cf01d3ff99c7c15df6003af
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Mon Jun 17 22:49:28 2019 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Jun 20 14:12:16 2019 +0200
android: These have to be passed by copy too.
Without this, we get crashes later in GetMethodID when performing
send2JS().
Change-Id: Ia0d8a07d0a4f24dec17215a94c5bb3d0d77d19c8
diff --git a/android/app/src/main/cpp/androidapp.cpp b/android/app/src/main/cpp/androidapp.cpp
index 94f0c77b8..49caa35cd 100644
--- a/android/app/src/main/cpp/androidapp.cpp
+++ b/android/app/src/main/cpp/androidapp.cpp
@@ -157,7 +157,7 @@ Java_org_libreoffice_androidapp_MainActivity_postMobileMessageNative(JNIEnv *env
jclass mainActivityClz = (jclass) env->NewGlobalRef(clz);
jobject mainActivityObj = env->NewGlobalRef(instance);
- std::thread([&mainActivityClz, &mainActivityObj, currentFakeClientFd]
+ std::thread([mainActivityClz, mainActivityObj, currentFakeClientFd]
{
Util::setThreadName("app2js");
while (true)
commit 2d2208e16dd8f6eedb40dcf8bfeb9b072437a578
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Mon Jun 17 22:21:36 2019 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Jun 20 14:12:07 2019 +0200
android: Copy images.zip into the APK too.
Will be needed for eg. the sidebar.
Change-Id: I4e39db8e593d5a4f52b23dcf70e4e791144f7470
diff --git a/android/app/build.gradle b/android/app/build.gradle
index 2d7c7458c..f1470fd58 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -135,8 +135,11 @@ task copyAssets(type: Copy) {
}
task createFullConfig(type: Copy) {
- into 'src/main/assets/share/config/soffice.cfg'
- from "${liboInstdir}/share/config/soffice.cfg"
+ description "copies various configuration bits into the apk"
+ into('src/main/assets/share/config')
+ from("${liboInstdir}/share/config") {
+ includes = ['soffice.cfg/**', 'images_colibre.zip']
+ }
}
task createStrippedConfig {
commit 29f981028e14128f9fa393ae0f9146c582e22e7a
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Mon Jun 17 21:20:16 2019 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Jun 20 14:11:58 2019 +0200
android: No initial spaces in the rc files.
Just a reformat, no functional change.
Change-Id: I516a4548ea3d188759a5eb37f273fafbc490df29
diff --git a/android/app/build.gradle b/android/app/build.gradle
index d37e8e315..2d7c7458c 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -185,44 +185,44 @@ task createRCfiles {
doLast {
sofficerc.text = '''\
- [Bootstrap]
- Logo=1
- NativeProgress=1
- URE_BOOTSTRAP=file:///assets/program/fundamentalrc
- HOME=$APP_DATA_DIR/cache
- OSL_SOCKET_PATH=$APP_DATA_DIR/cache
- '''.stripIndent()
+[Bootstrap]
+Logo=1
+NativeProgress=1
+URE_BOOTSTRAP=file:///assets/program/fundamentalrc
+HOME=$APP_DATA_DIR/cache
+OSL_SOCKET_PATH=$APP_DATA_DIR/cache
+'''.stripIndent()
fundamentalrc.text = '''\
- [Bootstrap]
- LO_LIB_DIR=file://$APP_DATA_DIR/lib/
- BRAND_BASE_DIR=file:///assets
- BRAND_SHARE_SUBDIR=share
- CONFIGURATION_LAYERS=xcsxcu:${BRAND_BASE_DIR}/share/registry res:${BRAND_BASE_DIR}/share/registry
- URE_BIN_DIR=file:///assets/ure/bin/dir/nothing-here/we-can/exec-anyway
- '''.stripIndent()
+[Bootstrap]
+LO_LIB_DIR=file://$APP_DATA_DIR/lib/
+BRAND_BASE_DIR=file:///assets
+BRAND_SHARE_SUBDIR=share
+CONFIGURATION_LAYERS=xcsxcu:${BRAND_BASE_DIR}/share/registry res:${BRAND_BASE_DIR}/share/registry
+URE_BIN_DIR=file:///assets/ure/bin/dir/nothing-here/we-can/exec-anyway
+'''.stripIndent()
bootstraprc.text = '''\
- [Bootstrap]
- InstallMode=<installmode>
- ProductKey=LibreOffice ''' + "${liboVersionMajor}.${liboVersionMinor}" + '''
- UserInstallation=file://$APP_DATA_DIR
- '''.stripIndent()
+[Bootstrap]
+InstallMode=<installmode>
+ProductKey=LibreOffice ''' + "${liboVersionMajor}.${liboVersionMinor}" + '''
+UserInstallation=file://$APP_DATA_DIR
+'''.stripIndent()
unorc.text = '''\
- [Bootstrap]
- URE_INTERNAL_LIB_DIR=file://$APP_DATA_DIR/lib/
- UNO_TYPES=file://$APP_DATA_DIR/program/udkapi.rdb file://$APP_DATA_DIR/program/offapi.rdb file://$APP_DATA_DIR/program/oovbaapi.rdb
- UNO_SERVICES=file:///assets/program/services.rdb file:///assets/program/services/services.rdb
- '''.stripIndent()
+[Bootstrap]
+URE_INTERNAL_LIB_DIR=file://$APP_DATA_DIR/lib/
+UNO_TYPES=file://$APP_DATA_DIR/program/udkapi.rdb file://$APP_DATA_DIR/program/offapi.rdb file://$APP_DATA_DIR/program/oovbaapi.rdb
+UNO_SERVICES=file:///assets/program/services.rdb file:///assets/program/services/services.rdb
+'''.stripIndent()
versionrc.text = '''\
- [Version]
- AllLanguages=en-US
- BuildVersion=
- buildid=''' + "${liboGitFullCommit}" + '''
- ReferenceOOoMajorMinor=4.1
- '''.stripIndent()
+[Version]
+AllLanguages=en-US
+BuildVersion=
+buildid=''' + "${liboGitFullCommit}" + '''
+ReferenceOOoMajorMinor=4.1
+'''.stripIndent()
}
}
commit 7a4290dc5cdd435ac08c10b76864d0b7944260ae
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Mon Jun 17 21:19:08 2019 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Jun 20 14:11:46 2019 +0200
android: The BRAND_SHARE_SUBDIR is needed for the dialogs to work.
Change-Id: Ie65701e6ebe83f3f054c299c50327a2ae2ffe87f
diff --git a/android/app/build.gradle b/android/app/build.gradle
index 482ed2c7d..d37e8e315 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -197,6 +197,7 @@ task createRCfiles {
[Bootstrap]
LO_LIB_DIR=file://$APP_DATA_DIR/lib/
BRAND_BASE_DIR=file:///assets
+ BRAND_SHARE_SUBDIR=share
CONFIGURATION_LAYERS=xcsxcu:${BRAND_BASE_DIR}/share/registry res:${BRAND_BASE_DIR}/share/registry
URE_BIN_DIR=file:///assets/ure/bin/dir/nothing-here/we-can/exec-anyway
'''.stripIndent()
commit bbab589ea02bd984e98794e170cfd88d69220e61
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Fri Jun 14 18:29:42 2019 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Jun 20 14:11:22 2019 +0200
android: Unload the document already in onPause().
So that it doesn't end up running on the background.
Change-Id: I24386a2eecb740bfce7fcfb83c62aafadb36f7f9
diff --git a/android/app/src/main/java/org/libreoffice/androidapp/MainActivity.java b/android/app/src/main/java/org/libreoffice/androidapp/MainActivity.java
index de0969d07..78cd43010 100644
--- a/android/app/src/main/java/org/libreoffice/androidapp/MainActivity.java
+++ b/android/app/src/main/java/org/libreoffice/androidapp/MainActivity.java
@@ -320,9 +320,9 @@ public class MainActivity extends AppCompatActivity {
}
@Override
- protected void onStop() {
- super.onStop();
- Log.d(TAG, "Stop LOOLWSD instance");
+ protected void onPause() {
+ super.onPause();
+ Log.d(TAG, "onPause() - unload the document");
postMobileMessageNative("BYE");
}
commit 92f83a84b027eed54b30336823a9a31b56ced4c3
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Fri Jun 14 18:27:06 2019 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Jun 20 14:11:13 2019 +0200
android: Don't re-initialize LibreOfficeKit over and over again.
LOK is designed to be initialized just once, so avoid the
re-initialization here.
Change-Id: I7ad9235c36d5a4dee85437a95f358d13ca25a2a9
diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index d5a9f37bc..b0f3e32c2 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -2702,12 +2702,12 @@ void lokit_main(
Poco::URI userInstallationURI("file", LO_PATH);
LibreOfficeKit *kit = lok_init_2(LO_PATH "/program", userInstallationURI.toString().c_str());
#else
- LibreOfficeKit *kit = lok_init_2(nullptr, nullptr);
+ static LibreOfficeKit *kit = lok_init_2(nullptr, nullptr);
#endif
assert(kit);
- std::shared_ptr<lok::Office> loKit = std::make_shared<lok::Office>(kit);
+ static std::shared_ptr<lok::Office> loKit = std::make_shared<lok::Office>(kit);
assert(loKit);
LOOLWSD::LOKitVersion = loKit->getVersionInfo();
commit 9794b85ff3cd8b5efdedac625426a1c9562b61c6
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Fri Jun 14 17:57:55 2019 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Jun 20 14:11:03 2019 +0200
android: Re-create fakeClientFd for every loolwsd restart.
Also remember it in the thread itself, otherwise we are likely to close
the newly created one, instead of the old one (when loading the document
the 2nd time).
[This is the most important piece of the '2nd start crashes' puzzle.]
Change-Id: I3bb89882b6f3ac1493c47a27b4c4589b6996afab
diff --git a/android/app/src/main/cpp/androidapp.cpp b/android/app/src/main/cpp/androidapp.cpp
index bc4666392..94f0c77b8 100644
--- a/android/app/src/main/cpp/androidapp.cpp
+++ b/android/app/src/main/cpp/androidapp.cpp
@@ -134,6 +134,10 @@ Java_org_libreoffice_androidapp_MainActivity_postMobileMessageNative(JNIEnv *env
{
LOG_DBG("From JS: lool: " << string_value);
+ // we need a copy, because we can get a new one while we are still
+ // taking down the old one
+ const int currentFakeClientFd = fakeClientFd;
+
if (strcmp(string_value, "HULLO") == 0)
{
// Now we know that the JS has started completely
@@ -141,7 +145,8 @@ Java_org_libreoffice_androidapp_MainActivity_postMobileMessageNative(JNIEnv *env
// Contact the permanently (during app lifetime) listening LOOLWSD server
// "public" socket
assert(loolwsd_server_socket_fd != -1);
- int rc = fakeSocketConnect(fakeClientFd, loolwsd_server_socket_fd);
+
+ int rc = fakeSocketConnect(currentFakeClientFd, loolwsd_server_socket_fd);
assert(rc != -1);
// Create a socket pair to notify the below thread when the document has been closed
@@ -152,13 +157,13 @@ Java_org_libreoffice_androidapp_MainActivity_postMobileMessageNative(JNIEnv *env
jclass mainActivityClz = (jclass) env->NewGlobalRef(clz);
jobject mainActivityObj = env->NewGlobalRef(instance);
- std::thread([&mainActivityClz, &mainActivityObj]
+ std::thread([&mainActivityClz, &mainActivityObj, currentFakeClientFd]
{
Util::setThreadName("app2js");
while (true)
{
struct pollfd pollfd[2];
- pollfd[0].fd = fakeClientFd;
+ pollfd[0].fd = currentFakeClientFd;
pollfd[0].events = POLLIN;
pollfd[1].fd = closeNotificationPipeForForwardingThread[1];
pollfd[1].events = POLLIN;
@@ -166,6 +171,7 @@ Java_org_libreoffice_androidapp_MainActivity_postMobileMessageNative(JNIEnv *env
{
if (pollfd[1].revents == POLLIN)
{
+ LOG_DBG("app2js: closing the sockets");
// The code below handling the "BYE" fake Websocket
// message has closed the other end of the
// closeNotificationPipeForForwardingThread. Let's close
@@ -180,17 +186,17 @@ Java_org_libreoffice_androidapp_MainActivity_postMobileMessageNative(JNIEnv *env
// Close our end of the fake socket connection to the
// ClientSession thread, so that it terminates
- fakeSocketClose(fakeClientFd);
+ fakeSocketClose(currentFakeClientFd);
return;
}
if (pollfd[0].revents == POLLIN)
{
- int n = fakeSocketAvailableDataLength(fakeClientFd);
+ int n = fakeSocketAvailableDataLength(currentFakeClientFd);
if (n == 0)
return;
std::vector<char> buf(n);
- n = fakeSocketRead(fakeClientFd, buf.data(), n);
+ n = fakeSocketRead(currentFakeClientFd, buf.data(), n);
send2JS(mainActivityClz, mainActivityObj, buf);
}
}
@@ -205,13 +211,13 @@ Java_org_libreoffice_androidapp_MainActivity_postMobileMessageNative(JNIEnv *env
LOG_DBG("Actually sending to Online:" << fileURL);
// Must do this in a thread, too, so that we can return to the GTK+ main loop
- std::thread([]
+ std::thread([=]
{
struct pollfd pollfd;
- pollfd.fd = fakeClientFd;
+ pollfd.fd = currentFakeClientFd;
pollfd.events = POLLOUT;
fakeSocketPoll(&pollfd, 1, -1);
- fakeSocketWrite(fakeClientFd, fileURL.c_str(), fileURL.size());
+ fakeSocketWrite(currentFakeClientFd, fileURL.c_str(), fileURL.size());
}).detach();
}
else if (strcmp(string_value, "BYE") == 0)
@@ -220,8 +226,6 @@ Java_org_libreoffice_androidapp_MainActivity_postMobileMessageNative(JNIEnv *env
// Close one end of the socket pair, that will wake up the forwarding thread above
fakeSocketClose(closeNotificationPipeForForwardingThread[0]);
-
- // ???
}
else
{
@@ -230,10 +234,10 @@ Java_org_libreoffice_androidapp_MainActivity_postMobileMessageNative(JNIEnv *env
std::thread([=]
{
struct pollfd pollfd;
- pollfd.fd = fakeClientFd;
+ pollfd.fd = currentFakeClientFd;
pollfd.events = POLLOUT;
fakeSocketPoll(&pollfd, 1, -1);
- fakeSocketWrite(fakeClientFd, string_copy, strlen(string_copy));
+ fakeSocketWrite(currentFakeClientFd, string_copy, strlen(string_copy));
free(string_copy);
}).detach();
}
@@ -274,6 +278,8 @@ Java_org_libreoffice_androidapp_MainActivity_createLOOLWSD(JNIEnv *env, jobject,
{
LOG_DBG("Creating LOOLWSD");
{
+ fakeClientFd = fakeSocketSocket();
+ LOG_DBG("createLOOLWSD created fakeClientFd: " << fakeClientFd);
std::unique_ptr<LOOLWSD> loolwsd(new LOOLWSD());
loolwsd->run(1, argv);
}
@@ -281,9 +287,6 @@ Java_org_libreoffice_androidapp_MainActivity_createLOOLWSD(JNIEnv *env, jobject,
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
}).detach();
-
- fakeClientFd = fakeSocketSocket();
- LOG_DBG("createLOOLWSD created fakeClientFd: " << fakeClientFd);
}
extern "C"
commit 9ea4f537d4b0e9aba6c635473c5211d8121a245b
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Fri Jun 14 15:14:34 2019 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Jun 20 14:10:55 2019 +0200
android: No need to have the loolwsd instance static.
When we don't treat it as static anyway...
Change-Id: I165c06390882cfb9870c338a361ec3c5216985c7
diff --git a/android/app/src/main/cpp/androidapp.cpp b/android/app/src/main/cpp/androidapp.cpp
index 126092ac1..bc4666392 100644
--- a/android/app/src/main/cpp/androidapp.cpp
+++ b/android/app/src/main/cpp/androidapp.cpp
@@ -30,7 +30,6 @@ const int SHOW_JS_MAXLEN = 70;
int loolwsd_server_socket_fd = -1;
static std::string fileURL;
-static LOOLWSD *loolwsd = nullptr;
static int fakeClientFd;
static int closeNotificationPipeForForwardingThread[2];
static JavaVM* javaVM = nullptr;
@@ -267,7 +266,6 @@ Java_org_libreoffice_androidapp_MainActivity_createLOOLWSD(JNIEnv *env, jobject,
std::thread([]
{
- assert(loolwsd == nullptr);
char *argv[2];
argv[0] = strdup("mobile");
argv[1] = nullptr;
@@ -275,9 +273,10 @@ Java_org_libreoffice_androidapp_MainActivity_createLOOLWSD(JNIEnv *env, jobject,
while (true)
{
LOG_DBG("Creating LOOLWSD");
- loolwsd = new LOOLWSD();
- loolwsd->run(1, argv);
- delete loolwsd;
+ {
+ std::unique_ptr<LOOLWSD> loolwsd(new LOOLWSD());
+ loolwsd->run(1, argv);
+ }
LOG_DBG("One run of LOOLWSD completed");
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
commit a742f95473ee72d9d27b0ea753442db330d5b1e7
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Fri Jun 14 11:46:47 2019 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Jun 20 14:10:45 2019 +0200
android: Initialize the LibreOfficeKit only once.
Change-Id: Ieeefaa94bc2eeb583fe0f815306c8fc76a02c327
diff --git a/android/app/src/main/cpp/androidapp.cpp b/android/app/src/main/cpp/androidapp.cpp
index 7ef1af2ab..126092ac1 100644
--- a/android/app/src/main/cpp/androidapp.cpp
+++ b/android/app/src/main/cpp/androidapp.cpp
@@ -34,6 +34,7 @@ static LOOLWSD *loolwsd = nullptr;
static int fakeClientFd;
static int closeNotificationPipeForForwardingThread[2];
static JavaVM* javaVM = nullptr;
+static bool lokInitialized = false;
extern "C" JNIEXPORT jint JNICALL
JNI_OnLoad(JavaVM* vm, void*) {
@@ -248,10 +249,15 @@ extern "C" jboolean libreofficekit_initialize(JNIEnv* env, jstring dataDir, jstr
extern "C" JNIEXPORT void JNICALL
Java_org_libreoffice_androidapp_MainActivity_createLOOLWSD(JNIEnv *env, jobject, jstring dataDir, jstring cacheDir, jstring apkFile, jobject assetManager, jstring loadFileURL)
{
- libreofficekit_initialize(env, dataDir, cacheDir, apkFile, assetManager);
-
fileURL = std::string(env->GetStringUTFChars(loadFileURL, nullptr));
+ // already initialized?
+ if (lokInitialized)
+ return;
+
+ lokInitialized = true;
+ libreofficekit_initialize(env, dataDir, cacheDir, apkFile, assetManager);
+
Util::setThreadName("main");
fakeSocketSetLoggingCallback([](const std::string& line)
commit 834d6453c6991d9b6826f57517506669f647bc71
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Wed Jun 12 12:22:54 2019 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Jun 20 14:10:32 2019 +0200
android: We avoid trace log level on Android, adapt accordingly.
Change-Id: I1d30e550fc22c70d7687a40ab0d1d853f099a232
diff --git a/android/app/src/main/cpp/androidapp.cpp b/android/app/src/main/cpp/androidapp.cpp
index 251798bb1..7ef1af2ab 100644
--- a/android/app/src/main/cpp/androidapp.cpp
+++ b/android/app/src/main/cpp/androidapp.cpp
@@ -52,7 +52,7 @@ JNI_OnLoad(JavaVM* vm, void*) {
static void send2JS(jclass mainActivityClz, jobject mainActivityObj, const std::vector<char>& buffer)
{
- LOG_TRC_NOFILE("Send to JS: " << LOOLProtocol::getAbbreviatedMessage(buffer.data(), buffer.size()));
+ LOG_DBG("Send to JS: " << LOOLProtocol::getAbbreviatedMessage(buffer.data(), buffer.size()));
std::string js;
@@ -106,15 +106,15 @@ static void send2JS(jclass mainActivityClz, jobject mainActivityObj, const std::
if (js.length() > SHOW_JS_MAXLEN)
subjs += "...";
- LOG_TRC_NOFILE( "Sending to JavaScript: " << subjs);
+ LOG_DBG("Sending to JavaScript: " << subjs);
JNIEnv *env;
jint res = javaVM->GetEnv((void**)&env, JNI_VERSION_1_6);
if (res != JNI_OK) {
- LOG_TRC_NOFILE("GetEnv need to attach thread");
+ LOG_DBG("GetEnv need to attach thread");
res = javaVM->AttachCurrentThread(&env, nullptr);
if (JNI_OK != res) {
- LOG_TRC_NOFILE("Failed to AttachCurrentThread");
+ LOG_DBG("Failed to AttachCurrentThread");
return;
}
}
@@ -132,7 +132,7 @@ Java_org_libreoffice_androidapp_MainActivity_postMobileMessageNative(JNIEnv *env
if (string_value)
{
- LOG_TRC_NOFILE("From JS: lool: " << string_value);
+ LOG_DBG("From JS: lool: " << string_value);
if (strcmp(string_value, "HULLO") == 0)
{
@@ -202,7 +202,7 @@ Java_org_libreoffice_androidapp_MainActivity_postMobileMessageNative(JNIEnv *env
// First we simply send it the URL. This corresponds to the GET request with Upgrade to
// WebSocket.
- LOG_TRC_NOFILE("Actually sending to Online:" << fileURL);
+ LOG_DBG("Actually sending to Online:" << fileURL);
// Must do this in a thread, too, so that we can return to the GTK+ main loop
std::thread([]
@@ -216,7 +216,7 @@ Java_org_libreoffice_androidapp_MainActivity_postMobileMessageNative(JNIEnv *env
}
else if (strcmp(string_value, "BYE") == 0)
{
- LOG_TRC_NOFILE("Document window terminating on JavaScript side. Closing our end of the socket.");
+ LOG_DBG("Document window terminating on JavaScript side. Closing our end of the socket.");
// Close one end of the socket pair, that will wake up the forwarding thread above
fakeSocketClose(closeNotificationPipeForForwardingThread[0]);
@@ -239,7 +239,7 @@ Java_org_libreoffice_androidapp_MainActivity_postMobileMessageNative(JNIEnv *env
}
}
else
- LOG_TRC_NOFILE("From JS: lool: some object");
+ LOG_DBG("From JS: lool: some object");
}
extern "C" jboolean libreofficekit_initialize(JNIEnv* env, jstring dataDir, jstring cacheDir, jstring apkFile, jobject assetManager);
@@ -256,7 +256,7 @@ Java_org_libreoffice_androidapp_MainActivity_createLOOLWSD(JNIEnv *env, jobject,
fakeSocketSetLoggingCallback([](const std::string& line)
{
- LOG_TRC_NOFILE(line);
+ LOG_DBG(line);
});
std::thread([]
@@ -268,15 +268,17 @@ Java_org_libreoffice_androidapp_MainActivity_createLOOLWSD(JNIEnv *env, jobject,
Util::setThreadName("app");
while (true)
{
+ LOG_DBG("Creating LOOLWSD");
loolwsd = new LOOLWSD();
loolwsd->run(1, argv);
delete loolwsd;
- LOG_TRC("One run of LOOLWSD completed");
+ LOG_DBG("One run of LOOLWSD completed");
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
}).detach();
fakeClientFd = fakeSocketSocket();
+ LOG_DBG("createLOOLWSD created fakeClientFd: " << fakeClientFd);
}
extern "C"
commit 2103cd39de6a0bd721b86d5c4f2594fed4503405
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Mon Jun 10 16:20:10 2019 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Jun 20 14:09:59 2019 +0200
android: Use the MobileTerminationFlag the same way as on iOS.
We have the same problems - lokit_main thread does not go away - so
let's get the code in sync.
For the actual MobileTerminationFlag background, see the "Introduce new
flag to speed up shutdown of the Online plumbing in the iOS app" commit.
Change-Id: I091a61472f2528971a7473e222bf79f6f33874a9
diff --git a/android/app/src/main/cpp/androidapp.cpp b/android/app/src/main/cpp/androidapp.cpp
index 4b2010797..251798bb1 100644
--- a/android/app/src/main/cpp/androidapp.cpp
+++ b/android/app/src/main/cpp/androidapp.cpp
@@ -174,6 +174,10 @@ Java_org_libreoffice_androidapp_MainActivity_postMobileMessageNative(JNIEnv *env
// is saved by closing it.
fakeSocketClose(closeNotificationPipeForForwardingThread[1]);
+ // Flag to make the inter-thread plumbing in the Online
+ // bits go away quicker.
+ MobileTerminationFlag = true;
+
// Close our end of the fake socket connection to the
// ClientSession thread, so that it terminates
fakeSocketClose(fakeClientFd);
commit b2b3ccdee5eba6a08d4d8b814b78dae3a0bd78bf
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Mon Jun 10 10:41:46 2019 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Jun 20 14:09:37 2019 +0200
gtkapp: Avoid warning.
The gtkapp is to test functionality, not performance.
Change-Id: I357777f7bd5609af1e8b6658607c73b23b78e857
diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index b18e62c74..d5a9f37bc 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -766,7 +766,7 @@ public:
_shutdown(false)
{
int maxConcurrency = 2;
-#if MOBILEAPP
+#if MOBILEAPP && !defined(GTKAPP)
# warning "Good defaults ? - 2 for iOS, 4 for Android ?"
#else
const char *max = getenv("MAX_CONCURRENCY");
commit 9f04503f34a0515e57b84dca991641122b70963d
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Fri Jun 7 15:37:41 2019 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Jun 20 14:09:26 2019 +0200
android: Reduce the logging to 'debug'.
With 'trace', the logcat often ends up with 'Unexpected EOF' and nothing
else is logged until after you reconnect the device again.
Change-Id: Idd14a5100d49a4920be0a19b4d9b32e7fb158a12
diff --git a/android/app/src/main/cpp/androidapp.cpp b/android/app/src/main/cpp/androidapp.cpp
index eb95e36b0..4b2010797 100644
--- a/android/app/src/main/cpp/androidapp.cpp
+++ b/android/app/src/main/cpp/androidapp.cpp
@@ -45,7 +45,7 @@ JNI_OnLoad(JavaVM* vm, void*) {
return JNI_ERR; // JNI version not supported.
}
- Log::initialize("Mobile", "trace", false, false, {});
+ Log::initialize("Mobile", "debug", false, false, {});
return JNI_VERSION_1_6;
}
More information about the Libreoffice-commits
mailing list