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

Commit 6f0977c3 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Clarify two-phase constructions on two IME-related controllers

This CL aims to clarify that the following controllers have relied on
two-phase construction, and their default states are just empty.

 * InputMethodSubtypeSwitchingController
 * HardwareKeyboardShortcutController

While this CL looks to be a behavior change, in reality these two
controllers have relied on subsequent update() calls to be fully
initialized for each user. Thus there must be no user observable
behavior change.

Bug: 305849394
Bug: 347693610
Test: presubmit
Flag: EXEMPT refactor
Change-Id: Ib3834fb7b9fcd87b5ca8cb4855a0aa7b9a524ecf
parent 30b5c960
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -33,8 +33,7 @@ final class HardwareKeyboardShortcutController {
    @GuardedBy("ImfLock.class")
    private final ArrayList<InputMethodSubtypeHandle> mSubtypeHandles = new ArrayList<>();

    HardwareKeyboardShortcutController(@NonNull InputMethodSettings settings) {
        update(settings);
    HardwareKeyboardShortcutController() {
    }

    @GuardedBy("ImfLock.class")
+1 −0
Original line number Diff line number Diff line
@@ -1293,6 +1293,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
            final var userData = getUserData(mCurrentUserId);
            userData.mSwitchingController.resetCircularListLocked(settings);
            userData.mHardwareKeyboardShortcutController.update(settings);

            mMenuController = new InputMethodMenuController(this);
            mVisibilityStateComputer = new ImeVisibilityStateComputer(this);
            mVisibilityApplier = new DefaultImeVisibilityApplier(this);
+2 −17
Original line number Diff line number Diff line
@@ -16,10 +16,8 @@

package com.android.server.inputmethod;

import android.annotation.AnyThread;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.UserIdInt;
import android.content.Context;
import android.os.UserHandle;
import android.text.TextUtils;
@@ -480,25 +478,12 @@ final class InputMethodSubtypeSwitchingController {

    @NonNull
    private final Context mContext;
    @UserIdInt
    private final int mUserId;
    @NonNull
    private ControllerImpl mController;

    InputMethodSubtypeSwitchingController(@NonNull Context context,
            @NonNull InputMethodSettings settings) {
    InputMethodSubtypeSwitchingController(@NonNull Context context) {
        mContext = context;
        mUserId = settings.getUserId();
        mController = ControllerImpl.createFrom(null,
                getSortedInputMethodAndSubtypeList(
                        false /* includeAuxiliarySubtypes */, false /* isScreenLocked */,
                        false /* forImeMenu */, context, settings));
    }

    @AnyThread
    @UserIdInt
    int getUserId() {
        return mUserId;
        mController = ControllerImpl.createFrom(null, Collections.emptyList());
    }

    public void onUserActionLocked(@NonNull InputMethodInfo imi,
+2 −5
Original line number Diff line number Diff line
@@ -108,11 +108,8 @@ final class UserDataRepository {
                @NonNull InputMethodBindingController bindingController, @NonNull Context context) {
            mUserId = userId;
            mBindingController = bindingController;
            final var emptySettings = InputMethodSettings.createEmptyMap(userId);
            mSwitchingController = new InputMethodSubtypeSwitchingController(context,
                    emptySettings);
            mHardwareKeyboardShortcutController = new HardwareKeyboardShortcutController(
                    emptySettings);
            mSwitchingController = new InputMethodSubtypeSwitchingController(context);
            mHardwareKeyboardShortcutController = new HardwareKeyboardShortcutController();
        }

        @Override