diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-03-04 22:21:59 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2024-03-04 22:21:59 +0000 |
commit | 6508c485fa6392989059a792b40bb9163fcdd072 (patch) | |
tree | 051614c85d7dd4789e7a738c055e666a3c2a99b7 | |
parent | 269a851c3a355d2bef4ff538f77b956a05e3e252 (diff) | |
parent | 1b64fd9c08e4da88796959b237a123c4cb980c09 (diff) | |
download | native-simpleperf-release.tar.gz |
Merge "Snap for 11526323 from 3aa13d0d7dce6e69cc079ac85ae66cbf4491e421 to simpleperf-release" into simpleperf-releasesimpleperf-release
-rw-r--r-- | cmds/atrace/atrace.cpp | 20 | ||||
-rw-r--r-- | cmds/atrace/atrace.rc | 2 | ||||
-rw-r--r-- | libs/graphicsenv/GraphicsEnv.cpp | 6 | ||||
-rw-r--r-- | services/batteryservice/include/batteryservice/BatteryService.h | 6 | ||||
-rw-r--r-- | services/surfaceflinger/CompositionEngine/src/Output.cpp | 3 | ||||
-rw-r--r-- | services/surfaceflinger/CompositionEngine/tests/OutputTest.cpp | 65 |
6 files changed, 76 insertions, 26 deletions
diff --git a/cmds/atrace/atrace.cpp b/cmds/atrace/atrace.cpp index 5719a09a16..cd4926ad50 100644 --- a/cmds/atrace/atrace.cpp +++ b/cmds/atrace/atrace.cpp @@ -313,12 +313,6 @@ static const char* k_traceClockPath = static const char* k_traceBufferSizePath = "buffer_size_kb"; -#if 0 -// TODO: Re-enable after stabilization -static const char* k_traceCmdlineSizePath = - "saved_cmdlines_size"; -#endif - static const char* k_tracingOverwriteEnablePath = "options/overwrite"; @@ -545,18 +539,6 @@ static bool setTraceBufferSizeKB(int size) return writeStr(k_traceBufferSizePath, str); } -#if 0 -// TODO: Re-enable after stabilization -// Set the default size of cmdline hashtable -static bool setCmdlineSize() -{ - if (fileExists(k_traceCmdlineSizePath)) { - return writeStr(k_traceCmdlineSizePath, "8192"); - } - return true; -} -#endif - // Set the clock to the best available option while tracing. Use 'boot' if it's // available; otherwise, use 'mono'. If neither are available use 'global'. // Any write to the trace_clock sysfs file will reset the buffer, so only @@ -870,8 +852,6 @@ static bool setUpKernelTracing() ok &= setCategoriesEnableFromFile(g_categoriesFile); ok &= setTraceOverwriteEnable(g_traceOverwrite); ok &= setTraceBufferSizeKB(g_traceBufferSizeKB); - // TODO: Re-enable after stabilization - //ok &= setCmdlineSize(); ok &= setClock(); ok &= setPrintTgidEnableIfPresent(true); ok &= setKernelTraceFuncs(g_kernelTraceFuncs); diff --git a/cmds/atrace/atrace.rc b/cmds/atrace/atrace.rc index 3e6d2e01f8..9b357e7163 100644 --- a/cmds/atrace/atrace.rc +++ b/cmds/atrace/atrace.rc @@ -13,6 +13,8 @@ on late-init # Access control to these files is now entirely in selinux policy. chmod 0666 /sys/kernel/debug/tracing/trace_clock chmod 0666 /sys/kernel/tracing/trace_clock + chmod 0666 /sys/kernel/debug/tracing/buffer_percent + chmod 0666 /sys/kernel/tracing/buffer_percent chmod 0666 /sys/kernel/debug/tracing/buffer_size_kb chmod 0666 /sys/kernel/tracing/buffer_size_kb chmod 0666 /sys/kernel/debug/tracing/options/overwrite diff --git a/libs/graphicsenv/GraphicsEnv.cpp b/libs/graphicsenv/GraphicsEnv.cpp index 394a0002ed..50c05f4e5b 100644 --- a/libs/graphicsenv/GraphicsEnv.cpp +++ b/libs/graphicsenv/GraphicsEnv.cpp @@ -265,7 +265,8 @@ android_namespace_t* GraphicsEnv::getDriverNamespace() { auto vndkNamespace = android_get_exported_namespace("vndk"); if (!vndkNamespace) { - return nullptr; + mDriverNamespace = nullptr; + return mDriverNamespace; } mDriverNamespace = android_create_namespace("updatable gfx driver", @@ -617,7 +618,8 @@ android_namespace_t* GraphicsEnv::getAngleNamespace() { auto vndkNamespace = android_get_exported_namespace("vndk"); if (!vndkNamespace) { - return nullptr; + mAngleNamespace = nullptr; + return mAngleNamespace; } if (!linkDriverNamespaceLocked(mAngleNamespace, vndkNamespace, "")) { diff --git a/services/batteryservice/include/batteryservice/BatteryService.h b/services/batteryservice/include/batteryservice/BatteryService.h index 654c903db2..f697f94a7e 100644 --- a/services/batteryservice/include/batteryservice/BatteryService.h +++ b/services/batteryservice/include/batteryservice/BatteryService.h @@ -34,9 +34,9 @@ enum { BATTERY_PROP_CAPACITY = 4, // equals BATTERY_PROPERTY_CAPACITY BATTERY_PROP_ENERGY_COUNTER = 5, // equals BATTERY_PROPERTY_ENERGY_COUNTER BATTERY_PROP_BATTERY_STATUS = 6, // equals BATTERY_PROPERTY_BATTERY_STATUS - BATTERY_PROP_CHARGING_POLICY = 7, // equals BATTERY_PROPERTY_CHARGING_POLICY - BATTERY_PROP_MANUFACTURING_DATE = 8, // equals BATTERY_PROPERTY_MANUFACTURING_DATE - BATTERY_PROP_FIRST_USAGE_DATE = 9, // equals BATTERY_PROPERTY_FIRST_USAGE_DATE + BATTERY_PROP_MANUFACTURING_DATE = 7, // equals BATTERY_PROPERTY_MANUFACTURING_DATE + BATTERY_PROP_FIRST_USAGE_DATE = 8, // equals BATTERY_PROPERTY_FIRST_USAGE_DATE + BATTERY_PROP_CHARGING_POLICY = 9, // equals BATTERY_PROPERTY_CHARGING_POLICY BATTERY_PROP_STATE_OF_HEALTH = 10, // equals BATTERY_PROPERTY_STATE_OF_HEALTH BATTERY_PROP_PART_STATUS = 12, // equals BATTERY_PROPERTY_PART_STATUS }; diff --git a/services/surfaceflinger/CompositionEngine/src/Output.cpp b/services/surfaceflinger/CompositionEngine/src/Output.cpp index 1205a2ce71..6314d2830f 100644 --- a/services/surfaceflinger/CompositionEngine/src/Output.cpp +++ b/services/surfaceflinger/CompositionEngine/src/Output.cpp @@ -1213,7 +1213,8 @@ void Output::updateProtectedContentState() { if (outputState.isSecure && supportsProtectedContent) { auto layers = getOutputLayersOrderedByZ(); bool needsProtected = std::any_of(layers.begin(), layers.end(), [](auto* layer) { - return layer->getLayerFE().getCompositionState()->hasProtectedContent; + return layer->getLayerFE().getCompositionState()->hasProtectedContent + && layer->requiresClientComposition(); }); if (needsProtected != mRenderSurface->isProtected()) { mRenderSurface->setProtected(needsProtected); diff --git a/services/surfaceflinger/CompositionEngine/tests/OutputTest.cpp b/services/surfaceflinger/CompositionEngine/tests/OutputTest.cpp index bf2d568503..774dc91a9e 100644 --- a/services/surfaceflinger/CompositionEngine/tests/OutputTest.cpp +++ b/services/surfaceflinger/CompositionEngine/tests/OutputTest.cpp @@ -3992,6 +3992,7 @@ struct OutputComposeSurfacesTest_HandlesProtectedContent : public OutputComposeS Layer() { EXPECT_CALL(*mLayerFE, getCompositionState()).WillRepeatedly(Return(&mLayerFEState)); EXPECT_CALL(mOutputLayer, getLayerFE()).WillRepeatedly(ReturnRef(*mLayerFE)); + EXPECT_CALL(mOutputLayer, requiresClientComposition()).WillRepeatedly(Return(true)); } StrictMock<mock::OutputLayer> mOutputLayer; @@ -4970,5 +4971,69 @@ TEST_F(GenerateClientCompositionRequestsTest_ThreeLayers, EXPECT_EQ(mLayers[2].mLayerSettings, requests[0]); } +/* + * Output::updateProtectedContentState() + */ + +struct OutputUpdateProtectedContentStateTest : public testing::Test { + struct OutputPartialMock : public OutputPartialMockBase { + // Sets up the helper functions called by the function under test to use + // mock implementations. + MOCK_CONST_METHOD0(getCompositionEngine, const CompositionEngine&()); + }; + + OutputUpdateProtectedContentStateTest() { + mOutput.setRenderSurfaceForTest(std::unique_ptr<RenderSurface>(mRenderSurface)); + EXPECT_CALL(mOutput, getCompositionEngine()).WillRepeatedly(ReturnRef(mCompositionEngine)); + EXPECT_CALL(mCompositionEngine, getRenderEngine()).WillRepeatedly(ReturnRef(mRenderEngine)); + EXPECT_CALL(mOutput, getOutputLayerCount()).WillRepeatedly(Return(2u)); + EXPECT_CALL(mOutput, getOutputLayerOrderedByZByIndex(0)) + .WillRepeatedly(Return(&mLayer1.mOutputLayer)); + EXPECT_CALL(mOutput, getOutputLayerOrderedByZByIndex(1)) + .WillRepeatedly(Return(&mLayer2.mOutputLayer)); + } + + struct Layer { + Layer() { + EXPECT_CALL(*mLayerFE, getCompositionState()).WillRepeatedly(Return(&mLayerFEState)); + EXPECT_CALL(mOutputLayer, getLayerFE()).WillRepeatedly(ReturnRef(*mLayerFE)); + } + + StrictMock<mock::OutputLayer> mOutputLayer; + sp<StrictMock<mock::LayerFE>> mLayerFE = sp<StrictMock<mock::LayerFE>>::make(); + LayerFECompositionState mLayerFEState; + }; + + mock::RenderSurface* mRenderSurface = new StrictMock<mock::RenderSurface>(); + StrictMock<OutputPartialMock> mOutput; + StrictMock<mock::CompositionEngine> mCompositionEngine; + StrictMock<renderengine::mock::RenderEngine> mRenderEngine; + Layer mLayer1; + Layer mLayer2; +}; + +TEST_F(OutputUpdateProtectedContentStateTest, ifProtectedContentLayerComposeByHWC) { + mOutput.mState.isSecure = true; + mLayer1.mLayerFEState.hasProtectedContent = false; + mLayer2.mLayerFEState.hasProtectedContent = true; + EXPECT_CALL(mRenderEngine, supportsProtectedContent()).WillRepeatedly(Return(true)); + EXPECT_CALL(*mRenderSurface, isProtected).WillOnce(Return(false)); + EXPECT_CALL(mLayer1.mOutputLayer, requiresClientComposition()).WillRepeatedly(Return(true)); + EXPECT_CALL(mLayer2.mOutputLayer, requiresClientComposition()).WillRepeatedly(Return(false)); + mOutput.updateProtectedContentState(); +} + +TEST_F(OutputUpdateProtectedContentStateTest, ifProtectedContentLayerComposeByClient) { + mOutput.mState.isSecure = true; + mLayer1.mLayerFEState.hasProtectedContent = false; + mLayer2.mLayerFEState.hasProtectedContent = true; + EXPECT_CALL(mRenderEngine, supportsProtectedContent()).WillRepeatedly(Return(true)); + EXPECT_CALL(*mRenderSurface, isProtected).WillOnce(Return(false)); + EXPECT_CALL(*mRenderSurface, setProtected(true)); + EXPECT_CALL(mLayer1.mOutputLayer, requiresClientComposition()).WillRepeatedly(Return(true)); + EXPECT_CALL(mLayer2.mOutputLayer, requiresClientComposition()).WillRepeatedly(Return(true)); + mOutput.updateProtectedContentState(); +} + } // namespace } // namespace android::compositionengine |