mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-01 10:46:23 -04:00
fixed conflicts with upstream/master
This commit is contained in:
commit
4a76fddaa9
186 changed files with 6793 additions and 5999 deletions
|
@ -2,9 +2,9 @@
|
|||
<manifest
|
||||
package="org.retroshare.service"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:versionName="0.6.4" android:versionCode="1"
|
||||
android:versionName="0.6.6" android:versionCode="1"
|
||||
android:installLocation="auto">
|
||||
<application android:name="org.qtproject.qt5.android.bindings.QtApplication" android:hardwareAccelerated="true" android:label="RetroShare" android:icon="@drawable/retroshare_service_128x128">
|
||||
<application android:label="RetroShare" android:icon="@drawable/retroshare_service_128x128">
|
||||
<activity
|
||||
android:name=".RetroShareServiceControlActivity"
|
||||
android:label="RetroShare" >
|
||||
|
@ -14,59 +14,81 @@
|
|||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<receiver android:name=".BootCompletedReceiver" android:enabled="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED"/>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<receiver android:name=".AppUpdatedReceiver" android:enabled="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<!-- For adding service(s) please check:
|
||||
++ https://wiki.qt.io/AndroidServices -->
|
||||
<service android:name=".RetroShareServiceAndroid" android:process=":rs" android:label="RetroShare Service" android:exported="true">
|
||||
<!-- android:exported="true" Added to be able to run the service
|
||||
++ from adb shell
|
||||
++ android:process=":rs" is needed to force the service to run on
|
||||
++ a separate process than the Activity -->
|
||||
|
||||
<!-- Background running -->
|
||||
<meta-data android:name="android.app.background_running" android:value="true"/>
|
||||
<!-- Background running -->
|
||||
|
||||
<![CDATA[
|
||||
<!-- Qt Application to launch -->
|
||||
<meta-data android:name="android.app.lib_name" android:value="retroshare-service"/>
|
||||
<!-- <meta-data android:name="android.app.lib_name" android:value="retroshare-service"/> -->
|
||||
|
||||
<!-- Ministro -->
|
||||
<meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
|
||||
<meta-data android:name="android.app.repository" android:value="default"/>
|
||||
<meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
|
||||
<meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
|
||||
|
||||
<!-- Deploy Qt libs as part of package -->
|
||||
<meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
|
||||
<meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
|
||||
<meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
|
||||
|
||||
<!-- Run with local libs -->
|
||||
<meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
|
||||
<meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
|
||||
<meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/>
|
||||
<meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
|
||||
<meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
|
||||
|
||||
<!-- Messages maps -->
|
||||
<meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
|
||||
<meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
|
||||
<meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
|
||||
<!-- Messages maps -->
|
||||
|
||||
<!-- Background running -->
|
||||
<meta-data android:name="android.app.background_running" android:value="true"/>
|
||||
<!-- Background running -->
|
||||
]]>
|
||||
</service>
|
||||
|
||||
<![CDATA[
|
||||
<!-- G10h4ck: Example on how to start the service at boot -->
|
||||
<receiver android:name=".BootCompletedReceiver" android:enabled="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED"/>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<!-- G10h4ck: Example on how to restart the service on update -->
|
||||
<receiver android:name=".AppUpdatedReceiver" android:enabled="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
]]>
|
||||
</application>
|
||||
|
||||
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="18"/>
|
||||
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
|
||||
|
||||
<!-- Added by G10h4ck: Needed permission for network usage -->
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
||||
<!-- Added by G10h4ck: Needed to listen for multicast packets, needed for
|
||||
! broadcast discovery -->
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
|
||||
|
||||
<!-- Added by Angesoc: used to access files shared by other apps -->
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
|
||||
<![CDATA[
|
||||
<!-- The following comment will be replaced upon deployment with default
|
||||
++ permissions based on the dependencies of the application.
|
||||
++ Remove the comment if you do not require these default permissions. -->
|
||||
|
@ -76,17 +98,11 @@
|
|||
++ features based on the dependencies of the application.
|
||||
++ Remove the comment if you do not require these default features. -->
|
||||
<!-- %%INSERT_FEATURES -->
|
||||
]]>
|
||||
|
||||
<!-- Added by G10h4ck: Needed permission for autostart at boot -->
|
||||
<![CDATA[
|
||||
<!-- Added by G10h4ck: Needed permission for autostart at boot example
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
||||
<!-- Added by Angesoc: used to access files shared by other apps -->
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
<!-- Added by G10h4ck: Needed permission for network usage -->
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<!-- Added by G10h4ck: Needed to listen for multicast packets, needed for
|
||||
! broadcast discovery -->
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
|
||||
-->
|
||||
]]>
|
||||
</manifest>
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
/*
|
||||
package org.retroshare.service;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
|
@ -36,3 +37,4 @@ public class AppUpdatedReceiver extends BroadcastReceiver
|
|||
RetroShareServiceAndroid.start(context);
|
||||
}
|
||||
}
|
||||
*/
|
|
@ -0,0 +1 @@
|
|||
../../../../../../../libretroshare/src/rs_android/org/retroshare/service/AssetHelper.java
|
|
@ -19,6 +19,7 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
/*
|
||||
package org.retroshare.service;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
|
@ -35,3 +36,4 @@ public class BootCompletedReceiver extends BroadcastReceiver
|
|||
RetroShareServiceAndroid.start(context);
|
||||
}
|
||||
}
|
||||
*/
|
|
@ -0,0 +1 @@
|
|||
../../../../../../../libretroshare/src/rs_android/org/retroshare/service/ErrorConditionWrap.java
|
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
* RetroShare
|
||||
* Copyright (C) 2016-2018 Gioacchino Mazzurco <gio@eigenlab.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* SPDX-FileCopyrightText: Retroshare Team <contact@retroshare.cc>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package org.retroshare.service;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import org.qtproject.qt5.android.bindings.QtService;
|
||||
|
||||
public class RetroShareServiceAndroid extends QtService
|
||||
{
|
||||
public static void start(Context ctx)
|
||||
{
|
||||
ctx.startService(new Intent(ctx, RetroShareServiceAndroid.class));
|
||||
}
|
||||
|
||||
public static void stop(Context ctx)
|
||||
{
|
||||
ctx.stopService(new Intent(ctx, RetroShareServiceAndroid.class));
|
||||
}
|
||||
|
||||
public static boolean isRunning(Context ctx)
|
||||
{
|
||||
ActivityManager manager = (ActivityManager) ctx.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE))
|
||||
if (RetroShareServiceAndroid.class.getName().equals(service.service.getClassName()))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
../../../../../../../libretroshare/src/rs_android/org/retroshare/service/RetroShareServiceAndroid.java
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* RetroShare
|
||||
* Copyright (C) 2016-2018 Gioacchino Mazzurco <gio@altermundi.net>
|
||||
* Copyright (C) 2016-2021 Gioacchino Mazzurco <gio@altermundi.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
|
@ -50,7 +50,11 @@ public class RetroShareServiceControlActivity extends Activity
|
|||
else
|
||||
{
|
||||
button.setText("Starting...");
|
||||
RetroShareServiceAndroid.start(RetroShareServiceControlActivity.this);
|
||||
RetroShareServiceAndroid.start(
|
||||
RetroShareServiceControlActivity.this,
|
||||
RetroShareServiceAndroid.DEFAULT_JSON_API_PORT,
|
||||
RetroShareServiceAndroid.DEFAULT_JSON_API_BINDING_ADDRESS
|
||||
);
|
||||
serviceStarting = true;
|
||||
serviceStopping = false;
|
||||
}
|
||||
|
|
29
retroshare-service/src/retroshare-service-android.cc
Normal file
29
retroshare-service/src/retroshare-service-android.cc
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* RetroShare Service Android
|
||||
* Copyright (C) 2021 Gioacchino Mazzurco <gio@eigenlab.org>
|
||||
* Copyright (C) 2021 Asociación Civil Altermundi <info@altermundi.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* SPDX-FileCopyrightText: Retroshare Team <contact@retroshare.cc>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
#include "rs_android/rsjni.hpp"
|
||||
|
||||
extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* _reserved)
|
||||
{
|
||||
RS_DBG(vm);
|
||||
return JNI_OnLoad_retroshare(vm, _reserved);
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* RetroShare Service
|
||||
* Copyright (C) 2016-2019 Gioacchino Mazzurco <gio@eigenlab.org>
|
||||
* Copyright (C) 2016-2021 Gioacchino Mazzurco <gio@eigenlab.org>
|
||||
* Copyright (C) 2021 Asociación Civil Altermundi <info@altermundi.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
|
@ -19,6 +20,12 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
|
||||
#include <cmath>
|
||||
#include <csignal>
|
||||
#include <iomanip>
|
||||
#include <atomic>
|
||||
|
||||
#include "util/stacktrace.h"
|
||||
#include "util/argstream.h"
|
||||
#include "util/rskbdinput.h"
|
||||
|
@ -26,36 +33,20 @@
|
|||
#include "retroshare/rsinit.h"
|
||||
#include "retroshare/rstor.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
|
||||
#ifdef RS_JSONAPI
|
||||
#include "retroshare/rsjsonapi.h"
|
||||
|
||||
#ifdef RS_WEBUI
|
||||
#include "retroshare/rswebui.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static CrashStackTrace gCrashStackTrace;
|
||||
|
||||
#include <cmath>
|
||||
#include <csignal>
|
||||
#include <iomanip>
|
||||
#include <atomic>
|
||||
|
||||
#ifdef __ANDROID__
|
||||
# include <QAndroidService>
|
||||
# include <QCoreApplication>
|
||||
# include <QObject>
|
||||
# include <QStringList>
|
||||
|
||||
# include "util/androiddebug.h"
|
||||
#endif // def __ANDROID__
|
||||
#include <QCoreApplication>
|
||||
|
||||
#include "retroshare/rsinit.h"
|
||||
#include "retroshare/rsiface.h"
|
||||
#include "util/rsdebug.h"
|
||||
|
||||
#ifdef RS_JSONAPI
|
||||
# include "retroshare/rsjsonapi.h"
|
||||
|
||||
# ifdef RS_WEBUI
|
||||
# include "retroshare/rswebui.h"
|
||||
# endif // def RS_WEBUI
|
||||
#endif // def RS_JSONAPI
|
||||
|
||||
static CrashStackTrace gCrashStackTrace;
|
||||
|
||||
#ifdef RS_SERVICE_TERMINAL_LOGIN
|
||||
class RsServiceNotify: public NotifyClient
|
||||
{
|
||||
|
@ -78,9 +69,6 @@ public:
|
|||
};
|
||||
#endif // def RS_SERVICE_TERMINAL_LOGIN
|
||||
|
||||
#ifdef __ANDROID__
|
||||
void signalHandler(int /*signal*/) { QCoreApplication::exit(0); }
|
||||
#else
|
||||
static std::atomic<bool> keepRunning(true);
|
||||
static int receivedSignal = 0;
|
||||
|
||||
|
@ -91,18 +79,10 @@ void signalHandler(int signal)
|
|||
receivedSignal = signal;
|
||||
keepRunning = false;
|
||||
}
|
||||
#endif // def __ANDROID__
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
#ifdef __ANDROID__
|
||||
AndroidStdIOCatcher dbg; (void) dbg;
|
||||
QAndroidService app(argc, argv);
|
||||
#else // def __ANDROID__
|
||||
QCoreApplication app(argc,argv); // needed for TorManaer (that uses QDir). To be removed when TorManager doesn't use Qt anymore.
|
||||
#endif
|
||||
|
||||
signal(SIGINT, signalHandler);
|
||||
signal(SIGTERM, signalHandler);
|
||||
#ifdef SIGBREAK
|
||||
|
@ -134,7 +114,7 @@ int main(int argc, char* argv[])
|
|||
RsConfigOptions conf;
|
||||
|
||||
#ifdef RS_JSONAPI
|
||||
conf.jsonApiPort = RsJsonApi::DEFAULT_PORT; // enable JSonAPI by default
|
||||
conf.jsonApiPort = RsJsonApi::DEFAULT_PORT; // enable JSON API by default
|
||||
#ifdef RS_WEBUI
|
||||
std::string webui_base_directory = RsWebUi::DEFAULT_BASE_DIRECTORY;
|
||||
#endif
|
||||
|
@ -358,22 +338,10 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef __ANDROID__
|
||||
rsControl->setShutdownCallback(QCoreApplication::exit);
|
||||
|
||||
QObject::connect(
|
||||
&app, &QCoreApplication::aboutToQuit,
|
||||
[](){
|
||||
if(RsControl::instance()->isReady())
|
||||
RsControl::instance()->rsGlobalShutDown(); } );
|
||||
|
||||
return app.exec();
|
||||
#else // def __ANDROID__
|
||||
rsControl->setShutdownCallback([&](int){keepRunning = false;});
|
||||
|
||||
while(keepRunning)
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# RetroShare service qmake build script
|
||||
#
|
||||
# Copyright (C) 2018-2019, Gioacchino Mazzurco <gio@eigenlab.org>
|
||||
# Copyright (C) 2018-2021, Gioacchino Mazzurco <gio@eigenlab.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it under
|
||||
# the terms of the GNU Affero General Public License as published by the
|
||||
|
@ -22,11 +22,6 @@
|
|||
|
||||
TARGET = retroshare-service
|
||||
|
||||
CONFIG += qt
|
||||
|
||||
QT += core network
|
||||
QT -= gui
|
||||
|
||||
!include("../../libretroshare/src/use_libretroshare.pri"):error("Including")
|
||||
|
||||
SOURCES += retroshare-service.cc
|
||||
|
@ -34,8 +29,6 @@ SOURCES += retroshare-service.cc
|
|||
################################# Linux ##########################################
|
||||
|
||||
android-* {
|
||||
QT += androidextras
|
||||
|
||||
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
|
||||
|
||||
DISTFILES += android/AndroidManifest.xml \
|
||||
|
@ -47,6 +40,9 @@ android-* {
|
|||
android/build.gradle \
|
||||
android/gradle/wrapper/gradle-wrapper.properties \
|
||||
android/gradlew.bat
|
||||
|
||||
SOURCES -= retroshare-service.cc
|
||||
SOURCES += retroshare-service-android.cc
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue