Loading packages/SystemUI/plugin/src/com/android/systemui/plugins/HomeControlsPlugin.java 0 → 100644 +36 −0 Original line number Diff line number Diff line /* * 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); } packages/SystemUI/res/layout/status_bar_expanded.xml +13 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,19 @@ android:clipChildren="false" systemui:viewType="com.android.systemui.plugins.qs.QS" /> <!-- Temporary area to test out home controls --> <LinearLayout android:id="@+id/home_controls_layout" android:layout_width="match_parent" android:layout_height="125dp" android:layout_gravity="@integer/notification_panel_layout_gravity" android:visibility="gone" android:padding="8dp" android:layout_margin="5dp" android:background="?android:attr/colorBackgroundFloating" android:orientation="vertical"> </LinearLayout> <com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout android:id="@+id/notification_stack_scroller" android:layout_marginTop="@dimen/notification_panel_margin_top" Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +28 −2 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ import android.view.ViewGroup; import android.view.WindowInsets; import android.view.accessibility.AccessibilityManager; import android.widget.FrameLayout; import android.widget.LinearLayout; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.config.sysui.SystemUiDeviceConfigFlags; Loading @@ -68,10 +69,13 @@ import com.android.systemui.R; import com.android.systemui.fragments.FragmentHostManager; import com.android.systemui.fragments.FragmentHostManager.FragmentListener; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.HomeControlsPlugin; import com.android.systemui.plugins.PluginListener; import com.android.systemui.plugins.qs.QS; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener; import com.android.systemui.qs.QSFragment; import com.android.systemui.shared.plugins.PluginManager; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.FlingAnimationUtils; import com.android.systemui.statusbar.GestureRecorder; Loading Loading @@ -192,6 +196,7 @@ public class NotificationPanelView extends PanelView implements private View mQsNavbarScrim; protected NotificationsQuickSettingsContainer mNotificationContainerParent; protected NotificationStackScrollLayout mNotificationStackScroller; protected LinearLayout mHomeControlsLayout; private boolean mAnimateNextPositionUpdate; private int mTrackingPointer; Loading Loading @@ -450,6 +455,7 @@ public class NotificationPanelView extends PanelView implements mBigClockContainer = findViewById(R.id.big_clock_container); keyguardClockSwitch.setBigClockContainer(mBigClockContainer); mHomeControlsLayout = findViewById(R.id.home_controls_layout); mNotificationContainerParent = findViewById(R.id.notification_container_parent); mNotificationStackScroller = findViewById(R.id.notification_stack_scroller); mNotificationStackScroller.setOnHeightChangedListener(this); Loading Loading @@ -480,6 +486,21 @@ public class NotificationPanelView extends PanelView implements } } }); Dependency.get(PluginManager.class).addPluginListener( new PluginListener<HomeControlsPlugin>() { @Override public void onPluginConnected(HomeControlsPlugin plugin, Context pluginContext) { plugin.sendParentGroup(mHomeControlsLayout); } @Override public void onPluginDisconnected(HomeControlsPlugin plugin) { } }, HomeControlsPlugin.class, false); } @Override Loading Loading @@ -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; Loading Loading @@ -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 Loading Loading @@ -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(); Loading Loading
packages/SystemUI/plugin/src/com/android/systemui/plugins/HomeControlsPlugin.java 0 → 100644 +36 −0 Original line number Diff line number Diff line /* * 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); }
packages/SystemUI/res/layout/status_bar_expanded.xml +13 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,19 @@ android:clipChildren="false" systemui:viewType="com.android.systemui.plugins.qs.QS" /> <!-- Temporary area to test out home controls --> <LinearLayout android:id="@+id/home_controls_layout" android:layout_width="match_parent" android:layout_height="125dp" android:layout_gravity="@integer/notification_panel_layout_gravity" android:visibility="gone" android:padding="8dp" android:layout_margin="5dp" android:background="?android:attr/colorBackgroundFloating" android:orientation="vertical"> </LinearLayout> <com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout android:id="@+id/notification_stack_scroller" android:layout_marginTop="@dimen/notification_panel_margin_top" Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +28 −2 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ import android.view.ViewGroup; import android.view.WindowInsets; import android.view.accessibility.AccessibilityManager; import android.widget.FrameLayout; import android.widget.LinearLayout; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.config.sysui.SystemUiDeviceConfigFlags; Loading @@ -68,10 +69,13 @@ import com.android.systemui.R; import com.android.systemui.fragments.FragmentHostManager; import com.android.systemui.fragments.FragmentHostManager.FragmentListener; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.HomeControlsPlugin; import com.android.systemui.plugins.PluginListener; import com.android.systemui.plugins.qs.QS; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener; import com.android.systemui.qs.QSFragment; import com.android.systemui.shared.plugins.PluginManager; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.FlingAnimationUtils; import com.android.systemui.statusbar.GestureRecorder; Loading Loading @@ -192,6 +196,7 @@ public class NotificationPanelView extends PanelView implements private View mQsNavbarScrim; protected NotificationsQuickSettingsContainer mNotificationContainerParent; protected NotificationStackScrollLayout mNotificationStackScroller; protected LinearLayout mHomeControlsLayout; private boolean mAnimateNextPositionUpdate; private int mTrackingPointer; Loading Loading @@ -450,6 +455,7 @@ public class NotificationPanelView extends PanelView implements mBigClockContainer = findViewById(R.id.big_clock_container); keyguardClockSwitch.setBigClockContainer(mBigClockContainer); mHomeControlsLayout = findViewById(R.id.home_controls_layout); mNotificationContainerParent = findViewById(R.id.notification_container_parent); mNotificationStackScroller = findViewById(R.id.notification_stack_scroller); mNotificationStackScroller.setOnHeightChangedListener(this); Loading Loading @@ -480,6 +486,21 @@ public class NotificationPanelView extends PanelView implements } } }); Dependency.get(PluginManager.class).addPluginListener( new PluginListener<HomeControlsPlugin>() { @Override public void onPluginConnected(HomeControlsPlugin plugin, Context pluginContext) { plugin.sendParentGroup(mHomeControlsLayout); } @Override public void onPluginDisconnected(HomeControlsPlugin plugin) { } }, HomeControlsPlugin.class, false); } @Override Loading Loading @@ -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; Loading Loading @@ -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 Loading Loading @@ -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(); Loading