Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0dabc23a authored by Xiaomiao Zhang's avatar Xiaomiao Zhang
Browse files

Implement Web content filters entry point in Supervision Settings dashboard.

Test: atest SupervisionWebContentFiltersScreenTest
Bug: 395134536
Flag:android.app.supervision.flags.enable_web_content_filters_screen
Change-Id: I5471d8b2956e94b0120ae13bec6187065a5e738a
parent ed15a107
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
<!--
Copyright (C) 2025 The Android Open Source Project

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="960"
    android:viewportHeight="960"
    android:tint="?android:attr/colorControlNormal">
    <path
        android:fillColor="@android:color/white"
        android:pathData="M480,880Q397,880 324,848.5Q251,817 197,763Q143,709 111.5,636Q80,563 80,480Q80,397 111.5,324Q143,251 197,197Q251,143 324,111.5Q397,80 480,80Q563,80 636,111.5Q709,143 763,197Q817,251 848.5,324Q880,397 880,480Q880,563 848.5,636Q817,709 763,763Q709,817 636,848.5Q563,880 480,880ZM480,800Q614,800 707,707Q800,614 800,480Q800,473 799.5,465.5Q799,458 799,453Q794,482 772,501Q750,520 720,520L640,520Q607,520 583.5,496.5Q560,473 560,440L560,400L400,400L400,320Q400,287 423.5,263.5Q447,240 480,240L520,240L520,240Q520,217 532.5,199.5Q545,182 563,171Q543,166 522.5,163Q502,160 480,160Q346,160 253,253Q160,346 160,480Q160,480 160,480Q160,480 160,480L360,480Q426,480 473,527Q520,574 520,640L520,680L400,680L400,790Q420,795 439.5,797.5Q459,800 480,800Z"/>
</vector>
 No newline at end of file
+2 −0
Original line number Diff line number Diff line
@@ -14253,4 +14253,6 @@ Data usage charges may apply.</string>
    <string name="supervision_change_pin_preference_title">Change PIN</string>
    <!-- Title for supervision forgot PIN setting entry [CHAR LIMIT=60] -->
    <string name="supervision_add_forgot_pin_preference_title">Forgot PIN</string>
    <!-- Title for web content filters entry [CHAR LIMIT=60] -->
    <string name="supervision_web_content_filters_title">Web content filters</string>
</resources>
+1 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ class SupervisionDashboardScreen : PreferenceScreenCreator {
        preferenceHierarchy(context, this) {
            +SupervisionMainSwitchPreference()
            +TitlelessPreferenceGroup(SUPERVISION_DYNAMIC_GROUP_1) += {
                // Empty category for dynamic injection targeting.
                +SupervisionWebContentFiltersScreen.KEY
            }
            +SupervisionPinManagementScreen.KEY
        }
+30 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.android.settings.supervision

import android.content.Context
import com.android.settingslib.preference.PreferenceFragment

/**
 * Fragment to display the Supervision web content filters page (Settings > Supervision> Web content
 * filters).
 *
 * See [SupervisionWebContentFiltersScreen] for details on the page contents.
 */
class SupervisionWebContentFiltersFragment : PreferenceFragment() {
    override fun getPreferenceScreenBindingKey(context: Context) =
        SupervisionWebContentFiltersScreen.KEY
}
+50 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.android.settings.supervision

import android.app.supervision.flags.Flags
import android.content.Context
import com.android.settings.R
import com.android.settingslib.metadata.ProvidePreferenceScreen
import com.android.settingslib.metadata.preferenceHierarchy
import com.android.settingslib.preference.PreferenceScreenCreator

/** Web content filters landing page (Settings > Supervision > Web content filters). */
@ProvidePreferenceScreen(SupervisionWebContentFiltersScreen.KEY)
class SupervisionWebContentFiltersScreen : PreferenceScreenCreator {
    override fun isFlagEnabled(context: Context) = Flags.enableWebContentFiltersScreen()

    override val key: String
        get() = KEY

    override val title: Int
        get() = R.string.supervision_web_content_filters_title

    // TODO(b/395134536) update the summary once the string is finalized.
    override val icon: Int
        get() = R.drawable.ic_globe

    override fun fragmentClass() = SupervisionWebContentFiltersFragment::class.java

    override fun getPreferenceHierarchy(context: Context) =
        preferenceHierarchy(context, this) {
            // TODO(b/395134536) implement the screen.
        }

    companion object {
        const val KEY = "supervision_web_content_filters"
    }
}
Loading