summaryrefslogtreecommitdiffstats
path: root/src/android/java/src
diff options
context:
space:
mode:
authorAssam Boudjelthia <assam.boudjelthia@qt.io>2020-06-16 12:03:41 +0300
committerAssam Boudjelthia <assam.boudjelthia@qt.io>2021-07-01 23:54:14 +0300
commitaf6bc5a21bbef6a5870f8e49c2cc70c53d4fa352 (patch)
tree8a5fa4acfd641dd87158d7e60753342024b1505e /src/android/java/src
parent6948c5b3ae255d8a1e0805aaa9b88382a4a445b0 (diff)
Remove ministro code
Since Ministro no longer work on recent Android versions (Android 8+), and it hasn't been maintained and the repos are not updated, the existing code is practically a dead code. [ChangeLog][Android] Remove ministro code since it's been unmaintained and not working with recent Android versions. Task-number: QTBUG-85201 Pick-to: 6.2 Change-Id: I18d7b1e209cba3cfd04674060e9bf39aa5a5510f Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Diffstat (limited to 'src/android/java/src')
-rw-r--r--src/android/java/src/org/kde/necessitas/ministro/IMinistro.aidl60
-rw-r--r--src/android/java/src/org/kde/necessitas/ministro/IMinistroCallback.aidl65
-rw-r--r--src/android/java/src/org/qtproject/qt/android/bindings/QtActivity.java2
-rw-r--r--src/android/java/src/org/qtproject/qt/android/bindings/QtActivityLoader.java26
-rw-r--r--src/android/java/src/org/qtproject/qt/android/bindings/QtLoader.java144
5 files changed, 1 insertions, 296 deletions
diff --git a/src/android/java/src/org/kde/necessitas/ministro/IMinistro.aidl b/src/android/java/src/org/kde/necessitas/ministro/IMinistro.aidl
deleted file mode 100644
index bbd8116d96..0000000000
--- a/src/android/java/src/org/kde/necessitas/ministro/IMinistro.aidl
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- Copyright (c) 2011-2013, BogDan Vatra <bogdan@kde.org>
- Contact: http://www.qt.io/licensing/
-
- Commercial License Usage
- Licensees holding valid commercial Qt licenses may use this file in
- accordance with the commercial license agreement provided with the
- Software or, alternatively, in accordance with the terms contained in
- a written agreement between you and The Qt Company. For licensing terms
- and conditions see http://www.qt.io/terms-conditions. For further
- information use the contact form at http://www.qt.io/contact-us.
-
- BSD License Usage
- Alternatively, this file may be used under the BSD license as follows:
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-package org.kde.necessitas.ministro;
-
-import org.kde.necessitas.ministro.IMinistroCallback;
-
-interface IMinistro
-{
-/**
-* Check/download required libs to run the application
-*
-* param callback - interface used by Minsitro service to notify the client when the loader is ready
-* param parameters
-* parameters fields:
-* * Key Name Key type Explanations
-* "sources" StringArray Sources list from where Ministro will download the libs. Make sure you are using ONLY secure locations.
-* "repository" String Overwrites the default Ministro repository. Possible values: default, stable, testing and unstable
-* "required.modules" StringArray Required modules by your application
-* "application.title" String Application name, used to show more informations to user
-* "qt.provider" String Qt libs provider, currently only "necessitas" is supported.
-* "minimum.ministro.api" Integer Minimum Ministro API level, used to check if Ministro service compatible with your application. Current API Level is 3 !
-* "minimum.qt.version" Integer Minimim Qt version (e.g. 0x040800, which means Qt 4.8.0, check http://qt-project.org/doc/qt-4.8/qtglobal.html#QT_VERSION)!
-*/
- void requestLoader(in IMinistroCallback callback, in Bundle parameters);
-}
diff --git a/src/android/java/src/org/kde/necessitas/ministro/IMinistroCallback.aidl b/src/android/java/src/org/kde/necessitas/ministro/IMinistroCallback.aidl
deleted file mode 100644
index f19caa69e0..0000000000
--- a/src/android/java/src/org/kde/necessitas/ministro/IMinistroCallback.aidl
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- Copyright (c) 2011-2013, BogDan Vatra <bogdan@kde.org>
- Contact: http://www.qt.io/licensing/
-
- Commercial License Usage
- Licensees holding valid commercial Qt licenses may use this file in
- accordance with the commercial license agreement provided with the
- Software or, alternatively, in accordance with the terms contained in
- a written agreement between you and The Qt Company. For licensing terms
- and conditions see http://www.qt.io/terms-conditions. For further
- information use the contact form at http://www.qt.io/contact-us.
-
- BSD License Usage
- Alternatively, this file may be used under the BSD license as follows:
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-package org.kde.necessitas.ministro;
-
-oneway interface IMinistroCallback {
-/**
-* This method is called by the Ministro service back into the application which
-* implements this interface.
-*
-* param in - loaderParams
-* loaderParams fields:
-* * Key Name Key type Explanations
-* * "error.code" Integer See below
-* * "error.message" String Missing if no error, otherwise will contain the error message translated into phone language where available.
-* * "dex.path" String The list of jar/apk files containing classes and resources, needed to be passed to application DexClassLoader
-* * "lib.path" String The list of directories containing native libraries; may be missing, needed to be passed to application DexClassLoader
-* * "loader.class.name" String Loader class name.
-*
-* "error.code" field possible errors:
-* - 0 no error.
-* - 1 incompatible Ministro version. Ministro needs to be upgraded.
-* - 2 not all modules could be satisfy.
-* - 3 invalid parameters
-* - 4 invalid qt version
-* - 5 download canceled
-*
-* The parameter contains additional fields which are used by the loader to start your application, so it must be passed to the loader.
-*/
-
- void loaderReady(in Bundle loaderParams);
-}
diff --git a/src/android/java/src/org/qtproject/qt/android/bindings/QtActivity.java b/src/android/java/src/org/qtproject/qt/android/bindings/QtActivity.java
index 63a2bc238e..17fcf0e19b 100644
--- a/src/android/java/src/org/qtproject/qt/android/bindings/QtActivity.java
+++ b/src/android/java/src/org/qtproject/qt/android/bindings/QtActivity.java
@@ -168,8 +168,6 @@ public class QtActivity extends Activity
QtApplication.invokeDelegateMethod(QtApplication.onActivityResult, requestCode, resultCode, data);
return;
}
- if (requestCode == QtLoader.MINISTRO_INSTALL_REQUEST_CODE)
- m_loader.startApp(false);
super.onActivityResult(requestCode, resultCode, data);
}
public void super_onActivityResult(int requestCode, int resultCode, Intent data)
diff --git a/src/android/java/src/org/qtproject/qt/android/bindings/QtActivityLoader.java b/src/android/java/src/org/qtproject/qt/android/bindings/QtActivityLoader.java
index da6b01c9a7..9251eba5d2 100644
--- a/src/android/java/src/org/qtproject/qt/android/bindings/QtActivityLoader.java
+++ b/src/android/java/src/org/qtproject/qt/android/bindings/QtActivityLoader.java
@@ -58,32 +58,6 @@ public class QtActivityLoader extends QtLoader {
super(activity, QtActivity.class);
m_activity = activity;
}
- @Override
- protected void downloadUpgradeMinistro(String msg) {
- AlertDialog.Builder downloadDialog = new AlertDialog.Builder(m_activity);
- downloadDialog.setMessage(msg);
- downloadDialog.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialogInterface, int i) {
- try {
- Uri uri = Uri.parse("market://details?id=org.kde.necessitas.ministro");
- Intent intent = new Intent(Intent.ACTION_VIEW, uri);
- m_activity.startActivityForResult(intent, MINISTRO_INSTALL_REQUEST_CODE);
- } catch (Exception e) {
- e.printStackTrace();
- ministroNotFound();
- }
- }
- });
-
- downloadDialog.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialogInterface, int i) {
- m_activity.finish();
- }
- });
- downloadDialog.show();
- }
@Override
protected String loaderClassName() {
diff --git a/src/android/java/src/org/qtproject/qt/android/bindings/QtLoader.java b/src/android/java/src/org/qtproject/qt/android/bindings/QtLoader.java
index 3dfac43339..7a122f658a 100644
--- a/src/android/java/src/org/qtproject/qt/android/bindings/QtLoader.java
+++ b/src/android/java/src/org/qtproject/qt/android/bindings/QtLoader.java
@@ -37,22 +37,15 @@
package org.qtproject.qt.android.bindings;
import android.app.AlertDialog;
-import android.content.ComponentName;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.DialogInterface;
import android.content.Intent;
-import android.content.ServiceConnection;
import android.content.pm.ComponentInfo;
import android.os.Build;
import android.os.Bundle;
-import android.os.IBinder;
-import android.os.RemoteException;
import android.util.Log;
-import org.kde.necessitas.ministro.IMinistro;
-import org.kde.necessitas.ministro.IMinistroCallback;
-
import java.io.File;
import java.io.FileOutputStream;
import java.lang.reflect.Method;
@@ -65,11 +58,6 @@ import dalvik.system.DexClassLoader;
public abstract class QtLoader {
- public final static int MINISTRO_INSTALL_REQUEST_CODE = 0xf3ee; // request code used to know when Ministro instalation is finished
- public static final int MINISTRO_API_LEVEL = 5; // Ministro api level (check IMinistro.aidl file)
- public static final int NECESSITAS_API_LEVEL = 2; // Necessitas api level used by platform plugin
- public static final int QT_VERSION = 0x050700; // This app requires at least Qt version 5.7.0
-
public static final String ERROR_CODE_KEY = "error.code";
public static final String ERROR_MESSAGE_KEY = "error.message";
public static final String DEX_PATH_KEY = "dex.path";
@@ -81,7 +69,6 @@ public abstract class QtLoader {
public static final String BUNDLED_LIBRARIES_KEY = "bundled.libraries";
public static final String MAIN_LIBRARY_KEY = "main.library";
public static final String STATIC_INIT_CLASSES_KEY = "static.init.classes";
- public static final String NECESSITAS_API_LEVEL_KEY = "necessitas.api.level";
public static final String EXTRACT_STYLE_KEY = "extract.android.style";
private static final String EXTRACT_STYLE_MINIMAL_KEY = "extract.android.style.option";
@@ -89,20 +76,6 @@ public abstract class QtLoader {
public static final String SYSTEM_LIB_PATH = "/system/lib/";
public String[] SYSTEM_APP_PATHS = {"/system/priv-app/", "/system/app/"};
- /// Ministro server parameter keys
- public static final String REQUIRED_MODULES_KEY = "required.modules";
- public static final String APPLICATION_TITLE_KEY = "application.title";
- public static final String MINIMUM_MINISTRO_API_KEY = "minimum.ministro.api";
- public static final String MINIMUM_QT_VERSION_KEY = "minimum.qt.version";
- public static final String SOURCES_KEY = "sources"; // needs MINISTRO_API_LEVEL >=3 !!!
- // Use this key to specify any 3rd party sources urls
- // Ministro will download these repositories into their
- // own folders, check http://community.kde.org/Necessitas/Ministro
- // for more details.
-
- public static final String REPOSITORY_KEY = "repository"; // use this key to overwrite the default ministro repsitory
- public static final String ANDROID_THEMES_KEY = "android.themes"; // themes that your application uses
-
public String APPLICATION_PARAMETERS = null; // use this variable to pass any parameters to your application,
// the parameters must not contain any white spaces
// and must be separated with "\t"
@@ -129,20 +102,6 @@ public abstract class QtLoader {
public String QT_ANDROID_DEFAULT_THEME = null; // sets the default theme.
- public static final int INCOMPATIBLE_MINISTRO_VERSION = 1; // Incompatible Ministro version. Ministro needs to be upgraded.
-
- public String[] m_sources = {"https://download.qt-project.org/ministro/android/qt5/qt-5.7"}; // Make sure you are using ONLY secure locations
- public String m_repository = "default"; // Overwrites the default Ministro repository
- // Possible values:
- // * default - Ministro default repository set with "Ministro configuration tool".
- // By default the stable version is used. Only this or stable repositories should
- // be used in production.
- // * stable - stable repository, only this and default repositories should be used
- // in production.
- // * testing - testing repository, DO NOT use this repository in production,
- // this repository is used to push a new release, and should be used to test your application.
- // * unstable - unstable repository, DO NOT use this repository in production,
- // this repository is used to push Qt snapshots.
public ArrayList<String> m_qtLibs = null; // required qt libs
public int m_displayDensity = -1;
private ContextWrapper m_context;
@@ -167,10 +126,6 @@ public abstract class QtLoader {
protected void runOnUiThread(Runnable run) {
run.run();
}
- protected void downloadUpgradeMinistro(String msg)
- {
- Log.e(QtApplication.QtTAG, msg);
- }
protected abstract String loaderClassName();
protected abstract Class<?> contextClassName();
@@ -218,11 +173,6 @@ public abstract class QtLoader {
try {
final int errorCode = loaderParams.getInt(ERROR_CODE_KEY);
if (errorCode != 0) {
- if (errorCode == INCOMPATIBLE_MINISTRO_VERSION) {
- downloadUpgradeMinistro(loaderParams.getString(ERROR_MESSAGE_KEY));
- return;
- }
-
// fatal error, show the error and quit
AlertDialog errorDialog = new AlertDialog.Builder(m_context).create();
errorDialog.setMessage(loaderParams.getString(ERROR_MESSAGE_KEY));
@@ -250,7 +200,6 @@ public abstract class QtLoader {
}
loaderParams.putStringArrayList(BUNDLED_LIBRARIES_KEY, libs);
- loaderParams.putInt(NECESSITAS_API_LEVEL_KEY, NECESSITAS_API_LEVEL);
// load and start QtLoader class
DexClassLoader classLoader = new DexClassLoader(loaderParams.getString(DEX_PATH_KEY), // .jar/.apk files
@@ -291,82 +240,9 @@ public abstract class QtLoader {
}
}
- private ServiceConnection m_ministroConnection=new ServiceConnection() {
- private IMinistro m_service = null;
- @Override
- public void onServiceConnected(ComponentName name, IBinder service)
- {
- m_service = IMinistro.Stub.asInterface(service);
- try {
- if (m_service != null) {
- Bundle parameters = new Bundle();
- parameters.putStringArray(REQUIRED_MODULES_KEY, (String[]) m_qtLibs.toArray());
- parameters.putString(APPLICATION_TITLE_KEY, getTitle());
- parameters.putInt(MINIMUM_MINISTRO_API_KEY, MINISTRO_API_LEVEL);
- parameters.putInt(MINIMUM_QT_VERSION_KEY, QT_VERSION);
- parameters.putString(ENVIRONMENT_VARIABLES_KEY, ENVIRONMENT_VARIABLES);
- if (APPLICATION_PARAMETERS != null)
- parameters.putString(APPLICATION_PARAMETERS_KEY, APPLICATION_PARAMETERS);
- parameters.putStringArray(SOURCES_KEY, m_sources);
- parameters.putString(REPOSITORY_KEY, m_repository);
- if (QT_ANDROID_THEMES != null)
- parameters.putStringArray(ANDROID_THEMES_KEY, QT_ANDROID_THEMES);
- m_service.requestLoader(m_ministroCallback, parameters);
- }
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- }
-
- private IMinistroCallback m_ministroCallback = new IMinistroCallback.Stub() {
- // this function is called back by Ministro.
- @Override
- public void loaderReady(final Bundle loaderParams) throws RemoteException {
- runOnUiThread(new Runnable() {
- @Override
- public void run() {
- m_context.unbindService(m_ministroConnection);
- loadApplication(loaderParams);
- }
- });
- }
- };
-
- @Override
- public void onServiceDisconnected(ComponentName name) {
- m_service = null;
- }
- };
-
- protected void ministroNotFound()
- {
- AlertDialog errorDialog = new AlertDialog.Builder(m_context).create();
-
- if (m_contextInfo.metaData.containsKey("android.app.ministro_not_found_msg"))
- errorDialog.setMessage(m_contextInfo.metaData.getString("android.app.ministro_not_found_msg"));
- else
- errorDialog.setMessage("Can't find Ministro service.\nThe application can't start.");
-
- errorDialog.setButton(m_context.getResources().getString(android.R.string.ok), new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- finish();
- }
- });
- errorDialog.show();
- }
-
public void startApp(final boolean firstStart)
{
try {
- if (m_contextInfo.metaData.containsKey("android.app.qt_sources_resource_id")) {
- int resourceId = m_contextInfo.metaData.getInt("android.app.qt_sources_resource_id");
- m_sources = m_context.getResources().getStringArray(resourceId);
- }
-
- if (m_contextInfo.metaData.containsKey("android.app.repository"))
- m_repository = m_contextInfo.metaData.getString("android.app.repository");
-
if (m_contextInfo.metaData.containsKey("android.app.qt_libs_resource_id")) {
int resourceId = m_contextInfo.metaData.getInt("android.app.qt_libs_resource_id");
m_qtLibs = prefferedAbiLibs(m_context.getResources().getStringArray(resourceId));
@@ -472,8 +348,7 @@ public abstract class QtLoader {
if (extractOption.equals("full"))
ENVIRONMENT_VARIABLES += "\tQT_USE_ANDROID_NATIVE_STYLE=1";
- ENVIRONMENT_VARIABLES += "\tMINISTRO_ANDROID_STYLE_PATH=" + stylePath
- + "\tQT_ANDROID_THEMES_ROOT_PATH=" + themePath;
+ ENVIRONMENT_VARIABLES += "\tANDROID_STYLE_PATH=" + stylePath;
loaderParams.putString(ENVIRONMENT_VARIABLES_KEY, ENVIRONMENT_VARIABLES);
@@ -505,23 +380,6 @@ public abstract class QtLoader {
loadApplication(loaderParams);
return;
}
-
- try {
- if (!m_context.bindService(new Intent(org.kde.necessitas.ministro.IMinistro.class.getCanonicalName()),
- m_ministroConnection,
- Context.BIND_AUTO_CREATE)) {
- throw new SecurityException("");
- }
- } catch (Exception e) {
- if (firstStart) {
- String msg = "This application requires Ministro service. Would you like to install it?";
- if (m_contextInfo.metaData.containsKey("android.app.ministro_needed_msg"))
- msg = m_contextInfo.metaData.getString("android.app.ministro_needed_msg");
- downloadUpgradeMinistro(msg);
- } else {
- ministroNotFound();
- }
- }
} catch (Exception e) {
Log.e(QtApplication.QtTAG, "Can't create main activity", e);
}