Android: Increase minimum API level to Android-23 / Android 6
There are certain APIs we need which cannot be used without this, and in general it simplifies some code. [ChangeLog][Android] Minimum Android version is now Android 6.0, API level 23. Change-Id: I72ca3b429bf48969e16e2bc6b99d9c4af993ea77 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: BogDan Vatra <bogdan@kdab.com>
This commit is contained in:
parent
b4e17a4864
commit
5f1afeacf6
@ -625,7 +625,7 @@ defineTest(qtConfOutput_prepareOptions) {
|
||||
android_abis = armeabi-v7a,arm64-v8a,x86,x86_64
|
||||
platform = $$eval(config.input.android-ndk-platform)
|
||||
isEmpty(platform): \
|
||||
platform = android-21
|
||||
platform = android-23
|
||||
|
||||
$${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-21
|
||||
isEmpty(API_VERSION_TO_USE): API_VERSION_TO_USE = android-23
|
||||
|
||||
ANDROID_JAR_FILE = $$ANDROID_SDK_ROOT/platforms/$$API_VERSION_TO_USE/android.jar
|
||||
!exists($$ANDROID_JAR_FILE) {
|
||||
|
@ -673,7 +673,7 @@ public class ExtractStyle {
|
||||
json.put("gradient",gradientStateClass.getField("mGradient").getInt(obj));
|
||||
GradientDrawable.Orientation orientation=(Orientation) gradientStateClass.getField("mOrientation").get(obj);
|
||||
json.put("orientation",orientation.name());
|
||||
int [] intArray=(int[]) gradientStateClass.getField((Build.VERSION.SDK_INT < 23) ? "mColors" : "mGradientColors").get(obj);
|
||||
int [] intArray=(int[]) gradientStateClass.getField("mGradientColors").get(obj);
|
||||
if (intArray != null)
|
||||
json.put("colors",getJsonArray(intArray, 0, intArray.length));
|
||||
json.put("positions",getJsonArray((float[]) gradientStateClass.getField("mPositions").get(obj)));
|
||||
@ -1089,9 +1089,7 @@ public class ExtractStyle {
|
||||
{
|
||||
try {
|
||||
InsetDrawable d = (InsetDrawable)drawable;
|
||||
// mInsetState changed to mState in Android 5.1 (22)
|
||||
Object mInsetStateObject = getAccessibleField(InsetDrawable.class, (Build.VERSION.SDK_INT > 21) ? "mState"
|
||||
: "mInsetState").get(d);
|
||||
Object mInsetStateObject = getAccessibleField(InsetDrawable.class, "mState").get(d);
|
||||
Rect _padding = new Rect();
|
||||
boolean hasPadding = d.getPadding(_padding);
|
||||
return getDrawable(getAccessibleField(mInsetStateObject.getClass(), "mDrawable").get(mInsetStateObject), filename, hasPadding ? _padding : null);
|
||||
|
@ -704,14 +704,9 @@ public class QtNative
|
||||
synchronized (m_mainActivityMutex) {
|
||||
Context context = getContext();
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
if (m_checkSelfPermissionMethod == null)
|
||||
m_checkSelfPermissionMethod = Context.class.getMethod("checkSelfPermission", String.class);
|
||||
perm = (Integer)m_checkSelfPermissionMethod.invoke(context, permission);
|
||||
} else {
|
||||
final PackageManager pm = context.getPackageManager();
|
||||
perm = pm.checkPermission(permission, context.getApplicationContext().getPackageName());
|
||||
}
|
||||
if (m_checkSelfPermissionMethod == null)
|
||||
m_checkSelfPermissionMethod = Context.class.getMethod("checkSelfPermission", String.class);
|
||||
perm = (Integer)m_checkSelfPermissionMethod.invoke(context, permission);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -93,13 +93,8 @@ public class QtActivity extends Activity
|
||||
public QtActivity()
|
||||
{
|
||||
m_loader = new QtActivityLoader(this);
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
QT_ANDROID_THEMES = new String[] {"Theme_Holo_Light"};
|
||||
QT_ANDROID_DEFAULT_THEME = "Theme_Holo_Light";
|
||||
} else {
|
||||
QT_ANDROID_THEMES = new String[] {"Theme_DeviceDefault_Light"};
|
||||
QT_ANDROID_DEFAULT_THEME = "Theme_DeviceDefault_Light";
|
||||
}
|
||||
QT_ANDROID_THEMES = new String[] {"Theme_Holo_Light"};
|
||||
QT_ANDROID_DEFAULT_THEME = "Theme_Holo_Light";
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<manifest package="org.qtproject.example" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="-- %%INSERT_VERSION_NAME%% --" android:versionCode="-- %%INSERT_VERSION_CODE%% --" android:installLocation="auto">
|
||||
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28"/>
|
||||
<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="28"/>
|
||||
|
||||
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
|
||||
Remove the comment if you do not require these default permissions. -->
|
||||
|
@ -1425,8 +1425,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() < 21) {
|
||||
fprintf(stderr, "Invalid minSdkVersion version, minSdkVersion must be >= 21\n");
|
||||
if (reader.attributes().value(QLatin1String("android:minSdkVersion")).toInt() < 23) {
|
||||
fprintf(stderr, "Invalid minSdkVersion version, minSdkVersion must be >= 23\n");
|
||||
return false;
|
||||
}
|
||||
} else if ((reader.name() == QLatin1String("application") ||
|
||||
|
Loading…
Reference in New Issue
Block a user