android notification service stub, improve login

Added retroshare-android-notify-service a stub will handle notifications
  to android system, at the moment it only attempt autologin if default
  password is used
retroshare-android-service quit QCoreApplication gracefully
Android Studio update has changed some android build files
Create BusyOverlay.qml componet so it is reusable accross the qml app
Contacts.qml create a pseudonimous GXS identity as needed without
  prompting the user
RsLoginPassView.qml nicer look, on mobile phone password usage is not
  common so do not use password by default
QML app main view handle correctly +waiting_startup+ runstate
QML app main view use BusyOverlay as initial item
This commit is contained in:
Gioacchino Mazzurco 2017-04-07 18:26:08 +02:00
parent 70e91f7164
commit bcbd5230eb
24 changed files with 562 additions and 94 deletions

View file

@ -75,8 +75,9 @@
</receiver>
<!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices -->
<service android:process=":rs" android:name=".RetroShareAndroidService" android:label="RetroShare Service" android:exported="true"> <!-- Added to be able to run the service from adb shell -->
<!-- android:process=":qt" is needed to force the service to run on a separate process than the Activity -->
<service android:process=":rs" android:name=".RetroShareAndroidService" 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 -->
<!-- Application arguments -->
@ -114,6 +115,52 @@
<!-- Messages maps -->
<!-- Background running -->
<meta-data android:name="android.app.background_running" android:value="true"/>
<!-- Background running -->
</service>
<!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices -->
<service android:process=":nf" android:name=".RetroShareAndroidNotifyService" android:label="RetroShare Notify Service" android:exported="true">
<!-- android:exported="true" Added to be able to run the service from adb shell -->
<!-- android:process=":nf" is needed to force the service to run on a separate process than the Activity -->
<!-- Application arguments -->
<!-- meta-data android:name="android.app.arguments" android:value="-service"/ -->
<!-- Application arguments -->
<!-- If you are using the same application (.so file) for activity and also for service, then you
need to use *android.app.arguments* to pass some arguments to your service in order to know which
one is which.
-->
<!-- Application to launch -->
<meta-data android:name="android.app.lib_name" android:value="retroshare-android-notify-service"/>
<!-- Application to launch -->
<!-- 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 -->

View file

@ -16,34 +16,30 @@
<task>generateDebugSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/../../../../qt5/qtbase/src/android/java/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/../../../../qt5/qtbase/src/android/java/res;file://$MODULE_DIR$/res" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/../../../../../../../opt/Qt5.8.0/5.8/android_armv7/src/android/java/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file:///opt/Qt5.8.0/5.8/android_armv7/src/android/java/res;file://$MODULE_DIR$/res" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/.build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/.build/intermediates/classes/test/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$/../../../../qt5/qtbase/src/android/java/res">
<sourceFolder url="file://$MODULE_DIR$/../../../../qt5/qtbase/src/android/java/res" type="java-resource" />
</content>
<content url="file://$MODULE_DIR$/../../../../qt5/qtbase/src/android/java/src">
<sourceFolder url="file://$MODULE_DIR$/../../../../qt5/qtbase/src/android/java/src" isTestSource="false" />
</content>
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/.build/generated/source/r/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/.build/generated/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/.build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/.build/generated/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/.build/generated/source/apt/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/.build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/.build/generated/res/generated/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/.build/generated/res/resValues/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/.build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/.build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/.build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/.build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/.build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/.build/generated/res/rs/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/.build/generated/res/generated/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/.build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
@ -51,6 +47,7 @@
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
@ -58,6 +55,7 @@
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/assets" type="java-resource" />
@ -65,6 +63,7 @@
<sourceFolder url="file://$MODULE_DIR$/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
@ -72,6 +71,7 @@
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
@ -79,18 +79,22 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/.build/intermediates/assets" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/.build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/.build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/.build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/.build/intermediates/mockable-android-18.jar" />
<excludeFolder url="file://$MODULE_DIR$/.build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/.build/intermediates/resources" />
<excludeFolder url="file://$MODULE_DIR$/.build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/.build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/.build/outputs" />
</content>
<orderEntry type="jdk" jdkName="Android API 18 Platform" jdkType="Android SDK" />
<content url="file:///opt/Qt5.8.0/5.8/android_armv7/src/android/java/res">
<sourceFolder url="file:///opt/Qt5.8.0/5.8/android_armv7/src/android/java/res" type="java-resource" />
</content>
<content url="file:///opt/Qt5.8.0/5.8/android_armv7/src/android/java/src">
<sourceFolder url="file:///opt/Qt5.8.0/5.8/android_armv7/src/android/java/src" isTestSource="false" />
</content>
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" scope="TEST" name="mockable-android-18" level="project" />
</component>
</module>

