Merge "Fix lint warnings under com.android.server.inputmethod"
This commit is contained in:
committed by
Android (Google) Code Review
commit
21628242ff
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<InputMethodSubtype> 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;
|
||||
|
||||
@@ -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]) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user