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

Commit d0842b2e authored by Yohei Yukawa's avatar Yohei Yukawa Committed by Android (Google) Code Review
Browse files

Merge "Add IMMS#getCurrentImeUserId() to reduce inter-class dependencies" into main

parents a4ee0ad0 5d3f629a
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@ final class AutofillSuggestionsController {
    private static final String TAG = AutofillSuggestionsController.class.getSimpleName();

    @NonNull private final InputMethodManagerService mService;
    @NonNull private final InputMethodUtils.InputMethodSettings mSettings;

    private static final class CreateInlineSuggestionsRequest {
        @NonNull final InlineSuggestionsRequestInfo mRequestInfo;
@@ -76,7 +75,6 @@ final class AutofillSuggestionsController {

    AutofillSuggestionsController(@NonNull InputMethodManagerService service) {
        mService = service;
        mSettings = mService.mSettings;
    }

    @GuardedBy("ImfLock.class")
@@ -88,7 +86,7 @@ final class AutofillSuggestionsController {
        final InputMethodInfo imi = mService.queryInputMethodForCurrentUserLocked(
                mService.getSelectedMethodIdLocked());
        try {
            if (userId == mSettings.getCurrentUserId()
            if (userId == mService.getCurrentImeUserIdLocked()
                    && imi != null && isInlineSuggestionsEnabled(imi, touchExplorationEnabled)) {
                mPendingInlineSuggestionsRequest = new CreateInlineSuggestionsRequest(
                        requestInfo, callback, imi.getPackageName());
+2 −4
Original line number Diff line number Diff line
@@ -63,7 +63,6 @@ final class InputMethodBindingController {

    @NonNull private final InputMethodManagerService mService;
    @NonNull private final Context mContext;
    @NonNull private final InputMethodUtils.InputMethodSettings mSettings;
    @NonNull private final PackageManagerInternal mPackageManagerInternal;
    @NonNull private final WindowManagerInternal mWindowManagerInternal;

@@ -113,7 +112,6 @@ final class InputMethodBindingController {
            int imeConnectionBindFlags, CountDownLatch latchForTesting) {
        mService = service;
        mContext = mService.mContext;
        mSettings = mService.mSettings;
        mPackageManagerInternal = mService.mPackageManagerInternal;
        mWindowManagerInternal = mService.mWindowManagerInternal;
        mImeConnectionBindFlags = imeConnectionBindFlags;
@@ -322,7 +320,7 @@ final class InputMethodBindingController {
        private void updateCurrentMethodUid() {
            final String curMethodPackage = mCurIntent.getComponent().getPackageName();
            final int curMethodUid = mPackageManagerInternal.getPackageUid(
                    curMethodPackage, 0 /* flags */, mSettings.getCurrentUserId());
                    curMethodPackage, 0 /* flags */, mService.getCurrentImeUserIdLocked());
            if (curMethodUid < 0) {
                Slog.e(TAG, "Failed to get UID for package=" + curMethodPackage);
                mCurMethodUid = Process.INVALID_UID;
@@ -478,7 +476,7 @@ final class InputMethodBindingController {
            return false;
        }
        return mContext.bindServiceAsUser(mCurIntent, conn, flags,
                new UserHandle(mSettings.getCurrentUserId()));
                new UserHandle(mService.getCurrentImeUserIdLocked()));
    }

    @GuardedBy("ImfLock.class")
+6 −0
Original line number Diff line number Diff line
@@ -1728,6 +1728,12 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
        registerDeviceListenerAndCheckStylusSupport();
    }

    @GuardedBy("ImfLock.class")
    @UserIdInt
    int getCurrentImeUserIdLocked() {
        return mSettings.getCurrentUserId();
    }

    private final class InkWindowInitializer implements Runnable {
        public void run() {
            synchronized (ImfLock.class) {
+2 −1
Original line number Diff line number Diff line
@@ -79,7 +79,8 @@ final class InputMethodMenuController {

        synchronized (ImfLock.class) {
            final boolean isScreenLocked = mWindowManagerInternal.isKeyguardLocked()
                    && mWindowManagerInternal.isKeyguardSecure(mSettings.getCurrentUserId());
                    && mWindowManagerInternal.isKeyguardSecure(
                            mService.getCurrentImeUserIdLocked());
            final String lastInputMethodId = mSettings.getSelectedInputMethod();
            int lastInputMethodSubtypeId =
                    mSettings.getSelectedInputMethodSubtypeId(lastInputMethodId);