Example usage for android.content.pm ApplicationInfo disableCompatibilityMode

List of usage examples for android.content.pm ApplicationInfo disableCompatibilityMode

Introduction

In this page you can find the example usage for android.content.pm ApplicationInfo disableCompatibilityMode.

Prototype

@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
public void disableCompatibilityMode() 

Source Link

Document

Disable compatibility mode

Usage

From source file:android.content.pm.PackageParser.java

private static void updateApplicationInfo(ApplicationInfo ai, int flags, PackageUserState state) {
    // CompatibilityMode is global state.
    if (!sCompatibilityModeEnabled) {
        ai.disableCompatibilityMode();
    }/*w  ww  .ja v  a 2  s  .  com*/
    if (state.installed) {
        ai.flags |= ApplicationInfo.FLAG_INSTALLED;
    } else {
        ai.flags &= ~ApplicationInfo.FLAG_INSTALLED;
    }
    if (state.hidden) {
        ai.privateFlags |= ApplicationInfo.PRIVATE_FLAG_HIDDEN;
    } else {
        ai.privateFlags &= ~ApplicationInfo.PRIVATE_FLAG_HIDDEN;
    }
    if (state.enabled == PackageManager.COMPONENT_ENABLED_STATE_ENABLED) {
        ai.enabled = true;
    } else if (state.enabled == PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED) {
        ai.enabled = (flags & PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS) != 0;
    } else if (state.enabled == PackageManager.COMPONENT_ENABLED_STATE_DISABLED
            || state.enabled == PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER) {
        ai.enabled = false;
    }
    ai.enabledSetting = state.enabled;
}