The interval of the startup timer is changed to 10 seconds.
And, a member variable called delay_count_ is added to check if
the number of times has exceeded 6.
If the count is less than 6, amd prints the error log for debugging.
Change-Id: Iddca7dd9799339345fcf36e8e866207ce78129ba
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
namespace {
constexpr int DYING_TIMEOUT = 5;
-constexpr int STARTUP_TIMEOUT = 30;
+constexpr int STARTUP_TIMEOUT = 10;
typedef enum {
AT_SERVICE_APP,
startup_timer_ = g_timeout_add_seconds(STARTUP_TIMEOUT,
+[](gpointer data) -> gboolean {
auto* app_status = static_cast<AppStatus*>(data);
- app_status->startup_timer_ = 0;
- app_status->event_listener_->OnStartupTimeout(app_status);
- return G_SOURCE_REMOVE;
+ if (!app_status->event_listener_->OnStartupTimeout(app_status)) {
+ app_status->startup_timer_ = 0;
+ return G_SOURCE_REMOVE;
+ }
+
+ return G_SOURCE_CONTINUE;
}, this);
if (startup_timer_ == 0) {
++fg_count_;
}
+int AppStatus::GetDelayCount() const {
+ return delay_count_;
+}
+
+void AppStatus::IncreaseDelayCount() {
+ ++delay_count_;
+}
+
bool AppStatus::IsManaged() const {
return app_info_->GetTaskmanage() == "true";
}
class IEvent {
public:
virtual void OnDyingTimeout(AppStatus* data) = 0;
- virtual void OnStartupTimeout(AppStatus* data) = 0;
+ virtual bool OnStartupTimeout(AppStatus* data) = 0;
virtual ~IEvent() = default;
};
void SetTimeStamp(int timestamp);
int GetFgCount() const;
void IncreaseFgCount();
+ int GetDelayCount() const;
+ void IncreaseDelayCount();
bool IsSubapp() const;
bool IsManaged() const;
bool exiting_ = false;
std::unordered_map<std::string, void*> extras_;
int64_t start_time_; /* start timestamp millisecond */
+ int delay_count_ = 0;
};
} // namespace amd
_request_flush_pending_request(app_status->GetPID());
}
-void AppStatusManager::OnStartupTimeout(AppStatus* app_status) {
+bool AppStatusManager::OnStartupTimeout(AppStatus* app_status) {
if (app_status == nullptr)
- return;
+ return false;
+
+ app_status->IncreaseDelayCount();
+ if (app_status->GetDelayCount() < 6) {
+ _E("App(%s[%d]) hasn't run main loop yet. delay_count(%d)",
+ app_status->GetAppID().c_str(), app_status->GetPID(),
+ app_status->GetDelayCount());
+ return true;
+ }
_E("App startup signal has not been received. pid(%d)", app_status->GetPID());
/*
*/
amd::AppStatusManager::GetInst().Update(app_status->shared_from_this(),
STATUS_DYING, false, true);
+ return false;
}
AppStatusManager& AppStatusManager::GetInst() {
int Finish();
void OnDyingTimeout(AppStatus* app) override;
- void OnStartupTimeout(AppStatus* app) override;
+ bool OnStartupTimeout(AppStatus* app) override;
private:
AppStatusManager() = default;