Loading libs/native_activity_thread/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ rust_library { rustlibs: [ "activitymanager_structured_aidl-rust", "libanyhow", "libatrace_rust", "libbinder_rs", "libdlext_bindgen", "liblogger", Loading libs/native_activity_thread/src/native_activity_thread.rs +8 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ use activitymanager_structured_aidl::aidl::android::app::IActivityManagerStructu SERVICE_DONE_EXECUTING_STOP, SERVICE_DONE_EXECUTING_UNBIND, }; use anyhow::{bail, Context, Result}; use atrace::AtraceTag; use binder::{ unstable_api::{new_spibinder, AIBinder as SysAIBinder}, SpIBinder, Strong, Loading Loading @@ -68,6 +69,7 @@ impl NativeActivityThread { } fn handle_create_service_request(&mut self, req: CreateServiceRequest) -> Result<()> { atrace::trace_method!(AtraceTag::ActivityManager); // Create a linker namespace dedicated to the service. A process could host multiple // services but their namespaces must be isolated. let namespace = self Loading Loading @@ -115,6 +117,7 @@ impl NativeActivityThread { } fn handle_destroy_service_request(&mut self, req: DestroyServiceRequest) -> Result<()> { atrace::trace_method!(AtraceTag::ActivityManager); // Remove the service not to process requests for it anymore. let mut service = self.services.remove(&req.service_token).context("service not found")?; if let Some(on_destroy) = service.service.callbacks.onDestroy { Loading @@ -129,6 +132,7 @@ impl NativeActivityThread { } fn handle_bind_service_request(&mut self, req: BindServiceRequest) -> Result<()> { atrace::trace_method!(AtraceTag::ActivityManager); let service = self.services.get_mut(&req.service_token).context("service not found")?; let intent_token = req.intent_hash; Loading Loading @@ -174,6 +178,7 @@ impl NativeActivityThread { } fn handle_unbind_service_request(&mut self, req: UnbindServiceRequest) -> Result<()> { atrace::trace_method!(AtraceTag::ActivityManager); let service = self.services.get_mut(&req.service_token).context("service not found")?; let intent_token = req.intent_hash; Loading @@ -197,6 +202,7 @@ impl NativeActivityThread { } fn handle_trim_memory_request(&mut self, level: i32) -> Result<()> { atrace::trace_method!(AtraceTag::ActivityManager); if level != ANativeServiceTrimMemoryLevel_ANATIVE_SERVICE_TRIM_MEMORY_BACKGROUND && level != ANativeServiceTrimMemoryLevel_ANATIVE_SERVICE_TRIM_MEMORY_UI_HIDDEN { Loading @@ -218,6 +224,7 @@ impl NativeActivityThread { } fn handle_bind_application_request(&mut self) -> Result<()> { atrace::trace_method!(AtraceTag::ActivityManager); // We don't support calling Application.onCreate in native processes. self.activity_manager .finishAttachApplication(self.start_seq, 0) Loading @@ -225,6 +232,7 @@ impl NativeActivityThread { } fn handle_set_process_state(&mut self, state: i32) -> Result<()> { atrace::trace_method!(AtraceTag::ActivityManager); self.process_state = state; Ok(()) } Loading Loading
libs/native_activity_thread/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ rust_library { rustlibs: [ "activitymanager_structured_aidl-rust", "libanyhow", "libatrace_rust", "libbinder_rs", "libdlext_bindgen", "liblogger", Loading
libs/native_activity_thread/src/native_activity_thread.rs +8 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ use activitymanager_structured_aidl::aidl::android::app::IActivityManagerStructu SERVICE_DONE_EXECUTING_STOP, SERVICE_DONE_EXECUTING_UNBIND, }; use anyhow::{bail, Context, Result}; use atrace::AtraceTag; use binder::{ unstable_api::{new_spibinder, AIBinder as SysAIBinder}, SpIBinder, Strong, Loading Loading @@ -68,6 +69,7 @@ impl NativeActivityThread { } fn handle_create_service_request(&mut self, req: CreateServiceRequest) -> Result<()> { atrace::trace_method!(AtraceTag::ActivityManager); // Create a linker namespace dedicated to the service. A process could host multiple // services but their namespaces must be isolated. let namespace = self Loading Loading @@ -115,6 +117,7 @@ impl NativeActivityThread { } fn handle_destroy_service_request(&mut self, req: DestroyServiceRequest) -> Result<()> { atrace::trace_method!(AtraceTag::ActivityManager); // Remove the service not to process requests for it anymore. let mut service = self.services.remove(&req.service_token).context("service not found")?; if let Some(on_destroy) = service.service.callbacks.onDestroy { Loading @@ -129,6 +132,7 @@ impl NativeActivityThread { } fn handle_bind_service_request(&mut self, req: BindServiceRequest) -> Result<()> { atrace::trace_method!(AtraceTag::ActivityManager); let service = self.services.get_mut(&req.service_token).context("service not found")?; let intent_token = req.intent_hash; Loading Loading @@ -174,6 +178,7 @@ impl NativeActivityThread { } fn handle_unbind_service_request(&mut self, req: UnbindServiceRequest) -> Result<()> { atrace::trace_method!(AtraceTag::ActivityManager); let service = self.services.get_mut(&req.service_token).context("service not found")?; let intent_token = req.intent_hash; Loading @@ -197,6 +202,7 @@ impl NativeActivityThread { } fn handle_trim_memory_request(&mut self, level: i32) -> Result<()> { atrace::trace_method!(AtraceTag::ActivityManager); if level != ANativeServiceTrimMemoryLevel_ANATIVE_SERVICE_TRIM_MEMORY_BACKGROUND && level != ANativeServiceTrimMemoryLevel_ANATIVE_SERVICE_TRIM_MEMORY_UI_HIDDEN { Loading @@ -218,6 +224,7 @@ impl NativeActivityThread { } fn handle_bind_application_request(&mut self) -> Result<()> { atrace::trace_method!(AtraceTag::ActivityManager); // We don't support calling Application.onCreate in native processes. self.activity_manager .finishAttachApplication(self.start_seq, 0) Loading @@ -225,6 +232,7 @@ impl NativeActivityThread { } fn handle_set_process_state(&mut self, state: i32) -> Result<()> { atrace::trace_method!(AtraceTag::ActivityManager); self.process_state = state; Ok(()) } Loading