Closed Bug 935802 Opened 11 years ago Closed 10 years ago

[fugu]no stk entry in the settings app

Categories

(Firefox OS Graveyard :: Vendcom, defect)

ARM
Other
defect
Not set
major

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 906164

People

(Reporter: ming.li, Unassigned)

Details

Attachments

(2 files)

We ofen found that the stk menu was not setup.
After tracking some logs, i found there is a bug can cause this issue.

Briefly, system/js/icc.js registerd to receive the  broadcast msg of “icc-stkcommand" after the system is ready.
Actually, after these events: "webapps-registry-ready" and "system-message-listener-ready".

See into icc.js ,it's obviously that the problem is we registe the handler of msg of "icc-stkcommand" within a asynchronous callback in "clearcache".
Refered to hamachi ,modem side will report the UNSOLICITED_STK_PROACTIVE_COMMAND for many times util there is a response.
But for fugu , it seems the modem is always waiting for the response of the first command of UNSOLICITED_STK_PROACTIVE_COMMAND .


I sugguest that the system/icc.js need to be changed to make sure all the  icc-stkcommand be received.
So for fugu , if the sim is locked by pin , after reboot, enter the pin , all things are right ,because the stkcommand is delayed.
can i change the code in icc.init as below?
    this.clearMenuCache(function() {
	console.log("clearMenuCache done");
    });
    window.navigator.mozSetMessageHandler('icc-stkcommand',
        function callHandleSTKCommand(message) {
        self.handleSTKCommand(message);
    });


Will it cause any problem?
ni? for fesela as he's the owner in STK app.
Flags: needinfo?(frsela)
(In reply to Ming from comment #3)
Maybe we can delay the action of clearMenuCache 

like this:
	window.navigator.mozSetMessageHandler('icc-stkcommand',
	function callHandleSTKCommand(message) {
	  self.needClearCache = false;
	  self.handleSTKCommand(message);
	});
	setTimeout(function(){
		if (self.needClearCache) {
			this.clearMenuCache(function(){});
		}
	},1000);
Attachment #828477 - Flags: review?(frsela)
Comment on attachment 828477 [details] [diff] [review]
0001-bug-234341-no-stk-entry-in-the-settings.patch

Review of attachment 828477 [details] [diff] [review]:
-----------------------------------------------------------------

obsolete
Attachment #828477 - Flags: review?(frsela) → review-
Attachment #828484 - Flags: review?(frsela)
Comment on attachment 828484 [details] [diff] [review]
0001-bug-234341-no-stk-entry-in-the-settings.patch

For Gaia you need to go through Pull Request from github.

Also now Bugzilla has intergrated with github.

see http://globau.wordpress.com/2013/10/21/github-pull-requests-and-bugzilla/
Attachment #828484 - Flags: review?(frsela)
(In reply to Yoshi Huang[:allstars.chh][:yoshi] from comment #4)
> ni? for fesela as he's the owner in STK app.

Hi, this code is to remove STK menu entry before receiving any STK command.

A better solution is to check if the SIM was changed (based on ICC or similar) and avoid remove it if the SIM wasn't changed.

Currently we allways remove it and wait for the menu given by the STK app.
Flags: needinfo?(frsela)
Comment on attachment 828477 [details] [diff] [review]
0001-bug-234341-no-stk-entry-in-the-settings.patch

Review of attachment 828477 [details] [diff] [review]:
-----------------------------------------------------------------

As Yoshi told before, Gaia is reviewed as PR in github.

Anyway, some little comments...

::: apps/system/js/icc.js
@@ +19,5 @@
> +      // window.navigator.mozSetMessageHandler('icc-stkcommand',
> +        // function callHandleSTKCommand(message) {
> +          // self.handleSTKCommand(message);
> +        // });
> +    // });

Remove dead code

@@ +30,5 @@
>  
> +    setTimeout(function() {
> +        if (self.needClearCache) {
> +            this.clearMenuCache(function() {});
> +    },1000);

When needClearCache is enabled? Where is it defined?

Did you test race condition cases?

Also, if you receive the Apps menu and the the clearMenuChache is launched it'll remove the just received message... check this corner cases
A question, Is this bug the same as this other one?

https://bugzilla.mozilla.org/show_bug.cgi?id=907628
Flags: needinfo?(ming.li)
(In reply to Fernando R. Sela (no CC, needinfo please) [:frsela] from comment #12)
> A question, Is this bug the same as this other one?
> 
> https://bugzilla.mozilla.org/show_bug.cgi?id=907628

Also take a look at this other bug:

https://bugzilla.mozilla.org/show_bug.cgi?id=898699

and a WIP patch proposal (not landed):

https://github.com/mozilla-b2g/gaia/pull/11711/files
(In reply to Fernando R. Sela (no CC, needinfo please) [:frsela] from comment #12)
> A question, Is this bug the same as this other one?
> https://bugzilla.mozilla.org/show_bug.cgi?id=907628

Yes, they seems to be same.  But at last ,it suggest turn to bug 93385.
I couldn't find a solution for the problem of system/icc.js.

The rootcause is asynchronous callback  in it,not in the settings app. 

If modem side isn't stronger like qcom ,who sends the RIL_UNSOL_STK_PROACTIVE_COMMAND for many times,  this always be a problem.

Thanks very much!
(In reply to Fernando R. Sela (no CC, needinfo please) [:frsela] from comment #11)
When needClearCache is enabled? Where is it defined?

Did you
> test race condition cases?

Also, if you receive the Apps menu and the the
> clearMenuChache is launched it'll remove the just received message... check
> this corner cases

Sorry .
1. I added the definiton later in the update patch. But i forget to obsolete the old one.

2. I didn't test the race condition case.

3. In icc.init ,if the stkcommand comes first , then the clearMenuChache will have no chance to run.
Flags: needinfo?(ming.li)
(In reply to Ming from comment #3)
> can i change the code in icc.init as below?
   
> this.clearMenuCache(function() {
	console.log("clearMenuCache done");
   
> });
    window.navigator.mozSetMessageHandler('icc-stkcommand',
       
> function callHandleSTKCommand(message) {
       
> self.handleSTKCommand(message);
    });


It seems this is enough. It seems that multi calls to mozSettings.createLock.set/get will be executed in the order they calls .

Is there someone can verify this?
blocking-b2g: --- → koi?
mvines - comment 14 implies that this is a com ril bug. Can someone on your team look into this?

Removing koi? since this is a vendor bug.
blocking-b2g: koi? → ---
Component: RIL → Vendcom
Flags: needinfo?(mvines)
Whiteboard: [POVB]
Not much I can help with here unfortunately ;)
Flags: needinfo?(mvines)
Fernando - So I'm confused what to do with this bug. Is this technically a Gaia bug on our side? Or is this a bug in the vendor code? And is this a regression or not?
Flags: needinfo?(frsela)
Whiteboard: [POVB]
Joe, I wonder if this is 1.3+.
blocking-b2g: --- → 1.3?
Flags: needinfo?(kchang)
Flags: needinfo?(kchang)
(In reply to Jason Smith [:jsmith] from comment #19)
> Fernando - So I'm confused what to do with this bug. Is this technically a
> Gaia bug on our side? Or is this a bug in the vendor code? And is this a
> regression or not?

Hi Jason,

This is a race condition between the STK Cache management and the RIL sending the STK Main Menu command.

Currently we clean the cached STK menu each time we restart the device, after that we register for new STK Commands.

If the RIL sents the command before we register the callback, we lost it :(

Sometime ago we delayed the SIM initialization on gecko side to avoid these effects;

Now the suggested patch is to register the ICC callback as soon as possible, and start the cleaning process. If we receive the command before start cleaning, we avoid remove it.

Anyway, this patch can have another race conditions if the ICC message and clean timeout fires at the sametime. But since the SIM sents this message in a really early stage, we can "assure" that a second is enough to check cache cleaning ...
Flags: needinfo?(frsela)
Comment on attachment 828484 [details] [diff] [review]
0001-bug-234341-no-stk-entry-in-the-settings.patch

Review of attachment 828484 [details] [diff] [review]:
-----------------------------------------------------------------

::: apps/system/js/icc.js
@@ +20,5 @@
> +      // window.navigator.mozSetMessageHandler('icc-stkcommand',
> +        // function callHandleSTKCommand(message) {
> +          // self.handleSTKCommand(message);
> +        // });
> +    // });

Avoid dead code...
(In reply to Fernando R. Sela (no CC, needinfo please) [:frsela] from comment #21)
> we can "assure" that a second is enough to check cache
> cleaning ...

Can the cache clening be done ahead of the message of "webapps-registry-ready"?

if yes, it'll be ok.  As the delay the gecko side does.
James, do you want to submit another patch?
Flags: needinfo?(james.zhang)
(In reply to Steven Yang [:styang] from comment #24)
> James, do you want to submit another patch?

I suggest add sprd flag to support sprd modem behavior.
We need confirm the flag first, use 'moz.sprd.ril'?
Flags: needinfo?(james.zhang) → needinfo?(ming.li)
(In reply to James Zhang from comment #25)
> (In reply to Steven Yang [:styang] from comment #24)
> > James, do you want to submit another patch?
> 
> I suggest add sprd flag to support sprd modem behavior.
> We need confirm the flag first, use 'moz.sprd.ril'?
James, do you want to use this in RIL_worker.js? Or other files?
Flags: needinfo?(james.zhang)
(In reply to Ken Chang from comment #26)
> (In reply to James Zhang from comment #25)
> > (In reply to Steven Yang [:styang] from comment #24)
> > > James, do you want to submit another patch?
> > 
> > I suggest add sprd flag to support sprd modem behavior.
> > We need confirm the flag first, use 'moz.sprd.ril'?
> James, do you want to use this in RIL_worker.js? Or other files?

It's better in RIL_worker.js. We can try to use a meaningful name just like 'ro.moz.mute.call.to_ril'.
Flags: needinfo?(james.zhang)
(In reply to Ming from comment #23)
> (In reply to Fernando R. Sela (no CC, needinfo please) [:frsela] from
> comment #21)
> > we can "assure" that a second is enough to check cache
> > cleaning ...
> 
> Can the cache clening be done ahead of the message of
> "webapps-registry-ready"?
> 
> if yes, it'll be ok.  As the delay the gecko side does.

I think this is a reasonable solution ;)
(In reply to Fernando R. Sela (no CC, needinfo please) [:frsela] from comment #28)

> 
> I think this is a reasonable solution ;)

Will you take this bug?
blocking-b2g: 1.3? → fugu?
fugu master build has this bug as well.

Gaia      b411fd6c7d074ce4b4e8248e28981411a1420197
Gecko     c5fbc5c2efc86f33591a23b7e54c6ff4f1a472e0
BuildID   20131204140040
Version   28.0a1
(In reply to Enpei from comment #30)
> fugu master build has this bug as well.
> 
> Gaia      b411fd6c7d074ce4b4e8248e28981411a1420197
> Gecko     c5fbc5c2efc86f33591a23b7e54c6ff4f1a472e0
> BuildID   20131204140040
> Version   28.0a1
This build with sprd patch?

Steven, can you help to merge ming's patch to 1.2f?
Flags: needinfo?(styang)
Please make sure there's no other way out in short-term. Ken, comments?
Flags: needinfo?(styang) → needinfo?(kchang)
(In reply to Steven Yang [:styang] from comment #32)
> Please make sure there's no other way out in short-term. Ken, comments?
Another thought, I wonder if RILC could keep sending RIL_UNSOL_STK_PROACTIVE_COMMAND until RILC get a response from STK
app.
Flags: needinfo?(kchang)
(In reply to Ken Chang[:ken] from comment #33)

> Another thought, I wonder if RILC could keep sending
> RIL_UNSOL_STK_PROACTIVE_COMMAND until RILC get a response from STK
> app.


pls refer to comment 23 & 28 

I think that's the best way to fix this bug.
Flags: needinfo?(ming.li)
(In reply to Ming from comment #34)
> pls refer to comment 23 & 28 
> 
> I think that's the best way to fix this bug.
I wonder if a delay is a good solution. Since we never know what is the best delay time.
blocking-b2g: fugu? → ---
(In reply to Fernando R. Sela (no CC, needinfo please) [:frsela] from comment #21)
> (In reply to Jason Smith [:jsmith] from comment #19)
> > Fernando - So I'm confused what to do with this bug. Is this technically a
> > Gaia bug on our side? Or is this a bug in the vendor code? And is this a
> > regression or not?
> 
> Hi Jason,
> 
> This is a race condition between the STK Cache management and the RIL
> sending the STK Main Menu command.
> 
> Currently we clean the cached STK menu each time we restart the device,
> after that we register for new STK Commands.
> 
> If the RIL sents the command before we register the callback, we lost it :(
> 
> Sometime ago we delayed the SIM initialization on gecko side to avoid these
> effects;
> 
> Now the suggested patch is to register the ICC callback as soon as possible,
> and start the cleaning process. If we receive the command before start
> cleaning, we avoid remove it.
> 
> Anyway, this patch can have another race conditions if the ICC message and
> clean timeout fires at the sametime. But since the SIM sents this message in
> a really early stage, we can "assure" that a second is enough to check cache
> cleaning ...

It is a flaw in system message, will fix it in bug 906164.
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: