感谢对OpenHarmony社区的支持与关注,欢迎反馈缺陷。
应用上架提示:功耗:应用存在不合理使用传感器资源的问题,退到后台后存在传感器占用;
不影响上架华为应用商店
是否是因为:RNOrientationLockerTurboModule.ts中的 sensor.on(sensor.SensorId.ORIENTATION, (data: sensor.OrientationResponse) => { console.info("orientation change z value:"+data.alpha) let deviceOrientationValue:string = this.lastDeviceSensorOrientationValue; let orientation=data.alpha if (orientation == -1) { deviceOrientationValue = "UNKNOWN"; } else if (orientation > 355 || orientation < 5) { deviceOrientationValue = "PORTRAIT"; } else if (orientation > 85 && orientation < 95) { deviceOrientationValue = "LANDSCAPE-RIGHT"; } else if (orientation > 175 && orientation < 185) { deviceOrientationValue = "PORTRAIT-UPSIDEDOWN"; } else if (orientation > 265 && orientation < 275) { deviceOrientationValue = "LANDSCAPE-LEFT"; } if (this.lastDeviceSensorOrientationValue !== deviceOrientationValue) { ctx.rnInstance.emitDeviceEvent('deviceOrientationDidChange', { deviceOrientation: deviceOrientationValue }) this.lastDeviceSensorOrientationValue = deviceOrientationValue; } }, { interval: 100000000 }); 造成的
sensor.on(sensor.SensorId.ORIENTATION, (data: sensor.OrientationResponse) => { console.info("orientation change z value:"+data.alpha) let deviceOrientationValue:string = this.lastDeviceSensorOrientationValue; let orientation=data.alpha if (orientation == -1) { deviceOrientationValue = "UNKNOWN"; } else if (orientation > 355 || orientation < 5) { deviceOrientationValue = "PORTRAIT"; } else if (orientation > 85 && orientation < 95) { deviceOrientationValue = "LANDSCAPE-RIGHT"; } else if (orientation > 175 && orientation < 185) { deviceOrientationValue = "PORTRAIT-UPSIDEDOWN"; } else if (orientation > 265 && orientation < 275) { deviceOrientationValue = "LANDSCAPE-LEFT"; } if (this.lastDeviceSensorOrientationValue !== deviceOrientationValue) { ctx.rnInstance.emitDeviceEvent('deviceOrientationDidChange', { deviceOrientation: deviceOrientationValue }) this.lastDeviceSensorOrientationValue = deviceOrientationValue; } }, { interval: 100000000 });
[x] master [ ] 5.0-Beta1 [ ] Release 4.1 [ ] Release 4.0 [ ] Release 3.2
你好,开发者已收到该问题,会安排处理
你好开发者,你反馈的问题在后续的版本中已经修复,可以使用最新版本验证
感谢对OpenHarmony社区的支持与关注,欢迎反馈缺陷。
发生了什么问题?
应用上架提示:功耗:应用存在不合理使用传感器资源的问题,退到后台后存在传感器占用;
期望行为是什么?
不影响上架华为应用商店
如何复现该缺陷
是否是因为:RNOrientationLockerTurboModule.ts中的
sensor.on(sensor.SensorId.ORIENTATION, (data: sensor.OrientationResponse) => { console.info("orientation change z value:"+data.alpha) let deviceOrientationValue:string = this.lastDeviceSensorOrientationValue; let orientation=data.alpha if (orientation == -1) { deviceOrientationValue = "UNKNOWN"; } else if (orientation > 355 || orientation < 5) { deviceOrientationValue = "PORTRAIT"; } else if (orientation > 85 && orientation < 95) { deviceOrientationValue = "LANDSCAPE-RIGHT"; } else if (orientation > 175 && orientation < 185) { deviceOrientationValue = "PORTRAIT-UPSIDEDOWN"; } else if (orientation > 265 && orientation < 275) { deviceOrientationValue = "LANDSCAPE-LEFT"; } if (this.lastDeviceSensorOrientationValue !== deviceOrientationValue) { ctx.rnInstance.emitDeviceEvent('deviceOrientationDidChange', { deviceOrientation: deviceOrientationValue }) this.lastDeviceSensorOrientationValue = deviceOrientationValue; } }, { interval: 100000000 });造成的
其他补充信息
版本或分支信息
[x] master
[ ] 5.0-Beta1
[ ] Release 4.1
[ ] Release 4.0
[ ] Release 3.2