!93 修改性能问题,ohpm编译,以及crash

Merge pull request !93 from 李婷婷/master
This commit is contained in:
openharmony_ci 2023-05-22 14:34:21 +00:00 committed by Gitee
commit 53096c43be
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
30 changed files with 351 additions and 76 deletions

View File

@ -2,8 +2,8 @@
"app": {
"bundleName": "com.ohos.callui",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"versionCode": 10004010,
"versionName": "1.0.4.010",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,

View File

@ -17,8 +17,8 @@
"app": {
"bundleName": "com.ohos.callui",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"versionCode": 10004010,
"versionName": "1.0.4.010",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,

25
common/oh-package.json5 Normal file
View File

@ -0,0 +1,25 @@
/**
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{
"license": "ISC",
"types": "",
"devDependencies": {},
"name": "@ohos/common",
"description": "a npm package which contains common function",
"main": "index.ets",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -15,8 +15,7 @@
{
"apiType": 'stageMode',
"buildOption": {
},
"buildOption": {"compileMode": "esmodule"},
"targets": [
{
"name": "default"

23
entry/oh-package.json5 Normal file
View File

@ -0,0 +1,23 @@
/**
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{
"license": "ISC",
"devDependencies": {},
"name": "entry",
"description": "example description",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -1,14 +0,0 @@
{
"license":"ISC",
"devDependencies":{},
"name":"entry",
"ohos":{
"org":"huawei",
"directoryLevel":"module",
"buildTool":"hvigor"
},
"description":"example description",
"repository":{},
"version":"1.0.0",
"dependencies":{}
}

View File

@ -158,8 +158,12 @@ export default class CallManagerService {
* @return void
*/
public onDisconnected(): void {
this.callData.callState = CALL_STATUS_DISCONNECTED;
this.publishData(this.callData);
if (this.callData != null && this.callData.callState === 6) {
return;
} else {
this.callData.callState = CALL_STATUS_DISCONNECTED;
this.publishData(this.callData);
}
}
/**

View File

@ -29,6 +29,7 @@ export default struct BottomBtn {
onItemClick: Function = null;
@Link callData: DefaultCallData;
@Link callList: Array<CallListStruct>;
@Link hangup: boolean;
private mCallServiceProxy: CallServiceProxy;
private imageList;
@ -64,6 +65,7 @@ export default struct BottomBtn {
onHangUp() {
this.mCallServiceProxy.hangUpCall(this.callData.callId);
if (this.callList.length === 1) {
this.hangup = true;
globalThis.calluiAbilityContext?.terminateSelf().then((data) => {
LogUtils.i(TAG, "onHangUp terminateSelfCallBack");
});
@ -96,8 +98,13 @@ export default struct BottomBtn {
if (type == 'hangUP') {
this.onHangUp();
}
if (type == 'speakerphone') {
this.onSpeakerButtonClicked();
}
}
onSpeakerButtonClicked() {
}
build() {
GridRow({ columns: { sm: 4, md: 8, lg: 12 }, gutter: 24 }) {
GridCol({ span: { sm: 4, md: 6, lg: 6 }, offset: { md: 1, lg: 3 } }) {

View File

@ -19,8 +19,8 @@ import DefaultCallData from '../struct/TypeUtils';
const TAG = "DtmfBtn";
class DataListStruct {
value
sign
value: string
sign: string
}
@Component

View File

@ -53,6 +53,7 @@ const SEND_SMS_FAILURE_SERVICE_UNAVAILABLE = 3;
export default struct IncomingCom {
@Link callList: Array<CallListStruct>;
@Link callData: DefaultCallData;
@Link hangup: boolean;
private btnList = [];
private msgList = [];
mCallServiceProxy: CallServiceProxy = null;
@ -111,7 +112,8 @@ export default struct IncomingCom {
});
})
} else {
globalThis.calluiAbilityContext?.resourceManager.getString($r("app.string.message_Failed").id, (err, typeName) => {
globalThis.calluiAbilityContext?.resourceManager.getString($r("app.string.message_Failed")
.id, (err, typeName) => {
if (err) {
return;
}
@ -174,10 +176,12 @@ export default struct IncomingCom {
* Handling interface call hangup and rejection
*/
private async onReject() {
const incomingData = this.callList.find((v) => v.callState === CallStateConst.callStateObj.CALL_STATUS_WAITING || v.callState === CallStateConst.callStateObj.CALL_STATUS_INCOMING);
Object.assign(this.callData, {
...incomingData
});
if (this.callList.length > 1) {
const incomingData = this.callList.find((v) => v.callState === CallStateConst.callStateObj.CALL_STATUS_WAITING || v.callState === CallStateConst.callStateObj.CALL_STATUS_INCOMING);
Object.assign(this.callData, {
...incomingData
});
}
const {callId, callState} = this.callData;
if (callState !== CallStateConst.CALL_STATUS_WAITING) {
this.mCallServiceProxy.rejectCall(callId);
@ -186,6 +190,12 @@ export default struct IncomingCom {
this.mCallServiceProxy.hangUpCall(callId);
LogUtils.i(TAG, "onReject this.mCallServiceProxy.hangUpCall :");
}
if (this.callList.length === 1) {
this.hangup = true;
globalThis.calluiAbilityContext?.terminateSelf().then((data) => {
LogUtils.i(TAG, "onReject terminateSelfCallBack");
});
}
}
/**

View File

@ -18,8 +18,8 @@ import DtmfBtn from '../components/DtmfBtn';
import DefaultCallData from '../struct/TypeUtils';
class DataListStruct {
value
sign
value: string
sign: string
}
const TAG = "Keyboard";

View File

@ -73,7 +73,8 @@ export default struct MultiContactCard {
|| this.callData.callState === CallStateConst.callStateObj.CALL_STATUS_INCOMING) && this.hasSimCard1 && this.hasSimCard2;
}
getInComingCallState() {
getInComingCallState() {
if (this.callList.length > 1) {
let incomingState = false;
this.callList.forEach((v) => {
if (v.callState === CallStateConst.callStateObj.CALL_STATUS_WAITING || v.callState === CallStateConst.callStateObj.CALL_STATUS_INCOMING) {
@ -85,7 +86,10 @@ export default struct MultiContactCard {
});
LogUtils.i(TAG, "getInComingCallState incomingState:" + JSON.stringify(incomingState));
return incomingState;
} else {
return this.callData.callState;
}
}
build() {
GridRow({ columns: { sm: 4, md: 8, lg: 12 }, gutter: 24 }) {

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
export default class DefaultCallData {
callId
callState
callId: number
callState: number
accountNumber: string
videoState: number
callType: number

View File

@ -34,7 +34,7 @@ export default class CallDataManager {
callList: Array<CallListStruct> = [];
callTimeList: Array<CallTimeListStruct> = [];
private callStateChange: Function;
private mCallStateManager: CallStateManager ;
private mCallStateManager: CallStateManager;
private NotificationManager;
private contactManager;
private static sCallDataManager: CallDataManager;
@ -53,7 +53,7 @@ export default class CallDataManager {
this.NotificationManager = new NotificationManager();
this.contactManager = new ContactManager();
this.mCallStateManager = CallStateManager.getInstance()
if (this.callData) {
if (this.callData == null) {
this.callData = callData;
} else {
let oldCallData = this.callData;
@ -76,7 +76,6 @@ export default class CallDataManager {
LogUtils.i(TAG, "init callTimeList: undefined");
this.callTimeList = callTimeList;
} else {
LogUtils.i(TAG, "init callTimeList else : " + JSON.stringify(this.callTimeList));
let oldCallTimeList = this.callTimeList;
this.callTimeList = callTimeList;
Object.assign(this.callTimeList, {
@ -134,6 +133,7 @@ export default class CallDataManager {
this.NotificationManager.cancelNotification();
AppStorage.Get<NotificationManager>('notificationManager').sendCapsuleNotification(callData, true);
AppStorage.Delete("CallTimeList");
this.clearData();
globalThis.calluiAbilityContext?.terminateSelf().then((data) => {
LogUtils.i(TAG, "calluiAbility terminateSelf");
});
@ -230,4 +230,16 @@ export default class CallDataManager {
LogUtils.i(TAG, "updateCallTimeList : " + JSON.stringify(this.callTimeList))
}
}
clearData() {
this.callList.splice(0, this.callList.length);
LogUtils.i(TAG, "clearData: " + JSON.stringify(this.callList));
let inputvalue = AppStorage.Delete("TextInputValue");
LogUtils.i(TAG, "clearData:TextInputValue " + JSON.stringify(inputvalue));
let textinput = AppStorage.Delete("TextInput");
AppStorage.Delete("CallTimeList");
AppStorage.Delete("notificationManager");
AppStorage.Delete("currentAudioDeviceIcon");
AppStorage.Delete("datalist");
}
}

View File

@ -249,7 +249,7 @@ export default class CallServiceProxy {
*
* @param { string } str - str char
*/
public startDTMF = (callId, str) => {
public startDTMF = (callId = 1, str = '1') => {
call.startDTMF(callId, str).then((res) => {
LogUtils.i(TAG, prefixLog + "then:startDtmf : %s" + JSON.stringify(callId) + JSON.stringify(str))
}).catch((err) => {
@ -262,7 +262,7 @@ export default class CallServiceProxy {
*
* @param { number } callId - call id
*/
public stopDTMF = (callId) => {
public stopDTMF = (callId = 1) => {
call.stopDTMF(callId).then((res) => {
LogUtils.i(TAG, prefixLog + "then:stopDtmf : %s" + JSON.stringify(callId))
}).catch((err) => {

View File

@ -49,6 +49,7 @@ struct Index {
private mCallDataManager: CallDataManager;
@State curBp: string = 'md';
@State incomingData: DefaultCallData = new DefaultCallData();
@State mHangup: boolean = false;
private smListener: mediaQuery.MediaQueryListener;
private mdListener: mediaQuery.MediaQueryListener;
private lgListener: mediaQuery.MediaQueryListener;
@ -100,8 +101,10 @@ struct Index {
onPageHide() {
LogUtils.i(TAG, "onPageHide");
globalThis.appInactiveState = true;
this.updateNotification();
if (!this.mHangup) {
globalThis.appInactiveState = true;
this.updateNotification();
}
LogUtils.i(TAG, "onPageHide end");
}
@ -243,6 +246,7 @@ struct Index {
BottomBtn({
callData: $callData,
callList: $callList,
hangup: $mHangup,
onItemClick: () => {
this.showKeyboard()
}
@ -252,7 +256,8 @@ struct Index {
Column() {
IncomingCom({
callList: $callList,
callData: $callData })
callData: $callData,
hangup: $mHangup})
if (this.isTripleCall()) {
Column() {

View File

@ -30,7 +30,7 @@
"startWindowIcon": "$media:app_start_window_icon",
"startWindowBackground": "$color:black",
"removeMissionAfterTerminate": true,
"visible": true,
"visible": false,
"minWindowHeight": 700,
"minWindowWidth": 320,
"skills": [
@ -56,7 +56,10 @@
"type": "service",
"visible": true,
"srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts",
"label": "$string:callui_description"
"label": "$string:callui_description",
"permissions": [
"ohos.permission.PLACE_CALL"
]
}
],
"requestPermissions": [

View File

@ -45,7 +45,7 @@
"startWindowIcon": "$media:app_start_window_icon",
"startWindowBackground": "$color:black",
"removeMissionAfterTerminate": true,
"visible": true,
"visible": false,
"minWindowHeight": 700,
"minWindowWidth": 320,
"skills": [
@ -71,7 +71,10 @@
"type": "service",
"visible": true,
"srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts",
"label": "$string:callui_description"
"label": "$string:callui_description",
"permissions": [
"ohos.permission.PLACE_CALL"
],
}
],
"requestPermissions": [

View File

@ -0,0 +1,20 @@
/**
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{
"hvigorVersion": "2.0.0",
"dependencies": {
"@ohos/hvigor-ohos-plugin": "2.0.0"
}
}

2
hvigor/hvigor-wrapper.js Normal file

File diff suppressed because one or more lines are too long

60
hvigorw Normal file
View File

@ -0,0 +1,60 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#!/bin/bash
# ----------------------------------------------------------------------------
# Hvigor startup script, version 1.0.0
#
# Required ENV vars:
# ------------------
# NODE_HOME - location of a Node home dir
# or
# Add /usr/local/nodejs/bin to the PATH environment variable
# ----------------------------------------------------------------------------
HVIGOR_APP_HOME=$(dirname $(readlink -f $0))
HVIGOR_WRAPPER_SCRIPT=${HVIGOR_APP_HOME}/hvigor/hvigor-wrapper.js
warn() {
echo ""
echo -e "\033[1;33m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m"
}
error() {
echo ""
echo -e "\033[1;31m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m"
}
fail() {
error "$@"
exit 1
}
# Determine node to start hvigor wrapper script
if [ -n "${NODE_HOME}" ];then
EXECUTABLE_NODE="${NODE_HOME}/bin/node"
if [ ! -x "$EXECUTABLE_NODE" ];then
fail "ERROR: NODE_HOME is set to an invalid directory,check $NODE_HOME\n\nPlease set NODE_HOME in your environment to the location where your nodejs installed"
fi
else
EXECUTABLE_NODE="node"
which ${EXECUTABLE_NODE} > /dev/null 2>&1 || fail "ERROR: NODE_HOME is not set and not 'node' command found in your path"
fi
# Check hvigor wrapper script
if [ ! -r "$HVIGOR_WRAPPER_SCRIPT" ];then
fail "ERROR: Couldn't find hvigor/hvigor-wrapper.js in ${HVIGOR_APP_HOME}"
fi
# start hvigor-wrapper script
exec "${EXECUTABLE_NODE}" \
"${HVIGOR_WRAPPER_SCRIPT}" "$@"

69
hvigorw.bat Normal file
View File

@ -0,0 +1,69 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Hvigor startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js
set NODE_EXE=node.exe
goto start
:start
@rem Find node.exe
if defined NODE_HOME goto findNodeFromNodeHome
%NODE_EXE% --version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
echo.
echo Please set the NODE_HOME variable in your environment to match the
echo location of your NodeJs installation.
goto fail
:findNodeFromNodeHome
set NODE_HOME=%NODE_HOME:"=%
set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE%
if exist "%NODE_EXE_PATH%" goto execute
echo.
echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
echo.
echo Please set the NODE_HOME variable in your environment to match the
echo location of your NodeJs installation.
goto fail
:execute
@rem Execute hvigor
"%NODE_EXE%" %WRAPPER_MODULE_PATH% %*
:fail
exit /b 1

View File

@ -17,6 +17,7 @@
"apiType": 'stageMode',
"buildOption": {
},
"buildOption": {"compileMode": "esmodule"},
"entryModules": [
"callui"
],

View File

@ -0,0 +1,23 @@
/**
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{
"license": "ISC",
"devDependencies": {},
"name": "mobiledatasettings",
"description": "example description",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -1,14 +0,0 @@
{
"license":"ISC",
"devDependencies":{},
"name":"mobiledatasettings",
"ohos":{
"org":"huawei",
"directoryLevel":"module",
"buildTool":"hvigor"
},
"description":"example description",
"repository":{},
"version":"1.0.0",
"dependencies":{}
}

25
oh-package.json5 Normal file
View File

@ -0,0 +1,25 @@
/**
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{
"license": "ISC",
"devDependencies": {
"@ohos/hypium": "1.0.6"
},
"name": "callui",
"description": "example description",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

Binary file not shown.

View File

@ -15,8 +15,7 @@
{
"apiType": 'stageMode',
"buildOption": {
},
"buildOption": {"compileMode": "esmodule"},
"entryModules": [
"callui"
],

View File

@ -0,0 +1,23 @@
/**
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{
"license": "ISC",
"devDependencies": {},
"name": "simcardmanagement",
"description": "example description",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -1,14 +0,0 @@
{
"license": "ISC",
"devDependencies": {},
"name": "simcardmanagement",
"ohos": {
"org": "huawei",
"directoryLevel": "module",
"buildTool": "hvigor"
},
"description": "example description",
"repository": {},
"version": "1.0.0",
"dependencies": {}
}