Refactor StatsUtils into two components:StatsUtils & StatsUtilsManager
Bug:16522256 Change-Id: I9cb8129c552159cf17ea5c2656e0988bf0f999f5main
parent
98e56c6905
commit
aabb351279
|
@ -16,22 +16,12 @@
|
||||||
|
|
||||||
package com.android.inputmethod.latin.utils;
|
package com.android.inputmethod.latin.utils;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
|
|
||||||
import com.android.inputmethod.latin.RichInputMethodManager;
|
import com.android.inputmethod.latin.RichInputMethodManager;
|
||||||
import com.android.inputmethod.latin.settings.SettingsValues;
|
import com.android.inputmethod.latin.settings.SettingsValues;
|
||||||
|
|
||||||
public final class StatsUtils {
|
public final class StatsUtils {
|
||||||
public static void init(final Context context) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void onCreate(final SettingsValues settingsValues,
|
public static void onCreate(final SettingsValues settingsValues,
|
||||||
RichInputMethodManager richImm) {
|
RichInputMethodManager richImm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onLoadSettings(final SettingsValues settingsValues) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void onDestroy() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2014 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.inputmethod.latin.utils;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.android.inputmethod.latin.settings.SettingsValues;
|
||||||
|
|
||||||
|
public class StatsUtilsManager {
|
||||||
|
|
||||||
|
private static final StatsUtilsManager sInstance = new StatsUtilsManager();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the singleton instance of {@link StatsUtilsManager}.
|
||||||
|
*/
|
||||||
|
public static StatsUtilsManager getInstance() {
|
||||||
|
return sInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onCreate(final Context context) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onLoadSettings(final SettingsValues settingsValues) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onDestroy() {
|
||||||
|
}
|
||||||
|
}
|
|
@ -93,6 +93,7 @@ import com.android.inputmethod.latin.utils.IntentUtils;
|
||||||
import com.android.inputmethod.latin.utils.JniUtils;
|
import com.android.inputmethod.latin.utils.JniUtils;
|
||||||
import com.android.inputmethod.latin.utils.LeakGuardHandlerWrapper;
|
import com.android.inputmethod.latin.utils.LeakGuardHandlerWrapper;
|
||||||
import com.android.inputmethod.latin.utils.StatsUtils;
|
import com.android.inputmethod.latin.utils.StatsUtils;
|
||||||
|
import com.android.inputmethod.latin.utils.StatsUtilsManager;
|
||||||
import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
|
import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
|
||||||
import com.android.inputmethod.latin.utils.ViewLayoutUtils;
|
import com.android.inputmethod.latin.utils.ViewLayoutUtils;
|
||||||
|
|
||||||
|
@ -158,6 +159,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
private final SubtypeSwitcher mSubtypeSwitcher;
|
private final SubtypeSwitcher mSubtypeSwitcher;
|
||||||
private final SubtypeState mSubtypeState = new SubtypeState();
|
private final SubtypeState mSubtypeState = new SubtypeState();
|
||||||
private final SpecialKeyDetector mSpecialKeyDetector;
|
private final SpecialKeyDetector mSpecialKeyDetector;
|
||||||
|
private StatsUtilsManager mStatsUtilsManager;
|
||||||
|
|
||||||
// Object for reacting to adding/removing a dictionary pack.
|
// Object for reacting to adding/removing a dictionary pack.
|
||||||
private final BroadcastReceiver mDictionaryPackInstallReceiver =
|
private final BroadcastReceiver mDictionaryPackInstallReceiver =
|
||||||
|
@ -538,6 +540,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
mSubtypeSwitcher = SubtypeSwitcher.getInstance();
|
mSubtypeSwitcher = SubtypeSwitcher.getInstance();
|
||||||
mKeyboardSwitcher = KeyboardSwitcher.getInstance();
|
mKeyboardSwitcher = KeyboardSwitcher.getInstance();
|
||||||
mSpecialKeyDetector = new SpecialKeyDetector(this);
|
mSpecialKeyDetector = new SpecialKeyDetector(this);
|
||||||
|
mStatsUtilsManager = StatsUtilsManager.getInstance();
|
||||||
mIsHardwareAcceleratedDrawingEnabled =
|
mIsHardwareAcceleratedDrawingEnabled =
|
||||||
InputMethodServiceCompatUtils.enableHardwareAcceleration(this);
|
InputMethodServiceCompatUtils.enableHardwareAcceleration(this);
|
||||||
Log.i(TAG, "Hardware accelerated drawing: " + mIsHardwareAcceleratedDrawingEnabled);
|
Log.i(TAG, "Hardware accelerated drawing: " + mIsHardwareAcceleratedDrawingEnabled);
|
||||||
|
@ -553,8 +556,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
KeyboardSwitcher.init(this);
|
KeyboardSwitcher.init(this);
|
||||||
AudioAndHapticFeedbackManager.init(this);
|
AudioAndHapticFeedbackManager.init(this);
|
||||||
AccessibilityUtils.init(this);
|
AccessibilityUtils.init(this);
|
||||||
StatsUtils.init(this);
|
|
||||||
|
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
|
|
||||||
mHandler.onCreate();
|
mHandler.onCreate();
|
||||||
|
@ -586,7 +587,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
registerReceiver(mDictionaryDumpBroadcastReceiver, dictDumpFilter);
|
registerReceiver(mDictionaryDumpBroadcastReceiver, dictDumpFilter);
|
||||||
|
|
||||||
DictionaryDecayBroadcastReciever.setUpIntervalAlarmForDictionaryDecaying(this);
|
DictionaryDecayBroadcastReciever.setUpIntervalAlarmForDictionaryDecaying(this);
|
||||||
|
mStatsUtilsManager.onCreate(this /* context */);
|
||||||
StatsUtils.onCreate(mSettings.getCurrent(), mRichImm);
|
StatsUtils.onCreate(mSettings.getCurrent(), mRichImm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -609,7 +610,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
mDictionaryFacilitator.updateEnabledSubtypes(mRichImm.getMyEnabledInputMethodSubtypeList(
|
mDictionaryFacilitator.updateEnabledSubtypes(mRichImm.getMyEnabledInputMethodSubtypeList(
|
||||||
true /* allowsImplicitlySelectedSubtypes */));
|
true /* allowsImplicitlySelectedSubtypes */));
|
||||||
refreshPersonalizationDictionarySession(currentSettingsValues);
|
refreshPersonalizationDictionarySession(currentSettingsValues);
|
||||||
StatsUtils.onLoadSettings(currentSettingsValues);
|
mStatsUtilsManager.onLoadSettings(currentSettingsValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshPersonalizationDictionarySession(
|
private void refreshPersonalizationDictionarySession(
|
||||||
|
@ -699,7 +700,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
unregisterReceiver(mConnectivityAndRingerModeChangeReceiver);
|
unregisterReceiver(mConnectivityAndRingerModeChangeReceiver);
|
||||||
unregisterReceiver(mDictionaryPackInstallReceiver);
|
unregisterReceiver(mDictionaryPackInstallReceiver);
|
||||||
unregisterReceiver(mDictionaryDumpBroadcastReceiver);
|
unregisterReceiver(mDictionaryDumpBroadcastReceiver);
|
||||||
StatsUtils.onDestroy();
|
mStatsUtilsManager.onDestroy();
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue