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

Commit fc1b27c8 authored by Mikhail Naganov's avatar Mikhail Naganov Committed by Automerger Merge Worker
Browse files

Merge "Retain ID mapping for product strategy to be optional" into main am:...

Merge "Retain ID mapping for product strategy to be optional" into main am: 87a22b0f am: 9ac9e44c

Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/3437219



Change-Id: If3c0a7f4b37f24174791c3f924aac46b10f47ee4
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 5258cf6d 9ac9e44c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ PolicySubsystem::PolicySubsystem(const std::string &name, core::log::Logger &log
        );
    addSubsystemObjectFactory(
        new TSubsystemObjectFactory<ProductStrategy>(
            mProductStrategyComponentName, (1 << MappingKeyName) | (1 << MappingKeyIdentifier))
            mProductStrategyComponentName, (1 << MappingKeyName))
        );
}

+13 −8
Original line number Diff line number Diff line
@@ -29,9 +29,6 @@ ProductStrategy::ProductStrategy(const std::string &mappingValue,
                                (MappingKeyAmendEnd - MappingKeyAmend1 + 1),
                                context) {

    size_t id = context.getItemAsInteger(MappingKeyIdentifier);
    std::string nameFromStructure(context.getItem(MappingKeyName));

    ALOG_ASSERT(instanceConfigurableElement != nullptr, "Invalid Configurable Element");
    mPolicySubsystem = static_cast<const PolicySubsystem *>(
            instanceConfigurableElement->getBelongingSubsystem());
@@ -40,14 +37,22 @@ ProductStrategy::ProductStrategy(const std::string &mappingValue,
    mPolicyPluginInterface = mPolicySubsystem->getPolicyPluginInterface();
    ALOG_ASSERT(mPolicyPluginInterface != nullptr, "Invalid Policy Plugin Interface");

    const std::string nameFromStructure(context.getItem(MappingKeyName));
    std::string name;
    if (context.iSet(MappingKeyIdentifier)) {
        size_t id = context.getItemAsInteger(MappingKeyIdentifier);
        mId = static_cast<android::product_strategy_t>(id);
    std::string name = mPolicyPluginInterface->getProductStrategyName(mId);
        name = mPolicyPluginInterface->getProductStrategyName(mId);
        if (name.empty()) {
            name = nameFromStructure;
            mId = mPolicyPluginInterface->getProductStrategyByName(name);
        }
    } else {
        name = nameFromStructure;
        mId = mPolicyPluginInterface->getProductStrategyByName(nameFromStructure);
    }

    ALOG_ASSERT(mId != PRODUCT_STRATEGY_INVALID, "Product Strategy %s not found", name.c_str());
    ALOG_ASSERT(mId != PRODUCT_STRATEGY_NONE, "Product Strategy %s not found", name.c_str());

    ALOGE("Product Strategy %s added", name.c_str());
}