Loading data/etc/android.hardware.vulkan.version-1_4.xml 0 → 100644 +21 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright 2024 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. --> <!-- This is the standard feature indicating that the device has a Vulkan driver that supports API version 1.4 (0x00404000) --> <permissions> <feature name="android.hardware.vulkan.version" version="4210688" /> </permissions> include/audiomanager/AudioManager.h +5 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ namespace android { // must be kept in sync with definitions in AudioPlaybackConfiguration.java #define PLAYER_PIID_INVALID -1 // TODO (b/309532236) remove manual IAudioManager impl in favor of AIDL. typedef enum { PLAYER_TYPE_SLES_AUDIOPLAYER_BUFFERQUEUE = 11, PLAYER_TYPE_SLES_AUDIOPLAYER_URI_FD = 12, Loading Loading @@ -60,6 +61,7 @@ enum { PLAYER_MUTE_CLIENT_VOLUME = (1 << 4), PLAYER_MUTE_VOLUME_SHAPER = (1 << 5), PLAYER_MUTE_PORT_VOLUME = (1 << 6), PLAYER_MUTE_OP_AUDIO_CONTROL = (1 << 7), }; struct mute_state_t { Loading @@ -77,6 +79,8 @@ struct mute_state_t { bool muteFromVolumeShaper = false; /** Flag used when volume is muted by port volume. */ bool muteFromPortVolume = false; /** Flag used when volume is muted by audio control op. */ bool muteFromOpAudioControl = false; explicit operator int() const { Loading @@ -87,6 +91,7 @@ struct mute_state_t { result |= muteFromClientVolume * PLAYER_MUTE_CLIENT_VOLUME; result |= muteFromVolumeShaper * PLAYER_MUTE_VOLUME_SHAPER; result |= muteFromPortVolume * PLAYER_MUTE_PORT_VOLUME; result |= muteFromOpAudioControl * PLAYER_MUTE_OP_AUDIO_CONTROL; return result; } Loading libs/binder/rust/src/system_only.rs +26 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,32 @@ impl Accessor { Accessor { accessor } } /// Creates a new Accessor instance based on an existing Accessor's binder. /// This is useful when the Accessor instance is hosted in another process /// that has the permissions to create the socket connection FD. /// /// The `instance` argument must match the instance that the original Accessor /// is responsible for. /// `instance` must not contain null bytes and is used to create a CString to /// pass through FFI. /// The `binder` argument must be a valid binder from an Accessor pub fn from_binder(instance: &str, binder: SpIBinder) -> Option<Accessor> { let inst = CString::new(instance).unwrap(); // Safety: All `SpIBinder` objects (the `binder` argument) hold a valid pointer // to an `AIBinder` that is guaranteed to remain valid for the lifetime of the // SpIBinder. `ABinderRpc_Accessor_fromBinder` creates a new pointer to that binder // that it is responsible for. // The `inst` argument is a new CString that will copied by // `ABinderRpc_Accessor_fromBinder` and not modified. let accessor = unsafe { sys::ABinderRpc_Accessor_fromBinder(inst.as_ptr(), binder.as_raw()) }; if accessor.is_null() { return None; } Some(Accessor { accessor }) } /// Get the underlying binder for this Accessor for when it needs to be either /// registered with service manager or sent to another process. pub fn as_binder(&self) -> Option<SpIBinder> { Loading libs/binder/rust/tests/integration.rs +28 −0 Original line number Diff line number Diff line Loading @@ -1038,6 +1038,34 @@ mod tests { assert!(deleted.load(Ordering::Relaxed)); } #[test] fn test_accessor_from_accessor_binder() { let get_connection_info = move |_instance: &str| None; let accessor = Accessor::new("foo.service", get_connection_info); let accessor2 = Accessor::from_binder("foo.service", accessor.as_binder().unwrap()).unwrap(); assert_eq!(accessor.as_binder(), accessor2.as_binder()); } #[test] fn test_accessor_from_non_accessor_binder() { let service_name = "rust_test_ibinder"; let _process = ScopedServiceProcess::new(service_name); let binder = binder::get_service(service_name).unwrap(); assert!(binder.is_binder_alive()); let accessor = Accessor::from_binder("rust_test_ibinder", binder); assert!(accessor.is_none()); } #[test] fn test_accessor_from_wrong_accessor_binder() { let get_connection_info = move |_instance: &str| None; let accessor = Accessor::new("foo.service", get_connection_info); let accessor2 = Accessor::from_binder("NOT.foo.service", accessor.as_binder().unwrap()); assert!(accessor2.is_none()); } #[tokio::test] async fn reassociate_rust_binder_async() { let service_name = "testing_service"; Loading libs/input/InputConsumerNoResampling.cpp +15 −0 Original line number Diff line number Diff line Loading @@ -169,6 +169,12 @@ InputMessage createTimelineMessage(int32_t inputEventId, nsecs_t gpuCompletedTim msg.body.timeline.graphicsTimeline[GraphicsTimeline::PRESENT_TIME] = presentTime; return msg; } std::ostream& operator<<(std::ostream& out, const InputMessage& msg) { out << ftl::enum_string(msg.header.type); return out; } } // namespace // --- InputConsumerNoResampling --- Loading Loading @@ -272,6 +278,15 @@ void InputConsumerNoResampling::processOutboundEvents() { return; // try again later } if (result == DEAD_OBJECT) { // If there's no one to receive events in the channel, there's no point in sending them. // Drop all outbound events. LOG(INFO) << "Channel " << mChannel->getName() << " died. Dropping outbound event " << outboundMsg; mOutboundQueue.pop(); setFdEvents(0); continue; } // Some other error. Give up LOG(FATAL) << "Failed to send outbound event on channel '" << mChannel->getName() << "'. status=" << statusToString(result) << "(" << result << ")"; Loading Loading
data/etc/android.hardware.vulkan.version-1_4.xml 0 → 100644 +21 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright 2024 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. --> <!-- This is the standard feature indicating that the device has a Vulkan driver that supports API version 1.4 (0x00404000) --> <permissions> <feature name="android.hardware.vulkan.version" version="4210688" /> </permissions>
include/audiomanager/AudioManager.h +5 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ namespace android { // must be kept in sync with definitions in AudioPlaybackConfiguration.java #define PLAYER_PIID_INVALID -1 // TODO (b/309532236) remove manual IAudioManager impl in favor of AIDL. typedef enum { PLAYER_TYPE_SLES_AUDIOPLAYER_BUFFERQUEUE = 11, PLAYER_TYPE_SLES_AUDIOPLAYER_URI_FD = 12, Loading Loading @@ -60,6 +61,7 @@ enum { PLAYER_MUTE_CLIENT_VOLUME = (1 << 4), PLAYER_MUTE_VOLUME_SHAPER = (1 << 5), PLAYER_MUTE_PORT_VOLUME = (1 << 6), PLAYER_MUTE_OP_AUDIO_CONTROL = (1 << 7), }; struct mute_state_t { Loading @@ -77,6 +79,8 @@ struct mute_state_t { bool muteFromVolumeShaper = false; /** Flag used when volume is muted by port volume. */ bool muteFromPortVolume = false; /** Flag used when volume is muted by audio control op. */ bool muteFromOpAudioControl = false; explicit operator int() const { Loading @@ -87,6 +91,7 @@ struct mute_state_t { result |= muteFromClientVolume * PLAYER_MUTE_CLIENT_VOLUME; result |= muteFromVolumeShaper * PLAYER_MUTE_VOLUME_SHAPER; result |= muteFromPortVolume * PLAYER_MUTE_PORT_VOLUME; result |= muteFromOpAudioControl * PLAYER_MUTE_OP_AUDIO_CONTROL; return result; } Loading
libs/binder/rust/src/system_only.rs +26 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,32 @@ impl Accessor { Accessor { accessor } } /// Creates a new Accessor instance based on an existing Accessor's binder. /// This is useful when the Accessor instance is hosted in another process /// that has the permissions to create the socket connection FD. /// /// The `instance` argument must match the instance that the original Accessor /// is responsible for. /// `instance` must not contain null bytes and is used to create a CString to /// pass through FFI. /// The `binder` argument must be a valid binder from an Accessor pub fn from_binder(instance: &str, binder: SpIBinder) -> Option<Accessor> { let inst = CString::new(instance).unwrap(); // Safety: All `SpIBinder` objects (the `binder` argument) hold a valid pointer // to an `AIBinder` that is guaranteed to remain valid for the lifetime of the // SpIBinder. `ABinderRpc_Accessor_fromBinder` creates a new pointer to that binder // that it is responsible for. // The `inst` argument is a new CString that will copied by // `ABinderRpc_Accessor_fromBinder` and not modified. let accessor = unsafe { sys::ABinderRpc_Accessor_fromBinder(inst.as_ptr(), binder.as_raw()) }; if accessor.is_null() { return None; } Some(Accessor { accessor }) } /// Get the underlying binder for this Accessor for when it needs to be either /// registered with service manager or sent to another process. pub fn as_binder(&self) -> Option<SpIBinder> { Loading
libs/binder/rust/tests/integration.rs +28 −0 Original line number Diff line number Diff line Loading @@ -1038,6 +1038,34 @@ mod tests { assert!(deleted.load(Ordering::Relaxed)); } #[test] fn test_accessor_from_accessor_binder() { let get_connection_info = move |_instance: &str| None; let accessor = Accessor::new("foo.service", get_connection_info); let accessor2 = Accessor::from_binder("foo.service", accessor.as_binder().unwrap()).unwrap(); assert_eq!(accessor.as_binder(), accessor2.as_binder()); } #[test] fn test_accessor_from_non_accessor_binder() { let service_name = "rust_test_ibinder"; let _process = ScopedServiceProcess::new(service_name); let binder = binder::get_service(service_name).unwrap(); assert!(binder.is_binder_alive()); let accessor = Accessor::from_binder("rust_test_ibinder", binder); assert!(accessor.is_none()); } #[test] fn test_accessor_from_wrong_accessor_binder() { let get_connection_info = move |_instance: &str| None; let accessor = Accessor::new("foo.service", get_connection_info); let accessor2 = Accessor::from_binder("NOT.foo.service", accessor.as_binder().unwrap()); assert!(accessor2.is_none()); } #[tokio::test] async fn reassociate_rust_binder_async() { let service_name = "testing_service"; Loading
libs/input/InputConsumerNoResampling.cpp +15 −0 Original line number Diff line number Diff line Loading @@ -169,6 +169,12 @@ InputMessage createTimelineMessage(int32_t inputEventId, nsecs_t gpuCompletedTim msg.body.timeline.graphicsTimeline[GraphicsTimeline::PRESENT_TIME] = presentTime; return msg; } std::ostream& operator<<(std::ostream& out, const InputMessage& msg) { out << ftl::enum_string(msg.header.type); return out; } } // namespace // --- InputConsumerNoResampling --- Loading Loading @@ -272,6 +278,15 @@ void InputConsumerNoResampling::processOutboundEvents() { return; // try again later } if (result == DEAD_OBJECT) { // If there's no one to receive events in the channel, there's no point in sending them. // Drop all outbound events. LOG(INFO) << "Channel " << mChannel->getName() << " died. Dropping outbound event " << outboundMsg; mOutboundQueue.pop(); setFdEvents(0); continue; } // Some other error. Give up LOG(FATAL) << "Failed to send outbound event on channel '" << mChannel->getName() << "'. status=" << statusToString(result) << "(" << result << ")"; Loading