summaryrefslogtreecommitdiff
path: root/native
diff options
context:
space:
mode:
Diffstat (limited to 'native')
-rw-r--r--native/android/libandroid.map.txt1
-rw-r--r--native/android/performance_hint.cpp6
-rw-r--r--native/android/surface_control.cpp12
-rw-r--r--native/android/tests/performance_hint/PerformanceHintNativeTest.cpp4
-rw-r--r--native/graphics/jni/imagedecoder.cpp4
5 files changed, 22 insertions, 5 deletions
diff --git a/native/android/libandroid.map.txt b/native/android/libandroid.map.txt
index 28fd040f6c64..d74f9b7bb659 100644
--- a/native/android/libandroid.map.txt
+++ b/native/android/libandroid.map.txt
@@ -346,6 +346,7 @@ LIBANDROID_PLATFORM {
extern "C++" {
ASurfaceControl_registerSurfaceStatsListener*;
ASurfaceControl_unregisterSurfaceStatsListener*;
+ ASurfaceControl_getChoreographer*;
ASurfaceControlStats_getAcquireTime*;
ASurfaceControlStats_getFrameNumber*;
};
diff --git a/native/android/performance_hint.cpp b/native/android/performance_hint.cpp
index b3628fa3e5ce..27666caafac4 100644
--- a/native/android/performance_hint.cpp
+++ b/native/android/performance_hint.cpp
@@ -69,7 +69,7 @@ public:
int updateTargetWorkDuration(int64_t targetDurationNanos);
int reportActualWorkDuration(int64_t actualDurationNanos);
- int sendHint(SessionHint hint);
+ int sendHint(int32_t hint);
int setThreads(const int32_t* threadIds, size_t size);
int getThreadIds(int32_t* const threadIds, size_t* size);
@@ -243,7 +243,7 @@ int APerformanceHintSession::reportActualWorkDuration(int64_t actualDurationNano
return 0;
}
-int APerformanceHintSession::sendHint(SessionHint hint) {
+int APerformanceHintSession::sendHint(int32_t hint) {
if (hint < 0 || hint >= static_cast<int32_t>(mLastHintSentTimestamp.size())) {
ALOGE("%s: invalid session hint %d", __FUNCTION__, hint);
return EINVAL;
@@ -335,7 +335,7 @@ void APerformanceHint_closeSession(APerformanceHintSession* session) {
delete session;
}
-int APerformanceHint_sendHint(void* session, SessionHint hint) {
+int APerformanceHint_sendHint(void* session, int32_t hint) {
return reinterpret_cast<APerformanceHintSession*>(session)->sendHint(hint);
}
diff --git a/native/android/surface_control.cpp b/native/android/surface_control.cpp
index 58de02c79e35..904fa7484027 100644
--- a/native/android/surface_control.cpp
+++ b/native/android/surface_control.cpp
@@ -180,6 +180,18 @@ void ASurfaceControl_unregisterSurfaceStatsListener(void* context,
reinterpret_cast<void*>(func));
}
+AChoreographer* ASurfaceControl_getChoreographer(ASurfaceControl* aSurfaceControl) {
+ LOG_ALWAYS_FATAL_IF(aSurfaceControl == nullptr, "aSurfaceControl should not be nullptr");
+ SurfaceControl* surfaceControl =
+ ASurfaceControl_to_SurfaceControl(reinterpret_cast<ASurfaceControl*>(aSurfaceControl));
+ if (!surfaceControl->isValid()) {
+ ALOGE("Attempted to get choreographer from invalid surface control");
+ return nullptr;
+ }
+ SurfaceControl_acquire(surfaceControl);
+ return reinterpret_cast<AChoreographer*>(surfaceControl->getChoreographer().get());
+}
+
int64_t ASurfaceControlStats_getAcquireTime(ASurfaceControlStats* stats) {
if (const auto* fence = std::get_if<sp<Fence>>(&stats->acquireTimeOrFence)) {
// We got a fence instead of the acquire time due to latch unsignaled.
diff --git a/native/android/tests/performance_hint/PerformanceHintNativeTest.cpp b/native/android/tests/performance_hint/PerformanceHintNativeTest.cpp
index 791adfd33fcd..321a7dddb144 100644
--- a/native/android/tests/performance_hint/PerformanceHintNativeTest.cpp
+++ b/native/android/tests/performance_hint/PerformanceHintNativeTest.cpp
@@ -127,7 +127,7 @@ TEST_F(PerformanceHintTest, TestSession) {
result = APerformanceHint_reportActualWorkDuration(session, -1L);
EXPECT_EQ(EINVAL, result);
- SessionHint hintId = SessionHint::CPU_LOAD_RESET;
+ int hintId = 2;
EXPECT_CALL(*iSession, sendHint(Eq(hintId))).Times(Exactly(1));
result = APerformanceHint_sendHint(session, hintId);
EXPECT_EQ(0, result);
@@ -140,7 +140,7 @@ TEST_F(PerformanceHintTest, TestSession) {
result = APerformanceHint_sendHint(session, hintId);
EXPECT_EQ(0, result);
- result = APerformanceHint_sendHint(session, static_cast<SessionHint>(-1));
+ result = APerformanceHint_sendHint(session, -1);
EXPECT_EQ(EINVAL, result);
EXPECT_CALL(*iSession, close()).Times(Exactly(1));
diff --git a/native/graphics/jni/imagedecoder.cpp b/native/graphics/jni/imagedecoder.cpp
index cd6ed2391608..e18b4a9d2420 100644
--- a/native/graphics/jni/imagedecoder.cpp
+++ b/native/graphics/jni/imagedecoder.cpp
@@ -25,10 +25,14 @@
#include <hwui/ImageDecoder.h>
#include <log/log.h>
#include <SkAndroidCodec.h>
+#include <SkAlphaType.h>
#include <SkCodec.h>
+#include <SkCodecAnimation.h>
#include <SkColorSpace.h>
+#include <SkColorType.h>
#include <SkImageInfo.h>
#include <SkRect.h>
+#include <SkRefCnt.h>
#include <SkSize.h>
#include <SkStream.h>
#include <utils/Color.h>