Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a916e1c authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 12704449 from d71f5866 to 25Q2-release

Change-Id: Ic01de8e8c32958111c5f626b254d9f3a67b79775
parents d7b93c12 d71f5866
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 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.
-->
<!-- Adds the feature indicating support for the BLE Channel sounding -->
<permissions>
    <feature name="android.hardware.bluetooth_le.channel_sounding" />
</permissions>
+5 −1
Original line number Diff line number Diff line
@@ -6,3 +6,7 @@ per-file input_transfer_token.h = file:platform/frameworks/base:/services/core/j

# CoGS
per-file *luts* = file:platform/frameworks/base:/graphics/java/android/graphics/OWNERS

# ADPF
per-file performance_hint.h = file:platform/frameworks/base:/ADPF_OWNERS
per-file thermal.h = file:platform/frameworks/base:/ADPF_OWNERS
+165 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 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.
 */

/**
 * @addtogroup NativeActivity Native Activity
 * @{
 */

/**
 * @file display_luts.h
 */
#pragma once

#include <inttypes.h>

__BEGIN_DECLS

/**
 * The dimension of the lut
 */
enum ADisplayLuts_Dimension : int32_t {
    ADISPLAYLUTS_ONE_DIMENSION = 1,
    ADISPLAYLUTS_THREE_DIMENSION = 3,
};
typedef enum ADisplayLuts_Dimension ADisplayLuts_Dimension;

/**
 * The sampling key used by the lut
 */
enum ADisplayLuts_SamplingKey : int32_t {
    ADISPLAYLUTS_SAMPLINGKEY_RGB = 0,
    ADISPLAYLUTS_SAMPLINGKEY_MAX_RGB = 1,
};
typedef enum ADisplayLuts_SamplingKey ADisplayLuts_SamplingKey;

/**
 * Used to get and set display luts entry
 */
typedef struct ADisplayLutsEntry ADisplayLutsEntry;

/**
 * Used to get and set display luts
 */
typedef struct ADisplayLuts ADisplayLuts;

/**
 * Creates a \a ADisplayLutsEntry entry.
 *
 * You are responsible for mamanging the memory of the returned object.
 * Always call \a ADisplayLutsEntry_destroy to release it after use.
 *
 * Functions like \a ADisplayLuts_set create their own copies of entries,
 * therefore they don't take the ownership of the instance created by
 * \a ADisplayLutsEntry_create.
 *
 * @param buffer The lut raw buffer. The function creates a copy of it and does not need to
 * outlive the life of the ADisplayLutsEntry.
 * @param length The length of lut raw buffer
 * @param dimension The dimension of the lut. see \a ADisplayLuts_Dimension
 * @param key The sampling key used by the lut. see \a ADisplayLuts_SamplingKey
 * @return a new \a ADisplayLutsEntry instance.
 */
ADisplayLutsEntry* _Nonnull ADisplayLutsEntry_createEntry(float* _Nonnull buffer,
        int32_t length, int32_t dimension, int32_t key) __INTRODUCED_IN(36);

/**
 * Destroy the \a ADisplayLutsEntry instance.
 *
 * @param entry The entry to be destroyed
 */
void ADisplayLutsEntry_destroy(ADisplayLutsEntry* _Nullable entry) __INTRODUCED_IN(36);

/**
 * Gets the dimension of the entry.
 *
 * The function is only valid for the lifetime of the `entry`.
 *
 * @param entry The entry to query
 * @return the dimension of the lut
 */
ADisplayLuts_Dimension ADisplayLutsEntry_getDimension(const ADisplayLutsEntry* _Nonnull entry)
        __INTRODUCED_IN(36);

/**
 * Gets the size for each dimension of the entry.
 *
 * The function is only valid for the lifetime of the `entry`.
 *
 * @param entry The entry to query
 * @return the size of each dimension of the lut
 */
int32_t ADisplayLutsEntry_getSize(const ADisplayLutsEntry* _Nonnull entry)
        __INTRODUCED_IN(36);

/**
 * Gets the sampling key used by the entry.
 *
 * The function is only valid for the lifetime of the `entry`.
 *
 * @param entry The entry to query
 * @return the sampling key used by the lut
 */
ADisplayLuts_SamplingKey ADisplayLutsEntry_getSamplingKey(const ADisplayLutsEntry* _Nonnull entry)
        __INTRODUCED_IN(36);

/**
 * Gets the lut buffer of the entry.
 *
 * The function is only valid for the lifetime of the `entry`.
 *
 * @param entry The entry to query
 * @return a pointer to the raw lut buffer
 */
