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

Commit 5e1565ea authored by Alan Viverette's avatar Alan Viverette
Browse files

Enable hardware rendering for system process

Also enables hardware rendering by default on windows created
without a parent activity (e.g. by services).

BUG: 16240470
Change-Id: I906d48cb07af50fa02dae4f4ecdb5e65211fc6ef
parent 8a850b4c
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -5081,7 +5081,12 @@ public final class ActivityThread {
    }
    }


    public static ActivityThread systemMain() {
    public static ActivityThread systemMain() {
        // The system process on low-memory devices do not get to use hardware
        // accelerated drawing, since this can add too much overhead to the
        // process.
        if (!ActivityManager.isHighEndGfx()) {
            HardwareRenderer.disable(true);
            HardwareRenderer.disable(true);
        }
        ActivityThread thread = new ActivityThread();
        ActivityThread thread = new ActivityThread();
        thread.attach(true);
        thread.attach(true);
        return thread;
        return thread;
+10 −0
Original line number Original line Diff line number Diff line
@@ -19,7 +19,9 @@ package android.view;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator;
import android.app.ActivityManager;
import android.app.ActivityManager;
import android.content.ComponentCallbacks2;
import android.content.ComponentCallbacks2;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Configuration;
import android.os.Build;
import android.os.IBinder;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceManager;
@@ -204,6 +206,14 @@ public final class WindowManagerGlobal {
        final WindowManager.LayoutParams wparams = (WindowManager.LayoutParams)params;
        final WindowManager.LayoutParams wparams = (WindowManager.LayoutParams)params;
        if (parentWindow != null) {
        if (parentWindow != null) {
            parentWindow.adjustLayoutParamsForSubWindow(wparams);
            parentWindow.adjustLayoutParamsForSubWindow(wparams);
        } else {
            // If there's no parent and we're running on L or above (or in the
            // system context), assume we want hardware acceleration.
            final Context context = view.getContext();
            if (context != null
                    && context.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.L) {
                wparams.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
            }
        }
        }


        ViewRootImpl root;
        ViewRootImpl root;