diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java index 8d0114d41a12f..794c06fec5ae4 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java @@ -1,16 +1,17 @@ /* + * Copyright (C) 2022 The Android Open Source Project * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package com.android.server.inputmethod; @@ -367,29 +368,29 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub Future mImeDrawsImeNavBarResLazyInitFuture; static class SessionState { - final ClientState client; - final IInputMethodInvoker method; + final ClientState mClient; + final IInputMethodInvoker mMethod; - IInputMethodSession session; - InputChannel channel; + IInputMethodSession mSession; + InputChannel mChannel; @Override public String toString() { - return "SessionState{uid " + client.uid + " pid " + client.pid + return "SessionState{uid " + mClient.mUid + " pid " + mClient.mPid + " method " + Integer.toHexString( - IInputMethodInvoker.getBinderIdentityHashCode(method)) + IInputMethodInvoker.getBinderIdentityHashCode(mMethod)) + " session " + Integer.toHexString( - System.identityHashCode(session)) - + " channel " + channel + System.identityHashCode(mSession)) + + " channel " + mChannel + "}"; } - SessionState(ClientState _client, IInputMethodInvoker _method, - IInputMethodSession _session, InputChannel _channel) { - client = _client; - method = _method; - session = _session; - channel = _channel; + SessionState(ClientState client, IInputMethodInvoker method, + IInputMethodSession session, InputChannel channel) { + mClient = client; + mMethod = method; + mSession = session; + mChannel = channel; } } @@ -405,7 +406,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub @Override public String toString() { - return "AccessibilitySessionState{uid " + mClient.uid + " pid " + mClient.pid + return "AccessibilitySessionState{uid " + mClient.mUid + " pid " + mClient.mPid + " id " + Integer.toHexString(mId) + " session " + Integer.toHexString( System.identityHashCode(mSession)) @@ -436,37 +437,37 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub } static final class ClientState { - final IInputMethodClientInvoker client; - final IRemoteInputConnection fallbackInputConnection; - final int uid; - final int pid; - final int selfReportedDisplayId; - final InputBinding binding; - final ClientDeathRecipient clientDeathRecipient; + final IInputMethodClientInvoker mClient; + final IRemoteInputConnection mFallbackInputConnection; + final int mUid; + final int mPid; + final int mSelfReportedDisplayId; + final InputBinding mBinding; + final ClientDeathRecipient mClientDeathRecipient; - boolean sessionRequested; + boolean mSessionRequested; boolean mSessionRequestedForAccessibility; - SessionState curSession; + SessionState mCurSession; SparseArray mAccessibilitySessions = new SparseArray<>(); @Override public String toString() { return "ClientState{" + Integer.toHexString( - System.identityHashCode(this)) + " uid=" + uid - + " pid=" + pid + " displayId=" + selfReportedDisplayId + "}"; + System.identityHashCode(this)) + " mUid=" + mUid + + " mPid=" + mPid + " mSelfReportedDisplayId=" + mSelfReportedDisplayId + "}"; } - ClientState(IInputMethodClientInvoker _client, - IRemoteInputConnection _fallbackInputConnection, - int _uid, int _pid, int _selfReportedDisplayId, - ClientDeathRecipient _clientDeathRecipient) { - client = _client; - fallbackInputConnection = _fallbackInputConnection; - uid = _uid; - pid = _pid; - selfReportedDisplayId = _selfReportedDisplayId; - binding = new InputBinding(null, fallbackInputConnection.asBinder(), uid, pid); - clientDeathRecipient = _clientDeathRecipient; + ClientState(IInputMethodClientInvoker client, + IRemoteInputConnection fallbackInputConnection, + int uid, int pid, int selfReportedDisplayId, + ClientDeathRecipient clientDeathRecipient) { + mClient = client; + mFallbackInputConnection = fallbackInputConnection; + mUid = uid; + mPid = pid; + mSelfReportedDisplayId = selfReportedDisplayId; + mBinding = new InputBinding(null, mFallbackInputConnection.asBinder(), mUid, mPid); + mClientDeathRecipient = clientDeathRecipient; } } @@ -764,7 +765,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub */ boolean mBoundToAccessibility; - /** + /** * Currently enabled session. */ @GuardedBy("ImfLock.class") @@ -1009,7 +1010,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub *

