diff options
| author | 2022-02-22 16:31:57 +0000 | |
|---|---|---|
| committer | 2022-02-22 16:31:57 +0000 | |
| commit | 2e60d41375d77c306c1bf2766e62ad6bcf315a4d (patch) | |
| tree | 4eae007531b19d930bf66dea92c1129ea1521c6e | |
| parent | 00dcf266fbd802a821dcbeebf6b922166ed89290 (diff) | |
| parent | 199ec5d10148f804db41c182e3d515636657bc68 (diff) | |
Merge "Final icons in dream overlay status bar." into tm-dev
11 files changed, 252 insertions, 199 deletions
diff --git a/packages/SystemUI/res/layout/dream_overlay_container.xml b/packages/SystemUI/res/layout/dream_overlay_container.xml index 330f515a29fc..8e83b4abe0dc 100644 --- a/packages/SystemUI/res/layout/dream_overlay_container.xml +++ b/packages/SystemUI/res/layout/dream_overlay_container.xml @@ -34,34 +34,5 @@ app:layout_constraintBottom_toBottomOf="parent" /> - <com.android.systemui.dreams.DreamOverlayStatusBarView - android:id="@+id/dream_overlay_status_bar" - android:layout_width="match_parent" - android:layout_height="@dimen/dream_overlay_status_bar_height" - android:paddingEnd="@dimen/dream_overlay_status_bar_margin" - android:paddingStart="@dimen/dream_overlay_status_bar_margin" - app:layout_constraintTop_toTopOf="parent"> - - <androidx.constraintlayout.widget.ConstraintLayout - android:id="@+id/dream_overlay_system_status" - android:layout_width="wrap_content" - android:layout_height="match_parent" - app:layout_constraintEnd_toEndOf="parent"> - - <com.android.systemui.statusbar.AlphaOptimizedImageView - android:id="@+id/dream_overlay_wifi_status" - android:layout_width="@dimen/status_bar_wifi_signal_size" - android:layout_height="match_parent" - android:layout_marginEnd="@dimen/dream_overlay_status_icon_margin" - android:visibility="gone" - app:layout_constraintEnd_toStartOf="@id/dream_overlay_battery" /> - - <com.android.systemui.battery.BatteryMeterView - android:id="@+id/dream_overlay_battery" - android:layout_width="wrap_content" - android:layout_height="match_parent" - app:layout_constraintEnd_toEndOf="parent" /> - - </androidx.constraintlayout.widget.ConstraintLayout> - </com.android.systemui.dreams.DreamOverlayStatusBarView> + <include layout="@layout/dream_overlay_status_bar_view" /> </com.android.systemui.dreams.DreamOverlayContainerView>
\ No newline at end of file diff --git a/packages/SystemUI/res/layout/dream_overlay_status_bar_view.xml b/packages/SystemUI/res/layout/dream_overlay_status_bar_view.xml new file mode 100644 index 000000000000..813787e8f9d0 --- /dev/null +++ b/packages/SystemUI/res/layout/dream_overlay_status_bar_view.xml @@ -0,0 +1,96 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2022 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. + --> +<com.android.systemui.dreams.DreamOverlayStatusBarView + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:id="@+id/dream_overlay_status_bar" + android:layout_width="match_parent" + android:layout_height="@dimen/dream_overlay_status_bar_height" + android:paddingEnd="@dimen/dream_overlay_status_bar_margin" + android:paddingStart="@dimen/dream_overlay_status_bar_margin" + app:layout_constraintTop_toTopOf="parent"> + + <com.android.systemui.dreams.DreamOverlayDotImageView + android:id="@+id/dream_overlay_notification_indicator" + android:layout_width="@dimen/dream_overlay_notification_indicator_size" + android:layout_height="@dimen/dream_overlay_notification_indicator_size" + android:visibility="gone" + android:contentDescription="@string/dream_overlay_status_bar_notification_indicator" + app:dotColor="@android:color/white" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toBottomOf="parent" /> + + <LinearLayout + android:id="@+id/dream_overlay_system_status" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:orientation="horizontal" + app:layout_constraintEnd_toEndOf="parent"> + + <com.android.systemui.statusbar.AlphaOptimizedImageView + android:id="@+id/dream_overlay_assistant_guest_mode_enabled" + android:layout_width="@dimen/dream_overlay_status_bar_icon_size" + android:layout_height="match_parent" + android:layout_marginEnd="@dimen/dream_overlay_status_icon_margin" + android:src="@drawable/ic_account_circle" + android:tint="@android:color/white" + android:visibility="gone" + android:contentDescription= + "@string/dream_overlay_status_bar_assistant_guest_mode_enabled" /> + + <com.android.systemui.statusbar.AlphaOptimizedImageView + android:id="@+id/dream_overlay_alarm_set" + android:layout_width="@dimen/dream_overlay_status_bar_icon_size" + android:layout_height="match_parent" + android:layout_marginEnd="@dimen/dream_overlay_status_icon_margin" + android:src="@drawable/ic_alarm" + android:tint="@android:color/white" + android:visibility="gone" + android:contentDescription="@string/dream_overlay_status_bar_alarm_set" /> + + <com.android.systemui.statusbar.AlphaOptimizedImageView + android:id="@+id/dream_overlay_priority_mode" + android:layout_width="@dimen/dream_overlay_status_bar_icon_size" + android:layout_height="match_parent" + android:layout_marginEnd="@dimen/dream_overlay_status_icon_margin" + android:src="@drawable/ic_remove_circle" + android:tint="@android:color/white" + android:visibility="gone" + android:contentDescription="@string/dream_overlay_status_bar_priority_mode" /> + + <com.android.systemui.statusbar.AlphaOptimizedImageView + android:id="@+id/dream_overlay_wifi_status" + android:layout_width="@dimen/dream_overlay_status_bar_icon_size" + android:layout_height="match_parent" + android:layout_marginEnd="@dimen/dream_overlay_status_icon_margin" + android:src="@drawable/ic_signal_wifi_off" + android:visibility="gone" + android:contentDescription="@string/dream_overlay_status_bar_wifi_off" /> + + <com.android.systemui.dreams.DreamOverlayDotImageView + android:id="@+id/dream_overlay_camera_mic_off" + android:layout_width="@dimen/dream_overlay_camera_mic_off_indicator_size" + android:layout_height="@dimen/dream_overlay_camera_mic_off_indicator_size" + android:layout_gravity="center_vertical" + android:layout_marginEnd="@dimen/dream_overlay_status_icon_margin" + android:visibility="gone" + android:contentDescription="@string/dream_overlay_status_bar_camera_mic_off" + app:dotColor="@color/dream_overlay_camera_mic_off_dot_color" /> + + </LinearLayout> +</com.android.systemui.dreams.DreamOverlayStatusBarView> diff --git a/packages/SystemUI/res/values/attrs.xml b/packages/SystemUI/res/values/attrs.xml index 2992859b1ce7..c5e005c556b2 100644 --- a/packages/SystemUI/res/values/attrs.xml +++ b/packages/SystemUI/res/values/attrs.xml @@ -199,5 +199,9 @@ </declare-styleable> <attr name="overlayButtonTextColor" format="color" /> + + <declare-styleable name="DreamOverlayDotImageView"> + <attr name="dotColor" format="color" /> + </declare-styleable> </resources> diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml index f4e7cf3fcf40..dc7470081da2 100644 --- a/packages/SystemUI/res/values/colors.xml +++ b/packages/SystemUI/res/values/colors.xml @@ -225,4 +225,6 @@ <color name="settingslib_track_off_color">@color/settingslib_track_off</color> <color name="connected_network_primary_color">#191C18</color> <color name="connected_network_secondary_color">#41493D</color> + + <color name="dream_overlay_camera_mic_off_dot_color">#FCBE03</color> </resources> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 370413400766..fcf60bf43c62 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -1332,12 +1332,16 @@ <dimen name="fgs_manager_min_width_minor">100%</dimen> <!-- Dream overlay related dimensions --> - <dimen name="dream_overlay_status_bar_height">80dp</dimen> + <dimen name="dream_overlay_status_bar_height">60dp</dimen> <dimen name="dream_overlay_status_bar_margin">40dp</dimen> <dimen name="dream_overlay_status_icon_margin">8dp</dimen> + <dimen name="dream_overlay_status_bar_icon_size"> + @*android:dimen/status_bar_system_icon_size</dimen> <!-- Height of the area at the top of the dream overlay to allow dragging down the notifications shade. --> <dimen name="dream_overlay_notifications_drag_area_height">100dp</dimen> + <dimen name="dream_overlay_camera_mic_off_indicator_size">8dp</dimen> + <dimen name="dream_overlay_notification_indicator_size">6dp</dimen> <!-- Dream overlay complications related dimensions --> <dimen name="dream_overlay_complication_clock_time_text_size">72sp</dimen> diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 23b252906056..df16b0d45228 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -2410,4 +2410,17 @@ <!-- Toast shown when a notification does not support dragging to split [CHAR LIMIT=NONE] --> <string name="drag_split_not_supported">This notification does not support dragging to Splitscreen.</string> + + <!-- Content description for the Wi-Fi off icon in the dream overlay status bar [CHAR LIMIT=NONE] --> + <string name="dream_overlay_status_bar_wifi_off">Wi\u2011Fi unavailable</string> + <!-- Content description for the priority mode icon in the dream overlay status bar [CHAR LIMIT=NONE] --> + <string name="dream_overlay_status_bar_priority_mode">Priority mode</string> + <!-- Content description for the alarm set icon in the dream overlay status bar [CHAR LIMIT=NONE] --> + <string name="dream_overlay_status_bar_alarm_set">Alarm set</string> + <!-- Content description for the assistant guest mode enabled icon in the dream overlay status bar [CHAR LIMIT=NONE] --> + <string name="dream_overlay_status_bar_assistant_guest_mode_enabled">Assistant guest mode enabled</string> + <!-- Content description for the camera and mic off icon in the dream overlay status bar [CHAR LIMIT=NONE] --> + <string name="dream_overlay_status_bar_camera_mic_off">Camera and mic are off</string> + <!-- Content description for the camera and mic off icon in the dream overlay status bar [CHAR LIMIT=NONE] --> + <string name="dream_overlay_status_bar_notification_indicator">There are notifications</string> </resources> diff --git a/packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayDotImageView.java b/packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayDotImageView.java new file mode 100644 index 000000000000..02a8b39a106a --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayDotImageView.java @@ -0,0 +1,128 @@ +/* + * Copyright (C) 2022 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.dreams; + +import android.annotation.ColorInt; +import android.content.Context; +import android.content.res.TypedArray; +import android.graphics.Bitmap; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.ColorFilter; +import android.graphics.Paint; +import android.graphics.Rect; +import android.graphics.drawable.Drawable; +import android.util.AttributeSet; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import com.android.systemui.R; +import com.android.systemui.statusbar.AlphaOptimizedImageView; + +/** + * An {@link AlphaOptimizedImageView} that is responsible for rendering a dot. Used by + * {@link DreamOverlayStatusBarView}. + */ +public class DreamOverlayDotImageView extends AlphaOptimizedImageView { + private final @ColorInt int mDotColor; + + public DreamOverlayDotImageView(Context context) { + this(context, null); + } + + public DreamOverlayDotImageView(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + + public DreamOverlayDotImageView(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public DreamOverlayDotImageView(Context context, AttributeSet attrs, int defStyleAttr, + int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + TypedArray a = context.getTheme().obtainStyledAttributes(attrs, + R.styleable.DreamOverlayDotImageView, 0, 0); + + try { + mDotColor = a.getColor(R.styleable.DreamOverlayDotImageView_dotColor, Color.WHITE); + } finally { + a.recycle(); + } + } + + @Override + protected void onFinishInflate() { + super.onFinishInflate(); + setImageDrawable(new DotDrawable(mDotColor)); + } + + private static class DotDrawable extends Drawable { + private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private Bitmap mDotBitmap; + private final Rect mBounds = new Rect(); + private final @ColorInt int mDotColor; + + DotDrawable(@ColorInt int color) { + mDotColor = color; + } + + @Override + public void draw(@NonNull Canvas canvas) { + if (mBounds.isEmpty()) { + return; + } + + if (mDotBitmap == null) { + mDotBitmap = createBitmap(mBounds.width(), mBounds.height()); + } + + canvas.drawBitmap(mDotBitmap, null, mBounds, mPaint); + } + + @Override + protected void onBoundsChange(Rect bounds) { + super.onBoundsChange(bounds); + mBounds.set(bounds.left, bounds.top, bounds.right, bounds.bottom); + // Make sure to regenerate the dot bitmap when the bounds change. + mDotBitmap = null; + } + + @Override + public void setAlpha(int alpha) { + } + + @Override + public void setColorFilter(@Nullable ColorFilter colorFilter) { + } + + @Override + public int getOpacity() { + return 0; + } + + private Bitmap createBitmap(int width, int height) { + Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); + Canvas canvas = new Canvas(bitmap); + Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); + paint.setColor(mDotColor); + canvas.drawCircle(width / 2.f, height / 2.f, Math.min(width, height) / 2.f, paint); + return bitmap; + } + } +} diff --git a/packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayStatusBarView.java b/packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayStatusBarView.java index 9847ef633bc1..2d969206b468 100644 --- a/packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayStatusBarView.java +++ b/packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayStatusBarView.java @@ -25,17 +25,13 @@ import androidx.constraintlayout.widget.ConstraintLayout; import com.android.internal.util.Preconditions; import com.android.systemui.R; -import com.android.systemui.battery.BatteryMeterView; -import com.android.systemui.statusbar.policy.BatteryController.BatteryStateChangeCallback; /** * {@link DreamOverlayStatusBarView} is the view responsible for displaying the status bar in a - * dream. The status bar includes status icons such as battery and wifi. + * dream. The status bar displays conditional status icons such as "priority mode" and "no wifi". */ -public class DreamOverlayStatusBarView extends ConstraintLayout implements - BatteryStateChangeCallback { +public class DreamOverlayStatusBarView extends ConstraintLayout { - private BatteryMeterView mBatteryView; private ImageView mWifiStatusView; public DreamOverlayStatusBarView(Context context) { @@ -59,20 +55,8 @@ public class DreamOverlayStatusBarView extends ConstraintLayout implements protected void onFinishInflate() { super.onFinishInflate(); - mBatteryView = Preconditions.checkNotNull(findViewById(R.id.dream_overlay_battery), - "R.id.dream_overlay_battery must not be null"); mWifiStatusView = Preconditions.checkNotNull(findViewById(R.id.dream_overlay_wifi_status), "R.id.dream_overlay_wifi_status must not be null"); - - mWifiStatusView.setImageDrawable(getContext().getDrawable(R.drawable.ic_signal_wifi_off)); - } - - /** - * Whether to show the battery percent text next to the battery status icons. - * @param show True if the battery percent text should be shown. - */ - void showBatteryPercentText(boolean show) { - mBatteryView.setForceShowPercent(show); } /** diff --git a/packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayStatusBarViewController.java b/packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayStatusBarViewController.java index 5674b9f3f9fd..ed82ab0e308f 100644 --- a/packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayStatusBarViewController.java +++ b/packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayStatusBarViewController.java @@ -17,24 +17,19 @@ package com.android.systemui.dreams; import android.annotation.IntDef; -import android.content.Context; import android.net.ConnectivityManager; import android.net.ConnectivityManager.NetworkCallback; import android.net.Network; import android.net.NetworkCapabilities; import android.net.NetworkRequest; -import com.android.systemui.battery.BatteryMeterViewController; import com.android.systemui.dreams.dagger.DreamOverlayComponent; -import com.android.systemui.dreams.dagger.DreamOverlayModule; -import com.android.systemui.statusbar.policy.BatteryController; import com.android.systemui.util.ViewController; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import javax.inject.Inject; -import javax.inject.Named; /** * View controller for {@link DreamOverlayStatusBarView}. @@ -52,21 +47,7 @@ public class DreamOverlayStatusBarViewController extends ViewController<DreamOve private static final int WIFI_STATUS_UNAVAILABLE = 1; private static final int WIFI_STATUS_AVAILABLE = 2; - @Retention(RetentionPolicy.SOURCE) - @IntDef(prefix = { "BATTERY_STATUS_" }, value = { - BATTERY_STATUS_UNKNOWN, - BATTERY_STATUS_NOT_CHARGING, - BATTERY_STATUS_CHARGING - }) - private @interface BatteryStatus {} - private static final int BATTERY_STATUS_UNKNOWN = 0; - private static final int BATTERY_STATUS_NOT_CHARGING = 1; - private static final int BATTERY_STATUS_CHARGING = 2; - - private final BatteryController mBatteryController; - private final BatteryMeterViewController mBatteryMeterViewController; private final ConnectivityManager mConnectivityManager; - private final boolean mShowPercentAvailable; private final NetworkRequest mNetworkRequest = new NetworkRequest.Builder() .clearCapabilities() @@ -91,43 +72,18 @@ public class DreamOverlayStatusBarViewController extends ViewController<DreamOve } }; - private final BatteryController.BatteryStateChangeCallback mBatteryStateChangeCallback = - new BatteryController.BatteryStateChangeCallback() { - @Override - public void onBatteryLevelChanged(int level, boolean pluggedIn, boolean charging) { - DreamOverlayStatusBarViewController.this.onBatteryLevelChanged(charging); - } - }; - private @WifiStatus int mWifiStatus = WIFI_STATUS_UNKNOWN; - private @BatteryStatus int mBatteryStatus = BATTERY_STATUS_UNKNOWN; @Inject public DreamOverlayStatusBarViewController( - Context context, DreamOverlayStatusBarView view, - BatteryController batteryController, - @Named(DreamOverlayModule.DREAM_OVERLAY_BATTERY_CONTROLLER) - BatteryMeterViewController batteryMeterViewController, ConnectivityManager connectivityManager) { super(view); - mBatteryController = batteryController; - mBatteryMeterViewController = batteryMeterViewController; mConnectivityManager = connectivityManager; - - mShowPercentAvailable = context.getResources().getBoolean( - com.android.internal.R.bool.config_battery_percentage_setting_available); - } - - @Override - protected void onInit() { - super.onInit(); - mBatteryMeterViewController.init(); } @Override protected void onViewAttached() { - mBatteryController.addCallback(mBatteryStateChangeCallback); mConnectivityManager.registerNetworkCallback(mNetworkRequest, mNetworkCallback); NetworkCapabilities capabilities = @@ -140,7 +96,6 @@ public class DreamOverlayStatusBarViewController extends ViewController<DreamOve @Override protected void onViewDetached() { - mBatteryController.removeCallback(mBatteryStateChangeCallback); mConnectivityManager.unregisterNetworkCallback(mNetworkCallback); } @@ -155,18 +110,4 @@ public class DreamOverlayStatusBarViewController extends ViewController<DreamOve mView.showWifiStatus(mWifiStatus == WIFI_STATUS_UNAVAILABLE); } } - - /** - * The battery level has changed. Update the battery status icon as appropriate. - * @param charging Whether the battery is currently charging. - */ - private void onBatteryLevelChanged(boolean charging) { - final int newBatteryStatus = - charging ? BATTERY_STATUS_CHARGING : BATTERY_STATUS_NOT_CHARGING; - if (mBatteryStatus != newBatteryStatus) { - mBatteryStatus = newBatteryStatus; - mView.showBatteryPercentText( - mBatteryStatus == BATTERY_STATUS_CHARGING && mShowPercentAvailable); - } - } } diff --git a/packages/SystemUI/src/com/android/systemui/dreams/dagger/DreamOverlayModule.java b/packages/SystemUI/src/com/android/systemui/dreams/dagger/DreamOverlayModule.java index 4eb5cb97607a..839a05e6e78f 100644 --- a/packages/SystemUI/src/com/android/systemui/dreams/dagger/DreamOverlayModule.java +++ b/packages/SystemUI/src/com/android/systemui/dreams/dagger/DreamOverlayModule.java @@ -16,9 +16,7 @@ package com.android.systemui.dreams.dagger; -import android.content.ContentResolver; import android.content.res.Resources; -import android.os.Handler; import android.view.LayoutInflater; import android.view.ViewGroup; @@ -28,15 +26,9 @@ import androidx.lifecycle.LifecycleRegistry; import com.android.internal.util.Preconditions; import com.android.systemui.R; -import com.android.systemui.battery.BatteryMeterView; -import com.android.systemui.battery.BatteryMeterViewController; -import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.dreams.DreamOverlayContainerView; import com.android.systemui.dreams.DreamOverlayStatusBarView; -import com.android.systemui.statusbar.policy.BatteryController; -import com.android.systemui.statusbar.policy.ConfigurationController; -import com.android.systemui.tuner.TunerService; import javax.inject.Named; @@ -47,9 +39,6 @@ import dagger.Provides; /** Dagger module for {@link DreamOverlayComponent}. */ @Module public abstract class DreamOverlayModule { - private static final String DREAM_OVERLAY_BATTERY_VIEW = "dream_overlay_battery_view"; - public static final String DREAM_OVERLAY_BATTERY_CONTROLLER = - "dream_overlay_battery_controller"; public static final String DREAM_OVERLAY_CONTENT_VIEW = "dream_overlay_content_view"; public static final String MAX_BURN_IN_OFFSET = "max_burn_in_offset"; public static final String BURN_IN_PROTECTION_UPDATE_INTERVAL = @@ -86,37 +75,6 @@ public abstract class DreamOverlayModule { /** */ @Provides @DreamOverlayComponent.DreamOverlayScope - @Named(DREAM_OVERLAY_BATTERY_VIEW) - static BatteryMeterView providesBatteryMeterView(DreamOverlayContainerView view) { - return Preconditions.checkNotNull(view.findViewById(R.id.dream_overlay_battery), - "R.id.battery must not be null"); - } - - /** */ - @Provides - @DreamOverlayComponent.DreamOverlayScope - @Named(DREAM_OVERLAY_BATTERY_CONTROLLER) - static BatteryMeterViewController providesBatteryMeterViewController( - @Named(DREAM_OVERLAY_BATTERY_VIEW) BatteryMeterView batteryMeterView, - ConfigurationController configurationController, - TunerService tunerService, - BroadcastDispatcher broadcastDispatcher, - @Main Handler mainHandler, - ContentResolver contentResolver, - BatteryController batteryController) { - return new BatteryMeterViewController( - batteryMeterView, - configurationController, - tunerService, - broadcastDispatcher, - mainHandler, - contentResolver, - batteryController); - } - - /** */ - @Provides - @DreamOverlayComponent.DreamOverlayScope @Named(MAX_BURN_IN_OFFSET) static int providesMaxBurnInOffset(@Main Resources resources) { return resources.getDimensionPixelSize(R.dimen.default_burn_in_prevention_offset); diff --git a/packages/SystemUI/tests/src/com/android/systemui/dreams/DreamOverlayStatusBarViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/dreams/DreamOverlayStatusBarViewControllerTest.java index 7f72dda441d2..658702929d7b 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/dreams/DreamOverlayStatusBarViewControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/dreams/DreamOverlayStatusBarViewControllerTest.java @@ -29,8 +29,6 @@ import android.testing.AndroidTestingRunner; import androidx.test.filters.SmallTest; import com.android.systemui.SysuiTestCase; -import com.android.systemui.battery.BatteryMeterViewController; -import com.android.systemui.statusbar.policy.BatteryController; import org.junit.Before; import org.junit.Test; @@ -46,10 +44,6 @@ public class DreamOverlayStatusBarViewControllerTest extends SysuiTestCase { @Mock DreamOverlayStatusBarView mView; @Mock - BatteryController mBatteryController; - @Mock - BatteryMeterViewController mBatteryMeterViewController; - @Mock ConnectivityManager mConnectivityManager; @Mock NetworkCapabilities mNetworkCapabilities; @@ -61,22 +55,7 @@ public class DreamOverlayStatusBarViewControllerTest extends SysuiTestCase { @Before public void setup() { MockitoAnnotations.initMocks(this); - mController = new DreamOverlayStatusBarViewController( - mContext, mView, mBatteryController, mBatteryMeterViewController, - mConnectivityManager); - } - - @Test - public void testOnInitInitializesControllers() { - mController.onInit(); - verify(mBatteryMeterViewController).init(); - } - - @Test - public void testOnViewAttachedAddsBatteryControllerCallback() { - mController.onViewAttached(); - verify(mBatteryController) - .addCallback(any(BatteryController.BatteryStateChangeCallback.class)); + mController = new DreamOverlayStatusBarViewController(mView, mConnectivityManager); } @Test @@ -113,13 +92,6 @@ public class DreamOverlayStatusBarViewControllerTest extends SysuiTestCase { } @Test - public void testOnViewDetachedRemovesBatteryControllerCallback() { - mController.onViewDetached(); - verify(mBatteryController) - .removeCallback(any(BatteryController.BatteryStateChangeCallback.class)); - } - - @Test public void testOnViewDetachedUnregistersNetworkCallback() { mController.onViewDetached(); verify(mConnectivityManager) @@ -127,26 +99,6 @@ public class DreamOverlayStatusBarViewControllerTest extends SysuiTestCase { } @Test - public void testBatteryPercentTextShownWhenBatteryLevelChangesWhileCharging() { - final ArgumentCaptor<BatteryController.BatteryStateChangeCallback> callbackCapture = - ArgumentCaptor.forClass(BatteryController.BatteryStateChangeCallback.class); - mController.onViewAttached(); - verify(mBatteryController).addCallback(callbackCapture.capture()); - callbackCapture.getValue().onBatteryLevelChanged(1, true, true); - verify(mView).showBatteryPercentText(true); - } - - @Test - public void testBatteryPercentTextHiddenWhenBatteryLevelChangesWhileNotCharging() { - final ArgumentCaptor<BatteryController.BatteryStateChangeCallback> callbackCapture = - ArgumentCaptor.forClass(BatteryController.BatteryStateChangeCallback.class); - mController.onViewAttached(); - verify(mBatteryController).addCallback(callbackCapture.capture()); - callbackCapture.getValue().onBatteryLevelChanged(1, true, false); - verify(mView).showBatteryPercentText(false); - } - - @Test public void testWifiStatusHiddenWhenWifiBecomesAvailable() { // Make sure wifi starts out unavailable when onViewAttached is called. when(mNetworkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)) |