Loading cmds/installd/tests/installd_utils_test.cpp +32 −15 Original line number Diff line number Diff line Loading @@ -104,12 +104,12 @@ TEST_F(UtilsTest, IsValidApkPath_Internal) { EXPECT_EQ(-1, validate_apk_path(badint2)) << badint2 << " should be rejected as a invalid path"; // Only one subdir should be allowed. const char *bad_path3 = TEST_APP_DIR "example.com/subdir/pkg.apk"; // Should not have more than two sub directories const char *bad_path3 = TEST_APP_DIR "random/example.com/subdir/pkg.apk"; EXPECT_EQ(-1, validate_apk_path(bad_path3)) << bad_path3 << " should be rejected as a invalid path"; const char *bad_path4 = TEST_APP_DIR "example.com/subdir/../pkg.apk"; const char *bad_path4 = TEST_APP_DIR "random/example.com/subdir/pkg.apk"; EXPECT_EQ(-1, validate_apk_path(bad_path4)) << bad_path4 << " should be rejected as a invalid path"; Loading @@ -120,6 +120,7 @@ TEST_F(UtilsTest, IsValidApkPath_Internal) { TEST_F(UtilsTest, IsValidApkPath_TopDir) { EXPECT_EQ(0, validate_apk_path(TEST_DATA_DIR "app/com.example")); EXPECT_EQ(0, validate_apk_path(TEST_DATA_DIR "app/random/com.example")); EXPECT_EQ(0, validate_apk_path(TEST_EXPAND_DIR "app/com.example")); EXPECT_EQ(-1, validate_apk_path(TEST_DATA_DIR "data/com.example")); EXPECT_EQ(-1, validate_apk_path(TEST_EXPAND_DIR "data/com.example")); Loading @@ -127,6 +128,7 @@ TEST_F(UtilsTest, IsValidApkPath_TopDir) { TEST_F(UtilsTest, IsValidApkPath_TopFile) { EXPECT_EQ(0, validate_apk_path(TEST_DATA_DIR "app/com.example/base.apk")); EXPECT_EQ(0, validate_apk_path(TEST_DATA_DIR "app/random/com.example/base.apk")); EXPECT_EQ(0, validate_apk_path(TEST_EXPAND_DIR "app/com.example/base.apk")); EXPECT_EQ(-1, validate_apk_path(TEST_DATA_DIR "data/com.example/base.apk")); EXPECT_EQ(-1, validate_apk_path(TEST_EXPAND_DIR "data/com.example/base.apk")); Loading @@ -134,6 +136,7 @@ TEST_F(UtilsTest, IsValidApkPath_TopFile) { TEST_F(UtilsTest, IsValidApkPath_OatDir) { EXPECT_EQ(0, validate_apk_path_subdirs(TEST_DATA_DIR "app/com.example/oat")); EXPECT_EQ(0, validate_apk_path_subdirs(TEST_DATA_DIR "app/random/com.example/oat")); EXPECT_EQ(0, validate_apk_path_subdirs(TEST_EXPAND_DIR "app/com.example/oat")); EXPECT_EQ(-1, validate_apk_path_subdirs(TEST_DATA_DIR "data/com.example/oat")); EXPECT_EQ(-1, validate_apk_path_subdirs(TEST_EXPAND_DIR "data/com.example/oat")); Loading @@ -141,6 +144,7 @@ TEST_F(UtilsTest, IsValidApkPath_OatDir) { TEST_F(UtilsTest, IsValidApkPath_OatDirDir) { EXPECT_EQ(0, validate_apk_path_subdirs(TEST_DATA_DIR "app/com.example/oat/arm64")); EXPECT_EQ(0, validate_apk_path_subdirs(TEST_DATA_DIR "app/random/com.example/oat/arm64")); EXPECT_EQ(0, validate_apk_path_subdirs(TEST_EXPAND_DIR "app/com.example/oat/arm64")); EXPECT_EQ(-1, validate_apk_path_subdirs(TEST_DATA_DIR "data/com.example/oat/arm64")); EXPECT_EQ(-1, validate_apk_path_subdirs(TEST_EXPAND_DIR "data/com.example/oat/arm64")); Loading @@ -148,6 +152,7 @@ TEST_F(UtilsTest, IsValidApkPath_OatDirDir) { TEST_F(UtilsTest, IsValidApkPath_OatDirDirFile) { EXPECT_EQ(0, validate_apk_path_subdirs(TEST_DATA_DIR "app/com.example/oat/arm64/base.odex")); EXPECT_EQ(0, validate_apk_path_subdirs(TEST_DATA_DIR "app/random/com.example/oat/arm64/base.odex")); EXPECT_EQ(0, validate_apk_path_subdirs(TEST_EXPAND_DIR "app/com.example/oat/arm64/base.odex")); EXPECT_EQ(-1, validate_apk_path_subdirs(TEST_DATA_DIR "data/com.example/oat/arm64/base.odex")); EXPECT_EQ(-1, validate_apk_path_subdirs(TEST_EXPAND_DIR "data/com.example/oat/arm64/base.odex")); Loading @@ -164,6 +169,10 @@ TEST_F(UtilsTest, IsValidApkPath_Private) { EXPECT_EQ(0, validate_apk_path(path2)) << path2 << " should be allowed as a valid path"; const char *path3 = TEST_APP_DIR "random/example.com/example.apk"; EXPECT_EQ(0, validate_apk_path(path3)) << path3 << " should be allowed as a valid path"; const char *badpriv1 = TEST_APP_PRIVATE_DIR "../example.apk"; EXPECT_EQ(-1, validate_apk_path(badpriv1)) << badpriv1 << " should be rejected as a invalid path"; Loading @@ -172,16 +181,16 @@ TEST_F(UtilsTest, IsValidApkPath_Private) { EXPECT_EQ(-1, validate_apk_path(badpriv2)) << badpriv2 << " should be rejected as a invalid path"; // Only one subdir should be allowed. const char *bad_path3 = TEST_APP_PRIVATE_DIR "example.com/subdir/pkg.apk"; // Only one or two subdir should be allowed. const char *bad_path3 = TEST_APP_PRIVATE_DIR "random/example.com/subdir/pkg.apk"; EXPECT_EQ(-1, validate_apk_path(bad_path3)) << bad_path3 << " should be rejected as a invalid path"; const char *bad_path4 = TEST_APP_PRIVATE_DIR "example.com/subdir/../pkg.apk"; const char *bad_path4 = TEST_APP_PRIVATE_DIR "random/example.com/subdir/../pkg.apk"; EXPECT_EQ(-1, validate_apk_path(bad_path4)) << bad_path4 << " should be rejected as a invalid path"; const char *bad_path5 = TEST_APP_PRIVATE_DIR "example.com1/../example.com2/pkg.apk"; const char *bad_path5 = TEST_APP_PRIVATE_DIR "random/example.com1/../example.com2/pkg.apk"; EXPECT_EQ(-1, validate_apk_path(bad_path5)) << bad_path5 << " should be rejected as a invalid path"; } Loading Loading @@ -229,10 +238,16 @@ TEST_F(UtilsTest, IsValidApkPath_SubdirEscapeSingleFail) { << badasec6 << " should be rejected as a invalid path"; } TEST_F(UtilsTest, IsValidApkPath_TwoSubdirFail) { const char *badasec7 = TEST_ASEC_DIR "com.example.asec/subdir1/pkg.apk"; EXPECT_EQ(-1, validate_apk_path(badasec7)) << badasec7 << " should be rejected as a invalid path"; TEST_F(UtilsTest, IsValidApkPath_TwoSubdir) { const char *badasec7 = TEST_ASEC_DIR "random/com.example.asec/pkg.apk"; EXPECT_EQ(0, validate_apk_path(badasec7)) << badasec7 << " should be allowed as a valid path"; } TEST_F(UtilsTest, IsValidApkPath_ThreeSubdirFail) { const char *badasec8 = TEST_ASEC_DIR "random/com.example.asec/subdir/pkg.apk"; EXPECT_EQ(-1, validate_apk_path(badasec8)) << badasec8 << " should be rejcted as an invalid path"; } TEST_F(UtilsTest, CheckSystemApp_Dir1) { Loading Loading @@ -511,8 +526,8 @@ TEST_F(UtilsTest, ValidateApkPath) { EXPECT_EQ(0, validate_apk_path("/data/app/com.example")); EXPECT_EQ(0, validate_apk_path("/data/app/com.example/file")); EXPECT_EQ(0, validate_apk_path("/data/app/com.example//file")); EXPECT_NE(0, validate_apk_path("/data/app/com.example/dir/")); EXPECT_NE(0, validate_apk_path("/data/app/com.example/dir/file")); EXPECT_EQ(0, validate_apk_path("/data/app/random/com.example/")); EXPECT_EQ(0, validate_apk_path("/data/app/random/com.example/file")); EXPECT_NE(0, validate_apk_path("/data/app/com.example/dir/dir/file")); EXPECT_NE(0, validate_apk_path("/data/app/com.example/dir/dir//file")); EXPECT_NE(0, validate_apk_path("/data/app/com.example/dir/dir/dir/file")); Loading @@ -527,8 +542,10 @@ TEST_F(UtilsTest, ValidateApkPathSubdirs) { EXPECT_EQ(0, validate_apk_path_subdirs("/data/app/com.example/dir/file")); EXPECT_EQ(0, validate_apk_path_subdirs("/data/app/com.example/dir/dir/file")); EXPECT_EQ(0, validate_apk_path_subdirs("/data/app/com.example/dir/dir//file")); EXPECT_NE(0, validate_apk_path_subdirs("/data/app/com.example/dir/dir/dir/file")); EXPECT_NE(0, validate_apk_path_subdirs("/data/app/com.example/dir/dir/dir//file")); EXPECT_EQ(0, validate_apk_path_subdirs("/data/app/com.example/dir/dir/dir/file")); EXPECT_EQ(0, validate_apk_path_subdirs("/data/app/com.example/dir/dir/dir//file")); EXPECT_NE(0, validate_apk_path_subdirs("/data/app/com.example/dir/dir/dir/dir/file")); EXPECT_NE(0, validate_apk_path_subdirs("/data/app/com.example/dir/dir/dir/dir//file")); } TEST_F(UtilsTest, MatchExtension_Valid) { Loading cmds/installd/utils.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -954,11 +954,11 @@ static int validate_apk_path_internal(const std::string& path, int maxSubdirs) { } int validate_apk_path(const char* path) { return validate_apk_path_internal(path, 1 /* maxSubdirs */); return validate_apk_path_internal(path, 2 /* maxSubdirs */); } int validate_apk_path_subdirs(const char* path) { return validate_apk_path_internal(path, 3 /* maxSubdirs */); return validate_apk_path_internal(path, 4 /* maxSubdirs */); } int ensure_config_user_dirs(userid_t userid) { Loading services/surfaceflinger/BufferStateLayer.cpp +14 −13 Original line number Diff line number Diff line Loading @@ -239,7 +239,7 @@ bool BufferStateLayer::setBuffer(const sp<GraphicBuffer>& buffer, nsecs_t postTi mReleasePreviousBuffer = true; } mFrameCounter++; mCurrentState.frameNumber++; mCurrentState.buffer = buffer; mCurrentState.clientCacheId = clientCacheId; Loading @@ -247,10 +247,11 @@ bool BufferStateLayer::setBuffer(const sp<GraphicBuffer>& buffer, nsecs_t postTi setTransactionFlags(eTransactionNeeded); const int32_t layerId = getSequence(); mFlinger->mTimeStats->setPostTime(layerId, mFrameNumber, getName().c_str(), postTime); mFlinger->mTimeStats->setPostTime(layerId, mCurrentState.frameNumber, getName().c_str(), postTime); mFlinger->mFrameTracer->traceNewLayer(layerId, getName().c_str()); mFlinger->mFrameTracer->traceTimestamp(layerId, buffer->getId(), mFrameNumber, postTime, FrameTracer::FrameEvent::POST); mFlinger->mFrameTracer->traceTimestamp(layerId, buffer->getId(), mCurrentState.frameNumber, postTime, FrameTracer::FrameEvent::POST); mCurrentState.desiredPresentTime = desiredPresentTime; mFlinger->mScheduler->recordLayerHistory(this, Loading Loading @@ -414,7 +415,7 @@ bool BufferStateLayer::framePresentTimeIsCurrent(nsecs_t expectedPresentTime) co } uint64_t BufferStateLayer::getFrameNumber(nsecs_t /*expectedPresentTime*/) const { return mFrameNumber; return mDrawingState.frameNumber; } bool BufferStateLayer::getAutoRefresh() const { Loading Loading @@ -491,7 +492,7 @@ status_t BufferStateLayer::updateTexImage(bool& /*recomputeVisibleRegions*/, nse ALOGE("[%s] rejecting buffer: " "bufferWidth=%d, bufferHeight=%d, front.active.{w=%d, h=%d}", getDebugName(), bufferWidth, bufferHeight, s.active.w, s.active.h); mFlinger->mTimeStats->removeTimeRecord(layerId, mFrameNumber); mFlinger->mTimeStats->removeTimeRecord(layerId, mDrawingState.frameNumber); return BAD_VALUE; } Loading @@ -499,8 +500,6 @@ status_t BufferStateLayer::updateTexImage(bool& /*recomputeVisibleRegions*/, nse handle->latchTime = latchTime; } mFrameNumber = mFrameCounter; if (!SyncFeatures::getInstance().useNativeFenceSync()) { // Bind the new buffer to the GL texture. // Loading @@ -517,11 +516,13 @@ status_t BufferStateLayer::updateTexImage(bool& /*recomputeVisibleRegions*/, nse } const uint64_t bufferID = getCurrentBufferId(); mFlinger->mTimeStats->setAcquireFence(layerId, mFrameNumber, mBufferInfo.mFenceTime); mFlinger->mFrameTracer->traceFence(layerId, bufferID, mFrameNumber, mBufferInfo.mFenceTime, mFlinger->mTimeStats->setAcquireFence(layerId, mDrawingState.frameNumber, mBufferInfo.mFenceTime); mFlinger->mFrameTracer->traceFence(layerId, bufferID, mDrawingState.frameNumber, mBufferInfo.mFenceTime, FrameTracer::FrameEvent::ACQUIRE_FENCE); mFlinger->mTimeStats->setLatchTime(layerId, mFrameNumber, latchTime); mFlinger->mFrameTracer->traceTimestamp(layerId, bufferID, mFrameNumber, latchTime, mFlinger->mTimeStats->setLatchTime(layerId, mDrawingState.frameNumber, latchTime); mFlinger->mFrameTracer->traceTimestamp(layerId, bufferID, mDrawingState.frameNumber, latchTime, FrameTracer::FrameEvent::LATCH); mCurrentStateModified = false; Loading @@ -548,7 +549,7 @@ status_t BufferStateLayer::updateActiveBuffer() { status_t BufferStateLayer::updateFrameNumber(nsecs_t /*latchTime*/) { // TODO(marissaw): support frame history events mPreviousFrameNumber = mCurrentFrameNumber; mCurrentFrameNumber = mFrameNumber; mCurrentFrameNumber = mDrawingState.frameNumber; return NO_ERROR; } Loading services/surfaceflinger/Layer.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ Layer::Layer(const LayerCreationArgs& args) mCurrentState.active.w = UINT32_MAX; mCurrentState.active.h = UINT32_MAX; mCurrentState.active.transform.set(0, 0); mCurrentState.frameNumber = 0; mCurrentState.transform = 0; mCurrentState.transformToDisplayInverse = false; mCurrentState.crop.makeInvalid(); Loading services/surfaceflinger/Layer.h +1 −0 Original line number Diff line number Diff line Loading @@ -189,6 +189,7 @@ public: ui::Dataspace dataspace; // The fields below this point are only used by BufferStateLayer uint64_t frameNumber; Geometry active; uint32_t transform; Loading Loading
cmds/installd/tests/installd_utils_test.cpp +32 −15 Original line number Diff line number Diff line Loading @@ -104,12 +104,12 @@ TEST_F(UtilsTest, IsValidApkPath_Internal) { EXPECT_EQ(-1, validate_apk_path(badint2)) << badint2 << " should be rejected as a invalid path"; // Only one subdir should be allowed. const char *bad_path3 = TEST_APP_DIR "example.com/subdir/pkg.apk"; // Should not have more than two sub directories const char *bad_path3 = TEST_APP_DIR "random/example.com/subdir/pkg.apk"; EXPECT_EQ(-1, validate_apk_path(bad_path3)) << bad_path3 << " should be rejected as a invalid path"; const char *bad_path4 = TEST_APP_DIR "example.com/subdir/../pkg.apk"; const char *bad_path4 = TEST_APP_DIR "random/example.com/subdir/pkg.apk"; EXPECT_EQ(-1, validate_apk_path(bad_path4)) << bad_path4 << " should be rejected as a invalid path"; Loading @@ -120,6 +120,7 @@ TEST_F(UtilsTest, IsValidApkPath_Internal) { TEST_F(UtilsTest, IsValidApkPath_TopDir) { EXPECT_EQ(0, validate_apk_path(TEST_DATA_DIR "app/com.example")); EXPECT_EQ(0, validate_apk_path(TEST_DATA_DIR "app/random/com.example")); EXPECT_EQ(0, validate_apk_path(TEST_EXPAND_DIR "app/com.example")); EXPECT_EQ(-1, validate_apk_path(TEST_DATA_DIR "data/com.example")); EXPECT_EQ(-1, validate_apk_path(TEST_EXPAND_DIR "data/com.example")); Loading @@ -127,6 +128,7 @@ TEST_F(UtilsTest, IsValidApkPath_TopDir) { TEST_F(UtilsTest, IsValidApkPath_TopFile) { EXPECT_EQ(0, validate_apk_path(TEST_DATA_DIR "app/com.example/base.apk")); EXPECT_EQ(0, validate_apk_path(TEST_DATA_DIR "app/random/com.example/base.apk")); EXPECT_EQ(0, validate_apk_path(TEST_EXPAND_DIR "app/com.example/base.apk")); EXPECT_EQ(-1, validate_apk_path(TEST_DATA_DIR "data/com.example/base.apk")); EXPECT_EQ(-1, validate_apk_path(TEST_EXPAND_DIR "data/com.example/base.apk")); Loading @@ -134,6 +136,7 @@ TEST_F(UtilsTest, IsValidApkPath_TopFile) { TEST_F(UtilsTest, IsValidApkPath_OatDir) { EXPECT_EQ(0, validate_apk_path_subdirs(TEST_DATA_DIR "app/com.example/oat")); EXPECT_EQ(0, validate_apk_path_subdirs(TEST_DATA_DIR "app/random/com.example/oat")); EXPECT_EQ(0, validate_apk_path_subdirs(TEST_EXPAND_DIR "app/com.example/oat")); EXPECT_EQ(-1, validate_apk_path_subdirs(TEST_DATA_DIR "data/com.example/oat")); EXPECT_EQ(-1, validate_apk_path_subdirs(TEST_EXPAND_DIR "data/com.example/oat")); Loading @@ -141,6 +144,7 @@ TEST_F(UtilsTest, IsValidApkPath_OatDir) { TEST_F(UtilsTest, IsValidApkPath_OatDirDir) { EXPECT_EQ(0, validate_apk_path_subdirs(TEST_DATA_DIR "app/com.example/oat/arm64")); EXPECT_EQ(0, validate_apk_path_subdirs(TEST_DATA_DIR "app/random/com.example/oat/arm64")); EXPECT_EQ(0, validate_apk_path_subdirs(TEST_EXPAND_DIR "app/com.example/oat/arm64")); EXPECT_EQ(-1, validate_apk_path_subdirs(TEST_DATA_DIR "data/com.example/oat/arm64")); EXPECT_EQ(-1, validate_apk_path_subdirs(TEST_EXPAND_DIR "data/com.example/oat/arm64")); Loading @@ -148,6 +152,7 @@ TEST_F(UtilsTest, IsValidApkPath_OatDirDir) { TEST_F(UtilsTest, IsValidApkPath_OatDirDirFile) { EXPECT_EQ(0, validate_apk_path_subdirs(TEST_DATA_DIR "app/com.example/oat/arm64/base.odex")); EXPECT_EQ(0, validate_apk_path_subdirs(TEST_DATA_DIR "app/random/com.example/oat/arm64/base.odex")); EXPECT_EQ(0, validate_apk_path_subdirs(TEST_EXPAND_DIR "app/com.example/oat/arm64/base.odex")); EXPECT_EQ(-1, validate_apk_path_subdirs(TEST_DATA_DIR "data/com.example/oat/arm64/base.odex")); EXPECT_EQ(-1, validate_apk_path_subdirs(TEST_EXPAND_DIR "data/com.example/oat/arm64/base.odex")); Loading @@ -164,6 +169,10 @@ TEST_F(UtilsTest, IsValidApkPath_Private) { EXPECT_EQ(0, validate_apk_path(path2)) << path2 << " should be allowed as a valid path"; const char *path3 = TEST_APP_DIR "random/example.com/example.apk"; EXPECT_EQ(0, validate_apk_path(path3)) << path3 << " should be allowed as a valid path"; const char *badpriv1 = TEST_APP_PRIVATE_DIR "../example.apk"; EXPECT_EQ(-1, validate_apk_path(badpriv1)) << badpriv1 << " should be rejected as a invalid path"; Loading @@ -172,16 +181,16 @@ TEST_F(UtilsTest, IsValidApkPath_Private) { EXPECT_EQ(-1, validate_apk_path(badpriv2)) << badpriv2 << " should be rejected as a invalid path"; // Only one subdir should be allowed. const char *bad_path3 = TEST_APP_PRIVATE_DIR "example.com/subdir/pkg.apk"; // Only one or two subdir should be allowed. const char *bad_path3 = TEST_APP_PRIVATE_DIR "random/example.com/subdir/pkg.apk"; EXPECT_EQ(-1, validate_apk_path(bad_path3)) << bad_path3 << " should be rejected as a invalid path"; const char *bad_path4 = TEST_APP_PRIVATE_DIR "example.com/subdir/../pkg.apk"; const char *bad_path4 = TEST_APP_PRIVATE_DIR "random/example.com/subdir/../pkg.apk"; EXPECT_EQ(-1, validate_apk_path(bad_path4)) << bad_path4 << " should be rejected as a invalid path"; const char *bad_path5 = TEST_APP_PRIVATE_DIR "example.com1/../example.com2/pkg.apk"; const char *bad_path5 = TEST_APP_PRIVATE_DIR "random/example.com1/../example.com2/pkg.apk"; EXPECT_EQ(-1, validate_apk_path(bad_path5)) << bad_path5 << " should be rejected as a invalid path"; } Loading Loading @@ -229,10 +238,16 @@ TEST_F(UtilsTest, IsValidApkPath_SubdirEscapeSingleFail) { << badasec6 << " should be rejected as a invalid path"; } TEST_F(UtilsTest, IsValidApkPath_TwoSubdirFail) { const char *badasec7 = TEST_ASEC_DIR "com.example.asec/subdir1/pkg.apk"; EXPECT_EQ(-1, validate_apk_path(badasec7)) << badasec7 << " should be rejected as a invalid path"; TEST_F(UtilsTest, IsValidApkPath_TwoSubdir) { const char *badasec7 = TEST_ASEC_DIR "random/com.example.asec/pkg.apk"; EXPECT_EQ(0, validate_apk_path(badasec7)) << badasec7 << " should be allowed as a valid path"; } TEST_F(UtilsTest, IsValidApkPath_ThreeSubdirFail) { const char *badasec8 = TEST_ASEC_DIR "random/com.example.asec/subdir/pkg.apk"; EXPECT_EQ(-1, validate_apk_path(badasec8)) << badasec8 << " should be rejcted as an invalid path"; } TEST_F(UtilsTest, CheckSystemApp_Dir1) { Loading Loading @@ -511,8 +526,8 @@ TEST_F(UtilsTest, ValidateApkPath) { EXPECT_EQ(0, validate_apk_path("/data/app/com.example")); EXPECT_EQ(0, validate_apk_path("/data/app/com.example/file")); EXPECT_EQ(0, validate_apk_path("/data/app/com.example//file")); EXPECT_NE(0, validate_apk_path("/data/app/com.example/dir/")); EXPECT_NE(0, validate_apk_path("/data/app/com.example/dir/file")); EXPECT_EQ(0, validate_apk_path("/data/app/random/com.example/")); EXPECT_EQ(0, validate_apk_path("/data/app/random/com.example/file")); EXPECT_NE(0, validate_apk_path("/data/app/com.example/dir/dir/file")); EXPECT_NE(0, validate_apk_path("/data/app/com.example/dir/dir//file")); EXPECT_NE(0, validate_apk_path("/data/app/com.example/dir/dir/dir/file")); Loading @@ -527,8 +542,10 @@ TEST_F(UtilsTest, ValidateApkPathSubdirs) { EXPECT_EQ(0, validate_apk_path_subdirs("/data/app/com.example/dir/file")); EXPECT_EQ(0, validate_apk_path_subdirs("/data/app/com.example/dir/dir/file")); EXPECT_EQ(0, validate_apk_path_subdirs("/data/app/com.example/dir/dir//file")); EXPECT_NE(0, validate_apk_path_subdirs("/data/app/com.example/dir/dir/dir/file")); EXPECT_NE(0, validate_apk_path_subdirs("/data/app/com.example/dir/dir/dir//file")); EXPECT_EQ(0, validate_apk_path_subdirs("/data/app/com.example/dir/dir/dir/file")); EXPECT_EQ(0, validate_apk_path_subdirs("/data/app/com.example/dir/dir/dir//file")); EXPECT_NE(0, validate_apk_path_subdirs("/data/app/com.example/dir/dir/dir/dir/file")); EXPECT_NE(0, validate_apk_path_subdirs("/data/app/com.example/dir/dir/dir/dir//file")); } TEST_F(UtilsTest, MatchExtension_Valid) { Loading
cmds/installd/utils.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -954,11 +954,11 @@ static int validate_apk_path_internal(const std::string& path, int maxSubdirs) { } int validate_apk_path(const char* path) { return validate_apk_path_internal(path, 1 /* maxSubdirs */); return validate_apk_path_internal(path, 2 /* maxSubdirs */); } int validate_apk_path_subdirs(const char* path) { return validate_apk_path_internal(path, 3 /* maxSubdirs */); return validate_apk_path_internal(path, 4 /* maxSubdirs */); } int ensure_config_user_dirs(userid_t userid) { Loading
services/surfaceflinger/BufferStateLayer.cpp +14 −13 Original line number Diff line number Diff line Loading @@ -239,7 +239,7 @@ bool BufferStateLayer::setBuffer(const sp<GraphicBuffer>& buffer, nsecs_t postTi mReleasePreviousBuffer = true; } mFrameCounter++; mCurrentState.frameNumber++; mCurrentState.buffer = buffer; mCurrentState.clientCacheId = clientCacheId; Loading @@ -247,10 +247,11 @@ bool BufferStateLayer::setBuffer(const sp<GraphicBuffer>& buffer, nsecs_t postTi setTransactionFlags(eTransactionNeeded); const int32_t layerId = getSequence(); mFlinger->mTimeStats->setPostTime(layerId, mFrameNumber, getName().c_str(), postTime); mFlinger->mTimeStats->setPostTime(layerId, mCurrentState.frameNumber, getName().c_str(), postTime); mFlinger->mFrameTracer->traceNewLayer(layerId, getName().c_str()); mFlinger->mFrameTracer->traceTimestamp(layerId, buffer->getId(), mFrameNumber, postTime, FrameTracer::FrameEvent::POST); mFlinger->mFrameTracer->traceTimestamp(layerId, buffer->getId(), mCurrentState.frameNumber, postTime, FrameTracer::FrameEvent::POST); mCurrentState.desiredPresentTime = desiredPresentTime; mFlinger->mScheduler->recordLayerHistory(this, Loading Loading @@ -414,7 +415,7 @@ bool BufferStateLayer::framePresentTimeIsCurrent(nsecs_t expectedPresentTime) co } uint64_t BufferStateLayer::getFrameNumber(nsecs_t /*expectedPresentTime*/) const { return mFrameNumber; return mDrawingState.frameNumber; } bool BufferStateLayer::getAutoRefresh() const { Loading Loading @@ -491,7 +492,7 @@ status_t BufferStateLayer::updateTexImage(bool& /*recomputeVisibleRegions*/, nse ALOGE("[%s] rejecting buffer: " "bufferWidth=%d, bufferHeight=%d, front.active.{w=%d, h=%d}", getDebugName(), bufferWidth, bufferHeight, s.active.w, s.active.h); mFlinger->mTimeStats->removeTimeRecord(layerId, mFrameNumber); mFlinger->mTimeStats->removeTimeRecord(layerId, mDrawingState.frameNumber); return BAD_VALUE; } Loading @@ -499,8 +500,6 @@ status_t BufferStateLayer::updateTexImage(bool& /*recomputeVisibleRegions*/, nse handle->latchTime = latchTime; } mFrameNumber = mFrameCounter; if (!SyncFeatures::getInstance().useNativeFenceSync()) { // Bind the new buffer to the GL texture. // Loading @@ -517,11 +516,13 @@ status_t BufferStateLayer::updateTexImage(bool& /*recomputeVisibleRegions*/, nse } const uint64_t bufferID = getCurrentBufferId(); mFlinger->mTimeStats->setAcquireFence(layerId, mFrameNumber, mBufferInfo.mFenceTime); mFlinger->mFrameTracer->traceFence(layerId, bufferID, mFrameNumber, mBufferInfo.mFenceTime, mFlinger->mTimeStats->setAcquireFence(layerId, mDrawingState.frameNumber, mBufferInfo.mFenceTime); mFlinger->mFrameTracer->traceFence(layerId, bufferID, mDrawingState.frameNumber, mBufferInfo.mFenceTime, FrameTracer::FrameEvent::ACQUIRE_FENCE); mFlinger->mTimeStats->setLatchTime(layerId, mFrameNumber, latchTime); mFlinger->mFrameTracer->traceTimestamp(layerId, bufferID, mFrameNumber, latchTime, mFlinger->mTimeStats->setLatchTime(layerId, mDrawingState.frameNumber, latchTime); mFlinger->mFrameTracer->traceTimestamp(layerId, bufferID, mDrawingState.frameNumber, latchTime, FrameTracer::FrameEvent::LATCH); mCurrentStateModified = false; Loading @@ -548,7 +549,7 @@ status_t BufferStateLayer::updateActiveBuffer() { status_t BufferStateLayer::updateFrameNumber(nsecs_t /*latchTime*/) { // TODO(marissaw): support frame history events mPreviousFrameNumber = mCurrentFrameNumber; mCurrentFrameNumber = mFrameNumber; mCurrentFrameNumber = mDrawingState.frameNumber; return NO_ERROR; } Loading
services/surfaceflinger/Layer.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ Layer::Layer(const LayerCreationArgs& args) mCurrentState.active.w = UINT32_MAX; mCurrentState.active.h = UINT32_MAX; mCurrentState.active.transform.set(0, 0); mCurrentState.frameNumber = 0; mCurrentState.transform = 0; mCurrentState.transformToDisplayInverse = false; mCurrentState.crop.makeInvalid(); Loading
services/surfaceflinger/Layer.h +1 −0 Original line number Diff line number Diff line Loading @@ -189,6 +189,7 @@ public: ui::Dataspace dataspace; // The fields below this point are only used by BufferStateLayer uint64_t frameNumber; Geometry active; uint32_t transform; Loading