Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix appvoice #4

Merged
merged 2 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions server/ActivityManagerService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ int ActivityManagerInner::startActivityReal(ITaskManager* taskmanager, const str
const auto appInfo = mAppInfo.findAppInfoWithAlive(packageInfo.packageName);
if (appInfo) {
newActivity->setAppThread(appInfo);
if (is_home_task) taskmanager->setHomeTask(targetTask);
taskmanager->pushNewActivity(targetTask, newActivity, startFlag);
} else {
// Check the system environment is adequate for starting the application
Expand All @@ -358,6 +359,7 @@ int ActivityManagerInner::startActivityReal(ITaskManager* taskmanager, const str
is_home_task](const AppAttachTask::Event* e) {
mPriorityPolicy.add(e->mPid, true, priority);
newActivity->setAppThread(e->mAppRecord);
if (is_home_task) taskmanager->setHomeTask(targetTask);
taskmanager->pushNewActivity(targetTask, newActivity, startFlag);
};
if (submitAppStartupTask(packageInfo.packageName, packageInfo.packageName,
Expand Down Expand Up @@ -1024,6 +1026,7 @@ void ActivityManagerInner::systemReady() {
broadcastIntent(intent, IntentAction::COMP_TYPE_ACTIVITY);

if (startBootGuide() == false) {
ALOGI("startBootGuide failed, startHomeActivity");
startHomeActivity();
}

Expand Down
24 changes: 2 additions & 22 deletions server/TaskStackManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ bool TaskStackManager::moveTaskToBackground(const ActivityStackHandler& targetSt
auto topActivity = targetStack->getTopActivity();
topActivity->lifecycleTransition(ActivityRecord::PAUSED);
targetStack->setForeground(false);
mAllTasks.pop_front();
// mAllTasks.pop_front();
activeTask = getActiveTask();
if (activeTask) {
auto nextActivity = activeTask->getTopActivity();
Expand All @@ -98,25 +98,7 @@ bool TaskStackManager::moveTaskToBackground(const ActivityStackHandler& targetSt
}
}

// If it's above HomeTask, move it below HomeTask, otherwise no need to move it
for (auto iter = mAllTasks.begin(); iter != mAllTasks.end();) {
if (*iter == targetStack) {
isBeforeHomeTask = true;
auto tmp = iter;
++iter;
mAllTasks.erase(tmp);
} else {
if (*iter == mHomeTask) {
if (isBeforeHomeTask) {
mAllTasks.insert(++iter, targetStack);
}
return true;
}
++iter;
}
}

return false;
return isBeforeHomeTask;
}

void TaskStackManager::pushNewActivity(const ActivityStackHandler& targetStack,
Expand All @@ -128,8 +110,6 @@ void TaskStackManager::pushNewActivity(const ActivityStackHandler& targetStack,
if (activeTask) {
lastTopActivity = activeTask->getTopActivity();
lastTopActivity->lifecycleTransition(ActivityRecord::PAUSED);
} else {
mHomeTask = targetStack;
}

if (startFlag & Intent::FLAG_ACTIVITY_CLEAR_TASK) {
Expand Down
Loading