Closed Bug 1035383 Opened 10 years ago Closed 10 years ago

[B2G][Camera] The user is able to use the camera when battery is below 5%

Categories

(Firefox OS Graveyard :: Gaia::Camera, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(blocking-b2g:2.0+, b2g-v1.4 unaffected, b2g-v2.0 verified, b2g-v2.1 verified)

VERIFIED FIXED
2.0 S6 (18july)
blocking-b2g 2.0+
Tracking Status
b2g-v1.4 --- unaffected
b2g-v2.0 --- verified
b2g-v2.1 --- verified

People

(Reporter: dharris, Assigned: dmarcos)

References

()

Details

(Keywords: regression, Whiteboard: LocRun2.0)

Attachments

(3 files)

Attached file Battery Life.txt
Description:
The user is able to use the camera no matter how much battery life is left on the phone

Prerequsite: DUT has less than 5% battery life

Repro Steps:
1) Update a Flame to Build ID: 20140707000200
2) Open Camera app

Actual:
No warning saying "The battery is too low to use the camera." appears

Expected:
The user is unable to use the camera and "The battery is too low to use the camera." warning message appears

Flame 2.0

Environmental Variables:
Device: Flame 2.0
Build ID: 20140707000200
Gaia: ef67af27dff3130d41a9139d6ae7ed640c34d922
Gecko: f53099796238
Version: 32.0a2 (2.0) 
Firmware Version: v122
User Agent: Mozilla/5.0 (Mobile; rv:32.0) Gecko/32.0 Firefox/32.0

Keywords: Battery, Percentage, Low, Less than, Below, Camera, Video, Media

Repro frequency: 100%
Link to failed test case: https://moztrap.mozilla.org/manage/case/12703/
See attached: Logcat, Video - http://youtu.be/Ctf4INrq0Sc
This issue DOES occur on Flame 2.1, and Buri 2.1

Flame 2.1

Environmental Variables:
Device: Flame Master
Build ID: 20140707040201
Gaia: 93daa354671a698634a3dc661c8c9dcb7d824c31
Gecko: 1dc6b294800d
Version: 33.0a1 (Master) 
Firmware Version: v122
User Agent: Mozilla/5.0 (Mobile; rv:33.0) Gecko/33.0 Firefox/33.0

Buri 2.1

Environmental Variables:
Device: Buri 2.1
Build ID: 20140707040201
Gaia: 93daa354671a698634a3dc661c8c9dcb7d824c31
Gecko: 1dc6b294800d
Version: 33.0a1  
Firmware Version: v1.2device.cfg

User agent: Mozilla/5.0 (Mobile; rv:33.0) Gecko/33.0 Firefox/33.0

This issue does NOT occur on Flame 1.4, or Buri 1.4

Flame 1.4

Environmental Variables:
Device: Flame 1.4
Build ID: 20140707000200
Gaia: 5c9e1e4131d3ac8915ed88b72bb66dc7d97be6a0
Gecko: 2d0c15450488
Version: 30.0 (1.4) 
Firmware Version: v122
User Agent: Mozilla/5.0 (Mobile; rv:30.0) Gecko/30.0 Firefox/30.0 

Buri 1.4

Environmental Variables:
Device: Buri 1.4
Build ID: 20140707000200
Gaia: 5c9e1e4131d3ac8915ed88b72bb66dc7d97be6a0
Gecko: 2d0c15450488
Version: 30.0 (1.4) 
Firmware Version: v1.2device.cfg
User Agent: Mozilla/5.0 (Mobile; rv:30.0) Gecko/30.0 Firefox/30.0
QA Whiteboard: [QAnalyst-Triage?]
Flags: needinfo?(ktucker)
The warning message saying "10% battery remaining" when opening the camera app at 10% battery life does not show up either. Only an icon with a battery at low life appears on the left side of the screen
Keywords: regression
Nominating this 2.0? since this a regression from 1.4. This could lead to end user frustration when their battery dies while recording a video. 

