close android activities when settings is closed (#20604)

* close android activities

* new line

* only if activity is launched

* fix
old-commit-hash: 27ebd334dc
commatwo_master
iejMac 4 years ago committed by GitHub
parent ac54ac7513
commit 2883bab710
  1. 7
      selfdrive/hardware/eon/hardware.h
  2. 7
      selfdrive/ui/qt/offroad/settings.cc
  3. 3
      selfdrive/ui/qt/offroad/settings.hpp

@ -47,6 +47,13 @@ public:
int ret = std::system("dumpsys SurfaceFlinger --list | grep -Fq 'com.android.settings'"); int ret = std::system("dumpsys SurfaceFlinger --list | grep -Fq 'com.android.settings'");
launched_activity = ret == 0; launched_activity = ret == 0;
} }
static void close_activities() {
if(launched_activity){
std::system("pm disable com.android.settings && pm enable com.android.settings");
}
}
static void launch_activity(std::string activity, std::string opts = "") { static void launch_activity(std::string activity, std::string opts = "") {
if (!launched_activity) { if (!launched_activity) {
std::string cmd = "am start -n " + activity + " " + opts + std::string cmd = "am start -n " + activity + " " + opts +

@ -328,3 +328,10 @@ SettingsWindow::SettingsWindow(QWidget *parent) : QFrame(parent) {
} }
)"); )");
} }
void SettingsWindow::hideEvent(QHideEvent *event){
#ifdef QCOM
HardwareEon::close_activities();
#endif
}

@ -37,6 +37,9 @@ class SettingsWindow : public QFrame {
public: public:
explicit SettingsWindow(QWidget *parent = 0); explicit SettingsWindow(QWidget *parent = 0);
protected:
void hideEvent(QHideEvent *event);
signals: signals:
void closeSettings(); void closeSettings();
void offroadTransition(bool offroad); void offroadTransition(bool offroad);

Loading…
Cancel
Save