AppManager icon indicating copy to clipboard operation
AppManager copied to clipboard

Install a apk as frozen

Open yilksd opened this issue 1 year ago • 8 comments

Please check before submitting an issue

  • [X] I am using the latest version of App Manager
  • [X] I have searched the issues and haven't found anything relevant
  • [X] I have read the docs

Describe a description of the new feature

Is there any method to install a apk as frozen , from the beginning? I mean, never been running. I want to use App Manager to restrict ( disable some components, etc) it before running the app. I know stopped apps (including apps that never been manually started after installed) cannot receive system broadcast beacause the system adds FLAG_EXCLUDE_STOPPED_PACKAGES to all broadcast intents, but some powerful apps just run before I touch their icon.

Describe the solution you'd like

When installing a app using App Manager , there is a option like " install as frozen".

Describe alternatives you've considered

No response

Additional context

No response

yilksd avatar Aug 24 '23 16:08 yilksd

An app can't open itself if it's installed for the first time. But if you're updating it, it can run itself by listening to certain broadcast receivers.

MuntashirAkon avatar Aug 24 '23 16:08 MuntashirAkon

An app can't open itself if it's installed for the first time.

An app can't open itself if it's installed for the first time because it cannot receive system broadcast, but some powerful apps just runs. Maybe by using other apps which are already installed and have been running to send custom broadcast to wake this app up?

But if you're updating it, it can run itself by listening to certain broadcast receivers.

I didn't update it.

yilksd avatar Aug 25 '23 12:08 yilksd

DeepL will adds itself to a menu when tap and holding text in chrome and other apps, when it is installed, before first run. Is there an exception for this or did the app run on install?

https://play.google.com/store/apps/details?id=com.deepl.mobiletranslator

Screenshot_20230831_133053_Chrome~2

Incog5 avatar Aug 31 '23 06:08 Incog5

These options are based on the intent filters in the AndroidManifest.xml inside the APK file. It's nothing to do with running or not running an app. But if you click on it, it will launch the app.

MuntashirAkon avatar Aug 31 '23 06:08 MuntashirAkon

Understood. Thanks.

Incog5 avatar Sep 01 '23 15:09 Incog5

It's not actually that difficult to implement such an option in our existing model. But I think I need to think it through:

An app can run right after installing it if it's being updated (with the exception of system apps which can run in first install). But I don't think it's necessary to freeze the app to prevent the app from running automatically (freezing has consequences over temporary data such as launcher/dynamic shortcuts). We can prevent this by stopping the app before installing it (if the option is enabled). This way it can't receive broadcast actions such as ACTION_MY_PACKAGE_REPLACED and stay stopped.

MuntashirAkon avatar Sep 16 '23 10:09 MuntashirAkon

An app can run right after installing it if it's being updated (with the exception of system apps which can run in first install).

I didn't update it.

Maybe you could check this: https://www.javacodegeeks.com/2012/05/android-broadcast-receiver-change-in.html An app can send custom broadcast with FLAG_INCLUDE_STOPPED_PACKAGES to wake up stopped apps.

yilksd avatar Oct 08 '23 04:10 yilksd

Maybe you could check this: https://www.javacodegeeks.com/2012/05/android-broadcast-receiver-change-in.html An app can send custom broadcast with FLAG_INCLUDE_STOPPED_PACKAGES to wake up stopped apps.

This is actually the default behaviour. Installer specifically avoids waking up stopped packages by setting FLAG_EXCLUDE_STOPPED_PACKAGES. If it's happening to you, some other system app is triggering it, not the installer.

MuntashirAkon avatar Oct 08 '23 11:10 MuntashirAkon

My verdict: Such feature isn't required due to the reason stated above.

MuntashirAkon avatar Aug 12 '24 06:08 MuntashirAkon