diff --git a/host/bins/cfc-0.1.0-x64.deb b/host/bins/cfc-0.1.0-x64.deb index aea5b4d..e4d91a9 100644 Binary files a/host/bins/cfc-0.1.0-x64.deb and b/host/bins/cfc-0.1.0-x64.deb differ diff --git a/host/src/pack/dpkg/opt/cfc/mwc/bin/kill_lg_instance.sh b/host/src/pack/dpkg/opt/cfc/mwc/bin/kill_lg_instance.sh index 71becac..c34193b 100755 --- a/host/src/pack/dpkg/opt/cfc/mwc/bin/kill_lg_instance.sh +++ b/host/src/pack/dpkg/opt/cfc/mwc/bin/kill_lg_instance.sh @@ -18,7 +18,7 @@ else pid=`ps aux | grep "LG_B1_Client " | grep -v grep | grep $inst | awk '{print $2}'` fi -if [ "$pid" -gt 0 ] +if [ ! -z "$pid" ] && [ "$pid" -gt 0 ] then echo "inside kill" kill -KILL $pid diff --git a/host/src/pack/dpkg/opt/cfc/mwc/bin/lg_launcher.sh b/host/src/pack/dpkg/opt/cfc/mwc/bin/lg_launcher.sh index 7c7fdce..18a0cd6 100755 --- a/host/src/pack/dpkg/opt/cfc/mwc/bin/lg_launcher.sh +++ b/host/src/pack/dpkg/opt/cfc/mwc/bin/lg_launcher.sh @@ -62,6 +62,14 @@ fi $FOLDER_1_UPDATE $FOLDER_2_UPDATE + +num_app_process=`ps aux | grep "mwc_launcher.* $1 $2" | grep -v grep | wc -l` +if [ ! "$num_app_process" -lt "1" ]; +then + echo "The app process is already running, skip the app launch!" + exit 0 +fi + /opt/cfc/mwc/bin/mwc_launcher localhost 3000 $@ echo "appname:$1, previous_app:$previous_app" diff --git a/host/src/pack/dpkg/opt/cfc/mwc/bin/loadapp.sh b/host/src/pack/dpkg/opt/cfc/mwc/bin/loadapp.sh index 89ce37f..85d584f 100755 --- a/host/src/pack/dpkg/opt/cfc/mwc/bin/loadapp.sh +++ b/host/src/pack/dpkg/opt/cfc/mwc/bin/loadapp.sh @@ -60,6 +60,18 @@ function configure_wm_density() configure_wm_density +# Kill the looking glass client with same slot id. +# This is to avoid messed looking glass slot allocation status. +lg_pids=`ps aux | grep "LG_B1_Client.*looking-glass$3" | grep -v grep | awk '{print $2}'` + +echo "Looking-glass client pid:$lg_pids" +if [ ! -z "$lg_pids" ]; +then + echo "Kill looking-glass client pid: $lg_pids" + kill -KILL $lg_pids + sleep 1 +fi + if [ "$1" = "com.tencent.mm" ]; then adb -s vsock:3:5555 shell am start -W -S -n $2 --display $3 --activity-no-animation diff --git a/host/src/pack/dpkg/opt/cfc/mwc/bin/mwc_hostdaemon b/host/src/pack/dpkg/opt/cfc/mwc/bin/mwc_hostdaemon index 0df5605..014025b 100755 Binary files a/host/src/pack/dpkg/opt/cfc/mwc/bin/mwc_hostdaemon and b/host/src/pack/dpkg/opt/cfc/mwc/bin/mwc_hostdaemon differ diff --git a/host/src/pghost/vatclient.cpp b/host/src/pghost/vatclient.cpp index 368f399..5c3e85b 100644 --- a/host/src/pghost/vatclient.cpp +++ b/host/src/pghost/vatclient.cpp @@ -433,6 +433,9 @@ int VatClient::HandleEvent(Event* event) if (ret >=0) { slot_id = lg_slot; } + else { + slot_id = -1; + } } for (int i=0; islot_status, m_lg_slots[i]->appname, m_lg_slots[i]->activity); @@ -449,7 +452,11 @@ int VatClient::HandleEvent(Event* event) if (LGSLOT_USED == m_lg_slots[i]->slot_status) { char* launched_appname = m_lg_slots[i]->appname; if (strstr(launched_appname, appname)) { - m_lgslot->SetLGSlotIdle(i); + // Set the slot_id to -1 to avoid unexpected slot state update. + slot_id = -1; + // Don't set the slot to idle here. Let the process opened looking glass + // to communicate with daemon for the graceful shutdown. + // m_lgslot->SetLGSlotIdle(i); kill_lg_process = 1; slot_found = i; break; @@ -532,6 +539,7 @@ int VatClient::HandleEvent(Event* event) (char*) ";"); lg_slot = atoi(lg_instance_id); if (lg_slot >=0 && lg_slot < NUM_LG_SLOTS) { + slot_id = -1; m_lgslot->SetLGSlotIdle(lg_slot); } running = 0; @@ -594,8 +602,9 @@ void VatClient::CleanUp() delete m_launcherconnmgr; if (slot_id >=0 && slot_id < NUM_LG_SLOTS) { - if (LGSLOT_USED == m_lg_slots[slot_id]->slot_status) { + if (LGSLOT_IDLE != m_lg_slots[slot_id]->slot_status) { m_lgslot->SetLGSlotIdle(slot_id); + slot_id = -1; } } }