diff options
author | Heemin Seog <hseog@google.com> | 2020-06-11 17:16:31 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-06-11 17:16:31 +0000 |
commit | 4d5104df84df6c204c405003590b6e5e0c392d58 (patch) | |
tree | 2240e90d86b1ca86d631ab3ecea1594fb7cc78b8 /packages/CarSystemUI/src | |
parent | 57c56e91d82329611eb0d38c0a8cac224575a4e9 (diff) | |
parent | 8808b5a3d3a5deeff7ddf066c59ecb96e817a71a (diff) |
Merge "Dismiss panel when requested to close system dialogs" into rvc-dev am: 8808b5a3d3
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11827743
Change-Id: Icf83ebdc3a5551503a97b9bb1198ede5df3127d9
Diffstat (limited to 'packages/CarSystemUI/src')
3 files changed, 35 insertions, 0 deletions
diff --git a/packages/CarSystemUI/src/com/android/systemui/car/notification/BottomNotificationPanelViewMediator.java b/packages/CarSystemUI/src/com/android/systemui/car/notification/BottomNotificationPanelViewMediator.java index 6d140cae5442..7d353f5acd9a 100644 --- a/packages/CarSystemUI/src/com/android/systemui/car/notification/BottomNotificationPanelViewMediator.java +++ b/packages/CarSystemUI/src/com/android/systemui/car/notification/BottomNotificationPanelViewMediator.java @@ -16,6 +16,7 @@ package com.android.systemui.car.notification; +import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.car.CarDeviceProvisionedController; import com.android.systemui.car.navigationbar.CarNavigationBarController; import com.android.systemui.car.window.OverlayPanelViewController; @@ -37,6 +38,7 @@ public class BottomNotificationPanelViewMediator extends NotificationPanelViewMe NotificationPanelViewController notificationPanelViewController, PowerManagerHelper powerManagerHelper, + BroadcastDispatcher broadcastDispatcher, CarDeviceProvisionedController carDeviceProvisionedController, ConfigurationController configurationController @@ -44,6 +46,7 @@ public class BottomNotificationPanelViewMediator extends NotificationPanelViewMe super(carNavigationBarController, notificationPanelViewController, powerManagerHelper, + broadcastDispatcher, carDeviceProvisionedController, configurationController); notificationPanelViewController.setOverlayDirection( diff --git a/packages/CarSystemUI/src/com/android/systemui/car/notification/NotificationPanelViewMediator.java b/packages/CarSystemUI/src/com/android/systemui/car/notification/NotificationPanelViewMediator.java index 41349b284147..0c185bae8199 100644 --- a/packages/CarSystemUI/src/com/android/systemui/car/notification/NotificationPanelViewMediator.java +++ b/packages/CarSystemUI/src/com/android/systemui/car/notification/NotificationPanelViewMediator.java @@ -17,10 +17,17 @@ package com.android.systemui.car.notification; import android.car.hardware.power.CarPowerManager; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; import android.content.res.Configuration; +import android.os.UserHandle; +import android.util.Log; import androidx.annotation.CallSuper; +import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.car.CarDeviceProvisionedController; import com.android.systemui.car.navigationbar.CarNavigationBarController; import com.android.systemui.car.window.OverlayViewMediator; @@ -37,18 +44,36 @@ import javax.inject.Singleton; public class NotificationPanelViewMediator implements OverlayViewMediator, ConfigurationController.ConfigurationListener { + private static final boolean DEBUG = false; + private static final String TAG = "NotificationPanelVM"; + private final CarNavigationBarController mCarNavigationBarController; private final NotificationPanelViewController mNotificationPanelViewController; private final PowerManagerHelper mPowerManagerHelper; + private final BroadcastDispatcher mBroadcastDispatcher; private final CarDeviceProvisionedController mCarDeviceProvisionedController; private final ConfigurationController mConfigurationController; + private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + if (DEBUG) Log.v(TAG, "onReceive: " + intent); + String action = intent.getAction(); + if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(action)) { + if (mNotificationPanelViewController.isPanelExpanded()) { + mNotificationPanelViewController.toggle(); + } + } + } + }; + @Inject public NotificationPanelViewMediator( CarNavigationBarController carNavigationBarController, NotificationPanelViewController notificationPanelViewController, PowerManagerHelper powerManagerHelper, + BroadcastDispatcher broadcastDispatcher, CarDeviceProvisionedController carDeviceProvisionedController, ConfigurationController configurationController @@ -56,6 +81,7 @@ public class NotificationPanelViewMediator implements OverlayViewMediator, mCarNavigationBarController = carNavigationBarController; mNotificationPanelViewController = notificationPanelViewController; mPowerManagerHelper = powerManagerHelper; + mBroadcastDispatcher = broadcastDispatcher; mCarDeviceProvisionedController = carDeviceProvisionedController; mConfigurationController = configurationController; } @@ -84,6 +110,9 @@ public class NotificationPanelViewMediator implements OverlayViewMediator, return mNotificationPanelViewController.isPanelExpanded(); } }); + + mBroadcastDispatcher.registerReceiver(mBroadcastReceiver, + new IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS), null, UserHandle.ALL); } @Override diff --git a/packages/CarSystemUI/src/com/android/systemui/car/notification/TopNotificationPanelViewMediator.java b/packages/CarSystemUI/src/com/android/systemui/car/notification/TopNotificationPanelViewMediator.java index 8d3eb4c2bbee..89c9931ac76e 100644 --- a/packages/CarSystemUI/src/com/android/systemui/car/notification/TopNotificationPanelViewMediator.java +++ b/packages/CarSystemUI/src/com/android/systemui/car/notification/TopNotificationPanelViewMediator.java @@ -16,6 +16,7 @@ package com.android.systemui.car.notification; +import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.car.CarDeviceProvisionedController; import com.android.systemui.car.navigationbar.CarNavigationBarController; import com.android.systemui.car.window.OverlayPanelViewController; @@ -37,6 +38,7 @@ public class TopNotificationPanelViewMediator extends NotificationPanelViewMedia NotificationPanelViewController notificationPanelViewController, PowerManagerHelper powerManagerHelper, + BroadcastDispatcher broadcastDispatcher, CarDeviceProvisionedController carDeviceProvisionedController, ConfigurationController configurationController @@ -44,6 +46,7 @@ public class TopNotificationPanelViewMediator extends NotificationPanelViewMedia super(carNavigationBarController, notificationPanelViewController, powerManagerHelper, + broadcastDispatcher, carDeviceProvisionedController, configurationController); notificationPanelViewController.setOverlayDirection( |