Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fm-commonsys
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
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
CodeLinaro
public-release-test-restored
platform
vendor
qcom-opensource
fm-commonsys
Commits
7a8bc3ff
Commit
7a8bc3ff
authored
7 years ago
by
CNSS_WLAN Service
Committed by
Gerrit - the friendly Code Review server
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge "fm: wait for enable event to complete" into fm.lnx.2.1-dev
parents
2b9ceb84
6c3e689d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fmapp2/src/com/caf/fmradio/FMRadioService.java
+40
-29
40 additions, 29 deletions
fmapp2/src/com/caf/fmradio/FMRadioService.java
with
40 additions
and
29 deletions
fmapp2/src/com/caf/fmradio/FMRadioService.java
+
40
−
29
View file @
7a8bc3ff
...
...
@@ -224,6 +224,7 @@ public class FMRadioService extends Service
private
static
Object
mNotchFilterLock
=
new
Object
();
private
boolean
mFmA2dpDisabled
;
private
boolean
mEventReceived
=
false
;
public
FMRadioService
()
{
}
...
...
@@ -2124,6 +2125,27 @@ public class FMRadioService extends Service
misAnalogPathEnabled
=
analogMode
;
return
true
;
}
private
boolean
waitForEvent
()
{
boolean
status
=
false
;
synchronized
(
mEventWaitLock
)
{
Log
.
d
(
LOGTAG
,
"waiting for event"
);
try
{
if
(
mEventReceived
==
false
)
mEventWaitLock
.
wait
(
RADIO_TIMEOUT
);
if
(
mEventReceived
==
true
)
status
=
true
;
}
catch
(
IllegalMonitorStateException
e
)
{
Log
.
e
(
LOGTAG
,
"Exception caught while waiting for event"
);
e
.
printStackTrace
();
}
catch
(
InterruptedException
ex
)
{
Log
.
e
(
LOGTAG
,
"Exception caught while waiting for event"
);
ex
.
printStackTrace
();
}
}
return
status
;
}
/*
* Turn ON FM: Powers up FM hardware, and initializes the FM module
* .
...
...
@@ -2165,7 +2187,12 @@ public class FMRadioService extends Service
Log
.
d
(
LOGTAG
,
"fmOn: RdsStd :"
+
config
.
getRdsStd
());
Log
.
d
(
LOGTAG
,
"fmOn: LowerLimit :"
+
config
.
getLowerLimit
());
Log
.
d
(
LOGTAG
,
"fmOn: UpperLimit :"
+
config
.
getUpperLimit
());
mEventReceived
=
false
;
bStatus
=
mReceiver
.
enable
(
FmSharedPreferences
.
getFMConfiguration
(),
this
);
if
(
mReceiver
.
isCherokeeChip
())
{
bStatus
=
waitForEvent
();
}
if
(
isSpeakerEnabled
())
{
setAudioPath
(
false
);
}
else
{
...
...
@@ -2325,21 +2352,6 @@ public class FMRadioService extends Service
if
(
mReceiver
!=
null
)
{
bStatus
=
mReceiver
.
disable
(
this
);
if
(
bStatus
&&
(
mReceiver
.
getFMState
()
==
mReceiver
.
subPwrLevel_FMTurning_Off
))
{
synchronized
(
mEventWaitLock
)
{
Log
.
d
(
LOGTAG
,
"waiting for disable event"
);
try
{
mEventWaitLock
.
wait
(
RADIO_TIMEOUT
);
}
catch
(
IllegalMonitorStateException
e
)
{
Log
.
e
(
LOGTAG
,
"Exception caught while waiting for event"
);
e
.
printStackTrace
();
}
catch
(
InterruptedException
ex
)
{
Log
.
e
(
LOGTAG
,
"Exception caught while waiting for event"
);
ex
.
printStackTrace
();
}
}
}
mReceiver
=
null
;
}
fmOperationsOff
();
...
...
@@ -2362,21 +2374,11 @@ public class FMRadioService extends Service
// This will disable the FM radio device
if
(
mReceiver
!=
null
)
{
mEventReceived
=
false
;
bStatus
=
mReceiver
.
disable
(
this
);
if
(
bStatus
&&
(
mReceiver
.
getFMState
()
==
mReceiver
.
subPwrLevel_FMTurning_Off
))
{
synchronized
(
mEventWaitLock
)
{
Log
.
d
(
LOGTAG
,
"waiting for disable event"
);
try
{
mEventWaitLock
.
wait
(
RADIO_TIMEOUT
);
}
catch
(
IllegalMonitorStateException
e
)
{
Log
.
e
(
LOGTAG
,
"Exception caught while waiting for event"
);
e
.
printStackTrace
();
}
catch
(
InterruptedException
ex
)
{
Log
.
e
(
LOGTAG
,
"Exception caught while waiting for event"
);
ex
.
printStackTrace
();
}
}
bStatus
=
waitForEvent
();
}
mReceiver
=
null
;
}
...
...
@@ -3125,14 +3127,23 @@ public class FMRadioService extends Service
public
void
FmRxEvEnableReceiver
()
{
Log
.
d
(
LOGTAG
,
"FmRxEvEnableReceiver"
);
mReceiver
.
setRawRdsGrpMask
();
if
(
mReceiver
!=
null
&&
mReceiver
.
isCherokeeChip
())
{
synchronized
(
mEventWaitLock
)
{
mEventReceived
=
true
;
mEventWaitLock
.
notify
();
}
}
}
public
void
FmRxEvDisableReceiver
()
{
Log
.
d
(
LOGTAG
,
"FmRxEvDisableReceiver"
);
mFMOn
=
false
;
FmSharedPreferences
.
clearTags
();
synchronized
(
mEventWaitLock
)
{
mEventWaitLock
.
notify
();
if
(
mReceiver
!=
null
&&
mReceiver
.
isCherokeeChip
())
{
synchronized
(
mEventWaitLock
)
{
mEventReceived
=
true
;
mEventWaitLock
.
notify
();
}
}
}
public
void
FmRxEvRadioReset
()
...
...
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