新增更新打印机信息接口 Signed-off-by:baozewei@huawei.com

Signed-off-by: b30052170 <baozewei@huawei.com>
This commit is contained in:
b30052170 2024-10-31 20:57:46 +08:00
parent 9835d89663
commit 397d5d2b5f

View File

@ -3064,7 +3064,6 @@ bool PrintServiceAbility::UpdateSinglePrinterInfo(const PrinterInfo &info, const
std::string printExtId = info.GetPrinterId();
printExtId = PrintUtils::GetGlobalId(extensionId, printExtId);
bool isSystemDataUpdated = UpdatePrinterSystemData(info);
auto printerInfo = printSystemData_.QueryDiscoveredPrinterInfoById(printExtId);
if (printerInfo == nullptr) {
PRINT_HILOGE("invalid printer id, ignore it");
@ -3080,14 +3079,13 @@ bool PrintServiceAbility::UpdateSinglePrinterInfo(const PrinterInfo &info, const
isCapabilityUpdated = UpdatePrinterCapability(printExtId, info);
}
bool isChanged = isSystemDataUpdated || isCapabilityUpdated;
if (isChanged) {
if (isCapabilityUpdated) {
SendPrinterEvent(*printerInfo);
SendPrinterDiscoverEvent(PRINTER_UPDATE_CAP, *printerInfo);
printSystemData_.SaveCupsPrinterMap();
}
return isChanged;
return isCapabilityUpdated;
}
bool PrintServiceAbility::RemoveSinglePrinterInfo(const std::string &printerId)