Allow keyguard_message_area_container to be null
In certain applications, the keyguard_message_area_container view may not be present around a KeyguardMessageArea instance. Allowing the container to be nullable and adding the appropriate null checks will prevent exceptions under these circumstances. Bug: 213476245 Test: manual Change-Id: I65a4b6577c7b420ce6a55ae1d459989855c2e7a0
This commit is contained in:
@@ -30,6 +30,8 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.internal.policy.SystemBarUtils;
|
||||
import com.android.settingslib.Utils;
|
||||
import com.android.systemui.R;
|
||||
@@ -57,6 +59,11 @@ public class KeyguardMessageArea extends TextView implements SecurityMessageDisp
|
||||
private ColorStateList mNextMessageColorState = ColorStateList.valueOf(DEFAULT_COLOR);
|
||||
private boolean mBouncerVisible;
|
||||
private boolean mAltBouncerShowing;
|
||||
/**
|
||||
* Container that wraps the KeyguardMessageArea - may be null if current view hierarchy doesn't
|
||||
* contain {@link R.id.keyguard_message_area_container}.
|
||||
*/
|
||||
@Nullable
|
||||
private ViewGroup mContainer;
|
||||
private int mTopMargin;
|
||||
|
||||
@@ -75,6 +82,9 @@ public class KeyguardMessageArea extends TextView implements SecurityMessageDisp
|
||||
}
|
||||
|
||||
void onConfigChanged() {
|
||||
if (mContainer == null) {
|
||||
return;
|
||||
}
|
||||
final int newTopMargin = SystemBarUtils.getStatusBarHeight(getContext());
|
||||
if (mTopMargin == newTopMargin) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user