These scenarios were stated in Bug 966841 which was resolved fixed.
blocking-b2g: --- → 2.0?
QA Whiteboard: [QAnalyst-Triage?]
Flags: needinfo?(ktucker)
Flags: needinfo?(jdarcangelo)
Diego/Wilson - Can one of you help investigate this one?
Flags: needinfo?(wilsonpage)
Flags: needinfo?(jdarcangelo)
Flags: needinfo?(dmarcos)
Assignee: nobody → dmarcos
Flags: needinfo?(dmarcos)
Everything is wired up properly and we actually attempt to display the low battery message that would prevent the user to operate the camera. We have an orchestration problem. This is why the message is not showing up:

1. To speedup camera startup (tap to photo time) we're lazy loading some of the modules. i10n and the battery module are among them.
2. The battery module properly triggers an event that indicates very low battery at camera startup
3. The event is received by the overlay module to display the appropriate message.
4. Overlay fails to display the message because i10n module is not loaded. 

First approach to a solution (PR attached):

1. I load i10n module before the battery module.
2. When battery triggers its event the i10n is ready and the low battery message is rendered.

Problems: 

1. i10n has itself parts that are asynchronously loaded. Loading i10n before battery does not guarantee that the module is going to be ready when overlay needs to display a message.
2. By lazy loading battery and i10n modules we are delaying the battery level check until the preview is ready. In slow phones (like Hamachi) the camera is usable for several seconds before displaying the low battery message. This results on the user being able to take pictures or videos in low battery conditions.

We need to find a way to orchestrate the initialization without affecting the critical path.
Attached file Pull Request
The PR is not meant to be merged. It just illustrates the problem.
Attachment #8452789 - Flags: feedback?(wilsonpage)
Regression from 1.4 and if battery low warning is not seen, user will certainly be frustrating when shooting important videos. The message lets the user power up the device.
blocking-b2g: 2.0? → 2.0+
Attachment #8452789 - Flags: feedback?(wilsonpage)
Comment on attachment 8452789 [details] [review]
Pull Request

New PR. Still not ready but making progress towards the solution:

- Battery module is part of the critical path so we can show the overlay as fast as possible.
- It displays a spinner before i10n is ready to prevent the user operate the camera.
- We display the localized overlay once i10n is ready. On hamachi i10n takes > 1 seconds to emit the localized event. 

The PR emulates low battery conditions and there's logging to measure i10n loading times (adb logcat | grep i10n)
Attachment #8452789 - Flags: feedback?(wilsonpage)
Comment on attachment 8452789 [details] [review]
Pull Request

Overall looks good!

- Some code comments left in Github.
- Unrelated, but there is a quick flicker before the overlay background loads in. Ideally we should use CSS gradients for this and ditch the PNGs. Or alternatively if there is a way to preload the PNG, that might help. Any ideas? It looks pretty shitty ATM.
Attachment #8452789 - Flags: feedback?(wilsonpage) → feedback+
Flags: needinfo?(wilsonpage)
Attachment #8452789 - Flags: review?(jdarcangelo)
Comment on attachment 8452789 [details] [review]
Pull Request

looks good! land it!
Attachment #8452789 - Flags: review?(jdarcangelo) → review+
Landed on master:

https://github.com/mozilla-b2g/gaia/commit/913056a1580bb802d5bf6efe2fa0fdf206ba67c0
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
issue was fixed before anyone got to the regression-window, removing that tag now.
Attached video video
This issue has been verified successfully on Flame 2.0 and 2.1.
When device has 5% battery life or less than 5% battery life, launch camera, the "The battery is too low to use the camera.” warning message can appears
See attachment: Verify_1035383.MP4
Reproducing rate: 0/5

Flame2.0 build:
Gaia-Rev        856863962362030174bae4e03d59c3ebbc182473
Gecko-Rev       https://hg.mozilla.org/releases/mozilla-b2g32_v2_0/rev/e40fe21e37f1
Build-ID        20141207000206
Version         32.0

Flame2.1 build:
Gaia-Rev        38e17b0219cbc50a4ad6f51101898f89e513a552
Gecko-Rev       https://hg.mozilla.org/releases/mozilla-b2g34_v2_1/rev/8b92c4b8f59a
Build-ID        20141205001201
Version         34.0
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: