Skip to content

Commit 27a5836

Browse files
mgeislergribozavr
andauthored
docs: improve language in Android section (#2890)
I asked Gemini to review the English for inconsistencies and grammar mistakes. This is the result and I hope it's useful! As a non-native speaker, it is hard for me to evaluate the finer details, so let me know if you would like to see changes (or even better: make them directly in the PR with the suggestion function). --------- Co-authored-by: Dmitri Gribenko <gribozavr@gmail.com>
1 parent 56a3b7c commit 27a5836

File tree

12 files changed

+37
-41
lines changed

12 files changed

+37
-41
lines changed

src/android/aidl.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
# AIDL
22

3-
The
4-
[Android Interface Definition Language
5-
(AIDL)](https://developer.android.com/guide/components/aidl) is supported in
6-
Rust:
3+
Rust supports the
4+
[Android Interface Definition Language (AIDL)](https://developer.android.com/guide/components/aidl):
75

8-
- Rust code can call existing AIDL servers,
6+
- Rust code can call existing AIDL servers.
97
- You can create new AIDL servers in Rust.
108

119
<details>
1210

13-
- AIDL is what enables Android apps to interact with each other.
11+
- AIDL enables Android apps to interact with each other.
1412

15-
- Since Rust is supported as a first-class citizen in this ecosystem, Rust
16-
services can be called by any other process on the phone.
13+
- Since Rust is a first-class citizen in this ecosystem, other processes on the
14+
device can call Rust services.
1715

1816
</details>
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# Birthday Service Tutorial
22

3-
To illustrate how to use Rust with Binder, we're going to walk through the
4-
process of creating a Binder interface. We're then going to both implement the
5-
described service and write client code that talks to that service.
3+
To illustrate using Rust with Binder, we will create a Binder interface. Then,
4+
we'll implement the service and write a client that talks to it.

src/android/aidl/example-service/changing-definition.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Changing API
22

3-
Let us extend the API with more functionality: we want to let clients specify a
4-
list of lines for the birthday card:
3+
Let's extend the API: we'll let clients specify a list of lines for the birthday
4+
card:
55

66
```java
77
package com.example.birthdayservice;

src/android/aidl/example-service/server.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,21 @@ _birthday_service/Android.bp_:
1616

1717
<details>
1818

19-
The process for taking a user-defined service implementation (in this case the
19+
The process for taking a user-defined service implementation (in this case, the
2020
`BirthdayService` type, which implements the `IBirthdayService`) and starting it
21-
as a Binder service has multiple steps, and may appear more complicated than
21+
as a Binder service has multiple steps. This may appear more complicated than
2222
students are used to if they've used Binder from C++ or another language.
2323
Explain to students why each step is necessary.
2424

2525
1. Create an instance of your service type (`BirthdayService`).
26-
1. Wrap the service object in corresponding `Bn*` type (`BnBirthdayService` in
27-
this case). This type is generated by Binder and provides the common Binder
28-
functionality that would be provided by the `BnBinder` base class in C++. We
29-
don't have inheritance in Rust, so instead we use composition, putting our
30-
`BirthdayService` within the generated `BnBinderService`.
31-
1. Call `add_service`, giving it a service identifier and your service object
26+
2. Wrap the service object in the corresponding `Bn*` type (`BnBirthdayService`
27+
in this case). This type is generated by Binder and provides common Binder
28+
functionality, similar to the `BnBinder` base class in C++. Since Rust
29+
doesn't have inheritance, we use composition, putting our `BirthdayService`
30+
within the generated `BnBinderService`.
31+
3. Call `add_service`, giving it a service identifier and your service object
3232
(the `BnBirthdayService` object in the example).
33-
1. Call `join_thread_pool` to add the current thread to Binder's thread pool and
33+
4. Call `join_thread_pool` to add the current thread to Binder's thread pool and
3434
start listening for connections.
3535

3636
</details>

src/android/aidl/example-service/service-bindings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ trait to talk to the service.
2525
<details>
2626

2727
- Point out how the generated function signature, specifically the argument and
28-
return types, correspond the interface definition.
28+
return types, correspond to the interface definition.
2929
- `String` for an argument results in a different Rust type than `String` as a
3030
return type.
3131

src/android/aidl/example-service/service.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ _birthday_service/Android.bp_:
2525
each of the segments is necessary.
2626
- Note that `wishHappyBirthday` and other AIDL IPC methods take `&self` (instead
2727
of `&mut self`).
28-
- This is necessary because binder responds to incoming requests on a thread
28+
- This is necessary because Binder responds to incoming requests on a thread
2929
pool, allowing for multiple requests to be processed in parallel. This
3030
requires that the service methods only get a shared reference to `self`.
3131
- Any state that needs to be modified by the service will have to be put in
3232
something like a `Mutex` to allow for safe mutation.
3333
- The correct approach for managing service state depends heavily on the
3434
details of your service.
3535
- TODO: What does the `binder::Interface` trait do? Are there methods to
36-
override? Where source?
36+
override? Where is the source?
3737

3838
</details>

src/android/aidl/types/arrays.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Array Types
22

3-
The array types (`T[]`, `byte[]`, and `List<T>`) get translated to the
3+
The array types (`T[]`, `byte[]`, and `List<T>`) are translated to the
44
appropriate Rust array type depending on how they are used in the function
55
signature:
66

src/android/build-rules.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Build Rules
22

3-
The Android build system (Soong) supports Rust via a number of modules:
3+
The Android build system (Soong) supports Rust through several modules:
44

55
| Module Type | Description |
66
| ----------------- | -------------------------------------------------------------------------------------------------- |
@@ -17,13 +17,13 @@ We will look at `rust_binary` and `rust_library` next.
1717

1818
<details>
1919

20-
Additional items speaker may mention:
20+
Additional items the speaker may mention:
2121

22-
- Cargo is not optimized for multi-language repos, and also downloads packages
23-
from the internet.
22+
- Cargo is not optimized for multi-language repositories, and also downloads
23+
packages from the internet.
2424

2525
- For compliance and performance, Android must have crates in-tree. It must also
26-
interop with C/C++/Java code. Soong fills that gap.
26+
interoperate with C/C++/Java code. Soong fills that gap.
2727

2828
- Soong has many similarities to [Bazel](https://bazel.build/), which is the
2929
open-source variant of Blaze (used in google3).

src/android/build-rules/binary.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Rust Binaries
22

3-
Let us start with a simple application. At the root of an AOSP checkout, create
3+
Let's start with a simple application. At the root of an AOSP checkout, create
44
the following files:
55

66
_hello_rust/Android.bp_:
@@ -33,7 +33,7 @@ Hello from Rust!
3333
that all modules have documentation. Try removing it and see what error you
3434
get.
3535

36-
- Stress that the Rust build rules look like the other Soong rules. This is on
37-
purpose to make it as easy to use Rust as C++ or Java.
36+
- Stress that the Rust build rules look like the other Soong rules. This is by
37+
design, to make using Rust as easy as C++ or Java.
3838

3939
</details>

src/android/interoperability.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ that you can:
66
- Call Rust functions from other languages.
77
- Call functions written in other languages from Rust.
88

9-
When you call functions in a foreign language we say that you're using a
10-
_foreign function interface_, also known as FFI.
9+
When you call functions in a foreign language, you're using a _foreign function
10+
interface_, also known as FFI.
1111

1212
<details>
1313

0 commit comments

Comments
 (0)