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

Commit faf083ef authored by Joe Onorato's avatar Joe Onorato Committed by Android Git Automerger
Browse files

am 4c541b13: Merge "visibility ("lights out") API." into honeycomb

* commit '4c541b13':
  visibility ("lights out") API.
parents b4ae633d 4c541b13
Loading
Loading
Loading
Loading
+95 −0
Original line number Diff line number Diff line
@@ -216239,6 +216239,19 @@
<parameter name="selected" type="boolean">
</parameter>
</method>
<method name="dispatchSystemUiVisibilityChanged"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="visibility" type="int">
</parameter>
</method>
<method name="dispatchTouchEvent"
 return="boolean"
 abstract="false"
@@ -217292,6 +217305,19 @@
 visibility="protected"
>
</method>
<method name="getSystemUiVisibility"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="visibility" type="int">
</parameter>
</method>
<method name="getTag"
 return="java.lang.Object"
 abstract="false"
@@ -219542,6 +219568,19 @@
<parameter name="l" type="android.view.View.OnLongClickListener">
</parameter>
</method>
<method name="setOnSystemUiVisibilityChangeListener"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="l" type="android.view.View.OnSystemUiVisibilityChangeListener">
</parameter>
</method>
<method name="setOnTouchListener"
 return="void"
 abstract="false"
@@ -219795,6 +219834,19 @@
<parameter name="soundEffectsEnabled" type="boolean">
</parameter>
</method>
<method name="setSystemUiVisibility"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="visibility" type="int">
</parameter>
</method>
<method name="setTag"
 return="void"
 abstract="false"
@@ -220802,6 +220854,28 @@
 visibility="public"
>
</field>
<field name="STATUS_BAR_HIDDEN"
 type="int"
 transient="false"
 volatile="false"
 value="1"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="STATUS_BAR_VISIBLE"
 type="int"
 transient="false"
 volatile="false"
 value="0"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="VIEW_LOG_TAG"
 type="java.lang.String"
 transient="false"
@@ -221220,6 +221294,27 @@
</parameter>
</method>
</interface>
<interface name="View.OnSystemUiVisibilityChangeListener"
 abstract="true"
 static="true"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<method name="onSystemUiVisibilityChange"
 return="void"
 abstract="true"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="visibility" type="int">
</parameter>
</method>
</interface>
<interface name="View.OnTouchListener"
 abstract="true"
 static="true"
+5 −0
Original line number Diff line number Diff line
@@ -70,4 +70,9 @@ oneway interface IWindow {
     * Drag/drop events
     */
     void dispatchDragEvent(in DragEvent event);

    /**
     * System chrome visibility changes
     */
     void dispatchSystemUiVisibilityChanged(int visibility);
}
+5 −0
Original line number Diff line number Diff line
@@ -187,4 +187,9 @@ interface IWindowManager
	 * Create a screenshot of the applications currently displayed.
	 */
	Bitmap screenshotApplications(IBinder appToken, int maxWidth, int maxHeight);

    /**
     * Called by the status bar to notify Views of changes to System UI visiblity.
     */
    void statusBarVisibilityChanged(int visibility);
}
+96 −7
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ import android.os.Message;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.util.AttributeSet;
@@ -1696,6 +1697,20 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
     */
    public static final int OVER_SCROLL_NEVER = 2;

    /**
     * View has requested the status bar to be visible (the default).
     *
     * @see setSystemUiVisibility
     */
    public static final int STATUS_BAR_VISIBLE = 0;

    /**
     * View has requested the status bar to be visible (the default).
     *
     * @see setSystemUiVisibility
     */
    public static final int STATUS_BAR_HIDDEN = 0x00000001;

    /**
     * Controls the over-scroll mode for this view.
     * See {@link #overScrollBy(int, int, int, int, int, int, int, int, boolean)},
@@ -1734,6 +1749,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
    })
    int mPrivateFlags;

    /**
     * This view's request for the visibility of the status bar.
     * @hide
     */
    int mSystemUiVisibility;

    /**
     * Count of how many windows this view has been attached to.
     */
