Update Hvac to remove the self register or ui components with their controller

They were being removed from the status bar when the device was un-provisioned
due to a false state change. There was also an issue where the background
tried to animate before it was on screen causing an exception

Bug:110105682
Test: run on bench or test hardware of the outside kind
Change-Id: I1a3815bf7f08b321f92919a2fb6e20c7d859f95e
This commit is contained in:
Brad Stenning
2018-08-08 13:34:21 -07:00
parent deee39507f
commit f084d88992
5 changed files with 31 additions and 24 deletions

View File

@@ -23,8 +23,6 @@ import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import com.android.systemui.statusbar.car.hvac.TemperatureView;
import com.android.systemui.statusbar.car.hvac.HvacController;
import android.util.AttributeSet;
import android.util.Property;
import android.view.Gravity;
@@ -36,8 +34,8 @@ import android.widget.ImageView;
import android.widget.TextSwitcher;
import android.widget.TextView;
import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.statusbar.car.hvac.TemperatureView;
/**
* Simple text display of HVAC properties, It is designed to show mTemperature and is configured in
@@ -47,8 +45,6 @@ import com.android.systemui.R;
* hvacAreaId - Example: VehicleSeat.SEAT_ROW_1_LEFT (1)
* hvacTempFormat - Example: "%.1f\u00B0" (1 decimal and the degree symbol)
* hvacOrientaion = Example: left
* <p>
* Note: It registers itself with {@link HvacController}
*/
public class AnimatedTemperatureView extends FrameLayout implements TemperatureView {
@@ -158,12 +154,9 @@ public class AnimatedTemperatureView extends FrameLayout implements TemperatureV
ViewGroup.LayoutParams.MATCH_PARENT);
typedArray.recycle();
// register with controller
HvacController hvacController = Dependency.get(HvacController.class);
hvacController.addHvacTextView(this);
}
private TextView generateTextView() {
TextView textView = new TextView(getContext());
textView.setTextAppearance(mTextAppearanceRes);

View File

@@ -131,7 +131,9 @@ class TemperatureBackgroundAnimator {
}
void animateOpen() {
if (!mAnimationsReady || mCircleState == CircleState.ENTERING) {
if (!mAnimationsReady
|| !mAnimatedView.isAttachedToWindow()
|| mCircleState == CircleState.ENTERING) {
return;
}