QQ4A: All Loaders extract metadata and applicationArguments
Just like regular Q4A apps and Android service apps, we should also extract and set the common environment variables and app parameters for QQ4A apps, so call extractContextMetadata() from the QtEmbeddedLoader ctor. In order for QtTest library to know where to output test results, androidtestrunner passes it some parameters via "applicationArguments" when launching the application. These params should be passed from the launch intent to the main application, so now the base QtLoader class parses this info in extractContextMetadata(), so that it's not just parsed by QtActivityLoader. Change-Id: If0444847676d197689b087c5f6684552f8ea73aa Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
parent
dad9ce46f0
commit
74bdd85209
@ -86,10 +86,6 @@ class QtActivityLoader extends QtLoader {
|
||||
return;
|
||||
}
|
||||
|
||||
String intentArgs = intent.getStringExtra("applicationArguments");
|
||||
if (intentArgs != null)
|
||||
appendApplicationParameters(intentArgs);
|
||||
|
||||
Bundle extras = intent.getExtras();
|
||||
if (extras == null) {
|
||||
Log.w(QtTAG, "Null extras from the Activity's intent.");
|
||||
|
@ -17,6 +17,8 @@ class QtEmbeddedLoader extends QtLoader {
|
||||
String stylePath = ExtractStyle.setup(context, "minimal", displayDensity);
|
||||
setEnvironmentVariable("ANDROID_STYLE_PATH", stylePath);
|
||||
setEnvironmentVariable("QT_ANDROID_NO_EXIT_CALL", String.valueOf(true));
|
||||
|
||||
extractContextMetaData(context);
|
||||
}
|
||||
|
||||
static QtEmbeddedLoader getEmbeddedLoader(Context context) throws IllegalArgumentException {
|
||||
|
@ -7,6 +7,7 @@ package org.qtproject.qt.android;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
@ -110,6 +111,12 @@ abstract class QtLoader {
|
||||
setEnvironmentVariable("QT_BLOCK_EVENT_LOOPS_WHEN_SUSPENDED", isBackgroundRunningBlocked());
|
||||
setEnvironmentVariable("QTRACE_LOCATION", getMetaData("android.app.trace_location"));
|
||||
appendApplicationParameters(getMetaData("android.app.arguments"));
|
||||
|
||||
if (context instanceof Activity) {
|
||||
Intent intent = ((Activity) context).getIntent();
|
||||
if (intent != null)
|
||||
appendApplicationParameters(intent.getStringExtra("applicationArguments"));
|
||||
}
|
||||
}
|
||||
|
||||
private String isBackgroundRunningBlocked() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user