| Index: remoting/android/java/src/org/chromium/chromoting/Desktop.java
|
| diff --git a/remoting/android/java/src/org/chromium/chromoting/Desktop.java b/remoting/android/java/src/org/chromium/chromoting/Desktop.java
|
| index c115749677ffb9dab8db7ecd28567fc8e5b79200..e2070d62c9112b7788efe197a2595de81adcc082 100644
|
| --- a/remoting/android/java/src/org/chromium/chromoting/Desktop.java
|
| +++ b/remoting/android/java/src/org/chromium/chromoting/Desktop.java
|
| @@ -5,6 +5,7 @@
|
| package org.chromium.chromoting;
|
|
|
| import android.annotation.SuppressLint;
|
| +import android.content.res.Configuration;
|
| import android.os.Build;
|
| import android.os.Bundle;
|
| import android.os.Handler;
|
| @@ -23,6 +24,7 @@ import android.view.inputmethod.InputMethodManager;
|
| import org.chromium.chromoting.help.HelpContext;
|
| import org.chromium.chromoting.help.HelpSingleton;
|
| import org.chromium.chromoting.jni.Client;
|
| +import org.chromium.ui.UiUtils;
|
|
|
| import java.util.List;
|
|
|
| @@ -78,6 +80,14 @@ public class Desktop
|
|
|
| private DesktopView mRemoteHostDesktop;
|
|
|
| + /**
|
| + * Indicates whether the device is connected to a non-hidden physical qwerty keyboard. This is
|
| + * set by {@link Desktop#setKeyboardState(Configuration)}. DO NOT request a soft keyboard when a
|
| + * physical keyboard exists, otherwise the activity will enter an undefined state where the soft
|
| + * keyboard never shows up meanwhile request to hide status bar always fails.
|
| + */
|
| + private boolean mHasPhysicalKeyboard;
|
| +
|
| /** Called when the activity is first created. */
|
| @Override
|
| public void onCreate(Bundle savedInstanceState) {
|
| @@ -222,9 +232,24 @@ public class Desktop
|
| // Wait to set the input mode until after the default tinting has been applied.
|
| setInputMode(mInputMode);
|
|
|
| + // Keyboard state must be set after the keyboard icon has been added to the menu.
|
| + setKeyboardState(getResources().getConfiguration());
|
| +
|
| return super.onCreateOptionsMenu(menu);
|
| }
|
|
|
| + @Override
|
| + public void onConfigurationChanged(Configuration config) {
|
| + super.onConfigurationChanged(config);
|
| + setKeyboardState(config);
|
| + }
|
| +
|
| + private void setKeyboardState(Configuration configuration) {
|
| + mHasPhysicalKeyboard = (configuration.keyboard == Configuration.KEYBOARD_QWERTY)
|
| + && (configuration.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO);
|
| + mToolbar.getMenu().findItem(R.id.actionbar_keyboard).setVisible(!mHasPhysicalKeyboard);
|
| + }
|
| +
|
| public Event<SystemUiVisibilityChangedEventParameter> onSystemUiVisibilityChanged() {
|
| return mOnSystemUiVisibilityChanged;
|
| }
|
| @@ -384,6 +409,15 @@ public class Desktop
|
| return flags;
|
| }
|
|
|
| + /**
|
| + * Shows the soft keyboard if no physical keyboard is attached.
|
| + */
|
| + public void showKeyboard() {
|
| + if (!mHasPhysicalKeyboard) {
|
| + UiUtils.showKeyboard(mRemoteHostDesktop);
|
| + }
|
| + }
|
| +
|
| public void showSystemUi() {
|
| // Request exit from any fullscreen mode. The action-bar controls will be shown in response
|
| // to the SystemUiVisibility notification. The visibility of the action-bar should be tied
|
|
|