MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / GetAndroidSdkVersion

Function GetAndroidSdkVersion

tensorflow/lite/nnapi/nnapi_implementation.cc:34–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32
33#ifdef __ANDROID__
34int32_t GetAndroidSdkVersion() {
35 const char* sdkProp = "ro.build.version.sdk";
36 char sdkVersion[PROP_VALUE_MAX];
37 int length = __system_property_get(sdkProp, sdkVersion);
38 if (length != 0) {
39 int32_t result = 0;
40 for (int i = 0; i < length; ++i) {
41 int digit = sdkVersion[i] - '0';
42 if (digit < 0 || digit > 9) {
43 // Non-numeric SDK version, assume it's higher than expected;
44 return 0xffff;
45 }
46 result = result * 10 + digit;
47 }
48 // TODO(levp): remove once SDK gets updated to 29th level
49 // Upgrade SDK version for pre-release Q to be able to test functionality
50 // available from SDK level 29.
51 if (result == 28) {
52 char versionCodename[PROP_VALUE_MAX];
53 const char* versionCodenameProp = "ro.build.version.codename";
54 length = __system_property_get(versionCodenameProp, versionCodename);
55 if (length != 0) {
56 if (versionCodename[0] == 'Q') {
57 return 29;
58 }
59 }
60 }
61 return result;
62 }
63 return 0;
64}
65#endif // __ANDROID__
66
67void* LoadFunction(void* handle, const char* name, bool optional) {

Callers 1

LoadNnApiFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected