function regulateApplications(t, regulation)
for k,v in pairs(ft(t)) do
- -- iterate through the undefined and entertainment apps, see if
- -- they have been overruled in local config
+ whitelisted = false
+ -- our local application config, which takes precedence
local conf = getApplication(v.appid)
- if conf and conf.resource_class ~= "player" then
+ if conf then
+ if conf.resource_class ~= "player" then
+ whitelisted = true
+ end
+
+ if conf.requisites and conf.requisites.screen then
+ if conf.requisites.screen.driving then
+ whitelisted = true
+ end
+ end
+ end
+
+ if whitelisted then
-- override, don't disable
resmgr:disable_screen_by_appid("*", "*", v.appid, false, false)
else
-- our local application config, which takes precedence
local conf = getApplication(ev.appid)
- -- disable only non-whitelisted applications
- if not conf or conf.resource_class == "player" then
- if blacklisted then
- if verbose > 0 then
- print("disabling screen for " .. ev.appid)
+ if not conf then
+ blacklisted = true
+ else
+ if conf.resource_class == "player" then
+ blacklisted = true
+ end
+
+ -- check the exceptions
+ if conf.requisites and conf.requisites.screen then
+ if conf.requisites.screen.driving then
+ blacklisted = false
end
- resmgr:disable_screen_by_appid("*", "*", ev.appid, true, true)
end
end
+
+ -- disable only non-whitelisted applications
+ if blacklisted then
+ if verbose > 0 then
+ print("disabling screen for " .. ev.appid)
+ end
+ resmgr:disable_screen_by_appid("*", "*", ev.appid, true, true)
+ end
end
elseif event == "destroy" then
if s == "system" then
local a = animation({})
local r = m:JSON({surface = win.surface,
- visible = 1,
+ visible = 0,
raise = 1})
self:window_request(r,a,0)
else
area = "Center.Full",
privileges = { screen = "none", audio = "none" },
resource_class = "system",
+ requisites = { screen = "driving", audio = "none" },
screen_priority = 30
}
+application {
+ appid = "MediaPlayer",
+ area = "Center.Full",
+ privileges = { screen = "none", audio = "none" },
+ requisites = { screen = "driving", audio = "none" },
+ resource_class = "player",
+ screen_priority = 0
+}
+
+application {
+ appid = "MyMediaPlayer",
+ area = "Center.Full",
+ privileges = { screen = "none", audio = "none" },
+ requisites = { screen = "driving", audio = "none" },
+ resource_class = "player",
+ screen_priority = 0
+}
+
+application {
+ appid = "MeterWidget",
+ area = "Center.Full",
+ privileges = { screen = "none", audio = "none" },
+ requisites = { screen = "driving", audio = "none" },
+ resource_class = "player",
+ screen_priority = 0
+}
+
+application {
+ appid = "org.tizen.ico.app-soundsample",
+ area = "Center.Full",
+ privileges = { screen = "none", audio = "none" },
+ -- uncomment the next line to make the app exempt from regulation
+ -- requisites = { screen = "driving", audio = "none" },
+ resource_class = "player",
+ screen_priority = 0
+}
+
+
if sc then
sc.client_handler = function (self, cid, msg)
local command = msg.command
local time = 200
if msg.arg.anim_time then
local t = msg.arg.anim_time
+ -- the actual time for the animation
time = m:AND(t, time_mask)
- nores = not m:AND(t, nores_mask)
+ -- flag for ignoring resource control
+ nores = m:AND(t, nores_mask)
if m:AND(t, raise_mask) then
msg.arg.raise = 1
elseif m:AND(t, lower_mask) then
local time = 200
if msg.arg.anim_time then
local t = msg.arg.anim_time
+ -- the actual time for the animation
time = m:AND(t, time_mask)
- nores = not m:AND(t, nores_mask)
+ -- flag for ignoring resource control
+ nores = m:AND(t, nores_mask)
end
if msg.arg.anim_name then
a.hide = { msg.arg.anim_name, time }
elseif msg.res.input then
key = msg.res.input.name
elseif msg.res.window then
+ -- alarm! this appars to be non-unique?
key = msg.res.window.resourceId
end
end
end
createResourceSet = function (ctl, client, msg)
- cb = function(rset, data)
+ cb = function(rset)
-- m:info("*** resource_cb: client = '" .. msg.appid .. "'")
requestType = msg.res.type
end
- if data.filter_first then
- data.filter_first = false
+ if rset.data.filter_first then
+ rset.data.filter_first = false
return
end
rset.timer = m:Timer({
interval = 5000,
oneshot = true,
- callback = function (t, data)
- m:info("notification resource set timer expired")
+ callback = function (t)
+ m:info("notification timer expired")
- -- destroy the internal resource set
+ if rset.data then
+ reply.res.window = rset.data.window
+ end
- rset:destroy()
+ rset:release()
+ rset.timer = nil
-- Send a "RELEASE" message to client.
-- This triggers the resource deletion
}
})
- if rset.data.window then
- reply.res.window = rset.data.window
- end
-
sc:send_message(client, reply)
end
})
else
cmd = 0x00040002 -- release
if rset.timer then
- rset.timer.cb = nil
+ rset.timer.callback = nil
+ rset.timer = nil
end
end
end
end
- rset = m:ResourceSet({
+ local rset = m:ResourceSet({
application_class = "player",
zone = "driver", -- msg.zone ("full")
callback = cb
if not sets.cid then
sets.cid = {}
end
- sets.cid.key = createResourceSet(self, cid, msg)
+ sets.cid[key] = createResourceSet(self, cid, msg)
end
elseif msg.command == 0x40012 then -- destroy_res
if key then
if sets.cid and sets.cid[key] then
sets.cid[key]:release()
+ sets.cid[key].timer = nil
sets.cid[key] = nil -- garbage collecting
end
end
key = getKey(msg)
if key then
- print("key is " .. tostring(key))
if not sets.cid then
sets.cid = {}
end
if not sets.cid[key] then
- print("creating a resource set")
sets.cid[key] = createResourceSet(self, cid, msg)
end
print("acquiring the resource set")
if key then
if sets.cid and sets.cid[key] then
sets.cid[key]:release()
- end
- if msg.appid == onscreen then
- -- in case of OnScreen, this actually means that the
- -- resource set is never used again; let gc do its job
- if sets.cid and sets.cid[key] then
+ if msg.appid == onscreen then
+ -- in case of OnScreen, this actually means that the
+ -- resource set is never used again; let gc do its job
+ sets.cid[key].timer = nil
sets.cid[key] = nil -- garbage collecting
end
end
-
end
-
elseif msg.command == 0x40003 then -- deprive_res
print("command DEPRIVE_RES")