Split status bar window (1/N)
This is the first step to create another new window for status bar.
Small window => TYPE_STATUS_BAR: The bar on top of screen.
Large window => TYPE_NOTIFICATION_SHADE: Anything else.
Bug: 136993073
Test: build then flash
Test: atest WmTests SystemUITests
Test: atest RegisterStatusBarResultTest InsetsFlagsTest
Manual Test:
- Bouncer can show when leave showWhenLocked activity.
- StatusBar can show when comes HUN in fullscreen mode.
- StatusBar can play enter/leave animation in fullscreen mode.
- Able to drag notification panel when bubble/glow existing.
- Switch to market launcher, and run above tests.
- Drag notification panel from launcher several times and observe it
works fine.
Change-Id: Id9f72cd0e21f01b50d57f02ea60f97c6460926b7
diff --git a/packages/SystemUI/res/layout/super_notification_shade.xml b/packages/SystemUI/res/layout/super_notification_shade.xml
new file mode 100644
index 0000000..dc070cb
--- /dev/null
+++ b/packages/SystemUI/res/layout/super_notification_shade.xml
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+**
+** Copyright 2020, 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.
+*/
+-->
+
+<!-- This is the notification shade window. -->
+<com.android.systemui.statusbar.phone.NotificationShadeWindowView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:sysui="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fitsSystemWindows="true">
+
+ <com.android.systemui.statusbar.BackDropView
+ android:id="@+id/backdrop"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:visibility="gone"
+ sysui:ignoreRightInset="true"
+ >
+ <ImageView android:id="@+id/backdrop_back"
+ android:layout_width="match_parent"
+ android:scaleType="centerCrop"
+ android:layout_height="match_parent" />
+ <ImageView android:id="@+id/backdrop_front"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:scaleType="centerCrop"
+ android:visibility="invisible" />
+ </com.android.systemui.statusbar.BackDropView>
+
+ <com.android.systemui.statusbar.ScrimView
+ android:id="@+id/scrim_for_bubble"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:importantForAccessibility="no"
+ sysui:ignoreRightInset="true"
+ />
+
+ <com.android.systemui.statusbar.ScrimView
+ android:id="@+id/scrim_behind"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:importantForAccessibility="no"
+ sysui:ignoreRightInset="true"
+ />
+
+ <include layout="@layout/status_bar_expanded"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:visibility="invisible" />
+
+ <include layout="@layout/brightness_mirror" />
+
+ <com.android.systemui.statusbar.ScrimView
+ android:id="@+id/scrim_in_front"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:importantForAccessibility="no"
+ sysui:ignoreRightInset="true"
+ />
+
+ <LinearLayout
+ android:id="@+id/lock_icon_container"
+ android:orientation="vertical"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@dimen/status_bar_height"
+ android:layout_gravity="top|center_horizontal">
+ <com.android.systemui.statusbar.phone.LockIcon
+ android:id="@+id/lock_icon"
+ android:layout_width="@dimen/keyguard_lock_width"
+ android:layout_height="@dimen/keyguard_lock_height"
+ android:layout_gravity="center_horizontal"
+ android:layout_marginTop="@dimen/keyguard_lock_padding"
+ android:contentDescription="@string/accessibility_unlock_button"
+ android:src="@*android:drawable/ic_lock"
+ android:scaleType="center" />
+ <com.android.keyguard.KeyguardMessageArea
+ android:id="@+id/keyguard_message_area"
+ style="@style/Keyguard.TextView"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@dimen/keyguard_lock_padding"
+ android:gravity="center"
+ android:singleLine="true"
+ android:ellipsize="marquee"
+ android:focusable="true" />
+ </LinearLayout>
+</com.android.systemui.statusbar.phone.NotificationShadeWindowView>
diff --git a/packages/SystemUI/res/layout/super_status_bar.xml b/packages/SystemUI/res/layout/super_status_bar.xml
index 9716a00..8fee2cf9 100644
--- a/packages/SystemUI/res/layout/super_status_bar.xml
+++ b/packages/SystemUI/res/layout/super_status_bar.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
**
-** Copyright 2012, The Android Open Source Project
+** Copyright 2020, 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.
@@ -17,7 +17,7 @@
*/
-->
-<!-- This is the combined status bar / notification panel window. -->
+<!-- This is the status bar window. -->
<com.android.systemui.statusbar.phone.StatusBarWindowView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:sysui="http://schemas.android.com/apk/res-auto"
@@ -25,85 +25,8 @@
android:layout_height="match_parent"
android:fitsSystemWindows="true">
- <com.android.systemui.statusbar.BackDropView
- android:id="@+id/backdrop"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:visibility="gone"
- sysui:ignoreRightInset="true"
- >
- <ImageView android:id="@+id/backdrop_back"
- android:layout_width="match_parent"
- android:scaleType="centerCrop"
- android:layout_height="match_parent" />
- <ImageView android:id="@+id/backdrop_front"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:scaleType="centerCrop"
- android:visibility="invisible" />
- </com.android.systemui.statusbar.BackDropView>
-
- <com.android.systemui.statusbar.ScrimView
- android:id="@+id/scrim_for_bubble"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:importantForAccessibility="no"
- sysui:ignoreRightInset="true"
- />
-
<FrameLayout
android:id="@+id/status_bar_container"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
-
- <com.android.systemui.statusbar.ScrimView
- android:id="@+id/scrim_behind"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:importantForAccessibility="no"
- sysui:ignoreRightInset="true"
- />
-
- <include layout="@layout/status_bar_expanded"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:visibility="invisible" />
-
- <include layout="@layout/brightness_mirror" />
-
- <com.android.systemui.statusbar.ScrimView
- android:id="@+id/scrim_in_front"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:importantForAccessibility="no"
- sysui:ignoreRightInset="true"
- />
-
- <LinearLayout
- android:id="@+id/lock_icon_container"
- android:orientation="vertical"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/status_bar_height"
- android:layout_gravity="top|center_horizontal">
- <com.android.systemui.statusbar.phone.LockIcon
- android:id="@+id/lock_icon"
- android:layout_width="@dimen/keyguard_lock_width"
- android:layout_height="@dimen/keyguard_lock_height"
- android:layout_gravity="center_horizontal"
- android:layout_marginTop="@dimen/keyguard_lock_padding"
- android:contentDescription="@string/accessibility_unlock_button"
- android:src="@*android:drawable/ic_lock"
- android:scaleType="center" />
- <com.android.keyguard.KeyguardMessageArea
- android:id="@+id/keyguard_message_area"
- style="@style/Keyguard.TextView"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/keyguard_lock_padding"
- android:gravity="center"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:focusable="true" />
- </LinearLayout>
</com.android.systemui.statusbar.phone.StatusBarWindowView>
diff --git a/packages/SystemUI/src/com/android/systemui/Dependency.java b/packages/SystemUI/src/com/android/systemui/Dependency.java
index bbe972d..16f9cda 100644
--- a/packages/SystemUI/src/com/android/systemui/Dependency.java
+++ b/packages/SystemUI/src/com/android/systemui/Dependency.java
@@ -88,6 +88,7 @@
import com.android.systemui.statusbar.phone.NavigationModeController;
import com.android.systemui.statusbar.phone.NotificationGroupAlertTransferHelper;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
+import com.android.systemui.statusbar.phone.NotificationShadeWindowController;
import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.phone.StatusBarIconController;
@@ -237,7 +238,8 @@
@Inject Lazy<LeakReporter> mLeakReporter;
@Inject Lazy<GarbageMonitor> mGarbageMonitor;
@Inject Lazy<TunerService> mTunerService;
- @Inject Lazy<StatusBarWindowController> mStatusBarWindowController;
+ @Inject Lazy<NotificationShadeWindowController> mNotificationShadeWindowController;
+ @Inject Lazy<StatusBarWindowController> mTempStatusBarWindowController;
@Inject Lazy<DarkIconDispatcher> mDarkIconDispatcher;
@Inject Lazy<ConfigurationController> mConfigurationController;
@Inject Lazy<StatusBarIconController> mStatusBarIconController;
@@ -398,7 +400,10 @@
mProviders.put(TunerService.class, mTunerService::get);
- mProviders.put(StatusBarWindowController.class, mStatusBarWindowController::get);
+ mProviders.put(NotificationShadeWindowController.class,
+ mNotificationShadeWindowController::get);
+
+ mProviders.put(StatusBarWindowController.class, mTempStatusBarWindowController::get);
mProviders.put(DarkIconDispatcher.class, mDarkIconDispatcher::get);
diff --git a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
index c533755..db8b583 100644
--- a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
+++ b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
@@ -455,17 +455,25 @@
private void setupStatusBarPadding(int padding) {
// Add some padding to all the content near the edge of the screen.
StatusBar statusBar = mStatusBarLazy.get();
- View statusBarWindow = statusBar.getStatusBarWindow();
- if (statusBarWindow != null) {
- TunablePadding.addTunablePadding(statusBarWindow.findViewById(R.id.keyguard_header),
+ final View notificationShadeWindowView = statusBar.getNotificationShadeWindowView();
+ if (notificationShadeWindowView != null) {
+ TunablePadding.addTunablePadding(
+ notificationShadeWindowView.findViewById(R.id.keyguard_header),
PADDING, padding, FLAG_END);
- FragmentHostManager fragmentHostManager = FragmentHostManager.get(statusBarWindow);
- fragmentHostManager.addTagListener(CollapsedStatusBarFragment.TAG,
- new TunablePaddingTagListener(padding, R.id.status_bar));
+ final FragmentHostManager fragmentHostManager =
+ FragmentHostManager.get(notificationShadeWindowView);
fragmentHostManager.addTagListener(QS.TAG,
new TunablePaddingTagListener(padding, R.id.header));
}
+
+ final View statusBarWindow = statusBar.getStatusBarWindow();
+ if (statusBarWindow != null) {
+ final FragmentHostManager fragmentHostManager =
+ FragmentHostManager.get(statusBarWindow);
+ fragmentHostManager.addTagListener(CollapsedStatusBarFragment.TAG,
+ new TunablePaddingTagListener(padding, R.id.status_bar));
+ }
}
@VisibleForTesting
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
index d835ee1..644d8c4 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
@@ -89,9 +89,9 @@
import com.android.systemui.statusbar.notification.NotificationInterruptionStateProvider;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
+import com.android.systemui.statusbar.phone.NotificationShadeWindowController;
import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.StatusBar;
-import com.android.systemui.statusbar.phone.StatusBarWindowController;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.RemoteInputUriController;
import com.android.systemui.statusbar.policy.ZenModeController;
@@ -166,7 +166,7 @@
private final HashSet<String> mUserBlockedBubbles;
// Bubbles get added to the status bar view
- private final StatusBarWindowController mStatusBarWindowController;
+ private final NotificationShadeWindowController mNotificationShadeWindowController;
private final ZenModeController mZenModeController;
private StatusBarStateListener mStatusBarStateListener;
private final ScreenshotHelper mScreenshotHelper;
@@ -245,7 +245,7 @@
@Inject
public BubbleController(Context context,
- StatusBarWindowController statusBarWindowController,
+ NotificationShadeWindowController notificationShadeWindowController,
StatusBarStateController statusBarStateController,
ShadeController shadeController,
BubbleData data,
@@ -256,14 +256,14 @@
NotificationGroupManager groupManager,
NotificationEntryManager entryManager,
RemoteInputUriController remoteInputUriController) {
- this(context, statusBarWindowController, statusBarStateController, shadeController,
+ this(context, notificationShadeWindowController, statusBarStateController, shadeController,
data, null /* synchronizer */, configurationController, interruptionStateProvider,
zenModeController, notifUserManager, groupManager, entryManager,
remoteInputUriController);
}
public BubbleController(Context context,
- StatusBarWindowController statusBarWindowController,
+ NotificationShadeWindowController notificationShadeWindowController,
StatusBarStateController statusBarStateController,
ShadeController shadeController,
BubbleData data,
@@ -324,7 +324,7 @@
}
});
- mStatusBarWindowController = statusBarWindowController;
+ mNotificationShadeWindowController = notificationShadeWindowController;
mStatusBarStateListener = new StatusBarStateListener();
statusBarStateController.addCallback(mStatusBarStateListener);
@@ -377,10 +377,10 @@
private void ensureStackViewCreated() {
if (mStackView == null) {
mStackView = new BubbleStackView(mContext, mBubbleData, mSurfaceSynchronizer);
- ViewGroup sbv = mStatusBarWindowController.getStatusBarView();
- int bubbleScrimIndex = sbv.indexOfChild(sbv.findViewById(R.id.scrim_for_bubble));
+ ViewGroup nsv = mNotificationShadeWindowController.getNotificationShadeView();
+ int bubbleScrimIndex = nsv.indexOfChild(nsv.findViewById(R.id.scrim_for_bubble));
int stackIndex = bubbleScrimIndex + 1; // Show stack above bubble scrim.
- sbv.addView(mStackView, stackIndex,
+ nsv.addView(mStackView, stackIndex,
new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
if (mExpandListener != null) {
mStackView.setExpandListener(mExpandListener);
@@ -473,7 +473,7 @@
if (listener != null) {
listener.onBubbleExpandChanged(isExpanding, key);
}
- mStatusBarWindowController.setBubbleExpanded(isExpanding);
+ mNotificationShadeWindowController.setBubbleExpanded(isExpanding);
});
if (mStackView != null) {
mStackView.setExpandListener(mExpandListener);
@@ -944,9 +944,9 @@
}
// Let listeners know if bubble state changed.
- boolean hadBubbles = mStatusBarWindowController.getBubblesShowing();
+ boolean hadBubbles = mNotificationShadeWindowController.getBubblesShowing();
boolean hasBubblesShowing = hasBubbles() && mStackView.getVisibility() == VISIBLE;
- mStatusBarWindowController.setBubblesShowing(hasBubblesShowing);
+ mNotificationShadeWindowController.setBubblesShowing(hasBubblesShowing);
if (mStateChangeListener != null && hadBubbles != hasBubblesShowing) {
mStateChangeListener.onHasBubblesChanged(hasBubblesShowing);
}
@@ -983,7 +983,7 @@
&& context.getDisplay().getDisplayId() == DEFAULT_DISPLAY;
final Bubble expandedBubble = mStackView.getExpandedBubble();
if (defaultDisplay && expandedBubble != null && isStackExpanded()
- && !mStatusBarWindowController.getPanelExpanded()) {
+ && !mNotificationShadeWindowController.getPanelExpanded()) {
return expandedBubble;
}
return null;
diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
index c138462..36a4a10 100644
--- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
+++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
@@ -97,8 +97,8 @@
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.GlobalActions.GlobalActionsManager;
import com.android.systemui.plugins.GlobalActionsPanelPlugin;
+import com.android.systemui.statusbar.phone.NotificationShadeWindowController;
import com.android.systemui.statusbar.phone.ScrimController;
-import com.android.systemui.statusbar.phone.StatusBarWindowController;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.util.EmergencyDialerConstants;
@@ -1528,7 +1528,7 @@
private float mScrimAlpha;
private ResetOrientationData mResetOrientationData;
private boolean mHadTopUi;
- private final StatusBarWindowController mStatusBarWindowController;
+ private final NotificationShadeWindowController mNotificationShadeWindowController;
private boolean mControlsEnabled;
ActionsDialog(Context context, MyAdapter adapter,
@@ -1539,7 +1539,8 @@
mAdapter = adapter;
mColorExtractor = Dependency.get(SysuiColorExtractor.class);
mStatusBarService = Dependency.get(IStatusBarService.class);
- mStatusBarWindowController = Dependency.get(StatusBarWindowController.class);
+ mNotificationShadeWindowController =
+ Dependency.get(NotificationShadeWindowController.class);
mControlsEnabled = controlsEnabled;
// Window initialization
@@ -1721,8 +1722,8 @@
public void show() {
super.show();
mShowing = true;
- mHadTopUi = mStatusBarWindowController.getForceHasTopUi();
- mStatusBarWindowController.setForceHasTopUi(true);
+ mHadTopUi = mNotificationShadeWindowController.getForceHasTopUi();
+ mNotificationShadeWindowController.setForceHasTopUi(true);
mBackgroundDrawable.setAlpha(0);
mGlobalActionsLayout.setTranslationX(mGlobalActionsLayout.getAnimationOffsetX());
mGlobalActionsLayout.setTranslationY(mGlobalActionsLayout.getAnimationOffsetY());
@@ -1775,7 +1776,7 @@
}
private void completeDismiss() {
- mStatusBarWindowController.setForceHasTopUi(mHadTopUi);
+ mNotificationShadeWindowController.setForceHasTopUi(mHadTopUi);
super.dismiss();
}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index e13c3e0..2fc7a9c 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -88,9 +88,9 @@
import com.android.systemui.statusbar.phone.BiometricUnlockController;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.NotificationPanelViewController;
+import com.android.systemui.statusbar.phone.NotificationShadeWindowController;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
-import com.android.systemui.statusbar.phone.StatusBarWindowController;
import com.android.systemui.util.InjectionInflationController;
import java.io.FileDescriptor;
@@ -212,7 +212,7 @@
private AlarmManager mAlarmManager;
private AudioManager mAudioManager;
private StatusBarManager mStatusBarManager;
- private final StatusBarWindowController mStatusBarWindowController;
+ private final NotificationShadeWindowController mNotificationShadeWindowController;
private final Executor mUiBgExecutor;
private boolean mSystemReady;
@@ -691,7 +691,7 @@
FalsingManager falsingManager,
LockPatternUtils lockPatternUtils,
BroadcastDispatcher broadcastDispatcher,
- StatusBarWindowController statusBarWindowController,
+ NotificationShadeWindowController notificationShadeWindowController,
Lazy<StatusBarKeyguardViewManager> statusBarKeyguardViewManagerLazy,
DismissCallbackRegistry dismissCallbackRegistry,
@UiBackground Executor uiBgExecutor) {
@@ -699,7 +699,7 @@
mFalsingManager = falsingManager;
mLockPatternUtils = lockPatternUtils;
mBroadcastDispatcher = broadcastDispatcher;
- mStatusBarWindowController = statusBarWindowController;
+ mNotificationShadeWindowController = notificationShadeWindowController;
mStatusBarKeyguardViewManagerLazy = statusBarKeyguardViewManagerLazy;
mDismissCallbackRegistry = dismissCallbackRegistry;
mUiBgExecutor = uiBgExecutor;
@@ -1819,7 +1819,7 @@
adjustStatusBarLocked();
userActivity();
mUpdateMonitor.setKeyguardGoingAway(false);
- mStatusBarWindowController.setKeyguardGoingAway(false);
+ mNotificationShadeWindowController.setKeyguardGoingAway(false);
mShowKeyguardWakeLock.release();
}
mKeyguardDisplayManager.show();
@@ -1852,7 +1852,7 @@
}
mUpdateMonitor.setKeyguardGoingAway(true);
- mStatusBarWindowController.setKeyguardGoingAway(true);
+ mNotificationShadeWindowController.setKeyguardGoingAway(true);
// Don't actually hide the Keyguard at the moment, wait for window
// manager until it tells us it's safe to do so with
diff --git a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
index ae48db2..569f660 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
@@ -68,9 +68,9 @@
import com.android.systemui.statusbar.phone.NavigationBarFragment;
import com.android.systemui.statusbar.phone.NavigationBarView;
import com.android.systemui.statusbar.phone.NavigationModeController;
+import com.android.systemui.statusbar.phone.NotificationShadeWindowController;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.phone.StatusBarWindowCallback;
-import com.android.systemui.statusbar.phone.StatusBarWindowController;
import com.android.systemui.statusbar.policy.CallbackController;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
import com.android.systemui.statusbar.policy.DeviceProvisionedController.DeviceProvisionedListener;
@@ -109,7 +109,7 @@
private SysUiState mSysUiState;
private final Handler mHandler;
private final NavigationBarController mNavBarController;
- private final StatusBarWindowController mStatusBarWinController;
+ private final NotificationShadeWindowController mStatusBarWinController;
private final Runnable mConnectionRunnable = this::internalConnectToCurrentUser;
private final ComponentName mRecentsComponentName;
private final DeviceProvisionedController mDeviceProvisionedController;
@@ -476,8 +476,9 @@
@Inject
public OverviewProxyService(Context context, DeviceProvisionedController provisionController,
NavigationBarController navBarController, NavigationModeController navModeController,
- StatusBarWindowController statusBarWinController, SysUiState sysUiState, PipUI pipUI,
- Optional<Divider> dividerOptional, Optional<Lazy<StatusBar>> statusBarOptionalLazy) {
+ NotificationShadeWindowController statusBarWinController, SysUiState sysUiState,
+ PipUI pipUI, Optional<Divider> dividerOptional,
+ Optional<Lazy<StatusBar>> statusBarOptionalLazy) {
mContext = context;
mPipUI = pipUI;
mStatusBarOptionalLazy = statusBarOptionalLazy;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
index 246b0f0..a457266 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
@@ -59,10 +59,10 @@
import com.android.systemui.statusbar.phone.BiometricUnlockController;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.LockscreenWallpaper;
+import com.android.systemui.statusbar.phone.NotificationShadeWindowController;
import com.android.systemui.statusbar.phone.ScrimController;
import com.android.systemui.statusbar.phone.ScrimState;
import com.android.systemui.statusbar.phone.StatusBar;
-import com.android.systemui.statusbar.phone.StatusBarWindowController;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import java.io.FileDescriptor;
@@ -105,7 +105,7 @@
private final NotificationEntryManager mEntryManager;
@Nullable
- private Lazy<StatusBarWindowController> mStatusBarWindowController;
+ private Lazy<NotificationShadeWindowController> mStatusBarWindowController;
@Nullable
private BiometricUnlockController mBiometricUnlockController;
@@ -180,7 +180,7 @@
public NotificationMediaManager(
Context context,
Lazy<StatusBar> statusBarLazy,
- Lazy<StatusBarWindowController> statusBarWindowController,
+ Lazy<NotificationShadeWindowController> statusBarWindowController,
NotificationEntryManager notificationEntryManager,
MediaArtworkProcessor mediaArtworkProcessor,
KeyguardBypassController keyguardBypassController) {
@@ -525,7 +525,7 @@
}
}
- StatusBarWindowController windowController = mStatusBarWindowController.get();
+ NotificationShadeWindowController windowController = mStatusBarWindowController.get();
boolean hideBecauseOccluded = mStatusBarLazy.get().isOccluded();
final boolean hasArtwork = artworkDrawable != null;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SuperStatusBarViewFactory.java b/packages/SystemUI/src/com/android/systemui/statusbar/SuperStatusBarViewFactory.java
index 9398e6f..0ab5afa 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/SuperStatusBarViewFactory.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/SuperStatusBarViewFactory.java
@@ -23,6 +23,7 @@
import com.android.systemui.R;
import com.android.systemui.statusbar.phone.LockIcon;
import com.android.systemui.statusbar.phone.NotificationPanelView;
+import com.android.systemui.statusbar.phone.NotificationShadeWindowView;
import com.android.systemui.statusbar.phone.StatusBarWindowView;
import com.android.systemui.util.InjectionInflationController;
@@ -30,8 +31,8 @@
import javax.inject.Singleton;
/**
- * Creates a single instance of super_status_bar that can be shared across various system ui
- * objects.
+ * Creates a single instance of super_status_bar and super_notification_shade that can be shared
+ * across various system ui objects.
*/
@Singleton
public class SuperStatusBarViewFactory {
@@ -39,6 +40,7 @@
private final Context mContext;
private final InjectionInflationController mInjectionInflationController;
+ private NotificationShadeWindowView mNotificationShadeWindowView;
private StatusBarWindowView mStatusBarWindowView;
private NotificationShelf mNotificationShelf;
@@ -50,15 +52,42 @@
}
/**
- * Gets the inflated {@link StatusBarWindowView} from {@link R.layout#super_status_bar}. Returns
- * a cached instance, if it has already been inflated.
+ * Gets the inflated {@link NotificationShadeWindowView} from
+ * {@link R.layout#super_notification_shade}.
+ * Returns a cached instance, if it has already been inflated.
+ */
+ public NotificationShadeWindowView getNotificationShadeWindowView() {
+ if (mNotificationShadeWindowView != null) {
+ return mNotificationShadeWindowView;
+ }
+
+ mNotificationShadeWindowView = (NotificationShadeWindowView)
+ mInjectionInflationController.injectable(
+ LayoutInflater.from(mContext)).inflate(R.layout.super_notification_shade,
+ /* root= */ null);
+ if (mNotificationShadeWindowView == null) {
+ throw new IllegalStateException(
+ "R.layout.super_notification_shade could not be properly inflated");
+ }
+ return mNotificationShadeWindowView;
+ }
+
+ /** Gets the {@link LockIcon} inside of {@link R.layout#super_status_bar}. */
+ public LockIcon getLockIcon() {
+ return getNotificationShadeWindowView().findViewById(R.id.lock_icon);
+ }
+
+ /**
+ * Gets the inflated {@link StatusBarWindowView} from {@link R.layout#super_status_bar}.
+ * Returns a cached instance, if it has already been inflated.
*/
public StatusBarWindowView getStatusBarWindowView() {
if (mStatusBarWindowView != null) {
return mStatusBarWindowView;
}
- mStatusBarWindowView = (StatusBarWindowView) mInjectionInflationController.injectable(
+ mStatusBarWindowView =
+ (StatusBarWindowView) mInjectionInflationController.injectable(
LayoutInflater.from(mContext)).inflate(R.layout.super_status_bar,
/* root= */ null);
if (mStatusBarWindowView == null) {
@@ -68,11 +97,6 @@
return mStatusBarWindowView;
}
- /** Gets the {@link LockIcon} inside of {@link R.layout#super_status_bar}. */
- public LockIcon getLockIcon() {
- return getStatusBarWindowView().findViewById(R.id.lock_icon);
- }
-
/**
* Gets the inflated {@link NotificationShelf} from
* {@link R.layout#status_bar_notification_shelf}.
@@ -98,11 +122,11 @@
}
public NotificationPanelView getNotificationPanelView() {
- StatusBarWindowView statusBarWindowView = getStatusBarWindowView();
- if (statusBarWindowView == null) {
+ NotificationShadeWindowView notificationShadeWindowView = getNotificationShadeWindowView();
+ if (notificationShadeWindowView == null) {
return null;
}
- return mStatusBarWindowView.findViewById(R.id.notification_panel);
+ return mNotificationShadeWindowView.findViewById(R.id.notification_panel);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/ActivityLaunchAnimator.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/ActivityLaunchAnimator.java
index 6660569..5fc043a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/ActivityLaunchAnimator.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/ActivityLaunchAnimator.java
@@ -38,7 +38,7 @@
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
import com.android.systemui.statusbar.phone.CollapsedStatusBarFragment;
import com.android.systemui.statusbar.phone.NotificationPanelViewController;
-import com.android.systemui.statusbar.phone.StatusBarWindowViewController;
+import com.android.systemui.statusbar.phone.NotificationShadeWindowViewController;
/**
* A class that allows activities to be launched in a seamless way where the notification
@@ -56,7 +56,7 @@
private final NotificationPanelViewController mNotificationPanel;
private final NotificationListContainer mNotificationContainer;
private final float mWindowCornerRadius;
- private final StatusBarWindowViewController mStatusBarWindowViewController;
+ private final NotificationShadeWindowViewController mNotificationShadeWindowViewController;
private Callback mCallback;
private final Runnable mTimeoutRunnable = () -> {
setAnimationPending(false);
@@ -67,21 +67,23 @@
private boolean mIsLaunchForActivity;
public ActivityLaunchAnimator(
- StatusBarWindowViewController statusBarWindowViewController,
+ NotificationShadeWindowViewController notificationShadeWindowViewController,
Callback callback,
NotificationPanelViewController notificationPanel,
NotificationListContainer container) {
mNotificationPanel = notificationPanel;
mNotificationContainer = container;
- mStatusBarWindowViewController = statusBarWindowViewController;
+ mNotificationShadeWindowViewController = notificationShadeWindowViewController;
mCallback = callback;
mWindowCornerRadius = ScreenDecorationsUtils
- .getWindowCornerRadius(mStatusBarWindowViewController.getView().getResources());
+ .getWindowCornerRadius(mNotificationShadeWindowViewController.getView()
+ .getResources());
}
public RemoteAnimationAdapter getLaunchAnimation(
View sourceView, boolean occluded) {
- if (!(sourceView instanceof ExpandableNotificationRow) || !mCallback.areLaunchAnimationsEnabled() || occluded) {
+ if (!(sourceView instanceof ExpandableNotificationRow)
+ || !mCallback.areLaunchAnimationsEnabled() || occluded) {
return null;
}
AnimationRunner animationRunner = new AnimationRunner(
@@ -113,11 +115,12 @@
private void setAnimationPending(boolean pending) {
mAnimationPending = pending;
- mStatusBarWindowViewController.setExpandAnimationPending(pending);
+ mNotificationShadeWindowViewController.setExpandAnimationPending(pending);
if (pending) {
- mStatusBarWindowViewController.getView().postDelayed(mTimeoutRunnable, LAUNCH_TIMEOUT);
+ mNotificationShadeWindowViewController.getView().postDelayed(mTimeoutRunnable,
+ LAUNCH_TIMEOUT);
} else {
- mStatusBarWindowViewController.getView().removeCallbacks(mTimeoutRunnable);
+ mNotificationShadeWindowViewController.getView().removeCallbacks(mTimeoutRunnable);
}
}
@@ -247,7 +250,7 @@
private void setExpandAnimationRunning(boolean running) {
mNotificationPanel.setLaunchingNotification(running);
mSourceNotification.setExpandAnimationRunning(running);
- mStatusBarWindowViewController.setExpandAnimationRunning(running);
+ mNotificationShadeWindowViewController.setExpandAnimationRunning(running);
mNotificationContainer.setExpandingNotification(running ? mSourceNotification : null);
mAnimationRunning = running;
if (!running) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationMediaTemplateViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationMediaTemplateViewWrapper.java
index 76fdfc6..874d81d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationMediaTemplateViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationMediaTemplateViewWrapper.java
@@ -47,7 +47,7 @@
import com.android.systemui.statusbar.NotificationMediaManager;
import com.android.systemui.statusbar.TransformableView;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
-import com.android.systemui.statusbar.phone.StatusBarWindowController;
+import com.android.systemui.statusbar.phone.NotificationShadeWindowController;
import com.android.systemui.util.Utils;
import java.util.Timer;
@@ -181,8 +181,9 @@
final int[] compactActions = mRow.getEntry().getSbn().getNotification().extras
.getIntArray(Notification.EXTRA_COMPACT_ACTIONS);
int tintColor = getNotificationHeader().getOriginalIconColor();
- StatusBarWindowController ctrl = Dependency.get(StatusBarWindowController.class);
- QuickQSPanel panel = ctrl.getStatusBarView().findViewById(
+ NotificationShadeWindowController ctrl = Dependency.get(
+ NotificationShadeWindowController.class);
+ QuickQSPanel panel = ctrl.getNotificationShadeView().findViewById(
com.android.systemui.R.id.quick_qs_panel);
StatusBarNotification sbn = mRow.getEntry().getSbn();
Notification notif = sbn.getNotification();
@@ -193,7 +194,7 @@
mActions,
compactActions,
notif.contentIntent);
- QSPanel bigPanel = ctrl.getStatusBarView().findViewById(
+ QSPanel bigPanel = ctrl.getNotificationShadeView().findViewById(
com.android.systemui.R.id.quick_settings_panel);
bigPanel.addMediaSession(token,
notif.getSmallIcon(),
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java
index 4880520..691e1c4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java
@@ -141,7 +141,7 @@
private final KeyguardUpdateMonitor mUpdateMonitor;
private final DozeParameters mDozeParameters;
private final KeyguardStateController mKeyguardStateController;
- private final StatusBarWindowController mStatusBarWindowController;
+ private final NotificationShadeWindowController mNotificationShadeWindowController;
private final Context mContext;
private final int mWakeUpDelay;
private int mMode;
@@ -162,7 +162,7 @@
public BiometricUnlockController(Context context, DozeScrimController dozeScrimController,
KeyguardViewMediator keyguardViewMediator, ScrimController scrimController,
StatusBar statusBar, ShadeController shadeController,
- StatusBarWindowController statusBarWindowController,
+ NotificationShadeWindowController notificationShadeWindowController,
KeyguardStateController keyguardStateController, Handler handler,
KeyguardUpdateMonitor keyguardUpdateMonitor,
@Main Resources resources,
@@ -177,7 +177,8 @@
mMediaManager = Dependency.get(NotificationMediaManager.class);
Dependency.get(WakefulnessLifecycle.class).addObserver(mWakefulnessObserver);
Dependency.get(ScreenLifecycle.class).addObserver(mScreenObserver);
- mStatusBarWindowController = statusBarWindowController;
+
+ mNotificationShadeWindowController = notificationShadeWindowController;
mDozeScrimController = dozeScrimController;
mKeyguardViewMediator = keyguardViewMediator;
mScrimController = scrimController;
@@ -284,7 +285,7 @@
// notifications would light up first, creating an unpleasant animation.
// Defer changing the screen brightness by forcing doze brightness on our window
// until the clock and the notifications are faded out.
- mStatusBarWindowController.setForceDozeBrightness(true);
+ mNotificationShadeWindowController.setForceDozeBrightness(true);
}
// During wake and unlock, we need to draw black before waking up to avoid abrupt
// brightness changes due to display state transitions.
@@ -340,7 +341,7 @@
Trace.beginSection("MODE_WAKE_AND_UNLOCK_FROM_DREAM");
mUpdateMonitor.awakenFromDream();
}
- mStatusBarWindowController.setStatusBarFocusable(false);
+ mNotificationShadeWindowController.setNotificationShadeFocusable(false);
if (delayWakeUp) {
mHandler.postDelayed(wakeUp, mWakeUpDelay);
} else {
@@ -508,7 +509,7 @@
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
- mStatusBarWindowController.setForceDozeBrightness(false);
+ mNotificationShadeWindowController.setForceDozeBrightness(false);
}
}, StatusBar.FADE_KEYGUARD_DURATION_PULSING);
}
@@ -522,7 +523,7 @@
private void resetMode() {
mMode = MODE_NONE;
- mStatusBarWindowController.setForceDozeBrightness(false);
+ mNotificationShadeWindowController.setForceDozeBrightness(false);
if (mStatusBar.getNavigationBarView() != null) {
mStatusBar.getNavigationBarView().setWakeAndUnlocking(false);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeServiceHost.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeServiceHost.java
index accd2a4..04efc2d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeServiceHost.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeServiceHost.java
@@ -85,9 +85,9 @@
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
private final VisualStabilityManager mVisualStabilityManager;
private final PulseExpansionHandler mPulseExpansionHandler;
- private final StatusBarWindowController mStatusBarWindowController;
+ private final NotificationShadeWindowController mNotificationShadeWindowController;
private final NotificationWakeUpCoordinator mNotificationWakeUpCoordinator;
- private StatusBarWindowViewController mStatusBarWindowViewController;
+ private NotificationShadeWindowViewController mNotificationShadeWindowViewController;
private final LockscreenLockIconController mLockscreenLockIconController;
private NotificationIconAreaController mNotificationIconAreaController;
private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
@@ -108,7 +108,7 @@
DozeScrimController dozeScrimController, KeyguardUpdateMonitor keyguardUpdateMonitor,
VisualStabilityManager visualStabilityManager,
PulseExpansionHandler pulseExpansionHandler,
- StatusBarWindowController statusBarWindowController,
+ NotificationShadeWindowController notificationShadeWindowController,
NotificationWakeUpCoordinator notificationWakeUpCoordinator,
LockscreenLockIconController lockscreenLockIconController) {
super();
@@ -127,7 +127,7 @@
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
mVisualStabilityManager = visualStabilityManager;
mPulseExpansionHandler = pulseExpansionHandler;
- mStatusBarWindowController = statusBarWindowController;
+ mNotificationShadeWindowController = notificationShadeWindowController;
mNotificationWakeUpCoordinator = notificationWakeUpCoordinator;
mLockscreenLockIconController = lockscreenLockIconController;
}
@@ -140,13 +140,13 @@
public void initialize(StatusBar statusBar,
NotificationIconAreaController notificationIconAreaController,
StatusBarKeyguardViewManager statusBarKeyguardViewManager,
- StatusBarWindowViewController statusBarWindowViewController,
+ NotificationShadeWindowViewController notificationShadeWindowViewController,
NotificationPanelViewController notificationPanel, View ambientIndicationContainer) {
mStatusBar = statusBar;
mNotificationIconAreaController = notificationIconAreaController;
mStatusBarKeyguardViewManager = statusBarKeyguardViewManager;
mNotificationPanel = notificationPanel;
- mStatusBarWindowViewController = statusBarWindowViewController;
+ mNotificationShadeWindowViewController = notificationShadeWindowViewController;
mAmbientIndicationContainer = ambientIndicationContainer;
mBiometricUnlockController = mBiometricUnlockControllerLazy.get();
}
@@ -292,7 +292,7 @@
}
mIgnoreTouchWhilePulsing = ignore;
if (mStatusBarStateController.isDozing() && ignore) {
- mStatusBarWindowViewController.cancelCurrentTouch();
+ mNotificationShadeWindowViewController.cancelCurrentTouch();
}
}
@@ -391,7 +391,7 @@
@Override
public void setDozeScreenBrightness(int value) {
- mStatusBarWindowController.setDozeScreenBrightness(value);
+ mNotificationShadeWindowController.setDozeScreenBrightness(value);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java
index 7b20a7b..c39ee3a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java
@@ -92,21 +92,22 @@
public HeadsUpAppearanceController(
NotificationIconAreaController notificationIconAreaController,
- HeadsUpManagerPhone headsUpManager, View statusbarView,
+ HeadsUpManagerPhone headsUpManager,
+ View notificationShadeView,
SysuiStatusBarStateController statusBarStateController,
KeyguardBypassController keyguardBypassController,
KeyguardStateController keyguardStateController,
NotificationWakeUpCoordinator wakeUpCoordinator, CommandQueue commandQueue,
- NotificationPanelViewController notificationPanelViewController) {
+ NotificationPanelViewController notificationPanelViewController, View statusBarView) {
this(notificationIconAreaController, headsUpManager, statusBarStateController,
keyguardBypassController, wakeUpCoordinator, keyguardStateController,
commandQueue,
- statusbarView.findViewById(R.id.heads_up_status_bar_view),
- statusbarView.findViewById(R.id.notification_stack_scroller),
+ statusBarView.findViewById(R.id.heads_up_status_bar_view),
+ notificationShadeView.findViewById(R.id.notification_stack_scroller),
notificationPanelViewController,
- statusbarView.findViewById(R.id.clock),
- statusbarView.findViewById(R.id.operator_name_frame),
- statusbarView.findViewById(R.id.centered_icon_area));
+ statusBarView.findViewById(R.id.clock),
+ statusBarView.findViewById(R.id.operator_name_frame),
+ statusBarView.findViewById(R.id.centered_icon_area));
}
@VisibleForTesting
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
index 6ac6d35..c6e3fde 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
@@ -65,7 +65,7 @@
private final StatusBarStateController mStatusBarStateController;
private final KeyguardBypassController mBypassController;
private final int mAutoHeadsUpNotificationDecay;
- private View mStatusBarWindowView;
+ private View mNotificationShadeWindowView;
private NotificationGroupManager mGroupManager;
private VisualStabilityManager mVisualStabilityManager;
private StatusBarTouchableRegionManager mStatusBarTouchableRegionManager;
@@ -124,14 +124,13 @@
initResources();
}
-
- public void setUp(@NonNull View statusBarWindowView,
+ public void setUp(@NonNull View notificationShadeWindowView,
@NonNull NotificationGroupManager groupManager,
@NonNull StatusBar bar,
@NonNull VisualStabilityManager visualStabilityManager) {
- mStatusBarWindowView = statusBarWindowView;
- mStatusBarTouchableRegionManager = new StatusBarTouchableRegionManager(mContext, this, bar,
- statusBarWindowView);
+ mNotificationShadeWindowView = notificationShadeWindowView;
+ mStatusBarTouchableRegionManager = new StatusBarTouchableRegionManager(this, bar,
+ notificationShadeWindowView);
mGroupManager = groupManager;
mVisualStabilityManager = visualStabilityManager;
@@ -364,7 +363,7 @@
// updated yet, but callbacks leading out of the headsUp manager, querying it. Let's
// therefore also check if the topEntry is null.
if (!hasPinnedHeadsUp() || topEntry == null) {
- mTouchableRegion.set(0, 0, mStatusBarWindowView.getWidth(), mStatusBarHeight);
+ mTouchableRegion.set(0, 0, mNotificationShadeWindowView.getWidth(), mStatusBarHeight);
updateRegionForNotch(mTouchableRegion);
} else {
@@ -386,7 +385,7 @@
}
private void updateRegionForNotch(Region region) {
- WindowInsets windowInsets = mStatusBarWindowView.getRootWindowInsets();
+ WindowInsets windowInsets = mNotificationShadeWindowView.getRootWindowInsets();
if (windowInsets == null) {
Log.w(TAG, "StatusBarWindowView is not attached.");
return;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
index 3554b54..707138e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
@@ -128,7 +128,7 @@
mAodIcons.setAnimationsEnabled(false);
mAodIcons.removeAllViews();
}
- mAodIcons = mStatusBar.getStatusBarWindow().findViewById(
+ mAodIcons = mStatusBar.getNotificationShadeWindowView().findViewById(
R.id.clock_notification_icon_container);
mAodIcons.setOnLockScreen(true);
updateAodIconsVisibility(false /* animate */);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
index 90ec2a0..6112ae8 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
@@ -1367,14 +1367,7 @@
if (mExpectingSynthesizedDown) {
mExpectingSynthesizedDown = false;
maybeVibrateOnOpening();
- Runnable runnable = () -> fling(velocity > 1f ? 1000f * velocity : 0,
- true /* expand */);
- if (mStatusBar.getStatusBarWindow().getHeight() != mStatusBar.getStatusBarHeight()) {
- // The panel is already expanded to its full size, let's expand directly
- runnable.run();
- } else {
- mExpandAfterLayoutRunnable = runnable;
- }
+ fling(velocity > 1f ? 1000f * velocity : 0, true /* expand */);
onTrackingStopped(false);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowController.java
new file mode 100644
index 0000000..d346d39
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowController.java
@@ -0,0 +1,714 @@
+/*
+ * Copyright (C) 2020 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.statusbar.phone;
+
+import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
+
+import static com.android.systemui.DejankUtils.whitelistIpcs;
+import static com.android.systemui.statusbar.NotificationRemoteInputManager.ENABLE_REMOTE_INPUT;
+
+import android.app.IActivityManager;
+import android.content.Context;
+import android.content.pm.ActivityInfo;
+import android.content.res.Resources;
+import android.graphics.PixelFormat;
+import android.os.Binder;
+import android.os.RemoteException;
+import android.os.SystemProperties;
+import android.os.Trace;
+import android.util.Log;
+import android.view.Display;
+import android.view.Gravity;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.WindowManager;
+import android.view.WindowManager.LayoutParams;
+
+import com.android.systemui.Dumpable;
+import com.android.systemui.R;
+import com.android.systemui.colorextraction.SysuiColorExtractor;
+import com.android.systemui.keyguard.KeyguardViewMediator;
+import com.android.systemui.plugins.statusbar.StatusBarStateController;
+import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener;
+import com.android.systemui.statusbar.RemoteInputController.Callback;
+import com.android.systemui.statusbar.StatusBarState;
+import com.android.systemui.statusbar.SuperStatusBarViewFactory;
+import com.android.systemui.statusbar.SysuiStatusBarStateController;
+import com.android.systemui.statusbar.policy.ConfigurationController;
+import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener;
+
+import com.google.android.collect.Lists;
+
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
+import java.lang.ref.WeakReference;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+/**
+ * Encapsulates all logic for the notification shade window state management.
+ */
+@Singleton
+public class NotificationShadeWindowController implements Callback, Dumpable,
+ ConfigurationListener {
+
+ private static final String TAG = "NotificationShadeWindowController";
+ private static final boolean DEBUG = false;
+
+ private final Context mContext;
+ private final WindowManager mWindowManager;
+ private final IActivityManager mActivityManager;
+ private final DozeParameters mDozeParameters;
+ private final LayoutParams mLpChanged;
+ private final boolean mKeyguardScreenRotation;
+ private final long mLockScreenDisplayTimeout;
+ private final Display.Mode mKeyguardDisplayMode;
+ private final KeyguardBypassController mKeyguardBypassController;
+ private ViewGroup mNotificationShadeView;
+ private LayoutParams mLp;
+ private boolean mHasTopUi;
+ private boolean mHasTopUiChanged;
+ private float mScreenBrightnessDoze;
+ private final State mCurrentState = new State();
+ private OtherwisedCollapsedListener mListener;
+ private ForcePluginOpenListener mForcePluginOpenListener;
+ private final ArrayList<WeakReference<StatusBarWindowCallback>>
+ mCallbacks = Lists.newArrayList();
+
+ private final SysuiColorExtractor mColorExtractor;
+ private final SuperStatusBarViewFactory mSuperStatusBarViewFactory;
+
+ @Inject
+ public NotificationShadeWindowController(Context context, WindowManager windowManager,
+ IActivityManager activityManager, DozeParameters dozeParameters,
+ StatusBarStateController statusBarStateController,
+ ConfigurationController configurationController,
+ KeyguardBypassController keyguardBypassController, SysuiColorExtractor colorExtractor,
+ SuperStatusBarViewFactory superStatusBarViewFactory) {
+ mContext = context;
+ mWindowManager = windowManager;
+ mActivityManager = activityManager;
+ mKeyguardScreenRotation = shouldEnableKeyguardScreenRotation();
+ mDozeParameters = dozeParameters;
+ mScreenBrightnessDoze = mDozeParameters.getScreenBrightnessDoze();
+ mLpChanged = new LayoutParams();
+ mKeyguardBypassController = keyguardBypassController;
+ mColorExtractor = colorExtractor;
+ mSuperStatusBarViewFactory = superStatusBarViewFactory;
+ mNotificationShadeView = mSuperStatusBarViewFactory.getNotificationShadeWindowView();
+
+ mLockScreenDisplayTimeout = context.getResources()
+ .getInteger(R.integer.config_lockScreenDisplayTimeout);
+ ((SysuiStatusBarStateController) statusBarStateController)
+ .addCallback(mStateListener,
+ SysuiStatusBarStateController.RANK_STATUS_BAR_WINDOW_CONTROLLER);
+ configurationController.addCallback(this);
+
+ Display.Mode[] supportedModes = context.getDisplay().getSupportedModes();
+ Display.Mode currentMode = context.getDisplay().getMode();
+ // Running on the highest frame rate available can be expensive.
+ // Let's specify a preferred refresh rate, and allow higher FPS only when we
+ // know that we're not falsing (because we unlocked.)
+ int keyguardRefreshRate = context.getResources()
+ .getInteger(R.integer.config_keyguardRefreshRate);
+ // Find supported display mode with the same resolution and requested refresh rate.
+ mKeyguardDisplayMode = Arrays.stream(supportedModes).filter(mode ->
+ (int) mode.getRefreshRate() == keyguardRefreshRate
+ && mode.getPhysicalWidth() == currentMode.getPhysicalWidth()
+ && mode.getPhysicalHeight() == currentMode.getPhysicalHeight())
+ .findFirst().orElse(null);
+ }
+
+ /**
+ * Register to receive notifications about status bar window state changes.
+ */
+ public void registerCallback(StatusBarWindowCallback callback) {
+ // Prevent adding duplicate callbacks
+ for (int i = 0; i < mCallbacks.size(); i++) {
+ if (mCallbacks.get(i).get() == callback) {
+ return;
+ }
+ }
+ mCallbacks.add(new WeakReference<StatusBarWindowCallback>(callback));
+ }
+
+ private boolean shouldEnableKeyguardScreenRotation() {
+ Resources res = mContext.getResources();
+ return SystemProperties.getBoolean("lockscreen.rot_override", false)
+ || res.getBoolean(R.bool.config_enableLockScreenRotation);
+ }
+
+ /**
+ * Adds the notification shade view to the window manager.
+ */
+ public void attach() {
+ // Now that the notification shade encompasses the sliding panel and its
+ // translucent backdrop, the entire thing is made TRANSLUCENT and is
+ // hardware-accelerated.
+ mLp = new LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ LayoutParams.TYPE_NOTIFICATION_SHADE,
+ LayoutParams.FLAG_NOT_FOCUSABLE
+ | LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING
+ | LayoutParams.FLAG_SPLIT_TOUCH
+ | LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
+ | LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS,
+ PixelFormat.TRANSLUCENT);
+ mLp.token = new Binder();
+ mLp.gravity = Gravity.TOP;
+ mLp.setFitWindowInsetsTypes(0 /* types */);
+ mLp.softInputMode = LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
+ mLp.setTitle("NotificationShade");
+ mLp.packageName = mContext.getPackageName();
+ mLp.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
+ mWindowManager.addView(mNotificationShadeView, mLp);
+ mLpChanged.copyFrom(mLp);
+ onThemeChanged();
+ }
+
+ public ViewGroup getNotificationShadeView() {
+ return mNotificationShadeView;
+ }
+
+ public void setDozeScreenBrightness(int value) {
+ mScreenBrightnessDoze = value / 255f;
+ }
+
+ private void setKeyguardDark(boolean dark) {
+ int vis = mNotificationShadeView.getSystemUiVisibility();
+ if (dark) {
+ vis = vis | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
+ vis = vis | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
+ } else {
+ vis = vis & ~View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
+ vis = vis & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
+ }
+ mNotificationShadeView.setSystemUiVisibility(vis);
+ }
+
+ private void applyKeyguardFlags(State state) {
+ final boolean scrimsOccludingWallpaper =
+ state.mScrimsVisibility == ScrimController.OPAQUE;
+ final boolean keyguardOrAod = state.mKeyguardShowing
+ || (state.mDozing && mDozeParameters.getAlwaysOn());
+ if (keyguardOrAod && !state.mBackdropShowing && !scrimsOccludingWallpaper) {
+ mLpChanged.flags |= LayoutParams.FLAG_SHOW_WALLPAPER;
+ } else {
+ mLpChanged.flags &= ~LayoutParams.FLAG_SHOW_WALLPAPER;
+ }
+
+ if (state.mDozing) {
+ mLpChanged.privateFlags |= LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
+ } else {
+ mLpChanged.privateFlags &= ~LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
+ }
+
+ if (mKeyguardDisplayMode != null) {
+ boolean bypassOnKeyguard = mKeyguardBypassController.getBypassEnabled()
+ && state.mStatusBarState == StatusBarState.KEYGUARD
+ && !state.mKeyguardFadingAway && !state.mKeyguardGoingAway;
+ if (state.mDozing || bypassOnKeyguard) {
+ mLpChanged.preferredDisplayModeId = mKeyguardDisplayMode.getModeId();
+ } else {
+ mLpChanged.preferredDisplayModeId = 0;
+ }
+ Trace.setCounter("display_mode_id", mLpChanged.preferredDisplayModeId);
+ }
+ }
+
+ private void adjustScreenOrientation(State state) {
+ if (state.isKeyguardShowingAndNotOccluded() || state.mDozing) {
+ if (mKeyguardScreenRotation) {
+ mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_USER;
+ } else {
+ mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;
+ }
+ } else {
+ mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
+ }
+ }
+
+ private void applyFocusableFlag(State state) {
+ boolean panelFocusable = state.mNotificationShadeFocusable && state.mPanelExpanded;
+ if (state.mBouncerShowing && (state.mKeyguardOccluded || state.mKeyguardNeedsInput)
+ || ENABLE_REMOTE_INPUT && state.mRemoteInputActive
+ || state.mBubbleExpanded) {
+ mLpChanged.flags &= ~LayoutParams.FLAG_NOT_FOCUSABLE;
+ mLpChanged.flags &= ~LayoutParams.FLAG_ALT_FOCUSABLE_IM;
+ } else if (state.isKeyguardShowingAndNotOccluded() || panelFocusable) {
+ mLpChanged.flags &= ~LayoutParams.FLAG_NOT_FOCUSABLE;
+ mLpChanged.flags |= LayoutParams.FLAG_ALT_FOCUSABLE_IM;
+ } else {
+ mLpChanged.flags |= LayoutParams.FLAG_NOT_FOCUSABLE;
+ mLpChanged.flags &= ~LayoutParams.FLAG_ALT_FOCUSABLE_IM;
+ }
+
+ mLpChanged.softInputMode = LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
+ }
+
+ private void applyForceShowNavigationFlag(State state) {
+ if (state.mPanelExpanded || state.mBouncerShowing
+ || ENABLE_REMOTE_INPUT && state.mRemoteInputActive) {
+ mLpChanged.privateFlags |= LayoutParams.PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION;
+ } else {
+ mLpChanged.privateFlags &= ~LayoutParams.PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION;
+ }
+ }
+
+ private void applyVisibility(State state) {
+ boolean visible = isExpanded(state);
+ if (state.mForcePluginOpen) {
+ if (mListener != null) {
+ mListener.setWouldOtherwiseCollapse(visible);
+ }
+ visible = true;
+ }
+ if (visible) {
+ mNotificationShadeView.setVisibility(View.VISIBLE);
+ } else {
+ mNotificationShadeView.setVisibility(View.INVISIBLE);
+ }
+ }
+
+ private boolean isExpanded(State state) {
+ return !state.mForceCollapsed && (state.isKeyguardShowingAndNotOccluded()
+ || state.mPanelVisible || state.mKeyguardFadingAway || state.mBouncerShowing
+ || state.mHeadsUpShowing || state.mBubblesShowing
+ || state.mScrimsVisibility != ScrimController.TRANSPARENT);
+ }
+
+ private void applyFitsSystemWindows(State state) {
+ boolean fitsSystemWindows = !state.isKeyguardShowingAndNotOccluded();
+ if (mNotificationShadeView != null
+ && mNotificationShadeView.getFitsSystemWindows() != fitsSystemWindows) {
+ mNotificationShadeView.setFitsSystemWindows(fitsSystemWindows);
+ mNotificationShadeView.requestApplyInsets();
+ }
+ }
+
+ private void applyUserActivityTimeout(State state) {
+ if (state.isKeyguardShowingAndNotOccluded()
+ && state.mStatusBarState == StatusBarState.KEYGUARD
+ && !state.mQsExpanded) {
+ mLpChanged.userActivityTimeout = state.mBouncerShowing
+ ? KeyguardViewMediator.AWAKE_INTERVAL_BOUNCER_MS : mLockScreenDisplayTimeout;
+ } else {
+ mLpChanged.userActivityTimeout = -1;
+ }
+ }
+
+ private void applyInputFeatures(State state) {
+ if (state.isKeyguardShowingAndNotOccluded()
+ && state.mStatusBarState == StatusBarState.KEYGUARD
+ && !state.mQsExpanded && !state.mForceUserActivity) {
+ mLpChanged.inputFeatures |=
+ LayoutParams.INPUT_FEATURE_DISABLE_USER_ACTIVITY;
+ } else {
+ mLpChanged.inputFeatures &=
+ ~LayoutParams.INPUT_FEATURE_DISABLE_USER_ACTIVITY;
+ }
+ }
+
+ private void applyStatusBarColorSpaceAgnosticFlag(State state) {
+ if (!isExpanded(state)) {
+ mLpChanged.privateFlags |= LayoutParams.PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC;
+ } else {
+ mLpChanged.privateFlags &=
+ ~LayoutParams.PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC;
+ }
+ }
+
+ private void apply(State state) {
+ applyKeyguardFlags(state);
+ applyFocusableFlag(state);
+ applyForceShowNavigationFlag(state);
+ adjustScreenOrientation(state);
+ applyVisibility(state);
+ applyUserActivityTimeout(state);
+ applyInputFeatures(state);
+ applyFitsSystemWindows(state);
+ applyModalFlag(state);
+ applyBrightness(state);
+ applyHasTopUi(state);
+ applyNotTouchable(state);
+ applyStatusBarColorSpaceAgnosticFlag(state);
+ if (mLp != null && mLp.copyFrom(mLpChanged) != 0) {
+ mWindowManager.updateViewLayout(mNotificationShadeView, mLp);
+ }
+ if (mHasTopUi != mHasTopUiChanged) {
+ whitelistIpcs(() -> {
+ try {
+ mActivityManager.setHasTopUi(mHasTopUiChanged);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Failed to call setHasTopUi", e);
+ }
+ mHasTopUi = mHasTopUiChanged;
+ });
+ }
+ notifyStateChangedCallbacks();
+ }
+
+ public void notifyStateChangedCallbacks() {
+ for (int i = 0; i < mCallbacks.size(); i++) {
+ StatusBarWindowCallback cb = mCallbacks.get(i).get();
+ if (cb != null) {
+ cb.onStateChanged(mCurrentState.mKeyguardShowing,
+ mCurrentState.mKeyguardOccluded,
+ mCurrentState.mBouncerShowing);
+ }
+ }
+ }
+
+ private void applyModalFlag(State state) {
+ if (state.mHeadsUpShowing) {
+ mLpChanged.flags |= LayoutParams.FLAG_NOT_TOUCH_MODAL;
+ } else {
+ mLpChanged.flags &= ~LayoutParams.FLAG_NOT_TOUCH_MODAL;
+ }
+ }
+
+ private void applyBrightness(State state) {
+ if (state.mForceDozeBrightness) {
+ mLpChanged.screenBrightness = mScreenBrightnessDoze;
+ } else {
+ mLpChanged.screenBrightness = LayoutParams.BRIGHTNESS_OVERRIDE_NONE;
+ }
+ }
+
+ private void applyHasTopUi(State state) {
+ mHasTopUiChanged = state.mForceHasTopUi || isExpanded(state);
+ }
+
+ private void applyNotTouchable(State state) {
+ if (state.mNotTouchable) {
+ mLpChanged.flags |= LayoutParams.FLAG_NOT_TOUCHABLE;
+ } else {
+ mLpChanged.flags &= ~LayoutParams.FLAG_NOT_TOUCHABLE;
+ }
+ }
+
+ public void setKeyguardShowing(boolean showing) {
+ mCurrentState.mKeyguardShowing = showing;
+ apply(mCurrentState);
+ }
+
+ public void setKeyguardOccluded(boolean occluded) {
+ mCurrentState.mKeyguardOccluded = occluded;
+ apply(mCurrentState);
+ }
+
+ public void setKeyguardNeedsInput(boolean needsInput) {
+ mCurrentState.mKeyguardNeedsInput = needsInput;
+ apply(mCurrentState);
+ }
+
+ public void setPanelVisible(boolean visible) {
+ mCurrentState.mPanelVisible = visible;
+ mCurrentState.mNotificationShadeFocusable = visible;
+ apply(mCurrentState);
+ }
+
+ public void setNotificationShadeFocusable(boolean focusable) {
+ mCurrentState.mNotificationShadeFocusable = focusable;
+ apply(mCurrentState);
+ }
+
+ public void setBouncerShowing(boolean showing) {
+ mCurrentState.mBouncerShowing = showing;
+ apply(mCurrentState);
+ }
+
+ public void setBackdropShowing(boolean showing) {
+ mCurrentState.mBackdropShowing = showing;
+ apply(mCurrentState);
+ }
+
+ public void setKeyguardFadingAway(boolean keyguardFadingAway) {
+ mCurrentState.mKeyguardFadingAway = keyguardFadingAway;
+ apply(mCurrentState);
+ }
+
+ public void setQsExpanded(boolean expanded) {
+ mCurrentState.mQsExpanded = expanded;
+ apply(mCurrentState);
+ }
+
+ public void setForceUserActivity(boolean forceUserActivity) {
+ mCurrentState.mForceUserActivity = forceUserActivity;
+ apply(mCurrentState);
+ }
+
+ public void setScrimsVisibility(int scrimsVisibility) {
+ mCurrentState.mScrimsVisibility = scrimsVisibility;
+ apply(mCurrentState);
+ }
+
+ public void setHeadsUpShowing(boolean showing) {
+ mCurrentState.mHeadsUpShowing = showing;
+ apply(mCurrentState);
+ }
+
+ public void setWallpaperSupportsAmbientMode(boolean supportsAmbientMode) {
+ mCurrentState.mWallpaperSupportsAmbientMode = supportsAmbientMode;
+ apply(mCurrentState);
+ }
+
+ /**
+ * @param state The {@link StatusBarStateController} of the status bar.
+ */
+ private void setStatusBarState(int state) {
+ mCurrentState.mStatusBarState = state;
+ apply(mCurrentState);
+ }
+
+ /**
+ * Force the window to be collapsed, even if it should theoretically be expanded.
+ * Used for when a heads-up comes in but we still need to wait for the touchable regions to
+ * be computed.
+ */
+ public void setForceWindowCollapsed(boolean force) {
+ mCurrentState.mForceCollapsed = force;
+ apply(mCurrentState);
+ }
+
+ public void setPanelExpanded(boolean isExpanded) {
+ mCurrentState.mPanelExpanded = isExpanded;
+ apply(mCurrentState);
+ }
+
+ @Override
+ public void onRemoteInputActive(boolean remoteInputActive) {
+ mCurrentState.mRemoteInputActive = remoteInputActive;
+ apply(mCurrentState);
+ }
+
+ /**
+ * Set whether the screen brightness is forced to the value we use for doze mode by the status
+ * bar window.
+ */
+ public void setForceDozeBrightness(boolean forceDozeBrightness) {
+ mCurrentState.mForceDozeBrightness = forceDozeBrightness;
+ apply(mCurrentState);
+ }
+
+ public void setDozing(boolean dozing) {
+ mCurrentState.mDozing = dozing;
+ apply(mCurrentState);
+ }
+
+ public void setForcePluginOpen(boolean forcePluginOpen) {
+ mCurrentState.mForcePluginOpen = forcePluginOpen;
+ apply(mCurrentState);
+ if (mForcePluginOpenListener != null) {
+ mForcePluginOpenListener.onChange(forcePluginOpen);
+ }
+ }
+
+ /**
+ * The forcePluginOpen state for the status bar.
+ */
+ public boolean getForcePluginOpen() {
+ return mCurrentState.mForcePluginOpen;
+ }
+
+ public void setNotTouchable(boolean notTouchable) {
+ mCurrentState.mNotTouchable = notTouchable;
+ apply(mCurrentState);
+ }
+
+ /**
+ * Sets whether there are bubbles showing on the screen.
+ */
+ public void setBubblesShowing(boolean bubblesShowing) {
+ mCurrentState.mBubblesShowing = bubblesShowing;
+ apply(mCurrentState);
+ }
+
+ /**
+ * The bubbles showing state for the status bar.
+ */
+ public boolean getBubblesShowing() {
+ return mCurrentState.mBubblesShowing;
+ }
+
+ /**
+ * Sets if there is a bubble being expanded on the screen.
+ */
+ public void setBubbleExpanded(boolean bubbleExpanded) {
+ mCurrentState.mBubbleExpanded = bubbleExpanded;
+ apply(mCurrentState);
+ }
+
+ /**
+ * Whether the bubble is shown in expanded state for the status bar.
+ */
+ public boolean getBubbleExpanded() {
+ return mCurrentState.mBubbleExpanded;
+ }
+
+ /**
+ * Whether the status bar panel is expanded or not.
+ */
+ public boolean getPanelExpanded() {
+ return mCurrentState.mPanelExpanded;
+ }
+
+ public void setStateListener(OtherwisedCollapsedListener listener) {
+ mListener = listener;
+ }
+
+ public void setForcePluginOpenListener(ForcePluginOpenListener listener) {
+ mForcePluginOpenListener = listener;
+ }
+
+ public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+ pw.println("StatusBarWindowController:");
+ pw.println(" mKeyguardDisplayMode=" + mKeyguardDisplayMode);
+ pw.println(mCurrentState);
+ }
+
+ public boolean isShowingWallpaper() {
+ return !mCurrentState.mBackdropShowing;
+ }
+
+ @Override
+ public void onThemeChanged() {
+ if (mNotificationShadeView == null) {
+ return;
+ }
+
+ final boolean useDarkText = mColorExtractor.getNeutralColors().supportsDarkText();
+ // Make sure we have the correct navbar/statusbar colors.
+ setKeyguardDark(useDarkText);
+ }
+
+ /**
+ * When keyguard will be dismissed but didn't start animation yet.
+ */
+ public void setKeyguardGoingAway(boolean goingAway) {
+ mCurrentState.mKeyguardGoingAway = goingAway;
+ apply(mCurrentState);
+ }
+
+ public boolean getForceHasTopUi() {
+ return mCurrentState.mForceHasTopUi;
+ }
+
+ public void setForceHasTopUi(boolean forceHasTopUi) {
+ mCurrentState.mForceHasTopUi = forceHasTopUi;
+ apply(mCurrentState);
+ }
+
+ private static class State {
+ boolean mKeyguardShowing;
+ boolean mKeyguardOccluded;
+ boolean mKeyguardNeedsInput;
+ boolean mPanelVisible;
+ boolean mPanelExpanded;
+ boolean mNotificationShadeFocusable;
+ boolean mBouncerShowing;
+ boolean mKeyguardFadingAway;
+ boolean mKeyguardGoingAway;
+ boolean mQsExpanded;
+ boolean mHeadsUpShowing;
+ boolean mForceCollapsed;
+ boolean mForceDozeBrightness;
+ boolean mForceUserActivity;
+ boolean mBackdropShowing;
+ boolean mWallpaperSupportsAmbientMode;
+ boolean mNotTouchable;
+ boolean mBubblesShowing;
+ boolean mBubbleExpanded;
+ boolean mForceHasTopUi;
+
+ /**
+ * The {@link StatusBar} state from the status bar.
+ */
+ int mStatusBarState;
+
+ boolean mRemoteInputActive;
+ boolean mForcePluginOpen;
+ boolean mDozing;
+ int mScrimsVisibility;
+
+ private boolean isKeyguardShowingAndNotOccluded() {
+ return mKeyguardShowing && !mKeyguardOccluded;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder result = new StringBuilder();
+ String newLine = "\n";
+ result.append("Window State {");
+ result.append(newLine);
+
+ Field[] fields = this.getClass().getDeclaredFields();
+
+ // Print field names paired with their values
+ for (Field field : fields) {
+ result.append(" ");
+ try {
+ result.append(field.getName());
+ result.append(": ");
+ //requires access to private field:
+ result.append(field.get(this));
+ } catch (IllegalAccessException ex) {
+ }
+ result.append(newLine);
+ }
+ result.append("}");
+
+ return result.toString();
+ }
+ }
+
+ private final StateListener mStateListener = new StateListener() {
+ @Override
+ public void onStateChanged(int newState) {
+ setStatusBarState(newState);
+ }
+
+ @Override
+ public void onDozingChanged(boolean isDozing) {
+ setDozing(isDozing);
+ }
+ };
+
+ /**
+ * Custom listener to pipe data back to plugins about whether or not the status bar would be
+ * collapsed if not for the plugin.
+ * TODO: Find cleaner way to do this.
+ */
+ public interface OtherwisedCollapsedListener {
+ void setWouldOtherwiseCollapse(boolean otherwiseCollapse);
+ }
+
+ /**
+ * Listener to indicate forcePluginOpen has changed
+ */
+ public interface ForcePluginOpenListener {
+ /**
+ * Called when mState.forcePluginOpen is changed
+ */
+ void onChange(boolean forceOpen);
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowView.java
new file mode 100644
index 0000000..6979554
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowView.java
@@ -0,0 +1,614 @@
+/*
+ * Copyright (C) 2020 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.statusbar.phone;
+
+import android.annotation.ColorInt;
+import android.annotation.DrawableRes;
+import android.annotation.LayoutRes;
+import android.content.Context;
+import android.content.res.Configuration;
+import android.content.res.TypedArray;
+import android.graphics.Canvas;
+import android.graphics.Insets;
+import android.graphics.Paint;
+import android.graphics.Rect;
+import android.graphics.drawable.Drawable;
+import android.net.Uri;
+import android.os.Bundle;
+import android.util.AttributeSet;
+import android.view.ActionMode;
+import android.view.DisplayCutout;
+import android.view.InputQueue;
+import android.view.KeyEvent;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.MotionEvent;
+import android.view.SurfaceHolder;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.ViewTreeObserver;
+import android.view.Window;
+import android.view.WindowInsets;
+import android.view.WindowInsetsController;
+import android.widget.FrameLayout;
+
+import com.android.internal.view.FloatingActionMode;
+import com.android.internal.widget.FloatingToolbar;
+import com.android.systemui.R;
+
+/**
+ * Combined keyguard and notification panel view. Also holding backdrop and scrims.
+ */
+public class NotificationShadeWindowView extends FrameLayout {
+ public static final String TAG = "NotificationShadeWindowView";
+ public static final boolean DEBUG = StatusBar.DEBUG;
+
+ private int mRightInset = 0;
+ private int mLeftInset = 0;
+
+ // Implements the floating action mode for TextView's Cut/Copy/Past menu. Normally provided by
+ // DecorView, but since this is a special window we have to roll our own.
+ private View mFloatingActionModeOriginatingView;
+ private ActionMode mFloatingActionMode;
+ private FloatingToolbar mFloatingToolbar;
+ private ViewTreeObserver.OnPreDrawListener mFloatingToolbarPreDrawListener;
+
+ private InteractionEventHandler mInteractionEventHandler;
+
+ public NotificationShadeWindowView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ setMotionEventSplittingEnabled(false);
+ }
+
+ public NotificationPanelView getNotificationPanelView() {
+ return findViewById(R.id.notification_panel);
+ }
+
+ @Override
+ public WindowInsets onApplyWindowInsets(WindowInsets windowInsets) {
+ final Insets insets = windowInsets.getMaxInsets(WindowInsets.Type.systemBars());
+ if (getFitsSystemWindows()) {
+ boolean paddingChanged = insets.top != getPaddingTop()
+ || insets.bottom != getPaddingBottom();
+
+ int rightCutout = 0;
+ int leftCutout = 0;
+ DisplayCutout displayCutout = getRootWindowInsets().getDisplayCutout();
+ if (displayCutout != null) {
+ leftCutout = displayCutout.getSafeInsetLeft();
+ rightCutout = displayCutout.getSafeInsetRight();
+ }
+
+ int targetLeft = Math.max(insets.left, leftCutout);
+ int targetRight = Math.max(insets.right, rightCutout);
+
+ // Super-special right inset handling, because scrims and backdrop need to ignore it.
+ if (targetRight != mRightInset || targetLeft != mLeftInset) {
+ mRightInset = targetRight;
+ mLeftInset = targetLeft;
+ applyMargins();
+ }
+ // Drop top inset, and pass through bottom inset.
+ if (paddingChanged) {
+ setPadding(0, 0, 0, 0);
+ }
+ } else {
+ if (mRightInset != 0 || mLeftInset != 0) {
+ mRightInset = 0;
+ mLeftInset = 0;
+ applyMargins();
+ }
+ boolean changed = getPaddingLeft() != 0
+ || getPaddingRight() != 0
+ || getPaddingTop() != 0
+ || getPaddingBottom() != 0;
+ if (changed) {
+ setPadding(0, 0, 0, 0);
+ }
+ }
+ return windowInsets;
+ }
+
+ private void applyMargins() {
+ final int count = getChildCount();
+ for (int i = 0; i < count; i++) {
+ View child = getChildAt(i);
+ if (child.getLayoutParams() instanceof LayoutParams) {
+ LayoutParams lp = (LayoutParams) child.getLayoutParams();
+ if (!lp.ignoreRightInset
+ && (lp.rightMargin != mRightInset || lp.leftMargin != mLeftInset)) {
+ lp.rightMargin = mRightInset;
+ lp.leftMargin = mLeftInset;
+ child.requestLayout();
+ }
+ }
+ }
+ }
+
+ @Override
+ public FrameLayout.LayoutParams generateLayoutParams(AttributeSet attrs) {
+ return new LayoutParams(getContext(), attrs);
+ }
+
+ @Override
+ protected FrameLayout.LayoutParams generateDefaultLayoutParams() {
+ return new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
+ }
+
+ @Override
+ protected void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ setWillNotDraw(!DEBUG);
+ }
+
+ @Override
+ public boolean dispatchKeyEvent(KeyEvent event) {
+ if (mInteractionEventHandler.interceptMediaKey(event)) {
+ return true;
+ }
+
+ if (super.dispatchKeyEvent(event)) {
+ return true;
+ }
+
+ return mInteractionEventHandler.dispatchKeyEvent(event);
+ }
+
+ protected void setInteractionEventHandler(InteractionEventHandler listener) {
+ mInteractionEventHandler = listener;
+ }
+
+ @Override
+ public boolean dispatchTouchEvent(MotionEvent ev) {
+ Boolean result = mInteractionEventHandler.handleDispatchTouchEvent(ev);
+
+ return result != null ? result : super.dispatchTouchEvent(ev);
+ }
+
+ @Override
+ public boolean onInterceptTouchEvent(MotionEvent ev) {
+ boolean intercept = mInteractionEventHandler.shouldInterceptTouchEvent(ev);
+ if (!intercept) {
+ intercept = super.onInterceptTouchEvent(ev);
+ }
+ if (intercept) {
+ mInteractionEventHandler.didIntercept(ev);
+ }
+
+ return intercept;
+ }
+
+ @Override
+ public boolean onTouchEvent(MotionEvent ev) {
+ boolean handled = mInteractionEventHandler.handleTouchEvent(ev);
+
+ if (!handled) {
+ handled = super.onTouchEvent(ev);
+ }
+
+ if (!handled) {
+ mInteractionEventHandler.didNotHandleTouchEvent(ev);
+ }
+
+ return handled;
+ }
+
+ @Override
+ public void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+ if (DEBUG) {
+ Paint pt = new Paint();
+ pt.setColor(0x80FFFF00);
+ pt.setStrokeWidth(12.0f);
+ pt.setStyle(Paint.Style.STROKE);
+ canvas.drawRect(0, 0, canvas.getWidth(), canvas.getHeight(), pt);
+ }
+ }
+
+ class LayoutParams extends FrameLayout.LayoutParams {
+
+ public boolean ignoreRightInset;
+
+ LayoutParams(int width, int height) {
+ super(width, height);
+ }
+
+ LayoutParams(Context c, AttributeSet attrs) {
+ super(c, attrs);
+
+ TypedArray a = c.obtainStyledAttributes(attrs, R.styleable.StatusBarWindowView_Layout);
+ ignoreRightInset = a.getBoolean(
+ R.styleable.StatusBarWindowView_Layout_ignoreRightInset, false);
+ a.recycle();
+ }
+ }
+
+ @Override
+ public ActionMode startActionModeForChild(View originalView, ActionMode.Callback callback,
+ int type) {
+ if (type == ActionMode.TYPE_FLOATING) {
+ return startActionMode(originalView, callback, type);
+ }
+ return super.startActionModeForChild(originalView, callback, type);
+ }
+
+ private ActionMode createFloatingActionMode(
+ View originatingView, ActionMode.Callback2 callback) {
+ if (mFloatingActionMode != null) {
+ mFloatingActionMode.finish();
+ }
+ cleanupFloatingActionModeViews();
+ mFloatingToolbar = new FloatingToolbar(mFakeWindow);
+ final FloatingActionMode mode =
+ new FloatingActionMode(mContext, callback, originatingView, mFloatingToolbar);
+ mFloatingActionModeOriginatingView = originatingView;
+ mFloatingToolbarPreDrawListener =
+ new ViewTreeObserver.OnPreDrawListener() {
+ @Override
+ public boolean onPreDraw() {
+ mode.updateViewLocationInWindow();
+ return true;
+ }
+ };
+ return mode;
+ }
+
+ private void setHandledFloatingActionMode(ActionMode mode) {
+ mFloatingActionMode = mode;
+ mFloatingActionMode.invalidate(); // Will show the floating toolbar if necessary.
+ mFloatingActionModeOriginatingView.getViewTreeObserver()
+ .addOnPreDrawListener(mFloatingToolbarPreDrawListener);
+ }
+
+ private void cleanupFloatingActionModeViews() {
+ if (mFloatingToolbar != null) {
+ mFloatingToolbar.dismiss();
+ mFloatingToolbar = null;
+ }
+ if (mFloatingActionModeOriginatingView != null) {
+ if (mFloatingToolbarPreDrawListener != null) {
+ mFloatingActionModeOriginatingView.getViewTreeObserver()
+ .removeOnPreDrawListener(mFloatingToolbarPreDrawListener);
+ mFloatingToolbarPreDrawListener = null;
+ }
+ mFloatingActionModeOriginatingView = null;
+ }
+ }
+
+ private ActionMode startActionMode(
+ View originatingView, ActionMode.Callback callback, int type) {
+ ActionMode.Callback2 wrappedCallback = new ActionModeCallback2Wrapper(callback);
+ ActionMode mode = createFloatingActionMode(originatingView, wrappedCallback);
+ if (mode != null && wrappedCallback.onCreateActionMode(mode, mode.getMenu())) {
+ setHandledFloatingActionMode(mode);
+ } else {
+ mode = null;
+ }
+ return mode;
+ }
+
+ private class ActionModeCallback2Wrapper extends ActionMode.Callback2 {
+ private final ActionMode.Callback mWrapped;
+
+ ActionModeCallback2Wrapper(ActionMode.Callback wrapped) {
+ mWrapped = wrapped;
+ }
+
+ public boolean onCreateActionMode(ActionMode mode, Menu menu) {
+ return mWrapped.onCreateActionMode(mode, menu);
+ }
+
+ public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
+ requestFitSystemWindows();
+ return mWrapped.onPrepareActionMode(mode, menu);
+ }
+
+ public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
+ return mWrapped.onActionItemClicked(mode, item);
+ }
+
+ public void onDestroyActionMode(ActionMode mode) {
+ mWrapped.onDestroyActionMode(mode);
+ if (mode == mFloatingActionMode) {
+ cleanupFloatingActionModeViews();
+ mFloatingActionMode = null;
+ }
+ requestFitSystemWindows();
+ }
+
+ @Override
+ public void onGetContentRect(ActionMode mode, View view, Rect outRect) {
+ if (mWrapped instanceof ActionMode.Callback2) {
+ ((ActionMode.Callback2) mWrapped).onGetContentRect(mode, view, outRect);
+ } else {
+ super.onGetContentRect(mode, view, outRect);
+ }
+ }
+ }
+
+ interface InteractionEventHandler {
+ /**
+ * Returns a result for {@link ViewGroup#dispatchTouchEvent(MotionEvent)} or null to defer
+ * to the super method.
+ */
+ Boolean handleDispatchTouchEvent(MotionEvent ev);
+
+ /**
+ * Returns if the view should intercept the touch event.
+ *
+ * The touch event may still be interecepted if
+ * {@link ViewGroup#onInterceptTouchEvent(MotionEvent)} decides to do so.
+ */
+ boolean shouldInterceptTouchEvent(MotionEvent ev);
+
+ /**
+ * Called when the view decides to intercept the touch event.
+ */
+ void didIntercept(MotionEvent ev);
+
+ boolean handleTouchEvent(MotionEvent ev);
+
+ void didNotHandleTouchEvent(MotionEvent ev);
+
+ boolean interceptMediaKey(KeyEvent event);
+
+ boolean dispatchKeyEvent(KeyEvent event);
+ }
+
+ /**
+ * Minimal window to satisfy FloatingToolbar.
+ */
+ private Window mFakeWindow = new Window(mContext) {
+ @Override
+ public void takeSurface(SurfaceHolder.Callback2 callback) {
+ }
+
+ @Override
+ public void takeInputQueue(InputQueue.Callback callback) {
+ }
+
+ @Override
+ public boolean isFloating() {
+ return false;
+ }
+
+ @Override
+ public void alwaysReadCloseOnTouchAttr() {
+ }
+
+ @Override
+ public void setContentView(@LayoutRes int layoutResID) {
+ }
+
+ @Override
+ public void setContentView(View view) {
+ }
+
+ @Override
+ public void setContentView(View view, ViewGroup.LayoutParams params) {
+ }
+
+ @Override
+ public void addContentView(View view, ViewGroup.LayoutParams params) {
+ }
+
+ @Override
+ public void clearContentView() {
+ }
+
+ @Override
+ public View getCurrentFocus() {
+ return null;
+ }
+
+ @Override
+ public LayoutInflater getLayoutInflater() {
+ return null;
+ }
+
+ @Override
+ public void setTitle(CharSequence title) {
+ }
+
+ @Override
+ public void setTitleColor(@ColorInt int textColor) {
+ }
+
+ @Override
+ public void openPanel(int featureId, KeyEvent event) {
+ }
+
+ @Override
+ public void closePanel(int featureId) {
+ }
+
+ @Override
+ public void togglePanel(int featureId, KeyEvent event) {
+ }
+
+ @Override
+ public void invalidatePanelMenu(int featureId) {
+ }
+
+ @Override
+ public boolean performPanelShortcut(int featureId, int keyCode, KeyEvent event, int flags) {
+ return false;
+ }
+
+ @Override
+ public boolean performPanelIdentifierAction(int featureId, int id, int flags) {
+ return false;
+ }
+
+ @Override
+ public void closeAllPanels() {
+ }
+
+ @Override
+ public boolean performContextMenuIdentifierAction(int id, int flags) {
+ return false;
+ }
+
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ }
+
+ @Override
+ public void setBackgroundDrawable(Drawable drawable) {
+ }
+
+ @Override
+ public void setFeatureDrawableResource(int featureId, @DrawableRes int resId) {
+ }
+
+ @Override
+ public void setFeatureDrawableUri(int featureId, Uri uri) {
+ }
+
+ @Override
+ public void setFeatureDrawable(int featureId, Drawable drawable) {
+ }
+
+ @Override
+ public void setFeatureDrawableAlpha(int featureId, int alpha) {
+ }
+
+ @Override
+ public void setFeatureInt(int featureId, int value) {
+ }
+
+ @Override
+ public void takeKeyEvents(boolean get) {
+ }
+
+ @Override
+ public boolean superDispatchKeyEvent(KeyEvent event) {
+ return false;
+ }
+
+ @Override
+ public boolean superDispatchKeyShortcutEvent(KeyEvent event) {
+ return false;
+ }
+
+ @Override
+ public boolean superDispatchTouchEvent(MotionEvent event) {
+ return false;
+ }
+
+ @Override
+ public boolean superDispatchTrackballEvent(MotionEvent event) {
+ return false;
+ }
+
+ @Override
+ public boolean superDispatchGenericMotionEvent(MotionEvent event) {
+ return false;
+ }
+
+ @Override
+ public View getDecorView() {
+ return NotificationShadeWindowView.this;
+ }
+
+ @Override
+ public View peekDecorView() {
+ return null;
+ }
+
+ @Override
+ public Bundle saveHierarchyState() {
+ return null;
+ }
+
+ @Override
+ public void restoreHierarchyState(Bundle savedInstanceState) {
+ }
+
+ @Override
+ protected void onActive() {
+ }
+
+ @Override
+ public void setChildDrawable(int featureId, Drawable drawable) {
+ }
+
+ @Override
+ public void setChildInt(int featureId, int value) {
+ }
+
+ @Override
+ public boolean isShortcutKey(int keyCode, KeyEvent event) {
+ return false;
+ }
+
+ @Override
+ public void setVolumeControlStream(int streamType) {
+ }
+
+ @Override
+ public int getVolumeControlStream() {
+ return 0;
+ }
+
+ @Override
+ public int getStatusBarColor() {
+ return 0;
+ }
+
+ @Override
+ public void setStatusBarColor(@ColorInt int color) {
+ }
+
+ @Override
+ public int getNavigationBarColor() {
+ return 0;
+ }
+
+ @Override
+ public void setNavigationBarColor(@ColorInt int color) {
+ }
+
+ @Override
+ public void setDecorCaptionShade(int decorCaptionShade) {
+ }
+
+ @Override
+ public void setResizingCaptionDrawable(Drawable drawable) {
+ }
+
+ @Override
+ public void onMultiWindowModeChanged() {
+ }
+
+ @Override
+ public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode) {
+ }
+
+ @Override
+ public void reportActivityRelaunched() {
+ }
+
+ @Override
+ public WindowInsetsController getInsetsController() {
+ return null;
+ }
+ };
+
+}
+
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowViewController.java
similarity index 89%
rename from packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowViewController.java
rename to packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowViewController.java
index 4935f0e..c691a35 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowViewController.java
@@ -16,7 +16,10 @@
package com.android.systemui.statusbar.phone;
+import static android.app.StatusBarManager.WINDOW_STATE_SHOWING;
+
import android.app.StatusBarManager;
+import android.graphics.RectF;
import android.hardware.display.AmbientDisplayConfiguration;
import android.media.AudioManager;
import android.media.session.MediaSessionLegacyHelper;
@@ -56,9 +59,9 @@
import javax.inject.Inject;
/**
- * Controller for {@link StatusBarWindowView}.
+ * Controller for {@link NotificationShadeWindowView}.
*/
-public class StatusBarWindowViewController {
+public class NotificationShadeWindowViewController {
private final InjectionInflationController mInjectionInflationController;
private final NotificationWakeUpCoordinator mCoordinator;
private final PulseExpansionHandler mPulseExpansionHandler;
@@ -74,7 +77,7 @@
private final DozeLog mDozeLog;
private final DozeParameters mDozeParameters;
private final CommandQueue mCommandQueue;
- private final StatusBarWindowView mView;
+ private final NotificationShadeWindowView mView;
private final ShadeController mShadeController;
private GestureDetector mGestureDetector;
@@ -93,8 +96,13 @@
private final DockManager mDockManager;
private final NotificationPanelViewController mNotificationPanelViewController;
+ // Used for determining view / touch intersection
+ private int[] mTempLocation = new int[2];
+ private RectF mTempRect = new RectF();
+ private boolean mIsTrackingBarGesture = false;
+
@Inject
- public StatusBarWindowViewController(
+ public NotificationShadeWindowViewController(
InjectionInflationController injectionInflationController,
NotificationWakeUpCoordinator coordinator,
PulseExpansionHandler pulseExpansionHandler,
@@ -112,7 +120,7 @@
CommandQueue commandQueue,
ShadeController shadeController,
DockManager dockManager,
- StatusBarWindowView statusBarWindowView,
+ NotificationShadeWindowView statusBarWindowView,
NotificationPanelViewController notificationPanelViewController) {
mInjectionInflationController = injectionInflationController;
mCoordinator = coordinator;
@@ -182,7 +190,7 @@
};
mGestureDetector = new GestureDetector(mView.getContext(), gestureListener);
- mView.setInteractionEventHandler(new StatusBarWindowView.InteractionEventHandler() {
+ mView.setInteractionEventHandler(new NotificationShadeWindowView.InteractionEventHandler() {
@Override
public Boolean handleDispatchTouchEvent(MotionEvent ev) {
boolean isDown = ev.getActionMasked() == MotionEvent.ACTION_DOWN;
@@ -244,6 +252,26 @@
return mStatusBarView.dispatchTouchEvent(ev);
}
+ if (!mIsTrackingBarGesture && isDown
+ && mNotificationPanelViewController.isFullyCollapsed()) {
+ float x = ev.getRawX();
+ float y = ev.getRawY();
+ if (isIntersecting(mStatusBarView, x, y)) {
+ if (mService.isSameStatusBarState(WINDOW_STATE_SHOWING)) {
+ mIsTrackingBarGesture = true;
+ return mStatusBarView.dispatchTouchEvent(ev);
+ } else { // it's hidden or hiding, don't send to notification shade.
+ return true;
+ }
+ }
+ } else if (mIsTrackingBarGesture) {
+ final boolean sendToNotification = mStatusBarView.dispatchTouchEvent(ev);
+ if (isUp || isCancel) {
+ mIsTrackingBarGesture = false;
+ }
+ return sendToNotification;
+ }
+
return null;
}
@@ -357,7 +385,7 @@
dragDownCallback, mFalsingManager));
}
- public StatusBarWindowView getView() {
+ public NotificationShadeWindowView getView() {
return mView;
}
@@ -414,4 +442,11 @@
void setDragDownHelper(DragDownHelper dragDownHelper) {
mDragDownHelper = dragDownHelper;
}
+
+ private boolean isIntersecting(View view, float x, float y) {
+ mTempLocation = view.getLocationOnScreen();
+ mTempRect.set(mTempLocation[0], mTempLocation[1], mTempLocation[0] + view.getWidth(),
+ mTempLocation[1] + view.getHeight());
+ return mTempRect.contains(x, y);
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java
index 3d8e09a..af46f7b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java
@@ -783,8 +783,7 @@
mView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
return;
}
- if (mStatusBar.getStatusBarWindow().getHeight()
- != mStatusBar.getStatusBarHeight()) {
+ if (mStatusBar.getNotificationShadeWindowView().isVisibleToUser()) {
mView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
if (mAnimateAfterExpanding) {
notifyExpandingStarted();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
index 45f3bf9..ffbbffc 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
@@ -323,8 +323,7 @@
R.dimen.display_cutout_margin_consumption);
ViewGroup.LayoutParams layoutParams = getLayoutParams();
- layoutParams.height = getResources().getDimensionPixelSize(
- R.dimen.status_bar_height);
+ layoutParams.height = getResources().getDimensionPixelSize(R.dimen.status_bar_height);
setLayoutParams(layoutParams);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ShadeControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ShadeControllerImpl.java
index 866dc2d..3330615 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ShadeControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ShadeControllerImpl.java
@@ -44,7 +44,7 @@
private final CommandQueue mCommandQueue;
private final StatusBarStateController mStatusBarStateController;
- protected final StatusBarWindowController mStatusBarWindowController;
+ protected final NotificationShadeWindowController mNotificationShadeWindowController;
private final StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
private final int mDisplayId;
protected final Lazy<StatusBar> mStatusBarLazy;
@@ -57,7 +57,7 @@
public ShadeControllerImpl(
CommandQueue commandQueue,
StatusBarStateController statusBarStateController,
- StatusBarWindowController statusBarWindowController,
+ NotificationShadeWindowController notificationShadeWindowController,
StatusBarKeyguardViewManager statusBarKeyguardViewManager,
WindowManager windowManager,
Lazy<StatusBar> statusBarLazy,
@@ -66,7 +66,7 @@
) {
mCommandQueue = commandQueue;
mStatusBarStateController = statusBarStateController;
- mStatusBarWindowController = statusBarWindowController;
+ mNotificationShadeWindowController = notificationShadeWindowController;
mStatusBarKeyguardViewManager = statusBarKeyguardViewManager;
mDisplayId = windowManager.getDefaultDisplay().getDisplayId();
// TODO: Remove circular reference to StatusBar when possible.
@@ -122,14 +122,15 @@
}
// TODO(b/62444020): remove when this bug is fixed
- Log.v(TAG, "mStatusBarWindow: " + getStatusBarWindowView() + " canPanelBeCollapsed(): "
+ Log.v(TAG, "NotificationShadeWindow: " + getNotificationShadeWindowView()
+ + " canPanelBeCollapsed(): "
+ getNotificationPanelViewController().canPanelBeCollapsed());
- if (getStatusBarWindowView() != null
+ if (getNotificationShadeWindowView() != null
&& getNotificationPanelViewController().canPanelBeCollapsed()) {
// release focus immediately to kick off focus change transition
- mStatusBarWindowController.setStatusBarFocusable(false);
+ mNotificationShadeWindowController.setNotificationShadeFocusable(false);
- getStatusBar().getStatusBarWindowViewController().cancelExpandHelper();
+ getStatusBar().getNotificationShadeWindowViewController().cancelExpandHelper();
getStatusBarView().collapsePanel(true /* animate */, delayed, speedUpFactor);
} else {
mBubbleControllerLazy.get().collapseStack();
@@ -154,8 +155,7 @@
new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
- if (getStatusBar().getStatusBarWindow().getHeight()
- != getStatusBar().getStatusBarHeight()) {
+ if (getStatusBar().getNotificationShadeWindowView().isVisibleToUser()) {
getNotificationPanelViewController().removeOnGlobalLayoutListener(this);
getNotificationPanelViewController().getView().post(executable);
}
@@ -222,8 +222,8 @@
return getStatusBar().getPresenter();
}
- protected StatusBarWindowView getStatusBarWindowView() {
- return getStatusBar().getStatusBarWindow();
+ protected NotificationShadeWindowView getNotificationShadeWindowView() {
+ return getStatusBar().getNotificationShadeWindowView();
}
protected PhoneStatusBarView getStatusBarView() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index ba70cf4..c709579 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -342,9 +342,11 @@
private final Point mCurrentDisplaySize = new Point();
- protected StatusBarWindowView mStatusBarWindow;
+ protected NotificationShadeWindowView mNotificationShadeWindowView;
+ protected StatusBarWindowView mPhoneStatusBarWindow;
protected PhoneStatusBarView mStatusBarView;
private int mStatusBarWindowState = WINDOW_STATE_SHOWING;
+ protected NotificationShadeWindowController mNotificationShadeWindowController;
protected StatusBarWindowController mStatusBarWindowController;
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
private final LockscreenLockIconController mLockscreenLockIconController;
@@ -368,7 +370,7 @@
private final FalsingManager mFalsingManager;
private final BroadcastDispatcher mBroadcastDispatcher;
private final ConfigurationController mConfigurationController;
- protected StatusBarWindowViewController mStatusBarWindowViewController;
+ protected NotificationShadeWindowViewController mNotificationShadeWindowViewController;
private final DozeParameters mDozeParameters;
private final Lazy<BiometricUnlockController> mBiometricUnlockControllerLazy;
private final Provider<StatusBarComponent.Builder> mStatusBarComponentBuilder;
@@ -503,7 +505,7 @@
&& ((info == null && imageWallpaperInAmbient)
|| (info != null && info.supportsAmbientMode()));
- mStatusBarWindowController.setWallpaperSupportsAmbientMode(supportsAmbientMode);
+ mNotificationShadeWindowController.setWallpaperSupportsAmbientMode(supportsAmbientMode);
mScrimController.setWallpaperSupportsAmbientMode(supportsAmbientMode);
}
};
@@ -659,7 +661,7 @@
Lazy<AssistManager> assistManagerLazy,
NotificationListener notificationListener,
ConfigurationController configurationController,
- StatusBarWindowController statusBarWindowController,
+ NotificationShadeWindowController notificationShadeWindowController,
LockscreenLockIconController lockscreenLockIconController,
DozeParameters dozeParameters,
ScrimController scrimController,
@@ -740,7 +742,7 @@
mAssistManagerLazy = assistManagerLazy;
mNotificationListener = notificationListener;
mConfigurationController = configurationController;
- mStatusBarWindowController = statusBarWindowController;
+ mNotificationShadeWindowController = notificationShadeWindowController;
mLockscreenLockIconController = lockscreenLockIconController;
mDozeServiceHost = dozeServiceHost;
mPowerManager = powerManager;
@@ -912,7 +914,7 @@
mKeyguardUpdateMonitor.registerCallback(mUpdateCallback);
mDozeServiceHost.initialize(this, mNotificationIconAreaController,
- mStatusBarKeyguardViewManager, mStatusBarWindowViewController,
+ mStatusBarKeyguardViewManager, mNotificationShadeWindowViewController,
mNotificationPanelViewController, mAmbientIndicationContainer);
mConfigurationController.addCallback(this);
@@ -930,7 +932,8 @@
@Override
public void onPluginConnected(OverlayPlugin plugin, Context pluginContext) {
mMainThreadHandler.post(
- () -> plugin.setup(getStatusBarWindow(), getNavigationBarView(),
+ () -> plugin.setup(getNotificationShadeWindowView(),
+ getNavigationBarView(),
new Callback(plugin), mDozeParameters));
}
@@ -938,7 +941,8 @@
public void onPluginDisconnected(OverlayPlugin plugin) {
mMainThreadHandler.post(() -> {
mOverlays.remove(plugin);
- mStatusBarWindowController.setForcePluginOpen(mOverlays.size() != 0);
+ mNotificationShadeWindowController
+ .setForcePluginOpen(mOverlays.size() != 0);
});
}
@@ -957,10 +961,10 @@
mOverlays.remove(mPlugin);
}
mMainThreadHandler.post(() -> {
- mStatusBarWindowController
+ mNotificationShadeWindowController
.setStateListener(b -> mOverlays.forEach(
o -> o.setCollapseDesired(b)));
- mStatusBarWindowController
+ mNotificationShadeWindowController
.setForcePluginOpen(mOverlays.size() != 0);
});
}
@@ -978,12 +982,13 @@
updateTheme();
inflateStatusBarWindow();
- mStatusBarWindowViewController.setService(this);
- mStatusBarWindow.setOnTouchListener(getStatusBarWindowTouchListener());
+ mNotificationShadeWindowViewController.setService(this);
+ mNotificationShadeWindowView.setOnTouchListener(getStatusBarWindowTouchListener());
// TODO: Deal with the ugliness that comes from having some of the statusbar broken out
// into fragments, but the rest here, it leaves some awkward lifecycle and whatnot.
- mStackScroller = mStatusBarWindow.findViewById(R.id.notification_stack_scroller);
+ mStackScroller = mNotificationShadeWindowView.findViewById(
+ R.id.notification_stack_scroller);
NotificationListContainer notifListContainer = (NotificationListContainer) mStackScroller;
mNotificationLogger.setUpWithContainer(notifListContainer);
@@ -1004,17 +1009,18 @@
// Allow plugins to reference DarkIconDispatcher and StatusBarStateController
mPluginDependencyProvider.allowPluginDependency(DarkIconDispatcher.class);
mPluginDependencyProvider.allowPluginDependency(StatusBarStateController.class);
- FragmentHostManager.get(mStatusBarWindow)
+ FragmentHostManager.get(mPhoneStatusBarWindow)
.addTagListener(CollapsedStatusBarFragment.TAG, (tag, fragment) -> {
CollapsedStatusBarFragment statusBarFragment =
(CollapsedStatusBarFragment) fragment;
- statusBarFragment.initNotificationIconArea(mNotificationIconAreaController);
+
PhoneStatusBarView oldStatusBarView = mStatusBarView;
- mStatusBarView = (PhoneStatusBarView) fragment.getView();
+ mStatusBarView = (PhoneStatusBarView) statusBarFragment.getView();
mStatusBarView.setBar(this);
mStatusBarView.setPanel(mNotificationPanelViewController);
mStatusBarView.setScrimController(mScrimController);
+ statusBarFragment.initNotificationIconArea(mNotificationIconAreaController);
// CollapsedStatusBarFragment re-inflated PhoneStatusBarView and both of
// mStatusBarView.mExpanded and mStatusBarView.mBouncerShowing are false.
// PhoneStatusBarView's new instance will set to be gone in
@@ -1038,16 +1044,18 @@
mHeadsUpAppearanceController.destroy();
}
// TODO: this should probably be scoped to the StatusBarComponent
+ // TODO (b/136993073) Separate notification shade and status bar
mHeadsUpAppearanceController = new HeadsUpAppearanceController(
- mNotificationIconAreaController, mHeadsUpManager, mStatusBarWindow,
+ mNotificationIconAreaController, mHeadsUpManager,
+ mNotificationShadeWindowView,
mStatusBarStateController, mKeyguardBypassController,
mKeyguardStateController, mWakeUpCoordinator, mCommandQueue,
- mNotificationPanelViewController);
+ mNotificationPanelViewController, mStatusBarView);
mHeadsUpAppearanceController.readFrom(oldController);
mLightsOutNotifController.setLightsOutNotifView(
mStatusBarView.findViewById(R.id.notification_lights_out));
- mStatusBarWindowViewController.setStatusBarView(mStatusBarView);
+ mNotificationShadeWindowViewController.setStatusBarView(mStatusBarView);
checkBarModes();
}).getFragmentManager()
.beginTransaction()
@@ -1055,7 +1063,8 @@
CollapsedStatusBarFragment.TAG)
.commit();
- mHeadsUpManager.setUp(mStatusBarWindow, mGroupManager, this, mVisualStabilityManager);
+ mHeadsUpManager.setUp(mNotificationShadeWindowView, mGroupManager, this,
+ mVisualStabilityManager);
mConfigurationController.addCallback(mHeadsUpManager);
mHeadsUpManager.addListener(this);
mHeadsUpManager.addListener(mNotificationPanelViewController.getOnHeadsUpChangedListener());
@@ -1075,12 +1084,12 @@
mKeyguardIndicationController =
SystemUIFactory.getInstance().createKeyguardIndicationController(mContext,
- mStatusBarWindow.findViewById(R.id.keyguard_indication_area),
- mStatusBarWindow.findViewById(R.id.lock_icon));
+ mNotificationShadeWindowView.findViewById(R.id.keyguard_indication_area),
+ mNotificationShadeWindowView.findViewById(R.id.lock_icon));
mNotificationPanelViewController.setKeyguardIndicationController(
mKeyguardIndicationController);
- mAmbientIndicationContainer = mStatusBarWindow.findViewById(
+ mAmbientIndicationContainer = mNotificationShadeWindowView.findViewById(
R.id.ambient_indication_container);
// TODO: Find better place for this callback.
@@ -1101,13 +1110,13 @@
mAutoHideController.setStatusBar(this);
- ScrimView scrimBehind = mStatusBarWindow.findViewById(R.id.scrim_behind);
- ScrimView scrimInFront = mStatusBarWindow.findViewById(R.id.scrim_in_front);
- ScrimView scrimForBubble = mStatusBarWindow.findViewById(R.id.scrim_for_bubble);
+ ScrimView scrimBehind = mNotificationShadeWindowView.findViewById(R.id.scrim_behind);
+ ScrimView scrimInFront = mNotificationShadeWindowView.findViewById(R.id.scrim_in_front);
+ ScrimView scrimForBubble = mNotificationShadeWindowView.findViewById(R.id.scrim_for_bubble);
mScrimController.setScrimVisibleListener(scrimsVisible -> {
- mStatusBarWindowController.setScrimsVisibility(scrimsVisible);
- if (mStatusBarWindow != null) {
+ mNotificationShadeWindowController.setScrimsVisibility(scrimsVisible);
+ if (mNotificationShadeWindowView != null) {
mLockscreenLockIconController.onScrimVisibilityChanged(scrimsVisible);
}
});
@@ -1116,7 +1125,7 @@
mNotificationPanelViewController.initDependencies(this, mGroupManager, mNotificationShelf,
mNotificationIconAreaController, mScrimController);
- BackDropView backdrop = mStatusBarWindow.findViewById(R.id.backdrop);
+ BackDropView backdrop = mNotificationShadeWindowView.findViewById(R.id.backdrop);
mMediaManager.setup(backdrop, backdrop.findViewById(R.id.backdrop_front),
backdrop.findViewById(R.id.backdrop_back), mScrimController, mLockscreenWallpaper);
@@ -1129,7 +1138,7 @@
mLockscreenLockIconController::onShowingLaunchAffordanceChanged);
// Set up the quick settings tile panel
- View container = mStatusBarWindow.findViewById(R.id.qs_frame);
+ final View container = mNotificationShadeWindowView.findViewById(R.id.qs_frame);
if (container != null) {
FragmentHostManager fragmentHostManager = FragmentHostManager.get(container);
ExtensionFragmentListener.attachExtensonToFragment(container, QS.TAG, R.id.qs_frame,
@@ -1138,7 +1147,8 @@
.withPlugin(QS.class)
.withDefault(this::createDefaultQSFragment)
.build());
- mBrightnessMirrorController = new BrightnessMirrorController(mStatusBarWindow,
+ mBrightnessMirrorController = new BrightnessMirrorController(
+ mNotificationShadeWindowView,
mNotificationPanelViewController,
(visible) -> {
mBrightnessMirrorVisible = visible;
@@ -1153,7 +1163,8 @@
});
}
- mReportRejectedTouch = mStatusBarWindow.findViewById(R.id.report_rejected_touch);
+ mReportRejectedTouch = mNotificationShadeWindowView
+ .findViewById(R.id.report_rejected_touch);
if (mReportRejectedTouch != null) {
updateReportRejectedTouchVisibility();
mReportRejectedTouch.setOnClickListener(v -> {
@@ -1227,18 +1238,18 @@
}
protected QS createDefaultQSFragment() {
- return FragmentHostManager.get(mStatusBarWindow).create(QSFragment.class);
+ return FragmentHostManager.get(mNotificationShadeWindowView).create(QSFragment.class);
}
private void setUpPresenter() {
// Set up the initial notification state.
mActivityLaunchAnimator = new ActivityLaunchAnimator(
- mStatusBarWindowViewController, this, mNotificationPanelViewController,
+ mNotificationShadeWindowViewController, this, mNotificationPanelViewController,
(NotificationListContainer) mStackScroller);
// TODO: inject this.
mPresenter = new StatusBarNotificationPresenter(mContext, mNotificationPanelViewController,
- mHeadsUpManager, mStatusBarWindow, mStackScroller, mDozeScrimController,
+ mHeadsUpManager, mNotificationShadeWindowView, mStackScroller, mDozeScrimController,
mScrimController, mActivityLaunchAnimator, mDynamicPrivacyController,
mNotificationAlertingManager, mNotificationRowBinder, mKeyguardStateController,
mKeyguardIndicationController,
@@ -1251,7 +1262,7 @@
mDeviceProvisionedController);
mNotificationShelf.setOnActivatedListener(mPresenter);
- mRemoteInputManager.getController().addCallback(mStatusBarWindowController);
+ mRemoteInputManager.getController().addCallback(mNotificationShadeWindowController);
mNotificationActivityStarter =
mStatusBarNotificationActivityStarterBuilder
@@ -1328,7 +1339,7 @@
mShadeController.animateCollapsePanels();
}
}
- return mStatusBarWindow.onTouchEvent(event);
+ return mNotificationShadeWindowView.onTouchEvent(event);
};
}
@@ -1384,17 +1395,20 @@
protected void createUserSwitcher() {
mKeyguardUserSwitcher = new KeyguardUserSwitcher(mContext,
- mStatusBarWindow.findViewById(R.id.keyguard_user_switcher),
- mStatusBarWindow.findViewById(R.id.keyguard_header),
+ mNotificationShadeWindowView.findViewById(R.id.keyguard_user_switcher),
+ mNotificationShadeWindowView.findViewById(R.id.keyguard_header),
mNotificationPanelViewController);
}
private void inflateStatusBarWindow() {
- mStatusBarWindow = mSuperStatusBarViewFactory.getStatusBarWindowView();
+ mNotificationShadeWindowView = mSuperStatusBarViewFactory.getNotificationShadeWindowView();
StatusBarComponent statusBarComponent = mStatusBarComponentBuilder.get()
- .statusBarWindowView(mStatusBarWindow).build();
- mStatusBarWindowViewController = statusBarComponent.getStatusBarWindowViewController();
- mStatusBarWindowViewController.setupExpandedStatusBar();
+ .statusBarWindowView(mNotificationShadeWindowView).build();
+ mNotificationShadeWindowViewController = statusBarComponent
+ .getNotificationShadeWindowViewController();
+ mNotificationShadeWindowViewController.setupExpandedStatusBar();
+ mStatusBarWindowController = statusBarComponent.getStatusBarWindowController();
+ mPhoneStatusBarWindow = mSuperStatusBarViewFactory.getStatusBarWindowView();
mNotificationPanelViewController = statusBarComponent.getNotificationPanelViewController();
}
@@ -1404,7 +1418,8 @@
mStatusBarKeyguardViewManager.registerStatusBar(
/* statusBar= */ this, getBouncerContainer(),
mNotificationPanelViewController, mBiometricUnlockController,
- mDismissCallbackRegistry, mStatusBarWindow.findViewById(R.id.lock_icon_container),
+ mDismissCallbackRegistry,
+ mNotificationShadeWindowView.findViewById(R.id.lock_icon_container),
mStackScroller, mKeyguardBypassController, mFalsingManager);
mKeyguardIndicationController
.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
@@ -1422,16 +1437,20 @@
return mStatusBarView;
}
- public StatusBarWindowView getStatusBarWindow() {
- return mStatusBarWindow;
+ public NotificationShadeWindowView getNotificationShadeWindowView() {
+ return mNotificationShadeWindowView;
}
- public StatusBarWindowViewController getStatusBarWindowViewController() {
- return mStatusBarWindowViewController;
+ public StatusBarWindowView getStatusBarWindow() {
+ return mPhoneStatusBarWindow;
+ }
+
+ public NotificationShadeWindowViewController getNotificationShadeWindowViewController() {
+ return mNotificationShadeWindowViewController;
}
protected ViewGroup getBouncerContainer() {
- return mStatusBarWindow;
+ return mNotificationShadeWindowView;
}
public int getStatusBarHeight() {
@@ -1641,7 +1660,7 @@
}
public void setQsExpanded(boolean expanded) {
- mStatusBarWindowController.setQsExpanded(expanded);
+ mNotificationShadeWindowController.setQsExpanded(expanded);
mNotificationPanelViewController.setStatusAccessibilityImportance(expanded
? View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
: View.IMPORTANT_FOR_ACCESSIBILITY_AUTO);
@@ -1674,7 +1693,7 @@
@Override
public void onHeadsUpPinnedModeChanged(boolean inPinnedMode) {
if (inPinnedMode) {
- mStatusBarWindowController.setHeadsUpShowing(true);
+ mNotificationShadeWindowController.setHeadsUpShowing(true);
mStatusBarWindowController.setForceStatusBarVisible(true);
if (mNotificationPanelViewController.isFullyCollapsed()) {
// We need to ensure that the touchable region is updated before the window will be
@@ -1682,9 +1701,9 @@
// onComputeInternalInsets will be called and after that we can resize the layout. Let's
// make sure that the window stays small for one frame until the touchableRegion is set.
mNotificationPanelViewController.getView().requestLayout();
- mStatusBarWindowController.setForceWindowCollapsed(true);
+ mNotificationShadeWindowController.setForceWindowCollapsed(true);
mNotificationPanelViewController.getView().post(() -> {
- mStatusBarWindowController.setForceWindowCollapsed(false);
+ mNotificationShadeWindowController.setForceWindowCollapsed(false);
});
}
} else {
@@ -1694,7 +1713,7 @@
|| mNotificationPanelViewController.isTracking() || bypassKeyguard) {
// We are currently tracking or is open and the shade doesn't need to be kept
// open artificially.
- mStatusBarWindowController.setHeadsUpShowing(false);
+ mNotificationShadeWindowController.setHeadsUpShowing(false);
if (bypassKeyguard) {
mStatusBarWindowController.setForceStatusBarVisible(false);
}
@@ -1704,7 +1723,7 @@
mHeadsUpManager.setHeadsUpGoingAway(true);
mNotificationPanelViewController.runAfterAnimationFinished(() -> {
if (!mHeadsUpManager.hasPinnedHeadsUp()) {
- mStatusBarWindowController.setHeadsUpShowing(false);
+ mNotificationShadeWindowController.setHeadsUpShowing(false);
mHeadsUpManager.setHeadsUpGoingAway(false);
}
mRemoteInputManager.onPanelCollapsed();
@@ -1732,7 +1751,7 @@
public void setPanelExpanded(boolean isExpanded) {
mPanelExpanded = isExpanded;
updateHideIconsForBouncer(false /* animate */);
- mStatusBarWindowController.setPanelExpanded(isExpanded);
+ mNotificationShadeWindowController.setPanelExpanded(isExpanded);
mVisualStabilityManager.setPanelExpanded(isExpanded);
if (isExpanded && mStatusBarStateController.getState() != StatusBarState.KEYGUARD) {
if (DEBUG) {
@@ -1991,7 +2010,7 @@
// Expand the window to encompass the full screen in anticipation of the drag.
// This is only possible to do atomically because the status bar is at the top of the screen!
- mStatusBarWindowController.setPanelVisible(true);
+ mNotificationShadeWindowController.setPanelVisible(true);
visibilityChanged(true);
mCommandQueue.recomputeDisableFlags(mDisplayId, !force /* animate */);
@@ -2100,7 +2119,7 @@
if (SPEW) Log.d(TAG, "makeExpandedInvisible: mExpandedVisible=" + mExpandedVisible
+ " mExpandedVisible=" + mExpandedVisible);
- if (!mExpandedVisible || mStatusBarWindow == null) {
+ if (!mExpandedVisible || mNotificationShadeWindowView == null) {
return;
}
@@ -2113,8 +2132,8 @@
mExpandedVisible = false;
visibilityChanged(false);
- // Shrink the window to the size of the status bar only
- mStatusBarWindowController.setPanelVisible(false);
+ // Update the visibility of notification shade and status bar window.
+ mNotificationShadeWindowController.setPanelVisible(false);
mStatusBarWindowController.setForceStatusBarVisible(false);
// Close any guts that might be visible
@@ -2178,6 +2197,10 @@
return false;
}
+ boolean isSameStatusBarState(int state) {
+ return mStatusBarWindowState == state;
+ }
+
public GestureRecorder getGestureRecorder() {
return mGestureRec;
}
@@ -2193,7 +2216,7 @@
return;
}
boolean showing = state == WINDOW_STATE_SHOWING;
- if (mStatusBarWindow != null
+ if (mNotificationShadeWindowView != null
&& window == StatusBarManager.WINDOW_STATUS_BAR
&& mStatusBarWindowState != state) {
mStatusBarWindowState = state;
@@ -2427,8 +2450,8 @@
dumpBarTransitions(pw, "mStatusBarView", mStatusBarView.getBarTransitions());
}
pw.println(" StatusBarWindowView: ");
- if (mStatusBarWindowViewController != null) {
- mStatusBarWindowViewController.dump(fd, pw, args);
+ if (mNotificationShadeWindowViewController != null) {
+ mNotificationShadeWindowViewController.dump(fd, pw, args);
}
pw.println(" mMediaManager: ");
@@ -2527,6 +2550,7 @@
public void createAndAddWindows(@Nullable RegisterStatusBarResult result) {
makeStatusBarView(result);
+ mNotificationShadeWindowController.attach();
mStatusBarWindowController.attach();
}
@@ -2690,8 +2714,8 @@
}
}
else if (Intent.ACTION_SCREEN_OFF.equals(action)) {
- if (mStatusBarWindowController != null) {
- mStatusBarWindowController.setNotTouchable(false);
+ if (mNotificationShadeWindowController != null) {
+ mNotificationShadeWindowController.setNotTouchable(false);
}
if (mBubbleController.isStackExpanded()) {
mBubbleController.collapseStack();
@@ -2808,7 +2832,9 @@
mQSPanel.updateResources();
}
- mStatusBarWindowController.refreshStatusBarHeight();
+ if (mStatusBarWindowController != null) {
+ mStatusBarWindowController.refreshStatusBarHeight();
+ }
if (mStatusBarView != null) {
mStatusBarView.updateResources();
@@ -3518,7 +3544,7 @@
if (!mPresenter.isPresenterFullyCollapsed()) {
// if we set it not to be focusable when collapsing, we have to undo it when we aborted
// the closing
- mStatusBarWindowController.setStatusBarFocusable(true);
+ mNotificationShadeWindowController.setNotificationShadeFocusable(true);
}
}
@@ -3631,7 +3657,7 @@
*/
public void collapseShade() {
if (mNotificationPanelViewController.isTracking()) {
- mStatusBarWindowViewController.cancelCurrentTouch();
+ mNotificationShadeWindowViewController.cancelCurrentTouch();
}
if (mPanelExpanded && mState == StatusBarState.SHADE) {
mShadeController.animateCollapsePanels();
@@ -3652,7 +3678,7 @@
updateVisibleToUser();
updateNotificationPanelTouchState();
- mStatusBarWindowViewController.cancelCurrentTouch();
+ mNotificationShadeWindowViewController.cancelCurrentTouch();
if (mLaunchCameraOnFinishedGoingToSleep) {
mLaunchCameraOnFinishedGoingToSleep = false;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
index 407d256..de37cd9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
@@ -92,7 +92,7 @@
private static String TAG = "StatusBarKeyguardViewManager";
protected final Context mContext;
- private final StatusBarWindowController mStatusBarWindowController;
+ private final NotificationShadeWindowController mNotificationShadeWindowController;
private final BouncerExpansionCallback mExpansionCallback = new BouncerExpansionCallback() {
@Override
public void onFullyShown() {
@@ -199,13 +199,13 @@
KeyguardUpdateMonitor keyguardUpdateMonitor,
NavigationModeController navigationModeController,
DockManager dockManager,
- StatusBarWindowController statusBarWindowController,
+ NotificationShadeWindowController notificationShadeWindowController,
KeyguardStateController keyguardStateController,
NotificationMediaManager notificationMediaManager) {
mContext = context;
mViewMediatorCallback = callback;
mLockPatternUtils = lockPatternUtils;
- mStatusBarWindowController = statusBarWindowController;
+ mNotificationShadeWindowController = notificationShadeWindowController;
mKeyguardStateController = keyguardStateController;
mMediaManager = notificationMediaManager;
mKeyguardUpdateManager = keyguardUpdateMonitor;
@@ -315,7 +315,7 @@
*/
public void show(Bundle options) {
mShowing = true;
- mStatusBarWindowController.setKeyguardShowing(true);
+ mNotificationShadeWindowController.setKeyguardShowing(true);
mKeyguardStateController.notifyKeyguardState(mShowing,
mKeyguardStateController.isOccluded());
reset(true /* hideBouncerWhenShowing */);
@@ -491,11 +491,11 @@
}
public void setNeedsInput(boolean needsInput) {
- mStatusBarWindowController.setKeyguardNeedsInput(needsInput);
+ mNotificationShadeWindowController.setKeyguardNeedsInput(needsInput);
}
public boolean isUnlockWithWallpaper() {
- return mStatusBarWindowController.isShowingWallpaper();
+ return mNotificationShadeWindowController.isShowingWallpaper();
}
public void setOccluded(boolean occluded, boolean animate) {
@@ -509,7 +509,7 @@
new Runnable() {
@Override
public void run() {
- mStatusBarWindowController.setKeyguardOccluded(mOccluded);
+ mNotificationShadeWindowController.setKeyguardOccluded(mOccluded);
reset(true /* hideBouncerWhenShowing */);
}
});
@@ -524,7 +524,7 @@
if (mShowing) {
mMediaManager.updateMediaMetaData(false, animate && !occluded);
}
- mStatusBarWindowController.setKeyguardOccluded(occluded);
+ mNotificationShadeWindowController.setKeyguardOccluded(occluded);
// setDozing(false) will call reset once we stop dozing.
if (!mDozing) {
@@ -578,8 +578,8 @@
mStatusBar.fadeKeyguardAfterLaunchTransition(new Runnable() {
@Override
public void run() {
- mStatusBarWindowController.setKeyguardShowing(false);
- mStatusBarWindowController.setKeyguardFadingAway(true);
+ mNotificationShadeWindowController.setKeyguardShowing(false);
+ mNotificationShadeWindowController.setKeyguardFadingAway(true);
hideBouncer(true /* destroyView */);
updateStates();
}
@@ -587,7 +587,7 @@
@Override
public void run() {
mStatusBar.hideKeyguard();
- mStatusBarWindowController.setKeyguardFadingAway(false);
+ mNotificationShadeWindowController.setKeyguardFadingAway(false);
mViewMediatorCallback.keyguardGone();
executeAfterKeyguardGoneAction();
}
@@ -624,7 +624,7 @@
} else {
boolean staying = mStatusBarStateController.leaveOpenOnKeyguardHide();
if (!staying) {
- mStatusBarWindowController.setKeyguardFadingAway(true);
+ mNotificationShadeWindowController.setKeyguardFadingAway(true);
if (needsFading) {
ViewGroupFadeHelper.fadeOutAllChildrenExcept(
mNotificationPanelViewController.getView(),
@@ -650,7 +650,7 @@
}
updateLockIcon();
updateStates();
- mStatusBarWindowController.setKeyguardShowing(false);
+ mNotificationShadeWindowController.setKeyguardShowing(false);
mViewMediatorCallback.keyguardGone();
}
StatsLog.write(StatsLog.KEYGUARD_STATE_CHANGED,
@@ -684,8 +684,8 @@
}
public void onKeyguardFadedAway() {
- mContainer.postDelayed(() -> mStatusBarWindowController.setKeyguardFadingAway(false),
- 100);
+ mContainer.postDelayed(() -> mNotificationShadeWindowController
+ .setKeyguardFadingAway(false), 100);
ViewGroupFadeHelper.reset(mNotificationPanelViewController.getView());
mStatusBar.finishKeyguardFadingAway();
mBiometricUnlockController.finishKeyguardFadingAway();
@@ -818,7 +818,7 @@
}
if (bouncerShowing != mLastBouncerShowing || mFirstUpdate) {
- mStatusBarWindowController.setBouncerShowing(bouncerShowing);
+ mNotificationShadeWindowController.setBouncerShowing(bouncerShowing);
mStatusBar.setBouncerShowing(bouncerShowing);
updateLockIcon();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarModule.java
index b4d5dad..7615bf8 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarModule.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarModule.java
@@ -151,7 +151,7 @@
Lazy<AssistManager> assistManagerLazy,
NotificationListener notificationListener,
ConfigurationController configurationController,
- StatusBarWindowController statusBarWindowController,
+ NotificationShadeWindowController notificationShadeWindowController,
LockscreenLockIconController lockscreenLockIconController,
DozeParameters dozeParameters,
ScrimController scrimController,
@@ -233,7 +233,7 @@
assistManagerLazy,
notificationListener,
configurationController,
- statusBarWindowController,
+ notificationShadeWindowController,
lockscreenLockIconController,
dozeParameters,
scrimController,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
index 720f229..1336b2d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
@@ -134,7 +134,7 @@
public StatusBarNotificationPresenter(Context context,
NotificationPanelViewController panel,
HeadsUpManagerPhone headsUp,
- StatusBarWindowView statusBarWindow,
+ NotificationShadeWindowView statusBarWindow,
ViewGroup stackScroller,
DozeScrimController dozeScrimController,
ScrimController scrimController,
@@ -191,7 +191,7 @@
Dependency.get(NotificationRemoteInputManager.Callback.class),
mNotificationPanel.createRemoteInputDelegate());
remoteInputManager.getController().addCallback(
- Dependency.get(StatusBarWindowController.class));
+ Dependency.get(NotificationShadeWindowController.class));
NotificationListContainer notifListContainer = (NotificationListContainer) stackScroller;
initController.addPostInitTask(() -> {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarTouchableRegionManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarTouchableRegionManager.java
index 3d25749..b8fb6d3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarTouchableRegionManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarTouchableRegionManager.java
@@ -17,15 +17,13 @@
package com.android.systemui.statusbar.phone;
import android.annotation.NonNull;
-import android.content.Context;
-import android.content.res.Configuration;
-import android.content.res.Resources;
import android.graphics.Rect;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver.OnComputeInternalInsetsListener;
import com.android.systemui.Dependency;
+import com.android.systemui.R;
import com.android.systemui.bubbles.BubbleController;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener;
@@ -38,60 +36,62 @@
OnComputeInternalInsetsListener, ConfigurationListener {
private final BubbleController mBubbleController = Dependency.get(BubbleController.class);
- private final Context mContext;
private final HeadsUpManagerPhone mHeadsUpManager;
private boolean mIsStatusBarExpanded = false;
private boolean mShouldAdjustInsets = false;
private final StatusBar mStatusBar;
- private int mStatusBarHeight;
- private final View mStatusBarWindowView;
+ private final View mNotificationShadeWindowView;
+ private View mNotificationPanelView;
private boolean mForceCollapsedUntilLayout = false;
- private final StatusBarWindowController mStatusBarWindowController;
+ private final NotificationShadeWindowController mNotificationShadeWindowController;
- public StatusBarTouchableRegionManager(@NonNull Context context,
- HeadsUpManagerPhone headsUpManager,
+ public StatusBarTouchableRegionManager(HeadsUpManagerPhone headsUpManager,
@NonNull StatusBar statusBar,
- @NonNull View statusBarWindowView) {
- mContext = context;
+ @NonNull View notificationShadeWindowView) {
mHeadsUpManager = headsUpManager;
mStatusBar = statusBar;
- mStatusBarWindowView = statusBarWindowView;
- mStatusBarWindowController = Dependency.get(StatusBarWindowController.class);
-
- initResources();
+ mNotificationShadeWindowView = notificationShadeWindowView;
+ mNotificationShadeWindowController =
+ Dependency.get(NotificationShadeWindowController.class);
mBubbleController.setBubbleStateChangeListener((hasBubbles) -> {
updateTouchableRegion();
});
- mStatusBarWindowController.setForcePluginOpenListener((forceOpen) -> {
+ mNotificationShadeWindowController.setForcePluginOpenListener((forceOpen) -> {
updateTouchableRegion();
});
Dependency.get(ConfigurationController.class).addCallback(this);
+ if (mNotificationShadeWindowView != null) {
+ mNotificationPanelView = mNotificationShadeWindowView.findViewById(
+ R.id.notification_panel);
+ }
}
/**
* Set the touchable portion of the status bar based on what elements are visible.
*/
public void updateTouchableRegion() {
- boolean hasCutoutInset = (mStatusBarWindowView != null)
- && (mStatusBarWindowView.getRootWindowInsets() != null)
- && (mStatusBarWindowView.getRootWindowInsets().getDisplayCutout() != null);
+ boolean hasCutoutInset = (mNotificationShadeWindowView != null)
+ && (mNotificationShadeWindowView.getRootWindowInsets() != null)
+ && (mNotificationShadeWindowView.getRootWindowInsets().getDisplayCutout() != null);
boolean shouldObserve =
mHeadsUpManager.hasPinnedHeadsUp() || mHeadsUpManager.isHeadsUpGoingAway()
|| mBubbleController.hasBubbles()
|| mForceCollapsedUntilLayout
|| hasCutoutInset
- || mStatusBarWindowController.getForcePluginOpen();
+ || mNotificationShadeWindowController.getForcePluginOpen();
if (shouldObserve == mShouldAdjustInsets) {
return;
}
if (shouldObserve) {
- mStatusBarWindowView.getViewTreeObserver().addOnComputeInternalInsetsListener(this);
- mStatusBarWindowView.requestLayout();
+ mNotificationShadeWindowView.getViewTreeObserver()
+ .addOnComputeInternalInsetsListener(this);
+ mNotificationShadeWindowView.requestLayout();
} else {
- mStatusBarWindowView.getViewTreeObserver().removeOnComputeInternalInsetsListener(this);
+ mNotificationShadeWindowView.getViewTreeObserver()
+ .removeOnComputeInternalInsetsListener(this);
}
mShouldAdjustInsets = shouldObserve;
}
@@ -100,19 +100,20 @@
* Calls {@code updateTouchableRegion()} after a layout pass completes.
*/
public void updateTouchableRegionAfterLayout() {
- mForceCollapsedUntilLayout = true;
- mStatusBarWindowView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
- @Override
- public void onLayoutChange(View v, int left, int top, int right, int bottom,
- int oldLeft,
- int oldTop, int oldRight, int oldBottom) {
- if (mStatusBarWindowView.getHeight() <= mStatusBarHeight) {
- mStatusBarWindowView.removeOnLayoutChangeListener(this);
- mForceCollapsedUntilLayout = false;
- updateTouchableRegion();
+ if (mNotificationPanelView != null) {
+ mForceCollapsedUntilLayout = true;
+ mNotificationPanelView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
+ @Override
+ public void onLayoutChange(View v, int left, int top, int right, int bottom,
+ int oldLeft, int oldTop, int oldRight, int oldBottom) {
+ if (!mNotificationPanelView.isVisibleToUser()) {
+ mNotificationPanelView.removeOnLayoutChangeListener(this);
+ mForceCollapsedUntilLayout = false;
+ updateTouchableRegion();
+ }
}
- }
- });
+ });
+ }
}
/**
@@ -145,25 +146,4 @@
info.touchableRegion.union(bubbleRect);
}
}
-
- @Override
- public void onConfigChanged(Configuration newConfig) {
- initResources();
- }
-
- @Override
- public void onDensityOrFontScaleChanged() {
- initResources();
- }
-
- @Override
- public void onOverlayChanged() {
- initResources();
- }
-
- private void initResources() {
- Resources resources = mContext.getResources();
- mStatusBarHeight = resources.getDimensionPixelSize(
- com.android.internal.R.dimen.status_bar_height);
- }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java
index ce498a3..7cf5147 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014 The Android Open Source Project
+ * 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.
@@ -11,55 +11,25 @@
* 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
+ * limitations under the License.
*/
package com.android.systemui.statusbar.phone;
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
+import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_SHOW_STATUS_BAR;
-import static com.android.systemui.DejankUtils.whitelistIpcs;
-import static com.android.systemui.statusbar.NotificationRemoteInputManager.ENABLE_REMOTE_INPUT;
-
-import android.app.IActivityManager;
import android.content.Context;
-import android.content.pm.ActivityInfo;
import android.content.res.Resources;
import android.graphics.PixelFormat;
import android.os.Binder;
-import android.os.RemoteException;
-import android.os.SystemProperties;
-import android.os.Trace;
import android.util.Log;
-import android.view.Display;
import android.view.Gravity;
-import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
-import android.view.WindowManager.LayoutParams;
-import com.android.systemui.Dumpable;
-import com.android.systemui.R;
-import com.android.systemui.colorextraction.SysuiColorExtractor;
import com.android.systemui.dagger.qualifiers.Main;
-import com.android.systemui.keyguard.KeyguardViewMediator;
-import com.android.systemui.plugins.statusbar.StatusBarStateController;
-import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener;
-import com.android.systemui.statusbar.RemoteInputController.Callback;
-import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.SuperStatusBarViewFactory;
-import com.android.systemui.statusbar.SysuiStatusBarStateController;
-import com.android.systemui.statusbar.policy.ConfigurationController;
-import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener;
-
-import com.google.android.collect.Lists;
-
-import java.io.FileDescriptor;
-import java.io.PrintWriter;
-import java.lang.ref.WeakReference;
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.Arrays;
import javax.inject.Inject;
import javax.inject.Singleton;
@@ -68,101 +38,36 @@
* Encapsulates all logic for the status bar window state management.
*/
@Singleton
-public class StatusBarWindowController implements Callback, Dumpable, ConfigurationListener {
-
+public class StatusBarWindowController {
private static final String TAG = "StatusBarWindowController";
private static final boolean DEBUG = false;
private final Context mContext;
private final WindowManager mWindowManager;
- private final IActivityManager mActivityManager;
- private final DozeParameters mDozeParameters;
- private final LayoutParams mLpChanged;
- private final boolean mKeyguardScreenRotation;
- private final long mLockScreenDisplayTimeout;
- private final Display.Mode mKeyguardDisplayMode;
- private final KeyguardBypassController mKeyguardBypassController;
- private ViewGroup mStatusBarView;
- private LayoutParams mLp;
- private boolean mHasTopUi;
- private boolean mHasTopUiChanged;
- private int mBarHeight = -1;
- private float mScreenBrightnessDoze;
- private final State mCurrentState = new State();
- private OtherwisedCollapsedListener mListener;
- private ForcePluginOpenListener mForcePluginOpenListener;
- private final ArrayList<WeakReference<StatusBarWindowCallback>>
- mCallbacks = Lists.newArrayList();
-
- private final SysuiColorExtractor mColorExtractor;
private final SuperStatusBarViewFactory mSuperStatusBarViewFactory;
private final Resources mResources;
+ private int mBarHeight = -1;
+ private final State mCurrentState = new State();
+
+ private ViewGroup mStatusBarView;
+ private WindowManager.LayoutParams mLp;
+ private final WindowManager.LayoutParams mLpChanged;
@Inject
public StatusBarWindowController(Context context, WindowManager windowManager,
- IActivityManager activityManager, DozeParameters dozeParameters,
- StatusBarStateController statusBarStateController,
- ConfigurationController configurationController,
- KeyguardBypassController keyguardBypassController, SysuiColorExtractor colorExtractor,
SuperStatusBarViewFactory superStatusBarViewFactory,
@Main Resources resources) {
mContext = context;
mWindowManager = windowManager;
- mActivityManager = activityManager;
- mKeyguardScreenRotation = shouldEnableKeyguardScreenRotation();
- mDozeParameters = dozeParameters;
- mScreenBrightnessDoze = mDozeParameters.getScreenBrightnessDoze();
- mLpChanged = new LayoutParams();
- mKeyguardBypassController = keyguardBypassController;
- mColorExtractor = colorExtractor;
mSuperStatusBarViewFactory = superStatusBarViewFactory;
mStatusBarView = mSuperStatusBarViewFactory.getStatusBarWindowView();
+ mLpChanged = new WindowManager.LayoutParams();
mResources = resources;
if (mBarHeight < 0) {
mBarHeight = mResources.getDimensionPixelSize(
com.android.internal.R.dimen.status_bar_height);
}
-
- mLockScreenDisplayTimeout = context.getResources()
- .getInteger(R.integer.config_lockScreenDisplayTimeout);
- ((SysuiStatusBarStateController) statusBarStateController)
- .addCallback(mStateListener,
- SysuiStatusBarStateController.RANK_STATUS_BAR_WINDOW_CONTROLLER);
- configurationController.addCallback(this);
-
- Display.Mode[] supportedModes = context.getDisplay().getSupportedModes();
- Display.Mode currentMode = context.getDisplay().getMode();
- // Running on the highest frame rate available can be expensive.
- // Let's specify a preferred refresh rate, and allow higher FPS only when we
- // know that we're not falsing (because we unlocked.)
- int keyguardRefreshRate = context.getResources()
- .getInteger(R.integer.config_keyguardRefreshRate);
- // Find supported display mode with the same resolution and requested refresh rate.
- mKeyguardDisplayMode = Arrays.stream(supportedModes).filter(mode ->
- (int) mode.getRefreshRate() == keyguardRefreshRate
- && mode.getPhysicalWidth() == currentMode.getPhysicalWidth()
- && mode.getPhysicalHeight() == currentMode.getPhysicalHeight())
- .findFirst().orElse(null);
- }
-
- /**
- * Register to receive notifications about status bar window state changes.
- */
- public void registerCallback(StatusBarWindowCallback callback) {
- // Prevent adding duplicate callbacks
- for (int i = 0; i < mCallbacks.size(); i++) {
- if (mCallbacks.get(i).get() == callback) {
- return;
- }
- }
- mCallbacks.add(new WeakReference<StatusBarWindowCallback>(callback));
- }
-
- private boolean shouldEnableKeyguardScreenRotation() {
- Resources res = mContext.getResources();
- return SystemProperties.getBoolean("lockscreen.rot_override", false)
- || res.getBoolean(R.bool.config_enableLockScreenRotation);
}
public int getStatusBarHeight() {
@@ -192,574 +97,46 @@
// Now that the status bar window encompasses the sliding panel and its
// translucent backdrop, the entire thing is made TRANSLUCENT and is
// hardware-accelerated.
- mLp = new LayoutParams(
+ mLp = new WindowManager.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
mBarHeight,
- LayoutParams.TYPE_STATUS_BAR,
- LayoutParams.FLAG_NOT_FOCUSABLE
- | LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING
- | LayoutParams.FLAG_SPLIT_TOUCH
- | LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
- | LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS,
+ WindowManager.LayoutParams.TYPE_STATUS_BAR,
+ WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
+ | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH
+ | WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS,
PixelFormat.TRANSLUCENT);
mLp.token = new Binder();
mLp.gravity = Gravity.TOP;
- mLp.setFitWindowInsetsTypes(0 /* types */);
- mLp.softInputMode = LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
mLp.setTitle("StatusBar");
mLp.packageName = mContext.getPackageName();
mLp.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
+
mWindowManager.addView(mStatusBarView, mLp);
mLpChanged.copyFrom(mLp);
- onThemeChanged();
}
- public ViewGroup getStatusBarView() {
- return mStatusBarView;
- }
-
- public void setDozeScreenBrightness(int value) {
- mScreenBrightnessDoze = value / 255f;
- }
-
- private void setKeyguardDark(boolean dark) {
- int vis = mStatusBarView.getSystemUiVisibility();
- if (dark) {
- vis = vis | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
- vis = vis | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
- } else {
- vis = vis & ~View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
- vis = vis & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
- }
- mStatusBarView.setSystemUiVisibility(vis);
- }
-
- private void applyKeyguardFlags(State state) {
- if (state.keyguardShowing) {
- mLpChanged.privateFlags |= LayoutParams.PRIVATE_FLAG_KEYGUARD;
- } else {
- mLpChanged.privateFlags &= ~LayoutParams.PRIVATE_FLAG_KEYGUARD;
- }
-
- final boolean scrimsOccludingWallpaper =
- state.scrimsVisibility == ScrimController.OPAQUE;
- final boolean keyguardOrAod = state.keyguardShowing
- || (state.dozing && mDozeParameters.getAlwaysOn());
- if (keyguardOrAod && !state.backdropShowing && !scrimsOccludingWallpaper) {
- mLpChanged.flags |= LayoutParams.FLAG_SHOW_WALLPAPER;
- } else {
- mLpChanged.flags &= ~LayoutParams.FLAG_SHOW_WALLPAPER;
- }
-
- if (state.dozing) {
- mLpChanged.privateFlags |= LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
- } else {
- mLpChanged.privateFlags &= ~LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
- }
-
- if (mKeyguardDisplayMode != null) {
- boolean bypassOnKeyguard = mKeyguardBypassController.getBypassEnabled()
- && state.statusBarState == StatusBarState.KEYGUARD && !state.keyguardFadingAway
- && !state.keyguardGoingAway;
- if (state.dozing || bypassOnKeyguard) {
- mLpChanged.preferredDisplayModeId = mKeyguardDisplayMode.getModeId();
- } else {
- mLpChanged.preferredDisplayModeId = 0;
- }
- Trace.setCounter("display_mode_id", mLpChanged.preferredDisplayModeId);
- }
- }
-
- private void adjustScreenOrientation(State state) {
- if (state.isKeyguardShowingAndNotOccluded() || state.dozing) {
- if (mKeyguardScreenRotation) {
- mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_USER;
- } else {
- mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;
- }
- } else {
- mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
- }
- }
-
- private void applyFocusableFlag(State state) {
- boolean panelFocusable = state.statusBarFocusable && state.panelExpanded;
- if (state.bouncerShowing && (state.keyguardOccluded || state.keyguardNeedsInput)
- || ENABLE_REMOTE_INPUT && state.remoteInputActive
- || state.bubbleExpanded) {
- mLpChanged.flags &= ~LayoutParams.FLAG_NOT_FOCUSABLE;
- mLpChanged.flags &= ~LayoutParams.FLAG_ALT_FOCUSABLE_IM;
- } else if (state.isKeyguardShowingAndNotOccluded() || panelFocusable) {
- mLpChanged.flags &= ~LayoutParams.FLAG_NOT_FOCUSABLE;
- mLpChanged.flags |= LayoutParams.FLAG_ALT_FOCUSABLE_IM;
- } else {
- mLpChanged.flags |= LayoutParams.FLAG_NOT_FOCUSABLE;
- mLpChanged.flags &= ~LayoutParams.FLAG_ALT_FOCUSABLE_IM;
- }
-
- mLpChanged.softInputMode = LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
- }
-
- private void applyForceShowNavigationFlag(State state) {
- if (state.panelExpanded || state.bouncerShowing
- || ENABLE_REMOTE_INPUT && state.remoteInputActive) {
- mLpChanged.privateFlags |= LayoutParams.PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION;
- } else {
- mLpChanged.privateFlags &= ~LayoutParams.PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION;
- }
- }
-
- private void applyHeight(State state) {
- boolean expanded = isExpanded(state);
- if (state.forcePluginOpen) {
- if (mListener != null) {
- mListener.setWouldOtherwiseCollapse(expanded);
- }
- expanded = true;
- }
- if (expanded) {
- mLpChanged.height = ViewGroup.LayoutParams.MATCH_PARENT;
- } else {
- mLpChanged.height = mBarHeight;
- }
- }
-
- private boolean isExpanded(State state) {
- return !state.forceCollapsed && (state.isKeyguardShowingAndNotOccluded()
- || state.panelVisible || state.keyguardFadingAway || state.bouncerShowing
- || state.headsUpShowing || state.bubblesShowing
- || state.scrimsVisibility != ScrimController.TRANSPARENT);
- }
-
- private void applyFitsSystemWindows(State state) {
- boolean fitsSystemWindows = !state.isKeyguardShowingAndNotOccluded();
- if (mStatusBarView != null && mStatusBarView.getFitsSystemWindows() != fitsSystemWindows) {
- mStatusBarView.setFitsSystemWindows(fitsSystemWindows);
- mStatusBarView.requestApplyInsets();
- }
- }
-
- private void applyUserActivityTimeout(State state) {
- if (state.isKeyguardShowingAndNotOccluded()
- && state.statusBarState == StatusBarState.KEYGUARD
- && !state.qsExpanded) {
- mLpChanged.userActivityTimeout = state.bouncerShowing
- ? KeyguardViewMediator.AWAKE_INTERVAL_BOUNCER_MS : mLockScreenDisplayTimeout;
- } else {
- mLpChanged.userActivityTimeout = -1;
- }
- }
-
- private void applyInputFeatures(State state) {
- if (state.isKeyguardShowingAndNotOccluded()
- && state.statusBarState == StatusBarState.KEYGUARD
- && !state.qsExpanded && !state.forceUserActivity) {
- mLpChanged.inputFeatures |=
- LayoutParams.INPUT_FEATURE_DISABLE_USER_ACTIVITY;
- } else {
- mLpChanged.inputFeatures &=
- ~LayoutParams.INPUT_FEATURE_DISABLE_USER_ACTIVITY;
- }
- }
-
- private void applyStatusBarColorSpaceAgnosticFlag(State state) {
- if (!isExpanded(state)) {
- mLpChanged.privateFlags |= LayoutParams.PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC;
- } else {
- mLpChanged.privateFlags &=
- ~LayoutParams.PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC;
- }
+ /** Set force status bar visible. */
+ public void setForceStatusBarVisible(boolean forceStatusBarVisible) {
+ mCurrentState.mForceStatusBarVisible = forceStatusBarVisible;
+ apply(mCurrentState);
}
private void apply(State state) {
- applyKeyguardFlags(state);
applyForceStatusBarVisibleFlag(state);
- applyFocusableFlag(state);
- applyForceShowNavigationFlag(state);
- adjustScreenOrientation(state);
- applyHeight(state);
- applyUserActivityTimeout(state);
- applyInputFeatures(state);
- applyFitsSystemWindows(state);
- applyModalFlag(state);
- applyBrightness(state);
- applyHasTopUi(state);
- applyNotTouchable(state);
- applyStatusBarColorSpaceAgnosticFlag(state);
if (mLp != null && mLp.copyFrom(mLpChanged) != 0) {
mWindowManager.updateViewLayout(mStatusBarView, mLp);
}
- if (mHasTopUi != mHasTopUiChanged) {
- whitelistIpcs(() -> {
- try {
- mActivityManager.setHasTopUi(mHasTopUiChanged);
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to call setHasTopUi", e);
- }
- mHasTopUi = mHasTopUiChanged;
- });
- }
- notifyStateChangedCallbacks();
- }
-
- public void notifyStateChangedCallbacks() {
- for (int i = 0; i < mCallbacks.size(); i++) {
- StatusBarWindowCallback cb = mCallbacks.get(i).get();
- if (cb != null) {
- cb.onStateChanged(mCurrentState.keyguardShowing,
- mCurrentState.keyguardOccluded,
- mCurrentState.bouncerShowing);
- }
- }
- }
-
- private void applyForceStatusBarVisibleFlag(State state) {
- if (state.forceStatusBarVisible || state.forcePluginOpen) {
- mLpChanged.privateFlags |= WindowManager
- .LayoutParams.PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT;
- } else {
- mLpChanged.privateFlags
- &= ~LayoutParams.PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT;
- }
- }
-
- private void applyModalFlag(State state) {
- if (state.headsUpShowing) {
- mLpChanged.flags |= LayoutParams.FLAG_NOT_TOUCH_MODAL;
- } else {
- mLpChanged.flags &= ~LayoutParams.FLAG_NOT_TOUCH_MODAL;
- }
- }
-
- private void applyBrightness(State state) {
- if (state.forceDozeBrightness) {
- mLpChanged.screenBrightness = mScreenBrightnessDoze;
- } else {
- mLpChanged.screenBrightness = LayoutParams.BRIGHTNESS_OVERRIDE_NONE;
- }
- }
-
- private void applyHasTopUi(State state) {
- mHasTopUiChanged = state.forceHasTopUi || isExpanded(state);
- }
-
- private void applyNotTouchable(State state) {
- if (state.notTouchable) {
- mLpChanged.flags |= LayoutParams.FLAG_NOT_TOUCHABLE;
- } else {
- mLpChanged.flags &= ~LayoutParams.FLAG_NOT_TOUCHABLE;
- }
- }
-
- public void setKeyguardShowing(boolean showing) {
- mCurrentState.keyguardShowing = showing;
- apply(mCurrentState);
- }
-
- public void setKeyguardOccluded(boolean occluded) {
- mCurrentState.keyguardOccluded = occluded;
- apply(mCurrentState);
- }
-
- public void setKeyguardNeedsInput(boolean needsInput) {
- mCurrentState.keyguardNeedsInput = needsInput;
- apply(mCurrentState);
- }
-
- public void setPanelVisible(boolean visible) {
- mCurrentState.panelVisible = visible;
- mCurrentState.statusBarFocusable = visible;
- apply(mCurrentState);
- }
-
- public void setStatusBarFocusable(boolean focusable) {
- mCurrentState.statusBarFocusable = focusable;
- apply(mCurrentState);
- }
-
- public void setBouncerShowing(boolean showing) {
- mCurrentState.bouncerShowing = showing;
- apply(mCurrentState);
- }
-
- public void setBackdropShowing(boolean showing) {
- mCurrentState.backdropShowing = showing;
- apply(mCurrentState);
- }
-
- public void setKeyguardFadingAway(boolean keyguardFadingAway) {
- mCurrentState.keyguardFadingAway = keyguardFadingAway;
- apply(mCurrentState);
- }
-
- public void setQsExpanded(boolean expanded) {
- mCurrentState.qsExpanded = expanded;
- apply(mCurrentState);
- }
-
- public void setForceUserActivity(boolean forceUserActivity) {
- mCurrentState.forceUserActivity = forceUserActivity;
- apply(mCurrentState);
- }
-
- public void setScrimsVisibility(int scrimsVisibility) {
- mCurrentState.scrimsVisibility = scrimsVisibility;
- apply(mCurrentState);
- }
-
- public void setHeadsUpShowing(boolean showing) {
- mCurrentState.headsUpShowing = showing;
- apply(mCurrentState);
- }
-
- public void setWallpaperSupportsAmbientMode(boolean supportsAmbientMode) {
- mCurrentState.wallpaperSupportsAmbientMode = supportsAmbientMode;
- apply(mCurrentState);
- }
-
- /**
- * @param state The {@link StatusBarStateController} of the status bar.
- */
- private void setStatusBarState(int state) {
- mCurrentState.statusBarState = state;
- apply(mCurrentState);
- }
-
- public void setForceStatusBarVisible(boolean forceStatusBarVisible) {
- mCurrentState.forceStatusBarVisible = forceStatusBarVisible;
- apply(mCurrentState);
- }
-
- /**
- * Force the window to be collapsed, even if it should theoretically be expanded.
- * Used for when a heads-up comes in but we still need to wait for the touchable regions to
- * be computed.
- */
- public void setForceWindowCollapsed(boolean force) {
- mCurrentState.forceCollapsed = force;
- apply(mCurrentState);
- }
-
- public void setPanelExpanded(boolean isExpanded) {
- mCurrentState.panelExpanded = isExpanded;
- apply(mCurrentState);
- }
-
- @Override
- public void onRemoteInputActive(boolean remoteInputActive) {
- mCurrentState.remoteInputActive = remoteInputActive;
- apply(mCurrentState);
- }
-
- /**
- * Set whether the screen brightness is forced to the value we use for doze mode by the status
- * bar window.
- */
- public void setForceDozeBrightness(boolean forceDozeBrightness) {
- mCurrentState.forceDozeBrightness = forceDozeBrightness;
- apply(mCurrentState);
- }
-
- public void setDozing(boolean dozing) {
- mCurrentState.dozing = dozing;
- apply(mCurrentState);
- }
-
- public void setForcePluginOpen(boolean forcePluginOpen) {
- mCurrentState.forcePluginOpen = forcePluginOpen;
- apply(mCurrentState);
- if (mForcePluginOpenListener != null) {
- mForcePluginOpenListener.onChange(forcePluginOpen);
- }
- }
-
- /**
- * The forcePluginOpen state for the status bar.
- */
- public boolean getForcePluginOpen() {
- return mCurrentState.forcePluginOpen;
- }
-
- public void setNotTouchable(boolean notTouchable) {
- mCurrentState.notTouchable = notTouchable;
- apply(mCurrentState);
- }
-
- /**
- * Sets whether there are bubbles showing on the screen.
- */
- public void setBubblesShowing(boolean bubblesShowing) {
- mCurrentState.bubblesShowing = bubblesShowing;
- apply(mCurrentState);
- }
-
- /**
- * The bubbles showing state for the status bar.
- */
- public boolean getBubblesShowing() {
- return mCurrentState.bubblesShowing;
- }
-
- /**
- * Sets if there is a bubble being expanded on the screen.
- */
- public void setBubbleExpanded(boolean bubbleExpanded) {
- mCurrentState.bubbleExpanded = bubbleExpanded;
- apply(mCurrentState);
- }
-
- /**
- * Whether the bubble is shown in expanded state for the status bar.
- */
- public boolean getBubbleExpanded() {
- return mCurrentState.bubbleExpanded;
- }
-
- /**
- * Whether the status bar panel is expanded or not.
- */
- public boolean getPanelExpanded() {
- return mCurrentState.panelExpanded;
- }
-
- public void setStateListener(OtherwisedCollapsedListener listener) {
- mListener = listener;
- }
-
- public void setForcePluginOpenListener(ForcePluginOpenListener listener) {
- mForcePluginOpenListener = listener;
- }
-
- public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
- pw.println("StatusBarWindowController:");
- pw.println(" mKeyguardDisplayMode=" + mKeyguardDisplayMode);
- pw.println(mCurrentState);
- }
-
- public boolean isShowingWallpaper() {
- return !mCurrentState.backdropShowing;
- }
-
- @Override
- public void onThemeChanged() {
- if (mStatusBarView == null) {
- return;
- }
-
- final boolean useDarkText = mColorExtractor.getNeutralColors().supportsDarkText();
- // Make sure we have the correct navbar/statusbar colors.
- setKeyguardDark(useDarkText);
- }
-
- /**
- * When keyguard will be dismissed but didn't start animation yet.
- */
- public void setKeyguardGoingAway(boolean goingAway) {
- mCurrentState.keyguardGoingAway = goingAway;
- apply(mCurrentState);
- }
-
- public boolean getForceHasTopUi() {
- return mCurrentState.forceHasTopUi;
- }
-
- public void setForceHasTopUi(boolean forceHasTopUi) {
- mCurrentState.forceHasTopUi = forceHasTopUi;
- apply(mCurrentState);
}
private static class State {
- boolean keyguardShowing;
- boolean keyguardOccluded;
- boolean keyguardNeedsInput;
- boolean panelVisible;
- boolean panelExpanded;
- boolean statusBarFocusable;
- boolean bouncerShowing;
- boolean keyguardFadingAway;
- boolean keyguardGoingAway;
- boolean qsExpanded;
- boolean headsUpShowing;
- boolean forceStatusBarVisible;
- boolean forceCollapsed;
- boolean forceDozeBrightness;
- boolean forceUserActivity;
- boolean backdropShowing;
- boolean wallpaperSupportsAmbientMode;
- boolean notTouchable;
- boolean bubblesShowing;
- boolean bubbleExpanded;
- boolean forceHasTopUi;
-
- /**
- * The {@link StatusBar} state from the status bar.
- */
- int statusBarState;
-
- boolean remoteInputActive;
- boolean forcePluginOpen;
- boolean dozing;
- int scrimsVisibility;
-
- private boolean isKeyguardShowingAndNotOccluded() {
- return keyguardShowing && !keyguardOccluded;
- }
-
- @Override
- public String toString() {
- StringBuilder result = new StringBuilder();
- String newLine = "\n";
- result.append("Window State {");
- result.append(newLine);
-
- Field[] fields = this.getClass().getDeclaredFields();
-
- // Print field names paired with their values
- for (Field field : fields) {
- result.append(" ");
- try {
- result.append(field.getName());
- result.append(": ");
- //requires access to private field:
- result.append(field.get(this));
- } catch (IllegalAccessException ex) {
- }
- result.append(newLine);
- }
- result.append("}");
-
- return result.toString();
- }
+ boolean mForceStatusBarVisible;
}
- private final StateListener mStateListener = new StateListener() {
- @Override
- public void onStateChanged(int newState) {
- setStatusBarState(newState);
+ private void applyForceStatusBarVisibleFlag(State state) {
+ if (state.mForceStatusBarVisible) {
+ mLpChanged.privateFlags |= PRIVATE_FLAG_FORCE_SHOW_STATUS_BAR;
+ } else {
+ mLpChanged.privateFlags &= ~PRIVATE_FLAG_FORCE_SHOW_STATUS_BAR;
}
-
- @Override
- public void onDozingChanged(boolean isDozing) {
- setDozing(isDozing);
- }
- };
-
- /**
- * Custom listener to pipe data back to plugins about whether or not the status bar would be
- * collapsed if not for the plugin.
- * TODO: Find cleaner way to do this.
- */
- public interface OtherwisedCollapsedListener {
- void setWouldOtherwiseCollapse(boolean otherwiseCollapse);
- }
-
- /**
- * Listener to indicate forcePluginOpen has changed
- */
- public interface ForcePluginOpenListener {
- /**
- * Called when mState.forcePluginOpen is changed
- */
- void onChange(boolean forceOpen);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
index 1e3c5d6..da5df6a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 The Android Open Source Project
+ * 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.
@@ -16,599 +16,19 @@
package com.android.systemui.statusbar.phone;
-import android.annotation.ColorInt;
-import android.annotation.DrawableRes;
-import android.annotation.LayoutRes;
import android.content.Context;
-import android.content.res.Configuration;
-import android.content.res.TypedArray;
-import android.graphics.Canvas;
-import android.graphics.Insets;
-import android.graphics.Paint;
-import android.graphics.Rect;
-import android.graphics.drawable.Drawable;
-import android.net.Uri;
-import android.os.Bundle;
import android.util.AttributeSet;
-import android.view.ActionMode;
-import android.view.DisplayCutout;
-import android.view.InputQueue;
-import android.view.KeyEvent;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.MotionEvent;
-import android.view.SurfaceHolder;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.ViewTreeObserver;
-import android.view.Window;
-import android.view.WindowInsets;
-import android.view.WindowInsetsController;
import android.widget.FrameLayout;
-import com.android.internal.view.FloatingActionMode;
-import com.android.internal.widget.FloatingToolbar;
-import com.android.systemui.R;
-
/**
- * Combined status bar and notification panel view. Also holding backdrop and scrims.
+ * Status bar view.
*/
public class StatusBarWindowView extends FrameLayout {
- public static final String TAG = "StatusBarWindowView";
+
+ public static final String TAG = "PhoneStatusBarWindowView";
public static final boolean DEBUG = StatusBar.DEBUG;
- private int mRightInset = 0;
- private int mLeftInset = 0;
-
- // Implements the floating action mode for TextView's Cut/Copy/Past menu. Normally provided by
- // DecorView, but since this is a special window we have to roll our own.
- private View mFloatingActionModeOriginatingView;
- private ActionMode mFloatingActionMode;
- private FloatingToolbar mFloatingToolbar;
- private ViewTreeObserver.OnPreDrawListener mFloatingToolbarPreDrawListener;
-
- private InteractionEventHandler mInteractionEventHandler;
-
public StatusBarWindowView(Context context, AttributeSet attrs) {
super(context, attrs);
- setMotionEventSplittingEnabled(false);
}
-
- public NotificationPanelView getNotificationPanelView() {
- return findViewById(R.id.notification_panel);
- }
-
- @Override
- public WindowInsets onApplyWindowInsets(WindowInsets windowInsets) {
- final Insets insets = windowInsets.getMaxInsets(WindowInsets.Type.systemBars());
- if (getFitsSystemWindows()) {
- boolean paddingChanged = insets.top != getPaddingTop()
- || insets.bottom != getPaddingBottom();
-
- int rightCutout = 0;
- int leftCutout = 0;
- DisplayCutout displayCutout = getRootWindowInsets().getDisplayCutout();
- if (displayCutout != null) {
- leftCutout = displayCutout.getSafeInsetLeft();
- rightCutout = displayCutout.getSafeInsetRight();
- }
-
- int targetLeft = Math.max(insets.left, leftCutout);
- int targetRight = Math.max(insets.right, rightCutout);
-
- // Super-special right inset handling, because scrims and backdrop need to ignore it.
- if (targetRight != mRightInset || targetLeft != mLeftInset) {
- mRightInset = targetRight;
- mLeftInset = targetLeft;
- applyMargins();
- }
- // Drop top inset, and pass through bottom inset.
- if (paddingChanged) {
- setPadding(0, 0, 0, 0);
- }
- } else {
- if (mRightInset != 0 || mLeftInset != 0) {
- mRightInset = 0;
- mLeftInset = 0;
- applyMargins();
- }
- boolean changed = getPaddingLeft() != 0
- || getPaddingRight() != 0
- || getPaddingTop() != 0
- || getPaddingBottom() != 0;
- if (changed) {
- setPadding(0, 0, 0, 0);
- }
- }
- return windowInsets;
- }
-
- private void applyMargins() {
- final int N = getChildCount();
- for (int i = 0; i < N; i++) {
- View child = getChildAt(i);
- if (child.getLayoutParams() instanceof LayoutParams) {
- LayoutParams lp = (LayoutParams) child.getLayoutParams();
- if (!lp.ignoreRightInset
- && (lp.rightMargin != mRightInset || lp.leftMargin != mLeftInset)) {
- lp.rightMargin = mRightInset;
- lp.leftMargin = mLeftInset;
- child.requestLayout();
- }
- }
- }
- }
-
- @Override
- public FrameLayout.LayoutParams generateLayoutParams(AttributeSet attrs) {
- return new LayoutParams(getContext(), attrs);
- }
-
- @Override
- protected FrameLayout.LayoutParams generateDefaultLayoutParams() {
- return new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
- }
-
- @Override
- protected void onAttachedToWindow () {
- super.onAttachedToWindow();
- setWillNotDraw(!DEBUG);
- }
-
- @Override
- public boolean dispatchKeyEvent(KeyEvent event) {
- if (mInteractionEventHandler.interceptMediaKey(event)) {
- return true;
- }
-
- if (super.dispatchKeyEvent(event)) {
- return true;
- }
-
- return mInteractionEventHandler.dispatchKeyEvent(event);
- }
-
- protected void setInteractionEventHandler(InteractionEventHandler listener) {
- mInteractionEventHandler = listener;
- }
-
- @Override
- public boolean dispatchTouchEvent(MotionEvent ev) {
- Boolean result = mInteractionEventHandler.handleDispatchTouchEvent(ev);
-
- return result != null ? result : super.dispatchTouchEvent(ev);
- }
-
- @Override
- public boolean onInterceptTouchEvent(MotionEvent ev) {
- boolean intercept = mInteractionEventHandler.shouldInterceptTouchEvent(ev);
- if (!intercept) {
- intercept = super.onInterceptTouchEvent(ev);
- }
- if (intercept) {
- mInteractionEventHandler.didIntercept(ev);
- }
-
- return intercept;
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent ev) {
- boolean handled = mInteractionEventHandler.handleTouchEvent(ev);
-
- if (!handled) {
- handled = super.onTouchEvent(ev);
- }
-
- if (!handled) {
- mInteractionEventHandler.didNotHandleTouchEvent(ev);
- }
-
- return handled;
- }
-
- @Override
- public void onDraw(Canvas canvas) {
- super.onDraw(canvas);
- if (DEBUG) {
- Paint pt = new Paint();
- pt.setColor(0x80FFFF00);
- pt.setStrokeWidth(12.0f);
- pt.setStyle(Paint.Style.STROKE);
- canvas.drawRect(0, 0, canvas.getWidth(), canvas.getHeight(), pt);
- }
- }
-
- public class LayoutParams extends FrameLayout.LayoutParams {
-
- public boolean ignoreRightInset;
-
- public LayoutParams(int width, int height) {
- super(width, height);
- }
-
- public LayoutParams(Context c, AttributeSet attrs) {
- super(c, attrs);
-
- TypedArray a = c.obtainStyledAttributes(attrs, R.styleable.StatusBarWindowView_Layout);
- ignoreRightInset = a.getBoolean(
- R.styleable.StatusBarWindowView_Layout_ignoreRightInset, false);
- a.recycle();
- }
- }
-
- @Override
- public ActionMode startActionModeForChild(View originalView, ActionMode.Callback callback,
- int type) {
- if (type == ActionMode.TYPE_FLOATING) {
- return startActionMode(originalView, callback, type);
- }
- return super.startActionModeForChild(originalView, callback, type);
- }
-
- private ActionMode createFloatingActionMode(
- View originatingView, ActionMode.Callback2 callback) {
- if (mFloatingActionMode != null) {
- mFloatingActionMode.finish();
- }
- cleanupFloatingActionModeViews();
- mFloatingToolbar = new FloatingToolbar(mFakeWindow);
- final FloatingActionMode mode =
- new FloatingActionMode(mContext, callback, originatingView, mFloatingToolbar);
- mFloatingActionModeOriginatingView = originatingView;
- mFloatingToolbarPreDrawListener =
- new ViewTreeObserver.OnPreDrawListener() {
- @Override
- public boolean onPreDraw() {
- mode.updateViewLocationInWindow();
- return true;
- }
- };
- return mode;
- }
-
- private void setHandledFloatingActionMode(ActionMode mode) {
- mFloatingActionMode = mode;
- mFloatingActionMode.invalidate(); // Will show the floating toolbar if necessary.
- mFloatingActionModeOriginatingView.getViewTreeObserver()
- .addOnPreDrawListener(mFloatingToolbarPreDrawListener);
- }
-
- private void cleanupFloatingActionModeViews() {
- if (mFloatingToolbar != null) {
- mFloatingToolbar.dismiss();
- mFloatingToolbar = null;
- }
- if (mFloatingActionModeOriginatingView != null) {
- if (mFloatingToolbarPreDrawListener != null) {
- mFloatingActionModeOriginatingView.getViewTreeObserver()
- .removeOnPreDrawListener(mFloatingToolbarPreDrawListener);
- mFloatingToolbarPreDrawListener = null;
- }
- mFloatingActionModeOriginatingView = null;
- }
- }
-
- private ActionMode startActionMode(
- View originatingView, ActionMode.Callback callback, int type) {
- ActionMode.Callback2 wrappedCallback = new ActionModeCallback2Wrapper(callback);
- ActionMode mode = createFloatingActionMode(originatingView, wrappedCallback);
- if (mode != null && wrappedCallback.onCreateActionMode(mode, mode.getMenu())) {
- setHandledFloatingActionMode(mode);
- } else {
- mode = null;
- }
- return mode;
- }
-
- private class ActionModeCallback2Wrapper extends ActionMode.Callback2 {
- private final ActionMode.Callback mWrapped;
-
- public ActionModeCallback2Wrapper(ActionMode.Callback wrapped) {
- mWrapped = wrapped;
- }
-
- public boolean onCreateActionMode(ActionMode mode, Menu menu) {
- return mWrapped.onCreateActionMode(mode, menu);
- }
-
- public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
- requestFitSystemWindows();
- return mWrapped.onPrepareActionMode(mode, menu);
- }
-
- public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
- return mWrapped.onActionItemClicked(mode, item);
- }
-
- public void onDestroyActionMode(ActionMode mode) {
- mWrapped.onDestroyActionMode(mode);
- if (mode == mFloatingActionMode) {
- cleanupFloatingActionModeViews();
- mFloatingActionMode = null;
- }
- requestFitSystemWindows();
- }
-
- @Override
- public void onGetContentRect(ActionMode mode, View view, Rect outRect) {
- if (mWrapped instanceof ActionMode.Callback2) {
- ((ActionMode.Callback2) mWrapped).onGetContentRect(mode, view, outRect);
- } else {
- super.onGetContentRect(mode, view, outRect);
- }
- }
- }
-
- interface InteractionEventHandler {
- /**
- * Returns a result for {@link ViewGroup#dispatchTouchEvent(MotionEvent)} or null to defer
- * to the super method.
- */
- Boolean handleDispatchTouchEvent(MotionEvent ev);
-
- /**
- * Returns if the view should intercept the touch event.
- *
- * The touch event may still be interecepted if
- * {@link ViewGroup#onInterceptTouchEvent(MotionEvent)} decides to do so.
- */
- boolean shouldInterceptTouchEvent(MotionEvent ev);
-
- /**
- * Called when the view decides to intercept the touch event.
- */
- void didIntercept(MotionEvent ev);
-
- boolean handleTouchEvent(MotionEvent ev);
-
- void didNotHandleTouchEvent(MotionEvent ev);
-
- boolean interceptMediaKey(KeyEvent event);
-
- boolean dispatchKeyEvent(KeyEvent event);
- }
-
- /**
- * Minimal window to satisfy FloatingToolbar.
- */
- private Window mFakeWindow = new Window(mContext) {
- @Override
- public void takeSurface(SurfaceHolder.Callback2 callback) {
- }
-
- @Override
- public void takeInputQueue(InputQueue.Callback callback) {
- }
-
- @Override
- public boolean isFloating() {
- return false;
- }
-
- @Override
- public void alwaysReadCloseOnTouchAttr() {
- }
-
- @Override
- public void setContentView(@LayoutRes int layoutResID) {
- }
-
- @Override
- public void setContentView(View view) {
- }
-
- @Override
- public void setContentView(View view, ViewGroup.LayoutParams params) {
- }
-
- @Override
- public void addContentView(View view, ViewGroup.LayoutParams params) {
- }
-
- @Override
- public void clearContentView() {
- }
-
- @Override
- public View getCurrentFocus() {
- return null;
- }
-
- @Override
- public LayoutInflater getLayoutInflater() {
- return null;
- }
-
- @Override
- public void setTitle(CharSequence title) {
- }
-
- @Override
- public void setTitleColor(@ColorInt int textColor) {
- }
-
- @Override
- public void openPanel(int featureId, KeyEvent event) {
- }
-
- @Override
- public void closePanel(int featureId) {
- }
-
- @Override
- public void togglePanel(int featureId, KeyEvent event) {
- }
-
- @Override
- public void invalidatePanelMenu(int featureId) {
- }
-
- @Override
- public boolean performPanelShortcut(int featureId, int keyCode, KeyEvent event, int flags) {
- return false;
- }
-
- @Override
- public boolean performPanelIdentifierAction(int featureId, int id, int flags) {
- return false;
- }
-
- @Override
- public void closeAllPanels() {
- }
-
- @Override
- public boolean performContextMenuIdentifierAction(int id, int flags) {
- return false;
- }
-
- @Override
- public void onConfigurationChanged(Configuration newConfig) {
- }
-
- @Override
- public void setBackgroundDrawable(Drawable drawable) {
- }
-
- @Override
- public void setFeatureDrawableResource(int featureId, @DrawableRes int resId) {
- }
-
- @Override
- public void setFeatureDrawableUri(int featureId, Uri uri) {
- }
-
- @Override
- public void setFeatureDrawable(int featureId, Drawable drawable) {
- }
-
- @Override
- public void setFeatureDrawableAlpha(int featureId, int alpha) {
- }
-
- @Override
- public void setFeatureInt(int featureId, int value) {
- }
-
- @Override
- public void takeKeyEvents(boolean get) {
- }
-
- @Override
- public boolean superDispatchKeyEvent(KeyEvent event) {
- return false;
- }
-
- @Override
- public boolean superDispatchKeyShortcutEvent(KeyEvent event) {
- return false;
- }
-
- @Override
- public boolean superDispatchTouchEvent(MotionEvent event) {
- return false;
- }
-
- @Override
- public boolean superDispatchTrackballEvent(MotionEvent event) {
- return false;
- }
-
- @Override
- public boolean superDispatchGenericMotionEvent(MotionEvent event) {
- return false;
- }
-
- @Override
- public View getDecorView() {
- return StatusBarWindowView.this;
- }
-
- @Override
- public View peekDecorView() {
- return null;
- }
-
- @Override
- public Bundle saveHierarchyState() {
- return null;
- }
-
- @Override
- public void restoreHierarchyState(Bundle savedInstanceState) {
- }
-
- @Override
- protected void onActive() {
- }
-
- @Override
- public void setChildDrawable(int featureId, Drawable drawable) {
- }
-
- @Override
- public void setChildInt(int featureId, int value) {
- }
-
- @Override
- public boolean isShortcutKey(int keyCode, KeyEvent event) {
- return false;
- }
-
- @Override
- public void setVolumeControlStream(int streamType) {
- }
-
- @Override
- public int getVolumeControlStream() {
- return 0;
- }
-
- @Override
- public int getStatusBarColor() {
- return 0;
- }
-
- @Override
- public void setStatusBarColor(@ColorInt int color) {
- }
-
- @Override
- public int getNavigationBarColor() {
- return 0;
- }
-
- @Override
- public void setNavigationBarColor(@ColorInt int color) {
- }
-
- @Override
- public void setDecorCaptionShade(int decorCaptionShade) {
- }
-
- @Override
- public void setResizingCaptionDrawable(Drawable drawable) {
- }
-
- @Override
- public void onMultiWindowModeChanged() {
- }
-
- @Override
- public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode) {
- }
-
- @Override
- public void reportActivityRelaunched() {
- }
-
- @Override
- public WindowInsetsController getInsetsController() {
- return null;
- }
- };
-
}
-
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarComponent.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarComponent.java
index 21d0bb8..802da3e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarComponent.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarComponent.java
@@ -19,8 +19,9 @@
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import com.android.systemui.statusbar.phone.NotificationPanelViewController;
-import com.android.systemui.statusbar.phone.StatusBarWindowView;
-import com.android.systemui.statusbar.phone.StatusBarWindowViewController;
+import com.android.systemui.statusbar.phone.NotificationShadeWindowView;
+import com.android.systemui.statusbar.phone.NotificationShadeWindowViewController;
+import com.android.systemui.statusbar.phone.StatusBarWindowController;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
@@ -41,7 +42,8 @@
*/
@Subcomponent.Builder
interface Builder {
- @BindsInstance Builder statusBarWindowView(StatusBarWindowView statusBarWindowView);
+ @BindsInstance Builder statusBarWindowView(
+ NotificationShadeWindowView notificationShadeWindowView);
StatusBarComponent build();
}
@@ -54,10 +56,16 @@
@interface StatusBarScope {}
/**
+ * Creates a NotificationShadeWindowViewController.
+ */
+ @StatusBarScope
+ NotificationShadeWindowViewController getNotificationShadeWindowViewController();
+
+ /**
* Creates a StatusBarWindowViewController.
*/
@StatusBarScope
- StatusBarWindowViewController getStatusBarWindowViewController();
+ StatusBarWindowController getStatusBarWindowController();
/**
* Creates a NotificationPanelViewController.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java
index 20bd51d..37d8c9a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java
@@ -17,7 +17,7 @@
package com.android.systemui.statusbar.phone.dagger;
import com.android.systemui.statusbar.phone.NotificationPanelView;
-import com.android.systemui.statusbar.phone.StatusBarWindowView;
+import com.android.systemui.statusbar.phone.NotificationShadeWindowView;
import dagger.Module;
import dagger.Provides;
@@ -28,8 +28,8 @@
@Provides
@StatusBarComponent.StatusBarScope
public static NotificationPanelView getNotificationPanelView(
- StatusBarWindowView statusBarWindowView) {
- return statusBarWindowView.getNotificationPanelView();
+ NotificationShadeWindowView notificationShadeWindowView) {
+ return notificationShadeWindowView.getNotificationPanelView();
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessMirrorController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessMirrorController.java
index 625d884..d62da10 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessMirrorController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessMirrorController.java
@@ -25,7 +25,7 @@
import com.android.systemui.R;
import com.android.systemui.statusbar.phone.NotificationPanelViewController;
-import com.android.systemui.statusbar.phone.StatusBarWindowView;
+import com.android.systemui.statusbar.phone.NotificationShadeWindowView;
import java.util.Objects;
import java.util.function.Consumer;
@@ -36,14 +36,14 @@
public class BrightnessMirrorController
implements CallbackController<BrightnessMirrorController.BrightnessMirrorListener> {
- private final StatusBarWindowView mStatusBarWindow;
+ private final NotificationShadeWindowView mStatusBarWindow;
private final Consumer<Boolean> mVisibilityCallback;
private final NotificationPanelViewController mNotificationPanel;
private final ArraySet<BrightnessMirrorListener> mBrightnessMirrorListeners = new ArraySet<>();
private final int[] mInt2Cache = new int[2];
private View mBrightnessMirror;
- public BrightnessMirrorController(StatusBarWindowView statusBarWindow,
+ public BrightnessMirrorController(NotificationShadeWindowView statusBarWindow,
NotificationPanelViewController notificationPanelViewController,
@NonNull Consumer<Boolean> visibilityCallback) {
mStatusBarWindow = statusBarWindow;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java b/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java
index ba264c0..5706bee 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java
@@ -53,6 +53,7 @@
import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.fragments.FragmentHostManager;
import com.android.systemui.fragments.FragmentService;
+import com.android.systemui.statusbar.phone.NotificationShadeWindowView;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.phone.StatusBarWindowView;
import com.android.systemui.tuner.TunablePadding;
@@ -80,7 +81,8 @@
private WindowManager mWindowManager;
private FragmentService mFragmentService;
private FragmentHostManager mFragmentHostManager;
- private StatusBarWindowView mView;
+ private NotificationShadeWindowView mView;
+ private StatusBarWindowView mStatusBarWindowView;
private TunablePaddingService mTunablePaddingService;
private Handler mMainHandler;
@Mock
@@ -99,9 +101,11 @@
mFragmentService = mDependency.injectMockDependency(FragmentService.class);
mWindowManager = mock(WindowManager.class);
- mView = spy(new StatusBarWindowView(mContext, null));
+ mView = spy(new NotificationShadeWindowView(mContext, null));
+ mStatusBarWindowView = spy(new StatusBarWindowView(mContext, null));
when(mStatusBarLazy.get()).thenReturn(mStatusBar);
- when(mStatusBar.getStatusBarWindow()).thenReturn(mView);
+ when(mStatusBar.getNotificationShadeWindowView()).thenReturn(mView);
+ when(mStatusBar.getStatusBarWindow()).thenReturn(mStatusBarWindowView);
Display display = mContext.getSystemService(WindowManager.class).getDefaultDisplay();
when(mWindowManager.getDefaultDisplay()).thenReturn(display);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java
index e0b4b81..a320797 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java
@@ -74,8 +74,8 @@
import com.android.systemui.statusbar.phone.DozeParameters;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
+import com.android.systemui.statusbar.phone.NotificationShadeWindowController;
import com.android.systemui.statusbar.phone.ShadeController;
-import com.android.systemui.statusbar.phone.StatusBarWindowController;
import com.android.systemui.statusbar.policy.BatteryController;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.HeadsUpManager;
@@ -126,7 +126,7 @@
private ArgumentCaptor<NotificationRemoveInterceptor> mRemoveInterceptorCaptor;
private TestableBubbleController mBubbleController;
- private StatusBarWindowController mStatusBarWindowController;
+ private NotificationShadeWindowController mNotificationShadeWindowController;
private NotificationEntryListener mEntryListener;
private NotificationRemoveInterceptor mRemoveInterceptor;
@@ -170,11 +170,11 @@
new InjectionInflationController(SystemUIFactory.getInstance().getRootComponent()));
// Bubbles get added to status bar window view
- mStatusBarWindowController = new StatusBarWindowController(mContext, mWindowManager,
- mActivityManager, mDozeParameters, mStatusBarStateController,
+ mNotificationShadeWindowController = new NotificationShadeWindowController(mContext,
+ mWindowManager, mActivityManager, mDozeParameters, mStatusBarStateController,
mConfigurationController, mKeyguardBypassController, mColorExtractor,
- mSuperStatusBarViewFactory, mResources);
- mStatusBarWindowController.attach();
+ mSuperStatusBarViewFactory);
+ mNotificationShadeWindowController.attach();
// Need notifications for bubbles
mNotificationTestHelper = new NotificationTestHelper(mContext, mDependency);
@@ -201,7 +201,7 @@
mock(NotificationInterruptionStateProvider.HeadsUpSuppressor.class));
mBubbleData = new BubbleData(mContext);
mBubbleController = new TestableBubbleController(mContext,
- mStatusBarWindowController,
+ mNotificationShadeWindowController,
mStatusBarStateController,
mShadeController,
mBubbleData,
@@ -250,7 +250,7 @@
mBubbleController.removeBubble(
mRow.getEntry().getKey(), BubbleController.DISMISS_USER_GESTURE);
- assertFalse(mStatusBarWindowController.getBubblesShowing());
+ assertFalse(mNotificationShadeWindowController.getBubblesShowing());
assertNull(mBubbleData.getBubbleWithKey(mRow.getEntry().getKey()));
verify(mNotificationEntryManager, times(2)).updateNotifications(anyString());
verify(mBubbleStateChangeListener).onHasBubblesChanged(false);
@@ -290,7 +290,7 @@
assertTrue(mBubbleController.hasBubbles());
mBubbleController.dismissStack(BubbleController.DISMISS_USER_GESTURE);
- assertFalse(mStatusBarWindowController.getBubblesShowing());
+ assertFalse(mNotificationShadeWindowController.getBubblesShowing());
verify(mNotificationEntryManager, times(3)).updateNotifications(any());
assertNull(mBubbleData.getBubbleWithKey(mRow.getEntry().getKey()));
assertNull(mBubbleData.getBubbleWithKey(mRow2.getEntry().getKey()));
@@ -308,14 +308,14 @@
assertTrue(mBubbleController.hasBubbles());
assertFalse(mBubbleController.isBubbleNotificationSuppressedFromShade(
mRow.getEntry().getKey()));
- assertFalse(mStatusBarWindowController.getBubbleExpanded());
+ assertFalse(mNotificationShadeWindowController.getBubbleExpanded());
// Expand the stack
BubbleStackView stackView = mBubbleController.getStackView();
mBubbleController.expandStack();
assertTrue(mBubbleController.isStackExpanded());
verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow.getEntry().getKey());
- assertTrue(mStatusBarWindowController.getBubbleExpanded());
+ assertTrue(mNotificationShadeWindowController.getBubbleExpanded());
// Make sure the notif is suppressed
assertTrue(mBubbleController.isBubbleNotificationSuppressedFromShade(
@@ -325,7 +325,7 @@
mBubbleController.collapseStack();
verify(mBubbleExpandListener).onBubbleExpandChanged(false, mRow.getEntry().getKey());
assertFalse(mBubbleController.isStackExpanded());
- assertFalse(mStatusBarWindowController.getBubbleExpanded());
+ assertFalse(mNotificationShadeWindowController.getBubbleExpanded());
}
@Test
@@ -712,7 +712,7 @@
static class TestableBubbleController extends BubbleController {
// Let's assume surfaces can be synchronized immediately.
TestableBubbleController(Context context,
- StatusBarWindowController statusBarWindowController,
+ NotificationShadeWindowController notificationShadeWindowController,
StatusBarStateController statusBarStateController,
ShadeController shadeController,
BubbleData data,
@@ -724,7 +724,7 @@
NotificationEntryManager entryManager,
RemoteInputUriController remoteInputUriController) {
super(context,
- statusBarWindowController, statusBarStateController, shadeController,
+ notificationShadeWindowController, statusBarStateController, shadeController,
data, Runnable::run, configurationController, interruptionStateProvider,
zenModeController, lockscreenUserManager, groupManager, entryManager,
remoteInputUriController);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java
index 64fbc1b..acc30d9 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java
@@ -36,8 +36,8 @@
import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.classifier.FalsingManagerFake;
import com.android.systemui.plugins.FalsingManager;
+import com.android.systemui.statusbar.phone.NotificationShadeWindowController;
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
-import com.android.systemui.statusbar.phone.StatusBarWindowController;
import com.android.systemui.util.concurrency.FakeExecutor;
import com.android.systemui.util.time.FakeSystemClock;
@@ -57,7 +57,7 @@
private @Mock LockPatternUtils mLockPatternUtils;
private @Mock KeyguardUpdateMonitor mUpdateMonitor;
private @Mock StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
- private @Mock StatusBarWindowController mStatusBarWindowController;
+ private @Mock NotificationShadeWindowController mNotificationShadeWindowController;
private @Mock BroadcastDispatcher mBroadcastDispatcher;
private @Mock DismissCallbackRegistry mDismissCallbackRegistry;
private FakeExecutor mUiBgExecutor = new FakeExecutor(new FakeSystemClock());
@@ -77,7 +77,7 @@
TestableLooper.get(this).runWithLooper(() -> {
mViewMediator = new KeyguardViewMediator(
mContext, mFalsingManager, mLockPatternUtils, mBroadcastDispatcher,
- mStatusBarWindowController, () -> mStatusBarKeyguardViewManager,
+ mNotificationShadeWindowController, () -> mStatusBarKeyguardViewManager,
mDismissCallbackRegistry, mUiBgExecutor);
});
}
@@ -87,6 +87,6 @@
mViewMediator.start();
mViewMediator.onStartedGoingToSleep(OFF_BECAUSE_OF_USER);
verify(mUpdateMonitor).setKeyguardGoingAway(false);
- verify(mStatusBarWindowController, never()).setKeyguardGoingAway(anyBoolean());
+ verify(mNotificationShadeWindowController, never()).setKeyguardGoingAway(anyBoolean());
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NonPhoneDependencyTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NonPhoneDependencyTest.java
index bb9c14b..6d83ac3 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NonPhoneDependencyTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NonPhoneDependencyTest.java
@@ -34,8 +34,8 @@
import com.android.systemui.statusbar.notification.row.NotificationGutsManager.OnSettingsClickListener;
import com.android.systemui.statusbar.notification.row.NotificationInfo.CheckSaveListener;
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
+import com.android.systemui.statusbar.phone.NotificationShadeWindowController;
import com.android.systemui.statusbar.phone.ShadeController;
-import com.android.systemui.statusbar.phone.StatusBarWindowController;
import com.android.systemui.statusbar.policy.HeadsUpManager;
import org.junit.Before;
@@ -97,6 +97,6 @@
viewHierarchyManager.setUpWithPresenter(mPresenter, mListContainer);
TestableLooper.get(this).processAllMessages();
- assertFalse(mDependency.hasInstantiatedDependency(StatusBarWindowController.class));
+ assertFalse(mDependency.hasInstantiatedDependency(NotificationShadeWindowController.class));
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationTestHelper.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationTestHelper.java
index 3fdbd3e..61e43b0 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationTestHelper.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationTestHelper.java
@@ -55,7 +55,7 @@
import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
-import com.android.systemui.statusbar.phone.StatusBarWindowController;
+import com.android.systemui.statusbar.phone.NotificationShadeWindowController;
import com.android.systemui.tests.R;
import java.util.concurrent.CountDownLatch;
@@ -87,7 +87,7 @@
mContext = context;
dependency.injectMockDependency(NotificationMediaManager.class);
dependency.injectMockDependency(BubbleController.class);
- dependency.injectMockDependency(StatusBarWindowController.class);
+ dependency.injectMockDependency(NotificationShadeWindowController.class);
dependency.injectMockDependency(SmartReplyController.class);
StatusBarStateController stateController = mock(StatusBarStateController.class);
mGroupManager = new NotificationGroupManager(stateController);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/ActivityLaunchAnimatorTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/ActivityLaunchAnimatorTest.java
index a54f733..a07cfc3 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/ActivityLaunchAnimatorTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/ActivityLaunchAnimatorTest.java
@@ -34,8 +34,8 @@
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
import com.android.systemui.statusbar.phone.NotificationPanelViewController;
-import com.android.systemui.statusbar.phone.StatusBarWindowView;
-import com.android.systemui.statusbar.phone.StatusBarWindowViewController;
+import com.android.systemui.statusbar.phone.NotificationShadeWindowView;
+import com.android.systemui.statusbar.phone.NotificationShadeWindowViewController;
import org.junit.Assert;
import org.junit.Before;
@@ -49,20 +49,22 @@
private ActivityLaunchAnimator mLaunchAnimator;
private ActivityLaunchAnimator.Callback mCallback = mock(ActivityLaunchAnimator.Callback.class);
- private StatusBarWindowViewController mStatusBarWindowViewController = mock(
- StatusBarWindowViewController.class);
- private StatusBarWindowView mStatusBarWindowView = mock(StatusBarWindowView.class);
+ private NotificationShadeWindowViewController mNotificationShadeWindowViewController = mock(
+ NotificationShadeWindowViewController.class);
+ private NotificationShadeWindowView mNotificationShadeWindowView = mock(
+ NotificationShadeWindowView.class);
private NotificationListContainer mNotificationContainer
= mock(NotificationListContainer.class);
private ExpandableNotificationRow mRow = mock(ExpandableNotificationRow.class);
@Before
public void setUp() throws Exception {
- when(mStatusBarWindowViewController.getView()).thenReturn(mStatusBarWindowView);
- when(mStatusBarWindowView.getResources()).thenReturn(mContext.getResources());
+ when(mNotificationShadeWindowViewController.getView())
+ .thenReturn(mNotificationShadeWindowView);
+ when(mNotificationShadeWindowView.getResources()).thenReturn(mContext.getResources());
when(mCallback.areLaunchAnimationsEnabled()).thenReturn(true);
mLaunchAnimator = new ActivityLaunchAnimator(
- mStatusBarWindowViewController,
+ mNotificationShadeWindowViewController,
mCallback,
mock(NotificationPanelViewController.class),
mNotificationContainer);
@@ -92,7 +94,7 @@
RemoteAnimationAdapter launchAnimation = mLaunchAnimator.getLaunchAnimation(mRow,
false /* occluded */);
Assert.assertTrue("No animation generated", launchAnimation != null);
- executePostsImmediately(mStatusBarWindowView);
+ executePostsImmediately(mNotificationShadeWindowView);
mLaunchAnimator.setLaunchResult(ActivityManager.START_SUCCESS,
true /* wasIntentActivity */);
verify(mCallback).onExpandAnimationTimedOut();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java
index 5907a0a..769b774 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java
@@ -67,7 +67,7 @@
@Mock
private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
@Mock
- private StatusBarWindowController mStatusBarWindowController;
+ private NotificationShadeWindowController mNotificationShadeWindowController;
@Mock
private DozeScrimController mDozeScrimController;
@Mock
@@ -104,9 +104,9 @@
res.addOverride(com.android.internal.R.integer.config_wakeUpDelayDoze, 0);
mBiometricUnlockController = new BiometricUnlockController(mContext, mDozeScrimController,
mKeyguardViewMediator, mScrimController, mStatusBar, mShadeController,
- mStatusBarWindowController, mKeyguardStateController, mHandler, mUpdateMonitor,
- res.getResources(), mKeyguardBypassController, mDozeParameters, mMetricsLogger,
- mDumpController);
+ mNotificationShadeWindowController, mKeyguardStateController, mHandler,
+ mUpdateMonitor, res.getResources(), mKeyguardBypassController, mDozeParameters,
+ mMetricsLogger, mDumpController);
mBiometricUnlockController.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/DozeServiceHostTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/DozeServiceHostTest.java
index d31f175..3c6a698 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/DozeServiceHostTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/DozeServiceHostTest.java
@@ -79,12 +79,12 @@
@Mock private DozeLog mDozeLog;
@Mock private PulseExpansionHandler mPulseExpansionHandler;
@Mock private NotificationWakeUpCoordinator mNotificationWakeUpCoordinator;
- @Mock private StatusBarWindowController mStatusBarWindowController;
+ @Mock private NotificationShadeWindowController mNotificationShadeWindowController;
@Mock private PowerManager mPowerManager;
@Mock private WakefulnessLifecycle mWakefullnessLifecycle;
@Mock private StatusBar mStatusBar;
@Mock private NotificationIconAreaController mNotificationIconAreaController;
- @Mock private StatusBarWindowViewController mStatusBarWindowViewController;
+ @Mock private NotificationShadeWindowViewController mNotificationShadeWindowViewController;
@Mock private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
@Mock private NotificationPanelViewController mNotificationPanel;
@Mock private View mAmbientIndicationContainer;
@@ -99,12 +99,12 @@
mBatteryController, mScrimController, () -> mBiometricUnlockController,
mKeyguardViewMediator, () -> mAssistManager, mDozeScrimController,
mKeyguardUpdateMonitor, mVisualStabilityManager, mPulseExpansionHandler,
- mStatusBarWindowController, mNotificationWakeUpCoordinator,
+ mNotificationShadeWindowController, mNotificationWakeUpCoordinator,
mLockscreenLockIconController);
mDozeServiceHost.initialize(mStatusBar, mNotificationIconAreaController,
- mStatusBarKeyguardViewManager, mStatusBarWindowViewController, mNotificationPanel,
- mAmbientIndicationContainer);
+ mStatusBarKeyguardViewManager, mNotificationShadeWindowViewController,
+ mNotificationPanel, mAmbientIndicationContainer);
}
@Test
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhoneTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhoneTest.java
index 7fa6901..50d8bf0b0 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhoneTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhoneTest.java
@@ -57,7 +57,7 @@
private HeadsUpManagerPhone mHeadsUpManager;
@Mock private NotificationGroupManager mGroupManager;
- @Mock private View mStatusBarWindowView;
+ @Mock private View mNotificationShadeWindowView;
@Mock private VisualStabilityManager mVSManager;
@Mock private StatusBar mBar;
@Mock private StatusBarStateController mStatusBarStateController;
@@ -65,13 +65,13 @@
private boolean mLivesPastNormalTime;
private final class TestableHeadsUpManagerPhone extends HeadsUpManagerPhone {
- TestableHeadsUpManagerPhone(Context context, View statusBarWindowView,
+ TestableHeadsUpManagerPhone(Context context, View notificationShadeWindowView,
NotificationGroupManager groupManager, StatusBar bar,
VisualStabilityManager vsManager,
StatusBarStateController statusBarStateController,
KeyguardBypassController keyguardBypassController) {
super(context, statusBarStateController, keyguardBypassController);
- setUp(statusBarWindowView, groupManager, bar, vsManager);
+ setUp(notificationShadeWindowView, groupManager, bar, vsManager);
mMinimumDisplayTime = TEST_MINIMUM_DISPLAY_TIME;
mAutoDismissNotificationDecay = TEST_AUTO_DISMISS_TIME;
}
@@ -89,9 +89,9 @@
.thenReturn(TEST_AUTO_DISMISS_TIME);
when(mVSManager.isReorderingAllowed()).thenReturn(true);
mDependency.injectMockDependency(BubbleController.class);
- mDependency.injectMockDependency(StatusBarWindowController.class);
+ mDependency.injectMockDependency(NotificationShadeWindowController.class);
mDependency.injectMockDependency(ConfigurationController.class);
- mHeadsUpManager = new TestableHeadsUpManagerPhone(mContext, mStatusBarWindowView,
+ mHeadsUpManager = new TestableHeadsUpManagerPhone(mContext, mNotificationShadeWindowView,
mGroupManager, mBar, mVSManager, mStatusBarStateController, mBypassController);
super.setUp();
mHeadsUpManager.mHandler = mTestHandler;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarWindowControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerTest.java
similarity index 80%
rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarWindowControllerTest.java
rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerTest.java
index 147edf6..40d3395 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarWindowControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerTest.java
@@ -11,7 +11,7 @@
* 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
+ * limitations under the License.
*/
package com.android.systemui.statusbar.phone;
@@ -25,7 +25,6 @@
import static org.mockito.Mockito.when;
import android.app.IActivityManager;
-import android.content.res.Resources;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper.RunWithLooper;
import android.view.WindowManager;
@@ -49,11 +48,11 @@
@RunWith(AndroidTestingRunner.class)
@RunWithLooper
@SmallTest
-public class StatusBarWindowControllerTest extends SysuiTestCase {
+public class NotificationShadeWindowControllerTest extends SysuiTestCase {
@Mock private WindowManager mWindowManager;
@Mock private DozeParameters mDozeParameters;
- @Mock private StatusBarWindowView mStatusBarView;
+ @Mock private NotificationShadeWindowView mStatusBarView;
@Mock private IActivityManager mActivityManager;
@Mock private SysuiStatusBarStateController mStatusBarStateController;
@Mock private ConfigurationController mConfigurationController;
@@ -61,28 +60,28 @@
@Mock private SysuiColorExtractor mColorExtractor;
@Mock ColorExtractor.GradientColors mGradientColors;
@Mock private SuperStatusBarViewFactory mSuperStatusBarViewFactory;
- @Mock private Resources mResources;
- private StatusBarWindowController mStatusBarWindowController;
+ private NotificationShadeWindowController mNotificationShadeWindowController;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
when(mDozeParameters.getAlwaysOn()).thenReturn(true);
when(mColorExtractor.getNeutralColors()).thenReturn(mGradientColors);
- when(mSuperStatusBarViewFactory.getStatusBarWindowView()).thenReturn(mStatusBarView);
+ when(mSuperStatusBarViewFactory.getNotificationShadeWindowView())
+ .thenReturn(mStatusBarView);
- mStatusBarWindowController = new StatusBarWindowController(mContext, mWindowManager,
- mActivityManager, mDozeParameters, mStatusBarStateController,
+ mNotificationShadeWindowController = new NotificationShadeWindowController(mContext,
+ mWindowManager, mActivityManager, mDozeParameters, mStatusBarStateController,
mConfigurationController, mKeyguardBypassController, mColorExtractor,
- mSuperStatusBarViewFactory, mResources);
+ mSuperStatusBarViewFactory);
- mStatusBarWindowController.attach();
+ mNotificationShadeWindowController.attach();
}
@Test
public void testSetDozing_hidesSystemOverlays() {
- mStatusBarWindowController.setDozing(true);
+ mNotificationShadeWindowController.setDozing(true);
ArgumentCaptor<WindowManager.LayoutParams> captor =
ArgumentCaptor.forClass(WindowManager.LayoutParams.class);
verify(mWindowManager).updateViewLayout(any(), captor.capture());
@@ -91,7 +90,7 @@
assertThat(flag).isNotEqualTo(0);
reset(mWindowManager);
- mStatusBarWindowController.setDozing(false);
+ mNotificationShadeWindowController.setDozing(false);
verify(mWindowManager).updateViewLayout(any(), captor.capture());
flag = captor.getValue().privateFlags
& WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
@@ -100,7 +99,7 @@
@Test
public void testOnThemeChanged_doesntCrash() {
- mStatusBarWindowController.onThemeChanged();
+ mNotificationShadeWindowController.onThemeChanged();
}
@Test
@@ -110,6 +109,6 @@
@Test
public void testSetForcePluginOpen_beforeStatusBarInitialization() {
- mStatusBarWindowController.setForcePluginOpen(true);
+ mNotificationShadeWindowController.setForcePluginOpen(true);
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarWindowViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationShadeWindowViewTest.java
similarity index 94%
rename from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarWindowViewTest.java
rename to packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationShadeWindowViewTest.java
index f9848f3..9853540 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarWindowViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationShadeWindowViewTest.java
@@ -56,10 +56,10 @@
@RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper(setAsMainLooper = true)
@SmallTest
-public class StatusBarWindowViewTest extends SysuiTestCase {
+public class NotificationShadeWindowViewTest extends SysuiTestCase {
- private StatusBarWindowView mView;
- private StatusBarWindowViewController mController;
+ private NotificationShadeWindowView mView;
+ private NotificationShadeWindowViewController mController;
@Mock private NotificationWakeUpCoordinator mCoordinator;
@Mock private PulseExpansionHandler mPulseExpansionHandler;
@@ -84,15 +84,16 @@
public void setUp() {
MockitoAnnotations.initMocks(this);
- mView = spy(new StatusBarWindowView(getContext(), null));
+ mView = spy(new NotificationShadeWindowView(getContext(), null));
when(mView.findViewById(R.id.notification_stack_scroller))
.thenReturn(mNotificationStackScrollLayout);
+
when(mStatusBarStateController.isDozing()).thenReturn(false);
mDependency.injectTestDependency(ShadeController.class, mShadeController);
when(mDockManager.isDocked()).thenReturn(false);
- mController = new StatusBarWindowViewController(
+ mController = new NotificationShadeWindowViewController(
new InjectionInflationController(
SystemUIFactory.getInstance().getRootComponent()),
mCoordinator,
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java
index 5b5eaad..675a2df 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java
@@ -104,7 +104,7 @@
mock(KeyguardUpdateMonitor.class),
mock(NavigationModeController.class),
mock(DockManager.class),
- mock(StatusBarWindowController.class),
+ mock(NotificationShadeWindowController.class),
mKeyguardStateController,
mock(NotificationMediaManager.class));
mStatusBarKeyguardViewManager.registerStatusBar(mStatusBar, mContainer,
@@ -270,12 +270,12 @@
KeyguardUpdateMonitor keyguardUpdateMonitor,
NavigationModeController navigationModeController,
DockManager dockManager,
- StatusBarWindowController statusBarWindowController,
+ NotificationShadeWindowController notificationShadeWindowController,
KeyguardStateController keyguardStateController,
NotificationMediaManager notificationMediaManager) {
super(context, callback, lockPatternUtils, sysuiStatusBarStateController,
configurationController, keyguardUpdateMonitor, navigationModeController,
- dockManager, statusBarWindowController, keyguardStateController,
+ dockManager, notificationShadeWindowController, keyguardStateController,
notificationMediaManager);
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java
index 782e14c..dd896be 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java
@@ -100,16 +100,17 @@
mDependency.injectMockDependency(NotificationMediaManager.class);
mDependency.injectMockDependency(VisualStabilityManager.class);
mDependency.injectMockDependency(NotificationGutsManager.class);
- mDependency.injectMockDependency(StatusBarWindowController.class);
+ mDependency.injectMockDependency(NotificationShadeWindowController.class);
NotificationEntryManager entryManager =
mDependency.injectMockDependency(NotificationEntryManager.class);
when(entryManager.getActiveNotificationsForCurrentUser()).thenReturn(new ArrayList<>());
- StatusBarWindowView statusBarWindowView = mock(StatusBarWindowView.class);
- when(statusBarWindowView.getResources()).thenReturn(mContext.getResources());
+ NotificationShadeWindowView notificationShadeWindowView =
+ mock(NotificationShadeWindowView.class);
+ when(notificationShadeWindowView.getResources()).thenReturn(mContext.getResources());
mStatusBarNotificationPresenter = new StatusBarNotificationPresenter(mContext,
mock(NotificationPanelViewController.class), mock(HeadsUpManagerPhone.class),
- statusBarWindowView, mock(NotificationListContainerViewGroup.class),
+ notificationShadeWindowView, mock(NotificationListContainerViewGroup.class),
mock(DozeScrimController.class), mock(ScrimController.class),
mock(ActivityLaunchAnimator.class), mock(DynamicPrivacyController.class),
mock(NotificationAlertingManager.class),
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
index fee4852..e90e398 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
@@ -201,7 +201,7 @@
@Mock private NotificationLogger.ExpansionStateLogger mExpansionStateLogger;
@Mock private KeyguardUpdateMonitor mKeyguardUpdateMonitor;
@Mock private AmbientDisplayConfiguration mAmbientDisplayConfiguration;
- @Mock private StatusBarWindowView mStatusBarWindowView;
+ @Mock private NotificationShadeWindowView mNotificationShadeWindowView;
@Mock private BroadcastDispatcher mBroadcastDispatcher;
@Mock private AssistManager mAssistManager;
@Mock private NotificationGutsManager mNotificationGutsManager;
@@ -224,9 +224,9 @@
@Mock private BubbleController mBubbleController;
@Mock private NotificationGroupManager mGroupManager;
@Mock private NotificationGroupAlertTransferHelper mGroupAlertTransferHelper;
- @Mock private StatusBarWindowController mStatusBarWindowController;
+ @Mock private NotificationShadeWindowController mNotificationShadeWindowController;
@Mock private NotificationIconAreaController mNotificationIconAreaController;
- @Mock private StatusBarWindowViewController mStatusBarWindowViewController;
+ @Mock private NotificationShadeWindowViewController mNotificationShadeWindowViewController;
@Mock private DozeParameters mDozeParameters;
@Mock private Lazy<LockscreenWallpaper> mLockscreenWallpaperLazy;
@Mock private LockscreenWallpaper mLockscreenWallpaper;
@@ -324,11 +324,11 @@
when(mStatusBarComponentBuilderProvider.get()).thenReturn(mStatusBarComponentBuilder);
when(mStatusBarComponentBuilder.build()).thenReturn(mStatusBarComponent);
- when(mStatusBarComponent.getStatusBarWindowViewController()).thenReturn(
- mStatusBarWindowViewController);
+ when(mStatusBarComponent.getNotificationShadeWindowViewController()).thenReturn(
+ mNotificationShadeWindowViewController);
mShadeController = new ShadeControllerImpl(mCommandQueue,
- mStatusBarStateController, mStatusBarWindowController,
+ mStatusBarStateController, mNotificationShadeWindowController,
mStatusBarKeyguardViewManager, mContext.getSystemService(WindowManager.class),
() -> mStatusBar, () -> mAssistManager, () -> mBubbleController);
@@ -384,7 +384,7 @@
() -> mAssistManager,
mNotificationListener,
configurationController,
- mStatusBarWindowController,
+ mNotificationShadeWindowController,
mLockscreenLockIconController,
mDozeParameters,
mScrimController,
@@ -417,7 +417,7 @@
mNotificationRowBinder,
mDismissCallbackRegistry);
- when(mStatusBarWindowView.findViewById(R.id.lock_icon_container)).thenReturn(
+ when(mNotificationShadeWindowView.findViewById(R.id.lock_icon_container)).thenReturn(
mLockIconContainer);
when(mKeyguardViewMediator.registerStatusBar(any(StatusBar.class), any(ViewGroup.class),
@@ -430,7 +430,7 @@
// TODO: we should be able to call mStatusBar.start() and have all the below values
// initialized automatically.
- mStatusBar.mStatusBarWindow = mStatusBarWindowView;
+ mStatusBar.mNotificationShadeWindowView = mNotificationShadeWindowView;
mStatusBar.mNotificationPanelViewController = mNotificationPanelViewController;
mStatusBar.mDozeScrimController = mDozeScrimController;
mStatusBar.mNotificationIconAreaController = mNotificationIconAreaController;