Merge "Minor code clean-ups with no behavior change"
This commit is contained in:
committed by
Android (Google) Code Review
commit
ac2d178578
@@ -97,7 +97,6 @@ public class SpellCheckerSession {
|
||||
private final SpellCheckerInfo mSpellCheckerInfo;
|
||||
private final SpellCheckerSessionListener mSpellCheckerSessionListener;
|
||||
private final SpellCheckerSessionListenerImpl mSpellCheckerSessionListenerImpl;
|
||||
private final SpellCheckerSubtype mSubtype;
|
||||
|
||||
private boolean mIsUsed;
|
||||
|
||||
@@ -121,8 +120,7 @@ public class SpellCheckerSession {
|
||||
* @hide
|
||||
*/
|
||||
public SpellCheckerSession(
|
||||
SpellCheckerInfo info, ITextServicesManager tsm, SpellCheckerSessionListener listener,
|
||||
SpellCheckerSubtype subtype) {
|
||||
SpellCheckerInfo info, ITextServicesManager tsm, SpellCheckerSessionListener listener) {
|
||||
if (info == null || listener == null || tsm == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
@@ -132,7 +130,6 @@ public class SpellCheckerSession {
|
||||
mTextServicesManager = tsm;
|
||||
mIsUsed = true;
|
||||
mSpellCheckerSessionListener = listener;
|
||||
mSubtype = subtype;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -218,7 +215,8 @@ public class SpellCheckerSession {
|
||||
mSpellCheckerSessionListener.onGetSentenceSuggestions(suggestionInfos);
|
||||
}
|
||||
|
||||
private static class SpellCheckerSessionListenerImpl extends ISpellCheckerSessionListener.Stub {
|
||||
private static final class SpellCheckerSessionListenerImpl
|
||||
extends ISpellCheckerSessionListener.Stub {
|
||||
private static final int TASK_CANCEL = 1;
|
||||
private static final int TASK_GET_SUGGESTIONS_MULTIPLE = 2;
|
||||
private static final int TASK_CLOSE = 3;
|
||||
@@ -366,7 +364,7 @@ public class SpellCheckerSession {
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void onServiceConnected(ISpellCheckerSession session) {
|
||||
public void onServiceConnected(ISpellCheckerSession session) {
|
||||
synchronized (this) {
|
||||
switch (mState) {
|
||||
case STATE_WAIT_CONNECTION:
|
||||
@@ -408,9 +406,9 @@ public class SpellCheckerSession {
|
||||
+ Integer.toHexString(mISpellCheckerSession.hashCode())
|
||||
+ " mPendingTasks.size()=" + mPendingTasks.size());
|
||||
}
|
||||
}
|
||||
while (!mPendingTasks.isEmpty()) {
|
||||
processTask(session, mPendingTasks.poll(), false);
|
||||
while (!mPendingTasks.isEmpty()) {
|
||||
processTask(session, mPendingTasks.poll(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -529,7 +527,7 @@ public class SpellCheckerSession {
|
||||
public void onGetSentenceSuggestions(SentenceSuggestionsInfo[] results);
|
||||
}
|
||||
|
||||
private static class InternalListener extends ITextServicesSessionListener.Stub {
|
||||
private static final class InternalListener extends ITextServicesSessionListener.Stub {
|
||||
private final SpellCheckerSessionListenerImpl mParentSpellCheckerSessionListenerImpl;
|
||||
|
||||
public InternalListener(SpellCheckerSessionListenerImpl spellCheckerSessionListenerImpl) {
|
||||
@@ -547,7 +545,7 @@ public class SpellCheckerSession {
|
||||
super.finalize();
|
||||
if (mIsUsed) {
|
||||
Log.e(TAG, "SpellCheckerSession was not finished properly." +
|
||||
"You should call finishShession() when you finished to use a spell checker.");
|
||||
"You should call finishSession() when you finished to use a spell checker.");
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,8 +171,7 @@ public final class TextServicesManager {
|
||||
if (subtypeInUse == null) {
|
||||
return null;
|
||||
}
|
||||
final SpellCheckerSession session = new SpellCheckerSession(
|
||||
sci, mService, listener, subtypeInUse);
|
||||
final SpellCheckerSession session = new SpellCheckerSession(sci, mService, listener);
|
||||
try {
|
||||
mService.getSpellCheckerService(sci.getId(), subtypeInUse.getLocale(),
|
||||
session.getTextServicesSessionListener(),
|
||||
|
||||
@@ -198,7 +198,7 @@ public class TextServicesManagerService extends ITextServicesManager.Stub {
|
||||
mUserManager.getProfileIdsWithDisabled(mSettings.getCurrentUserId()));
|
||||
}
|
||||
|
||||
private class TextServicesMonitor extends PackageMonitor {
|
||||
private final class TextServicesMonitor extends PackageMonitor {
|
||||
private boolean isChangingPackagesOfCurrentUser() {
|
||||
final int userId = getChangingUserId();
|
||||
final boolean retval = userId == mSettings.getCurrentUserId();
|
||||
@@ -236,7 +236,7 @@ public class TextServicesManagerService extends ITextServicesManager.Stub {
|
||||
}
|
||||
}
|
||||
|
||||
class TextServicesBroadcastReceiver extends BroadcastReceiver {
|
||||
private final class TextServicesBroadcastReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
final String action = intent.getAction();
|
||||
@@ -618,8 +618,7 @@ public class TextServicesManagerService extends ITextServicesManager.Stub {
|
||||
Slog.w(TAG, "Start spell checker session inner locked.");
|
||||
}
|
||||
final String sciId = info.getId();
|
||||
final InternalServiceConnection connection = new InternalServiceConnection(
|
||||
sciId, locale, bundle);
|
||||
final InternalServiceConnection connection = new InternalServiceConnection(sciId);
|
||||
final Intent serviceIntent = new Intent(SpellCheckerService.SERVICE_INTERFACE);
|
||||
serviceIntent.setComponent(info.getComponent());
|
||||
if (DBG) {
|
||||
@@ -836,7 +835,7 @@ public class TextServicesManagerService extends ITextServicesManager.Stub {
|
||||
// SpellCheckerBindGroup contains active text service session listeners.
|
||||
// If there are no listeners anymore, the SpellCheckerBindGroup instance will be removed from
|
||||
// mSpellCheckerBindGroups
|
||||
private class SpellCheckerBindGroup {
|
||||
private final class SpellCheckerBindGroup {
|
||||
private final String TAG = SpellCheckerBindGroup.class.getSimpleName();
|
||||
private final InternalServiceConnection mInternalConnection;
|
||||
private final CopyOnWriteArrayList<InternalDeathRecipient> mListeners =
|
||||
@@ -972,15 +971,10 @@ public class TextServicesManagerService extends ITextServicesManager.Stub {
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalServiceConnection implements ServiceConnection {
|
||||
private final class InternalServiceConnection implements ServiceConnection {
|
||||
private final String mSciId;
|
||||
private final String mLocale;
|
||||
private final Bundle mBundle;
|
||||
public InternalServiceConnection(
|
||||
String id, String locale, Bundle bundle) {
|
||||
public InternalServiceConnection(String id) {
|
||||
mSciId = id;
|
||||
mLocale = locale;
|
||||
mBundle = bundle;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1013,7 +1007,7 @@ public class TextServicesManagerService extends ITextServicesManager.Stub {
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalDeathRecipient implements IBinder.DeathRecipient {
|
||||
private static final class InternalDeathRecipient implements IBinder.DeathRecipient {
|
||||
public final ITextServicesSessionListener mTsListener;
|
||||
public final ISpellCheckerSessionListener mScListener;
|
||||
public final String mScLocale;
|
||||
@@ -1041,7 +1035,7 @@ public class TextServicesManagerService extends ITextServicesManager.Stub {
|
||||
}
|
||||
}
|
||||
|
||||
private static class TextServicesSettings {
|
||||
private static final class TextServicesSettings {
|
||||
private final ContentResolver mResolver;
|
||||
@UserIdInt
|
||||
private int mCurrentUserId;
|
||||
|
||||
Reference in New Issue
Block a user