已开启
fix rotation #54
tangguochao创建于 16 天前
fix rotation #54
已开启
共 2 个文件变更+14-4
| @@ -0,0 +1,4 @@ | |||
| 1 | +{ | ||
| 2 | + "typescript.validate.enable": false, | ||
| 3 | + "typescript.suggest.enabled": false | ||
| 4 | +} | ||
| @@ -234,13 +234,20 @@ export class SCBScreenSessionManager { | |||
| 234 | private getOrientationLockByIpc(): boolean { | 234 | private getOrientationLockByIpc(): boolean { |
| 235 | let systemUIContext = GlobalContext.getContext(); | 235 | let systemUIContext = GlobalContext.getContext(); |
| 236 | log.showInfo('getOrientationLockByIpc systemUIContext, context: ' + typeof(systemUIContext)); | 236 | log.showInfo('getOrientationLockByIpc systemUIContext, context: ' + typeof(systemUIContext)); |
| 237 | - let value:string = null; | 237 | + let value: string = null; |
| 238 | try { | 238 | try { |
| 239 | value = settings.getValueSync(systemUIContext, | 239 | value = settings.getValueSync(systemUIContext, |
| 240 | settings.general.ACCELEROMETER_ROTATION_STATUS, | 240 | settings.general.ACCELEROMETER_ROTATION_STATUS, |
| 241 | - SettingsConstants.AUTO_ROTATE_OFF); | 241 | + ''); |
| 242 | + if (value === '') { | ||
| 243 | + value = SettingsConstants.AUTO_ROTATE_OFF; | ||
| 244 | + const result = settings.setValueSync(systemUIContext, | ||
| 245 | + settings.general.ACCELEROMETER_ROTATION_STATUS, | ||
| 246 | + value); | ||
| 247 | + log.showInfo(`init orientation lock settings, result: ${result}`); | ||
| 248 | + } | ||
| 242 | } catch (e) { | 249 | } catch (e) { |
| 243 | - log.showError(`getValue:${JSON.stringify(e)}`); | 250 | + log.showError(`get or init orientation lock settings failed: ${JSON.stringify(e)}`); |
| 244 | } | 251 | } |
| 245 | let ret: boolean = SettingsConstants.AUTO_ROTATE_OFF === value; | 252 | let ret: boolean = SettingsConstants.AUTO_ROTATE_OFF === value; |
| 246 | log.showInfo(`getOrientationLockByIpc systemUIContext, value: ${value} ret:${ret}`); | 253 | log.showInfo(`getOrientationLockByIpc systemUIContext, value: ${value} ret:${ret}`); |
| @@ -2440,4 +2447,3 @@ export class SCBScreenSessionManager { | |||
| 2440 | } | 2447 | } |
| 2441 | } | 2448 | } |
| 2442 | } | 2449 | } |
| 2443 | - | ||