Skip to content

Commit d2bc223

Browse files
authored
Misc. Android Improvements (#2325)
- Add missing package declaration on the AIDL interface slide. - Make the parcelable example more self-contained. The existing code was referencing variables that weren't declared in the example code. - Add a speaker note to the logging slide about explaining that the logger implementation is only needed in binaries, and that just the log facade is needed in libraries.
1 parent 9c16b36 commit d2bc223

File tree

5 files changed

+13
-3
lines changed

5 files changed

+13
-3
lines changed

src/android/aidl/birthday_service/aidl/com/example/birthdayservice/IBirthdayService.aidl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
// ANCHOR: package
1516
package com.example.birthdayservice;
17+
// ANCHOR_END: package
1618

1719
import com.example.birthdayservice.IBirthdayInfoProvider;
1820
import com.example.birthdayservice.BirthdayInfo;

src/android/aidl/birthday_service/src/client.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ fn main() -> Result<(), Box<dyn Error>> {
4343
println!("{msg}");
4444
// ANCHOR_END: main
4545

46-
// ANCHOR: wish_with_info
4746
service.wishWithInfo(&BirthdayInfo { name: name.clone(), years })?;
48-
// ANCHOR_END: wish_with_info
4947

5048
// ANCHOR: wish_with_provider
5149

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ You declare the API of your service using an AIDL interface:
55
_birthday_service/aidl/com/example/birthdayservice/IBirthdayService.aidl_:
66

77
```java
8+
{{#include ../birthday_service/aidl/com/example/birthdayservice/IBirthdayService.aidl:package}}
9+
810
{{#include ../birthday_service/aidl/com/example/birthdayservice/IBirthdayService.aidl:IBirthdayService}}
911
}
1012
```

src/android/aidl/types/parcelables.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ fn main() {
2525
binder::ProcessState::start_thread_pool();
2626
let service = connect().expect("Failed to connect to BirthdayService");
2727
28-
{{#include ../birthday_service/src/client.rs:wish_with_info}}
28+
let info = BirthdayInfo { name: "Alice".into(), years: 123 };
29+
service.wishWithInfo(&info)?;
2930
}
3031
```

src/android/logging.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,10 @@ adb logcat -s rust
3232
09-08 08:38:32.454 2420 2420 I rust: hello_rust_logs: Things are going fine.
3333
09-08 08:38:32.454 2420 2420 E rust: hello_rust_logs: Something went wrong!
3434
```
35+
36+
<details>
37+
38+
- The logger implementation in `liblogger` is only needed in the final binary,
39+
if you're logging from a library you only need the `log` facade crate.
40+
41+
</details>

0 commit comments

Comments
 (0)