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

Commit 6478adc6 authored by Joe Onorato's avatar Joe Onorato
Browse files

Allow independent control of the back and the other navigation buttons.

Bug: 3363046
Change-Id: Icc312fc9ffbf2f584dc541489c9769b07ed50315
parent 7bb8eeb9
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -41,13 +41,14 @@ public class StatusBarManager {
            = 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;

    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_CLOCK;
            | DISABLE_SYSTEM_INFO| DISABLE_NAVIGATION | DISABLE_BACK | DISABLE_CLOCK;

    private Context mContext;
    private IStatusBarService mService;
+15 −1
Original line number Diff line number Diff line
@@ -1793,9 +1793,22 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
     *
     * 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
     *
@@ -1805,7 +1818,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
     * 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 = 0x00400000;
    public static final int STATUS_BAR_DISABLE_CLOCK = 0x00800000;


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

            <!-- 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"
                android:layout_width="80dip"
                android:layout_height="match_parent"
                android:src="@drawable/ic_sysbar_back"
                android:layout_alignParentLeft="true"
                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"
                    android:layout_width="80dip"
                    android:layout_height="match_parent"
+13 −1
Original line number Diff line number Diff line
@@ -370,8 +370,8 @@ public class TabletStatusBar extends StatusBar implements
                (ImageView)sb.findViewById(R.id.network_type));

        // The navigation buttons
        mBackButton = (ImageView)sb.findViewById(R.id.back);
        mNavigationArea = sb.findViewById(R.id.navigationArea);
        mBackButton = (ImageView)mNavigationArea.findViewById(R.id.back);
        mHomeButton = mNavigationArea.findViewById(R.id.home);
        mMenuButton = mNavigationArea.findViewById(R.id.menu);
        mRecentButton = mNavigationArea.findViewById(R.id.recent_apps);
@@ -789,6 +789,18 @@ public class TabletStatusBar extends StatusBar implements
                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) {