aconfig: allow dots in package fields

Allow package fields to include dots.

Update the generated code based on the package name: if the package name
is com.android.example:

  - java: package com.android.example; ...
  - C++: namespace com::android::example { ... }
  - Rust: mod com { mod android { mod example { ... } } }

Also, update examples to use dots in the package fields.

Also, remove unnecessary #include from the auto-generated C++ code: the
header should not include itself.

Bug: 285000854
Test: atest aconfig.test
Change-Id: I8a5352e25c64c34dee0725202a1b7c9957819de8
diff --git a/tools/aconfig/templates/rust.template b/tools/aconfig/templates/rust.template
index a3c58c0..81b407c 100644
--- a/tools/aconfig/templates/rust.template
+++ b/tools/aconfig/templates/rust.template
@@ -1,23 +1,29 @@
+{{- for mod in modules -}}
+pub mod {mod} \{
+{{ endfor -}}
 {{- for parsed_flag in parsed_flags -}}
 {{- if parsed_flag.is_read_only_disabled -}}
 #[inline(always)]
-pub const fn r#{parsed_flag.fn_name}() -> bool \{
+pub const fn r#{parsed_flag.name}() -> bool \{
     false
 }
 
 {{ endif -}}
 {{- if parsed_flag.is_read_only_enabled -}}
 #[inline(always)]
-pub const fn r#{parsed_flag.fn_name}() -> bool \{
+pub const fn r#{parsed_flag.name}() -> bool \{
     true
 }
 
 {{ endif -}}
 {{- if parsed_flag.is_read_write -}}
 #[inline(always)]
-pub fn r#{parsed_flag.fn_name}() -> bool \{
+pub fn r#{parsed_flag.name}() -> bool \{
     flags_rust::GetServerConfigurableFlag("{package}", "{parsed_flag.name}", "false") == "true"
 }
 
 {{ endif -}}
 {{- endfor -}}
+{{- for mod in modules -}}
+}
+{{ endfor -}}