Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 529b60a3 authored by Romain Guy's avatar Romain Guy
Browse files

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
parent cf9a44cd
Loading
Loading
Loading
Loading
+52 −11
Original line number Diff line number Diff line
@@ -51156,6 +51156,17 @@
 visibility="public"
>
</field>
<field name="FLAG_HARDWARE_ACCELERATED"
 type="int"
 transient="false"
 volatile="false"
 value="1024"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="FLAG_IMMERSIVE"
 type="int"
 transient="false"
@@ -51555,17 +51566,6 @@
 visibility="public"
>
</field>
<field name="FLAG_HARDWARE_ACCELERATED"
 type="int"
 transient="false"
 volatile="false"
 value="2097152"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="FLAG_HAS_CODE"
 type="int"
 transient="false"
@@ -196487,6 +196487,25 @@
<parameter name="appName" type="java.lang.String">
</parameter>
</method>
<method name="setWindowManager"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="wm" type="android.view.WindowManager">
</parameter>
<parameter name="appToken" type="android.os.IBinder">
</parameter>
<parameter name="appName" type="java.lang.String">
</parameter>
<parameter name="hardwareAccelerated" type="boolean">
</parameter>
</method>
<method name="superDispatchKeyEvent"
 return="boolean"
 abstract="true"
@@ -196635,6 +196654,17 @@
 visibility="public"
>
</field>
<field name="FEATURE_HARDWARE_ACCELERATED"
 type="int"
 transient="false"
 volatile="false"
 value="10"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="FEATURE_INDETERMINATE_PROGRESS"
 type="int"
 transient="false"
@@ -197496,6 +197526,17 @@
 visibility="public"
>
</field>
<field name="FLAG_HARDWARE_ACCELERATED"
 type="int"
 transient="false"
 volatile="false"
 value="-2147483648"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="FLAG_IGNORE_CHEEK_PRESSES"
 type="int"
 transient="false"
+3 −2
Original line number Diff line number Diff line
@@ -4137,7 +4137,8 @@ public class Activity extends ContextThemeWrapper
        mEmbeddedID = id;
        mLastNonConfigurationInstances = lastNonConfigurationInstances;

        mWindow.setWindowManager(null, mToken, mComponent.flattenToString());
        mWindow.setWindowManager(null, mToken, mComponent.flattenToString(),
                (info.flags & ActivityInfo.FLAG_HARDWARE_ACCELERATED) != 0);
        if (mParent != null) {
            mWindow.setContainer(mParent.getWindow());
        }
+6 −1
Original line number Diff line number Diff line
@@ -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;

+0 −6
Original line number Diff line number Diff line
@@ -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 −14
Original line number Diff line number Diff line
@@ -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);

@@ -1894,6 +1890,12 @@ public class PackageParser {
        }
        
        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);
Loading