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

Commit cfd0bafd authored by Joe Onorato's avatar Joe Onorato Committed by Android (Google) Code Review
Browse files

Merge changes Iaa7bc042,Icc312fc9,I50ba06ed into honeycomb

* changes:
  Make keyguard also ask to turn the back button off, now that it is controlled separately.
  Allow independent control of the back and the other navigation buttons.
  Allow the status bar disable flags to be used as View's system ui visibility fields.
parents 94eb3d0f 4671ce56
Loading
Loading
Loading
Loading
+15 −42
Original line number Original line Diff line number Diff line
@@ -22,6 +22,7 @@ import android.os.Binder;
import android.os.RemoteException;
import android.os.RemoteException;
import android.os.IBinder;
import android.os.IBinder;
import android.os.ServiceManager;
import android.os.ServiceManager;
import android.view.View;


import com.android.internal.statusbar.IStatusBarService;
import com.android.internal.statusbar.IStatusBarService;


@@ -31,52 +32,24 @@ import com.android.internal.statusbar.IStatusBarService;
 * @hide
 * @hide
 */
 */
public class StatusBarManager {
public class StatusBarManager {
    /**
     * Flag for {@link #disable} to make the status bar not expandable.  Unless you also
     * set {@link #DISABLE_NOTIFICATION_ICONS}, new notifications will continue to show.
     */
    public static final int DISABLE_EXPAND = 0x00000001;

    /**
     * Flag for {@link #disable} to hide notification icons and scrolling ticker text.
     */
    public static final int DISABLE_NOTIFICATION_ICONS = 0x00000002;

    /**
     * Flag for {@link #disable} to disable incoming notification alerts.  This will not block
     * icons, but it will block sound, vibrating and other visual or aural notifications.
     */
    public static final int DISABLE_NOTIFICATION_ALERTS = 0x00000004;


    /**
    public static final int DISABLE_EXPAND = View.STATUS_BAR_DISABLE_EXPAND;
     * Flag for {@link #disable} to hide only the scrolling ticker.  Note that
    public static final int DISABLE_NOTIFICATION_ICONS = View.STATUS_BAR_DISABLE_NOTIFICATION_ICONS;
     * {@link #DISABLE_NOTIFICATION_ICONS} implies {@link #DISABLE_NOTIFICATION_TICKER}.
    public static final int DISABLE_NOTIFICATION_ALERTS
     */
            = View.STATUS_BAR_DISABLE_NOTIFICATION_ALERTS;
    public static final int DISABLE_NOTIFICATION_TICKER = 0x00000008;
    public static final int DISABLE_NOTIFICATION_TICKER
            = View.STATUS_BAR_DISABLE_NOTIFICATION_TICKER;
    public static final int DISABLE_SYSTEM_INFO = View.STATUS_BAR_DISABLE_SYSTEM_INFO;
    public static final int DISABLE_NAVIGATION = View.STATUS_BAR_DISABLE_NAVIGATION;
    public static final int DISABLE_BACK = View.STATUS_BAR_DISABLE_BACK;
    public static final int DISABLE_CLOCK = View.STATUS_BAR_DISABLE_CLOCK;


    /**
     * Flag for {@link #disable} to hide the center system info area.
     */
    public static final int DISABLE_SYSTEM_INFO = 0x00000010;

    /**
     * Flag for {@link #disable} to hide only the navigation buttons.  Don't use this
     * unless you're a special part of the system UI (i.e., setup wizard, keyguard).
     */
    public static final int DISABLE_NAVIGATION = 0x00000020;

    /**
     * Flag for {@link #disable} to hide only the clock.  You might use this if your activity has
     * its own clock making the status bar's clock redundant.
     */
    public static final int DISABLE_CLOCK = 0x00000040;


    /**
     * Re-enable all of the status bar features that you've disabled.
     */
    public static final int DISABLE_NONE = 0x00000000;
    public static final int DISABLE_NONE = 0x00000000;


    public static final int DISABLE_MASK = DISABLE_EXPAND | DISABLE_NOTIFICATION_ICONS
            | DISABLE_NOTIFICATION_ALERTS | DISABLE_NOTIFICATION_TICKER
            | DISABLE_SYSTEM_INFO| DISABLE_NAVIGATION | DISABLE_BACK | DISABLE_CLOCK;

