Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
frameworks_native
Commits
a78c2e65
Commit
a78c2e65
authored
9 years ago
by
Peng Xu
Committed by
Android (Google) Code Review
9 years ago
Browse files
Options
Download
Plain Diff
Merge "Avoiding flush on-change sensors at subscription" into mnc-dr-dev
parents
574145ea
20483c49
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
services/sensorservice/SensorService.cpp
services/sensorservice/SensorService.cpp
+9
-4
No files found.
services/sensorservice/SensorService.cpp
View file @
a78c2e65
...
...
@@ -912,10 +912,15 @@ status_t SensorService::enable(const sp<SensorEventConnection>& connection,
status_t
err
=
sensor
->
batch
(
connection
.
get
(),
handle
,
0
,
samplingPeriodNs
,
maxBatchReportLatencyNs
);
// Call flush() before calling activate() on the sensor. Wait for a first flush complete
// event before sending events on this connection. Ignore one-shot sensors which don't
// support flush(). Also if this sensor isn't already active, don't call flush().
if
(
err
==
NO_ERROR
&&
sensor
->
getSensor
().
getReportingMode
()
!=
AREPORTING_MODE_ONE_SHOT
&&
// Call flush() before calling activate() on the sensor. Wait for a first
// flush complete event before sending events on this connection. Ignore
// one-shot sensors which don't support flush(). Ignore on-change sensors
// to maintain the on-change logic (any on-change events except the initial
// one should be trigger by a change in value). Also if this sensor isn't
// already active, don't call flush().
if
(
err
==
NO_ERROR
&&
sensor
->
getSensor
().
getReportingMode
()
!=
AREPORTING_MODE_ONE_SHOT
&&
sensor
->
getSensor
().
getReportingMode
()
!=
AREPORTING_MODE_ON_CHANGE
&&
rec
->
getNumConnections
()
>
1
)
{
connection
->
setFirstFlushPending
(
handle
,
true
);
status_t
err_flush
=
sensor
->
flush
(
connection
.
get
(),
handle
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment