xref: /aosp_15_r20/frameworks/native/libs/gui/rust/aidl_types/src/lib.rs (revision 38e8c45f13ce32b0dcecb25141ffecaf386fa17f)
1 // Copyright (C) 2024 The Android Open Source Project
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 //! Rust wrapper for libgui AIDL types.
16 
17 use binder::{
18     binder_impl::{BorrowedParcel, UnstructuredParcelable},
19     impl_deserialize_for_unstructured_parcelable, impl_serialize_for_unstructured_parcelable,
20     StatusCode,
21 };
22 
23 macro_rules! stub_unstructured_parcelable {
24     ($name:ident) => {
25         /// Unimplemented stub parcelable.
26         #[derive(Debug, Default)]
27         pub struct $name(());
28 
29         impl UnstructuredParcelable for $name {
30             fn write_to_parcel(&self, _parcel: &mut BorrowedParcel) -> Result<(), StatusCode> {
31                 todo!()
32             }
33 
34             fn from_parcel(_parcel: &BorrowedParcel) -> Result<Self, StatusCode> {
35                 todo!()
36             }
37         }
38 
39         impl_deserialize_for_unstructured_parcelable!($name);
40         impl_serialize_for_unstructured_parcelable!($name);
41     };
42 }
43 
44 stub_unstructured_parcelable!(BitTube);
45 stub_unstructured_parcelable!(DisplayInfo);
46 stub_unstructured_parcelable!(LayerDebugInfo);
47 stub_unstructured_parcelable!(LayerMetadata);
48 stub_unstructured_parcelable!(ParcelableVsyncEventData);
49 stub_unstructured_parcelable!(ScreenCaptureResults);
50 stub_unstructured_parcelable!(VsyncEventData);
51 stub_unstructured_parcelable!(WindowInfo);
52 stub_unstructured_parcelable!(WindowInfosUpdate);
53