diff options
author | Youngjun Kwak <kwaky@google.com> | 2020-09-01 22:20:45 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-09-01 22:20:45 +0000 |
commit | 4ee23daf7da5c5e762a0799434c205b29d0cb032 (patch) | |
tree | d33de571d58a865d72cd34ba05b49b6a509f2a54 /packages/CarSystemUI/src | |
parent | a918ea54ccec2ec743bd7678d13371bdb9961043 (diff) | |
parent | 56c3b76fc4b3f786ac7656646ac8d82e1e8d44f5 (diff) |
Merge "Make SystemUI crash with warning if SystemBarConfigs is incompatible with NotificationPanelViewMediator." into rvc-qpr-dev
Diffstat (limited to 'packages/CarSystemUI/src')
-rw-r--r-- | packages/CarSystemUI/src/com/android/systemui/car/navigationbar/SystemBarConfigs.java | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/packages/CarSystemUI/src/com/android/systemui/car/navigationbar/SystemBarConfigs.java b/packages/CarSystemUI/src/com/android/systemui/car/navigationbar/SystemBarConfigs.java index 3527bf93682f..e7d31949eb24 100644 --- a/packages/CarSystemUI/src/com/android/systemui/car/navigationbar/SystemBarConfigs.java +++ b/packages/CarSystemUI/src/com/android/systemui/car/navigationbar/SystemBarConfigs.java @@ -29,6 +29,8 @@ import android.view.WindowManager; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.R; +import com.android.systemui.car.notification.BottomNotificationPanelViewMediator; +import com.android.systemui.car.notification.TopNotificationPanelViewMediator; import com.android.systemui.dagger.qualifiers.Main; import java.lang.annotation.ElementType; @@ -95,6 +97,7 @@ public class SystemBarConfigs { populateMaps(); readConfigs(); checkEnabledBarsHaveUniqueBarTypes(); + checkSystemBarEnabledForNotificationPanel(); setInsetPaddingsForOverlappingCorners(); sortSystemBarSidesByZOrder(); } @@ -221,6 +224,34 @@ public class SystemBarConfigs { } } + private void checkSystemBarEnabledForNotificationPanel() throws RuntimeException { + + String notificationPanelMediatorName = + mResources.getString(R.string.config_notificationPanelViewMediator); + if (notificationPanelMediatorName == null) { + return; + } + + Class<?> notificationPanelMediatorUsed = null; + try { + notificationPanelMediatorUsed = Class.forName(notificationPanelMediatorName); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + + if (!mTopNavBarEnabled && notificationPanelMediatorUsed.isAssignableFrom( + TopNotificationPanelViewMediator.class)) { + throw new RuntimeException( + "Top System Bar must be enabled to use " + notificationPanelMediatorName); + } + + if (!mBottomNavBarEnabled && notificationPanelMediatorUsed.isAssignableFrom( + BottomNotificationPanelViewMediator.class)) { + throw new RuntimeException("Bottom System Bar must be enabled to use " + + notificationPanelMediatorName); + } + } + private void setInsetPaddingsForOverlappingCorners() { setInsetPaddingForOverlappingCorner(TOP, LEFT); setInsetPaddingForOverlappingCorner(TOP, RIGHT); @@ -277,7 +308,7 @@ public class SystemBarConfigs { } private static boolean isHorizontalBar(@SystemBarSide int side) { - return side == TOP || side == BOTTOM; + return side == TOP || side == BOTTOM; } private static boolean isVerticalBar(@SystemBarSide int side) { |