Closed Bug 1156596 Opened 9 years ago Closed 9 years ago

[System] Support device type in base module

Categories

(Firefox OS Graveyard :: Gaia::TV::System, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: johnhu, Assigned: rickychien)

References

Details

Attachments

(1 file)

We already had device type information in system app. If a module has its owned sub-modules among different device types, the base module should have the ability to dynamic load the sub modules by device types.
Assignee: nobody → im
The proposal we have is:

*. change the SUB_MODULES variable from array to object, like:
   {
     'default': ['module1', 'module2'],
     'phone': ['module3'],
     'tv': ['moduletv']
   }

*. At _startSubModules, _initialSubModule, _stopSubModules, we only creates and calls |default| + |device typed|, like phone or tv, list.

*. If SUB_MODULES variable is still array, we view this array as 'phone' to be backward compatible.

*. File bugs to migrate all existing modules' SUB_MODULES from array to object.
I will take this back once I have time to work on it.
Assignee: im → nobody
Hey I'd like to take this when I feel free. I think it's a good starting point to learn about system app.
Assignee: nobody → rchien
Status: NEW → ASSIGNED
Comment on attachment 8633958 [details] [review]
[gaia] rickychien:basemodule > mozilla-b2g:master

Hey John, here my first patch for system app and please review it kindly.

1. To support a default and different device type for base_module, the new SUB_MODULES list would merge default type modules and a given device type modules. 

2. I also migrate all existing modules's SUB_MODULES from array to object.
Attachment #8633958 - Flags: review?(im)
Attachment #8633958 - Flags: feedback?(lchang)
(In reply to Ricky Chien [:rickychien] from comment #5)
> Comment on attachment 8633958 [details] [review]
> [gaia] rickychien:basemodule > mozilla-b2g:master
> 
> Hey John, here my first patch for system app and please review it kindly.
> 
> 1. To support a default and different device type for base_module, the new
> SUB_MODULES list would merge default type modules and a given device type
> modules. 
> 
> 2. I also migrate all existing modules's SUB_MODULES from array to object.

Ricky,

Thanks for this hard work. To prevent a big patch, we, alive and I, would like to see BaseModule to support fallback mechanism. Existing modules can use an object which implied to phone. If TV needs that module, we change should change that module to support device type. Please see comment 1.

BTW, we should email to dev-gaia to notify other devs this change.
Attachment #8633958 - Flags: review?(im)
Backward compatible mechanism is ready for review. I'm going to write a test and additional comments for this new feature before setting r?=johnhu.
Comment on attachment 8633958 [details] [review]
[gaia] rickychien:basemodule > mozilla-b2g:master

Done. Set review flag to johnhu.
Attachment #8633958 - Flags: review?(im)
Comment on attachment 8633958 [details] [review]
[gaia] rickychien:basemodule > mozilla-b2g:master

Looks good to me overall. But please revert the __DEVICE_TYPE__ part. We shouldn't use this variable at too many places. We should keep it only at feature_detector.js.
Attachment #8633958 - Flags: review?(im) → review+
Comment on attachment 8633958 [details] [review]
[gaia] rickychien:basemodule > mozilla-b2g:master

Nice work! :)
Attachment #8633958 - Flags: feedback?(lchang) → feedback+
Landed in master: https://github.com/mozilla-b2g/gaia/commit/b1ca30da064301abaa824cd2376227478ec15f41
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: