зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1322650 - Add jni::GetAPIVersion() to get Android API version r=jchen
MozReview-Commit-ID: EfPMfS7RmcH
This commit is contained in:
Родитель
daee505699
Коммит
2fec319cd5
|
@ -173,9 +173,7 @@ AndroidBridge::AndroidBridge()
|
|||
AutoJNIClass string(jEnv, "java/lang/String");
|
||||
jStringClass = string.getGlobalRef();
|
||||
|
||||
if (!GetStaticIntField("android/os/Build$VERSION", "SDK_INT", &mAPIVersion, jEnv)) {
|
||||
ALOG_BRIDGE("Failed to find API version");
|
||||
}
|
||||
mAPIVersion = jni::GetAPIVersion();
|
||||
|
||||
AutoJNIClass channels(jEnv, "java/nio/channels/Channels");
|
||||
jChannels = channels.getGlobalRef();
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
[android.os.Build$VERSION]
|
||||
<field> = noLiteral:true
|
|
@ -10,6 +10,7 @@ with Files("**"):
|
|||
# List of stems to generate .cpp and .h files for. To add a stem, add it to
|
||||
# this list and ensure that $(stem)-classes.txt exists in this directory.
|
||||
generated = [
|
||||
'AndroidBuild',
|
||||
'AndroidRect',
|
||||
'KeyEvent',
|
||||
'MediaCodec',
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "mozilla/Assertions.h"
|
||||
|
||||
#include "GeneratedJNIWrappers.h"
|
||||
#include "AndroidBuild.h"
|
||||
#include "nsAppShell.h"
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
|
@ -312,5 +313,13 @@ bool IsFennec()
|
|||
return sIsFennec;
|
||||
}
|
||||
|
||||
int GetAPIVersion() {
|
||||
static int32_t apiVersion = 0;
|
||||
if (!apiVersion) {
|
||||
java::sdk::VERSION::SDK_INT();
|
||||
}
|
||||
return apiVersion;
|
||||
}
|
||||
|
||||
} // jni
|
||||
} // mozilla
|
||||
|
|
|
@ -146,6 +146,8 @@ void DispatchToGeckoPriorityQueue(UniquePtr<AbstractCall>&& aCall);
|
|||
*/
|
||||
bool IsFennec();
|
||||
|
||||
int GetAPIVersion();
|
||||
|
||||
} // jni
|
||||
} // mozilla
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче