Closed Bug 940865 Opened 11 years ago Closed 6 years ago

[B2G][Helix][Booting][denghuachang]remove the battery during first booting, plug in the battery and power on again, device blocked on the third logo and can not enter FTU.

Categories

(Firefox OS Graveyard :: General, defect, P1)

ARM
Gonk (Firefox OS)
defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: lecky.wanglei, Unassigned)

Details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; aff-kingsoft-ciba; .NET4.0C; .NET4.0E; Tablet PC 2.0)

Steps to reproduce:

[reproduce step]
1. First booting, while the animation logo(second logo) appear, remove the battery.
2. plug in the battery and power on the device again. check whether device can enter UI successfully.

reset the device and repeat step 1 and 2.



Actual results:

[actual result]
device blocked on the third logo and can not enter FTU.

[probability]
5%


Expected results:

[expected result]
device can enter FTU and work well.

[Analyze]
when the issue happens, I check and find all the application file and directory(such as accuweather/facebook/twitter) exist under /data/local/webapps/, but their sizes are 0KB. and all the applications doesn't list in the webapps.json, maybe it has no time to sync and write the data to eMMC before power collapse.

I think the root reason is:
under gecko/dom/apps/src/AppUtils.jsm, about 423 line,  in the following function: 
isFirstRun: function isFirstRun(aPrefBranch)
it gets the value(gecko.mstone/gecko.buildID) to check whether it is first run, but set the value immediately, think the first boot is OK, regardless of whether the other operation is OK(such as copy application from system partition to data partion).
I think the correct code is: the function isFirstRun just use to check whether it is first run, don't change the value, and after we enter FTU, then change the value(gecko.mstone/gecko.buildID)  and then we can think First booting is OK.

please help to check it.

thanks
Severity: normal → blocker
OS: All → Gonk (Firefox OS)
Priority: -- → P1
Hardware: All → ARM
Flags: needinfo?(wchang)
(In reply to lecky from comment #0) 
> I think the root reason is:
> under gecko/dom/apps/src/AppUtils.jsm, about 423 line,  in the following
> function: 
> isFirstRun: function isFirstRun(aPrefBranch)
> it gets the value(gecko.mstone/gecko.buildID) to check whether it is first
> run, but set the value immediately, think the first boot is OK, regardless
> of whether the other operation is OK(such as copy application from system
> partition to data partion).
> I think the correct code is: the function isFirstRun just use to check
> whether it is first run, don't change the value, and after we enter FTU,
> then change the value(gecko.mstone/gecko.buildID)  and then we can think
> First booting is OK.
> 
> please help to check it.
> 
> thanks

Feel free to provide your suggested changes here and we'll have someone to review and work with you on that. But given the malicious STR attempts we will not block on this for now.

cc'ing people that may be interested in this bug.
Flags: needinfo?(wchang)
1.first time power on the device, create a flag to save the state.
gecko\extensions\cookie\nsPermissionManager.cpp
nsresult
nsPermissionManager::CreateTable()
{
  // set the schema version, before creating the table
  nsresult rv = mDBConn->SetSchemaVersion(HOSTS_SCHEMA_VERSION);
  if (NS_FAILED(rv)) return rv;
  
+  nsCOMPtr<nsIPrefBranch> prefs; 
+  nsCOMPtr<nsIPrefService> pserve(do_GetService(NS_PREFSERVICE_CONTRACTID)); 
+  if (pserve) 
+    pserve->GetBranch("", getter_AddRefs(prefs)); 
+  if (prefs) 
+    prefs->SetBoolPref("gecko.permLoaded", false); 

2. both check the flag and runUpdate to judge whether it is first time power on.
gecko\dom\apps\src\Webapps.jsm
  loadAndUpdateApps: function loadAndUpdateApps() {
    let runUpdate = AppsUtils.isFirstRun(Services.prefs);
+    let permLoaded = null; 
+    try { 
+      permLoaded = Services.prefs.getBoolPref("gecko.permLoaded"); 
+    } 
+    catch(e) {} 
+    runUpdate = (runUpdate || (true != permLoaded)); 

3.after system boot completed, set the flag to true, and think the first time power on is successful.
gecko\b2g\chrome\content\shell.js   in the function  handleEvent: function shell_handleEvent(evt)
#ifdef MOZ_WIDGET_GONK
          libcutils.property_set('sys.boot_completed', '1');
+          let permLoaded = null; 
+          try { 
+            permLoaded = Services.prefs.getBoolPref("gecko.permLoaded"); 
+          } 
+          catch(e) { }
+          if(true != permLoaded)
+          {
+            Services.prefs.setBoolPref("gecko.permLoaded", true); 
+          }
#endif


please help to review the modification.
thanks
Firefox OS is not being worked on
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.