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

Commit cd7cd296 authored by satok's avatar satok
Browse files

Store the current IME's token in the system bar for changing the current IME...

Store the current IME's token in the system bar for changing the current IME to a shortcut IME from the system bar

Bug: 3212206
Bug: 3201828

- Added a shortcut IME button. This will be used for calling a shortcut IME (e.g. Voice input)
- Made the positions of IME buttons left aligned
- IME token is required to change IME because of the security reasons.

Change-Id: I48ba5e2509b3aa1bfd2394f9201427fa6b93c6d3
parent d1544d38
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -32,6 +32,6 @@ oneway interface IStatusBar
    void animateCollapse();
    void setLightsOn(boolean on);
    void setMenuKeyVisible(boolean visible);
    void setIMEButtonVisible(boolean visible);
    void setIMEButtonVisible(in IBinder token, boolean visible);
}
+2 −2
Original line number Diff line number Diff line
@@ -32,13 +32,13 @@ interface IStatusBarService
    void removeIcon(String slot);
    void setActiveWindowIsFullscreen(boolean fullscreen);
    void setMenuKeyVisible(boolean visible);
    void setIMEButtonVisible(boolean visible);
    void setIMEButtonVisible(in IBinder token, boolean visible);

    // ---- Methods below are for use by the status bar policy services ----
    // You need the STATUS_BAR_SERVICE permission
    void registerStatusBar(IStatusBar callbacks, out StatusBarIconList iconList,
            out List<IBinder> notificationKeys, out List<StatusBarNotification> notifications,
            out int[] switches);
            out int[] switches, out List<IBinder> binders);
    void onPanelRevealed();
    void onNotificationClick(String pkg, String tag, int id);
    void onNotificationError(String pkg, String tag, int id,
+10 −2
Original line number Diff line number Diff line
@@ -167,11 +167,19 @@
                    />
            </com.android.systemui.statusbar.tablet.ShirtPocket>
            <com.android.systemui.statusbar.tablet.InputMethodButton
                android:id="@+id/imeButton"
                android:id="@+id/imeSwitchButton"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_marginLeft="8dip"
                android:src="@drawable/ic_sysbar_ime"
                android:src="@drawable/ic_sysbar_ime_default"
                android:visibility="invisible"
                />
            <com.android.systemui.statusbar.tablet.InputMethodButton
                android:id="@+id/imeShortcutButton"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_marginLeft="8dip"
                android:src="@drawable/ic_sysbar_ime_default"
                android:visibility="invisible"
                />
        </LinearLayout>
+4 −4
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ public class CommandQueue extends IStatusBar.Stub {
        public void animateCollapse();
        public void setLightsOn(boolean on);
        public void setMenuKeyVisible(boolean visible);
        public void setIMEButtonVisible(boolean visible);
        public void setIMEButtonVisible(IBinder token, boolean visible);
    }

    public CommandQueue(Callbacks callbacks, StatusBarIconList list) {
@@ -165,10 +165,10 @@ public class CommandQueue extends IStatusBar.Stub {
        }
    }

    public void setIMEButtonVisible(boolean visible) {
    public void setIMEButtonVisible(IBinder token, boolean visible) {
        synchronized (mList) {
            mHandler.removeMessages(MSG_SHOW_IME_BUTTON);
            mHandler.obtainMessage(MSG_SHOW_IME_BUTTON, visible ? 1 : 0, 0, null).sendToTarget();
            mHandler.obtainMessage(MSG_SHOW_IME_BUTTON, visible ? 1 : 0, 0, token).sendToTarget();
        }
    }

@@ -233,7 +233,7 @@ public class CommandQueue extends IStatusBar.Stub {
                    mCallbacks.setMenuKeyVisible(msg.arg1 != 0);
                    break;
                case MSG_SHOW_IME_BUTTON:
                    mCallbacks.setIMEButtonVisible(msg.arg1 != 0);
                    mCallbacks.setIMEButtonVisible((IBinder)msg.obj, msg.arg1 != 0);
                    break;
            }
        }
+4 −2
Original line number Diff line number Diff line
@@ -65,9 +65,10 @@ public abstract class StatusBar extends SystemUI implements CommandQueue.Callbac
        mBarService = IStatusBarService.Stub.asInterface(
                ServiceManager.getService(Context.STATUS_BAR_SERVICE));
        int[] switches = new int[4];
        ArrayList<IBinder> binders = new ArrayList<IBinder>();
        try {
            mBarService.registerStatusBar(mCommandQueue, iconList, notificationKeys, notifications,
                    switches);
                    switches, binders);
        } catch (RemoteException ex) {
            // If the system process isn't there we're doomed anyway.
        }
@@ -75,7 +76,8 @@ public abstract class StatusBar extends SystemUI implements CommandQueue.Callbac
        disable(switches[0]);
        setLightsOn(switches[1] != 0);
        setMenuKeyVisible(switches[2] != 0);
        setIMEButtonVisible(switches[3] != 0);
        // StatusBarManagerService has a back up of IME token and it's restored here.
        setIMEButtonVisible(binders.get(0), switches[3] != 0);

        // Set up the initial icon state
        int N = iconList.size();
Loading