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

Commit da2d47b1 authored by Aaron Echols's avatar Aaron Echols Committed by Steve Kondik
Browse files

framework: port IME selector notification toggle (2/2)

Change-Id: Ia35960d88468dba44cdfad26c7cc74f811a6844f

framework: fix 'port IME selector notification toggle'

Change-Id: I7801cc9edc2341c447e2c3eafd9344216eb6c0c6
parent 18759430
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -2765,6 +2765,12 @@ public final class Settings {
         */
         */
        public static final int SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1;
        public static final int SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1;


        /**
         * Whether to show the IME switcher in the status bar
         * @hide
         */
        public static final String STATUS_BAR_IME_SWITCHER = "status_bar_ime_switcher";

        /**
        /**
         * The keyboard brightness to be used while the screen is on.
         * The keyboard brightness to be used while the screen is on.
         * Valid value range is between 0 and {@link PowerManager#getMaximumKeyboardBrightness()}
         * Valid value range is between 0 and {@link PowerManager#getMaximumKeyboardBrightness()}
+3 −0
Original line number Original line Diff line number Diff line
@@ -2751,4 +2751,7 @@
         kill the foreground app. -->
         kill the foreground app. -->
    <integer name="config_backKillTimeout">2000</integer>
    <integer name="config_backKillTimeout">2000</integer>


    <!-- Setting to false will disable CM's IME switcher implementation for tablets -->
    <bool name="config_show_cmIMESwitcher">true</bool>

</resources>
</resources>
+3 −0
Original line number Original line Diff line number Diff line
@@ -2742,6 +2742,9 @@
  <!-- Gesture Sensor -->
  <!-- Gesture Sensor -->
  <java-symbol type="bool" name="config_enableGestureService" />
  <java-symbol type="bool" name="config_enableGestureService" />


  <!-- Config.xml entries -->
  <java-symbol type="bool" name="config_show_cmIMESwitcher"/>

  <!-- Developer settings - Kill app back press -->
  <!-- Developer settings - Kill app back press -->
  <java-symbol type="string" name="app_killed_message" />
  <java-symbol type="string" name="app_killed_message" />


+17 −2
Original line number Original line Diff line number Diff line
@@ -92,6 +92,7 @@ import android.os.SystemClock;
import android.os.UserHandle;
import android.os.UserHandle;
import android.os.UserManager;
import android.os.UserManager;
import android.provider.Settings;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.text.TextUtils;
import android.text.TextUtils;
import android.text.style.SuggestionSpan;
import android.text.style.SuggestionSpan;
import android.util.ArrayMap;
import android.util.ArrayMap;
@@ -511,6 +512,14 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
                    Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD), false, this, userId);
                    Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD), false, this, userId);
            resolver.registerContentObserver(Settings.Secure.getUriFor(
            resolver.registerContentObserver(Settings.Secure.getUriFor(
                    Settings.Secure.ACCESSIBILITY_SOFT_KEYBOARD_MODE), false, this, userId);
                    Settings.Secure.ACCESSIBILITY_SOFT_KEYBOARD_MODE), false, this, userId);
            resolver.registerContentObserver(Settings.System.getUriFor(
                    Settings.System.STATUS_BAR_IME_SWITCHER),
                    false, new ContentObserver(mHandler) {
                        public void onChange(boolean selfChange) {
                            updateFromSettingsLocked(true);
                        }
                    }, userId);

            mRegistered = true;
            mRegistered = true;
        }
        }


@@ -1086,8 +1095,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
                    mStatusBar.setIconVisibility(mSlotIme, false);
                    mStatusBar.setIconVisibility(mSlotIme, false);
                }
                }
                updateSystemUiLocked(mCurToken, mImeWindowVis, mBackDisposition);
                updateSystemUiLocked(mCurToken, mImeWindowVis, mBackDisposition);
                mShowOngoingImeSwitcherForPhones = mRes.getBoolean(
                        com.android.internal.R.bool.show_ongoing_ime_switcher);
                if (mShowOngoingImeSwitcherForPhones) {
                if (mShowOngoingImeSwitcherForPhones) {
                    mWindowManagerInternal.setOnHardKeyboardStatusChangeListener(
                    mWindowManagerInternal.setOnHardKeyboardStatusChangeListener(
                            mHardKeyboardListener);
                            mHardKeyboardListener);
@@ -1964,6 +1971,14 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
            // There is no longer an input method set, so stop any current one.
            // There is no longer an input method set, so stop any current one.
            resetCurrentMethodAndClient(InputMethodClient.UNBIND_REASON_NO_IME);
            resetCurrentMethodAndClient(InputMethodClient.UNBIND_REASON_NO_IME);
        }
        }
        // code to disable the CM Phone IME switcher with config_show_cmIMESwitcher set = false
        try {
            mShowOngoingImeSwitcherForPhones = Settings.System.getInt(mContext.getContentResolver(),
            Settings.System.STATUS_BAR_IME_SWITCHER) == 1;
        } catch (SettingNotFoundException e) {
            mShowOngoingImeSwitcherForPhones = mRes.getBoolean(
            com.android.internal.R.bool.config_show_cmIMESwitcher);
        }
        // Here is not the perfect place to reset the switching controller. Ideally
        // Here is not the perfect place to reset the switching controller. Ideally
        // mSwitchingController and mSettings should be able to share the same state.
        // mSwitchingController and mSettings should be able to share the same state.
        // TODO: Make sure that mSwitchingController and mSettings are sharing the
        // TODO: Make sure that mSwitchingController and mSettings are sharing the