Android: Update version names on QSysInfo and QOperatingSystemVersion
Add latest versions that were missing in QOperatingSystemVersion and the version names used with QSysInfo::prettyProductName(). Change-Id: I933158898f9ec39f1c224e15fd6456b7e0546a67 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This commit is contained in:
parent
9ff87af7af
commit
14278bb250
@ -15,6 +15,7 @@
|
||||
#include <qdebug.h>
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
#include <QtCore/private/qjnihelpers_p.h>
|
||||
#include <QJniObject>
|
||||
#endif
|
||||
|
||||
@ -179,11 +180,13 @@ QOperatingSystemVersionBase QOperatingSystemVersionBase::current_impl()
|
||||
{ 9, 0 }, // API level 28
|
||||
{ 10, 0 }, // API level 29
|
||||
{ 11, 0 }, // API level 30
|
||||
{ 12, 0 }, // API level 31
|
||||
{ 12, 0 }, // API level 32
|
||||
{ 13, 0 }, // API level 33
|
||||
};
|
||||
|
||||
// This will give us at least the first 2 version components
|
||||
const size_t versionIdx = size_t(QJniObject::getStaticField<jint>(
|
||||
"android/os/Build$VERSION", "SDK_INT")) - 1;
|
||||
const size_t versionIdx = QtAndroidPrivate::androidSdkVersion() - 1;
|
||||
if (versionIdx < sizeof(versions) / sizeof(versions[0])) {
|
||||
version.m_major = versions[versionIdx].major;
|
||||
version.m_minor = versions[versionIdx].minor;
|
||||
@ -657,6 +660,32 @@ const QOperatingSystemVersion QOperatingSystemVersion::Android10 =
|
||||
const QOperatingSystemVersion QOperatingSystemVersion::Android11 =
|
||||
QOperatingSystemVersion(QOperatingSystemVersion::Android, 11, 0);
|
||||
|
||||
/*!
|
||||
\variable QOperatingSystemVersion::Android12
|
||||
\brief a version corresponding to Android 12 (version 12.0, API level 31).
|
||||
\since 6.5
|
||||
*/
|
||||
const QOperatingSystemVersion QOperatingSystemVersion::Android12 =
|
||||
QOperatingSystemVersion(QOperatingSystemVersion::Android, 12, 0);
|
||||
|
||||
/*!
|
||||
\variable QOperatingSystemVersion::Android12L
|
||||
\brief a version corresponding to Android 12L (version 12.0, API level 32).
|
||||
\since 6.5
|
||||
*/
|
||||
const QOperatingSystemVersion QOperatingSystemVersion::Android12L =
|
||||
QOperatingSystemVersion(QOperatingSystemVersion::Android, 12, 0);
|
||||
|
||||
/*!
|
||||
\variable QOperatingSystemVersion::Android13
|
||||
\brief a version corresponding to Android 13 (version 13.0, API level 33).
|
||||
\since 6.5
|
||||
*/
|
||||
const QOperatingSystemVersion QOperatingSystemVersion::Android13 =
|
||||
QOperatingSystemVersion(QOperatingSystemVersion::Android, 13, 0);
|
||||
|
||||
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
QDebug operator<<(QDebug debug, const QOperatingSystemVersion &ov)
|
||||
{
|
||||
|
@ -152,6 +152,9 @@ public:
|
||||
static const QOperatingSystemVersion AndroidPie;
|
||||
static const QOperatingSystemVersion Android10;
|
||||
static const QOperatingSystemVersion Android11;
|
||||
static const QOperatingSystemVersion Android12;
|
||||
static const QOperatingSystemVersion Android12L;
|
||||
static const QOperatingSystemVersion Android13;
|
||||
#else
|
||||
static constexpr QOperatingSystemVersionBase Windows7 { QOperatingSystemVersionBase::Windows, 6, 1 };
|
||||
static constexpr QOperatingSystemVersionBase Windows8 { QOperatingSystemVersionBase::Windows, 6, 2 };
|
||||
@ -186,6 +189,9 @@ public:
|
||||
static constexpr QOperatingSystemVersionBase AndroidPie { QOperatingSystemVersionBase::Android, 9, 0 };
|
||||
static constexpr QOperatingSystemVersionBase Android10 { QOperatingSystemVersionBase::Android, 10, 0 };
|
||||
static constexpr QOperatingSystemVersionBase Android11 { QOperatingSystemVersionBase::Android, 11, 0 };
|
||||
static constexpr QOperatingSystemVersionBase Android12 { QOperatingSystemVersionBase::Android, 12, 0 };
|
||||
static constexpr QOperatingSystemVersionBase Android12L { QOperatingSystemVersionBase::Android, 12, 0 };
|
||||
static constexpr QOperatingSystemVersionBase Android13 { QOperatingSystemVersionBase::Android, 13, 0 };
|
||||
#endif // New (static constexpr) entries go here, only cherry-pick as far back as 6.3 (QTBUG-97808):
|
||||
|
||||
static constexpr QOperatingSystemVersionBase Windows10_1809 { QOperatingSystemVersionBase::Windows, 10, 0, 17763 }; // RS5
|
||||
|
@ -16,6 +16,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
#include <QtCore/private/qjnihelpers_p.h>
|
||||
#include <qjniobject.h>
|
||||
#endif
|
||||
|
||||
@ -408,65 +409,65 @@ static bool findUnixOsVersion(QUnixOSVersion &v)
|
||||
#ifdef Q_OS_ANDROID
|
||||
static const char *osVer_helper(QOperatingSystemVersion)
|
||||
{
|
||||
/* Data:
|
||||
|
||||
|
||||
|
||||
Cupcake
|
||||
Donut
|
||||
Eclair
|
||||
Eclair
|
||||
Eclair
|
||||
Froyo
|
||||
Gingerbread
|
||||
Gingerbread
|
||||
Honeycomb
|
||||
Honeycomb
|
||||
Honeycomb
|
||||
Ice Cream Sandwich
|
||||
Ice Cream Sandwich
|
||||
Jelly Bean
|
||||
Jelly Bean
|
||||
Jelly Bean
|
||||
KitKat
|
||||
KitKat
|
||||
Lollipop
|
||||
Lollipop
|
||||
Marshmallow
|
||||
Nougat
|
||||
Nougat
|
||||
Oreo
|
||||
*/
|
||||
static const char versions_string[] =
|
||||
"\0"
|
||||
"Cupcake\0"
|
||||
"Donut\0"
|
||||
"Eclair\0"
|
||||
"Froyo\0"
|
||||
"Gingerbread\0"
|
||||
"Honeycomb\0"
|
||||
"Ice Cream Sandwich\0"
|
||||
"Jelly Bean\0"
|
||||
"KitKat\0"
|
||||
"Lollipop\0"
|
||||
"Marshmallow\0"
|
||||
"Nougat\0"
|
||||
"Oreo\0"
|
||||
"\0";
|
||||
|
||||
static const int versions_indices[] = {
|
||||
0, 0, 0, 1, 9, 15, 15, 15,
|
||||
22, 28, 28, 40, 40, 40, 50, 50,
|
||||
69, 69, 69, 80, 80, 87, 87, 96,
|
||||
108, 108, 115, -1
|
||||
};
|
||||
|
||||
static const int versions_count = (sizeof versions_indices) / (sizeof versions_indices[0]);
|
||||
|
||||
// https://source.android.com/source/build-numbers.html
|
||||
// https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels
|
||||
const int sdk_int = QJniObject::getStaticField<jint>("android/os/Build$VERSION", "SDK_INT");
|
||||
return &versions_string[versions_indices[qBound(0, sdk_int, versions_count - 1)]];
|
||||
const int sdk_int = QtAndroidPrivate::androidSdkVersion();
|
||||
switch (sdk_int) {
|
||||
case 3:
|
||||
return "Cupcake";
|
||||
case 4:
|
||||
return "Donut";
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
return "Eclair";
|
||||
case 8:
|
||||
return "Froyo";
|
||||
case 9:
|
||||
case 10:
|
||||
return "Gingerbread";
|
||||
case 11:
|
||||
case 12:
|
||||
case 13:
|
||||
return "Honeycomb";
|
||||
case 14:
|
||||
case 15:
|
||||
return "Ice Cream Sandwich";
|
||||
case 16:
|
||||
case 17:
|
||||
case 18:
|
||||
return "Jelly Bean";
|
||||
case 19:
|
||||
case 20:
|
||||
return "KitKat";
|
||||
case 21:
|
||||
case 22:
|
||||
return "Lollipop";
|
||||
case 23:
|
||||
return "Marshmallow";
|
||||
case 24:
|
||||
case 25:
|
||||
return "Nougat";
|
||||
case 26:
|
||||
case 27:
|
||||
return "Oreo";
|
||||
case 28:
|
||||
return "Pie";
|
||||
case 29:
|
||||
return "10";
|
||||
case 30:
|
||||
return "11";
|
||||
case 31:
|
||||
return "12";
|
||||
case 32:
|
||||
return "12L";
|
||||
case 33:
|
||||
return "13";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user