Merge "Fixed a NP when replying to a message"

This commit is contained in:
Selim Cinek
2018-02-22 19:20:47 +00:00
committed by Android (Google) Code Review
2 changed files with 8 additions and 1 deletions

View File

@@ -461,7 +461,7 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
@Override
protected void onVisibilityChanged(View changedView, int visibility) {
super.onVisibilityChanged(changedView, visibility);
if (changedView == this) {
if (changedView == this && mOnVisibilityChangedListener != null) {
mOnVisibilityChangedListener.accept(visibility == VISIBLE);
}
}

View File

@@ -24,6 +24,7 @@ import android.content.pm.ShortcutManager;
import android.support.test.filters.SmallTest;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageButton;
@@ -88,4 +89,10 @@ public class RemoteInputViewTest extends SysuiTestCase {
assertEquals(RemoteInput.SOURCE_FREE_FORM_INPUT,
RemoteInput.getResultsSource(resultIntent));
}
@Test
public void testNoCrashWithoutVisibilityListener() {
mView.setOnVisibilityChangedListener(null);
mView.onVisibilityChanged(mView, View.VISIBLE);
}
}