Skip to main content

Advanced Memory Protection

warning

Advanced memory protection setting is only available in API level 34 (Android 14) or higher.

Android 14 adds a new setting page called Advanced Memory Protection where user can activates memory tagging feature to mitigate memory safety vulnerabilities.

Here's a good article by Mishaal Rahman that explains what is memory tagging, why we need it, and how we can access the advanced memory protection setting page.

The setting page itself will look like this:

The left image shows the page without the memory tagging toggle. This is probably because the device hasn't enabled the memory tagging feature or its unable to use it. The right image (source: XDA) shows the page with the toggle.

Basic Usage​

It is also possible to open the advanced memory protection setting page within our applications by using ACTION_ADVANCED_MEMORY_PROTECTION_SETTINGS intent action:

import android.content.Context
import android.content.Intent
import android.os.Build
import android.provider.Settings
import androidx.core.content.ContextCompat.startActivity

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
startActivity(context, Intent(Settings.ACTION_ADVANCED_MEMORY_PROTECTION_SETTINGS), null)
}

References​