Malware Threat Mitigation
Malwarelytics for Android provide several mitigation techniques. These are useful to protect the app when a harmful app is found on the device.
Available mitigations:
- Killing the app
- Uninstalling a harmful app
Due to the limitations of Android operating system it might not be possible uninstall a harmful app. In certain situations the system does not allow it or an aggressive malware with extensive permission might be able to protect itself and thwart uninstallation attempts.
Triggering Mitigations
When the apps wants to directly call a mitigation, it has to do so via MitigationManager
.
Killing the App
App can be killed immediately by calling:
val mitigationManager = antivirus.getMitigationManager()
mitigationManager.killApplication()
Uninstalling Other Apps
App can also request to uninstall other apps identified by its package name (application ID):
mitigationManager.uninstallApplication(context, packageName)
This call does not provide any callback for result of the uninstall.
If a result is required it has to be obtained in a slightly complicated manner that results
from the limitation of Android OS.
It has to be called either Activity
or Fragment
and utilize onActivityResult()
callback
that’s available in either one of them.
To do so in an activity trigger the uninstall with:
mitigationManager.uninstallApplicationWithActivityCallback(activity, packageName, requestCode)
Similarly, call
mitigationManager.uninstallApplicationWithFragmentCallback(fragment, packageName, requestCode)
from a fragment (only AndroidX fragment is supported).
To process the callback override onActivityResult()
system callback in the activity or fragment
and process the requestCode
you passed in.