Android: Set minimum supported version to android-21
With the current distribution, this is 90% of active devices, and it was released in 2014. Qt 5.12 is LTS and will continue to support older Android versions for a long time to come. This is to reduce the testing needed on outdated platforms and allow ourselves to use some newer APIs unconditionally in Qt. Android 21 was chosen because it is the minimum version that supports 64 bit builds. [ChangeLog][Android] Increased the minimum supported Android version to Android 5.0 (API level 21). Fixes: QTBUG-70508 Change-Id: Ia7b4345e42ca05a25a292f11ccbb8cbd692cf8f0 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
This commit is contained in:
parent
aa32510430
commit
e0dc6dce22
@ -618,14 +618,8 @@ defineTest(qtConfOutput_prepareOptions) {
|
||||
target_arch = armeabi-v7a
|
||||
|
||||
platform = $$eval(config.input.android-ndk-platform)
|
||||
isEmpty(platform): equals(target_arch, arm64-v8a): \
|
||||
platform = android-21
|
||||
|
||||
isEmpty(platform): equals(target_arch, x86_64): \
|
||||
platform = android-21
|
||||
|
||||
isEmpty(platform): \
|
||||
platform = android-16 ### the windows configure disagrees ...
|
||||
platform = android-21
|
||||
|
||||
$${currentConfig}.output.devicePro += \
|
||||
"DEFAULT_ANDROID_SDK_ROOT = $$val_escape(sdk_root)" \
|
||||
|
@ -1,6 +1,6 @@
|
||||
API_VERSION_TO_USE = $$(ANDROID_API_VERSION)
|
||||
isEmpty(API_VERSION_TO_USE): API_VERSION_TO_USE = $$API_VERSION
|
||||
isEmpty(API_VERSION_TO_USE): API_VERSION_TO_USE = android-16
|
||||
isEmpty(API_VERSION_TO_USE): API_VERSION_TO_USE = android-21
|
||||
|
||||
ANDROID_JAR_FILE = $$ANDROID_SDK_ROOT/platforms/$$API_VERSION_TO_USE/android.jar
|
||||
!exists($$ANDROID_JAR_FILE) {
|
||||
|
@ -2,7 +2,6 @@ TARGET = QtAndroid
|
||||
|
||||
CONFIG += java
|
||||
DESTDIR = $$[QT_INSTALL_PREFIX/get]/jar
|
||||
API_VERSION = android-16
|
||||
|
||||
PATHPREFIX = $$PWD/src/org/qtproject/qt5/android/
|
||||
|
||||
|
@ -89,8 +89,6 @@ import android.view.inputmethod.EditorInfo;
|
||||
|
||||
public class ExtractStyle {
|
||||
|
||||
native static int[] extractChunkInfo(byte[] chunkData);
|
||||
native static int[] extractNativeChunkInfo(int nativeChunk);
|
||||
native static int[] extractChunkInfo20(byte[] chunkData);
|
||||
native static int[] extractNativeChunkInfo20(long nativeChunk);
|
||||
|
||||
@ -345,10 +343,7 @@ public class ExtractStyle {
|
||||
}
|
||||
|
||||
public void drawPatch(Bitmap bmp, byte[] chunks, RectF dst, Paint paint) {
|
||||
if (Build.VERSION.SDK_INT > 19)
|
||||
chunkData = extractChunkInfo20(chunks);
|
||||
else
|
||||
chunkData = extractChunkInfo(chunks);
|
||||
chunkData = extractChunkInfo20(chunks);
|
||||
}
|
||||
}
|
||||
|
||||
@ -698,10 +693,6 @@ public class ExtractStyle {
|
||||
json.put("thicknessRatio",gradientStateClass.getField("mThicknessRatio").getFloat(obj));
|
||||
json.put("innerRadius",gradientStateClass.getField("mInnerRadius").getInt(obj));
|
||||
json.put("thickness",gradientStateClass.getField("mThickness").getInt(obj));
|
||||
if (Build.VERSION.SDK_INT < 20) {
|
||||
json.put("solidColor",gradientStateClass.getField("mSolidColor").getInt(obj));
|
||||
json.put("strokeColor",gradientStateClass.getField("mStrokeColor").getInt(obj));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -802,14 +793,7 @@ public class ExtractStyle {
|
||||
Object state = getAccessibleField(NinePatchDrawable.class, "mNinePatchState").get(d);
|
||||
np = (NinePatch) getAccessibleField(state.getClass(), "mNinePatch").get(state);
|
||||
}
|
||||
if (Build.VERSION.SDK_INT < 19)
|
||||
return getJsonChunkInfo(extractChunkInfo((byte[]) getAccessibleField(np.getClass(), "mChunk").get(np)));
|
||||
else
|
||||
{
|
||||
if (Build.VERSION.SDK_INT > 19)
|
||||
return getJsonChunkInfo(extractNativeChunkInfo20(getAccessibleField(np.getClass(), "mNativeChunk").getLong(np)));
|
||||
return getJsonChunkInfo(extractNativeChunkInfo(getAccessibleField(np.getClass(), "mNativeChunk").getInt(np)));
|
||||
}
|
||||
return getJsonChunkInfo(extractNativeChunkInfo20(getAccessibleField(np.getClass(), "mNativeChunk").getLong(np)));
|
||||
}
|
||||
|
||||
class DrawableCache
|
||||
@ -1016,16 +1000,12 @@ public class ExtractStyle {
|
||||
json.put("gravity", bitmapDrawable.getGravity());
|
||||
json.put("tileModeX", bitmapDrawable.getTileModeX());
|
||||
json.put("tileModeY", bitmapDrawable.getTileModeY());
|
||||
if (Build.VERSION.SDK_INT >= 18) {
|
||||
json.put("antialias", (Boolean) BitmapDrawable.class.getMethod("hasAntiAlias").invoke(bitmapDrawable));
|
||||
json.put("mipMap", (Boolean) BitmapDrawable.class.getMethod("hasMipMap").invoke(bitmapDrawable));
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
json.put("tintMode", (PorterDuff.Mode) BitmapDrawable.class.getMethod("getTintMode").invoke(bitmapDrawable));
|
||||
ColorStateList tintList = (ColorStateList) BitmapDrawable.class.getMethod("getTint").invoke(bitmapDrawable);
|
||||
if (tintList != null)
|
||||
json.put("tintList", getColorStateList(tintList));
|
||||
}
|
||||
json.put("antialias", (Boolean) BitmapDrawable.class.getMethod("hasAntiAlias").invoke(bitmapDrawable));
|
||||
json.put("mipMap", (Boolean) BitmapDrawable.class.getMethod("hasMipMap").invoke(bitmapDrawable));
|
||||
json.put("tintMode", (PorterDuff.Mode) BitmapDrawable.class.getMethod("getTintMode").invoke(bitmapDrawable));
|
||||
ColorStateList tintList = (ColorStateList) BitmapDrawable.class.getMethod("getTint").invoke(bitmapDrawable);
|
||||
if (tintList != null)
|
||||
json.put("tintList", getColorStateList(tintList));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -1758,10 +1738,8 @@ public class ExtractStyle {
|
||||
json.put("Switch_switchPadding", a.getDimensionPixelSize(getField(styleableClass, "Switch_switchPadding"), 0));
|
||||
json.put("Switch_thumbTextPadding", a.getDimensionPixelSize(getField(styleableClass, "Switch_thumbTextPadding"), 0));
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
json.put("Switch_showText", a.getBoolean(getField(styleableClass, "Switch_showText"), true));
|
||||
json.put("Switch_splitTrack", a.getBoolean(getField(styleableClass, "Switch_splitTrack"), false));
|
||||
}
|
||||
json.put("Switch_showText", a.getBoolean(getField(styleableClass, "Switch_showText"), true));
|
||||
json.put("Switch_splitTrack", a.getBoolean(getField(styleableClass, "Switch_splitTrack"), false));
|
||||
|
||||
a.recycle();
|
||||
jsonWriter.name(styleName).value(json);
|
||||
|
@ -161,15 +161,13 @@ public class QtActivityDelegate
|
||||
m_activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
m_activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT >= 19) {
|
||||
int flags = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
|
||||
flags |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
|
||||
flags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
|
||||
flags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
|
||||
flags |= View.SYSTEM_UI_FLAG_FULLSCREEN;
|
||||
flags |= View.class.getDeclaredField("SYSTEM_UI_FLAG_IMMERSIVE_STICKY").getInt(null);
|
||||
m_activity.getWindow().getDecorView().setSystemUiVisibility(flags | View.INVISIBLE);
|
||||
}
|
||||
int flags = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
|
||||
flags |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
|
||||
flags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
|
||||
flags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
|
||||
flags |= View.SYSTEM_UI_FLAG_FULLSCREEN;
|
||||
flags |= View.class.getDeclaredField("SYSTEM_UI_FLAG_IMMERSIVE_STICKY").getInt(null);
|
||||
m_activity.getWindow().getDecorView().setSystemUiVisibility(flags | View.INVISIBLE);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ public class QtActivityLoader extends QtLoader {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT < 16) {
|
||||
if (Build.VERSION.SDK_INT < 21) {
|
||||
// fatal error, show the error and quit
|
||||
AlertDialog errorDialog = new AlertDialog.Builder(m_activity).create();
|
||||
if (m_contextInfo.metaData.containsKey("android.app.unsupported_android_version"))
|
||||
|
@ -70,7 +70,7 @@
|
||||
|
||||
</application>
|
||||
|
||||
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="28"/>
|
||||
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28"/>
|
||||
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
|
||||
|
||||
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
|
||||
|
@ -239,10 +239,7 @@ QString QStandardPaths::writableLocation(StandardLocation type)
|
||||
case QStandardPaths::PicturesLocation:
|
||||
return getExternalStoragePublicDirectory("DIRECTORY_PICTURES");
|
||||
case QStandardPaths::DocumentsLocation:
|
||||
if (QtAndroidPrivate::androidSdkVersion() > 18)
|
||||
return getExternalStoragePublicDirectory("DIRECTORY_DOCUMENTS");
|
||||
else
|
||||
return getExternalStorageDirectory() + QLatin1String("/Documents");
|
||||
return getExternalStoragePublicDirectory("DIRECTORY_DOCUMENTS");
|
||||
case QStandardPaths::DownloadLocation:
|
||||
return getExternalStoragePublicDirectory("DIRECTORY_DOWNLOADS");
|
||||
case QStandardPaths::GenericConfigLocation:
|
||||
@ -295,13 +292,8 @@ QStringList QStandardPaths::standardLocations(StandardLocation type)
|
||||
}
|
||||
|
||||
if (type == DocumentsLocation) {
|
||||
if (QtAndroidPrivate::androidSdkVersion() > 18) {
|
||||
return QStringList() << writableLocation(type)
|
||||
<< getExternalFilesDir("DIRECTORY_DOCUMENTS");
|
||||
} else {
|
||||
return QStringList() << writableLocation(type)
|
||||
<< getExternalFilesDir() + QLatin1String("/Documents");
|
||||
}
|
||||
return QStringList() << writableLocation(type)
|
||||
<< getExternalFilesDir("DIRECTORY_DOCUMENTS");
|
||||
}
|
||||
|
||||
if (type == DownloadLocation) {
|
||||
|
@ -332,14 +332,6 @@ void QEGLPlatformContext::updateFormatFromGL()
|
||||
QByteArray version = QByteArray(reinterpret_cast<const char *>(s));
|
||||
int major, minor;
|
||||
if (QPlatformOpenGLContext::parseOpenGLVersion(version, major, minor)) {
|
||||
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
|
||||
// Some Android 4.2.2 devices report OpenGL ES 3.0 without the functions being available.
|
||||
static int apiLevel = QtAndroidPrivate::androidSdkVersion();
|
||||
if (apiLevel <= 17 && major >= 3) {
|
||||
major = 2;
|
||||
minor = 0;
|
||||
}
|
||||
#endif
|
||||
m_format.setMajorVersion(major);
|
||||
m_format.setMinorVersion(minor);
|
||||
}
|
||||
|
@ -329,10 +329,7 @@ if (!clazz) { \
|
||||
GET_AND_CHECK_STATIC_METHOD(m_setFocusedMethodID, nodeInfoClass, "setFocused", "(Z)V");
|
||||
GET_AND_CHECK_STATIC_METHOD(m_setScrollableMethodID, nodeInfoClass, "setScrollable", "(Z)V");
|
||||
GET_AND_CHECK_STATIC_METHOD(m_setVisibleToUserMethodID, nodeInfoClass, "setVisibleToUser", "(Z)V");
|
||||
|
||||
if (QtAndroidPrivate::androidSdkVersion() >= 18) {
|
||||
GET_AND_CHECK_STATIC_METHOD(m_setTextSelectionMethodID, nodeInfoClass, "setTextSelection", "(II)V");
|
||||
}
|
||||
GET_AND_CHECK_STATIC_METHOD(m_setTextSelectionMethodID, nodeInfoClass, "setTextSelection", "(II)V");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -40,16 +40,6 @@
|
||||
#include <jni.h>
|
||||
#include <extract.h>
|
||||
|
||||
extern "C" JNIEXPORT jintArray JNICALL Java_org_qtproject_qt5_android_ExtractStyle_extractNativeChunkInfo(JNIEnv *, jobject, Res_png_9patch*)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT jintArray JNICALL Java_org_qtproject_qt5_android_ExtractStyle_extractChunkInfo(JNIEnv *, jobject, jbyteArray)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT jintArray JNICALL Java_org_qtproject_qt5_android_ExtractStyle_extractNativeChunkInfo20(JNIEnv *, jobject, long)
|
||||
{
|
||||
return 0;
|
||||
|
@ -48,46 +48,6 @@
|
||||
#define LOG_TAG "extractSyleInfo"
|
||||
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
|
||||
|
||||
extern "C" JNIEXPORT jintArray JNICALL Java_org_qtproject_qt5_android_ExtractStyle_extractNativeChunkInfo(JNIEnv * env, jobject, Res_png_9patch* chunk)
|
||||
{
|
||||
Res_png_9patch::deserialize(chunk);
|
||||
//printChunkInformation(chunk);
|
||||
jintArray result;
|
||||
size_t size = 3+chunk->numXDivs+chunk->numYDivs+chunk->numColors;
|
||||
result = env->NewIntArray(size);
|
||||
if (!result)
|
||||
return 0;
|
||||
|
||||
jint *data = (jint*)malloc(sizeof(jint)*size);
|
||||
size_t pos = 0;
|
||||
data[pos++]=chunk->numXDivs;
|
||||
data[pos++]=chunk->numYDivs;
|
||||
data[pos++]=chunk->numColors;
|
||||
for (int x = 0; x <chunk->numXDivs; x ++)
|
||||
data[pos++]=chunk->xDivs[x];
|
||||
for (int y = 0; y <chunk->numYDivs; y ++)
|
||||
data[pos++]=chunk->yDivs[y];
|
||||
for (int c = 0; c <chunk->numColors; c ++)
|
||||
data[pos++]=chunk->colors[c];
|
||||
env->SetIntArrayRegion(result, 0, size, data);
|
||||
free(data);
|
||||
return result;
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT jintArray JNICALL Java_org_qtproject_qt5_android_ExtractStyle_extractChunkInfo(JNIEnv * env, jobject obj, jbyteArray chunkObj)
|
||||
{
|
||||
size_t chunkSize = env->GetArrayLength(chunkObj);
|
||||
void* storage = alloca(chunkSize);
|
||||
env->GetByteArrayRegion(chunkObj, 0, chunkSize,
|
||||
reinterpret_cast<jbyte*>(storage));
|
||||
|
||||
if (!env->ExceptionCheck())
|
||||
return Java_org_qtproject_qt5_android_ExtractStyle_extractNativeChunkInfo(env, obj, static_cast<Res_png_9patch*>(storage));
|
||||
else
|
||||
env->ExceptionClear();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// The following part was shamelessly stolen from ResourceTypes.cpp from Android's sources
|
||||
/*
|
||||
* Copyright (C) 2005 The Android Open Source Project
|
||||
|
@ -1369,8 +1369,8 @@ bool updateAndroidManifest(Options &options)
|
||||
options.packageName = reader.attributes().value(QLatin1String("package")).toString();
|
||||
} else if (reader.name() == QLatin1String("uses-sdk")) {
|
||||
if (reader.attributes().hasAttribute(QLatin1String("android:minSdkVersion")))
|
||||
if (reader.attributes().value(QLatin1String("android:minSdkVersion")).toInt() < 16) {
|
||||
fprintf(stderr, "Invalid minSdkVersion version, minSdkVersion must be >= 16\n");
|
||||
if (reader.attributes().value(QLatin1String("android:minSdkVersion")).toInt() < 21) {
|
||||
fprintf(stderr, "Invalid minSdkVersion version, minSdkVersion must be >= 21\n");
|
||||
return false;
|
||||
}
|
||||
} else if ((reader.name() == QLatin1String("application") ||
|
||||
|
Loading…
x
Reference in New Issue
Block a user