const float* _Nonnull ADisplayLutsEntry_getBuffer(const ADisplayLutsEntry* _Nonnull entry)
        __INTRODUCED_IN(36);

/**
 * Creates a \a ADisplayLuts instance.
 *
 * You are responsible for mamanging the memory of the returned object.
 * Always call \a ADisplayLuts_destroy to release it after use. E.g., after calling
 * the function \a ASurfaceTransaction_setLuts.
 *
 * @return a new \a ADisplayLuts instance
 */
ADisplayLuts* _Nonnull ADisplayLuts_create() __INTRODUCED_IN(36);

/**
 * Sets Luts in order to be applied.
 *
 * The function accepts a single 1D Lut, or a single 3D Lut or both 1D and 3D Lut in order.
 * And the function will replace any previously set lut(s).
 * If you want to clear the previously set lut(s), set `entries` to be nullptr,
 * and `numEntries` will be internally ignored.
 *
 * @param luts the pointer of the \a ADisplayLuts instance
 * @param entries the pointer of the array of lut entries to be applied
 * @param numEntries the number of lut entries. The value should be either 1 or 2.
 */
void ADisplayLuts_setEntries(ADisplayLuts* _Nonnull luts,
        ADisplayLutsEntry* _Nullable *_Nullable entries, int32_t numEntries) __INTRODUCED_IN(36);

/**
 * Deletes the \a ADisplayLuts instance.
 *
 * @param luts The luts to be destroyed
 */
void ADisplayLuts_destroy(ADisplayLuts* _Nullable luts) __INTRODUCED_IN(36);

__END_DECLS

/** @} */
 No newline at end of file
+17 −9
Original line number Diff line number Diff line
@@ -90,20 +90,23 @@ enum {
    ALOOPER_POLL_WAKE = -1,

    /**
     * Result from ALooper_pollOnce() and ALooper_pollAll():
     * One or more callbacks were executed.
     * Result from ALooper_pollOnce():
     * One or more callbacks were executed. The poll may also have been
     * explicitly woken by ALooper_wake().
     */
    ALOOPER_POLL_CALLBACK = -2,

    /**
     * Result from ALooper_pollOnce() and ALooper_pollAll():
     * The timeout expired.
     * The timeout expired. The poll may also have been explicitly woken by
     * ALooper_wake().
     */
    ALOOPER_POLL_TIMEOUT = -3,

    /**
     * Result from ALooper_pollOnce() and ALooper_pollAll():
     * An error occurred.
     * An error occurred. The poll may also have been explicitly woken by
     * ALooper_wake(()).
     */
    ALOOPER_POLL_ERROR = -4,
};
@@ -182,10 +185,13 @@ typedef int (*ALooper_callbackFunc)(int fd, int events, void* data);
 * If the timeout is zero, returns immediately without blocking.
 * If the timeout is negative, waits indefinitely until an event appears.
 *
 * **All return values may also imply ALOOPER_POLL_WAKE.** If you call this in a
 * loop, you must treat all return values as if they also indicated
 * ALOOPER_POLL_WAKE.
 *
 * Returns ALOOPER_POLL_WAKE if the poll was awoken using ALooper_wake() before
 * the timeout expired and no callbacks were invoked and no other file
 * descriptors were ready. **All return values may also imply
 * ALOOPER_POLL_WAKE.**
 * descriptors were ready.
 *
 * Returns ALOOPER_POLL_CALLBACK if one or more callbacks were invoked. The poll
 * may also have been explicitly woken by ALooper_wake.
