Loading AndroidManifest.xml +14 −1 Original line number Diff line number Diff line Loading @@ -3477,11 +3477,24 @@ <category android:name="android.intent.category.DEFAULT" /> </intent-filter> <meta-data android:name="com.android.settings.FRAGMENT_CLASS" android:value="com.android.settings.applications.specialaccess.turnscreenon.TurnScreenOnSettings" /> android:value="com.android.settings.applications.manageapplications.ManageApplications" /> <meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY" android:value="@string/menu_key_apps"/> </activity> <activity android:name="Settings$AppTurnScreenOnSettingsActivity" android:exported="true" android:label="@string/turn_screen_on_title"> <intent-filter android:priority="1"> <action android:name="android.settings.TURN_SCREEN_ON_SETTINGS" /> <category android:name="android.intent.category.DEFAULT" /> <data android:scheme="package" /> </intent-filter> <meta-data android:name="com.android.settings.FRAGMENT_CLASS" android:value="com.android.settings.applications.specialaccess.turnscreenon.TurnScreenOnDetails"/> </activity> <activity android:name="Settings$InteractAcrossProfilesSettingsActivity" android:exported="true" Loading res/xml/special_access.xml +5 −1 Original line number Diff line number Diff line Loading @@ -195,7 +195,11 @@ android:key="turn_screen_on" android:title="@string/turn_screen_on_title" android:order="-200" android:fragment="com.android.settings.applications.specialaccess.turnscreenon.TurnScreenOnSettings" /> android:fragment="com.android.settings.applications.manageapplications.ManageApplications"> <extra android:name="classname" android:value="com.android.settings.Settings$TurnScreenOnSettingsActivity" /> </Preference> <Preference android:key="special_access_more" Loading res/xml/turn_screen_on_settings.xmldeleted 100644 → 0 +0 −23 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2022 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. --> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" xmlns:settings="http://schemas.android.com/apk/res-auto" android:key="turn_screen_on_screen" android:title="@string/turn_screen_on_title" settings:searchable="false" /> src/com/android/settings/Settings.java +1 −0 Original line number Diff line number Diff line Loading @@ -350,6 +350,7 @@ public class Settings extends SettingsActivity { public static class PremiumSmsAccessActivity extends SettingsActivity { /* empty */ } public static class PictureInPictureSettingsActivity extends SettingsActivity { /* empty */ } public static class TurnScreenOnSettingsActivity extends SettingsActivity { /* empty */ } public static class AppTurnScreenOnSettingsActivity extends SettingsActivity { /* empty */ } public static class AppPictureInPictureSettingsActivity extends SettingsActivity { /* empty */ } public static class ZenAccessSettingsActivity extends SettingsActivity { /* empty */ } public static class ZenAccessDetailSettingsActivity extends SettingsActivity {} Loading src/com/android/settings/applications/AppStateTurnScreenOnBridge.java 0 → 100644 +86 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 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.applications; import android.Manifest; import android.app.AppOpsManager; import android.content.Context; import com.android.settingslib.applications.ApplicationsState; import com.android.settingslib.applications.ApplicationsState.AppEntry; import com.android.settingslib.applications.ApplicationsState.AppFilter; import java.util.List; /** * Connects app op info to the ApplicationsState. Extends {@link AppStateAppOpsBridge} to tailor * to the semantics of {@link Manifest.permission#TURN_SCREEN_ON}. * Also provides app filters that can use the info. */ public class AppStateTurnScreenOnBridge extends AppStateAppOpsBridge { private static final String APP_OP_STR = AppOpsManager.OPSTR_TURN_SCREEN_ON; private static final String[] PERMISSIONS = { Manifest.permission.TURN_SCREEN_ON }; private AppOpsManager mAppOpsManager; public AppStateTurnScreenOnBridge(Context context, ApplicationsState appState, Callback callback) { super(context, appState, callback, AppOpsManager.strOpToOp(APP_OP_STR), PERMISSIONS); mAppOpsManager = context.getSystemService(AppOpsManager.class); } @Override protected void updateExtraInfo(AppEntry app, String pkg, int uid) { app.extraInfo = getPermissionInfo(pkg, uid); } @Override protected void loadAllExtraInfo() { super.loadAllExtraInfo(); final List<AppEntry> apps = mAppSession.getAllApps(); for (AppEntry app : apps) { if (app.extraInfo instanceof PermissionState) { ((PermissionState) app.extraInfo).appOpMode = mAppOpsManager.unsafeCheckOpNoThrow( APP_OP_STR, app.info.uid, app.info.packageName); } } } @Override public PermissionState getPermissionInfo(String pkg, int uid) { PermissionState ps = super.getPermissionInfo(pkg, uid); ps.appOpMode = mAppOpsManager.unsafeCheckOpNoThrow(APP_OP_STR, uid, pkg); return ps; } public static final AppFilter FILTER_TURN_SCREEN_ON_APPS = new AppFilter() { @Override public void init() { } @Override public boolean filterApp(AppEntry info) { // If extraInfo != null, it means that the app has declared // Manifest.permission.TURN_SCREEN_ON and therefore it should appear on our // list return info.extraInfo != null; } }; } Loading
AndroidManifest.xml +14 −1 Original line number Diff line number Diff line Loading @@ -3477,11 +3477,24 @@ <category android:name="android.intent.category.DEFAULT" /> </intent-filter> <meta-data android:name="com.android.settings.FRAGMENT_CLASS" android:value="com.android.settings.applications.specialaccess.turnscreenon.TurnScreenOnSettings" /> android:value="com.android.settings.applications.manageapplications.ManageApplications" /> <meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY" android:value="@string/menu_key_apps"/> </activity> <activity android:name="Settings$AppTurnScreenOnSettingsActivity" android:exported="true" android:label="@string/turn_screen_on_title"> <intent-filter android:priority="1"> <action android:name="android.settings.TURN_SCREEN_ON_SETTINGS" /> <category android:name="android.intent.category.DEFAULT" /> <data android:scheme="package" /> </intent-filter> <meta-data android:name="com.android.settings.FRAGMENT_CLASS" android:value="com.android.settings.applications.specialaccess.turnscreenon.TurnScreenOnDetails"/> </activity> <activity android:name="Settings$InteractAcrossProfilesSettingsActivity" android:exported="true" Loading
res/xml/special_access.xml +5 −1 Original line number Diff line number Diff line Loading @@ -195,7 +195,11 @@ android:key="turn_screen_on" android:title="@string/turn_screen_on_title" android:order="-200" android:fragment="com.android.settings.applications.specialaccess.turnscreenon.TurnScreenOnSettings" /> android:fragment="com.android.settings.applications.manageapplications.ManageApplications"> <extra android:name="classname" android:value="com.android.settings.Settings$TurnScreenOnSettingsActivity" /> </Preference> <Preference android:key="special_access_more" Loading
res/xml/turn_screen_on_settings.xmldeleted 100644 → 0 +0 −23 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2022 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. --> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" xmlns:settings="http://schemas.android.com/apk/res-auto" android:key="turn_screen_on_screen" android:title="@string/turn_screen_on_title" settings:searchable="false" />
src/com/android/settings/Settings.java +1 −0 Original line number Diff line number Diff line Loading @@ -350,6 +350,7 @@ public class Settings extends SettingsActivity { public static class PremiumSmsAccessActivity extends SettingsActivity { /* empty */ } public static class PictureInPictureSettingsActivity extends SettingsActivity { /* empty */ } public static class TurnScreenOnSettingsActivity extends SettingsActivity { /* empty */ } public static class AppTurnScreenOnSettingsActivity extends SettingsActivity { /* empty */ } public static class AppPictureInPictureSettingsActivity extends SettingsActivity { /* empty */ } public static class ZenAccessSettingsActivity extends SettingsActivity { /* empty */ } public static class ZenAccessDetailSettingsActivity extends SettingsActivity {} Loading
src/com/android/settings/applications/AppStateTurnScreenOnBridge.java 0 → 100644 +86 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 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.applications; import android.Manifest; import android.app.AppOpsManager; import android.content.Context; import com.android.settingslib.applications.ApplicationsState; import com.android.settingslib.applications.ApplicationsState.AppEntry; import com.android.settingslib.applications.ApplicationsState.AppFilter; import java.util.List; /** * Connects app op info to the ApplicationsState. Extends {@link AppStateAppOpsBridge} to tailor * to the semantics of {@link Manifest.permission#TURN_SCREEN_ON}. * Also provides app filters that can use the info. */ public class AppStateTurnScreenOnBridge extends AppStateAppOpsBridge { private static final String APP_OP_STR = AppOpsManager.OPSTR_TURN_SCREEN_ON; private static final String[] PERMISSIONS = { Manifest.permission.TURN_SCREEN_ON }; private AppOpsManager mAppOpsManager; public AppStateTurnScreenOnBridge(Context context, ApplicationsState appState, Callback callback) { super(context, appState, callback, AppOpsManager.strOpToOp(APP_OP_STR), PERMISSIONS); mAppOpsManager = context.getSystemService(AppOpsManager.class); } @Override protected void updateExtraInfo(AppEntry app, String pkg, int uid) { app.extraInfo = getPermissionInfo(pkg, uid); } @Override protected void loadAllExtraInfo() { super.loadAllExtraInfo(); final List<AppEntry> apps = mAppSession.getAllApps(); for (AppEntry app : apps) { if (app.extraInfo instanceof PermissionState) { ((PermissionState) app.extraInfo).appOpMode = mAppOpsManager.unsafeCheckOpNoThrow( APP_OP_STR, app.info.uid, app.info.packageName); } } } @Override public PermissionState getPermissionInfo(String pkg, int uid) { PermissionState ps = super.getPermissionInfo(pkg, uid); ps.appOpMode = mAppOpsManager.unsafeCheckOpNoThrow(APP_OP_STR, uid, pkg); return ps; } public static final AppFilter FILTER_TURN_SCREEN_ON_APPS = new AppFilter() { @Override public void init() { } @Override public boolean filterApp(AppEntry info) { // If extraInfo != null, it means that the app has declared // Manifest.permission.TURN_SCREEN_ON and therefore it should appear on our // list return info.extraInfo != null; } }; }