From 50c8b50b37743383f73ccf02ba14f5106b551cdf Mon Sep 17 00:00:00 2001 From: Matt Pietal Date: Wed, 21 Aug 2019 13:03:12 -0400 Subject: Controls: Add a temporary space for home controls integration This space will only be visible by setting a flag to enable split status-bar functionality: adb shell device_config put systemui qs_split_enabled true To populate the view, you will also need to build and install an experimental plugin from google3, coming shortly. Test: manual Change-Id: Iccf712a0355ebf8d9c6da2dac63874820270d405 --- .../systemui/plugins/HomeControlsPlugin.java | 36 ++++++++++++++++++++++ .../SystemUI/res/layout/status_bar_expanded.xml | 13 ++++++++ .../statusbar/phone/NotificationPanelView.java | 30 ++++++++++++++++-- 3 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 packages/SystemUI/plugin/src/com/android/systemui/plugins/HomeControlsPlugin.java diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/HomeControlsPlugin.java b/packages/SystemUI/plugin/src/com/android/systemui/plugins/HomeControlsPlugin.java new file mode 100644 index 000000000000..cac673fdbf0b --- /dev/null +++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/HomeControlsPlugin.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2019 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 android.view.ViewGroup; + +import com.android.systemui.plugins.annotations.ProvidesInterface; + +/** + * Test plugin for home controls + */ +@ProvidesInterface(action = HomeControlsPlugin.ACTION, version = HomeControlsPlugin.VERSION) +public interface HomeControlsPlugin extends Plugin { + + String ACTION = "com.android.systemui.action.PLUGIN_HOME_CONTROLS"; + int VERSION = 1; + + /** + * Pass the container for the plugin to use however it wants. Ideally the plugin impl + * will add home controls to this space. + */ + void sendParentGroup(ViewGroup group); +} diff --git a/packages/SystemUI/res/layout/status_bar_expanded.xml b/packages/SystemUI/res/layout/status_bar_expanded.xml index 7d403b24354c..7a9400887c75 100644 --- a/packages/SystemUI/res/layout/status_bar_expanded.xml +++ b/packages/SystemUI/res/layout/status_bar_expanded.xml @@ -55,6 +55,19 @@ android:clipChildren="false" systemui:viewType="com.android.systemui.plugins.qs.QS" /> + + + + () { + + @Override + public void onPluginConnected(HomeControlsPlugin plugin, + Context pluginContext) { + plugin.sendParentGroup(mHomeControlsLayout); + } + + @Override + public void onPluginDisconnected(HomeControlsPlugin plugin) { + + } + }, HomeControlsPlugin.class, false); } @Override @@ -1270,9 +1291,11 @@ public class NotificationPanelView extends PanelView implements if (mQsExpandImmediate) { mNotificationStackScroller.setVisibility(View.GONE); mQsFrame.setVisibility(View.VISIBLE); + mHomeControlsLayout.setVisibility(View.VISIBLE); } else { mNotificationStackScroller.setVisibility(View.VISIBLE); mQsFrame.setVisibility(View.GONE); + mHomeControlsLayout.setVisibility(View.GONE); } } return false; @@ -1551,6 +1574,7 @@ public class NotificationPanelView extends PanelView implements if (mKeyguardShowing && isQsSplitEnabled()) { mNotificationStackScroller.setVisibility(View.VISIBLE); mQsFrame.setVisibility(View.VISIBLE); + mHomeControlsLayout.setVisibility(View.GONE); } if (oldState == StatusBarState.KEYGUARD @@ -2099,8 +2123,10 @@ public class NotificationPanelView extends PanelView implements t = (expandedHeight - panelHeightQsCollapsed) / (panelHeightQsExpanded - panelHeightQsCollapsed); } - setQsExpansion(mQsMinExpansionHeight - + t * (mQsMaxExpansionHeight - mQsMinExpansionHeight)); + float targetHeight = mQsMinExpansionHeight + + t * (mQsMaxExpansionHeight - mQsMinExpansionHeight); + setQsExpansion(targetHeight); + mHomeControlsLayout.setTranslationY(targetHeight); } updateExpandedHeight(expandedHeight); updateHeader(); -- cgit v1.2.3-59-g8ed1b