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>bb10
parent
631127126c
commit
eacf83594a
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue