From 1b35253f58635a67cb3a31850e3989d3717a3755 Mon Sep 17 00:00:00 2001 From: Kunhung Li Date: Mon, 30 Jul 2018 18:15:12 +0800 Subject: [PATCH] Add clock plugin interface More flexible to test any clock plugin in the future Bug: 111971817 Test: manual test Change-Id: I45fa2d1ca99446abdb315cc28b58956d8e409283 --- packages/SystemUI/docs/plugin_hooks.md | 4 ++ .../android/systemui/plugins/ClockPlugin.java | 47 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 packages/SystemUI/plugin/src/com/android/systemui/plugins/ClockPlugin.java diff --git a/packages/SystemUI/docs/plugin_hooks.md b/packages/SystemUI/docs/plugin_hooks.md index 5b08bfc387db7..9fe2e181971a3 100644 --- a/packages/SystemUI/docs/plugin_hooks.md +++ b/packages/SystemUI/docs/plugin_hooks.md @@ -51,6 +51,10 @@ Expected interface: [NotificationSwipeActionHelper](/packages/SystemUI/plugin/sr Use: Control over swipes/input for notification views, can be used to control what happens when you swipe/long-press +### Action: com.android.systemui.action.PLUGIN_CLOCK +Expected interface: [ClockPlugin](/packages/SystemUI/plugin/src/com/android/systemui/plugins/ClockPlugin.java) + +Use: Allows replacement of the keyguard main clock. # Global plugin dependencies These classes can be accessed by any plugin using PluginDependency as long as they @Requires them. diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/ClockPlugin.java b/packages/SystemUI/plugin/src/com/android/systemui/plugins/ClockPlugin.java new file mode 100644 index 0000000000000..b4fc82018303e --- /dev/null +++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/ClockPlugin.java @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2018 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.ProvidesInterface; + +import android.graphics.Paint.Style; +import android.view.View; + +/** + * This plugin is used to replace main clock in keyguard. + */ +@ProvidesInterface(action = ClockPlugin.ACTION, version = ClockPlugin.VERSION) +public interface ClockPlugin extends Plugin { + + String ACTION = "com.android.systemui.action.PLUGIN_CLOCK"; + int VERSION = 1; + + /** + * Get clock view. + * @return clock view from plugin. + */ + View getView(); + + /** + * Set clock paint style. + * @param style The new style to set in the paint. + */ + void setStyle(Style style); + + /** + * Set clock text color. + * @param color A color value. + */ + void setTextColor(int color); +}