mirror of
https://gitee.com/openharmony/usb_usb_manager
synced 2024-11-27 00:41:39 +00:00
!668 【usb_usb_manager】AI Review告警整改
Merge pull request !668 from luzhiye/master
This commit is contained in:
commit
d97863cc73
@ -129,6 +129,10 @@ export default class UsbDialogAbility extends extension {
|
||||
|
||||
private checkPermission(tokenID: number, permissionName: Permissions): boolean {
|
||||
let aac = abilityAccessCtrl.createAtManager();
|
||||
if (!aac) {
|
||||
console.error('createAtManager returned null');
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
let grantStatus = aac.verifyAccessTokenSync(tokenID, permissionName);
|
||||
if (grantStatus === abilityAccessCtrl.GrantStatus.PERMISSION_DENIED) {
|
||||
|
@ -53,7 +53,7 @@ private:
|
||||
void ProcessHandle(int32_t curAccStatus);
|
||||
int32_t ProcessAccessoryStart(int32_t curFunc, int32_t curAccStatus);
|
||||
int32_t ProcessAccessoryStop(int32_t curFunc, int32_t curAccStatus);
|
||||
int32_t ProcessAccessoryStop();
|
||||
int32_t ProcessAccessorySend();
|
||||
void InitBase64Map();
|
||||
std::vector<uint8_t> Base64Decode(const std::string& encoded_string);
|
||||
std::string SerialValueHash(const std::string &serialValue);
|
||||
|
@ -191,14 +191,14 @@ int32_t UsbAccessoryManager::ProcessAccessoryStop(int32_t curFunc, int32_t curAc
|
||||
return UEC_OK;
|
||||
}
|
||||
|
||||
int32_t UsbAccessoryManager::ProcessAccessoryStop()
|
||||
int32_t UsbAccessoryManager::ProcessAccessorySend()
|
||||
{
|
||||
this->accStatus_ = ACC_SEND;
|
||||
std::vector<std::string> accessorys;
|
||||
usbdImpl_->GetAccessoryInfo(accessorys);
|
||||
this->accessory.SetAccessory(accessorys);
|
||||
std::string extraInfo;
|
||||
if (accessorys.size() >= ACCESSORY_INFO_SIZE && !accessorys[ACCESSORY_EXTRA_INDEX].empty()) {
|
||||
if (accessorys.size() > ACCESSORY_INFO_SIZE && !accessorys[ACCESSORY_EXTRA_INDEX].empty()) {
|
||||
if (base64Map_.empty()) {
|
||||
InitBase64Map();
|
||||
}
|
||||
@ -312,7 +312,7 @@ void UsbAccessoryManager::ProcessHandle(int32_t curAccStatus)
|
||||
return;
|
||||
}
|
||||
} else if (curAccStatus == ACC_SEND) {
|
||||
ProcessAccessoryStop();
|
||||
ProcessAccessorySend();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ UsbDescriptorParser::~UsbDescriptorParser() {}
|
||||
int32_t UsbDescriptorParser::ParseDeviceDescriptor(const uint8_t *buffer, uint32_t length, UsbDevice &dev)
|
||||
{
|
||||
if (buffer == nullptr || length == 0) {
|
||||
USB_HILOGE(MODULE_USB_SERVICE, "buffer is null");
|
||||
USB_HILOGE(MODULE_USB_SERVICE, "buffer is null or length is zero");
|
||||
return UEC_SERVICE_INVALID_VALUE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user