Compatibility framework changes (Android 13)

Figure 1. The App Compatibility Changes screen in developer options lists the changes that you can toggle.

This page describes toggleable changes that are part of the compatibility framework in Android 13. Use this list in conjunction with the developer options and ADB commands to test and debug your app as you prepare to support and target Android 13.

Here are some of the things you can do using the compatibility framework tools:

  • Test targeted changes without actually changing the app's targetSdkVersion. You can use the toggles to force-enable specific targeted behavior changes to evaluate the impact on your existing app.
  • Focus your testing on specific changes only. Rather than having to address all targeted changes at once, the toggles let you disable all targeted changes except the ones you want to test against.
  • Manage toggles through adb. You can use adb commands to enable and disable the toggleable changes in your automated test environment.
  • Debug faster using standard change IDs. Toggleable changes each have a unique ID and name that you can use to quickly debug root cause in log output.

For complete details on using the tools for each of these use cases, see Compatibility framework tools.

Behavior changes included in the compatibility framework

The list in this section describes toggleable changes that included in the compatibility framework in Android 13.

You can filter the list of changes by Default State.

Toggleable changes in the compatibility framework in Android 13

ALWAYS_SANDBOX_DISPLAY_APIS

Change ID: 185004937
Default State: Disabled for all apps.

Forces the packages it is applied to always have Display API sandboxing applied, regardless of windowing mode. The Display APIs will always provide the app bounds.

To learn more about this change, see Display#getRealSize and getRealMetrics: deprecation and sandboxing.

CAMERA_MIC_INDICATORS_NOT_PRESENT

Change ID: 162547999
Default State: Disabled for all apps.

Indicates that this device supports camera and microphone indicators. Will be false if present, because the CompatChanges#isChangeEnabled method returns true if the Change ID is not present.

DEFER_BOOT_COMPLETED_BROADCAST_CHANGE_ID

Change ID: 203704822
Default State: Enabled for apps that target Android 13 or higher.

For apps targeting Android 13 and higher, defer LOCKED_BOOT_COMPLETED and BOOT_COMPLETED broadcasts until the first time any process in the UID is started.

DOWNSCALED

Change ID: 168419799
Default State: Disabled for all apps.

This change is the gatekeeper of all per-app buffer downscaling changes. Disabling this change prevents the following scaling factors from working:

When this change is enabled for an app package, the app is forcibly resized to the highest enabled scaling factor. For example, 80% is used if both 80% and 70% are enabled.

DOWNSCALE_30

Change ID: 189970040
Default State: Disabled for all apps.

When DOWNSCALED is also enabled, enabling this change for a package forces the app to assume it's running on a display with 30% vertical and horizontal resolution of the real display.

DOWNSCALE_35

Change ID: 189969749
Default State: Disabled for all apps.

When DOWNSCALED is also enabled, enabling this change for a package forces the app to assume it's running on a display with 35% vertical and horizontal resolution of the real display.

DOWNSCALE_40

Change ID: 189970038
Default State: Disabled for all apps.

When DOWNSCALED is also enabled, enabling this change for a package forces the app to assume it's running on a display with 40% vertical and horizontal resolution of the real display.

DOWNSCALE_45

Change ID: 189969782
Default State: Disabled for all apps.

When DOWNSCALED is also enabled, enabling this change for a package forces the app to assume it's running on a display with 45% vertical and horizontal resolution of the real display.

DOWNSCALE_50

Change ID: 176926741
Default State: Disabled for all apps.

When DOWNSCALED is also enabled, enabling this change for a package forces the app to assume it's running on a display with 50% vertical and horizontal resolution of the real display.

DOWNSCALE_55

Change ID: 189970036
Default State: Disabled for all apps.

When DOWNSCALED is also enabled, enabling this change for a package forces the app to assume it's running on a display with 55% vertical and horizontal resolution of the real display.

DOWNSCALE_60

Change ID: 176926771
Default State: Disabled for all apps.

When DOWNSCALED is also enabled, enabling this change for a package forces the app to assume it's running on a display with 60% vertical and horizontal resolution of the real display.

DOWNSCALE_65

Change ID: 189969744
Default State: Disabled for all apps.

When DOWNSCALED is also enabled, enabling this change for a package forces the app to assume it's running on a display with 65% vertical and horizontal resolution of the real display.

DOWNSCALE_70

Change ID: 176926829
Default State: Disabled for all apps.

When DOWNSCALED is also enabled, enabling this change for a package forces the app to assume it's running on a display with 70% vertical and horizontal resolution of the real display.

DOWNSCALE_75

Change ID: 189969779
Default State: Disabled for all apps.

When DOWNSCALED is also enabled, enabling this change for a package forces the app to assume it's running on a display with 75% vertical and horizontal resolution of the real display.

DOWNSCALE_80

Change ID: 176926753
Default State: Disabled for all apps.

