diff options
author | Assam Boudjelthia <assam.boudjelthia@qt.io> | 2020-07-03 19:02:17 +0300 |
---|---|---|
committer | Assam Boudjelthia <assam.boudjelthia@qt.io> | 2020-07-08 07:07:15 +0000 |
commit | eacf83594a5bf063665fdecc6c438673dc9f2cf6 (patch) | |
tree | 6770e1cf4da01f1341ebd21f5aef093fa4ef1dcb /src | |
parent | 631127126cc14e7c01cc611532b3256b58785670 (diff) |
Android: check for debug mode before fetching extraappparams
In pre Qt 5.14, the assets folder used to have the file
"--Added-by-androiddeployqt--/debugger.command", that indicate debug
mode, however, in Qt 5.14+ the assets are compressed into one file, so
this current check is obsolete. Qt Creator uses extraappparams to pass
QML debugger args, without it the debugger won't start.
Pick-to: 5.15
Task-number: QTCREATORBUG-24155
Change-Id: Ib3037f4dc8c55af6932d598c6491a046efe13033
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java index a7c5802c43..c8bf7dc534 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -45,6 +45,7 @@ import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.pm.ActivityInfo; +import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.AssetManager; @@ -711,12 +712,9 @@ public class QtActivityDelegate Bundle extras = m_activity.getIntent().getExtras(); if (extras != null) { try { - // do NOT remove !!!! - final String dc = "--Added-by-androiddeployqt--/debugger.command"; - new BufferedReader(new InputStreamReader(m_activity.getAssets().open(dc))).readLine(); - // do NOT remove !!!! - // The previous lines are needed to check if the debug mode is enabled. - // We are not allowed to use extraenvvars or extraappparams in a non debuggable environment. + final boolean isDebuggable = (m_activity.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; + if (!isDebuggable) + throw new Exception(); if (extras.containsKey("extraenvvars")) { try { @@ -734,6 +732,8 @@ public class QtActivityDelegate } } } catch (Exception e) { + Log.e(QtNative.QtTAG, "Not in debug mode! It is not allowed to use " + + "extra arguments in non-debug mode."); // This is not an error, so keep it silent // e.printStackTrace(); } |