summaryrefslogtreecommitdiff
path: root/services/java/com/android/server/InputMethodManagerService.java
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2011-10-31 15:39:59 -0700
committerDianne Hackborn <hackbod@google.com>2011-10-31 16:52:34 -0700
commit2c84cfc001fb92a71811bf7384b7f865ff31ff9d (patch)
tree1d43eda4854e37a553b85ce759ea4fffd41c9edb /services/java/com/android/server/InputMethodManagerService.java
parentdd79b4c85a9dd2c2ad702ea2137fe2a076567fa1 (diff)
Various performance and other work.
- IME service now switches between visible and perceptible depending on whether it is being showm, allowing us to more aggressively free its memory when not shown. - The activity display time is no longer delayed by the activity transition animation. - New -R (repeat) option for launching activities with the am command. - Improved some documentation on Loader to be clear about some methods that apps should not normally call. - FrameworkPerf test now allows you to select individual tests to run. Change-Id: Id1f73de66dc93d63212183958a72119ad174318b
Diffstat (limited to 'services/java/com/android/server/InputMethodManagerService.java')
-rw-r--r--services/java/com/android/server/InputMethodManagerService.java29
1 files changed, 27 insertions, 2 deletions
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java
index 17ea03bd20b0..ddac35c5d533 100644
--- a/services/java/com/android/server/InputMethodManagerService.java
+++ b/services/java/com/android/server/InputMethodManagerService.java
@@ -161,6 +161,16 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
private final LruCache<SuggestionSpan, InputMethodInfo> mSecureSuggestionSpans =
new LruCache<SuggestionSpan, InputMethodInfo>(SECURE_SUGGESTION_SPANS_MAX_SIZE);
+ // Used to bring IME service up to visible adjustment while it is being shown.
+ final ServiceConnection mVisibleConnection = new ServiceConnection() {
+ @Override public void onServiceConnected(ComponentName name, IBinder service) {
+ }
+
+ @Override public void onServiceDisconnected(ComponentName name) {
+ }
+ };
+ boolean mVisibleBound = false;
+
// Ongoing notification
private NotificationManager mNotificationManager;
private KeyguardManager mKeyguardManager;
@@ -893,7 +903,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
com.android.internal.R.string.input_method_binding_label);
mCurIntent.putExtra(Intent.EXTRA_CLIENT_INTENT, PendingIntent.getActivity(
mContext, 0, new Intent(Settings.ACTION_INPUT_METHOD_SETTINGS), 0));
- if (mContext.bindService(mCurIntent, this, Context.BIND_AUTO_CREATE)) {
+ if (mContext.bindService(mCurIntent, this, Context.BIND_AUTO_CREATE
+ | Context.BIND_NOT_VISIBLE)) {
mLastBindTime = SystemClock.uptimeMillis();
mHaveConnection = true;
mCurId = info.getId();
@@ -975,6 +986,11 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
}
void unbindCurrentMethodLocked(boolean reportToClient) {
+ if (mVisibleBound) {
+ mContext.unbindService(mVisibleConnection);
+ mVisibleBound = false;
+ }
+
if (mHaveConnection) {
mContext.unbindService(this);
mHaveConnection = false;
@@ -1366,6 +1382,10 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
MSG_SHOW_SOFT_INPUT, getImeShowFlags(), mCurMethod,
resultReceiver));
mInputShown = true;
+ if (mHaveConnection && !mVisibleBound) {
+ mContext.bindService(mCurIntent, mVisibleConnection, Context.BIND_AUTO_CREATE);
+ mVisibleBound = true;
+ }
res = true;
} else if (mHaveConnection && SystemClock.uptimeMillis()
>= (mLastBindTime+TIME_TO_RECONNECT)) {
@@ -1377,7 +1397,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
SystemClock.uptimeMillis()-mLastBindTime,1);
Slog.w(TAG, "Force disconnect/connect to the IME in showCurrentInputLocked()");
mContext.unbindService(this);
- mContext.bindService(mCurIntent, this, Context.BIND_AUTO_CREATE);
+ mContext.bindService(mCurIntent, this, Context.BIND_AUTO_CREATE
+ | Context.BIND_NOT_VISIBLE);
}
return res;
@@ -1436,6 +1457,10 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
} else {
res = false;
}
+ if (mHaveConnection && mVisibleBound) {
+ mContext.unbindService(mVisibleConnection);
+ mVisibleBound = false;
+ }
mInputShown = false;
mShowRequested = false;
mShowExplicitlyRequested = false;