From 32f9f89226d0de0d710596692c07cb156c9d4edd Mon Sep 17 00:00:00 2001 From: vng Date: Tue, 18 May 2021 12:41:23 +0300 Subject: [PATCH 1/2] Fixed PP types to display. Signed-off-by: vng --- indexer/feature_data.cpp | 45 ++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/indexer/feature_data.cpp b/indexer/feature_data.cpp index 4c53c4397b..2daf826188 100644 --- a/indexer/feature_data.cpp +++ b/indexer/feature_data.cpp @@ -88,17 +88,29 @@ public: return inst; } - bool operator()(uint32_t t) const + /// @return Type score, less is better. + uint8_t Score(uint32_t t) const { + // 2-arity is better than 1-arity + ftype::TruncValue(t, 2); - if (find(m_types2.begin(), m_types2.end(), t) != m_types2.end()) - return true; + if (IsIn2(t)) + return 1; ftype::TruncValue(t, 1); - if (find(m_types1.begin(), m_types1.end(), t) != m_types1.end()) - return true; + if (IsIn1(t)) + return 2; - return false; + return 0; + } + + template void SortUselessToEnd(ContT & cont) const + { + // Put "very common" types to the end of possible PP-description types. + std::stable_sort(cont.begin(), cont.end(), [this](uint32_t t1, uint32_t t2) + { + return Score(t1) < Score(t2); + }); } private: @@ -138,13 +150,20 @@ private: else if (type.size() == 2) m_types2.push_back(c.GetTypeByPath(type)); else - CHECK(false, ()); + ASSERT(false, (type)); } + + std::sort(m_types1.begin(), m_types1.end()); + std::sort(m_types2.begin(), m_types2.end()); } + bool IsIn1(uint32_t t) const { return std::binary_search(m_types1.begin(), m_types1.end(), t); } + bool IsIn2(uint32_t t) const { return std::binary_search(m_types2.begin(), m_types2.end(), t); } + vector m_types1; vector m_types2; }; + } // namespace namespace feature @@ -186,12 +205,7 @@ uint8_t CalculateHeader(size_t const typesCount, HeaderGeomType const headerGeom void TypesHolder::SortBySpec() { - if (m_size < 2) - return; - - // Put "very common" types to the end of possible PP-description types. - auto const & checker = UselessTypesChecker::Instance(); - UNUSED_VALUE(base::RemoveIfKeepValid(begin(), end(), checker)); + UselessTypesChecker::Instance().SortUselessToEnd(*this); } vector TypesHolder::ToObjectNames() const @@ -417,9 +431,8 @@ bool FeatureParams::FinishAddingTypes() if (m_types.size() > kMaxTypesCount) { - // Put common types to the end to leave the most important types. - auto const & checker = UselessTypesChecker::Instance(); - UNUSED_VALUE(base::RemoveIfKeepValid(m_types.begin(), m_types.end(), checker)); + UselessTypesChecker::Instance().SortUselessToEnd(m_types); + m_types.resize(kMaxTypesCount); sort(m_types.begin(), m_types.end()); } -- 2.45.3 From 055d28be41fbe344ed2be1226994d2d2869e9382 Mon Sep 17 00:00:00 2001 From: Roman Tsisyk Date: Tue, 18 May 2021 12:47:27 +0300 Subject: [PATCH 2/2] [android] Update Google libraries Signed-off-by: Roman Tsisyk --- android/build.gradle | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 81d9128296..9db373dbdb 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -37,8 +37,8 @@ buildscript { if (googleFirebaseServicesEnabled) { println("Building with Google Firebase Services") - classpath 'com.google.firebase:firebase-crashlytics-gradle:2.5.1' - classpath 'com.google.firebase:firebase-appdistribution-gradle:2.1.0' + classpath 'com.google.firebase:firebase-crashlytics-gradle:2.6.1' + classpath 'com.google.firebase:firebase-appdistribution-gradle:2.1.2' } else { println("Building without Google Firebase Services") } @@ -67,13 +67,13 @@ dependencies { // Google Mobile Services if (googleMobileServicesEnabled) { - implementation 'com.google.android.gms:play-services-location:17.0.0' + implementation 'com.google.android.gms:play-services-location:18.0.0' } // Google Firebase Services if (googleFirebaseServicesEnabled) { - implementation 'com.google.firebase:firebase-crashlytics:17.1.1' - implementation 'com.google.firebase:firebase-crashlytics-ndk:17.1.1' + implementation 'com.google.firebase:firebase-crashlytics:18.0.0' + implementation 'com.google.firebase:firebase-crashlytics-ndk:18.0.0' } // 3-party -- 2.45.3