When DOWNSCALED is also enabled, enabling this change for a package forces the app to assume it's running on a display with 80% vertical and horizontal resolution of the real display.

DOWNSCALE_85

Change ID: 189969734
Default State: Disabled for all apps.

When DOWNSCALED is also enabled, enabling this change for a package forces the app to assume it's running on a display with 85% vertical and horizontal resolution of the real display.

DOWNSCALE_90

Change ID: 182811243
Default State: Disabled for all apps.

When DOWNSCALED is also enabled, enabling this change for a package forces the app to assume it's running on a display with 90% vertical and horizontal resolution of the real display.

DYNAMIC_RECEIVER_EXPLICIT_EXPORT_REQUIRED

Change ID: 161145287
Default State: Enabled for apps that target Android 13 or higher.

For apps targeting Android 13 and higher, it is now required for apps to explicitly set either Context.RECEIVER_EXPORTED or Context.RECEIVER_NOT_EXPORTED when registering a receiver for an unprotected broadcast in code.

To learn more about this change, see the section on Safer exporting of context-registered receivers.

FORCE_DISABLE_HEVC_SUPPORT

Change ID: 174227820
Default State: Disabled for all apps.

Force disable an app from supporting the HEVC media capability. Apps should declare their supported media capabilities in their manifest but this flag can be used to force an app into not supporting HEVC, hence forcing transcoding while accessing media encoded in HEVC. Setting this flag will override any OS level defaults for apps. It is disabled by default, meaning that the OS defaults take precedence. Setting this flag and FORCE_ENABLE_HEVC_SUPPORT is an undefined state and will result in the OS ignoring both flags.

FORCE_ENABLE_HEVC_SUPPORT

Change ID: 174228127
Default State: Disabled for all apps.

Force enable an app to support the HEVC media capability Apps should declare their supported media capabilities in their manifest but this flag can be used to force an app into supporting HEVC, hence avoiding transcoding while accessing media encoded in HEVC. Setting this flag will override any OS level defaults for apps. It is disabled by default, meaning that the OS defaults would take precedence. Setting this flag and FORCE_DISABLE_HEVC_SUPPORT is an undefined state and will result in the OS ignoring both flags.

FORCE_NON_RESIZE_APP

Change ID: 181136395
Default State: Disabled for all apps.

Forces the packages it is applied to to be non-resizable.

FORCE_RESIZE_APP

Change ID: 174042936
Default State: Disabled for all apps.

Forces the packages it is applied to to be resizeable. We only allow resizing in fullscreen windowing mode, but not forcing the app into resizeable multi-windowing mode.

KEYSTORE_OPERATION_CREATION_MAY_FAIL

Change ID: 169897160
Default State: Disabled for all apps.

When enabled, keystore operation creation might fail according to the new pruning strategy. Keystore used to work under the assumption that the creation of cryptographic operations always succeeds. However, the KeyMint backend has only a limited number of operation slots.

In order to keep up the appearance of "infinite" operation slots, the Keystore daemon would prune least recently used operations if there was no available operation slot. As a result, good operations could be terminated prematurely. This opened up AndroidKeystore up to denial-of-service (DoS) and unintended livelock. For example, if multiple apps woke up at the same time due to power management optimizations and attempted to perform crypto operations, they start terminating each others operations without making any progress.

To break out of livelocks and to discourage DoS attempts, we have changed the pruning strategy for such that it prefers clients that use few operation slots briefly. As a result, single operations that don't linger inactive for more than 5 seconds will almost always conclude unhampered by the pruning strategy. There are still some operations related to file system encryption that can prune even these operations, but those cases are extremely rare. As a side effect of this new pruning strategy operation, creation can now fail if the client has a lower pruning power than all of the existing operations.

Pruning strategy: To find a suitable candidate, we compute the malus for the caller and each existing operation. The malus is the inverse of the pruning power (caller) or pruning resistance (existing operation). For the caller to be able to prune an operation, it must find an operation with a malus higher than its own. For more details on the pruning strategy, see the implementation of operation.rs. On Android 11 (API level 30) and lower, KeyStore2 will poll the Keystore daemon for a free operation slot. For apps targeting Android 11 (API level 30) and lower, it will still look like cipher and signature object initialization always succeeds—however, it may take longer to get an operation. All Android versions benefit from fairer operation slot scheduling and a better chance to successfully conclude an operation.

NATIVE_HEAP_ZERO_INIT

Change ID: 178038272
Default State: Disabled for all apps.

Enable automatic zero-initialization of native heap memory allocations.

NATIVE_MEMTAG_ASYNC

Change ID: 135772972
Default State: Disabled for all apps.

Enable asynchronous (ASYNC) memory tag checking in this process. This flag only affects hardware supporting the ARM Memory Tagging Extension (MTE).

NATIVE_MEMTAG_SYNC

Change ID: 177438394
Default State: Disabled for all apps.