@@ -2037,6 +2058,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility

    private OnDragListener mOnDragListener;

    private OnSystemUiVisibilityChangeListener mOnSystemUiVisibilityChangeListener;

    /**
     * The application environment this view lives in.
     * This field should be made private, so it is hidden from the SDK.
@@ -4706,17 +4729,22 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
    }

    void performCollectViewAttributes(int visibility) {
        //noinspection PointlessBitwiseExpression
        if (((visibility | mViewFlags) & (VISIBILITY_MASK | KEEP_SCREEN_ON))
                == (VISIBLE | KEEP_SCREEN_ON)) {
        if ((visibility & VISIBILITY_MASK) == VISIBLE) {
            if ((mViewFlags & KEEP_SCREEN_ON) == KEEP_SCREEN_ON) {
                mAttachInfo.mKeepScreenOn = true;
            }
            mAttachInfo.mSystemUiVisibility |= mSystemUiVisibility;
            if (mOnSystemUiVisibilityChangeListener != null) {
                mAttachInfo.mHasSystemUiListeners = true;
            }
        }
    }

    void needGlobalAttributesUpdate(boolean force) {
        AttachInfo ai = mAttachInfo;
        final AttachInfo ai = mAttachInfo;
        if (ai != null) {
            if (ai.mKeepScreenOn || force) {
            if (force || ai.mKeepScreenOn || (ai.mSystemUiVisibility != 0)
                    || ai.mHasSystemUiListeners) {
                ai.mRecomputeGlobalAttributes = true;
            }
        }
@@ -5301,7 +5329,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
        }

        if ((changed & KEEP_SCREEN_ON) != 0) {
            if (mParent != null) {
            if (mParent != null && mAttachInfo != null && !mAttachInfo.mRecomputeGlobalAttributes) {
                mParent.recomputeViewAttributes(this);
            }
        }
@@ -10617,6 +10645,40 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
                (flags & HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING) != 0);
    }

    /**
     * Request that the visibility of the status bar be changed.
     */
    public void setSystemUiVisibility(int visibility) {
        if (visibility != mSystemUiVisibility) {
            mSystemUiVisibility = visibility;
            if (mParent != null && mAttachInfo != null && !mAttachInfo.mRecomputeGlobalAttributes) {
                mParent.recomputeViewAttributes(this);
            }
        }
    }

    /**
     * Returns the status bar visibility that this view has requested.
     */
    public int getSystemUiVisibility(int visibility) {
        return mSystemUiVisibility;
    }

    public void setOnSystemUiVisibilityChangeListener(OnSystemUiVisibilityChangeListener l) {
        mOnSystemUiVisibilityChangeListener = l;
        if (mParent != null && mAttachInfo != null && !mAttachInfo.mRecomputeGlobalAttributes) {
            mParent.recomputeViewAttributes(this);
        }
    }

    /**
     */
    public void dispatchSystemUiVisibilityChanged(int visibility) {
        if (mOnSystemUiVisibilityChangeListener != null) {
            mOnSystemUiVisibilityChangeListener.onSystemUiVisibilityChange(visibility);
        }
    }

    /**
     * !!! TODO: real docs
     *
@@ -11307,6 +11369,22 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
        void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo);
    }

    /**
     * Interface definition for a callback to be invoked when the status bar changes
     * visibility.
     *
     * @see #setOnSystemUiVisibilityChangeListener
     */
    public interface OnSystemUiVisibilityChangeListener {
        /**
         * Called when the status bar changes visibility because of a call to
         * {@link #setSystemUiVisibility}.
         *
         * @param visibility {@link #STATUS_BAR_VISIBLE} or {@link #STATUS_BAR_HIDDEN}.
         */
        public void onSystemUiVisibilityChange(int visibility);
    }

    private final class UnsetPressedState implements Runnable {
        public void run() {
            setPressed(false);
@@ -11524,6 +11602,17 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
         */
        boolean mKeepScreenOn;

        /**
         * Bitwise-or of all of the values that views have passed to setSystemUiVisibility().
         */
        int mSystemUiVisibility;

        /**
         * True if a view in this hierarchy has an OnSystemUiVisibilityChangeListener
         * attached.
         */
        boolean mHasSystemUiListeners;

        /**
         * Set if the visibility of any views has changed.
         */
+16 −2
Original line number Diff line number Diff line
@@ -860,9 +860,11 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
     * {@inheritDoc}
     */
    public void recomputeViewAttributes(View child) {
        if (mAttachInfo != null && !mAttachInfo.mRecomputeGlobalAttributes) {
            ViewParent parent = mParent;
            if (parent != null) parent.recomputeViewAttributes(this);
        }
    }

    @Override
    void dispatchCollectViewAttributes(int visibility) {
@@ -1070,6 +1072,18 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        return child.mCanAcceptDrop;
    }

    @Override
    public void dispatchSystemUiVisibilityChanged(int visible) {
        super.dispatchSystemUiVisibilityChanged(visible);

        final int count = mChildrenCount;
        final View[] children = mChildren;
        for (int i=0; i <count; i++) {
            final View child = children[i];
            child.dispatchSystemUiVisibilityChanged(visible);
        }
    }

    /**
     * {@inheritDoc}
     */
Loading