RestrictedProfiles.isUserRestricted() always returns true on phone running Android M

RESOLVED FIXED in Firefox 42

Status

()

defect
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: sebastian, Assigned: sebastian)

Tracking

(Blocks 1 bug)

Trunk
Firefox 42
All
Android
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox42 fixed)

Details

Attachments

(1 attachment)

On my Nexus 5 running Android M preview RestrictedProfiles.isUserRestricted() always returns true. Therefore all the KidFox restrictions (bug 1125984) are automatically applied.
We determine whether a user is restricted by asking Android's UserManager for restrictions and then check if the bundle is empty or not. On my phone there's one restriction in the bundle:

> no_record_audio = false

This restriction is not documented up to Android 5.1.1_r6.

Comment 2

4 years ago
(In reply to :Sebastian Kaspari from comment #0)
> On my Nexus 5 running Android M preview
> RestrictedProfiles.isUserRestricted() always returns true. Therefore all the
> KidFox restrictions (bug 1125984) are automatically applied.

Thanks for the information!
So if you are in an Android restricted profile, Firefox automatically goes into kidfox mode?

I thought it'd be the same as creating a guest-mode session (Tool -> New Guest Session)?

Comment 3

4 years ago
(In reply to :Sebastian Kaspari from comment #1)
> We determine whether a user is restricted by asking Android's UserManager
> for restrictions and then check if the bundle is empty or not. On my phone
> there's one restriction in the bundle:
> 
> > no_record_audio = false
> 
> This restriction is not documented up to Android 5.1.1_r6.

The Kidfox is currently focused to run on Android tablet, so I'm not sure how different it will be on a phone. Please keep me updated :)
(In reply to Sam Fang [:sfang] from comment #2)
> So if you are in an Android restricted profile, Firefox automatically goes
> into kidfox mode?

Exactly. That's how I understand the goal for v1.

(In reply to Sam Fang [:sfang] from comment #2)
> I thought it'd be the same as creating a guest-mode session (Tool -> New
> Guest Session)?

That's something we can think of for a future iteration, e.g. v2. Having a restricted session in Firefox only will require some further evaluation how we'll handle profile switching and such cases. In general we will not be able to enforce a kid-friendly environment if the system itself is not restricted.

> The Kidfox is currently focused to run on Android tablet, so I'm not sure
> how different it will be on a phone. Please keep me updated :)

Yeah, this here is definitely a bug. I just don't know yet if this restriction on my phone is a bug in the Android M preview image or if there actually can be some restrictions on phones. Then we'll have to change our code to reflect that.
Some ideas how to fix this:

* (1) If the bundle is not empty, loop over all the entries and if all the restrictions are off (false) then assume we are not a restricted profile.

* Or (2): If we announce our restrictions to the system (bug 1180653) and read them from UserManager then we can just go ahead and check what's in UserManager.getApplicationRestrictions() to determine if we are restricted somehow

* Or (3): Ideally we refactor our code to not rely on our isUserRestricted() method but instead just always ask for a specific restriction
This patch implements option 1 because option 2 needs more effort and will depend on bug 1180653. Option 3 will also need restrictions being stored in the UserManager -> bug 1180653.
Attachment #8631549 - Flags: review?(ally)
Status: NEW → ASSIGNED
Blocks: 1125312
please be sure to file a bug for option 2 so it doesn't get lost in the noise, and make sure it gets attached to the phase 2 tracking bug that we talked about in todays cross team meeting.
Comment on attachment 8631549 [details] [diff] [review]
1181660_kidfox_isUserRestricted.patch

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

see previous comment for filing bugs to get a better long term solution.
Attachment #8631549 - Flags: review?(ally) → review+
url:        https://hg.mozilla.org/integration/fx-team/rev/ae59ec951b241feb27d83e2ac277f03f6c071dcf
changeset:  ae59ec951b241feb27d83e2ac277f03f6c071dcf
user:       Sebastian Kaspari <s.kaspari@gmail.com>
date:       Wed Jul 15 13:14:14 2015 +0200
description:
Bug 1181660 - Restricted profiles: At least one restriction has to be enabled in order to be a restricted profile. r=ally
Blocks: 1184064
https://hg.mozilla.org/mozilla-central/rev/ae59ec951b24
Status: ASSIGNED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 42
See Also: → 1213921
You need to log in before you can comment on or make changes to this bug.