Kill App not working

Post your questions and help other users.

Moderator: Martin

vertigo
Posts: 147
Joined: 28 Oct 2018 00:28

Kill App not working

Post by vertigo » 07 May 2020 23:28

I was trying to make a flow to open a different phone app and kill the default/system (Moto) one when the default app is opened, but I can't get it to work. Despite the phone app being in the background, it isn't killed, as it's still in recent apps. I'm wondering if I'm doing something wrong, if there's an issue with Automagic, or if it's because it's a system app.

In looking for help on the problem here, I was given an idea to try setting it to not be able to run in the background, and although I didn't find a setting for that, I did find how to change the default dialer app, which I assumed would remove the need to kill the Moto one, since it won't launch at all now, but it turns out it has to be launched, otherwise the missed call counter doesn't get reset, not to mention I'm still curious as to why it isn't working.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Kill App not working

Post by Desmanto » 08 May 2020 10:21

What is the package name do you kill? com.android.phone? I think it should be com.android.dialer. I just tried Kill App action on com.android.dialer. It kill the app when I put it to background. This is without root.

Don't kill com.android.phone, AFAIK this process include your cellular connection. Killing this might give you call problem.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

vertigo
Posts: 147
Joined: 28 Oct 2018 00:28

Re: Kill App not working

Post by vertigo » 08 May 2020 19:25

It's com.android.dialer, not phone.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Kill App not working

Post by Desmanto » 10 May 2020 07:09

After killed, it is still logged in the recent. You need to use control UI to swipe out the dialer recent. Or since you need to open the default dialer, you can open it using start activity android.intent.action.MAIN, and use com.android.dialer and tick the flag FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS. This way, after put it to background, it won't appear in recents. If you still need to kill it, you can use kill app on it.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

vertigo
Posts: 147
Joined: 28 Oct 2018 00:28

Re: Kill App not working

Post by vertigo » 13 May 2020 08:11

Well, this is frustrating. First, after trying the start activity, it did work, but after opening the system dialer then opening the preferred one, when backing out of it, it would go back into the system dialer, even though it was no longer in recent apps and even if I killed it. It's like Android remembers that's where I was before launching the second dialer. Then, neither dialer would show up in recent apps even when launched normally, so something got screwed up. Rebooting fixed that, but the other problem still remained.

I couldn't figure out a way to prevent the stock dialer from being reopened when backing out of the other one through a start activity flag, but i did find a way. If I use control UI to go home after launching the stock dialer, then launch the other one, when I back out of it, it takes me to the home screen. But while I'm pretty sure it worked flawlessly the first time or two I tested it, now it takes about 5 seconds between going home and launching the second dialer. The flow executes in less than half a second, so that's not the problem. And if I remove the control UI action the dialer opens immediately. So something about that action is causing the dialer app to open very slowly. There just doesn't seem to be a good solution here.

User avatar
Hit
Posts: 91
Joined: 20 Jan 2020 11:31

Re: Kill App not working

Post by Hit » 13 May 2020 09:43

I think I can help but can you explain:
  • Why don't you open your favorite app directly
  • What is the name of that app
Ok

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Kill App not working

Post by Desmanto » 13 May 2020 17:04

@vertigo : Because that's the normal way activity should start and stop, after back it will return to previous top one (built-in dialer in your case). When you start from home screen, it will return to home screen too. To force activity to return to home screen, use flag FLAG_ACTIVITY_TASK_ON_HOME. This way, when return, it will always back to home screen (as if you launch the activity from home screen). Is this what you want?

The control UI delay probably caused by some extra line of script there. Try to use action Show homescreen instead. But you maybe don't need it anymore if you can achieve using above flag.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

vertigo
Posts: 147
Joined: 28 Oct 2018 00:28

Re: Kill App not working

Post by vertigo » 15 May 2020 21:03

Neither way works consistently. The flag seems to work the best, but still far from 100%. It usually, if not always, opens the second (third-party) dialer, and usually goes to the home screen on back, but not always. In fact, when I first tried it, it worked so poorly in that regard that now that I just tried it again, the fact it's working as well as it is makes me wonder if it's really that inconsistent or if I didn't set it up right the first time.

The show home screen action really doesn't work well. I tried both killing the stock dialer between show home screen and launching the second dialer and after launching the second dialer, and the first way frequently doesn't even launch the second dialer (and when it does it still sometimes goes to the stock dialer on back) whereas the second way almost never shows the second dialer. I can only assume that sometimes the stock dialer is still launching when the command is given to launch the second, and that command doesn't go through because the system is busy, though that shouldn't happen. I don't know if it's a problem with Android, my phone being slow/laggy (though that's still an Android issue, really), or how Automagic launches apps, but I can't rely on it to actually work properly using any of the discussed methods.

The only thing that seems to work reliably is adding a short sleep in there, which I don't like because it would mean a longer pause than necessary most of the time and the possibility of it still not bring long enough sometimes, or having the flow trigger to launch the stock dialer and another trigger to run it over that dialer launches, which would then launch the second dialer. Just a lot of extra steps to do something fairly basic.

vertigo
Posts: 147
Joined: 28 Oct 2018 00:28

Re: Kill App not working

Post by vertigo » 15 May 2020 21:07

@Hit - I need to open the stock dialer first, because only it can clear and reset the missed calls notification. Third-party dialers can't do this. And simply using Automagic to close the notification isn't enough, either, because it also doesn't reset it. So it goes like this:

- Missed call -> notification of one missed call
- Open stock dialer -> notification cleared and missed calls reset
- Missed call -> notification of one missed call

- Missed call -> notification of one missed call
- Open 3rd party dialer and clear notification with Automagic or by tapping on it and having it open preferred (third-party) dialer directly instead of opening stock dialer -> notification cleared
- Missed call -> notification of two missed calls (never reset)

The dialer I'm trying to use is True Phone.

User avatar
Hit
Posts: 91
Joined: 20 Jan 2020 11:31

Re: Kill App not working

Post by Hit » 15 May 2020 23:52

So you want to say:
  • Every time you open the Default Dialer
    • So the Launcher know that you have seen the Missed Calls History and it clears the Notification Dot (or Number) (in the Launcher - Phone_icon
    • Do nothing
  • Open your Another Dialer and destroy the Default Dialer from Recent
    • And do what you want there
Right?

And
  1. You still need to see the Notification Dot (or Number) in the Launcher
    • And you want to see the History in the Second Dialer
  2. You always open Default Dialer whether there is Missed Call or not
  3. In Recent overview, you can clear app by swiping OR by clicking the [x] button?

Post Reply