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

Commit 706add33 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix crash when checking null surfaces" into main

parents ccc683d6 da6c6fea
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -859,7 +859,7 @@ void APerformanceHintManager::layersFromNativeSurfaces(ANativeWindow** windows,
        std::vector<ANativeWindow*> windowVec(windows, windows + numWindows);
        for (auto&& window : windowVec) {
            Surface* surface = static_cast<Surface*>(window);
            if (Surface::isValid(surface)) {
            if (surface != nullptr) {
                const sp<IBinder>& handle = surface->getSurfaceControlHandle();
                if (handle != nullptr) {
                    out.push_back(handle);
+9 −0
Original line number Diff line number Diff line
@@ -605,6 +605,15 @@ TEST_F(PerformanceHintTest, TestASessionCreationConfig) {
    ASSERT_NE(config, nullptr);
}

TEST_F(PerformanceHintTest, TestSessionCreationWithNullLayers) {
    EXPECT_CALL(*mMockIHintManager, createHintSessionWithConfig(_, _, _, _, _)).Times(1);
    auto&& config = configFromCreator(
            {.tids = mTids, .nativeWindows = {nullptr}, .surfaceControls = {nullptr}});
    APerformanceHintManager* manager = createManager();
    auto&& session = createSessionUsingConfig(manager, config);
    ASSERT_TRUE(session);
}

TEST_F(PerformanceHintTest, TestSupportObject) {
    // Disable GPU and Power Efficiency support to test partial enabling
    mClientData.supportInfo.sessionModes &= ~(1 << (int)hal::SessionMode::AUTO_GPU);