    private Context mContext;
    private Context mContext;
    private IStatusBarService mService;
    private IStatusBarService mService;
    private IBinder mToken = new Binder();
    private IBinder mToken = new Binder();
+98 −1
Original line number Original line Diff line number Diff line
@@ -1731,6 +1731,102 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
     */
     */
    public static final int STATUS_BAR_HIDDEN = 0x00000001;
    public static final int STATUS_BAR_HIDDEN = 0x00000001;


    /**
     * @hide
     *
     * NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked
     * out of the public fields to keep the undefined bits out of the developer's way.
     *
     * Flag to make the status bar not expandable.  Unless you also
     * set {@link #STATUS_BAR_DISABLE_NOTIFICATION_ICONS}, new notifications will continue to show.
     */
    public static final int STATUS_BAR_DISABLE_EXPAND = 0x00010000;

    /**
     * @hide
     *
     * NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked
     * out of the public fields to keep the undefined bits out of the developer's way.
     *
     * Flag to hide notification icons and scrolling ticker text.
     */
    public static final int STATUS_BAR_DISABLE_NOTIFICATION_ICONS = 0x00020000;

    /**
     * @hide
     *
     * NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked
     * out of the public fields to keep the undefined bits out of the developer's way.
     *
     * Flag to disable incoming notification alerts.  This will not block
     * icons, but it will block sound, vibrating and other visual or aural notifications.
     */
    public static final int STATUS_BAR_DISABLE_NOTIFICATION_ALERTS = 0x00040000;

    /**
     * @hide
     *
     * NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked
     * out of the public fields to keep the undefined bits out of the developer's way.
     *
     * Flag to hide only the scrolling ticker.  Note that
     * {@link #STATUS_BAR_DISABLE_NOTIFICATION_ICONS} implies
     * {@link #STATUS_BAR_DISABLE_NOTIFICATION_TICKER}.
     */
    public static final int STATUS_BAR_DISABLE_NOTIFICATION_TICKER = 0x00080000;

    /**
     * @hide
     *
     * NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked
     * out of the public fields to keep the undefined bits out of the developer's way.
     *
     * Flag to hide the center system info area.
     */
    public static final int STATUS_BAR_DISABLE_SYSTEM_INFO = 0x00100000;

    /**
     * @hide
     *
     * NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked
     * out of the public fields to keep the undefined bits out of the developer's way.
     *
     * Flag to hide only the navigation buttons.  Don't use this
     * unless you're a special part of the system UI (i.e., setup wizard, keyguard).
     *
     * THIS DOES NOT DISABLE THE BACK BUTTON
     */
    public static final int STATUS_BAR_DISABLE_NAVIGATION = 0x00200000;

    /**
     * @hide
     *
     * NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked
     * out of the public fields to keep the undefined bits out of the developer's way.
     *
     * Flag to hide only the back button.  Don't use this
     * unless you're a special part of the system UI (i.e., setup wizard, keyguard).
     */
    public static final int STATUS_BAR_DISABLE_BACK = 0x00400000;

    /**
     * @hide
     *
     * NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked
     * out of the public fields to keep the undefined bits out of the developer's way.
     *
     * Flag to hide only the clock.  You might use this if your activity has
     * its own clock making the status bar's clock redundant.
     */
    public static final int STATUS_BAR_DISABLE_CLOCK = 0x00800000;


    /**
     * @hide
     */
    public static final int PUBLIC_STATUS_BAR_VISIBILITY_MASK = STATUS_BAR_HIDDEN;
    