View file

@ -4,7 +4,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
classpath 'com.android.tools.build:gradle:2.2.3'
}
}

View file

@ -1,6 +1,6 @@
#Wed Apr 10 15:27:10 PDT 2013
#Fri Apr 07 17:55:25 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip

View file

@ -1,6 +1,6 @@
/*
* RetroShare Android Service
* Copyright (C) 2016 Gioacchino Mazzurco <gio@eigenlab.org>
* Copyright (C) 2016-2017 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
@ -28,9 +28,16 @@ public class AppUpdatedReceiver extends BroadcastReceiver
@Override
public void onReceive(Context context, Intent intent)
{
Log.i("AppUpdatedReceiver", "onReceive() Stopping RetroShareAndroidNotifyService After Update");
Intent nsIntent = new Intent(context, RetroShareAndroidNotifyService.class);
context.stopService(nsIntent);
Log.i("AppUpdatedReceiver", "onReceive() Restarting RetroShare Android Service After Update");
Intent myIntent = new Intent(context, RetroShareAndroidService.class);
context.stopService(myIntent);
context.startService(myIntent);
Intent coreIntent = new Intent(context, RetroShareAndroidService.class);
context.stopService(coreIntent);
context.startService(coreIntent);
Log.i("AppUpdatedReceiver", "onReceive() Starting RetroShareAndroidNotifyService After Update");
context.startService(nsIntent);
}
}

View file

@ -1,6 +1,6 @@
/*
* RetroShare Android Service
* Copyright (C) 2016 Gioacchino Mazzurco <gio@eigenlab.org>
* Copyright (C) 2016-2017 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
@ -21,13 +21,19 @@ package org.retroshare.android.qml_app;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
public class BootCompletedReceiver extends BroadcastReceiver
{
@Override
public void onReceive(Context context, Intent intent)
{
Intent myIntent = new Intent(context, RetroShareAndroidService.class);
context.startService(myIntent);
Log.i("BootCompletedReceiver", "onReceive() Starting RetroShareAndroidService on boot");
Intent coreIntent = new Intent(context, RetroShareAndroidService.class);
context.startService(coreIntent);
Log.i("BootCompletedReceiver", "onReceive() Starting RetroShareAndroidNotifyService on boot");
Intent nsIntent = new Intent(context, RetroShareAndroidNotifyService.class);
context.startService(nsIntent);
}
}

View file

@ -0,0 +1,23 @@
/*
* RetroShare Android Service
* Copyright (C) 2017 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/>.
*/
package org.retroshare.android.qml_app;
import org.qtproject.qt5.android.bindings.QtService;
public class RetroShareAndroidNotifyService extends QtService {}

View file

@ -1,6 +1,6 @@
/*
* RetroShare Android QML App
* Copyright (C) 2016 Gioacchino Mazzurco <gio@eigenlab.org>
* Copyright (C) 2016-2017 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
@ -39,6 +39,14 @@ public class RetroShareQmlActivity extends QtActivity
}
else Log.v("RetroShareQmlActivity", "onCreate(): RetroShareAndroidService already running");
if (!isMyServiceRunning(RetroShareAndroidNotifyService.class))
{
Log.i("RetroShareQmlActivity", "onCreate(): RetroShareAndroidNotifyService is not running, let's start it by Intent");
Intent rsIntent = new Intent(this, RetroShareAndroidNotifyService.class);
startService(rsIntent);
}
else Log.v("RetroShareQmlActivity", "onCreate(): RetroShareAndroidNotifyService already running");
super.onCreate(savedInstanceState);
}