Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADPF bindings #16445

Merged
merged 4 commits into from
Nov 2, 2023
Merged

ADPF bindings #16445

merged 4 commits into from
Nov 2, 2023

Conversation

PatriceJiang
Copy link
Contributor

Re: #

Changelog


Continuous Integration

This pull request:

  • needs automatic test cases check.

    Manual trigger with @cocos-robot run test cases afterward.

  • does not change any runtime related code or build configuration

    If any reviewer thinks the CI checks are needed, please uncheck this option, then close and reopen the issue.


Compatibility Check

This pull request:

  • changes public API, and have ensured backward compatibility with deprecated features.
  • affects platform compatibility, e.g. system version, browser version, platform sdk version, platform toolchain, language version, hardware compatibility etc.
  • affects file structure of the build package or build configuration which requires user project upgrade.
  • introduces breaking changes, please list all changes, affected features and the scope of violation.

@PatriceJiang PatriceJiang added this to the V3.8.2 milestone Oct 27, 2023
@github-actions
Copy link

github-actions bot commented Oct 27, 2023

Interface Check Report

! WARNING this pull request has changed these public interfaces:

@@ -34275,25 +34275,25 @@
          * @param requestURL @en Request download resource URL  @zh 请求下载资源的URL
          * @param storagePath @en Storage path for downloaded file @zh 下载文件存储路径
          * @param identifier  @en identifier @zh 标识符
          */
-        export type DownloadTask = {
+        export interface DownloadTask {
             requestURL: string;
             storagePath: string;
             identifier: string;
-        };
+        }
         /**
          * @en DownloaderTask @zh 下载任务对象
          * @param requestURL @en Request download resource URL  @zh 请求下载资源的URL
          * @param storagePath @en Storage path for downloaded file @zh 下载文件存储路径
          * @param identifier  @en identifier @zh 标识符
          * @deprecated since v3.7.0, please use `DownloadTask` to instead.
          */
-        export type DownloaderTask = {
+        export interface DownloaderTask {
             requestURL: string;
             storagePath: string;
             identifier: string;
-        };
+        }
         /**
          * @en DownloaderHints @zh 下载任务的配置接口
          * @param countOfMaxProcessingTasks
          * @en Maximum number of download tasks processed at the same time, optional, default is 6
@@ -35235,8 +35235,57 @@
              * @zh 获取当前传递给执行文件的参数列表
              */
             export const argv: Readonly<string[]>;
         }
+        /**
+         * @en This object provides properties related to thermal characteristics and an optional callback function to track changes in thermal status.
+         *     It is supported only on Android platforms with an API level of 31 or higher.
+         * @zh 该对象提供与热特性相关的属性以及用于跟踪热状态变化的可选回调函数。仅支持 API 等级为 31 或更高的 Android 平台。
+         *
+         * @see https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga1055f6c8d5910a1904162bea75807314
+         */
+        export const adpf: {
+            /**
+             * @en Provides an estimate of how much thermal headroom the device currently has before hitting severe throttling. The value range is a non-negative float, where 0.0 represents a fixed distance from overheating, 1.0 indicates the device will be severely throttled, and values greater than 1.0 may imply even heavier throttling.
+             * @zh 提供设备在达到严重节流之前当前有多少热余量的估计值。值的范围是非负浮点数,其中0.0表示距离过热的固定距离,1.0表示设备将被严重限制,而大于1.0的值可能表示更重的限制。
+             * @see https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga1055f6c8d5910a1904162bea75807314
+             */
+            readonly thermalHeadroom: number;
+            /**
+             * @en A number indicating the current thermal status
+             * @zh 表示当前热状态的数字
+             */
+            readonly thermalStatus: number;
+            /**
+             * @en  A number indicating the minimum threshold for thermal status
+             * @zh 表示热状态的最大阈值的数字
+             */
+            readonly thermalStatusMin: number;
+            /**
+             * @en  A number indicating the maximum threshold for thermal status
+             * @zh 表示热状态的最大阈值的数字
+             */
+            readonly thermalStatusMax: number;
+            /**
+             * @en  A normalized value of the current thermal status.  It's computed based on the formula:
+             *     (thermalStatus - thermalStatusMin) / thermalStatusMax.
+             *     This value ranges between 0 and 1, giving a relative measure of the current thermal status against its minimum and maximum thresholds.
+             * @zh 当前热状态的归一化值,范围在 0 到 1 之间.  它是基于以下公式计算的:  (thermalStatus - thermalStatusMin) / thermalStatusMax.
+             *     提供了当前热状态相对于其最小和最大阈值的相对测量。
+             */
+            readonly thermalStatusNormalized: number;
+            /**
+             * @en An optional callback function that is triggered when the thermal status changes
+             * @zh 该对象提供与热特性相关的属性以及用于跟踪热状态变化的可选回调函数
+             *
+             * @param previousStatus @zh 之前的热状态 @en The previous thermal status
+             * @param newStatus @zh 更改后的新热状态 @en The new thermal status after the change
+             * @param statusMin @zh 热状态的最小阈值 @en The minimum threshold for thermal status
+             * @param statusMax @zh 热状态的最大阈值 @en The maximum threshold for thermal status
+             * @returns
+             */
+            onThermalStatusChanged?: (previousStatus: number, newStatus: number, statusMin: number, statusMax: number) => void;
+        } | undefined;
     }
     export namespace rendering {
         export function getUpdateFrequencyName(e: UpdateFrequency): string;
         export function getParameterTypeName(e: ParameterType): string;

@PatriceJiang PatriceJiang marked this pull request as ready for review October 27, 2023 07:21
ns->setProperty("adpf", adpfObj);
}

#endif // CC_PLATFORM_ANDROID
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it better to put all ADPF related codes into another .cpp file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, all custom JSB extension attributes are placed in this file. I don't think it's necessary to open another file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this file becomes bigger and bigger, it is not suitable to do as previous.

@minggo minggo merged commit 7e459d2 into cocos:v3.8.2 Nov 2, 2023
22 of 23 checks passed
HakimNB pushed a commit to HakimNB/CocosEngine_231116 that referenced this pull request Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants