蓝牙crash问题和解决进入人脸,设置密码失败和声音逻辑优化

Signed-off-by: weiyunxing <weiyunxing@huawei.com>
This commit is contained in:
weiyunxing 2022-09-01 17:31:56 +08:00
parent f375e26545
commit 656f97bebe
6 changed files with 32 additions and 15 deletions

View File

@ -20,7 +20,6 @@ import ConfigData from '../../../../../../../common/utils/src/main/ets/default/b
import ISettingsController from '../../../../../../../common/component/src/main/ets/default/controller/ISettingsController';
import LogUtil from '../../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil';
import AboutDeviceModel from '../../model/aboutDeviceImpl/AboutDeviceModel'
import deviceInfo from '@ohos.deviceInfo'
const DISCOVERY_DURING_TIME: number = 30000; // 30'
const DISCOVERY_INTERVAL_TIME: number = 3000; // 3'
@ -165,7 +164,12 @@ export default class BluetoothDeviceController extends BaseSettingsController {
*/
confirmPairing(deviceId: string, accept: boolean): void {
if (accept) {
this.getAvailableDevice(deviceId).connectionState = BondState.BOND_STATE_BONDING;
try {
this.getAvailableDevice(deviceId).connectionState = BondState.BOND_STATE_BONDING;
} catch (err) {
LogUtil.error(this.TAG + 'confirmPairing =' + JSON.stringify(err));
}
this.forceRefresh(this.availableDevices);
AppStorage.SetOrCreate('bluetoothAvailableDevices', this.availableDevices);
}
@ -490,8 +494,7 @@ export default class BluetoothDeviceController extends BaseSettingsController {
cancel: () => {
LogUtil.info('Closed callbacks')
},
offset: ({ dx: $r("app.float.customDialog_dx_offset"), dy: $r("app.float.customDialog_dy_offset") }),
alignment: deviceInfo.deviceType === 'phone' ? DialogAlignment.Bottom : DialogAlignment.Center,
alignment: DialogAlignment.Bottom
})
}

View File

@ -20,6 +20,8 @@ import PasswordModel, {ResultCode} from '../../model/passwordImpl/PasswordModel'
import Router from '@system.router';
import Prompt from '@system.prompt';
const OPEN_SESSION_FAILED = '0';
export default class PasswordCheckController extends BaseSettingsController {
private TAG = ConfigData.TAG + 'PasswordCheckController ';
private pageRequestCode: number = -1;
@ -39,11 +41,20 @@ export default class PasswordCheckController extends BaseSettingsController {
}
subscribe(): ISettingsController {
PasswordModel.openSession((data) => {
if (data === OPEN_SESSION_FAILED) {
LogUtil.info(`${this.TAG}subscribe->openSession failed`);
} else {
LogUtil.info(`${this.TAG}subscribe->openSession success`);
}
this.pinChallenge = data;
});
PasswordModel.registerInputer();
return this;
};
unsubscribe(): ISettingsController {
PasswordModel.closeSession();
PasswordModel.unregisterInputer();
return this;
};

View File

@ -23,6 +23,7 @@ import Router from '@system.router';
const PASSWORD_SIX_LENGTH = 6;
const AUTH_SUB_TYPE_DEFAULT = PinSubType.PIN_SIX;
const OPEN_SESSION_FAILED = '0';
export default class PasswordInputController extends BaseSettingsController {
private TAG = ConfigData.TAG + 'PasswordInputController ';
@ -52,11 +53,20 @@ export default class PasswordInputController extends BaseSettingsController {
}
subscribe(): ISettingsController {
PasswordModel.openSession((data) => {
if (data === OPEN_SESSION_FAILED) {
LogUtil.info(`${this.TAG}subscribe->openSession failed`);
} else {
LogUtil.info(`${this.TAG}subscribe->openSession success`);
}
this.pinChallenge = data;
});
PasswordModel.registerInputer();
return this;
};
unsubscribe(): ISettingsController {
PasswordModel.closeSession();
PasswordModel.unregisterInputer();
return this;
};

View File

@ -27,20 +27,10 @@ export default class PasswordSettingController extends BaseSettingsController {
private passwordList: PasswordSettingItem[][] = [];
subscribe(): ISettingsController {
PasswordModel.closeSession();
PasswordModel.openSession((data) => {
if (data === '0') {
LogUtil.info(`${this.TAG}subscribe->openSession failed`);
} else {
LogUtil.info(`${this.TAG}subscribe->openSession success`);
}
this.pinChallenge = data;
});
return this;
};
unsubscribe(): ISettingsController {
PasswordModel.closeSession();
return this;
};

View File

@ -187,7 +187,7 @@ export class PasswordModel extends BaseModel {
"settingUri": "pages/passwordCheck"
}
]
]
];
/**
* constructor

View File

@ -175,6 +175,9 @@ struct AudioRingerModeItem {
.height(this.isRk ? $r('app.float.distance_8') : $r('app.float.wh_value_24'))
.margin({top: $r('app.float.distance_4')})
.checked(this.checked)
.onChange((vue) => {
this.audioRingerModel.setRingerMode();
})
}
.alignItems(HorizontalAlign.Center)
.width(ConfigData.WH_50_100)