Loading AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -2806,7 +2806,7 @@ </activity> <activity android:name=".Settings$SupervisionDashboardActivity" android:name=".supervision.SupervisionDashboardActivity" android:label="@string/supervision_settings_title" android:exported="true" android:featureFlag="android.app.supervision.flags.enable_supervision_settings_screen"> Loading res/xml/top_level_settings_expressive.xml +0 −1 Original line number Diff line number Diff line Loading @@ -225,7 +225,6 @@ android:summary="@string/supervision_settings_summary" android:icon="@drawable/ic_homepage_supervision" android:order="5" android:fragment="com.android.settings.supervision.SupervisionDashboardFragment" settings:highlightableMenuKey="@string/menu_key_supervision" settings:controller="com.android.settings.supervision.TopLevelSupervisionPreferenceController"/> Loading src/com/android/settings/Settings.java +0 −1 Original line number Diff line number Diff line Loading @@ -564,5 +564,4 @@ public class Settings extends SettingsActivity { public static class MagnificationActivity extends SettingsActivity { /* empty */ } public static class FlashNotificationsActivity extends SettingsActivity { /* empty */ } public static class NotificationBundlesActivity extends SettingsActivity { /* empty */ } public static class SupervisionDashboardActivity extends SettingsActivity { /* empty */ } } src/com/android/settings/supervision/SupervisionDashboardActivity.kt 0 → 100644 +37 −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.Intent import android.os.Bundle import com.android.settings.SettingsActivity /** * Activity to display the Supervision settings landing page (Settings > Supervision). * * See [SupervisionDashboardScreen] for details on the page contents. */ class SupervisionDashboardActivity : SettingsActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) // TODO(b/418837620) Show a loading screen if supervision app with required component is not // present. } override fun getInitialFragmentName(intent: Intent): String = SupervisionDashboardFragment::class.java.name } src/com/android/settings/supervision/TopLevelSupervisionPreferenceController.kt +14 −14 Original line number Diff line number Diff line Loading @@ -25,28 +25,28 @@ import com.android.settings.core.BasePreferenceController import com.android.settings.supervision.ipc.SupervisionMessengerClient.Companion.SUPERVISION_MESSENGER_SERVICE_BIND_ACTION /** Controller for the top level Supervision settings Preference item. */ class TopLevelSupervisionPreferenceController( private val context: Context, private val key: String, ) : BasePreferenceController(context, key) { class TopLevelSupervisionPreferenceController(context: Context, key: String) : BasePreferenceController(context, key) { private val supervisionPackage = context.supervisionPackageName private var missingAppStoreLink = false private var redirectIntent: Intent? = null override fun handlePreferenceTreeClick(preference: Preference?): Boolean { if (preference?.key.equals(key) && redirectIntent != null) { context.startActivity(redirectIntent) override fun handlePreferenceTreeClick(preference: Preference): Boolean { if (preference.key == preferenceKey) { val intent = redirectIntent ?: Intent(mContext, SupervisionDashboardActivity::class.java) mContext.startActivity(intent) return true } return super.handlePreferenceTreeClick(preference) } override fun updateState(preference: Preference?) { override fun updateState(preference: Preference) { super.updateState(preference) if (!hasNecessarySupervisionComponent() && missingAppStoreLink) { preference?.isEnabled = false preference.isEnabled = false } } Loading @@ -56,10 +56,10 @@ class TopLevelSupervisionPreferenceController( // Try to navigate to app store if supervision app with necessary component is not installed if (!hasNecessarySupervisionComponent()) { val installerPackageName = getInstallerPackageName(context, supervisionPackage) val installerPackageName = getInstallerPackageName(mContext, supervisionPackage) val appStoreLinkIntent = installerPackageName?.let { getAppStoreLink(context, installerPackageName, supervisionPackage) getAppStoreLink(mContext, installerPackageName, supervisionPackage) } if (appStoreLinkIntent == null) { missingAppStoreLink = true Loading @@ -81,14 +81,14 @@ class TopLevelSupervisionPreferenceController( Intent(SUPERVISION_MESSENGER_SERVICE_BIND_ACTION).setPackage(supervisionPackage) return supervisionPackage != null && context.packageManager.queryIntentServices(intent, 0).isNotEmpty() mContext.packageManager.queryIntentServices(intent, 0).isNotEmpty() } private fun hasRedirect(): Boolean { val intent = Intent(SETTINGS_REDIRECT_ACTION).setPackage(supervisionPackage) return supervisionPackage != null && context.packageManager .queryIntentActivitiesAsUser(intent, 0, context.userId) mContext.packageManager .queryIntentActivitiesAsUser(intent, 0, mContext.userId) .isNotEmpty() } Loading Loading
AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -2806,7 +2806,7 @@ </activity> <activity android:name=".Settings$SupervisionDashboardActivity" android:name=".supervision.SupervisionDashboardActivity" android:label="@string/supervision_settings_title" android:exported="true" android:featureFlag="android.app.supervision.flags.enable_supervision_settings_screen"> Loading
res/xml/top_level_settings_expressive.xml +0 −1 Original line number Diff line number Diff line Loading @@ -225,7 +225,6 @@ android:summary="@string/supervision_settings_summary" android:icon="@drawable/ic_homepage_supervision" android:order="5" android:fragment="com.android.settings.supervision.SupervisionDashboardFragment" settings:highlightableMenuKey="@string/menu_key_supervision" settings:controller="com.android.settings.supervision.TopLevelSupervisionPreferenceController"/> Loading
src/com/android/settings/Settings.java +0 −1 Original line number Diff line number Diff line Loading @@ -564,5 +564,4 @@ public class Settings extends SettingsActivity { public static class MagnificationActivity extends SettingsActivity { /* empty */ } public static class FlashNotificationsActivity extends SettingsActivity { /* empty */ } public static class NotificationBundlesActivity extends SettingsActivity { /* empty */ } public static class SupervisionDashboardActivity extends SettingsActivity { /* empty */ } }
src/com/android/settings/supervision/SupervisionDashboardActivity.kt 0 → 100644 +37 −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.Intent import android.os.Bundle import com.android.settings.SettingsActivity /** * Activity to display the Supervision settings landing page (Settings > Supervision). * * See [SupervisionDashboardScreen] for details on the page contents. */ class SupervisionDashboardActivity : SettingsActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) // TODO(b/418837620) Show a loading screen if supervision app with required component is not // present. } override fun getInitialFragmentName(intent: Intent): String = SupervisionDashboardFragment::class.java.name }
src/com/android/settings/supervision/TopLevelSupervisionPreferenceController.kt +14 −14 Original line number Diff line number Diff line Loading @@ -25,28 +25,28 @@ import com.android.settings.core.BasePreferenceController import com.android.settings.supervision.ipc.SupervisionMessengerClient.Companion.SUPERVISION_MESSENGER_SERVICE_BIND_ACTION /** Controller for the top level Supervision settings Preference item. */ class TopLevelSupervisionPreferenceController( private val context: Context, private val key: String, ) : BasePreferenceController(context, key) { class TopLevelSupervisionPreferenceController(context: Context, key: String) : BasePreferenceController(context, key) { private val supervisionPackage = context.supervisionPackageName private var missingAppStoreLink = false private var redirectIntent: Intent? = null override fun handlePreferenceTreeClick(preference: Preference?): Boolean { if (preference?.key.equals(key) && redirectIntent != null) { context.startActivity(redirectIntent) override fun handlePreferenceTreeClick(preference: Preference): Boolean { if (preference.key == preferenceKey) { val intent = redirectIntent ?: Intent(mContext, SupervisionDashboardActivity::class.java) mContext.startActivity(intent) return true } return super.handlePreferenceTreeClick(preference) } override fun updateState(preference: Preference?) { override fun updateState(preference: Preference) { super.updateState(preference) if (!hasNecessarySupervisionComponent() && missingAppStoreLink) { preference?.isEnabled = false preference.isEnabled = false } } Loading @@ -56,10 +56,10 @@ class TopLevelSupervisionPreferenceController( // Try to navigate to app store if supervision app with necessary component is not installed if (!hasNecessarySupervisionComponent()) { val installerPackageName = getInstallerPackageName(context, supervisionPackage) val installerPackageName = getInstallerPackageName(mContext, supervisionPackage) val appStoreLinkIntent = installerPackageName?.let { getAppStoreLink(context, installerPackageName, supervisionPackage) getAppStoreLink(mContext, installerPackageName, supervisionPackage) } if (appStoreLinkIntent == null) { missingAppStoreLink = true Loading @@ -81,14 +81,14 @@ class TopLevelSupervisionPreferenceController( Intent(SUPERVISION_MESSENGER_SERVICE_BIND_ACTION).setPackage(supervisionPackage) return supervisionPackage != null && context.packageManager.queryIntentServices(intent, 0).isNotEmpty() mContext.packageManager.queryIntentServices(intent, 0).isNotEmpty() } private fun hasRedirect(): Boolean { val intent = Intent(SETTINGS_REDIRECT_ACTION).setPackage(supervisionPackage) return supervisionPackage != null && context.packageManager .queryIntentActivitiesAsUser(intent, 0, context.userId) mContext.packageManager .queryIntentActivitiesAsUser(intent, 0, mContext.userId) .isNotEmpty() } Loading