← Back to index
References / filed

REQUEST_COMPANION_START_FOREGROUND_SERVICES_FROM_BACKGROUND

Lets a paired companion app start foreground services while in the background, which is what lets a hidden worker become resident.

274 words2 min read
Filed under
#android#permissions#reference

Since Android 9, an app normally cannot start a foreground service from the background. REQUEST_COMPANION_START_FOREGROUND_SERVICES_FROM_BACKGROUND is one of the narrow exemptions, scoped to a companion app in an established pairing.

It is the most interesting of the three companion permissions for what it enables. A foreground service is the residency mechanism behind every long-running worker in this kit: SmsPollingWorker, CallLogPollingWorker, SimInfoRefreshWorker, and the upload and retry workers that follow them. Normally getting one running requires the app to be visible, which is precisely what an implant avoids being.

This permission is the bridge between background execution and a resident foreground service, and it does so without the app having to surface first.

The trio reads as a complete background-execution path when taken together. REQUEST_COMPANION_RUN_IN_BACKGROUND covers staying alive in the background, this one covers escalating into a foreground service from there, and REQUEST_COMPANION_USE_DATA_IN_BACKGROUND covers keeping the network leg of those services open.

The caveat is the same as for the other two: the companion framework needs a real device pairing, which a sideloaded app has no evident route to establish. The write-up traces the resident worker service through startForeground(SYNC, notification) with the dataSync type rather than through the companion path, so this reads as declared background capability rather than an exploited one.

Related: REQUEST_COMPANION_RUN_IN_BACKGROUND, REQUEST_COMPANION_USE_DATA_IN_BACKGROUND, FOREGROUND_SERVICE

Part of Few Android permissions I have seen used often. All permissions here were seen in the mprivhaan analysis.