Issue 2203: Provide blocklist and login type to Parental Control
Description
Provide login type and blocklist of already installed apps, to Parental Control
Technical details
-
Content provider:
-
Login types:
UNAVAILABLE
,ANONYMOUS
,GOOGLE
,NO_GOOGLE
Uri for login type:content://foundation.e.apps.provider/login_type
Column name in cursor:login_type
cursor.moveToFirst() val loginType = cursor.getString(cursor.getColumnIndexOrThrow("login_type"))
-
Blocklist: Cursor with each row having a package name (of already installed apps) that needs to be blocked based on the age set on Parental Control.
Uri for blocklist:content://foundation.e.apps.provider/block_list
Column name in cursor:package_name
val blocklist = mutableListOf<String>() while (cursor.moveToNext()) { val packageName = cursor.getString(cursor.getColumnIndexOrThrow("package_name")) blocklist.add(packageName) }
-
Manifest permission to access both:
<uses-permission android:name="foundation.e.apps.permission.PROVIDER_READ" />
-
-
Launch App Lounge to ask users to login with GPlay type
This MR also allows to pass an intent extra to launch App Lounge and logout if it is not using
ANONYMOUS
orGOOGLE
mode of login and ask user to login again.val intent = packageManager.getLaunchIntentForPackage("foundation.e.apps")?.apply { flags = Intent.FLAG_ACTIVITY_SINGLE_TOP putExtra("request_gplay_login", true) } startActivity(intent)
-
Broadcast to Parental control once user logs in
- App Lounge will send a broadcast to Parental Control once the user logs in with a type of account.
Permission to be set in Parental Control manifest:<permission android:name="foundation.e.parentalcontrol.broadcast_permission"/>
- Action:
foundation.e.parentalcontrol.action.APP_LOUNGE_LOGIN
- Extra that defines the type of login:
login_type
Log.d("TAG", "Received login: ${intent?.extras?.getString("login_type")}")
- App Lounge will send a broadcast to Parental Control once the user logs in with a type of account.
We are also publishing a library named "ParentalControlData" so that the constants can be shared. The library can be found here: https://gitlab.e.foundation/e/os/apps/-/packages
A detailed implementation of using these content providers can be found here: https://gitlab.e.foundation/e/os/provider-tester
Issues
https://gitlab.e.foundation/e/os/backlog/-/issues/2203
10 commandments of code reviews
Summary by CodeRabbit
-
New Features
- Introduced a new
ContentProvider
class to handle queries for login types and age ratings of apps. - Added a new job
publish-contracts
in GitLab CI for publishing contracts. - Added Google Play login request handling in the app.
- Introduced a new
-
Updates
- Updated various permissions and configurations in AndroidManifest files.
- Updated dependencies and build configurations in
build.gradle
files. - Updated logic for content rating validation and age limit checks.
-
Bug Fixes
- Replaced outdated annotations and imports to improve functionality and compatibility.
-
Chores
- Added
.gitignore
rules for new directories. - Included
parental_control_data
module in the project settings.
- Added