Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LatinIME
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
keyboard
LatinIME
Commits
ce811f50
Commit
ce811f50
authored
12 years ago
by
Tadashi G. Takaoka
Browse files
Options
Downloads
Patches
Plain Diff
Use private lock object instead of synchronized method
Change-Id: Ifc62bacbd0583a7d102009681a94bdd9ccff7d47
parent
99b93d17
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
java/src/com/android/inputmethod/latin/LatinIME.java
+31
-22
31 additions, 22 deletions
java/src/com/android/inputmethod/latin/LatinIME.java
with
31 additions
and
22 deletions
java/src/com/android/inputmethod/latin/LatinIME.java
+
31
−
22
View file @
ce811f50
...
...
@@ -1551,7 +1551,8 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
private
static
final
class
BatchInputUpdater
implements
Handler
.
Callback
{
private
final
Handler
mHandler
;
private
LatinIME
mLatinIme
;
private
boolean
mInBatchInput
;
// synchronized using "this".
private
final
Object
mLock
=
new
Object
();
private
boolean
mInBatchInput
;
// synchronized using {@link #mLock}.
private
BatchInputUpdater
()
{
final
HandlerThread
handlerThread
=
new
HandlerThread
(
...
...
@@ -1582,21 +1583,25 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
}
// Run in the UI thread.
public
synchronized
void
onStartBatchInput
(
final
LatinIME
latinIme
)
{
mHandler
.
removeMessages
(
MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP
);
mLatinIme
=
latinIme
;
mInBatchInput
=
true
;
public
void
onStartBatchInput
(
final
LatinIME
latinIme
)
{
synchronized
(
mLock
)
{
mHandler
.
removeMessages
(
MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP
);
mLatinIme
=
latinIme
;
mInBatchInput
=
true
;
}
}
// Run in the Handler thread.
private
synchronized
void
updateBatchInput
(
final
InputPointers
batchPointers
)
{
if
(!
mInBatchInput
)
{
// Batch input has ended or canceled while the message was being delivered.
return
;
private
void
updateBatchInput
(
final
InputPointers
batchPointers
)
{
synchronized
(
mLock
)
{
if
(!
mInBatchInput
)
{
// Batch input has ended or canceled while the message was being delivered.
return
;
}
final
SuggestedWords
suggestedWords
=
getSuggestedWordsGestureLocked
(
batchPointers
);
mLatinIme
.
mHandler
.
showGesturePreviewAndSuggestionStrip
(
suggestedWords
,
false
/* dismissGestureFloatingPreviewText */
);
}
final
SuggestedWords
suggestedWords
=
getSuggestedWordsGestureLocked
(
batchPointers
);
mLatinIme
.
mHandler
.
showGesturePreviewAndSuggestionStrip
(
suggestedWords
,
false
/* dismissGestureFloatingPreviewText */
);
}
// Run in the UI thread.
...
...
@@ -1609,19 +1614,23 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
.
sendToTarget
();
}
public
synchronized
void
onCancelBatchInput
()
{
mInBatchInput
=
false
;
mLatinIme
.
mHandler
.
showGesturePreviewAndSuggestionStrip
(
SuggestedWords
.
EMPTY
,
true
/* dismissGestureFloatingPreviewText */
);
public
void
onCancelBatchInput
()
{
synchronized
(
mLock
)
{
mInBatchInput
=
false
;
mLatinIme
.
mHandler
.
showGesturePreviewAndSuggestionStrip
(
SuggestedWords
.
EMPTY
,
true
/* dismissGestureFloatingPreviewText */
);
}
}
// Run in the UI thread.
public
synchronized
SuggestedWords
onEndBatchInput
(
final
InputPointers
batchPointers
)
{
mInBatchInput
=
false
;
final
SuggestedWords
suggestedWords
=
getSuggestedWordsGestureLocked
(
batchPointers
);
mLatinIme
.
mHandler
.
showGesturePreviewAndSuggestionStrip
(
suggestedWords
,
true
/* dismissGestureFloatingPreviewText */
);
return
suggestedWords
;
public
SuggestedWords
onEndBatchInput
(
final
InputPointers
batchPointers
)
{
synchronized
(
mLock
)
{
mInBatchInput
=
false
;
final
SuggestedWords
suggestedWords
=
getSuggestedWordsGestureLocked
(
batchPointers
);
mLatinIme
.
mHandler
.
showGesturePreviewAndSuggestionStrip
(
suggestedWords
,
true
/* dismissGestureFloatingPreviewText */
);
return
suggestedWords
;
}
}
// {@link LatinIME#getSuggestedWords(int)} method calls with same session id have to
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment