diff options
author | 2015-03-18 21:32:18 +0000 | |
---|---|---|
committer | 2015-03-18 21:32:19 +0000 | |
commit | dd0d4b75794081e873977a5480d3d1dbff270d05 (patch) | |
tree | 33ca4f198a52ce5ab211fe4061a7662eed91c013 | |
parent | 07459a36177411595df2d6d0993d3dc489fa302b (diff) | |
parent | 9b0ab65ed46be992dd71b5f811bb972168e51c36 (diff) |
Merge "Enable/disable hardware rendering on windows by application tag"
-rw-r--r-- | api/current.txt | 1 | ||||
-rw-r--r-- | api/system-current.txt | 1 | ||||
-rw-r--r-- | core/java/android/content/pm/ApplicationInfo.java | 9 | ||||
-rw-r--r-- | core/java/android/content/pm/PackageParser.java | 1 | ||||
-rw-r--r-- | core/java/android/view/WindowManagerGlobal.java | 10 |
5 files changed, 17 insertions, 5 deletions
diff --git a/api/current.txt b/api/current.txt index 9f54b85e144a..988722d60eaf 100644 --- a/api/current.txt +++ b/api/current.txt @@ -8673,6 +8673,7 @@ package android.content.pm { 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 845c4ff093d0..942a2cb5d0b6 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -8888,6 +8888,7 @@ package android.content.pm { 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 e1a2aa96c36c..5b7896aa7d65 100644 --- a/core/java/android/content/pm/ApplicationInfo.java +++ b/core/java/android/content/pm/ApplicationInfo.java @@ -598,6 +598,11 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { */ 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) { @@ -637,6 +642,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { } pw.println(prefix + "enabled=" + enabled + " targetSdkVersion=" + targetSdkVersion + " versionCode=" + versionCode); + pw.println(prefix + "hardwareAccelerated=" + hardwareAccelerated); if (manageSpaceActivityName != null) { pw.println(prefix + "manageSpaceActivityName="+manageSpaceActivityName); } @@ -722,6 +728,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { descriptionRes = orig.descriptionRes; uiOptions = orig.uiOptions; backupAgentName = orig.backupAgentName; + hardwareAccelerated = orig.hardwareAccelerated; } @@ -773,6 +780,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { dest.writeString(backupAgentName); dest.writeInt(descriptionRes); dest.writeInt(uiOptions); + dest.writeInt(hardwareAccelerated ? 1 : 0); } public static final Parcelable.Creator<ApplicationInfo> CREATOR @@ -823,6 +831,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { backupAgentName = source.readString(); descriptionRes = source.readInt(); uiOptions = source.readInt(); + hardwareAccelerated = source.readInt() != 0; } /** diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index 11407563e2e5..a245ba56e3bf 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -2519,6 +2519,7 @@ public class PackageParser { 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 (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 1cebe3fd23f6..57558ff26205 100644 --- a/core/java/android/view/WindowManagerGlobal.java +++ b/core/java/android/view/WindowManagerGlobal.java @@ -249,12 +249,12 @@ public final class WindowManagerGlobal { final WindowManager.LayoutParams wparams = (WindowManager.LayoutParams) params; if (parentWindow != null) { parentWindow.adjustLayoutParamsForSubWindow(wparams); - } else if (ActivityManager.isHighEndGfx()) { - // If there's no parent and we're running on L or above (or in the - // system context), assume we want hardware acceleration. + } else { + // If there's no parent, then hardware acceleration for this view is + // set from the application's hardware acceleration setting. final Context context = view.getContext(); - if (context != null && context.getApplicationInfo().targetSdkVersion - >= Build.VERSION_CODES.LOLLIPOP) { + if (context != null + && context.getApplicationInfo().hardwareAccelerated) { wparams.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED; } } |