android_manifest/
profileable.rs

1use serde::{Deserialize, Serialize};
2
3use crate::VarOrBool;
4
5/// Specifies how profilers can access this application.
6///
7/// ## XML Syntax
8/// ```xml
9/// <profileable android:shell=["true" | "false"]
10///              android:enable=["true" | "false"]
11///  />
12/// ```
13///
14/// ## Contained in
15/// * [`<application>`]
16///
17/// ## Introduced in
18/// API Level 29
19///
20/// [`<application>`]: crate::Application
21#[derive(
22    Debug, Deserialize, Serialize, YaSerialize, YaDeserialize, PartialEq, Eq, Default, Clone,
23)]
24pub struct Profileable {
25    /// Specifies whether the user of the device can profile this application
26    /// through local debugging tools. These include
27    ///
28    /// * [`android.os.Trace`] tracing APIs (Android 11 and lower)
29    /// * [`simpleperf`]
30    /// * [`am profile commands`]
31    /// * [`perfetto profilers`] (native memory, Java memory, CPU).
32    ///
33    /// If this isn't set or is set to false, these tools and APIs will work
34    /// only when an app is debuggable. Debuggable apps incur significant and
35    /// varied performance degradation, and are not useful for measuring timing
36    /// accurately. This element is strongly recommended for local performance
37    /// measurements, in order to capture accurate results.
38    ///
39    /// [`android.os.Trace`]: https://developer.android.com/reference/kotlin/android/os/Trace
40    /// [`simpleperf`]: https://developer.android.com/ndk/guides/simpleperf
41    /// [`am profile commands`]: https://developer.android.com/studio/command-line/perfetto
42    #[yaserde(attribute, prefix = "android")]
43    pub shell: VarOrBool,
44    /// Specifies whether the application can be profiled by system services or
45    /// shell tools (for the latter, you must also set [`android:shell`]). If
46    /// false, the application cannot be profiled at all. Defaults to true. This
47    /// attribute was added in API level 30.
48    ///
49    /// [`android:shell`]: https://developer.android.com/guide/topics/manifest/profileable-element#shell
50    #[yaserde(attribute, prefix = "android")]
51    pub enable: VarOrBool,
52}