Logically revert "Directly show the layout selection screen."

This is logical revert of a CL [1] that was recently re-introduced as
part of my recent CL [2].

Reason for revert:
Directly showing the layout selection screen when there is no hardware
keyboard is selected yet is not something people had been familiar
with.

That behavior had been enabled only in a short period during Android N
development cycle and was never enabled in most of production builds.
To avoid confusions, let's revert back to the true Android M behavior
by logically reverting that change.

 [1]: I4483dfc89afc8d148b2cfa7c6a5f66d2a02f712a
      17b631988451613393c4656900c1821e23d8434a
 [2]: I7a2ed6dd39dcd8207d3d94e12cd01d5d67ba4bb5
      7129b374bb57e39ac94ffd5b27dc3acc79fb1fb9

Change-Id: If0529e20cbff432d38d9b2dd74eeb3af0da5baf1
Bug: 66498367
Fix: 75318417
Test: Manually verified
diff --git a/src/com/android/settings/inputmethod/KeyboardLayoutDialogFragment.java b/src/com/android/settings/inputmethod/KeyboardLayoutDialogFragment.java
index 3a62d0e..e100dd2 100644
--- a/src/com/android/settings/inputmethod/KeyboardLayoutDialogFragment.java
+++ b/src/com/android/settings/inputmethod/KeyboardLayoutDialogFragment.java
@@ -55,7 +55,6 @@
     private int mInputDeviceId = -1;
     private InputManager mIm;
     private KeyboardLayoutAdapter mAdapter;
-    private boolean mHasShownLayoutSelectionScreen;
 
     public KeyboardLayoutDialogFragment() {
     }
@@ -187,7 +186,6 @@
             dialog.getListView().setItemChecked(data.current, true);
         }
         updateSwitchHintVisibility();
-        showSetupKeyboardLayoutsIfNecessary();
     }
 
     @Override
@@ -222,17 +220,6 @@
         }
     }
 
-    private void showSetupKeyboardLayoutsIfNecessary() {
-        AlertDialog dialog = (AlertDialog)getDialog();
-        if (dialog != null
-                && mAdapter.getCount() == 1 && mAdapter.getItem(0) == null
-                && !mHasShownLayoutSelectionScreen) {
-            mHasShownLayoutSelectionScreen = true;
-            ((OnSetupKeyboardLayoutsListener)getTargetFragment()).onSetupKeyboardLayouts(
-                    mInputDeviceIdentifier);
-        }
-    }
-
     private static final class KeyboardLayoutAdapter extends ArrayAdapter<KeyboardLayout> {
         private final LayoutInflater mInflater;
         private int mCheckedItem = -1;
diff --git a/src/com/android/settings/inputmethod/PhysicalKeyboardFragment.java b/src/com/android/settings/inputmethod/PhysicalKeyboardFragment.java
index a02a6d0..36f4e92 100644
--- a/src/com/android/settings/inputmethod/PhysicalKeyboardFragment.java
+++ b/src/com/android/settings/inputmethod/PhysicalKeyboardFragment.java
@@ -187,13 +187,10 @@
     }
 
     private void showKeyboardLayoutDialog(InputDeviceIdentifier inputDeviceIdentifier) {
-        KeyboardLayoutDialogFragment fragment = (KeyboardLayoutDialogFragment)
-                getFragmentManager().findFragmentByTag("keyboardLayout");
-        if (fragment == null) {
-            fragment = new KeyboardLayoutDialogFragment(inputDeviceIdentifier);
-            fragment.setTargetFragment(this, 0);
-            fragment.show(getActivity().getFragmentManager(), "keyboardLayout");
-        }
+        KeyboardLayoutDialogFragment fragment = new KeyboardLayoutDialogFragment(
+                inputDeviceIdentifier);
+        fragment.setTargetFragment(this, 0);
+        fragment.show(getActivity().getFragmentManager(), "keyboardLayout");
     }
 
     private void registerShowVirtualKeyboardSettingsObserver() {