Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e7b13fd6 authored by Ryuichiro Chiba's avatar Ryuichiro Chiba
Browse files

Add the skelton of NativeActivityThread

This CL adds a directory and basic files for building
NativeActivityThread rust library which will be used for managing
native application processes.
This library is built as a dependency of the Native Zygote, which is
guarded by a build flag.

Bug: 402614577
Test: build
Flag: build.RELEASE_NATIVE_FRAMEWORK_PROTOTYPE
Change-Id: I585a356e794054b657ba8f8e3c61c8329f9022bd
parent 1050d44c
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
//
// Copyright (C) 2025 The Android Open-Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package {
    default_applicable_licenses: ["Android-Apache-2.0"],
    default_visibility: ["//system/zygote:__subpackages__"],
}

rust_library {
    name: "libnative_activity_thread",
    crate_name: "native_activity_thread",
    edition: "2021",
    srcs: [
        "src/lib.rs",
    ],
    rustlibs: [
        "liblogger",
        "liblog_rust",
    ],
}
+4 −0
Original line number Diff line number Diff line
chibar@google.com
ishitatsuyuki@google.com
jham@google.com
uekawa@google.com
+32 −0
Original line number Diff line number Diff line
//
// Copyright (C) 2025 The Android Open-Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//! The crate providing the functionality to manage the native application process.

use log::{info, LevelFilter};

/// Start NativeActivityThread to manage the process.
pub fn run_native_activity_thread(start_seq: i64) -> ! {
    logger::init(
        logger::Config::default()
            .with_tag_on_device("native_activity_thread")
            .with_max_level(LevelFilter::Trace),
    );
    info!("Hello from the native activity thread! start_seq={}", start_seq);

    // TODO(b/402614577): Implement the ActivityThread logic.

    panic!("Something wrong happened!");
}