Screen Sharing Detection

Android devices are capable of sharing (mirroring) their screen to another display. A screen can be shared either wirelessly or using a cable. Screen sharing can, however, pose a security risk, as sensitive information might be leaking from app screens.

Malwarelytics for Android is able to detect that the screen is being shared and can be configured to terminate the app in such case.

Configuration

This feature can be configured during the Malwarelytics initialization phase:

val raspConfig = RaspConfig.Builder()
    .checkScreenSharing(Boolean)
    .exitOnScreenSharing(Boolean)
    // configuration of other RASP features
    .build()
Method Description
checkScreenSharing(Boolean) indicates whether screen sharing should be detected automatically. Defaults to true.
exitOnScreenSharing(Boolean) indicates whether the app should be terminated when screen sharing is automatically detected. Defaults to false.

Usage

After initialization, the screen sharing detection feature can be accessed via RaspManager. This can be used to register an observer or to trigger a manual screen sharing detection check.

Registering an Observer

Screen sharing detection can trigger a certain action. To achieve that, an observer needs to be configured and registered.

Observer configuration:

val raspObserver = object : RaspObserver {
    override fun onScreenSharingDetected(screenSharingDetected: Boolean) {
        // handle screen sharing detection
    }
    // handle detection of other RASP features
}

The observer can be registered in RaspManager. When it is no longer needed, it can be unregistered again.

raspManager.registerRaspObserver(raspObserver)
raspManager.unregisterRaspObserver(raspObserver)

Triggering a Manual Check

Screen sharing detection check can be triggered manually in RaspManager. Two methods are available – isScreenShared() gives a simple boolean answer, whereas getScreenSharingDetection() provides more details.

val screenSharingDetection = raspManager.getScreenSharingDetection()
val isScreenShared = raspManager.isScreenShared()

More information on general RASP feature configuration and usage can be found in this overview.

Last updated on May 02, 2022 (22:53) View product
Search

0.19.x

Malwarelytics for Android