Loading cmds/installd/otapreopt_chroot.cpp +2 −2 Original line number Original line Diff line number Diff line Loading @@ -115,7 +115,7 @@ static int otapreopt_chroot(const int argc, char **arg) { exit(207); exit(207); } } { { std::string vendor_partition = StringPrintf("/dev/block/bootdevice/by-name/vendor%s", std::string vendor_partition = StringPrintf("/dev/block/by-name/vendor%s", arg[2]); arg[2]); int vendor_result = mount(vendor_partition.c_str(), int vendor_result = mount(vendor_partition.c_str(), "/postinstall/vendor", "/postinstall/vendor", Loading @@ -128,7 +128,7 @@ static int otapreopt_chroot(const int argc, char **arg) { // Try to mount the product partition. update_engine doesn't do this for us, but we // Try to mount the product partition. update_engine doesn't do this for us, but we // want it for product APKs. Same notes as vendor above. // want it for product APKs. Same notes as vendor above. { { std::string product_partition = StringPrintf("/dev/block/bootdevice/by-name/product%s", std::string product_partition = StringPrintf("/dev/block/by-name/product%s", arg[2]); arg[2]); int product_result = mount(product_partition.c_str(), int product_result = mount(product_partition.c_str(), "/postinstall/product", "/postinstall/product", Loading services/surfaceflinger/Layer.cpp +5 −9 Original line number Original line Diff line number Diff line Loading @@ -98,8 +98,9 @@ Layer::Layer(SurfaceFlinger* flinger, const sp<Client>& client, const String8& n mQueueItems(), mQueueItems(), mLastFrameNumberReceived(0), mLastFrameNumberReceived(0), mAutoRefresh(false), mAutoRefresh(false), mFreezeGeometryUpdates(false) { mFreezeGeometryUpdates(false), mCurrentChildren(LayerVector::StateSet::Current), mDrawingChildren(LayerVector::StateSet::Drawing) { mCurrentCrop.makeInvalid(); mCurrentCrop.makeInvalid(); uint32_t layerFlags = 0; uint32_t layerFlags = 0; Loading Loading @@ -137,7 +138,6 @@ Layer::Layer(SurfaceFlinger* flinger, const sp<Client>& client, const String8& n CompositorTiming compositorTiming; CompositorTiming compositorTiming; flinger->getCompositorTiming(&compositorTiming); flinger->getCompositorTiming(&compositorTiming); mFrameEventHistory.initializeCompositorTiming(compositorTiming); mFrameEventHistory.initializeCompositorTiming(compositorTiming); } } void Layer::onFirstRef() {} void Layer::onFirstRef() {} Loading Loading @@ -920,10 +920,7 @@ void Layer::pushPendingState() { } } void Layer::popPendingState(State* stateToCommit) { void Layer::popPendingState(State* stateToCommit) { auto oldFlags = stateToCommit->flags; *stateToCommit = mPendingStates[0]; *stateToCommit = mPendingStates[0]; stateToCommit->flags = (oldFlags & ~stateToCommit->mask) | (stateToCommit->flags & stateToCommit->mask); mPendingStates.removeAt(0); mPendingStates.removeAt(0); ATRACE_INT(mTransactionName.string(), mPendingStates.size()); ATRACE_INT(mTransactionName.string(), mPendingStates.size()); Loading Loading @@ -1270,7 +1267,6 @@ bool Layer::setFlags(uint8_t flags, uint8_t mask) { if (mCurrentState.flags == newFlags) return false; if (mCurrentState.flags == newFlags) return false; mCurrentState.sequence++; mCurrentState.sequence++; mCurrentState.flags = newFlags; mCurrentState.flags = newFlags; mCurrentState.mask = mask; mCurrentState.modified = true; mCurrentState.modified = true; setTransactionFlags(eTransactionNeeded); setTransactionFlags(eTransactionNeeded); return true; return true; Loading Loading @@ -1681,7 +1677,7 @@ __attribute__((no_sanitize("unsigned-integer-overflow"))) LayerVector Layer::mak return children; return children; } } LayerVector traverse; LayerVector traverse(stateSet); for (const wp<Layer>& weakRelative : state.zOrderRelatives) { for (const wp<Layer>& weakRelative : state.zOrderRelatives) { sp<Layer> strongRelative = weakRelative.promote(); sp<Layer> strongRelative = weakRelative.promote(); if (strongRelative != nullptr) { if (strongRelative != nullptr) { Loading Loading @@ -1779,7 +1775,7 @@ LayerVector Layer::makeChildrenTraversalList(LayerVector::StateSet stateSet, const LayerVector& children = useDrawing ? mDrawingChildren : mCurrentChildren; const LayerVector& children = useDrawing ? mDrawingChildren : mCurrentChildren; const State& state = useDrawing ? mDrawingState : mCurrentState; const State& state = useDrawing ? mDrawingState : mCurrentState; LayerVector traverse; LayerVector traverse(stateSet); for (const wp<Layer>& weakRelative : state.zOrderRelatives) { for (const wp<Layer>& weakRelative : state.zOrderRelatives) { sp<Layer> strongRelative = weakRelative.promote(); sp<Layer> strongRelative = weakRelative.promote(); // Only add relative layers that are also descendents of the top most parent of the tree. // Only add relative layers that are also descendents of the top most parent of the tree. Loading services/surfaceflinger/Layer.h +1 −2 Original line number Original line Diff line number Diff line Loading @@ -186,7 +186,6 @@ public: uint32_t layerStack; uint32_t layerStack; uint8_t flags; uint8_t flags; uint8_t mask; uint8_t reserved[2]; uint8_t reserved[2]; int32_t sequence; // changes when visible regions can change int32_t sequence; // changes when visible regions can change bool modified; bool modified; Loading Loading @@ -588,6 +587,7 @@ public: // SurfaceFlinger to complete a transaction. // SurfaceFlinger to complete a transaction. void commitChildList(); void commitChildList(); int32_t getZ() const; int32_t getZ() const; void pushPendingState(); protected: protected: // constant // constant Loading Loading @@ -670,7 +670,6 @@ protected: // Returns false if the relevant frame has already been latched // Returns false if the relevant frame has already been latched bool addSyncPoint(const std::shared_ptr<SyncPoint>& point); bool addSyncPoint(const std::shared_ptr<SyncPoint>& point); void pushPendingState(); void popPendingState(State* stateToCommit); void popPendingState(State* stateToCommit); bool applyPendingStates(State* stateToCommit); bool applyPendingStates(State* stateToCommit); Loading services/surfaceflinger/LayerVector.cpp +18 −7 Original line number Original line Diff line number Diff line Loading @@ -19,26 +19,37 @@ namespace android { namespace android { LayerVector::LayerVector() = default; LayerVector::LayerVector(const StateSet stateSet) : mStateSet(stateSet) {} LayerVector::LayerVector(const LayerVector& rhs) : SortedVector<sp<Layer>>(rhs) { LayerVector::LayerVector(const LayerVector& rhs, const StateSet stateSet) } : SortedVector<sp<Layer>>(rhs), mStateSet(stateSet) {} LayerVector::~LayerVector() = default; LayerVector::~LayerVector() = default; // This operator override is needed to prevent mStateSet from getting copied over. LayerVector& LayerVector::operator=(const LayerVector& rhs) { SortedVector::operator=(rhs); return *this; } int LayerVector::do_compare(const void* lhs, const void* rhs) const int LayerVector::do_compare(const void* lhs, const void* rhs) const { { // sort layers per layer-stack, then by z-order and finally by sequence // sort layers per layer-stack, then by z-order and finally by sequence const auto& l = *reinterpret_cast<const sp<Layer>*>(lhs); const auto& l = *reinterpret_cast<const sp<Layer>*>(lhs); const auto& r = *reinterpret_cast<const sp<Layer>*>(rhs); const auto& r = *reinterpret_cast<const sp<Layer>*>(rhs); uint32_t ls = l->getCurrentState().layerStack; const auto& lState = uint32_t rs = r->getCurrentState().layerStack; (mStateSet == StateSet::Current) ? l->getCurrentState() : l->getDrawingState(); const auto& rState = (mStateSet == StateSet::Current) ? r->getCurrentState() : r->getDrawingState(); uint32_t ls = lState.layerStack; uint32_t rs = rState.layerStack; if (ls != rs) if (ls != rs) return (ls > rs) ? 1 : -1; return (ls > rs) ? 1 : -1; int32_t lz = l->getCurrentState().z; int32_t lz = lState.z; int32_t rz = r->getCurrentState().z; int32_t rz = rState.z; if (lz != rz) if (lz != rz) return (lz > rz) ? 1 : -1; return (lz > rz) ? 1 : -1; Loading services/surfaceflinger/LayerVector.h +9 −4 Original line number Original line Diff line number Diff line Loading @@ -32,22 +32,27 @@ class Layer; */ */ class LayerVector : public SortedVector<sp<Layer>> { class LayerVector : public SortedVector<sp<Layer>> { public: public: LayerVector(); LayerVector(const LayerVector& rhs); ~LayerVector() override; enum class StateSet { enum class StateSet { Invalid, Invalid, Current, Current, Drawing, Drawing, }; }; explicit LayerVector(const StateSet stateSet); LayerVector(const LayerVector& rhs, const StateSet stateSet); ~LayerVector() override; LayerVector& operator=(const LayerVector& rhs); // Sorts layer by layer-stack, Z order, and finally creation order (sequence). // Sorts layer by layer-stack, Z order, and finally creation order (sequence). int do_compare(const void* lhs, const void* rhs) const override; int do_compare(const void* lhs, const void* rhs) const override; using Visitor = std::function<void(Layer*)>; using Visitor = std::function<void(Layer*)>; void traverseInReverseZOrder(StateSet stateSet, const Visitor& visitor) const; void traverseInReverseZOrder(StateSet stateSet, const Visitor& visitor) const; void traverseInZOrder(StateSet stateSet, const Visitor& visitor) const; void traverseInZOrder(StateSet stateSet, const Visitor& visitor) const; private: const StateSet mStateSet; }; }; } } Loading Loading
cmds/installd/otapreopt_chroot.cpp +2 −2 Original line number Original line Diff line number Diff line Loading @@ -115,7 +115,7 @@ static int otapreopt_chroot(const int argc, char **arg) { exit(207); exit(207); } } { { std::string vendor_partition = StringPrintf("/dev/block/bootdevice/by-name/vendor%s", std::string vendor_partition = StringPrintf("/dev/block/by-name/vendor%s", arg[2]); arg[2]); int vendor_result = mount(vendor_partition.c_str(), int vendor_result = mount(vendor_partition.c_str(), "/postinstall/vendor", "/postinstall/vendor", Loading @@ -128,7 +128,7 @@ static int otapreopt_chroot(const int argc, char **arg) { // Try to mount the product partition. update_engine doesn't do this for us, but we // Try to mount the product partition. update_engine doesn't do this for us, but we // want it for product APKs. Same notes as vendor above. // want it for product APKs. Same notes as vendor above. { { std::string product_partition = StringPrintf("/dev/block/bootdevice/by-name/product%s", std::string product_partition = StringPrintf("/dev/block/by-name/product%s", arg[2]); arg[2]); int product_result = mount(product_partition.c_str(), int product_result = mount(product_partition.c_str(), "/postinstall/product", "/postinstall/product", Loading
services/surfaceflinger/Layer.cpp +5 −9 Original line number Original line Diff line number Diff line Loading @@ -98,8 +98,9 @@ Layer::Layer(SurfaceFlinger* flinger, const sp<Client>& client, const String8& n mQueueItems(), mQueueItems(), mLastFrameNumberReceived(0), mLastFrameNumberReceived(0), mAutoRefresh(false), mAutoRefresh(false), mFreezeGeometryUpdates(false) { mFreezeGeometryUpdates(false), mCurrentChildren(LayerVector::StateSet::Current), mDrawingChildren(LayerVector::StateSet::Drawing) { mCurrentCrop.makeInvalid(); mCurrentCrop.makeInvalid(); uint32_t layerFlags = 0; uint32_t layerFlags = 0; Loading Loading @@ -137,7 +138,6 @@ Layer::Layer(SurfaceFlinger* flinger, const sp<Client>& client, const String8& n CompositorTiming compositorTiming; CompositorTiming compositorTiming; flinger->getCompositorTiming(&compositorTiming); flinger->getCompositorTiming(&compositorTiming); mFrameEventHistory.initializeCompositorTiming(compositorTiming); mFrameEventHistory.initializeCompositorTiming(compositorTiming); } } void Layer::onFirstRef() {} void Layer::onFirstRef() {} Loading Loading @@ -920,10 +920,7 @@ void Layer::pushPendingState() { } } void Layer::popPendingState(State* stateToCommit) { void Layer::popPendingState(State* stateToCommit) { auto oldFlags = stateToCommit->flags; *stateToCommit = mPendingStates[0]; *stateToCommit = mPendingStates[0]; stateToCommit->flags = (oldFlags & ~stateToCommit->mask) | (stateToCommit->flags & stateToCommit->mask); mPendingStates.removeAt(0); mPendingStates.removeAt(0); ATRACE_INT(mTransactionName.string(), mPendingStates.size()); ATRACE_INT(mTransactionName.string(), mPendingStates.size()); Loading Loading @@ -1270,7 +1267,6 @@ bool Layer::setFlags(uint8_t flags, uint8_t mask) { if (mCurrentState.flags == newFlags) return false; if (mCurrentState.flags == newFlags) return false; mCurrentState.sequence++; mCurrentState.sequence++; mCurrentState.flags = newFlags; mCurrentState.flags = newFlags; mCurrentState.mask = mask; mCurrentState.modified = true; mCurrentState.modified = true; setTransactionFlags(eTransactionNeeded); setTransactionFlags(eTransactionNeeded); return true; return true; Loading Loading @@ -1681,7 +1677,7 @@ __attribute__((no_sanitize("unsigned-integer-overflow"))) LayerVector Layer::mak return children; return children; } } LayerVector traverse; LayerVector traverse(stateSet); for (const wp<Layer>& weakRelative : state.zOrderRelatives) { for (const wp<Layer>& weakRelative : state.zOrderRelatives) { sp<Layer> strongRelative = weakRelative.promote(); sp<Layer> strongRelative = weakRelative.promote(); if (strongRelative != nullptr) { if (strongRelative != nullptr) { Loading Loading @@ -1779,7 +1775,7 @@ LayerVector Layer::makeChildrenTraversalList(LayerVector::StateSet stateSet, const LayerVector& children = useDrawing ? mDrawingChildren : mCurrentChildren; const LayerVector& children = useDrawing ? mDrawingChildren : mCurrentChildren; const State& state = useDrawing ? mDrawingState : mCurrentState; const State& state = useDrawing ? mDrawingState : mCurrentState; LayerVector traverse; LayerVector traverse(stateSet); for (const wp<Layer>& weakRelative : state.zOrderRelatives) { for (const wp<Layer>& weakRelative : state.zOrderRelatives) { sp<Layer> strongRelative = weakRelative.promote(); sp<Layer> strongRelative = weakRelative.promote(); // Only add relative layers that are also descendents of the top most parent of the tree. // Only add relative layers that are also descendents of the top most parent of the tree. Loading
services/surfaceflinger/Layer.h +1 −2 Original line number Original line Diff line number Diff line Loading @@ -186,7 +186,6 @@ public: uint32_t layerStack; uint32_t layerStack; uint8_t flags; uint8_t flags; uint8_t mask; uint8_t reserved[2]; uint8_t reserved[2]; int32_t sequence; // changes when visible regions can change int32_t sequence; // changes when visible regions can change bool modified; bool modified; Loading Loading @@ -588,6 +587,7 @@ public: // SurfaceFlinger to complete a transaction. // SurfaceFlinger to complete a transaction. void commitChildList(); void commitChildList(); int32_t getZ() const; int32_t getZ() const; void pushPendingState(); protected: protected: // constant // constant Loading Loading @@ -670,7 +670,6 @@ protected: // Returns false if the relevant frame has already been latched // Returns false if the relevant frame has already been latched bool addSyncPoint(const std::shared_ptr<SyncPoint>& point); bool addSyncPoint(const std::shared_ptr<SyncPoint>& point); void pushPendingState(); void popPendingState(State* stateToCommit); void popPendingState(State* stateToCommit); bool applyPendingStates(State* stateToCommit); bool applyPendingStates(State* stateToCommit); Loading
services/surfaceflinger/LayerVector.cpp +18 −7 Original line number Original line Diff line number Diff line Loading @@ -19,26 +19,37 @@ namespace android { namespace android { LayerVector::LayerVector() = default; LayerVector::LayerVector(const StateSet stateSet) : mStateSet(stateSet) {} LayerVector::LayerVector(const LayerVector& rhs) : SortedVector<sp<Layer>>(rhs) { LayerVector::LayerVector(const LayerVector& rhs, const StateSet stateSet) } : SortedVector<sp<Layer>>(rhs), mStateSet(stateSet) {} LayerVector::~LayerVector() = default; LayerVector::~LayerVector() = default; // This operator override is needed to prevent mStateSet from getting copied over. LayerVector& LayerVector::operator=(const LayerVector& rhs) { SortedVector::operator=(rhs); return *this; } int LayerVector::do_compare(const void* lhs, const void* rhs) const int LayerVector::do_compare(const void* lhs, const void* rhs) const { { // sort layers per layer-stack, then by z-order and finally by sequence // sort layers per layer-stack, then by z-order and finally by sequence const auto& l = *reinterpret_cast<const sp<Layer>*>(lhs); const auto& l = *reinterpret_cast<const sp<Layer>*>(lhs); const auto& r = *reinterpret_cast<const sp<Layer>*>(rhs); const auto& r = *reinterpret_cast<const sp<Layer>*>(rhs); uint32_t ls = l->getCurrentState().layerStack; const auto& lState = uint32_t rs = r->getCurrentState().layerStack; (mStateSet == StateSet::Current) ? l->getCurrentState() : l->getDrawingState(); const auto& rState = (mStateSet == StateSet::Current) ? r->getCurrentState() : r->getDrawingState(); uint32_t ls = lState.layerStack; uint32_t rs = rState.layerStack; if (ls != rs) if (ls != rs) return (ls > rs) ? 1 : -1; return (ls > rs) ? 1 : -1; int32_t lz = l->getCurrentState().z; int32_t lz = lState.z; int32_t rz = r->getCurrentState().z; int32_t rz = rState.z; if (lz != rz) if (lz != rz) return (lz > rz) ? 1 : -1; return (lz > rz) ? 1 : -1; Loading
services/surfaceflinger/LayerVector.h +9 −4 Original line number Original line Diff line number Diff line Loading @@ -32,22 +32,27 @@ class Layer; */ */ class LayerVector : public SortedVector<sp<Layer>> { class LayerVector : public SortedVector<sp<Layer>> { public: public: LayerVector(); LayerVector(const LayerVector& rhs); ~LayerVector() override; enum class StateSet { enum class StateSet { Invalid, Invalid, Current, Current, Drawing, Drawing, }; }; explicit LayerVector(const StateSet stateSet); LayerVector(const LayerVector& rhs, const StateSet stateSet); ~LayerVector() override; LayerVector& operator=(const LayerVector& rhs); // Sorts layer by layer-stack, Z order, and finally creation order (sequence). // Sorts layer by layer-stack, Z order, and finally creation order (sequence). int do_compare(const void* lhs, const void* rhs) const override; int do_compare(const void* lhs, const void* rhs) const override; using Visitor = std::function<void(Layer*)>; using Visitor = std::function<void(Layer*)>; void traverseInReverseZOrder(StateSet stateSet, const Visitor& visitor) const; void traverseInReverseZOrder(StateSet stateSet, const Visitor& visitor) const; void traverseInZOrder(StateSet stateSet, const Visitor& visitor) const; void traverseInZOrder(StateSet stateSet, const Visitor& visitor) const; private: const StateSet mStateSet; }; }; } } Loading