Inspiration

Nagara OS was inspired by the growing need for a mobile operating system that provides deeper security control than ordinary applications can offer.

Smartphones now store private communications, identities, business documents, credentials, financial information, and location data. However, most security applications operate only at the application layer and have limited control over system services, hardware access, permissions, and operating-system policies.

We asked ourselves:

What if a security platform could gradually become part of Android itself without immediately replacing the entire Android ecosystem?

Building an independent mobile operating system from scratch would require a kernel, device drivers, modem integration, camera support, application runtime, secure boot, recovery, and compatibility with many hardware configurations. Instead of replacing all of Android at once, we created a hybrid approach. Nagara OS progressively introduces its own security, policy, auditing, and system-management components while continuing to use mature Android components as a compatibility and fallback layer. Our guiding principle is:\text{Nagara Security Layer}+\text{Android Compatibility}+\text{Safe Fallback}] This approach allows Nagara OS to evolve gradually while reducing the risk of boot failure, hardware incompatibility, and permanent device lockout.

What it does

Nagara OS is a security-focused hybrid Android operating-system framework based on the Android Open Source Project. It is designed to introduce a centralized security and policy layer between applications, Android framework services, and sensitive system resources. The current project provides the foundation for: centralized security-policy evaluation; secure communication through Android Binder and AIDL; application and system-action authorization; protected security-audit recording; role- and capability-based system control; progressive replacement of selected Android components; secure launcher and policy-management applications; SELinux-based service isolation; hardware-backed authentication planning; Android-native fallback when Nagara services are unavailable; and structured AOSP product integration. Sensitive actions can be represented as:[R=(P,A,D,C)] where: (P) is the requesting package; (A) is the requested action; (D) is the associated data; (C) is the device and security context. The Nagara policy layer can evaluate the request and produce decisions such as: [Decision(R)\in{Allow,\ Deny,\ RequireAuth,\ Audit,\ Fallback}] For example, Nagara OS could evaluate requests involving the camera, microphone, location, protected files, administrative commands, or privileged system operations before allowing them to continue. The current version is an early-stage AOSP integration framework and development template. It is not yet a complete, production-ready, or universally flashable ROM.

How we built it

We built Nagara OS as a modular AOSP project rather than as one large application. The project contains several major layers.AOSP product configuration We created product and board configuration templates that allow Nagara OS to be introduced as an Android product flavor. The structure separates shared Nagara components from device-specific configurations so future hardware targets can be added without rewriting the entire platform. Security-service interface We designed an AIDL contract for a central Nagara security service. The interface allows authorized framework components and privileged applications to: check whether the security service is ready; determine the active takeover level; submit actions for policy evaluation; and record protected audit events. Framework manager A Java framework-manager skeleton provides a controlled API between Android applications and the Nagara security service. Instead of allowing applications to communicate directly with native processes, requests follow a structured path: Application or System Component ↓ Nagara Manager API ↓ Binder/AIDL IPC ↓ Nagara Security Service ↓ Policy Decision and Audit Native security service We created the initial C++ native-service structure for Android Binder communication, logging, policy loading, and security-event processing. The native service is intentionally minimal at this stage. Expanding a privileged native service too early could introduce memory-safety, boot, and permission risks. SELinux foundation We added initial SELinux domains, service contexts, and file contexts for Nagara components. Our architecture follows an important rule: Nagara OS must not require SELinux permissive mode in production. A security system should strengthen the operating system rather than disable its existing protections. Capability configuration We developed a machine-readable capability system to describe whether each takeover layer is enabled, experimental, planned, or not ready. Example: { "mode": "android_hybrid_layer", "takeover_levels": { "guard_layer": "enabled", "default_apps": "planned", "system_services": "experimental", "hal_adapters": "planned", "framework_replacement": "not_ready", "kernel_replacement": "not_ready" }, "fallback": "android_native" } This prevents unfinished components from being activated or presented as complete functionality. System applications We created initial application skeletons for: Nagara Launcher; Nagara Policy Manager; future security dashboards; audit viewers; and protected system settings. Build and safety tools The project also includes utilities for: checking the build environment; integrating Nagara components into an AOSP source tree; starting development builds; verifying generated image files; running structural tests; and preventing accidental flashing of incomplete images. We retained the earlier Python prototype as a behavioral reference. Its policy, routing, auditing, authorization, and capability concepts are gradually being mapped into native Android components

Challenges we ran into

