!16 bugfix快速亮灭屏,用户列表异常

Merge pull request !16 from 朱铖丰/master
This commit is contained in:
openharmony_ci 2022-05-16 09:33:37 +00:00 committed by Gitee
commit 7fee3db0dc
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 4 additions and 5 deletions

View File

@ -111,12 +111,10 @@ export default class AccountsModel {
private addAllUsers() {
Log.showInfo(TAG, "start getAllUsers")
let tempLink = AppStorage.SetAndLink('userList', []);
let accountList = tempLink.get();
let accountMap = new Map();
Log.showInfo(TAG, "start query")
osAccount.getAccountManager().queryAllCreatedOsAccounts().then((list) => {
Log.showInfo(TAG, "start sort")
let accountList = [];
let accountMap = new Map();
list.sort(this.sortAccount.bind(this));
for (const user of list) {
Log.showInfo(TAG, "start get user" + JSON.stringify(user))
@ -135,6 +133,7 @@ export default class AccountsModel {
accountMap.get(user.localId).userIconPath = path
})
}
AppStorage.SetOrCreate('userList', accountList);
})
}

View File

@ -97,8 +97,8 @@ export class ScreenLockService {
//The device is going to sleep
this.screenLockModel.eventListener(EVENT_BEGIN_SLEEP, () => {
Log.showInfo(TAG, `EVENT_BEGIN_SLEEP event`);
this.accountModel.updateAllUsers()
this.lockScreen();
this.accountModel.updateAllUsers()
AppStorage.SetOrCreate('deviceStatus', EVENT_BEGIN_SLEEP);
})