From d8b7d2ce2da68cd1853dd1d734eae6fb9f6323d4 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 2 Jun 2015 13:27:28 -0700 Subject: [PATCH] Fix TabHost stealing focus on hardware keyboard keypress Don't try to change focus at all on exit from touch mode. The old behavior might have been useful for very old apps with a TabHost as their primary UI, but that's not a modern app structure. Bug: 21417491 Change-Id: I3db2ab42c90b6c82f23216244a8183c4290eb7d7 --- core/java/android/widget/TabHost.java | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/core/java/android/widget/TabHost.java b/core/java/android/widget/TabHost.java index c521f72d7ad09..27fa3b91dfe83 100644 --- a/core/java/android/widget/TabHost.java +++ b/core/java/android/widget/TabHost.java @@ -188,32 +188,9 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1"); mLocalActivityManager = activityGroup; } - @Override - protected void onAttachedToWindow() { - super.onAttachedToWindow(); - final ViewTreeObserver treeObserver = getViewTreeObserver(); - treeObserver.addOnTouchModeChangeListener(this); - } - - @Override - protected void onDetachedFromWindow() { - super.onDetachedFromWindow(); - final ViewTreeObserver treeObserver = getViewTreeObserver(); - treeObserver.removeOnTouchModeChangeListener(this); - } - - /** - * {@inheritDoc} - */ public void onTouchModeChanged(boolean isInTouchMode) { - if (!isInTouchMode) { - // leaving touch mode.. if nothing has focus, let's give it to - // the indicator of the current tab - if (mCurrentView != null && (!mCurrentView.hasFocus() || mCurrentView.isFocused())) { - mTabWidget.getChildTabViewAt(mCurrentTab).requestFocus(); - } - } + // No longer used, but kept to maintain API compatibility. } /**