binder: fix decoding of vintf stability ParcelableHolder

Unlike the C++ implementation, `ParcelableHolder`s in rust are decoded
into a new object. The new object was losing the original stability
level, always reverting to local stability, so vintf parcelables would
fail the assertion.

We could replicate the C++ implementation, but it would require a lot of
API refactoring and it is easy to mess up. Instead, we make the
stability part of the type. This somewhat matches AIDL, where the
stability is a static annotation on the type containing the
`ParcelableHolder`.

Bug: 366383257
Test: m
Change-Id: Ic4654830d404fbf18046660eeb0129ab8abf7e61
diff --git a/libs/binder/rust/src/binder.rs b/libs/binder/rust/src/binder.rs
index 9a252b8..23026e5 100644
--- a/libs/binder/rust/src/binder.rs
+++ b/libs/binder/rust/src/binder.rs
@@ -136,6 +136,31 @@
     }
 }
 
+/// Same as `Stability`, but in the form of a trait. Used when the stability should be encoded in
+/// the type.
+///
+/// When/if the `adt_const_params` Rust feature is stabilized, this could be replace by using
+/// `Stability` directly with const generics.
+pub trait StabilityType {
+    /// The `Stability` represented by this type.
+    const VALUE: Stability;
+}
+
+/// `Stability::Local`.
+#[derive(Debug)]
+pub enum LocalStabilityType {}
+/// `Stability::Vintf`.
+#[derive(Debug)]
+pub enum VintfStabilityType {}
+
+impl StabilityType for LocalStabilityType {
+    const VALUE: Stability = Stability::Local;
+}
+
+impl StabilityType for VintfStabilityType {
+    const VALUE: Stability = Stability::Vintf;
+}
+
 /// A local service that can be remotable via Binder.
 ///
 /// An object that implement this interface made be made into a Binder service