Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incoming phone call triggers custom move. #65

Open
MasterTailer opened this issue Mar 15, 2019 · 15 comments
Open

Incoming phone call triggers custom move. #65

MasterTailer opened this issue Mar 15, 2019 · 15 comments
Assignees
Labels
enhancement New feature or request futurespeak Something which is more an idea for something that would be neat

Comments

@MasterTailer
Copy link
Collaborator

email arrives.. tail wag
wifi dropped - tail tremble
incoming call - tail lift..

Discuss!

@MasterTailer MasterTailer added enhancement New feature or request futurespeak Something which is more an idea for something that would be neat labels Mar 15, 2019
@MasterTailer MasterTailer changed the title Start to add system notifications to tail moves.. Start to add system notifications that can trigger tail moves.. Mar 18, 2019
@ildar-gilmanov
Copy link

The branch for this task is call-handlers.

If the application does not start at incoming call then check auto start permissions at 3rd party manager application. See here: https://stackoverflow.com/questions/34842659/cannot-autostart-app-on-boot-got-broadcastqueue-reject-to-launch-app

@MasterTailer
Copy link
Collaborator Author

So perhaps rather than autostarting this, we could allow it to be "enabled" in the app whilst the app is running. So incoming calls trigger a move. But not without the app (or service) explicitly being run, and the feature enabled..

@MasterTailer
Copy link
Collaborator Author

So incoming call triggers a custom move that I am designing. It needs to be able to interrupt any move currently moving. And we need to prevent the tail moving once the call is answered - to keep the tail quiet.

@MasterTailer MasterTailer changed the title Start to add system notifications that can trigger tail moves.. Incoming phone call triggers custom move. Apr 17, 2019
@ildar-gilmanov
Copy link

ildar-gilmanov commented Apr 19, 2019

So perhaps rather than autostarting this, we could allow it to be "enabled" in the app whilst the app is running. So incoming calls trigger a move. But not without the app (or service) explicitly being run, and the feature enabled..

I think it is better to trigger the events even the app is closed by default. I added the comment above because Asus phones have an application that denies that behavior. But as I know vanilla android devices should allow that.

@MasterTailer
Copy link
Collaborator Author

ok - good - lets see if it causes trouble,

@MasterTailer
Copy link
Collaborator Author

Excuse my ignorance but I don't see a pull request for the changes u made. What am I doing wrong? 😁

@ildar-gilmanov
Copy link

Now user can change the move commands for each phone events. But we can not run it from service...
We should be able to run it from service app, not from main app, because we do not need to start the main app each time the phone receives incoming calls.

@MasterTailer
Copy link
Collaborator Author

MasterTailer commented Apr 23, 2019 via email

@ildar-gilmanov
Copy link

It works now! But only with the main app, not service

@ildar-gilmanov
Copy link

ildar-gilmanov commented May 23, 2019

I have tried several ways to resolve this issue. Here is my report.

We should register C++ code only from Service library, not main library. It is because if we register C++ code from main library then the Qt main event loop is paused when the application is hidden, and when the app is hidden and someone called then we do not see any action. But when the app will be visible again we will get all the events at the same time. We do not want this.

So, to register C++ code only from Service library we have two ways:

  1. Separate Service and main libraries into two different .so files and use JNIEXPORT and JNICALL
  2. Use JNIEnv::RegisterNatives() method

I tested JNIEXPORT with JNICALL and JNIEnv::RegisterNatives() ways and no one is working now. I suspect it is due the Qt bug: UnsatisfiedLinkError when manually registering functions via JNI_OnLoad. It is fixed only at Qt 5.12.2, but the docker image has only Qt 5.12.1.

And I think the JNIEnv::RegisterNatives() is more flexible and stable way to do that.

And one more thing about the JNIEXPORT with JNICALL way. When we close the main app and stop the service and try to call the phone then the Java native method is registered, but qApp is null there.

At JNIEnv::RegisterNatives() case when we close the main app and stop the service and try to call the phone then the Java native method is registered at JNI_OnLoad() method, but when we try to call the phoneCallHandler() method from Java it says:

E/art: No implementation found for void org.thetailcompany.digitail.TailService.phoneCallHandler(java.lang.String) (tried Java_org_thetailcompany_digitail_TailService_phoneCallHandler and Java_org_thetailcompany_digitail_TailService_phoneCallHandler__Ljava_lang_String_2)

It seems it is due the Qt bug: UnsatisfiedLinkError when manually registering functions via JNI_OnLoad

Now I updated the kdeorg/android-sdk docker image and it contains Qt 5.12.3, but I cannot build the application:

CMake Error at /opt/kdeandroid-deps/share/ECM/toolchain/ECMAndroidDeployQt.cmake:2 (find_package):
  By not providing "FindQt5Core.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5Core", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5Core" with any
  of the following names:

    Qt5CoreConfig.cmake
    qt5core-config.cmake

  Add the installation prefix of "Qt5Core" to CMAKE_PREFIX_PATH or set
  "Qt5Core_DIR" to a directory containing one of the above files.  If
  "Qt5Core" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  /opt/kdeandroid-deps/share/ECM/toolchain/Android.cmake:192 (include)
  /opt/cmake/share/cmake-3.13/Modules/CMakeDetermineSystem.cmake:94 (include)
  CMakeLists.txt:2 (project)


CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

And I use the call-handlers and debug-jni-dirty branches.

@ildar-gilmanov
Copy link

I have tried the latest docker image with the command:

rm -rf * && cmake -DCMAKE_TOOLCHAIN_FILE=/opt/kdeandroid-deps/share/ECM/toolchain/Android.cmake -DECM_ADDITIONAL_FIND_ROOT_PATH=/opt/Qt/5.12.3/android_armv7 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../export -DQTANDROID_EXPORTED_TARGET=digitail -DANDROID_APK_DIR=../data -DANDROID_EXTRA_LIBS=/opt/kdeandroid-deps/lib/libcrypto.so,/opt/kdeandroid-deps/lib/libssl.so .. && make && cd src && make install && cd .. && make create-apk-digitail && cp digitail_build_apk/build/outputs/apk/debug/digitail_build_apk-debug.apk /output/

Now it builds the application, but nothing has changed

@ildar-gilmanov
Copy link

When we call System.loadLibrary("digitail"); manually we do not get the UnsatisfiedLinkError at Java, but at this case the main() function is not called from C++

@ildar-gilmanov
Copy link

I tested it with JNIEXPORT and JNICALL too. The behavior is the same as with the JNIEnv::RegisterNatives() and JNI_OnLoad(): when the main application is closed and we call to the phone the service is started on Java side, the JNI_OnLoad() method is called on C++ side and we get the UnsatisfiedLinkError at Java side until we call the System.loadLibrary("digitail"); manually.

@ildar-gilmanov
Copy link

Related bug report: https://bugreports.qt.io/browse/QTBUG-76038

@ildar-gilmanov
Copy link

So, I offer to wait until this bug will be fixed on Qt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request futurespeak Something which is more an idea for something that would be neat
Projects
None yet
Development

No branches or pull requests

2 participants