OSDN Git Service

Add Nullable annotation to getDecorView
authorSiarhei Vishniakou <svv@google.com>
Thu, 7 Mar 2019 19:10:00 +0000 (11:10 -0800)
committerSiarhei Vishniakou <svv@google.com>
Thu, 7 Mar 2019 19:19:43 +0000 (11:19 -0800)
Since getDecorView may return null when dialog's window is no longer
present, annotate it as @Nullable.

Bug: 124327419
Test: none
Change-Id: I0d49b75b14f54cd8ba8304c900f6c8625f889aa8

core/java/android/preference/DialogPreference.java

index a615f2d..0fb7e38 100644 (file)
@@ -19,6 +19,7 @@ package android.preference;
 
 import android.annotation.CallSuper;
 import android.annotation.DrawableRes;
+import android.annotation.Nullable;
 import android.annotation.StringRes;
 import android.annotation.UnsupportedAppUsage;
 import android.app.AlertDialog;
@@ -347,6 +348,7 @@ public abstract class DialogPreference extends Preference implements
      * @return the DecorView for the current dialog window, if it exists.
      * If the window does not exist, null is returned.
      */
+    @Nullable
     private View getDecorView() {
         if (mDialog != null && mDialog.getWindow() != null) {
             return mDialog.getWindow().getDecorView();