summaryrefslogtreecommitdiff
path: root/packages/CarSystemUI/src
diff options
context:
space:
mode:
authorHeemin Seog <hseog@google.com>2020-06-11 16:42:53 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-06-11 16:42:53 +0000
commit8808b5a3d3a5deeff7ddf066c59ecb96e817a71a (patch)
treeef7a231f97ec1836a3a9605eef4b46d02a2f7222 /packages/CarSystemUI/src
parent934df6246716351a0726ad1ebd9f9dcdd7886bfe (diff)
parentc0379bee83f575a2f786ee49e414246de1541c85 (diff)
Merge "Dismiss panel when requested to close system dialogs" into rvc-dev
Diffstat (limited to 'packages/CarSystemUI/src')
-rw-r--r--packages/CarSystemUI/src/com/android/systemui/car/notification/BottomNotificationPanelViewMediator.java3
-rw-r--r--packages/CarSystemUI/src/com/android/systemui/car/notification/NotificationPanelViewMediator.java29
-rw-r--r--packages/CarSystemUI/src/com/android/systemui/car/notification/TopNotificationPanelViewMediator.java3
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(