Merge "Move ApplicationInfo hardware acceleration to public flags" into mnc-dev
diff --git a/api/current.txt b/api/current.txt
index de3d2e1..0209fa4 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -8907,6 +8907,7 @@
     field public static final int FLAG_EXTRACT_NATIVE_LIBS = 268435456; // 0x10000000
     field public static final int FLAG_FACTORY_TEST = 16; // 0x10
     field public static final int FLAG_FULL_BACKUP_ONLY = 67108864; // 0x4000000
+    field public static final int FLAG_HARDWARE_ACCELERATED = 536870912; // 0x20000000
     field public static final int FLAG_HAS_CODE = 4; // 0x4
     field public static final int FLAG_INSTALLED = 8388608; // 0x800000
     field public static final int FLAG_IS_DATA_ONLY = 16777216; // 0x1000000
@@ -8936,7 +8937,6 @@
     field public int descriptionRes;
     field public boolean enabled;
     field public int flags;
-    field public boolean hardwareAccelerated;
     field public int largestWidthLimitDp;
     field public java.lang.String manageSpaceActivityName;
     field public java.lang.String nativeLibraryDir;
diff --git a/api/system-current.txt b/api/system-current.txt
index e5f8396..baab9a3 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -9136,6 +9136,7 @@
     field public static final int FLAG_EXTRACT_NATIVE_LIBS = 268435456; // 0x10000000
     field public static final int FLAG_FACTORY_TEST = 16; // 0x10
     field public static final int FLAG_FULL_BACKUP_ONLY = 67108864; // 0x4000000
+    field public static final int FLAG_HARDWARE_ACCELERATED = 536870912; // 0x20000000
     field public static final int FLAG_HAS_CODE = 4; // 0x4
     field public static final int FLAG_INSTALLED = 8388608; // 0x800000
     field public static final int FLAG_IS_DATA_ONLY = 16777216; // 0x1000000
@@ -9165,7 +9166,6 @@
     field public int descriptionRes;
     field public boolean enabled;
     field public int flags;
-    field public boolean hardwareAccelerated;
     field public int largestWidthLimitDp;
     field public java.lang.String manageSpaceActivityName;
     field public java.lang.String nativeLibraryDir;
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index 96bb2ee..9fb6f4d 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -373,6 +373,12 @@
     public static final int FLAG_EXTRACT_NATIVE_LIBS = 1<<28;
 
     /**
+     * Value for {@link #flags}: {@code true} when the application's rendering
+     * should be hardware accelerated.
+     */
+    public static final int FLAG_HARDWARE_ACCELERATED = 1<<29;
+
+    /**
      * Value for {@link #flags}: true if code from this application will need to be
      * loaded into other applications' processes. On devices that support multiple
      * instruction sets, this implies the code might be loaded into a process that's
@@ -648,11 +654,6 @@
      */
     public int installLocation = PackageInfo.INSTALL_LOCATION_UNSPECIFIED;
 
-    /**
-     * True when the application's rendering should be hardware accelerated.
-     */
-    public boolean hardwareAccelerated;
-
     public void dump(Printer pw, String prefix) {
         super.dumpFront(pw, prefix);
         if (className != null) {
@@ -692,7 +693,6 @@
         }
         pw.println(prefix + "enabled=" + enabled + " targetSdkVersion=" + targetSdkVersion
                 + " versionCode=" + versionCode);
-        pw.println(prefix + "hardwareAccelerated=" + hardwareAccelerated);
         if (manageSpaceActivityName != null) {
             pw.println(prefix + "manageSpaceActivityName="+manageSpaceActivityName);
         }
@@ -784,7 +784,6 @@
         descriptionRes = orig.descriptionRes;
         uiOptions = orig.uiOptions;
         backupAgentName = orig.backupAgentName;
-        hardwareAccelerated = orig.hardwareAccelerated;
         fullBackupContent = orig.fullBackupContent;
     }
 
@@ -838,7 +837,6 @@
         dest.writeString(backupAgentName);
         dest.writeInt(descriptionRes);
         dest.writeInt(uiOptions);
-        dest.writeInt(hardwareAccelerated ? 1 : 0);
         dest.writeInt(fullBackupContent);
     }
 
@@ -891,7 +889,6 @@
         backupAgentName = source.readString();
         descriptionRes = source.readInt();
         uiOptions = source.readInt();
-        hardwareAccelerated = source.readInt() != 0;
         fullBackupContent = source.readInt();
     }
 
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 596c0e4..755eb5b 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -2530,7 +2530,9 @@
         owner.baseHardwareAccelerated = sa.getBoolean(
                 com.android.internal.R.styleable.AndroidManifestApplication_hardwareAccelerated,
                 owner.applicationInfo.targetSdkVersion >= Build.VERSION_CODES.ICE_CREAM_SANDWICH);
-        ai.hardwareAccelerated = owner.baseHardwareAccelerated;
+        if (owner.baseHardwareAccelerated) {
+            ai.flags |= ApplicationInfo.FLAG_HARDWARE_ACCELERATED;
+        }
 
         if (sa.getBoolean(
                 com.android.internal.R.styleable.AndroidManifestApplication_hasCode,
diff --git a/core/java/android/view/WindowManagerGlobal.java b/core/java/android/view/WindowManagerGlobal.java
index c16578e..606168c 100644
--- a/core/java/android/view/WindowManagerGlobal.java
+++ b/core/java/android/view/WindowManagerGlobal.java
@@ -20,6 +20,7 @@
 import android.app.ActivityManager;
 import android.content.ComponentCallbacks2;
 import android.content.Context;
+import android.content.pm.ApplicationInfo;
 import android.content.res.Configuration;
 import android.os.IBinder;
 import android.os.RemoteException;
@@ -247,7 +248,8 @@
             // set from the application's hardware acceleration setting.
             final Context context = view.getContext();
             if (context != null
-                    && context.getApplicationInfo().hardwareAccelerated) {
+                    && (context.getApplicationInfo().flags
+                            & ApplicationInfo.FLAG_HARDWARE_ACCELERATED) != 0) {
                 wparams.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
             }
         }