mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-03-02 00:53:53 +08:00
close android activities when settings is closed (#20604)
* close android activities * new line * only if activity is launched * fix
This commit is contained in:
@@ -47,6 +47,13 @@ public:
|
||||
int ret = std::system("dumpsys SurfaceFlinger --list | grep -Fq 'com.android.settings'");
|
||||
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 = "") {
|
||||
if (!launched_activity) {
|
||||
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:
|
||||
explicit SettingsWindow(QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
void hideEvent(QHideEvent *event);
|
||||
|
||||
signals:
|
||||
void closeSettings();
|
||||
void offroadTransition(bool offroad);
|
||||
|
||||
Reference in New Issue
Block a user