Loading packages/SettingsLib/Service/Android.bp 0 → 100644 +20 −0 Original line number Original line Diff line number Diff line package { default_applicable_licenses: ["frameworks_base_license"], } filegroup { name: "SettingsLibService-srcs", srcs: ["src/**/*.kt"], } android_library { name: "SettingsLibService", defaults: [ "SettingsLintDefaults", ], srcs: [":SettingsLibService-srcs"], static_libs: [ "SettingsLibGraph", ], kotlincflags: ["-Xjvm-default=all"], } packages/SettingsLib/Service/AndroidManifest.xml 0 → 100644 +6 −0 Original line number Original line Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.settingslib.service"> <uses-sdk android:minSdkVersion="21" /> </manifest> packages/SettingsLib/Service/src/com/android/settingslib/service/PreferenceGraphApi.kt 0 → 100644 +37 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2024 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.settingslib.service import android.app.Application import com.android.settingslib.graph.GetPreferenceGraphApiHandler import com.android.settingslib.graph.GetPreferenceGraphRequest /** Api to get preference graph. */ internal class PreferenceGraphApi(activityClasses: Set<String>) : GetPreferenceGraphApiHandler(activityClasses) { override val id: Int get() = API_GET_PREFERENCE_GRAPH override fun hasPermission( application: Application, myUid: Int, callingUid: Int, request: GetPreferenceGraphRequest, ): Boolean { return true // TODO: add permission check } } packages/SettingsLib/Service/src/com/android/settingslib/service/PreferenceService.kt 0 → 100644 +37 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2024 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.settingslib.service import com.android.settingslib.ipc.ApiHandler import com.android.settingslib.ipc.MessengerService import com.android.settingslib.ipc.PermissionChecker /** * Preference service providing a bunch of APIs. * * In AndroidManifest.xml, the <service> must specify <intent-filter> with action * [PREFERENCE_SERVICE_ACTION]. */ open class PreferenceService( permissionChecker: PermissionChecker, name: String = "PreferenceService", ) : MessengerService( listOf<ApiHandler<*, *>>(PreferenceGraphApi(setOf())), permissionChecker, name, ) packages/SettingsLib/Service/src/com/android/settingslib/service/ServiceApiConstants.kt 0 → 100644 +21 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2024 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.settingslib.service const val PREFERENCE_SERVICE_ACTION = "com.android.settingslib.PREFERENCE_SERVICE" internal const val API_GET_PREFERENCE_GRAPH = 1 Loading
packages/SettingsLib/Service/Android.bp 0 → 100644 +20 −0 Original line number Original line Diff line number Diff line package { default_applicable_licenses: ["frameworks_base_license"], } filegroup { name: "SettingsLibService-srcs", srcs: ["src/**/*.kt"], } android_library { name: "SettingsLibService", defaults: [ "SettingsLintDefaults", ], srcs: [":SettingsLibService-srcs"], static_libs: [ "SettingsLibGraph", ], kotlincflags: ["-Xjvm-default=all"], }
packages/SettingsLib/Service/AndroidManifest.xml 0 → 100644 +6 −0 Original line number Original line Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.settingslib.service"> <uses-sdk android:minSdkVersion="21" /> </manifest>
packages/SettingsLib/Service/src/com/android/settingslib/service/PreferenceGraphApi.kt 0 → 100644 +37 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2024 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.settingslib.service import android.app.Application import com.android.settingslib.graph.GetPreferenceGraphApiHandler import com.android.settingslib.graph.GetPreferenceGraphRequest /** Api to get preference graph. */ internal class PreferenceGraphApi(activityClasses: Set<String>) : GetPreferenceGraphApiHandler(activityClasses) { override val id: Int get() = API_GET_PREFERENCE_GRAPH override fun hasPermission( application: Application, myUid: Int, callingUid: Int, request: GetPreferenceGraphRequest, ): Boolean { return true // TODO: add permission check } }
packages/SettingsLib/Service/src/com/android/settingslib/service/PreferenceService.kt 0 → 100644 +37 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2024 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.settingslib.service import com.android.settingslib.ipc.ApiHandler import com.android.settingslib.ipc.MessengerService import com.android.settingslib.ipc.PermissionChecker /** * Preference service providing a bunch of APIs. * * In AndroidManifest.xml, the <service> must specify <intent-filter> with action * [PREFERENCE_SERVICE_ACTION]. */ open class PreferenceService( permissionChecker: PermissionChecker, name: String = "PreferenceService", ) : MessengerService( listOf<ApiHandler<*, *>>(PreferenceGraphApi(setOf())), permissionChecker, name, )
packages/SettingsLib/Service/src/com/android/settingslib/service/ServiceApiConstants.kt 0 → 100644 +21 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2024 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.settingslib.service const val PREFERENCE_SERVICE_ACTION = "com.android.settingslib.PREFERENCE_SERVICE" internal const val API_GET_PREFERENCE_GRAPH = 1