Allow independent control of the back and the other navigation buttons.
Bug: 3363046
Change-Id: Icc312fc9ffbf2f584dc541489c9769b07ed50315
diff --git a/core/java/android/app/StatusBarManager.java b/core/java/android/app/StatusBarManager.java
index 46b52e1..1af0983 100644
--- a/core/java/android/app/StatusBarManager.java
+++ b/core/java/android/app/StatusBarManager.java
@@ -41,13 +41,14 @@
= 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;
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 75791d5..fc0039e 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -1793,6 +1793,8 @@
*
* 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;
@@ -1802,10 +1804,22 @@
* 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 = 0x00400000;
+ public static final int STATUS_BAR_DISABLE_CLOCK = 0x00800000;
+
/**
* @hide
diff --git a/packages/SystemUI/res/layout-xlarge/status_bar.xml b/packages/SystemUI/res/layout-xlarge/status_bar.xml
index f355e17..6c173c9 100644
--- a/packages/SystemUI/res/layout-xlarge/status_bar.xml
+++ b/packages/SystemUI/res/layout-xlarge/status_bar.xml
@@ -44,20 +44,20 @@
/>
<!-- navigation controls -->
+ <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_alignParentLeft="true"
+ android:layout_toRightOf="@+id/back"
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"
- systemui:keyCode="4"
- />
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/home"
android:layout_width="80dip"
android:layout_height="match_parent"
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
index dc23149..fd04418 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
@@ -370,8 +370,8 @@
(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 @@
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) {