One of our greatest challenges was converting a high-level security prototype into an architecture suitable for a real operating system. A prototype can simulate security decisions, applications, hardware, and authentication. A real Android-based operating system must also handle: process isolation; Binder IPC; application lifecycle; native memory; boot sequencing; hardware drivers; modem and camera services; permissions; encrypted storage; verified boot; recovery; SELinux; and over-the-air updates. We learned that prototype functions cannot simply be copied into AOSP. Each capability must be redesigned for the Android lifecycle and security model. Another major challenge was avoiding a single point of failure. A centralized security service is powerful, but if every system action depends on that service, a crash could make the device unusable. We addressed this through: service-readiness checks; Android-native fallback; boot-safe defaults; gradual capability activation; restricted takeover levels; and separation between policy decisions and hardware operations. Hardware fragmentation was another significant challenge. AOSP source code alone cannot produce a working ROM for every Android device. Each target may require a supported kernel, device tree, vendor binaries, modem configuration, partition definitions, camera integration, and verified-boot settings. Biometric security also required careful planning. Nagara OS must not store raw fingerprint, facial, or other biometric templates. Future versions must use Android BiometricPrompt, Keystore, KeyMint, StrongBox, or trusted execution environments to authorize hardware-backed cryptographic operations. Finally, we faced the challenge of defining the project honestly. The current package demonstrates a serious architecture and integration framework, but it is not yet a completed mobile operating system. Clearly communicating that distinction is essential for technical credibility and user safety.

Accomplishments that we're proud of

We are proud that Nagara OS now has a structured and realistic path from prototype to AOSP integration. Our current accomplishments include: creating an AOSP-compatible project structure; defining Nagara as a future Android product flavor; designing a centralized AIDL security-service contract; developing a Java framework-manager skeleton; creating a native Binder-service foundation; defining initial SELinux security boundaries; creating Nagara Launcher and Policy application skeletons; implementing machine-readable takeover levels; preserving Android-native fallback; adding build and environment-checking utilities; introducing flashing confirmation safeguards; writing automated structural and safety tests; documenting the migration from Python concepts to native Android services; and producing a phased roadmap toward a complete Nagara OS distribution. We are especially proud that the project prioritizes safe failure rather than uncontrolled system takeover. The tests verify not only whether files exist, but also whether critical safety assumptions remain active. They help ensure that kernel replacement, complete framework replacement, and other high-risk functions remain disabled until they are properly implemented and validated.

What we learned

We learned that building an operating system is fundamentally different from building an application. An operating system must take responsibility for booting, hardware access, process management, permissions, storage, recovery, security updates, and compatibility. This responsibility cannot be simulated or claimed without extensive implementation and testing. We also learned that Android compatibility is not merely a limitation. Android provides a mature kernel ecosystem, hardware support, application framework, security architecture, and developer ecosystem. These components provide a strong foundation on which Nagara OS can evolve. Another important lesson is that security must include recovery. A security feature that permanently locks out the legitimate owner, prevents emergency access, or causes an unrecoverable boot failure is not a complete security solution. We also learned that every system capability needs an explicit readiness state. The presence of source code does not mean a component is production-ready. A simplified readiness model can be represented as: [T_i=M_i\times V_i\times F_i\times H_i] where: (M_i) is implementation maturity; (V_i) is validation coverage; (F_i) is fallback reliability; (H_i) is hardware compatibility. A component should only be activated when: [T_i\geq T_{\text{minimum}}] Most importantly, we learned that a secure operating system should evolve through measured, testable, and reversible stages.

What's next for Nagara OS

The next milestone is integrating Nagara OS into a complete AOSP source tree for one supported development device. Our planned development sequence is: Select a compatible Pixel userdebug target. Integrate the Nagara product and board configurations. complete the Binder security-service implementation. Connect the Java framework manager to the native service. Build the policy-evaluation engine. Implement protected audit storage. Complete the Nagara Policy Manager application. Integrate owner authentication through BiometricPrompt and Android Keystore. Validate SELinux policies without permissive mode. Perform boot, crash, fallback, and recovery testing. Generate and test signed development images. Run Android compatibility and security test suites. Future development phases will introduce: secure intent routing; real-time application-risk evaluation; camera, microphone, and location policy adapters; hardware-backed key management; protected enterprise-device controls; verified over-the-air updates; secure recovery and rollback; anomaly detection; privacy dashboards; and integration with selected Android system services. The long-term roadmap is progressive: Security Prototype ↓ Nagara Guard Layer ↓ Nagara Default Applications ↓ Nagara Framework Services ↓ Nagara AOSP Distribution ↓ Nagara HAL Adapters ↓ Gradual Android Service Replacement ↓ Independent Nagara Mobile OS Our long-term goal is not to replace Android recklessly or immediately. Our goal is to create a secure mobile operating system that assumes control gradually, proves every capability through testing, preserves hardware compatibility, and always provides a safe recovery path. Replace gradually, verify continuously, and always preserve a safe path back.

Built With

  • chatgpt
  • claude
  • codex
  • lovable
Share this project:

Updates