Skip to content

Commit

Permalink
ndk-build: Add manifest attributes android:extractNativeLibs, `andr…
Browse files Browse the repository at this point in the history
…oid:usesCleartextTraffic` and `android:alwaysRetainTaskState` (#15)
  • Loading branch information
James2022-rgb authored Jun 28, 2023
1 parent 0441782 commit 8ce097b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cargo-apk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ icon = "@mipmap/ic_launcher"
# Defaults to the compiled artifact's name.
label = "Application Name"

# See https://developer.android.com/guide/topics/manifest/application-element#extractNativeLibs
extract_native_libs = true

# See https://developer.android.com/guide/topics/manifest/application-element#usesCleartextTraffic
uses_cleartext_traffic = true

# See https://developer.android.com/guide/topics/manifest/meta-data-element
#
# Note: there can be several .meta_data entries.
Expand Down Expand Up @@ -194,6 +200,9 @@ exported = true
# Defaults to true on Android >= 24, no effect on earlier API levels
resizeable_activity = false

# See https://developer.android.com/guide/topics/manifest/activity-element#always
always_retain_task_state = true

# See https://developer.android.com/guide/topics/manifest/meta-data-element
#
# Note: there can be several .meta_data entries.
Expand Down
1 change: 1 addition & 0 deletions ndk-build/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Unreleased

- Add `android:extractNativeLibs`, `android:usesCleartextTraffic` attributes to the manifest's `Application` element, and `android:alwaysRetainTaskState` to the `Activity` element. ([#15](https://github.com/rust-mobile/cargo-apk/pull/15))
- Enable building from `android` host ([#29](https://github.com/rust-mobile/cargo-apk/pull/29))

# 0.9.0 (2022-11-23)
Expand Down
7 changes: 7 additions & 0 deletions ndk-build/src/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ pub struct Application {
#[serde(rename(serialize = "android:label"))]
#[serde(default)]
pub label: String,
#[serde(rename(serialize = "android:extractNativeLibs"))]
pub extract_native_libs: Option<bool>,
#[serde(rename(serialize = "android:usesCleartextTraffic"))]
pub uses_cleartext_traffic: Option<bool>,

#[serde(rename(serialize = "meta-data"))]
#[serde(default)]
Expand Down Expand Up @@ -104,6 +108,8 @@ pub struct Activity {
pub exported: Option<bool>,
#[serde(rename(serialize = "android:resizeableActivity"))]
pub resizeable_activity: Option<bool>,
#[serde(rename(serialize = "android:alwaysRetainTaskState"))]
pub always_retain_task_state: Option<bool>,

#[serde(rename(serialize = "meta-data"))]
#[serde(default)]
Expand All @@ -124,6 +130,7 @@ impl Default for Activity {
orientation: None,
exported: None,
resizeable_activity: None,
always_retain_task_state: None,
meta_data: Default::default(),
intent_filter: Default::default(),
}
Expand Down

0 comments on commit 8ce097b

Please sign in to comment.