Android: Update Activity reference to C++ when set
There already exists a method to do this, but seems at some point calling it has been dropped. Add a call to update the native reference whenever the reference in Java gets updated. Task-number: QTBUG-130614 Pick-to: 6.9 Change-Id: If9654b504c88340feff2432973f8f9f2eaffa272 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
parent
019d2e5974
commit
acd331cd15
@ -21,6 +21,7 @@ import android.view.Menu;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.lang.UnsatisfiedLinkError;
|
||||||
import java.security.KeyStore;
|
import java.security.KeyStore;
|
||||||
import java.security.cert.X509Certificate;
|
import java.security.cert.X509Certificate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -67,6 +68,13 @@ public class QtNative
|
|||||||
{
|
{
|
||||||
synchronized (m_mainActivityMutex) {
|
synchronized (m_mainActivityMutex) {
|
||||||
m_activity = new WeakReference<>(qtMainActivity);
|
m_activity = new WeakReference<>(qtMainActivity);
|
||||||
|
try {
|
||||||
|
updateNativeActivity();
|
||||||
|
} catch (UnsatisfiedLinkError ignored) {
|
||||||
|
// No-op - this happens in certain e.g. QtQuick for Android cases when we set the
|
||||||
|
// Activity for the first time, before Qt native libraries have been loaded. The
|
||||||
|
// C++ side will update its reference when the library is loaded.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user