@@ -214,9 +220,9 @@ int ALooper_pollOnce(int timeoutMillis, int* outFd, int* outEvents, void** outDa
 * data has been consumed or a file descriptor is available with no callback.
 * This function will never return ALOOPER_POLL_CALLBACK.
 *
 * This API cannot be used safely, but a safe alternative exists (see below). As
 * such, new builds will not be able to call this API and must migrate to the
 * safe API. Binary compatibility is preserved to support already-compiled apps.
 * This API will not reliably respond to ALooper_wake. As such, this API is
 * hidden and callers should migrate to ALooper_pollOnce. Binary compatibility
 * is preserved to support already-compiled apps.
 *
 * \bug ALooper_pollAll will not wake in response to ALooper_wake calls if it
 * also handles another event at the same time.
@@ -235,6 +241,8 @@ int ALooper_pollAll(int timeoutMillis, int* outFd, int* outEvents, void** outDat
 *
 * This method can be called on any thread.
 * This method returns immediately.
 *
 * \bug ALooper_pollAll will not reliably wake in response to ALooper_wake.
 */
void ALooper_wake(ALooper* looper);

+154 −4
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@
#define ANDROID_NATIVE_PERFORMANCE_HINT_H

#include <sys/cdefs.h>
#include <jni.h>

/******************************************************************
 *
@@ -109,10 +110,25 @@ typedef struct AWorkDuration AWorkDuration;
 */
typedef struct APerformanceHintManager APerformanceHintManager;

/**
 * An opaque type representing a handle to a performance hint session creation configuration.
 * It is consumed by {@link APerformanceHint_createSessionUsingConfig}.
 *
 * A session creation config encapsulates the required information for a session.
 * Additionally, the caller can set various settings for the session,
 * to be passed during creation, streamlining the session setup process.
 *
 * The caller may reuse this object and modify the settings in it
 * to create additional sessions.
 *
 */
typedef struct ASessionCreationConfig ASessionCreationConfig;

/**
 * An opaque type representing a handle to a performance hint session.
 * A session can only be acquired from a {@link APerformanceHintManager}
 * with {@link APerformanceHint_createSession}. It must be
 * with {@link APerformanceHint_createSession}
 * or {@link APerformanceHint_createSessionUsingConfig}. It must be
 * freed with {@link APerformanceHint_closeSession} after use.
 *
 * A Session represents a group of threads with an inter-related workload such that hints for
@@ -152,13 +168,27 @@ APerformanceHintManager* _Nullable APerformanceHint_getManager()
 * @param size The size of the list of threadIds.
 * @param initialTargetWorkDurationNanos The target duration in nanoseconds for the new session.
 *     This must be positive if using the work duration API, or 0 otherwise.
 * @return APerformanceHintManager instance on success, nullptr on failure.
 * @return APerformanceHintSession pointer on success, nullptr on failure.
 */
APerformanceHintSession* _Nullable APerformanceHint_createSession(
        APerformanceHintManager* _Nonnull manager,
        const int32_t* _Nonnull threadIds, size_t size,
        int64_t initialTargetWorkDurationNanos) __INTRODUCED_IN(__ANDROID_API_T__);

/**
 * Creates a session for the given set of threads that are graphics pipeline threads
 * and set their initial target work duration.
 *
 * @param manager The performance hint manager instance.
 * @param config The configuration struct containing required information
 *        to create a session.
 * @return APerformanceHintSession pointer on success, nullptr on failure.
 */
APerformanceHintSession* _Nullable APerformanceHint_createSessionUsingConfig(
        APerformanceHintManager* _Nonnull manager,
        ASessionCreationConfig* _Nonnull config)
        __INTRODUCED_IN(36);

/**
 * Get preferred update rate information for this device.
 *
@@ -168,6 +198,15 @@ APerformanceHintSession* _Nullable APerformanceHint_createSession(
int64_t APerformanceHint_getPreferredUpdateRateNanos(
        APerformanceHintManager* _Nonnull manager) __INTRODUCED_IN(__ANDROID_API_T__);

/**
 * Get maximum number of graphics pipieline threads per-app for this device.
 *
 * @param manager The performance hint manager instance.
 * @return the maximum number of graphics pipeline threads supported by device.
 */
 int APerformanceHint_getMaxGraphicsPipelineThreadsCount(
        APerformanceHintManager* _Nonnull manager) __INTRODUCED_IN(36);

/**
 * Updates this session's target duration for each cycle of work.
 *
@@ -202,6 +241,9 @@ int APerformanceHint_reportActualWorkDuration(
 * Release the performance hint manager pointer acquired via
 * {@link APerformanceHint_createSession}.
 *
 * This cannot be used to close a Java PerformanceHintManager.Session, as its
 * lifecycle is tied to the object in the SDK.
 *
 * @param session The performance hint session instance to release.
 */
void APerformanceHint_closeSession(
@@ -316,12 +358,12 @@ int APerformanceHint_notifyWorkloadReset(
 * call {@link AWorkDuration_release()} to destroy {@link AWorkDuration} and release all resources
 * associated with it.
 *
 * @return AWorkDuration on success and nullptr otherwise.
 * @return AWorkDuration pointer.
 */
AWorkDuration* _Nonnull AWorkDuration_create() __INTRODUCED_IN(__ANDROID_API_V__);

/**
 * Destroys {@link AWorkDuration} and free all resources associated to it.
 * Destroys a {@link AWorkDuration} and frees all resources associated with it.
 *
 * @param aWorkDuration The {@link AWorkDuration} created by calling {@link AWorkDuration_create()}
 */
@@ -370,6 +412,114 @@ void AWorkDuration_setActualCpuDurationNanos(AWorkDuration* _Nonnull aWorkDurati
void AWorkDuration_setActualGpuDurationNanos(AWorkDuration* _Nonnull aWorkDuration,
        int64_t actualGpuDurationNanos) __INTRODUCED_IN(__ANDROID_API_V__);

/**
 * Return the APerformanceHintSession wrapped by a Java PerformanceHintManager.Session object.
 *
 * The Java session maintains ownership over the wrapped native session, so it cannot be
 * closed using {@link APerformanceHint_closeSession}.
 *
 * @param env The Java environment where the PerformanceHintManager.Session lives.
 * @param sessionObj The Java Session to unwrap.
 *
 * @return A pointer to the APerformanceHintManager that backs the Java Session.
 */
APerformanceHintSession* _Nonnull APerformanceHint_borrowSessionFromJava(
        JNIEnv* _Nonnull env, jobject _Nonnull sessionObj) __INTRODUCED_IN(36);

/*
 * Creates a new ASessionCreationConfig.
 *
 * When the client finishes using {@link ASessionCreationConfig}, it should
 * call {@link ASessionCreationConfig_release()} to destroy
 * {@link ASessionCreationConfig} and release all resources
 * associated with it.
 *
 * @return ASessionCreationConfig pointer.
 */
ASessionCreationConfig* _Nonnull ASessionCreationConfig_create()
                __INTRODUCED_IN(36);


/**
 * Destroys a {@link ASessionCreationConfig} and frees all
 * resources associated with it.
 *
 * @param config The {@link ASessionCreationConfig}
 *        created by calling {@link ASessionCreationConfig_create()}.
 */
void ASessionCreationConfig_release(
                ASessionCreationConfig* _Nonnull config) __INTRODUCED_IN(36);

/**
 * Sets the tids to be associated with the session to be created.
 *
 * @param config The {@link ASessionCreationConfig}
 *        created by calling {@link ASessionCreationConfig_create()}
 * @param tids The list of tids to be associated with this session. They must be part of
 *        this process' thread group.
 * @param size The size of the list of tids.
 *
 * @return 0 on success.
 *         EINVAL if invalid array pointer or the value of size
 */
int ASessionCreationConfig_setTids(
        ASessionCreationConfig* _Nonnull config,
        const pid_t* _Nonnull tids, size_t size)  __INTRODUCED_IN(36);

/**
 * Sets the initial target work duration in nanoseconds for the session to be created.
 *
 * @param config The {@link ASessionCreationConfig}
 *        created by calling {@link ASessionCreationConfig_create()}.
 * @param targetWorkDurationNanos The parameter to specify a target duration
 *        in nanoseconds for the new session; this value must be positive to use
 *        the work duration API.
 *
 * @return 0 on success.
 *         ENOTSUP if unsupported
 *         EINVAL if invalid value
 */
int ASessionCreationConfig_setTargetWorkDurationNanos(
        ASessionCreationConfig* _Nonnull config,
        int64_t targetWorkDurationNanos)  __INTRODUCED_IN(36);

/**
 * Sets whether power efficiency mode will be enabled for the session.
 * This tells the session that these threads can be
 * safely scheduled to prefer power efficiency over performance.
 *
 * @param config The {@link ASessionCreationConfig}
 *        created by calling {@link ASessionCreationConfig_create()}.
 * @param enabled Whether power efficiency mode will be enabled.
 *
 * @return 0 on success.
 *         ENOTSUP if unsupported
 *         EINVAL if invalid pointer to creation config
 */
int ASessionCreationConfig_setPreferPowerEfficiency(
        ASessionCreationConfig* _Nonnull config, bool enabled)  __INTRODUCED_IN(36);

/**
 * Sessions setting this hint are expected to time the critical path of
 * graphics pipeline from end to end, with the total work duration
 * representing the time from the start of frame production until the
 * buffer is fully finished drawing.
 *
 * It should include any threads on the critical path of that pipeline,
 * up to a limit accessible from {@link getMaxGraphicsPipelineThreadsCount()}.
 *
 * @param config The {@link ASessionCreationConfig}
 *        created by calling {@link ASessionCreationConfig_create()}.
 * @param enabled Whether this session manages a graphics pipeline's critical path.
 *
 * @return 0 on success.
 *         ENOTSUP if unsupported
 *         EINVAL if invalid pointer to creation config or maximum threads for graphics
                  pipeline is reached.
 */
int ASessionCreationConfig_setGraphicsPipeline(
        ASessionCreationConfig* _Nonnull config, bool enabled)  __INTRODUCED_IN(36);

__END_DECLS

#endif // ANDROID_NATIVE_PERFORMANCE_HINT_H
Loading