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/android/performance_hint.h +95 −0 Original line number Diff line number Diff line Loading @@ -76,6 +76,8 @@ __BEGIN_DECLS struct APerformanceHintManager; struct APerformanceHintSession; struct AWorkDuration; struct ANativeWindow; struct ASurfaceControl; /** * {@link AWorkDuration} is an opaque type that represents the breakdown of the Loading Loading @@ -150,6 +152,9 @@ typedef struct ASessionCreationConfig ASessionCreationConfig; */ typedef struct APerformanceHintSession APerformanceHintSession; typedef struct ANativeWindow ANativeWindow; typedef struct ASurfaceControl ASurfaceControl; /** * Acquire an instance of the performance hint manager. * Loading Loading @@ -353,6 +358,39 @@ int APerformanceHint_notifyWorkloadReset( APerformanceHintSession* _Nonnull session, bool cpu, bool gpu, const char* _Nonnull debugName) __INTRODUCED_IN(36); /** * Associates a session with any {@link ASurfaceControl} or {@link ANativeWindow} * instances managed by this session. * * This method is primarily intended for sessions that manage the timing of an entire * graphics pipeline end-to-end, such as those using the * {@link ASessionCreationConfig_setGraphicsPipeline} API. However, any session directly * or indirectly managing a graphics pipeline should still associate themselves with * directly relevant ASurfaceControl or ANativeWindow instances for better optimization. * * To see any benefit from this method, the client must make sure they are updating the framerate * of attached surfaces using methods such as {@link ANativeWindow_setFrameRate}, or by updating * any associated ASurfaceControls with transactions that have {ASurfaceTransaction_setFrameRate}. * * @param session The {@link APerformanceHintSession} instance to update. * @param nativeWindows A pointer to a list of ANativeWindows associated with this session. * nullptr can be passed to indicate there are no associated ANativeWindows. * @param nativeWindowsSize The number of ANativeWindows in the list. * @param surfaceControls A pointer to a list of ASurfaceControls associated with this session. * nullptr can be passed to indicate there are no associated ASurfaceControls. * @param surfaceControlsSize The number of ASurfaceControls in the list. * * @return 0 on success. * EPIPE if communication has failed. * ENOTSUP if unsupported. * EINVAL if invalid or empty arguments passed. */ int APerformanceHint_setNativeSurfaces(APerformanceHintSession* _Nonnull session, ANativeWindow* _Nonnull* _Nullable nativeWindows, int nativeWindowsSize, ASurfaceControl* _Nonnull* _Nullable surfaceControls, int surfaceControlsSize) __INTRODUCED_IN(36); /** * Creates a new AWorkDuration. When the client finishes using {@link AWorkDuration}, it should * call {@link AWorkDuration_release()} to destroy {@link AWorkDuration} and release all resources Loading Loading @@ -520,6 +558,63 @@ int ASessionCreationConfig_setPreferPowerEfficiency( int ASessionCreationConfig_setGraphicsPipeline( ASessionCreationConfig* _Nonnull config, bool enabled) __INTRODUCED_IN(36); /** * Associates a session with any {@link ASurfaceControl} or {@link ANativeWindow} * instances managed by this session. See {@link APerformanceHint_setNativeSurfaces} * for more details. * * @param config The {@link ASessionCreationConfig} * created by calling {@link ASessionCreationConfig_create()}. * @param nativeWindows A pointer to a list of ANativeWindows associated with this session. * nullptr can be passed to indicate there are no associated ANativeWindows. * @param nativeWindowsSize The number of ANativeWindows in the list. * @param surfaceControls A pointer to a list of ASurfaceControls associated with this session. * nullptr can be passed to indicate there are no associated ASurfaceControls. * @param surfaceControlsSize The number of ASurfaceControls in the list. * * @return 0 on success. * ENOTSUP if unsupported. * EINVAL if invalid or empty arguments passed. */ int ASessionCreationConfig_setNativeSurfaces( ASessionCreationConfig* _Nonnull config, ANativeWindow* _Nonnull* _Nullable nativeWindows, int nativeWindowsSize, ASurfaceControl* _Nonnull* _Nullable surfaceControls, int surfaceControlsSize) __INTRODUCED_IN(36); /** * Enable automatic timing mode for sessions using the GRAPHICS_PIPELINE API with an attached * surface. In this mode, sessions do not need to report actual durations and only need * to keep their thread list up-to-date, set a native surface, call * {@link ASessionCreationConfig_setGraphicsPipeline()} to signal that the session is in * "graphics pipeline" mode, and then set whether automatic timing is desired for the * CPU, GPU, or both, using this method. * * It is still be beneficial to set an accurate target time, as this may help determine * timing information for some workloads where there is less information available from * the framework, such as games. Additionally, reported CPU durations will be ignored * while automatic CPU timing is enabled, and similarly GPU durations will be ignored * when automatic GPU timing is enabled. When both are enabled, the entire * reportActualWorkDuration call will be ignored, and the session will be managed * completely automatically. * * This mode will not work unless the client makes sure they are updating the framerate * of attached surfaces with methods such as {@link ANativeWindow_setFrameRate}, or updating * any associated ASurfaceControls with transactions that have {ASurfaceTransaction_setFrameRate}. * * @param config The {@link ASessionCreationConfig} * created by calling {@link ASessionCreationConfig_create()}. * @param cpu Whether to enable automatic timing for the CPU for this session. * @param gpu Whether to enable automatic timing for the GPU for this session. * * @return 0 on success. * ENOTSUP if unsupported. */ int ASessionCreationConfig_setUseAutoTiming( ASessionCreationConfig* _Nonnull config, bool cpu, bool gpu) __INTRODUCED_IN(36); __END_DECLS #endif // ANDROID_NATIVE_PERFORMANCE_HINT_H Loading include/android/surface_control.h +0 −63 Original line number Diff line number Diff line Loading @@ -780,69 +780,6 @@ void ASurfaceTransaction_setFrameRateWithChangeStrategy(ASurfaceTransaction* _No int8_t changeFrameRateStrategy) __INTRODUCED_IN(31); /** * Sets the intended frame rate for the given \a surface_control. * * On devices that are capable of running the display at different frame rates, * the system may choose a display refresh rate to better match this surface's frame * rate. Usage of this API won't introduce frame rate throttling, or affect other * aspects of the application's frame production pipeline. However, because the system * may change the display refresh rate, calls to this function may result in changes * to Choreographer callback timings, and changes to the time interval at which the * system releases buffers back to the application. * * You can register for changes in the refresh rate using * \a AChoreographer_registerRefreshRateCallback. * * See ASurfaceTransaction_clearFrameRate(). * * Available since API level 36. * * \param desiredMinRate The desired minimum frame rate (inclusive) for the surface, specifying that * the surface prefers the device render rate to be at least `desiredMinRate`. * * <p>Set `desiredMinRate` = `desiredMaxRate` to indicate the surface prefers an exact frame rate. * * <p>Set `desiredMinRate` = 0 to indicate the surface has no preference * and any frame rate is acceptable. * * <p>The value should be greater than or equal to 0. * * \param desiredMaxRate The desired maximum frame rate (inclusive) for the surface, specifying that * the surface prefers the device render rate to be at most `desiredMaxRate`. * * <p>Set `desiredMaxRate` = `desiredMinRate` to indicate the surface prefers an exact frame rate. * * <p>Set `desiredMaxRate` = positive infinity to indicate the surface has no preference * and any frame rate is acceptable. * * <p>The value should be greater than or equal to `desiredMinRate`. * * \param fixedSourceRate The "fixed source" frame rate of the surface if the content has an * inherently fixed frame rate, e.g. a video that has a specific frame rate. * * <p>When the frame rate chosen for the surface is the `fixedSourceRate` or a * multiple, the surface can render without frame pulldown, for optimal smoothness. For * example, a 30 fps video (`fixedSourceRate`=30) renders just as smoothly on 30 fps, * 60 fps, 90 fps, 120 fps, and so on. * * <p>Setting the fixed source rate can also be used together with a desired * frame rate min and max via setting `desiredMinRate` and `desiredMaxRate`. This still * means the surface's content has a fixed frame rate of `fixedSourceRate`, but additionally * specifies the preference to be in the range [`desiredMinRate`, `desiredMaxRate`]. For example, an * app might want to specify there is 30 fps video (`fixedSourceRate`=30) as well as a smooth * animation on the same surface which looks good when drawing within a frame rate range such as * [`desiredMinRate`, `desiredMaxRate`] = [60,120]. * * \param changeFrameRateStrategy Whether display refresh rate transitions caused by this surface * should be seamless. A seamless transition is one that doesn't have any visual interruptions, such * as a black screen for a second or two. */ void ASurfaceTransaction_setFrameRateParams( ASurfaceTransaction* _Nonnull transaction, ASurfaceControl* _Nonnull surface_control, float desiredMinRate, float desiredMaxRate, float fixedSourceRate, ANativeWindow_ChangeFrameRateStrategy changeFrameRateStrategy) __INTRODUCED_IN(36); /** * Clears the frame rate which is set for \a surface_control. * Loading 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 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/android/performance_hint.h +95 −0 Original line number Diff line number Diff line Loading @@ -76,6 +76,8 @@ __BEGIN_DECLS struct APerformanceHintManager; struct APerformanceHintSession; struct AWorkDuration; struct ANativeWindow; struct ASurfaceControl; /** * {@link AWorkDuration} is an opaque type that represents the breakdown of the Loading Loading @@ -150,6 +152,9 @@ typedef struct ASessionCreationConfig ASessionCreationConfig; */ typedef struct APerformanceHintSession APerformanceHintSession; typedef struct ANativeWindow ANativeWindow; typedef struct ASurfaceControl ASurfaceControl; /** * Acquire an instance of the performance hint manager. * Loading Loading @@ -353,6 +358,39 @@ int APerformanceHint_notifyWorkloadReset( APerformanceHintSession* _Nonnull session, bool cpu, bool gpu, const char* _Nonnull debugName) __INTRODUCED_IN(36); /** * Associates a session with any {@link ASurfaceControl} or {@link ANativeWindow} * instances managed by this session. * * This method is primarily intended for sessions that manage the timing of an entire * graphics pipeline end-to-end, such as those using the * {@link ASessionCreationConfig_setGraphicsPipeline} API. However, any session directly * or indirectly managing a graphics pipeline should still associate themselves with * directly relevant ASurfaceControl or ANativeWindow instances for better optimization. * * To see any benefit from this method, the client must make sure they are updating the framerate * of attached surfaces using methods such as {@link ANativeWindow_setFrameRate}, or by updating * any associated ASurfaceControls with transactions that have {ASurfaceTransaction_setFrameRate}. * * @param session The {@link APerformanceHintSession} instance to update. * @param nativeWindows A pointer to a list of ANativeWindows associated with this session. * nullptr can be passed to indicate there are no associated ANativeWindows. * @param nativeWindowsSize The number of ANativeWindows in the list. * @param surfaceControls A pointer to a list of ASurfaceControls associated with this session. * nullptr can be passed to indicate there are no associated ASurfaceControls. * @param surfaceControlsSize The number of ASurfaceControls in the list. * * @return 0 on success. * EPIPE if communication has failed. * ENOTSUP if unsupported. * EINVAL if invalid or empty arguments passed. */ int APerformanceHint_setNativeSurfaces(APerformanceHintSession* _Nonnull session, ANativeWindow* _Nonnull* _Nullable nativeWindows, int nativeWindowsSize, ASurfaceControl* _Nonnull* _Nullable surfaceControls, int surfaceControlsSize) __INTRODUCED_IN(36); /** * Creates a new AWorkDuration. When the client finishes using {@link AWorkDuration}, it should * call {@link AWorkDuration_release()} to destroy {@link AWorkDuration} and release all resources Loading Loading @@ -520,6 +558,63 @@ int ASessionCreationConfig_setPreferPowerEfficiency( int ASessionCreationConfig_setGraphicsPipeline( ASessionCreationConfig* _Nonnull config, bool enabled) __INTRODUCED_IN(36); /** * Associates a session with any {@link ASurfaceControl} or {@link ANativeWindow} * instances managed by this session. See {@link APerformanceHint_setNativeSurfaces} * for more details. * * @param config The {@link ASessionCreationConfig} * created by calling {@link ASessionCreationConfig_create()}. * @param nativeWindows A pointer to a list of ANativeWindows associated with this session. * nullptr can be passed to indicate there are no associated ANativeWindows. * @param nativeWindowsSize The number of ANativeWindows in the list. * @param surfaceControls A pointer to a list of ASurfaceControls associated with this session. * nullptr can be passed to indicate there are no associated ASurfaceControls. * @param surfaceControlsSize The number of ASurfaceControls in the list. * * @return 0 on success. * ENOTSUP if unsupported. * EINVAL if invalid or empty arguments passed. */ int ASessionCreationConfig_setNativeSurfaces( ASessionCreationConfig* _Nonnull config, ANativeWindow* _Nonnull* _Nullable nativeWindows, int nativeWindowsSize, ASurfaceControl* _Nonnull* _Nullable surfaceControls, int surfaceControlsSize) __INTRODUCED_IN(36); /** * Enable automatic timing mode for sessions using the GRAPHICS_PIPELINE API with an attached * surface. In this mode, sessions do not need to report actual durations and only need * to keep their thread list up-to-date, set a native surface, call * {@link ASessionCreationConfig_setGraphicsPipeline()} to signal that the session is in * "graphics pipeline" mode, and then set whether automatic timing is desired for the * CPU, GPU, or both, using this method. * * It is still be beneficial to set an accurate target time, as this may help determine * timing information for some workloads where there is less information available from * the framework, such as games. Additionally, reported CPU durations will be ignored * while automatic CPU timing is enabled, and similarly GPU durations will be ignored * when automatic GPU timing is enabled. When both are enabled, the entire * reportActualWorkDuration call will be ignored, and the session will be managed * completely automatically. * * This mode will not work unless the client makes sure they are updating the framerate * of attached surfaces with methods such as {@link ANativeWindow_setFrameRate}, or updating * any associated ASurfaceControls with transactions that have {ASurfaceTransaction_setFrameRate}. * * @param config The {@link ASessionCreationConfig} * created by calling {@link ASessionCreationConfig_create()}. * @param cpu Whether to enable automatic timing for the CPU for this session. * @param gpu Whether to enable automatic timing for the GPU for this session. * * @return 0 on success. * ENOTSUP if unsupported. */ int ASessionCreationConfig_setUseAutoTiming( ASessionCreationConfig* _Nonnull config, bool cpu, bool gpu) __INTRODUCED_IN(36); __END_DECLS #endif // ANDROID_NATIVE_PERFORMANCE_HINT_H Loading
include/android/surface_control.h +0 −63 Original line number Diff line number Diff line Loading @@ -780,69 +780,6 @@ void ASurfaceTransaction_setFrameRateWithChangeStrategy(ASurfaceTransaction* _No int8_t changeFrameRateStrategy) __INTRODUCED_IN(31); /** * Sets the intended frame rate for the given \a surface_control. * * On devices that are capable of running the display at different frame rates, * the system may choose a display refresh rate to better match this surface's frame * rate. Usage of this API won't introduce frame rate throttling, or affect other * aspects of the application's frame production pipeline. However, because the system * may change the display refresh rate, calls to this function may result in changes * to Choreographer callback timings, and changes to the time interval at which the * system releases buffers back to the application. * * You can register for changes in the refresh rate using * \a AChoreographer_registerRefreshRateCallback. * * See ASurfaceTransaction_clearFrameRate(). * * Available since API level 36. * * \param desiredMinRate The desired minimum frame rate (inclusive) for the surface, specifying that * the surface prefers the device render rate to be at least `desiredMinRate`. * * <p>Set `desiredMinRate` = `desiredMaxRate` to indicate the surface prefers an exact frame rate. * * <p>Set `desiredMinRate` = 0 to indicate the surface has no preference * and any frame rate is acceptable. * * <p>The value should be greater than or equal to 0. * * \param desiredMaxRate The desired maximum frame rate (inclusive) for the surface, specifying that * the surface prefers the device render rate to be at most `desiredMaxRate`. * * <p>Set `desiredMaxRate` = `desiredMinRate` to indicate the surface prefers an exact frame rate. * * <p>Set `desiredMaxRate` = positive infinity to indicate the surface has no preference * and any frame rate is acceptable. * * <p>The value should be greater than or equal to `desiredMinRate`. * * \param fixedSourceRate The "fixed source" frame rate of the surface if the content has an * inherently fixed frame rate, e.g. a video that has a specific frame rate. * * <p>When the frame rate chosen for the surface is the `fixedSourceRate` or a * multiple, the surface can render without frame pulldown, for optimal smoothness. For * example, a 30 fps video (`fixedSourceRate`=30) renders just as smoothly on 30 fps, * 60 fps, 90 fps, 120 fps, and so on. * * <p>Setting the fixed source rate can also be used together with a desired * frame rate min and max via setting `desiredMinRate` and `desiredMaxRate`. This still * means the surface's content has a fixed frame rate of `fixedSourceRate`, but additionally * specifies the preference to be in the range [`desiredMinRate`, `desiredMaxRate`]. For example, an * app might want to specify there is 30 fps video (`fixedSourceRate`=30) as well as a smooth * animation on the same surface which looks good when drawing within a frame rate range such as * [`desiredMinRate`, `desiredMaxRate`] = [60,120]. * * \param changeFrameRateStrategy Whether display refresh rate transitions caused by this surface * should be seamless. A seamless transition is one that doesn't have any visual interruptions, such * as a black screen for a second or two. */ void ASurfaceTransaction_setFrameRateParams( ASurfaceTransaction* _Nonnull transaction, ASurfaceControl* _Nonnull surface_control, float desiredMinRate, float desiredMaxRate, float fixedSourceRate, ANativeWindow_ChangeFrameRateStrategy changeFrameRateStrategy) __INTRODUCED_IN(36); /** * Clears the frame rate which is set for \a surface_control. * Loading
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