Loading packages/SystemUI/plugin/Android.bp +2 −3 Original line number Diff line number Diff line Loading @@ -23,9 +23,7 @@ package { } java_library { name: "SystemUIPluginLib", srcs: [ "bcsmartspace/src/**/*.java", "bcsmartspace/src/**/*.kt", Loading @@ -40,6 +38,8 @@ java_library { export_proguard_flags_files: true, }, plugins: ["PluginAnnotationProcessor"], // If you add a static lib here, you may need to also add the package to the ClassLoaderFilter // in PluginInstance. That will ensure that loaded plugins have access to the related classes. // You should also add it to proguard_common.flags so that proguard does not remove the portions Loading @@ -53,7 +53,6 @@ java_library { "SystemUILogLib", "androidx.annotation_annotation", ], } android_app { Loading packages/SystemUI/plugin/src/com/android/systemui/plugins/TestPlugin.kt 0 → 100644 +33 −0 Original line number 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.systemui.plugins import com.android.systemui.plugins.annotations.ProtectedInterface import com.android.systemui.plugins.annotations.ProtectedReturn import com.android.systemui.plugins.annotations.ProvidesInterface @ProtectedInterface @ProvidesInterface(action = TestPlugin.ACTION, version = TestPlugin.VERSION) /** Interface intended for use in tests */ interface TestPlugin : Plugin { companion object { const val VERSION = 1 const val ACTION = "testAction" } @ProtectedReturn("return new Object();") /** Test method, implemented by test */ fun methodThrowsError(): Object } packages/SystemUI/plugin/src/com/android/systemui/plugins/clocks/ClockProviderPlugin.kt +40 −4 Original line number Diff line number Diff line Loading @@ -21,7 +21,11 @@ import androidx.constraintlayout.widget.ConstraintSet import com.android.internal.annotations.Keep import com.android.systemui.log.core.MessageBuffer import com.android.systemui.plugins.Plugin import com.android.systemui.plugins.annotations.GeneratedImport import com.android.systemui.plugins.annotations.ProtectedInterface import com.android.systemui.plugins.annotations.ProtectedReturn import com.android.systemui.plugins.annotations.ProvidesInterface import com.android.systemui.plugins.annotations.SimpleProperty import java.io.PrintWriter import java.util.Locale import java.util.TimeZone Loading @@ -31,6 +35,7 @@ import org.json.JSONObject typealias ClockId = String /** A Plugin which exposes the ClockProvider interface */ @ProtectedInterface @ProvidesInterface(action = ClockProviderPlugin.ACTION, version = ClockProviderPlugin.VERSION) interface ClockProviderPlugin : Plugin, ClockProvider { companion object { Loading @@ -40,31 +45,42 @@ interface ClockProviderPlugin : Plugin, ClockProvider { } /** Interface for building clocks and providing information about those clocks */ @ProtectedInterface @GeneratedImport("java.util.List") @GeneratedImport("java.util.ArrayList") interface ClockProvider { /** Initializes the clock provider with debug log buffers */ fun initialize(buffers: ClockMessageBuffers?) @ProtectedReturn("return new ArrayList<ClockMetadata>();") /** Returns metadata for all clocks this provider knows about */ fun getClocks(): List<ClockMetadata> @ProtectedReturn("return null;") /** Initializes and returns the target clock design */ fun createClock(settings: ClockSettings): ClockController fun createClock(settings: ClockSettings): ClockController? @ProtectedReturn("return new ClockPickerConfig(\"\", \"\", \"\", null);") /** Settings configuration parameters for the clock */ fun getClockPickerConfig(id: ClockId): ClockPickerConfig } /** Interface for controlling an active clock */ @ProtectedInterface interface ClockController { @get:SimpleProperty /** A small version of the clock, appropriate for smaller viewports */ val smallClock: ClockFaceController @get:SimpleProperty /** A large version of the clock, appropriate when a bigger viewport is available */ val largeClock: ClockFaceController @get:SimpleProperty /** Determines the way the hosting app should behave when rendering either clock face */ val config: ClockConfig @get:SimpleProperty /** Events that clocks may need to respond to */ val events: ClockEvents Loading @@ -76,19 +92,26 @@ interface ClockController { } /** Interface for a specific clock face version rendered by the clock */ @ProtectedInterface interface ClockFaceController { @get:SimpleProperty @Deprecated("Prefer use of layout") /** View that renders the clock face */ val view: View @get:SimpleProperty /** Layout specification for this clock */ val layout: ClockFaceLayout @get:SimpleProperty /** Determines the way the hosting app should behave when rendering this clock face */ val config: ClockFaceConfig @get:SimpleProperty /** Events specific to this clock face */ val events: ClockFaceEvents @get:SimpleProperty /** Triggers for various animations */ val animations: ClockAnimations } Loading @@ -107,14 +130,21 @@ data class ClockMessageBuffers( data class AodClockBurnInModel(val scale: Float, val translationX: Float, val translationY: Float) /** Specifies layout information for the */ /** Specifies layout information for the clock face */ @ProtectedInterface @GeneratedImport("java.util.ArrayList") @GeneratedImport("android.view.View") interface ClockFaceLayout { @get:ProtectedReturn("return new ArrayList<View>();") /** All clock views to add to the root constraint layout before applying constraints. */ val views: List<View> @ProtectedReturn("return constraints;") /** Custom constraints to apply to Lockscreen ConstraintLayout. */ fun applyConstraints(constraints: ConstraintSet): ConstraintSet @ProtectedReturn("return constraints;") /** Custom constraints to apply to preview ConstraintLayout. */ fun applyPreviewConstraints(constraints: ConstraintSet): ConstraintSet fun applyAodBurnIn(aodBurnInModel: AodClockBurnInModel) Loading Loading @@ -145,7 +175,9 @@ class DefaultClockFaceLayout(val view: View) : ClockFaceLayout { } /** Events that should call when various rendering parameters change */ @ProtectedInterface interface ClockEvents { @get:ProtectedReturn("return false;") /** Set to enable or disable swipe interaction */ var isReactiveTouchInteractionEnabled: Boolean Loading Loading @@ -187,6 +219,7 @@ data class ClockReactiveSetting( ) /** Methods which trigger various clock animations */ @ProtectedInterface interface ClockAnimations { /** Runs an enter animation (if any) */ fun enter() Loading Loading @@ -230,6 +263,7 @@ interface ClockAnimations { } /** Events that have specific data about the related face */ @ProtectedInterface interface ClockFaceEvents { /** Call every time tick */ fun onTimeTick() Loading Loading @@ -270,7 +304,9 @@ enum class ClockTickRate(val value: Int) { /** Some data about a clock design */ data class ClockMetadata(val clockId: ClockId) data class ClockPickerConfig( data class ClockPickerConfig @JvmOverloads constructor( val id: String, /** Localized name of the clock */ Loading Loading @@ -338,7 +374,7 @@ data class ClockConfig( /** Transition to AOD should move smartspace like large clock instead of small clock */ val useAlternateSmartspaceAODTransition: Boolean = false, /** Use ClockPickerConfig.isReactiveToTone instead */ /** Deprecated version of isReactiveToTone; moved to ClockPickerConfig */ @Deprecated("TODO(b/352049256): Remove in favor of ClockPickerConfig.isReactiveToTone") val isReactiveToTone: Boolean = true, Loading packages/SystemUI/plugin_core/Android.bp +62 −1 Original line number Diff line number Diff line Loading @@ -22,10 +22,44 @@ package { default_applicable_licenses: ["frameworks_base_packages_SystemUI_license"], } java_library { sdk_version: "current", name: "PluginAnnotationLib", host_supported: true, device_supported: true, srcs: [ "src/**/annotations/*.java", "src/**/annotations/*.kt", ], optimize: { proguard_flags_files: ["proguard.flags"], // Ensure downstream clients that reference this as a shared lib // inherit the appropriate flags to preserve annotations. export_proguard_flags_files: true, }, // Enforce that the library is built against java 8 so that there are // no compatibility issues with launcher java_version: "1.8", } java_library { sdk_version: "current", name: "PluginCoreLib", srcs: ["src/**/*.java"], device_supported: true, srcs: [ "src/**/*.java", "src/**/*.kt", ], exclude_srcs: [ "src/**/annotations/*.java", "src/**/annotations/*.kt", "src/**/processor/*.java", "src/**/processor/*.kt", ], static_libs: [ "PluginAnnotationLib", ], optimize: { proguard_flags_files: ["proguard.flags"], // Ensure downstream clients that reference this as a shared lib Loading @@ -37,3 +71,30 @@ java_library { // no compatibility issues with launcher java_version: "1.8", } java_library { java_version: "1.8", name: "PluginAnnotationProcessorLib", host_supported: true, device_supported: false, srcs: [ "src/**/processor/*.java", "src/**/processor/*.kt", ], plugins: ["auto_service_plugin"], static_libs: [ "androidx.annotation_annotation", "auto_service_annotations", "auto_common", "PluginAnnotationLib", "guava", "jsr330", ], } java_plugin { name: "PluginAnnotationProcessor", processor_class: "com.android.systemui.plugins.processor.ProtectedPluginProcessor", static_libs: ["PluginAnnotationProcessorLib"], java_version: "1.8", } packages/SystemUI/plugin_core/src/com/android/systemui/plugins/Plugin.java +3 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ package com.android.systemui.plugins; import android.content.Context; import com.android.systemui.plugins.annotations.ProtectedReturn; import com.android.systemui.plugins.annotations.Requires; /** Loading Loading @@ -116,6 +117,8 @@ public interface Plugin { * @deprecated * @see Requires */ @Deprecated @ProtectedReturn(statement = "return -1;") default int getVersion() { // Default of -1 indicates the plugin supports the new Requires model. return -1; Loading Loading
packages/SystemUI/plugin/Android.bp +2 −3 Original line number Diff line number Diff line Loading @@ -23,9 +23,7 @@ package { } java_library { name: "SystemUIPluginLib", srcs: [ "bcsmartspace/src/**/*.java", "bcsmartspace/src/**/*.kt", Loading @@ -40,6 +38,8 @@ java_library { export_proguard_flags_files: true, }, plugins: ["PluginAnnotationProcessor"], // If you add a static lib here, you may need to also add the package to the ClassLoaderFilter // in PluginInstance. That will ensure that loaded plugins have access to the related classes. // You should also add it to proguard_common.flags so that proguard does not remove the portions Loading @@ -53,7 +53,6 @@ java_library { "SystemUILogLib", "androidx.annotation_annotation", ], } android_app { Loading
packages/SystemUI/plugin/src/com/android/systemui/plugins/TestPlugin.kt 0 → 100644 +33 −0 Original line number 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.systemui.plugins import com.android.systemui.plugins.annotations.ProtectedInterface import com.android.systemui.plugins.annotations.ProtectedReturn import com.android.systemui.plugins.annotations.ProvidesInterface @ProtectedInterface @ProvidesInterface(action = TestPlugin.ACTION, version = TestPlugin.VERSION) /** Interface intended for use in tests */ interface TestPlugin : Plugin { companion object { const val VERSION = 1 const val ACTION = "testAction" } @ProtectedReturn("return new Object();") /** Test method, implemented by test */ fun methodThrowsError(): Object }
packages/SystemUI/plugin/src/com/android/systemui/plugins/clocks/ClockProviderPlugin.kt +40 −4 Original line number Diff line number Diff line Loading @@ -21,7 +21,11 @@ import androidx.constraintlayout.widget.ConstraintSet import com.android.internal.annotations.Keep import com.android.systemui.log.core.MessageBuffer import com.android.systemui.plugins.Plugin import com.android.systemui.plugins.annotations.GeneratedImport import com.android.systemui.plugins.annotations.ProtectedInterface import com.android.systemui.plugins.annotations.ProtectedReturn import com.android.systemui.plugins.annotations.ProvidesInterface import com.android.systemui.plugins.annotations.SimpleProperty import java.io.PrintWriter import java.util.Locale import java.util.TimeZone Loading @@ -31,6 +35,7 @@ import org.json.JSONObject typealias ClockId = String /** A Plugin which exposes the ClockProvider interface */ @ProtectedInterface @ProvidesInterface(action = ClockProviderPlugin.ACTION, version = ClockProviderPlugin.VERSION) interface ClockProviderPlugin : Plugin, ClockProvider { companion object { Loading @@ -40,31 +45,42 @@ interface ClockProviderPlugin : Plugin, ClockProvider { } /** Interface for building clocks and providing information about those clocks */ @ProtectedInterface @GeneratedImport("java.util.List") @GeneratedImport("java.util.ArrayList") interface ClockProvider { /** Initializes the clock provider with debug log buffers */ fun initialize(buffers: ClockMessageBuffers?) @ProtectedReturn("return new ArrayList<ClockMetadata>();") /** Returns metadata for all clocks this provider knows about */ fun getClocks(): List<ClockMetadata> @ProtectedReturn("return null;") /** Initializes and returns the target clock design */ fun createClock(settings: ClockSettings): ClockController fun createClock(settings: ClockSettings): ClockController? @ProtectedReturn("return new ClockPickerConfig(\"\", \"\", \"\", null);") /** Settings configuration parameters for the clock */ fun getClockPickerConfig(id: ClockId): ClockPickerConfig } /** Interface for controlling an active clock */ @ProtectedInterface interface ClockController { @get:SimpleProperty /** A small version of the clock, appropriate for smaller viewports */ val smallClock: ClockFaceController @get:SimpleProperty /** A large version of the clock, appropriate when a bigger viewport is available */ val largeClock: ClockFaceController @get:SimpleProperty /** Determines the way the hosting app should behave when rendering either clock face */ val config: ClockConfig @get:SimpleProperty /** Events that clocks may need to respond to */ val events: ClockEvents Loading @@ -76,19 +92,26 @@ interface ClockController { } /** Interface for a specific clock face version rendered by the clock */ @ProtectedInterface interface ClockFaceController { @get:SimpleProperty @Deprecated("Prefer use of layout") /** View that renders the clock face */ val view: View @get:SimpleProperty /** Layout specification for this clock */ val layout: ClockFaceLayout @get:SimpleProperty /** Determines the way the hosting app should behave when rendering this clock face */ val config: ClockFaceConfig @get:SimpleProperty /** Events specific to this clock face */ val events: ClockFaceEvents @get:SimpleProperty /** Triggers for various animations */ val animations: ClockAnimations } Loading @@ -107,14 +130,21 @@ data class ClockMessageBuffers( data class AodClockBurnInModel(val scale: Float, val translationX: Float, val translationY: Float) /** Specifies layout information for the */ /** Specifies layout information for the clock face */ @ProtectedInterface @GeneratedImport("java.util.ArrayList") @GeneratedImport("android.view.View") interface ClockFaceLayout { @get:ProtectedReturn("return new ArrayList<View>();") /** All clock views to add to the root constraint layout before applying constraints. */ val views: List<View> @ProtectedReturn("return constraints;") /** Custom constraints to apply to Lockscreen ConstraintLayout. */ fun applyConstraints(constraints: ConstraintSet): ConstraintSet @ProtectedReturn("return constraints;") /** Custom constraints to apply to preview ConstraintLayout. */ fun applyPreviewConstraints(constraints: ConstraintSet): ConstraintSet fun applyAodBurnIn(aodBurnInModel: AodClockBurnInModel) Loading Loading @@ -145,7 +175,9 @@ class DefaultClockFaceLayout(val view: View) : ClockFaceLayout { } /** Events that should call when various rendering parameters change */ @ProtectedInterface interface ClockEvents { @get:ProtectedReturn("return false;") /** Set to enable or disable swipe interaction */ var isReactiveTouchInteractionEnabled: Boolean Loading Loading @@ -187,6 +219,7 @@ data class ClockReactiveSetting( ) /** Methods which trigger various clock animations */ @ProtectedInterface interface ClockAnimations { /** Runs an enter animation (if any) */ fun enter() Loading Loading @@ -230,6 +263,7 @@ interface ClockAnimations { } /** Events that have specific data about the related face */ @ProtectedInterface interface ClockFaceEvents { /** Call every time tick */ fun onTimeTick() Loading Loading @@ -270,7 +304,9 @@ enum class ClockTickRate(val value: Int) { /** Some data about a clock design */ data class ClockMetadata(val clockId: ClockId) data class ClockPickerConfig( data class ClockPickerConfig @JvmOverloads constructor( val id: String, /** Localized name of the clock */ Loading Loading @@ -338,7 +374,7 @@ data class ClockConfig( /** Transition to AOD should move smartspace like large clock instead of small clock */ val useAlternateSmartspaceAODTransition: Boolean = false, /** Use ClockPickerConfig.isReactiveToTone instead */ /** Deprecated version of isReactiveToTone; moved to ClockPickerConfig */ @Deprecated("TODO(b/352049256): Remove in favor of ClockPickerConfig.isReactiveToTone") val isReactiveToTone: Boolean = true, Loading
packages/SystemUI/plugin_core/Android.bp +62 −1 Original line number Diff line number Diff line Loading @@ -22,10 +22,44 @@ package { default_applicable_licenses: ["frameworks_base_packages_SystemUI_license"], } java_library { sdk_version: "current", name: "PluginAnnotationLib", host_supported: true, device_supported: true, srcs: [ "src/**/annotations/*.java", "src/**/annotations/*.kt", ], optimize: { proguard_flags_files: ["proguard.flags"], // Ensure downstream clients that reference this as a shared lib // inherit the appropriate flags to preserve annotations. export_proguard_flags_files: true, }, // Enforce that the library is built against java 8 so that there are // no compatibility issues with launcher java_version: "1.8", } java_library { sdk_version: "current", name: "PluginCoreLib", srcs: ["src/**/*.java"], device_supported: true, srcs: [ "src/**/*.java", "src/**/*.kt", ], exclude_srcs: [ "src/**/annotations/*.java", "src/**/annotations/*.kt", "src/**/processor/*.java", "src/**/processor/*.kt", ], static_libs: [ "PluginAnnotationLib", ], optimize: { proguard_flags_files: ["proguard.flags"], // Ensure downstream clients that reference this as a shared lib Loading @@ -37,3 +71,30 @@ java_library { // no compatibility issues with launcher java_version: "1.8", } java_library { java_version: "1.8", name: "PluginAnnotationProcessorLib", host_supported: true, device_supported: false, srcs: [ "src/**/processor/*.java", "src/**/processor/*.kt", ], plugins: ["auto_service_plugin"], static_libs: [ "androidx.annotation_annotation", "auto_service_annotations", "auto_common", "PluginAnnotationLib", "guava", "jsr330", ], } java_plugin { name: "PluginAnnotationProcessor", processor_class: "com.android.systemui.plugins.processor.ProtectedPluginProcessor", static_libs: ["PluginAnnotationProcessorLib"], java_version: "1.8", }
packages/SystemUI/plugin_core/src/com/android/systemui/plugins/Plugin.java +3 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ package com.android.systemui.plugins; import android.content.Context; import com.android.systemui.plugins.annotations.ProtectedReturn; import com.android.systemui.plugins.annotations.Requires; /** Loading Loading @@ -116,6 +117,8 @@ public interface Plugin { * @deprecated * @see Requires */ @Deprecated @ProtectedReturn(statement = "return -1;") default int getVersion() { // Default of -1 indicates the plugin supports the new Requires model. return -1; Loading