diff --git a/build/config/android/config.gni b/build/config/android/config.gni index b46e8237a42..dfeccda917d 100644 --- a/build/config/android/config.gni +++ b/build/config/android/config.gni @@ -73,7 +73,7 @@ if (is_android) { if (current_cpu == "riscv64") { android_api_level = 35 } else { - android_api_level = 21 + android_api_level = 24 } # Toolchain root directory for each build. The actual binaries are inside diff --git a/runtime/platform/utils_android.h b/runtime/platform/utils_android.h index a824443830a..6c22837994f 100644 --- a/runtime/platform/utils_android.h +++ b/runtime/platform/utils_android.h @@ -38,10 +38,15 @@ inline uint64_t Utils::HostToLittleEndian64(uint64_t value) { } inline char* Utils::StrError(int err, char* buffer, size_t bufsize) { - if (strerror_r(err, buffer, bufsize) != 0) { +#if defined(__USE_GNU) && __ANDROID_API__ >= 23 + return strerror_r(err, buffer, bufsize); +#else + int result = strerror_r(err, buffer, bufsize); + if (result != 0) { snprintf(buffer, bufsize, "%s", "strerror_r failed"); } return buffer; +#endif } } // namespace dart diff --git a/tests/standalone/io/unix_socket_test.dart b/tests/standalone/io/unix_socket_test.dart index e99c0a6e846..10ac7079b9d 100644 --- a/tests/standalone/io/unix_socket_test.dart +++ b/tests/standalone/io/unix_socket_test.dart @@ -303,7 +303,7 @@ Future testSetSockOpt(String name) async { ); var result = socket.getRawOption(option); } catch (e) { - Expect.isTrue(e.toString().contains('Operation not supported')); + Expect.contains('Operation not supported', e.toString()); } } @@ -316,7 +316,7 @@ Future testSetSockOpt(String name) async { ); var result = socket.getRawOption(option); } catch (e) { - Expect.isTrue(e.toString().contains('Operation not supported')); + Expect.contains('Operation not supported', e.toString()); } } @@ -329,7 +329,7 @@ Future testSetSockOpt(String name) async { ); var result = socket.getRawOption(option); } catch (e) { - Expect.isTrue(e.toString().contains('Operation not supported')); + Expect.contains('Operation not supported', e.toString()); } } @@ -342,7 +342,7 @@ Future testSetSockOpt(String name) async { ); var result = socket.getRawOption(option); } catch (e) { - Expect.isTrue(e.toString().contains('Operation not supported')); + Expect.contains('Operation not supported', e.toString()); } } @@ -355,7 +355,7 @@ Future testSetSockOpt(String name) async { ); var result = socket.getRawOption(option); } catch (e) { - Expect.isTrue(e.toString().contains('Protocol not available')); + Expect.contains('Protocol not available', e.toString()); } } @@ -368,7 +368,7 @@ Future testSetSockOpt(String name) async { ); var result = socket.getRawOption(option); } catch (e) { - Expect.isTrue(e.toString().contains('Operation not supported')); + Expect.contains('Operation not supported', e.toString()); } } @@ -381,7 +381,7 @@ Future testSetSockOpt(String name) async { ); var result = socket.getRawOption(option); } catch (e) { - Expect.isTrue(e.toString().contains('Operation not supported')); + Expect.contains('Operation not supported', e.toString()); } } @@ -389,7 +389,7 @@ Future testSetSockOpt(String name) async { try { socket.setOption(SocketOption.tcpNoDelay, true); } catch (e) { - Expect.isTrue(e.toString().contains('Operation not supported')); + Expect.contains('Operation not supported', e.toString()); } for (int i = 0; i < 5; i++) { @@ -401,7 +401,7 @@ Future testSetSockOpt(String name) async { ); var result = socket.setRawOption(option); } catch (e) { - Expect.isTrue(e.toString().contains('Operation not supported')); + Expect.contains('Operation not supported', e.toString()); } } @@ -414,7 +414,7 @@ Future testSetSockOpt(String name) async { ); var result = socket.setRawOption(option); } catch (e) { - Expect.isTrue(e.toString().contains('Operation not supported')); + Expect.contains('Operation not supported', e.toString()); } } @@ -427,7 +427,7 @@ Future testSetSockOpt(String name) async { ); var result = socket.setRawOption(option); } catch (e) { - Expect.isTrue(e.toString().contains('Operation not supported')); + Expect.contains('Operation not supported', e.toString()); } } @@ -440,7 +440,7 @@ Future testSetSockOpt(String name) async { ); var result = socket.setRawOption(option); } catch (e) { - Expect.isTrue(e.toString().contains('Operation not supported')); + Expect.contains('Operation not supported', e.toString()); } } @@ -453,7 +453,7 @@ Future testSetSockOpt(String name) async { ); var result = socket.setRawOption(option); } catch (e) { - Expect.isTrue(e.toString().contains('Protocol not available')); + Expect.contains('Protocol not available', e.toString()); } } @@ -466,7 +466,7 @@ Future testSetSockOpt(String name) async { ); var result = socket.setRawOption(option); } catch (e) { - Expect.isTrue(e.toString().contains('Operation not supported')); + Expect.contains('Operation not supported', e.toString()); } } @@ -479,7 +479,7 @@ Future testSetSockOpt(String name) async { ); var result = socket.setRawOption(option); } catch (e) { - Expect.isTrue(e.toString().contains('Operation not supported')); + Expect.contains('Operation not supported', e.toString()); } } @@ -1230,7 +1230,7 @@ void main(List args) async { Expect.fail("Unexpected exception $e is thrown:\n$st"); } else { Expect.isTrue(e is SocketException); - Expect.isTrue(e.toString().contains('not available')); + Expect.contains('not available', e.toString()); } }, );