X

Google Adopting Rust for Android Will Make The More Stable And Safe

android new logo 2019
Advertisement
Advertisement

According to ArsTechnica Google is beginning to adopt Rust for Android more. Linux began taking steps toward supporting the language recently. For those who do not know, Rust is a memory-managed programming language. Google is in the same boat as Linux in adopting Rust.

The search giant says as much in a blog post they put out Tuesday, April 6. The Android Open Source Project now officially supports Rust for low-level components. Kotlin is the language that the Android team really pushes hard. Java is also pushed, but both Kotlin and Java rely on the Android Runtime to function.

C and C++ were also used before, but neither of the C languages is memory-managed. Unfortunately, this leaves Android prone to memory leaks and buffer overflows. The benefits of rust are laid out by Google in its blog post.

Advertisement

The company says “Rust provides memory safety guarantees by using a combination of compile-time checks to enforce object lifetime/ownership and runtime checks to ensure that memory accesses are valid. This safety is achieved while providing equivalent performance to C and C++.”

In addition, the company points out that “memory safety bugs continue to be a top contributor of stability issues, and consistently represents ~ 70% of Android’s high severity security vulnerabilities.”

Google adopting Rust for Android will make the OS more stable

Google goes on to say that tens of millions of lines of current C and C++ Android code in Rust is not feasible. As a result of this, rewriting old Android wouldn’t matter much since old code has most of the bugs fixed by now.

Sponsored Video

The Android source code is open source, and that means billions of users are using it. The search giant also says that most memory bugs occur in new or recently modified code, with about 50% being less than a year old. New components will utilize Rust when necessary.

This should help to reduce new memory bugs from popping up due to Google’s tinkering. Over a period of 18 months, Google has been adding Rust support into the Android Open Source Project. The company has other related early adopter projects in the works too, and notes that it will be sharing those down the line. Albeit without mentioning a general time frame on that.

Google says this is a multi-year project. So it won’t be anytime soon before this is all completed. But it does seem necessary from Google’s point of view.

Advertisement

Doing this can improve Android overall and help make it more efficient. Google doing this should help future iterations of Android easier to use, and to program for developers.