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

Commit 77d354ef authored by Tarandeep Singh's avatar Tarandeep Singh Committed by Android (Google) Code Review
Browse files

Merge "Allow MSIME to set inactive when window loses focus." into qt-dev

parents b225cffa e1921a7b
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -374,4 +374,15 @@ public final class MultiClientInputMethodServiceDelegate {
    public boolean isUidAllowedOnDisplay(int displayId, int uid) {
        return mImpl.isUidAllowedOnDisplay(displayId, uid);
    }

    /**
     * Can be called by MSIME to activate/deactivate a client when it is gaining/losing focus
     * respectively.
     *
     * @param clientId client ID to activate/deactivate.
     * @param active {@code true} to activate a client.
     */
    public void setActive(int clientId, boolean active) {
        mImpl.setActive(clientId, active);
    }
}
+4 −0
Original line number Diff line number Diff line
@@ -190,4 +190,8 @@ final class MultiClientInputMethodServiceDelegateImpl {
    boolean isUidAllowedOnDisplay(int displayId, int uid) {
        return mPrivOps.isUidAllowedOnDisplay(displayId, uid);
    }

    void setActive(int clientId, boolean active) {
        mPrivOps.setActive(clientId, active);
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -31,4 +31,5 @@ interface IMultiClientInputMethodPrivilegedOperations {
            in IMultiClientInputMethodSession multiClientSession, in InputChannel writeChannel);
    void reportImeWindowTarget(int clientId, int targetWindowHandle, in IBinder imeWindowToken);
    boolean isUidAllowedOnDisplay(int displayId, int uid);
    void setActive(int clientId, boolean active);
}
+17 −0
Original line number Diff line number Diff line
@@ -212,4 +212,21 @@ public class MultiClientInputMethodPrivilegedOperations {
        }
    }

    /**
     * Calls {@link IMultiClientInputMethodPrivilegedOperations#setActive(int, boolean)}.
     * @param clientId client ID to be set active/inactive
     * @param active {@code true} set set active.
     */
    @AnyThread
    public void setActive(int clientId, boolean active) {
        final IMultiClientInputMethodPrivilegedOperations ops = mOps.getAndWarnIfNull();
        if (ops == null) {
            return;
        }
        try {
            ops.setActive(clientId, active);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }
}
+18 −0
Original line number Diff line number Diff line
@@ -1228,6 +1228,24 @@ public final class MultiClientInputMethodManagerService {
        public boolean isUidAllowedOnDisplay(int displayId, int uid) {
            return mIWindowManagerInternal.isUidAllowedOnDisplay(displayId, uid);
        }

        @BinderThread
        @Override
        public void setActive(int clientId, boolean active) {
            synchronized (mPerUserData.mLock) {
                final InputMethodClientInfo clientInfo =
                        mPerUserData.getClientFromIdLocked(clientId);
                if (clientInfo == null) {
                    Slog.e(TAG, "Unknown clientId=" + clientId);
                    return;
                }
                try {
                    clientInfo.mClient.setActive(active, false /* fullscreen */);
                } catch (RemoteException e) {
                    return;
                }
            }
        }
    }

    /**