Enables synchronous (SYNC) memory tag checking in this process. This flag only affects hardware supporting the ARM Memory Tagging Extension (MTE). If both NATIVE_MEMTAG_ASYNC and this option are enabled, this option takes precedence and MTE is enabled in SYNC mode.

NEVER_SANDBOX_DISPLAY_APIS

Change ID: 184838306
Default State: Disabled for all apps.

Forces the packages it is applied to never have Display API sandboxing applied for a letterbox or SCM activity. The Display APIs will continue to provide DisplayArea bounds.

To learn more about this change, see Display#getRealSize and getRealMetrics: deprecation and sandboxing.

NOTIFICATION_LOG_ASSISTANT_CANCEL

Change ID: 195579280
Default State: Enabled for apps that target Android 13 or higher.

For apps targeting Android 13 and higher, enables listeners to understand the more specific reason provided for notification cancellations from an assistant, rather than using the more general REASON_LISTENER_CANCEL.

NOTIFICATION_PERM_CHANGE_ID

Change ID: 194833441
Default State: Enabled for apps that target Android 13 or higher.

For apps targeting Android 13 and higher, enables behavior changes related to the runtime permissionf or notifications.

To learn more about this change, see the page about the new notification runtime permission.

OVERRIDE_CAMERA_RESIZABLE_AND_SDK_CHECK

Change ID: 191513214
Default State: Disabled for all apps.

When enabled this change id forces the packages it is applied to ignore the current value of android:resizeableActivity as well as target SDK equal to or below M and consider the activity as non-resizeable. In this case, the value of camera rotate and crop will only depend on the needed compensation considering the current display rotation.

OVERRIDE_CAMERA_ROTATE_AND_CROP_DEFAULTS

Change ID: 189229956
Default State: Disabled for all apps.

When enabled this change id forces the packages it is applied to override the default camera rotate and crop behavior and always return CaptureRequest.SCALER_ROTATE_AND_CROP_NONE. The default behavior along with all possible override combinations is discussed in the table below.

OVERRIDE_MIN_ASPECT_RATIO

Change ID: 174042980
Default State: Disabled for all apps.

This change is the gatekeeper of all changes that force a given minimum aspect ratio. Enabling this change allows the following minimum aspect ratios to be applied:

When this change is enabled for an app package, the minimum aspect ratio given in the app's manifest is overridden to the largest enabled aspect ratio unless the app's manifest value is higher.

OVERRIDE_MIN_ASPECT_RATIO_LARGE

Change ID: 180326787
Default State: Disabled for all apps.

When OVERRIDE_MIN_ASPECT_RATIO is also enabled, enabling this change for a package sets the activity's minimum aspect ratio to a large value as defined by OVERRIDE_MIN_ASPECT_RATIO_LARGE_VALUE.

OVERRIDE_MIN_ASPECT_RATIO_MEDIUM

Change ID: 180326845
Default State: Disabled for all apps.

When OVERRIDE_MIN_ASPECT_RATIO is also enabled, enabling this change for a package sets the activity's minimum aspect ratio to a medium value as defined by OVERRIDE_MIN_ASPECT_RATIO_MEDIUM_VALUE.

OVERRIDE_MIN_ASPECT_RATIO_PORTRAIT_ONLY

Change ID: 203647190
Default State: Enabled for all apps.

When OVERRIDE_MIN_ASPECT_RATIO is also enabled, enabling this change for a package limits any other changes that force an activity's minimum aspect ratio to a certain value—such as OVERRIDE_MIN_ASPECT_RATIO_LARGE and OVERRIDE_MIN_ASPECT_RATIO_MEDIUM—to activities that also have a portrait orientation.

RATE_LIMIT_TOASTS

Change ID: 174840628
Default State: This change can't be toggled. It is only logged by the compatibility framework.

Enables rate limiting on the number of Toast.show() calls to prevent overburdening the user with too many toasts in a limited time. Any attempt to show more toasts than allowed in a certain time frame will result in the toast being discarded.

SUPPORT_DEREGISTERING_LOSING_PDN_STATE

Change ID: 201522903
Default State: Enabled for apps that target Android 13 or higher.

For apps targeting Android 13 and higher, support the DEREGISTERING_REASON_LOSING_PDN state on APIs, such as DelegateRegistrationState#addDeregisteringFeatureTag and DelegateRegistrationState#getDeregisteringFeatureTags.

SUPPORT_PUBLISHING_STATE

Change ID: 202894742
Default State: Enabled for apps that target Android 13 or higher.

For apps targeting Android 13 and higher, support the publishing state on APIs, such as RcsUceAdapter#PUBLISH_STATE_PUBLISHINGsupport.

SUPPORT_REGISTERING_DELEGATE_STATE

Change ID: 205194548
Default State: Enabled for apps that target Android 13 or higher.

For apps targeting Android 13 and higher, support the REGISTERING state on APIs, such as DelegateRegistrationState#addRegisteringFeatureTags and DelegateRegistrationState#getRegisteringFeatureTagssupport.