File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
android/vpnClient/src/main/java/org/mozilla/firefox/vpn/qt Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -39,10 +39,14 @@ public void onCreate(Bundle savedInstanceState) {
3939 } else {
4040 setRequestedOrientation (ActivityInfo .SCREEN_ORIENTATION_UNSPECIFIED );
4141 }
42- instance = this ;
4342 }
4443 private static VPNActivity instance ;
4544
45+ public VPNActivity () {
46+ super ();
47+ instance = this ;
48+ }
49+
4650 public static VPNActivity getInstance () {
4751 return instance ;
4852 }
Original file line number Diff line number Diff line change @@ -33,7 +33,17 @@ jbyteArray tojByteArray(const QByteArray& data) {
3333
3434// static
3535QJniObject AndroidCommons::getActivity () {
36- return QNativeInterface::QAndroidApplication::context ();
36+ // Call the static method to get the instance
37+ QJniObject activityInstance = QJniObject::callStaticObjectMethod (
38+ " org/mozilla/firefox/vpn/qt/VPNActivity" , " getInstance" ,
39+ " ()Lorg/mozilla/firefox/vpn/qt/VPNActivity;" );
40+
41+ if (!activityInstance.isValid ()) {
42+ qWarning (" Call to VPNActivity.getInstance() failed or returned null." );
43+ return QJniObject (); // Return an invalid QJniObject
44+ }
45+
46+ return activityInstance;
3747}
3848
3949// static
You can’t perform that action at this time.
0 commit comments