From 27331c661d4002fd99515f4331c9189372702852 Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Tue, 4 Oct 2022 17:16:14 -0700 Subject: [PATCH] Fix lint warnings under com.android.server.inputmethod This is a mechanical style-fix CL with no behavior change. Fix: 249790290 Test: prebuilts/checkstyle/checkstyle.py -f \ frameworks/base/services/core/java/com/android/server/inputmethod/ \ | grep ".java:" Change-Id: I64326fa2bec0293ecf0c62e4380bafa98c694721 --- .../InputContentUriTokenHandler.java | 28 +++++++++---------- .../inputmethod/InputMethodDeviceConfigs.java | 2 +- .../InputMethodMenuController.java | 2 +- .../server/inputmethod/InputMethodUtils.java | 7 ++--- .../server/inputmethod/LocaleUtils.java | 4 +-- .../server/inputmethod/SubtypeUtils.java | 14 +++++----- 6 files changed, 28 insertions(+), 29 deletions(-) diff --git a/services/core/java/com/android/server/inputmethod/InputContentUriTokenHandler.java b/services/core/java/com/android/server/inputmethod/InputContentUriTokenHandler.java index 5a0069ac8e062..789222eb08f14 100644 --- a/services/core/java/com/android/server/inputmethod/InputContentUriTokenHandler.java +++ b/services/core/java/com/android/server/inputmethod/InputContentUriTokenHandler.java @@ -1,18 +1,18 @@ /* -** Copyright 2016, 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 -** -** 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. -*/ + * Copyright (C) 2016 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 + * + * 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. + */ package com.android.server.inputmethod; diff --git a/services/core/java/com/android/server/inputmethod/InputMethodDeviceConfigs.java b/services/core/java/com/android/server/inputmethod/InputMethodDeviceConfigs.java index 2160b652317a5..dc2799e8e4340 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodDeviceConfigs.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodDeviceConfigs.java @@ -29,7 +29,7 @@ final class InputMethodDeviceConfigs { private boolean mHideImeWhenNoEditorFocus; private final DeviceConfig.OnPropertiesChangedListener mDeviceConfigChangedListener; - public InputMethodDeviceConfigs() { + InputMethodDeviceConfigs() { mDeviceConfigChangedListener = properties -> { if (!DeviceConfig.NAMESPACE_INPUT_METHOD_MANAGER.equals(properties.getNamespace())) { return; diff --git a/services/core/java/com/android/server/inputmethod/InputMethodMenuController.java b/services/core/java/com/android/server/inputmethod/InputMethodMenuController.java index 11e6923aa75aa..a25630ffefa1a 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodMenuController.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodMenuController.java @@ -71,7 +71,7 @@ final class InputMethodMenuController { @Nullable private InputMethodDialogWindowContext mDialogWindowContext; - public InputMethodMenuController(InputMethodManagerService service) { + InputMethodMenuController(InputMethodManagerService service) { mService = service; mSettings = mService.mSettings; mSwitchingController = mService.mSwitchingController; diff --git a/services/core/java/com/android/server/inputmethod/InputMethodUtils.java b/services/core/java/com/android/server/inputmethod/InputMethodUtils.java index 4688cc397caaf..69b06613b298e 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodUtils.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodUtils.java @@ -183,8 +183,7 @@ final class InputMethodUtils { return subtype != null ? TextUtils.concat(subtype.getDisplayName(context, imi.getPackageName(), imi.getServiceInfo().applicationInfo), - (TextUtils.isEmpty(imiLabel) ? - "" : " - " + imiLabel)) + (TextUtils.isEmpty(imiLabel) ? "" : " - " + imiLabel)) : imiLabel; } @@ -647,8 +646,8 @@ final class InputMethodUtils { List implicitlyEnabledSubtypes = SubtypeUtils.getImplicitlyApplicableSubtypesLocked(mRes, imi); if (implicitlyEnabledSubtypes != null) { - final int N = implicitlyEnabledSubtypes.size(); - for (int i = 0; i < N; ++i) { + final int numSubtypes = implicitlyEnabledSubtypes.size(); + for (int i = 0; i < numSubtypes; ++i) { final InputMethodSubtype st = implicitlyEnabledSubtypes.get(i); if (String.valueOf(st.hashCode()).equals(subtypeHashCode)) { return subtypeHashCode; diff --git a/services/core/java/com/android/server/inputmethod/LocaleUtils.java b/services/core/java/com/android/server/inputmethod/LocaleUtils.java index 3d02b3af6bc1d..f865e6010580c 100644 --- a/services/core/java/com/android/server/inputmethod/LocaleUtils.java +++ b/services/core/java/com/android/server/inputmethod/LocaleUtils.java @@ -46,7 +46,7 @@ final class LocaleUtils { * @param desired The locale preferred by user. * @return A score based on the locale matching for the default subtype enabling. */ - @IntRange(from=1, to=3) + @IntRange(from = 1, to = 3) private static byte calculateMatchingSubScore(@NonNull final ULocale supported, @NonNull final ULocale desired) { // Assuming supported/desired is fully expanded. @@ -111,7 +111,7 @@ final class LocaleUtils { * @return 1 if {@code left} is larger than {@code right}. -1 if {@code left} is less than * {@code right}. 0 if {@code left} and {@code right} is equal. */ - @IntRange(from=-1, to=1) + @IntRange(from = -1, to = 1) private static int compare(@NonNull byte[] left, @NonNull byte[] right) { for (int i = 0; i < left.length; ++i) { if (left[i] > right[i]) { diff --git a/services/core/java/com/android/server/inputmethod/SubtypeUtils.java b/services/core/java/com/android/server/inputmethod/SubtypeUtils.java index 7085868e4f611..f07539fa5eb26 100644 --- a/services/core/java/com/android/server/inputmethod/SubtypeUtils.java +++ b/services/core/java/com/android/server/inputmethod/SubtypeUtils.java @@ -68,14 +68,14 @@ final class SubtypeUtils { if (locale == null) { return false; } - final int N = imi.getSubtypeCount(); - for (int i = 0; i < N; ++i) { + final int numSubtypes = imi.getSubtypeCount(); + for (int i = 0; i < numSubtypes; ++i) { final InputMethodSubtype subtype = imi.getSubtypeAt(i); if (checkCountry) { final Locale subtypeLocale = subtype.getLocaleObject(); - if (subtypeLocale == null || - !TextUtils.equals(subtypeLocale.getLanguage(), locale.getLanguage()) || - !TextUtils.equals(subtypeLocale.getCountry(), locale.getCountry())) { + if (subtypeLocale == null + || !TextUtils.equals(subtypeLocale.getLanguage(), locale.getLanguage()) + || !TextUtils.equals(subtypeLocale.getCountry(), locale.getCountry())) { continue; } } else { @@ -260,8 +260,8 @@ final class SubtypeUtils { boolean partialMatchFound = false; InputMethodSubtype applicableSubtype = null; InputMethodSubtype firstMatchedModeSubtype = null; - final int N = subtypes.size(); - for (int i = 0; i < N; ++i) { + final int numSubtypes = subtypes.size(); + for (int i = 0; i < numSubtypes; ++i) { InputMethodSubtype subtype = subtypes.get(i); final String subtypeLocale = subtype.getLocale(); final String subtypeLanguage = LocaleUtils.getLanguageFromLocaleString(subtypeLocale);