Add android:hardwareAccelerated to Activity.
Hardware acceleration can now be enabled/disabled locally on each activity declared in the manifest. It can also be enabled/disabled directly on a window through the WindowManager.LayoutParams. Change-Id: I91dd0b26c4e7eb8cd7288e523ed6b7bda6d0990b
This commit is contained in:
@@ -165,6 +165,11 @@ public class ActivityInfo extends ComponentInfo
|
||||
* {@see android.app.Notification#FLAG_HIGH_PRIORITY}
|
||||
*/
|
||||
public static final int FLAG_IMMERSIVE = 0x0200;
|
||||
/**
|
||||
* Value for {@link #flags}: true when the application's rendering should
|
||||
* be hardware accelerated.
|
||||
*/
|
||||
public static final int FLAG_HARDWARE_ACCELERATED = 0x0400;
|
||||
/**
|
||||
* Options that have been set in the activity declaration in the
|
||||
* manifest.
|
||||
@@ -175,7 +180,7 @@ public class ActivityInfo extends ComponentInfo
|
||||
* {@link #FLAG_STATE_NOT_NEEDED}, {@link #FLAG_EXCLUDE_FROM_RECENTS},
|
||||
* {@link #FLAG_ALLOW_TASK_REPARENTING}, {@link #FLAG_NO_HISTORY},
|
||||
* {@link #FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS},
|
||||
* {@link #FLAG_IMMERSIVE}
|
||||
* {@link #FLAG_IMMERSIVE}, {@link #FLAG_HARDWARE_ACCELERATED}
|
||||
*/
|
||||
public int flags;
|
||||
|
||||
|
||||
@@ -283,12 +283,6 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
|
||||
*/
|
||||
public static final int FLAG_HEAVY_WEIGHT = 1<<20;
|
||||
|
||||
/**
|
||||
* Value for {@link #flags}: true when the application's rendering should
|
||||
* be hardware accelerated.
|
||||
*/
|
||||
public static final int FLAG_HARDWARE_ACCELERATED = 1<<21;
|
||||
|
||||
/**
|
||||
* Value for {@link #flags}: this is true if the application has set
|
||||
* its android:neverEncrypt to true, false otherwise. It is used to specify
|
||||
|
||||
@@ -16,9 +16,6 @@
|
||||
|
||||
package android.content.pm;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
@@ -30,14 +27,14 @@ import android.content.res.XmlResourceParser;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.PatternMatcher;
|
||||
import android.provider.Settings;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Config;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
|
||||
import com.android.internal.util.XmlUtils;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -48,7 +45,6 @@ import java.security.cert.CertificateEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
@@ -1535,11 +1531,9 @@ public class PackageParser {
|
||||
ai.flags |= ApplicationInfo.FLAG_VM_SAFE_MODE;
|
||||
}
|
||||
|
||||
if (sa.getBoolean(
|
||||
boolean hardwareAccelerated = sa.getBoolean(
|
||||
com.android.internal.R.styleable.AndroidManifestApplication_hardwareAccelerated,
|
||||
false)) {
|
||||
ai.flags |= ApplicationInfo.FLAG_HARDWARE_ACCELERATED;
|
||||
}
|
||||
false);
|
||||
|
||||
if (sa.getBoolean(
|
||||
com.android.internal.R.styleable.AndroidManifestApplication_hasCode,
|
||||
@@ -1638,7 +1632,8 @@ public class PackageParser {
|
||||
|
||||
String tagName = parser.getName();
|
||||
if (tagName.equals("activity")) {
|
||||
Activity a = parseActivity(owner, res, parser, attrs, flags, outError, false);
|
||||
Activity a = parseActivity(owner, res, parser, attrs, flags, outError, false,
|
||||
hardwareAccelerated);
|
||||
if (a == null) {
|
||||
mParseError = PackageManager.INSTALL_PARSE_FAILED_MANIFEST_MALFORMED;
|
||||
return false;
|
||||
@@ -1647,7 +1642,7 @@ public class PackageParser {
|
||||
owner.activities.add(a);
|
||||
|
||||
} else if (tagName.equals("receiver")) {
|
||||
Activity a = parseActivity(owner, res, parser, attrs, flags, outError, true);
|
||||
Activity a = parseActivity(owner, res, parser, attrs, flags, outError, true, false);
|
||||
if (a == null) {
|
||||
mParseError = PackageManager.INSTALL_PARSE_FAILED_MANIFEST_MALFORMED;
|
||||
return false;
|
||||
@@ -1782,7 +1777,8 @@ public class PackageParser {
|
||||
|
||||
private Activity parseActivity(Package owner, Resources res,
|
||||
XmlPullParser parser, AttributeSet attrs, int flags, String[] outError,
|
||||
boolean receiver) throws XmlPullParserException, IOException {
|
||||
boolean receiver, boolean hardwareAccelerated)
|
||||
throws XmlPullParserException, IOException {
|
||||
TypedArray sa = res.obtainAttributes(attrs,
|
||||
com.android.internal.R.styleable.AndroidManifestActivity);
|
||||
|
||||
@@ -1892,8 +1888,14 @@ public class PackageParser {
|
||||
false)) {
|
||||
a.info.flags |= ActivityInfo.FLAG_IMMERSIVE;
|
||||
}
|
||||
|
||||
|
||||
if (!receiver) {
|
||||
if (sa.getBoolean(
|
||||
com.android.internal.R.styleable.AndroidManifestActivity_hardwareAccelerated,
|
||||
hardwareAccelerated)) {
|
||||
a.info.flags |= ActivityInfo.FLAG_HARDWARE_ACCELERATED;
|
||||
}
|
||||
|
||||
a.info.launchMode = sa.getInt(
|
||||
com.android.internal.R.styleable.AndroidManifestActivity_launchMode,
|
||||
ActivityInfo.LAUNCH_MULTIPLE);
|
||||
|
||||
Reference in New Issue
Block a user