    /**
    /**
     * Controls the over-scroll mode for this view.
     * Controls the over-scroll mode for this view.
     * See {@link #overScrollBy(int, int, int, int, int, int, int, int, boolean)},
     * See {@link #overScrollBy(int, int, int, int, int, int, int, int, boolean)},
@@ -10839,7 +10935,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
    public void dispatchSystemUiVisibilityChanged(int visibility) {
    public void dispatchSystemUiVisibilityChanged(int visibility) {
        mSystemUiVisibility = visibility;
        mSystemUiVisibility = visibility;
        if (mOnSystemUiVisibilityChangeListener != null) {
        if (mOnSystemUiVisibilityChangeListener != null) {
            mOnSystemUiVisibilityChangeListener.onSystemUiVisibilityChange(visibility);
            mOnSystemUiVisibilityChangeListener.onSystemUiVisibilityChange(
                    visibility & ~PUBLIC_STATUS_BAR_VISIBILITY_MASK);
        }
        }
    }
    }


+8 −8
Original line number Original line Diff line number Diff line
@@ -44,20 +44,20 @@
                />
                />


            <!-- navigation controls -->
            <!-- navigation controls -->
            <LinearLayout
                android:id="@+id/navigationArea"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_alignParentLeft="true"
                android:orientation="horizontal"
                >

            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/back"
            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/back"
                android:layout_width="80dip"
                android:layout_width="80dip"
                android:layout_height="match_parent"
                android:layout_height="match_parent"
                android:src="@drawable/ic_sysbar_back"
                android:src="@drawable/ic_sysbar_back"
                android:layout_alignParentLeft="true"
                systemui:keyCode="4"
                systemui:keyCode="4"
                />
                />
            <LinearLayout
                android:id="@+id/navigationArea"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_toRightOf="@+id/back"
                android:orientation="horizontal"
                >
                <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/home"
                <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/home"
                    android:layout_width="80dip"
                    android:layout_width="80dip"
                    android:layout_height="match_parent"
                    android:layout_height="match_parent"
+13 −1
Original line number Original line Diff line number Diff line
@@ -368,8 +368,8 @@ public class TabletStatusBar extends StatusBar implements
                (ImageView)sb.findViewById(R.id.network_type));
                (ImageView)sb.findViewById(R.id.network_type));


        // The navigation buttons
        // The navigation buttons
        mBackButton = (ImageView)sb.findViewById(R.id.back);
        mNavigationArea = sb.findViewById(R.id.navigationArea);
        mNavigationArea = sb.findViewById(R.id.navigationArea);
        mBackButton = (ImageView)mNavigationArea.findViewById(R.id.back);
        mHomeButton = mNavigationArea.findViewById(R.id.home);
        mHomeButton = mNavigationArea.findViewById(R.id.home);
        mMenuButton = mNavigationArea.findViewById(R.id.menu);
        mMenuButton = mNavigationArea.findViewById(R.id.menu);
        mRecentButton = mNavigationArea.findViewById(R.id.recent_apps);
        mRecentButton = mNavigationArea.findViewById(R.id.recent_apps);
@@ -793,6 +793,18 @@ public class TabletStatusBar extends StatusBar implements
                mInputMethodSwitchButton.setScreenLocked(false);
                mInputMethodSwitchButton.setScreenLocked(false);
            }
            }
        }
        }
        if ((diff & StatusBarManager.DISABLE_BACK) != 0) {
            if ((state & StatusBarManager.DISABLE_BACK) != 0) {
                Slog.i(TAG, "DISABLE_BACK: yes");
                mBackButton.setVisibility(View.INVISIBLE);
                mInputMethodSwitchButton.setScreenLocked(true);
            } else {
                Slog.i(TAG, "DISABLE_BACK: no");
                mBackButton.setVisibility(View.VISIBLE);
                mInputMethodSwitchButton.setScreenLocked(false);
            }
        }

    }
    }


    private boolean hasTicker(Notification n) {
    private boolean hasTicker(Notification n) {
+7 −0
Original line number Original line Diff line number Diff line
@@ -50,6 +50,8 @@ public abstract class KeyguardViewBase extends FrameLayout {
    public KeyguardViewBase(Context context) {
    public KeyguardViewBase(Context context) {
        super(context);
        super(context);


        setSystemUiVisibility(STATUS_BAR_DISABLE_BACK);

        // This is a faster way to draw the background on devices without hardware acceleration
        // This is a faster way to draw the background on devices without hardware acceleration
        setBackgroundDrawable(new Drawable() {
        setBackgroundDrawable(new Drawable() {
            @Override
            @Override
@@ -235,4 +237,9 @@ public abstract class KeyguardViewBase extends FrameLayout {
        return false;
        return false;
    }
    }


    @Override
    public void dispatchSystemUiVisibilityChanged(int visibility) {
        super.dispatchSystemUiVisibilityChanged(visibility);
        setSystemUiVisibility(STATUS_BAR_DISABLE_BACK);
    }
}
}
Loading