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

Commit 7eec10e6 authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

Get rid of the extended themes.

We now decide whether to use a bitmap background based on whether the
window's drawing is hardware accelerated.  To do this, there is a new
"state_accelerated" that state list drawables can be parameterized on,
and the standard window background uses this to select a solid color
or bitmap drawable as appropriate.

Introduces a little hackery to have wm preview windows pretend like
they are hardware accelerated even if they aren't, so the preview looks
closer to the actual app.

Also Add a DialogWhenLarge variation for the light theme.

Change-Id: I215a79d5df65ba3eed52ab363cade9d8218a6588
parent 7c2ae657
Loading
Loading
Loading
Loading
+23 −1
Original line number Diff line number Diff line
@@ -8501,6 +8501,17 @@
 visibility="public"
>
</field>
<field name="state_accelerated"
 type="int"
 transient="false"
 volatile="false"
 value="16843564"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="state_activated"
 type="int"
 transient="false"
@@ -14645,6 +14656,17 @@
 visibility="public"
>
</field>
<field name="Theme_Holo_Light_DialogWhenLarge"
 type="int"
 transient="false"
 volatile="false"
 value="16973955"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="Theme_Holo_Light_Dialog_Alert"
 type="int"
 transient="false"
@@ -246551,7 +246573,7 @@
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="arg0" type="T">
<parameter name="t" type="T">
</parameter>
</method>
</interface>
+1 −1
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ interface IWindowManager
    void executeAppTransition();
    void setAppStartingWindow(IBinder token, String pkg, int theme,
            CharSequence nonLocalizedLabel, int labelRes,
            int icon, IBinder transferFrom, boolean createIfNeeded);
            int icon, int windowFlags, IBinder transferFrom, boolean createIfNeeded);
    void setAppWillBeHidden(IBinder token);
    void setAppVisibility(IBinder token, boolean visible);
    void startAppFreezingScreen(IBinder token, int configChanges);
+19 −0
Original line number Diff line number Diff line
@@ -1258,6 +1258,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
    static final int VIEW_STATE_ENABLED = 1 << 3;
    static final int VIEW_STATE_PRESSED = 1 << 4;
    static final int VIEW_STATE_ACTIVATED = 1 << 5;
    static final int VIEW_STATE_ACCELERATED = 1 << 6;

    static final int[] VIEW_STATE_IDS = new int[] {
        R.attr.state_window_focused,    VIEW_STATE_WINDOW_FOCUSED,
@@ -1266,9 +1267,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
        R.attr.state_enabled,           VIEW_STATE_ENABLED,
        R.attr.state_pressed,           VIEW_STATE_PRESSED,
        R.attr.state_activated,         VIEW_STATE_ACTIVATED,
        R.attr.state_accelerated,       VIEW_STATE_ACCELERATED,
    };

    static {
        if ((VIEW_STATE_IDS.length/2) != R.styleable.ViewDrawableStates.length) {
            throw new IllegalStateException(
                    "VIEW_STATE_IDs array length does not match ViewDrawableStates style array");
        }
        int[] orderedIds = new int[VIEW_STATE_IDS.length];
        for (int i = 0; i < R.styleable.ViewDrawableStates.length; i++) {
            int viewState = R.styleable.ViewDrawableStates[i];
@@ -7176,6 +7182,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
        //System.out.println("Attached! " + this);
        mAttachInfo = info;
        mWindowAttachCount++;
        // We will need to evaluate the drawable state at least once.
        mPrivateFlags |= DRAWABLE_STATE_DIRTY;
        if (mFloatingTreeObserver != null) {
            info.mTreeObserver.merge(mFloatingTreeObserver);
            mFloatingTreeObserver = null;
@@ -7190,6 +7198,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
        if (vis != GONE) {
            onWindowVisibilityChanged(vis);
        }
        if ((mPrivateFlags&DRAWABLE_STATE_DIRTY) != 0) {
            // If nobody has evaluated the drawable state yet, then do it now.
            refreshDrawableState();
        }
    }

    void dispatchDetachedFromWindow() {
@@ -8562,6 +8574,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
        if ((privateFlags & SELECTED) != 0) viewStateIndex |= VIEW_STATE_SELECTED;
        if (hasWindowFocus()) viewStateIndex |= VIEW_STATE_WINDOW_FOCUSED;
        if ((privateFlags & ACTIVATED) != 0) viewStateIndex |= VIEW_STATE_ACTIVATED;
        if (mAttachInfo != null && mAttachInfo.mHardwareAccelerationRequested) {
            // This is set if HW acceleration is requested, even if the current
            // process doesn't allow it.  This is just to allow app preview
            // windows to better match their app.
            viewStateIndex |= VIEW_STATE_ACCELERATED;
        }

        drawableState = VIEW_STATE_SETS[viewStateIndex];

@@ -10503,6 +10521,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
        Surface mSurface;

        boolean mHardwareAccelerated;
        boolean mHardwareAccelerationRequested;
        HardwareRenderer mHardwareRenderer;
        
        /**
+14 −8
Original line number Diff line number Diff line
@@ -467,19 +467,25 @@ public final class ViewRoot extends Handler implements ViewParent, View.AttachIn
    }

    private void enableHardwareAcceleration(WindowManager.LayoutParams attrs) {
        mAttachInfo.mHardwareAccelerated = false;
        mAttachInfo.mHardwareAccelerationRequested = false;
        
        // Try to enable hardware acceleration if requested
        if (attrs != null &&
                (attrs.flags & WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED) != 0) {
            // Only enable hardware acceleration if we are not in the system process
            // The window manager creates ViewRoots to display animated preview windows
            // of launching apps and we don't want those to be hardware accelerated
            if (!HardwareRenderer.sRendererDisabled) {
            // Try to enable hardware acceleration if requested
            if (attrs != null &&
                    (attrs.flags & WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED) != 0) {
                final boolean translucent = attrs.format != PixelFormat.OPAQUE;
                if (mAttachInfo.mHardwareRenderer != null) {
                    mAttachInfo.mHardwareRenderer.destroy(true);
                }                
                mAttachInfo.mHardwareRenderer = HardwareRenderer.createGlRenderer(2, translucent);
                mAttachInfo.mHardwareAccelerated = mAttachInfo.mHardwareRenderer != null;
                mAttachInfo.mHardwareAccelerated = mAttachInfo.mHardwareAccelerationRequested
                        = mAttachInfo.mHardwareRenderer != null;
            } else if (HardwareRenderer.isAvailable()) {
                mAttachInfo.mHardwareAccelerationRequested = true;
            }
        }
    }
+4 −0
Original line number Diff line number Diff line
@@ -428,6 +428,10 @@ public abstract class Window {
            mHardwareAccelerated = hardwareAccelerated;
        }

        public boolean isHardwareAccelerated() {
            return mHardwareAccelerated;
        }
        
        public final void addView(View view, ViewGroup.LayoutParams params) {
            // Let this throw an exception on a bad params.
            WindowManager.LayoutParams wp = (WindowManager.LayoutParams)params;
Loading