TODO: Consider to follow what other system services have been doing to manage * constants (e.g. {@link android.provider.Settings.Global#ACTIVITY_MANAGER_CONSTANTS}).

*/ - private final static int ENTRY_SIZE_FOR_HIGH_RAM_DEVICE = 32; + private static final int ENTRY_SIZE_FOR_HIGH_RAM_DEVICE = 32; /** * Entry size for non low-RAM devices. @@ -1017,7 +1018,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub *

TODO: Consider to follow what other system services have been doing to manage * constants (e.g. {@link android.provider.Settings.Global#ACTIVITY_MANAGER_CONSTANTS}).

*/ - private final static int ENTRY_SIZE_FOR_LOW_RAM_DEVICE = 5; + private static final int ENTRY_SIZE_FOR_LOW_RAM_DEVICE = 5; private static int getEntrySize() { if (ActivityManager.isLowRamDeviceStatic()) { @@ -1140,7 +1141,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub pw.print(prefix); pw.println(" softInputMode=" + InputMethodDebug.softInputModeToString( - entry.mTargetWindowSoftInputMode)); + entry.mTargetWindowSoftInputMode)); pw.print(prefix); pw.println(" inputType=0x" + Integer.toHexString(entry.mEditorInfo.inputType) @@ -1336,7 +1337,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub * rescanning.

*/ @GuardedBy("ImfLock.class") - final private ArraySet mKnownImePackageNames = new ArraySet<>(); + private final ArraySet mKnownImePackageNames = new ArraySet<>(); /** * Packages that are appeared, disappeared, or modified for whatever reason. @@ -1364,7 +1365,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub } @GuardedBy("ImfLock.class") - final void addKnownImePackageNameLocked(@NonNull String packageName) { + void addKnownImePackageNameLocked(@NonNull String packageName) { mKnownImePackageNames.add(packageName); } @@ -1387,9 +1388,9 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub return false; } String curInputMethodId = mSettings.getSelectedInputMethod(); - final int N = mMethodList.size(); + final int numImes = mMethodList.size(); if (curInputMethodId != null) { - for (int i=0; i accessibilityInputMethodSessions = createAccessibilityInputMethodSessions(mCurClient.mAccessibilitySessions); return new InputBindResult(InputBindResult.ResultCode.SUCCESS_WITH_IME_SESSION, - session.session, accessibilityInputMethodSessions, - (session.channel != null ? session.channel.dup() : null), + session.mSession, accessibilityInputMethodSessions, + (session.mChannel != null ? session.mChannel.dup() : null), curId, getSequenceNumberLocked(), mCurVirtualDisplayToScreenMatrix, suppressesSpellChecker); } @@ -2470,10 +2486,10 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub } else { matrix.postConcat(info.mMatrix); } - if (info.mParentClient.selfReportedDisplayId == imeDisplayId) { + if (info.mParentClient.mSelfReportedDisplayId == imeDisplayId) { return matrix; } - displayId = info.mParentClient.selfReportedDisplayId; + displayId = info.mParentClient.mSelfReportedDisplayId; } } @@ -2541,16 +2557,16 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub null, null, null, selectedMethodId, getSequenceNumberLocked(), null, false); } - if (!InputMethodUtils.checkIfPackageBelongsToUid(mAppOpsManager, cs.uid, + if (!InputMethodUtils.checkIfPackageBelongsToUid(mAppOpsManager, cs.mUid, editorInfo.packageName)) { Slog.e(TAG, "Rejecting this client as it reported an invalid package name." - + " uid=" + cs.uid + " package=" + editorInfo.packageName); + + " uid=" + cs.mUid + " package=" + editorInfo.packageName); return InputBindResult.INVALID_PACKAGE_NAME; } // Compute the final shown display ID with validated cs.selfReportedDisplayId for this // session & other conditions. - mDisplayIdToShowIme = computeImeDisplayIdForTarget(cs.selfReportedDisplayId, + mDisplayIdToShowIme = computeImeDisplayIdForTarget(cs.mSelfReportedDisplayId, mImeDisplayValidator); if (mDisplayIdToShowIme == INVALID_DISPLAY) { @@ -2572,7 +2588,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub mCurRemoteAccessibilityInputConnection = remoteAccessibilityInputConnection; mCurImeDispatcher = imeDispatcher; mCurVirtualDisplayToScreenMatrix = - getVirtualDisplayToScreenMatrixLocked(cs.selfReportedDisplayId, + getVirtualDisplayToScreenMatrixLocked(cs.mSelfReportedDisplayId, mDisplayIdToShowIme); mCurEditorInfo = editorInfo; @@ -2591,7 +2607,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub // We expect the caller has already verified that the client is allowed to access this // display ID. if (isSelectedMethodBoundLocked()) { - if (cs.curSession != null) { + if (cs.mCurSession != null) { // Fast case: if we are already connected to the input method, // then just return it. // This doesn't mean a11y sessions are there. When a11y service is @@ -2667,7 +2683,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub unbindCurrentClientLocked(UnbindReason.SWITCH_CLIENT); // If the screen is on, inform the new client it is active if (mIsInteractive) { - cs.client.setActive(true /* active */, false /* fullscreen */, + cs.mClient.setActive(true /* active */, false /* fullscreen */, false /* reportToImeController */); } } @@ -2779,13 +2795,13 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub && curMethod.asBinder() == method.asBinder()) { if (mCurClient != null) { clearClientSessionLocked(mCurClient); - mCurClient.curSession = new SessionState(mCurClient, + mCurClient.mCurSession = new SessionState(mCurClient, method, session, channel); InputBindResult res = attachNewInputLocked( StartInputReason.SESSION_CREATED_BY_IME, true); attachNewAccessibilityLocked(StartInputReason.SESSION_CREATED_BY_IME, true); if (res.method != null) { - mCurClient.client.onBindMethod(res); + mCurClient.mClient.onBindMethod(res); } return; } @@ -2828,7 +2844,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub @GuardedBy("ImfLock.class") void requestClientSessionLocked(ClientState cs) { - if (!cs.sessionRequested) { + if (!cs.mSessionRequested) { if (DEBUG) Slog.v(TAG, "Creating new session for client " + cs); final InputChannel serverChannel; final InputChannel clientChannel; @@ -2838,7 +2854,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub clientChannel = channels[1]; } - cs.sessionRequested = true; + cs.mSessionRequested = true; final IInputMethodInvoker curMethod = getCurMethodLocked(); final IInputMethodSessionCallback.Stub callback = @@ -2881,9 +2897,9 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub @GuardedBy("ImfLock.class") void clearClientSessionLocked(ClientState cs) { - finishSessionLocked(cs.curSession); - cs.curSession = null; - cs.sessionRequested = false; + finishSessionLocked(cs.mCurSession); + cs.mCurSession = null; + cs.mSessionRequested = false; } @GuardedBy("ImfLock.class") @@ -2907,18 +2923,18 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub @GuardedBy("ImfLock.class") private void finishSessionLocked(SessionState sessionState) { if (sessionState != null) { - if (sessionState.session != null) { + if (sessionState.mSession != null) { try { - sessionState.session.finishSession(); + sessionState.mSession.finishSession(); } catch (RemoteException e) { Slog.w(TAG, "Session failed to close due to remote exception", e); updateSystemUiLocked(0 /* vis */, mBackDisposition); } - sessionState.session = null; + sessionState.mSession = null; } - if (sessionState.channel != null) { - sessionState.channel.dispose(); - sessionState.channel = null; + if (sessionState.mChannel != null) { + sessionState.mChannel.dispose(); + sessionState.mChannel = null; } } } @@ -3017,7 +3033,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub InputMethodService.IME_ACTIVE | InputMethodService.IME_VISIBLE); return (canImeDrawsImeNavBar ? InputMethodNavButtonFlags.IME_DRAWS_IME_NAV_BAR : 0) | (shouldShowImeSwitcherWhenImeIsShown - ? InputMethodNavButtonFlags.SHOW_IME_SWITCHER_WHEN_IME_IS_SHOWN : 0); + ? InputMethodNavButtonFlags.SHOW_IME_SWITCHER_WHEN_IME_IS_SHOWN : 0); } @GuardedBy("ImfLock.class") @@ -3040,17 +3056,17 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub return false; } - List imis = mSettings.getEnabledInputMethodListWithFilterLocked( + List imes = mSettings.getEnabledInputMethodListWithFilterLocked( InputMethodInfo::shouldShowInInputMethodPicker); - final int N = imis.size(); - if (N > 2) return true; - if (N < 1) return false; + final int numImes = imes.size(); + if (numImes > 2) return true; + if (numImes < 1) return false; int nonAuxCount = 0; int auxCount = 0; InputMethodSubtype nonAuxSubtype = null; InputMethodSubtype auxSubtype = null; - for(int i = 0; i < N; ++i) { - final InputMethodInfo imi = imis.get(i); + for (int i = 0; i < numImes; ++i) { + final InputMethodInfo imi = imes.get(i); final List subtypes = mSettings.getEnabledInputMethodSubtypeListLocked(mContext, imi, true); final int subtypeCount = subtypes.size(); @@ -3074,8 +3090,8 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub } else if (nonAuxCount == 1 && auxCount == 1) { if (nonAuxSubtype != null && auxSubtype != null && (nonAuxSubtype.getLocale().equals(auxSubtype.getLocale()) - || auxSubtype.overridesImplicitlyEnabledSubtype() - || nonAuxSubtype.overridesImplicitlyEnabledSubtype()) + || auxSubtype.overridesImplicitlyEnabledSubtype() + || nonAuxSubtype.overridesImplicitlyEnabledSubtype()) && nonAuxSubtype.containsExtraValueKey(TAG_TRY_SUPPRESSING_IME_SWITCHER)) { return false; } @@ -3231,7 +3247,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub void updateInputMethodsFromSettingsLocked(boolean enabledMayChange) { if (enabledMayChange) { List enabled = mSettings.getEnabledInputMethodListLocked(); - for (int i=0; i enabled = mSettings.getEnabledInputMethodListLocked(); if (enabled != null) { - final int N = enabled.size(); + final int enabledCount = enabled.size(); final String locale = mCurrentSubtype == null ? mRes.getConfiguration().locale.toString() : mCurrentSubtype.getLocale(); - for (int i = 0; i < N; ++i) { + for (int i = 0; i < enabledCount; ++i) { final InputMethodInfo imi = enabled.get(i); if (imi.getSubtypeCount() > 0 && imi.isSystem()) { InputMethodSubtype keyboardSubtype = @@ -4093,7 +4109,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub targetLastImiId = imi.getId(); subtypeId = SubtypeUtils.getSubtypeIdFromHashCode(imi, keyboardSubtype.hashCode()); - if(keyboardSubtype.getLocale().equals(locale)) { + if (keyboardSubtype.getLocale().equals(locale)) { break; } } @@ -4230,8 +4246,9 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub * {@link InputMethodManager#getInputMethodWindowVisibleHeight()} and a dependency in * {@link InputMethodService#onCreate()}. * - *

TODO(Bug 113914148): Check if we can remove this.

* @return {@link WindowManagerInternal#getInputMethodWindowVisibleHeight(int)} + * + * @deprecated TODO(b/113914148): Check if we can remove this */ @Override @Deprecated @@ -4305,7 +4322,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub + " is already registered by " + info.mParentClient); } if (info == null) { - if (!mWindowManagerInternal.isUidAllowedOnDisplay(childDisplayId, cs.uid)) { + if (!mWindowManagerInternal.isUidAllowedOnDisplay(childDisplayId, cs.mUid)) { throw new SecurityException(cs + " cannot access to display #" + childDisplayId); } @@ -4314,12 +4331,12 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub } info.mMatrix.setValues(matrixValues); - if (mCurClient == null || mCurClient.curSession == null) { + if (mCurClient == null || mCurClient.mCurSession == null) { return; } Matrix matrix = null; - int displayId = mCurClient.selfReportedDisplayId; + int displayId = mCurClient.mSelfReportedDisplayId; boolean needToNotify = false; while (true) { needToNotify |= (displayId == childDisplayId); @@ -4332,16 +4349,16 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub } else { matrix.postConcat(next.mMatrix); } - if (next.mParentClient.selfReportedDisplayId == mCurTokenDisplayId) { + if (next.mParentClient.mSelfReportedDisplayId == mCurTokenDisplayId) { if (needToNotify) { final float[] values = new float[9]; matrix.getValues(values); - mCurClient.client.updateVirtualDisplayToScreenMatrix( + mCurClient.mClient.updateVirtualDisplayToScreenMatrix( getSequenceNumberLocked(), values); } break; } - displayId = info.mParentClient.selfReportedDisplayId; + displayId = info.mParentClient.mSelfReportedDisplayId; } } } catch (Throwable t) { @@ -4493,7 +4510,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub /** * Starting point for dumping the IME tracing information in proto format. * - * @param clientProtoDump dump information from the IME client side + * @param protoDump dump information from the IME client side */ @BinderThread @Override @@ -4558,7 +4575,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub } for (ClientState state : clients.values()) { if (state != null) { - state.client.setImeTraceEnabled(true /* enabled */); + state.mClient.setImeTraceEnabled(true /* enabled */); } } } @@ -4573,7 +4590,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub } for (ClientState state : clients.values()) { if (state != null) { - state.client.setImeTraceEnabled(false /* enabled */); + state.mClient.setImeTraceEnabled(false /* enabled */); } } } @@ -4652,7 +4669,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub // actual IME target. mWindowManagerInternal.hideIme( mHideRequestWindowMap.get(windowToken), - mCurClient.selfReportedDisplayId); + mCurClient.mSelfReportedDisplayId); } } else { // Send to window manager to show IME after IME layout finishes. @@ -4683,7 +4700,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub != PackageManager.PERMISSION_GRANTED) { throw new SecurityException( "Using null token requires permission " - + android.Manifest.permission.WRITE_SECURE_SETTINGS); + + android.Manifest.permission.WRITE_SECURE_SETTINGS); } } else if (getCurTokenLocked() != token) { Slog.w(TAG, "Ignoring setInputMethod of uid " + Binder.getCallingUid() @@ -4751,14 +4768,14 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub @GuardedBy("ImfLock.class") void setEnabledSessionLocked(SessionState session) { if (mEnabledSession != session) { - if (mEnabledSession != null && mEnabledSession.session != null) { + if (mEnabledSession != null && mEnabledSession.mSession != null) { if (DEBUG) Slog.v(TAG, "Disabling: " + mEnabledSession); - mEnabledSession.method.setSessionEnabled(mEnabledSession.session, false); + mEnabledSession.mMethod.setSessionEnabled(mEnabledSession.mSession, false); } mEnabledSession = session; - if (mEnabledSession != null && mEnabledSession.session != null) { + if (mEnabledSession != null && mEnabledSession.mSession != null) { if (DEBUG) Slog.v(TAG, "Enabling: " + mEnabledSession); - mEnabledSession.method.setSessionEnabled(mEnabledSession.session, true); + mEnabledSession.mMethod.setSessionEnabled(mEnabledSession.mSession, true); } } } @@ -4837,9 +4854,9 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub case MSG_REMOVE_IME_SURFACE: { synchronized (ImfLock.class) { try { - if (mEnabledSession != null && mEnabledSession.session != null + if (mEnabledSession != null && mEnabledSession.mSession != null && !mShowRequested) { - mEnabledSession.session.removeImeSurface(); + mEnabledSession.mSession.removeImeSurface(); } } catch (RemoteException e) { } @@ -4851,8 +4868,8 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub synchronized (ImfLock.class) { try { if (windowToken == mCurFocusedWindow - && mEnabledSession != null && mEnabledSession.session != null) { - mEnabledSession.session.removeImeSurface(); + && mEnabledSession != null && mEnabledSession.mSession != null) { + mEnabledSession.mSession.removeImeSurface(); } } catch (RemoteException e) { } @@ -4962,8 +4979,8 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub updateSystemUiLocked(interactive ? mImeWindowVis : 0, mBackDisposition); // Inform the current client of the change in active status - if (mCurClient != null && mCurClient.client != null) { - mCurClient.client.setActive(mIsInteractive, mInFullscreenMode, + if (mCurClient != null && mCurClient.mClient != null) { + mCurClient.mClient.setActive(mIsInteractive, mInFullscreenMode, mImePlatformCompatUtils.shouldFinishInputWithReportToIme( getCurMethodUidLocked())); } @@ -5073,8 +5090,8 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub mContext.getPackageManager().queryIntentServicesAsUser( new Intent(InputMethod.SERVICE_INTERFACE), PackageManager.MATCH_DISABLED_COMPONENTS, mSettings.getCurrentUserId()); - final int N = allInputMethodServices.size(); - for (int i = 0; i < N; ++i) { + final int numImes = allInputMethodServices.size(); + for (int i = 0; i < numImes; ++i) { final ServiceInfo si = allInputMethodServices.get(i).serviceInfo; if (android.Manifest.permission.BIND_INPUT_METHOD.equals(si.permission)) { mMyPackageMonitor.addKnownImePackageNameLocked(si.packageName); @@ -5088,8 +5105,8 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub boolean enabledImeFound = false; boolean enabledNonAuxImeFound = false; final List enabledImes = mSettings.getEnabledInputMethodListLocked(); - final int N = enabledImes.size(); - for (int i = 0; i < N; ++i) { + final int numImes = enabledImes.size(); + for (int i = 0; i < numImes; ++i) { final InputMethodInfo imi = enabledImes.get(i); if (mMethodList.contains(imi)) { enabledImeFound = true; @@ -5117,8 +5134,8 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub final ArrayList defaultEnabledIme = InputMethodInfoUtils.getDefaultEnabledImes(mContext, mMethodList, reenableMinimumNonAuxSystemImes); - final int N = defaultEnabledIme.size(); - for (int i = 0; i < N; ++i) { + final int numImes = defaultEnabledIme.size(); + for (int i = 0; i < numImes; ++i) { final InputMethodInfo imi = defaultEnabledIme.get(i); if (DEBUG) { Slog.d(TAG, "--- enable ime = " + imi); @@ -5360,7 +5377,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub if (userId == mSettings.getCurrentUserId()) { if (!mMethodMap.containsKey(imeId) || !mSettings.getEnabledInputMethodListLocked() - .contains(mMethodMap.get(imeId))) { + .contains(mMethodMap.get(imeId))) { return false; // IME is not found or not enabled. } setInputMethodLocked(imeId, NOT_A_SUBTYPE_ID); @@ -5371,8 +5388,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub mContext.getResources(), mContext.getContentResolver(), methodMap, userId, false); if (!methodMap.containsKey(imeId) - || !settings.getEnabledInputMethodListLocked() - .contains(methodMap.get(imeId))) { + || !settings.getEnabledInputMethodListLocked().contains(methodMap.get(imeId))) { return false; // IME is not found or not enabled. } settings.putSelectedInputMethod(imeId); @@ -5528,18 +5544,18 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub attachNewAccessibilityLocked(StartInputReason.SESSION_CREATED_BY_ACCESSIBILITY, true); - final SessionState sessionState = mCurClient.curSession; + final SessionState sessionState = mCurClient.mCurSession; final IInputMethodSession imeSession = sessionState == null - ? null : sessionState.session; + ? null : sessionState.mSession; final SparseArray accessibilityInputMethodSessions = - createAccessibilityInputMethodSessions( - mCurClient.mAccessibilitySessions); + createAccessibilityInputMethodSessions( + mCurClient.mAccessibilitySessions); final InputBindResult res = new InputBindResult( InputBindResult.ResultCode.SUCCESS_WITH_ACCESSIBILITY_SESSION, imeSession, accessibilityInputMethodSessions, null, getCurIdLocked(), getSequenceNumberLocked(), mCurVirtualDisplayToScreenMatrix, false); - mCurClient.client.onBindAccessibilityService(res, accessibilityConnectionId); + mCurClient.mClient.onBindAccessibilityService(res, accessibilityConnectionId); } } } @@ -5550,11 +5566,11 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub if (mCurClient != null) { if (DEBUG) { Slog.v(TAG, "unbindAccessibilityFromCurrentClientLocked: client=" - + mCurClient.client.asBinder()); + + mCurClient.mClient.asBinder()); } // A11yManagerService unbinds the disabled accessibility service. We don't need // to do it here. - mCurClient.client.onUnbindAccessibilityService(getSequenceNumberLocked(), + mCurClient.mClient.onUnbindAccessibilityService(getSequenceNumberLocked(), accessibilityConnectionId); } // We only have sessions when we bound to an input method. Remove this session @@ -5620,7 +5636,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub // This user ID can never bee spoofed. final int imeUserId = UserHandle.getUserId(uid); // This user ID can never bee spoofed. - final int appUserId = UserHandle.getUserId(mCurClient.uid); + final int appUserId = UserHandle.getUserId(mCurClient.mUid); // This user ID may be invalid if "contentUri" embedded an invalid user ID. final int contentUriOwnerUserId = ContentProvider.getUserIdFromUri(contentUri, imeUserId); @@ -5642,9 +5658,9 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub if (!calledWithValidTokenLocked(token)) { return; } - if (mCurClient != null && mCurClient.client != null) { + if (mCurClient != null && mCurClient.mClient != null) { mInFullscreenMode = fullscreen; - mCurClient.client.reportFullscreenMode(fullscreen); + mCurClient.mClient.reportFullscreenMode(fullscreen); } } } @@ -5722,9 +5738,9 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub synchronized (ImfLock.class) { p.println("Current Input Method Manager state:"); - int N = mMethodList.size(); + int numImes = mMethodList.size(); p.println(" Input Methods: mMethodMapUpdateCount=" + mMethodMapUpdateCount); - for (int i=0; i