Android: replace stacktrace with debug message in search for setService
Don't print stacktrace when setService is not found but only print a debug message, QtServiceDelegate will continue to look for setContext which might actually be a problem if not implemented. 950e628fd842f22ac741b18440fcc99213820587 did this change for QtActivityDelegate. Fixes: QTBUG-86733 Change-Id: I8f2c6494da9133a3e9dedaabbe5fc931732d0d72 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 15572f9efeb1b7dd609b55f8981eb5b5dc3d3db9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
7e3c646577
commit
4cafeba508
@ -84,6 +84,7 @@ import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Objects;
|
||||
|
||||
public class QtServiceDelegate
|
||||
{
|
||||
@ -118,7 +119,8 @@ public class QtServiceDelegate
|
||||
QtNative.setApplicationDisplayMetrics(10, 10, 0, 0, 10, 10, 120, 120, 1.0, 1.0);
|
||||
|
||||
if (loaderParams.containsKey(STATIC_INIT_CLASSES_KEY)) {
|
||||
for (String className: loaderParams.getStringArray(STATIC_INIT_CLASSES_KEY)) {
|
||||
for (String className :
|
||||
Objects.requireNonNull(loaderParams.getStringArray(STATIC_INIT_CLASSES_KEY))) {
|
||||
if (className.length() == 0)
|
||||
continue;
|
||||
try {
|
||||
@ -128,9 +130,11 @@ public class QtServiceDelegate
|
||||
Method m = initClass.getMethod("setService", Service.class, Object.class);
|
||||
m.invoke(staticInitDataObject, m_service, this);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.d(QtNative.QtTAG,
|
||||
"Class " + className + " does not implement setService method");
|
||||
}
|
||||
|
||||
// For modules that don't need/have setService
|
||||
try {
|
||||
Method m = initClass.getMethod("setContext", Context.class);
|
||||
m.invoke(staticInitDataObject, (Context)m_service);
|
||||
|
Loading…
x
Reference in New Issue
Block a user