leanback: make it friendly to deal with non AppCompat guided step

Add a ViewInflater to load a different View class in AppCompat theme,
so we won't get a warning logcat when using AppCompatEditText in none
AppCompat theme.

This is at the cost of slightly larger library size.

The GuidedActionEditText is changed back to EditText as parent.

Updated generatedv4.py and regenerated all source files.  Fixed
many NonNull/Nullable lint errors since the previous edit didn't run the
python script to auto generate code.  Updated different signature of
onCreateView and onSaveInstanceState for support library vs framework.

Test: added GuidedStepAppCompatActivity to support-leanback-demo app
Change-Id: Ic59e6144e3a5d1473fca1d34c90b7a6cfed76f2b
diff --git a/leanback/leanback/api/current.txt b/leanback/leanback/api/current.txt
index 6712e06..a9e0b33 100644
--- a/leanback/leanback/api/current.txt
+++ b/leanback/leanback/api/current.txt
@@ -46,27 +46,27 @@
 
   @Deprecated public class BrandedFragment extends android.app.Fragment {
     ctor @Deprecated public BrandedFragment();
-    method @Deprecated public android.graphics.drawable.Drawable! getBadgeDrawable();
+    method @Deprecated public android.graphics.drawable.Drawable? getBadgeDrawable();
     method @Deprecated public int getSearchAffordanceColor();
-    method @Deprecated public androidx.leanback.widget.SearchOrbView.Colors! getSearchAffordanceColors();
-    method @Deprecated public CharSequence! getTitle();
-    method @Deprecated public android.view.View! getTitleView();
-    method @Deprecated public androidx.leanback.widget.TitleViewAdapter! getTitleViewAdapter();
-    method @Deprecated public void installTitleView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+    method @Deprecated public androidx.leanback.widget.SearchOrbView.Colors? getSearchAffordanceColors();
+    method @Deprecated public CharSequence? getTitle();
+    method @Deprecated public android.view.View? getTitleView();
+    method @Deprecated public androidx.leanback.widget.TitleViewAdapter? getTitleViewAdapter();
+    method @Deprecated public void installTitleView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle?);
     method @Deprecated public final boolean isShowingTitle();
     method @Deprecated public void onDestroyView();
-    method @Deprecated public android.view.View! onInflateTitleView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+    method @Deprecated public android.view.View onInflateTitleView(android.view.LayoutInflater, android.view.ViewGroup?, android.os.Bundle?);
     method @Deprecated public void onPause();
     method @Deprecated public void onResume();
     method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
     method @Deprecated public void onStart();
     method @Deprecated public void onViewCreated(android.view.View, android.os.Bundle?);
-    method @Deprecated public void setBadgeDrawable(android.graphics.drawable.Drawable!);
-    method @Deprecated public void setOnSearchClickedListener(android.view.View.OnClickListener!);
+    method @Deprecated public void setBadgeDrawable(android.graphics.drawable.Drawable?);
+    method @Deprecated public void setOnSearchClickedListener(android.view.View.OnClickListener?);
     method @Deprecated public void setSearchAffordanceColor(int);
-    method @Deprecated public void setSearchAffordanceColors(androidx.leanback.widget.SearchOrbView.Colors!);
-    method @Deprecated public void setTitle(CharSequence!);
-    method @Deprecated public void setTitleView(android.view.View!);
+    method @Deprecated public void setSearchAffordanceColors(androidx.leanback.widget.SearchOrbView.Colors);
+    method @Deprecated public void setTitle(CharSequence?);
+    method @Deprecated public void setTitleView(android.view.View?);
     method @Deprecated public void showTitle(boolean);
     method @Deprecated public void showTitle(int);
   }
@@ -112,7 +112,7 @@
     method @Deprecated public boolean isInHeadersTransition();
     method @Deprecated public boolean isShowingHeaders();
     method @Deprecated public androidx.leanback.app.HeadersFragment! onCreateHeadersFragment();
-    method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+    method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup?, android.os.Bundle!);
     method @Deprecated public void onDestroy();
     method @Deprecated public void onStop();
     method @Deprecated public void setAdapter(androidx.leanback.widget.ObjectAdapter!);
@@ -302,7 +302,7 @@
     method @Deprecated public androidx.leanback.widget.DetailsParallax! getParallax();
     method @Deprecated public androidx.leanback.app.RowsFragment! getRowsFragment();
     method @Deprecated protected android.view.View! inflateTitle(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
-    method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+    method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup?, android.os.Bundle!);
     method @Deprecated protected void onSetDetailsOverviewRowStatus(androidx.leanback.widget.FullWidthDetailsOverviewRowPresenter!, androidx.leanback.widget.FullWidthDetailsOverviewRowPresenter.ViewHolder!, int, int, int);
     method @Deprecated protected void onSetRowStatus(androidx.leanback.widget.RowPresenter!, androidx.leanback.widget.RowPresenter.ViewHolder!, int, int, int);
     method @Deprecated public void onStop();
@@ -379,19 +379,19 @@
 
   @Deprecated public class ErrorFragment extends androidx.leanback.app.BrandedFragment {
     ctor @Deprecated public ErrorFragment();
-    method @Deprecated public android.graphics.drawable.Drawable! getBackgroundDrawable();
-    method @Deprecated public android.view.View.OnClickListener! getButtonClickListener();
-    method @Deprecated public String! getButtonText();
-    method @Deprecated public android.graphics.drawable.Drawable! getImageDrawable();
-    method @Deprecated public CharSequence! getMessage();
+    method @Deprecated public android.graphics.drawable.Drawable? getBackgroundDrawable();
+    method @Deprecated public android.view.View.OnClickListener? getButtonClickListener();
+    method @Deprecated public String? getButtonText();
+    method @Deprecated public android.graphics.drawable.Drawable? getImageDrawable();
+    method @Deprecated public CharSequence? getMessage();
     method @Deprecated public boolean isBackgroundTranslucent();
-    method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
-    method @Deprecated public void setBackgroundDrawable(android.graphics.drawable.Drawable!);
-    method @Deprecated public void setButtonClickListener(android.view.View.OnClickListener!);
-    method @Deprecated public void setButtonText(String!);
+    method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup?, android.os.Bundle!);
+    method @Deprecated public void setBackgroundDrawable(android.graphics.drawable.Drawable?);
+    method @Deprecated public void setButtonClickListener(android.view.View.OnClickListener?);
+    method @Deprecated public void setButtonText(String?);
     method @Deprecated public void setDefaultBackground(boolean);
-    method @Deprecated public void setImageDrawable(android.graphics.drawable.Drawable!);
-    method @Deprecated public void setMessage(CharSequence!);
+    method @Deprecated public void setImageDrawable(android.graphics.drawable.Drawable?);
+    method @Deprecated public void setMessage(CharSequence?);
   }
 
   public class ErrorSupportFragment extends androidx.leanback.app.BrandedSupportFragment {
@@ -412,26 +412,26 @@
 
   @Deprecated public class GuidedStepFragment extends android.app.Fragment {
     ctor @Deprecated public GuidedStepFragment();
-    method @Deprecated public static int add(android.app.FragmentManager!, androidx.leanback.app.GuidedStepFragment!);
-    method @Deprecated public static int add(android.app.FragmentManager!, androidx.leanback.app.GuidedStepFragment!, int);
-    method @Deprecated public static int addAsRoot(android.app.Activity!, androidx.leanback.app.GuidedStepFragment!, int);
+    method @Deprecated public static int add(android.app.FragmentManager, androidx.leanback.app.GuidedStepFragment);
+    method @Deprecated public static int add(android.app.FragmentManager, androidx.leanback.app.GuidedStepFragment, int);
+    method @Deprecated public static int addAsRoot(android.app.Activity, androidx.leanback.app.GuidedStepFragment, int);
     method @Deprecated public void collapseAction(boolean);
     method @Deprecated public void collapseSubActions();
-    method @Deprecated public void expandAction(androidx.leanback.widget.GuidedAction!, boolean);
-    method @Deprecated public void expandSubActions(androidx.leanback.widget.GuidedAction!);
-    method @Deprecated public androidx.leanback.widget.GuidedAction! findActionById(long);
+    method @Deprecated public void expandAction(androidx.leanback.widget.GuidedAction, boolean);
+    method @Deprecated public void expandSubActions(androidx.leanback.widget.GuidedAction);
+    method @Deprecated public androidx.leanback.widget.GuidedAction? findActionById(long);
     method @Deprecated public int findActionPositionById(long);
-    method @Deprecated public androidx.leanback.widget.GuidedAction! findButtonActionById(long);
+    method @Deprecated public androidx.leanback.widget.GuidedAction? findButtonActionById(long);
     method @Deprecated public int findButtonActionPositionById(long);
     method @Deprecated public void finishGuidedStepFragments();
-    method @Deprecated public android.view.View! getActionItemView(int);
-    method @Deprecated public java.util.List! getActions();
-    method @Deprecated public android.view.View! getButtonActionItemView(int);
-    method @Deprecated public java.util.List! getButtonActions();
-    method @Deprecated public static androidx.leanback.app.GuidedStepFragment! getCurrentGuidedStepFragment(android.app.FragmentManager!);
-    method @Deprecated public androidx.leanback.widget.GuidanceStylist! getGuidanceStylist();
-    method @Deprecated public androidx.leanback.widget.GuidedActionsStylist! getGuidedActionsStylist();
-    method @Deprecated public androidx.leanback.widget.GuidedActionsStylist! getGuidedButtonActionsStylist();
+    method @Deprecated public android.view.View? getActionItemView(int);
+    method @Deprecated public java.util.List getActions();
+    method @Deprecated public android.view.View? getButtonActionItemView(int);
+    method @Deprecated public java.util.List getButtonActions();
+    method @Deprecated public static androidx.leanback.app.GuidedStepFragment? getCurrentGuidedStepFragment(android.app.FragmentManager);
+    method @Deprecated public androidx.leanback.widget.GuidanceStylist getGuidanceStylist();
+    method @Deprecated public androidx.leanback.widget.GuidedActionsStylist getGuidedActionsStylist();
+    method @Deprecated public androidx.leanback.widget.GuidedActionsStylist getGuidedButtonActionsStylist();
     method @Deprecated public int getSelectedActionPosition();
     method @Deprecated public int getSelectedButtonActionPosition();
     method @Deprecated public int getUiStyle();
@@ -441,32 +441,32 @@
     method @Deprecated public boolean isSubActionsExpanded();
     method @Deprecated public void notifyActionChanged(int);
     method @Deprecated public void notifyButtonActionChanged(int);
-    method @Deprecated protected void onAddSharedElementTransition(android.app.FragmentTransaction!, androidx.leanback.app.GuidedStepFragment!);
-    method @Deprecated public void onCreate(android.os.Bundle!);
-    method @Deprecated public void onCreateActions(java.util.List, android.os.Bundle!);
-    method @Deprecated public androidx.leanback.widget.GuidedActionsStylist! onCreateActionsStylist();
-    method @Deprecated public android.view.View! onCreateBackgroundView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
-    method @Deprecated public void onCreateButtonActions(java.util.List, android.os.Bundle!);
-    method @Deprecated public androidx.leanback.widget.GuidedActionsStylist! onCreateButtonActionsStylist();
-    method @Deprecated public androidx.leanback.widget.GuidanceStylist.Guidance onCreateGuidance(android.os.Bundle!);
-    method @Deprecated public androidx.leanback.widget.GuidanceStylist! onCreateGuidanceStylist();
-    method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+    method @Deprecated protected void onAddSharedElementTransition(android.app.FragmentTransaction, androidx.leanback.app.GuidedStepFragment);
+    method @Deprecated public void onCreate(android.os.Bundle?);
+    method @Deprecated public void onCreateActions(java.util.List, android.os.Bundle?);
+    method @Deprecated public androidx.leanback.widget.GuidedActionsStylist onCreateActionsStylist();
+    method @Deprecated public android.view.View? onCreateBackgroundView(android.view.LayoutInflater, android.view.ViewGroup?, android.os.Bundle?);
+    method @Deprecated public void onCreateButtonActions(java.util.List, android.os.Bundle?);
+    method @Deprecated public androidx.leanback.widget.GuidedActionsStylist onCreateButtonActionsStylist();
+    method @Deprecated public androidx.leanback.widget.GuidanceStylist.Guidance onCreateGuidance(android.os.Bundle?);
+    method @Deprecated public androidx.leanback.widget.GuidanceStylist onCreateGuidanceStylist();
+    method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup?, android.os.Bundle!);
     method @Deprecated public void onDestroyView();
-    method @Deprecated public void onGuidedActionClicked(androidx.leanback.widget.GuidedAction!);
-    method @Deprecated public void onGuidedActionEditCanceled(androidx.leanback.widget.GuidedAction!);
+    method @Deprecated public void onGuidedActionClicked(androidx.leanback.widget.GuidedAction);
+    method @Deprecated public void onGuidedActionEditCanceled(androidx.leanback.widget.GuidedAction);
     method @Deprecated public void onGuidedActionEdited(androidx.leanback.widget.GuidedAction!);
-    method @Deprecated public long onGuidedActionEditedAndProceed(androidx.leanback.widget.GuidedAction!);
+    method @Deprecated public long onGuidedActionEditedAndProceed(androidx.leanback.widget.GuidedAction);
     method @Deprecated public void onGuidedActionFocused(androidx.leanback.widget.GuidedAction);
     method @Deprecated protected void onProvideFragmentTransitions();
     method @Deprecated public int onProvideTheme();
     method @Deprecated public void onResume();
     method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
-    method @Deprecated public boolean onSubGuidedActionClicked(androidx.leanback.widget.GuidedAction!);
-    method @Deprecated public void openInEditMode(androidx.leanback.widget.GuidedAction!);
-    method @Deprecated public void popBackStackToGuidedStepFragment(Class!, int);
-    method @Deprecated public void setActions(java.util.List!);
-    method @Deprecated public void setActionsDiffCallback(androidx.leanback.widget.DiffCallback!);
-    method @Deprecated public void setButtonActions(java.util.List!);
+    method @Deprecated public boolean onSubGuidedActionClicked(androidx.leanback.widget.GuidedAction);
+    method @Deprecated public void openInEditMode(androidx.leanback.widget.GuidedAction?);
+    method @Deprecated public void popBackStackToGuidedStepFragment(Class, int);
+    method @Deprecated public void setActions(java.util.List);
+    method @Deprecated public void setActionsDiffCallback(androidx.leanback.widget.DiffCallback?);
+    method @Deprecated public void setButtonActions(java.util.List);
     method @Deprecated public void setSelectedActionPosition(int);
     method @Deprecated public void setSelectedButtonActionPosition(int);
     method @Deprecated public void setUiStyle(int);
@@ -547,7 +547,7 @@
     method @Deprecated public int getSelectedPosition();
     method @Deprecated public final androidx.leanback.widget.VerticalGridView! getVerticalGridView();
     method @Deprecated public boolean isScrolling();
-    method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+    method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup?, android.os.Bundle!);
     method @Deprecated public void onDestroyView();
     method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
     method @Deprecated public void onTransitionEnd();
@@ -609,21 +609,21 @@
     method @Deprecated public final int getIconResourceId();
     method @Deprecated public final int getLogoResourceId();
     method @Deprecated protected abstract int getPageCount();
-    method @Deprecated protected abstract CharSequence! getPageDescription(int);
-    method @Deprecated protected abstract CharSequence! getPageTitle(int);
-    method @Deprecated public final CharSequence! getStartButtonText();
+    method @Deprecated protected abstract CharSequence? getPageDescription(int);
+    method @Deprecated protected abstract CharSequence? getPageTitle(int);
+    method @Deprecated public final CharSequence? getStartButtonText();
     method @Deprecated @ColorInt public final int getTitleViewTextColor();
     method @Deprecated protected final boolean isLogoAnimationFinished();
     method @Deprecated protected void moveToNextPage();
     method @Deprecated protected void moveToPreviousPage();
-    method @Deprecated protected abstract android.view.View? onCreateBackgroundView(android.view.LayoutInflater!, android.view.ViewGroup!);
-    method @Deprecated protected abstract android.view.View? onCreateContentView(android.view.LayoutInflater!, android.view.ViewGroup!);
-    method @Deprecated protected android.animation.Animator! onCreateDescriptionAnimator();
+    method @Deprecated protected abstract android.view.View? onCreateBackgroundView(android.view.LayoutInflater, android.view.ViewGroup);
+    method @Deprecated protected abstract android.view.View? onCreateContentView(android.view.LayoutInflater, android.view.ViewGroup);
+    method @Deprecated protected android.animation.Animator onCreateDescriptionAnimator();
     method @Deprecated protected android.animation.Animator? onCreateEnterAnimation();
-    method @Deprecated protected abstract android.view.View? onCreateForegroundView(android.view.LayoutInflater!, android.view.ViewGroup!);
+    method @Deprecated protected abstract android.view.View? onCreateForegroundView(android.view.LayoutInflater, android.view.ViewGroup);
     method @Deprecated protected android.animation.Animator? onCreateLogoAnimation();
-    method @Deprecated protected android.animation.Animator! onCreateTitleAnimator();
-    method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+    method @Deprecated protected android.animation.Animator onCreateTitleAnimator();
+    method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup?, android.os.Bundle!);
     method @Deprecated protected void onFinishFragment();
     method @Deprecated protected void onLogoAnimationFinished();
     method @Deprecated protected void onPageChanged(int, int);
@@ -636,7 +636,7 @@
     method @Deprecated public void setDotBackgroundColor(@ColorInt int);
     method @Deprecated public final void setIconResouceId(int);
     method @Deprecated public final void setLogoResourceId(int);
-    method @Deprecated public void setStartButtonText(CharSequence!);
+    method @Deprecated public void setStartButtonText(CharSequence?);
     method @Deprecated public void setTitleViewTextColor(@ColorInt int);
     method @Deprecated protected final void startEnterAnimation(boolean);
   }
@@ -694,7 +694,7 @@
     method @Deprecated public void notifyPlaybackRowChanged();
     method @Deprecated protected void onBufferingStateChanged(boolean);
     method @Deprecated public void onCreate(android.os.Bundle!);
-    method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+    method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup?, android.os.Bundle!);
     method @Deprecated public void onDestroy();
     method @Deprecated public void onDestroyView();
     method @Deprecated protected void onError(int, CharSequence!);
@@ -803,7 +803,7 @@
     method @Deprecated public int getSelectedPosition();
     method @Deprecated public final androidx.leanback.widget.VerticalGridView! getVerticalGridView();
     method @Deprecated public boolean isScrolling();
-    method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+    method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup?, android.os.Bundle!);
     method @Deprecated public void onDestroyView();
     method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
     method @Deprecated public void onTransitionEnd();
@@ -881,7 +881,7 @@
     method @Deprecated public String! getTitle();
     method @Deprecated public static androidx.leanback.app.SearchFragment! newInstance(String!);
     method @Deprecated public void onCreate(android.os.Bundle!);
-    method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+    method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup?, android.os.Bundle!);
     method @Deprecated public void onDestroy();
     method @Deprecated public void onDestroyView();
     method @Deprecated public void onPause();
@@ -939,14 +939,14 @@
 
   @Deprecated public class VerticalGridFragment extends androidx.leanback.app.BaseFragment {
     ctor @Deprecated public VerticalGridFragment();
-    method @Deprecated public androidx.leanback.widget.ObjectAdapter! getAdapter();
-    method @Deprecated public androidx.leanback.widget.VerticalGridPresenter! getGridPresenter();
-    method @Deprecated public androidx.leanback.widget.OnItemViewClickedListener! getOnItemViewClickedListener();
-    method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
-    method @Deprecated public void setAdapter(androidx.leanback.widget.ObjectAdapter!);
-    method @Deprecated public void setGridPresenter(androidx.leanback.widget.VerticalGridPresenter!);
-    method @Deprecated public void setOnItemViewClickedListener(androidx.leanback.widget.OnItemViewClickedListener!);
-    method @Deprecated public void setOnItemViewSelectedListener(androidx.leanback.widget.OnItemViewSelectedListener!);
+    method @Deprecated public androidx.leanback.widget.ObjectAdapter? getAdapter();
+    method @Deprecated public androidx.leanback.widget.VerticalGridPresenter? getGridPresenter();
+    method @Deprecated public androidx.leanback.widget.OnItemViewClickedListener? getOnItemViewClickedListener();
+    method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup?, android.os.Bundle!);
+    method @Deprecated public void setAdapter(androidx.leanback.widget.ObjectAdapter?);
+    method @Deprecated public void setGridPresenter(androidx.leanback.widget.VerticalGridPresenter);
+    method @Deprecated public void setOnItemViewClickedListener(androidx.leanback.widget.OnItemViewClickedListener?);
+    method @Deprecated public void setOnItemViewSelectedListener(androidx.leanback.widget.OnItemViewSelectedListener?);
     method @Deprecated public void setSelectedPosition(int);
   }
 
@@ -1883,6 +1883,14 @@
     method public B! title(CharSequence?);
   }
 
+  public class GuidedActionAppCompatEditText extends androidx.appcompat.widget.AppCompatEditText implements androidx.leanback.widget.GuidedActionAutofillSupport androidx.leanback.widget.ImeKeyMonitor {
+    ctor public GuidedActionAppCompatEditText(android.content.Context);
+    ctor public GuidedActionAppCompatEditText(android.content.Context, android.util.AttributeSet?);
+    ctor public GuidedActionAppCompatEditText(android.content.Context, android.util.AttributeSet?, int);
+    method public void setImeKeyListener(androidx.leanback.widget.ImeKeyMonitor.ImeKeyListener?);
+    method public void setOnAutofillListener(androidx.leanback.widget.GuidedActionAutofillSupport.OnAutofillListener?);
+  }
+
   public interface GuidedActionAutofillSupport {
     method public void setOnAutofillListener(androidx.leanback.widget.GuidedActionAutofillSupport.OnAutofillListener!);
   }
@@ -1898,7 +1906,7 @@
     method public static androidx.leanback.widget.GuidedActionDiffCallback getInstance();
   }
 
-  public class GuidedActionEditText extends androidx.appcompat.widget.AppCompatEditText implements androidx.leanback.widget.GuidedActionAutofillSupport androidx.leanback.widget.ImeKeyMonitor {
+  public class GuidedActionEditText extends android.widget.EditText implements androidx.leanback.widget.GuidedActionAutofillSupport androidx.leanback.widget.ImeKeyMonitor {
     ctor public GuidedActionEditText(android.content.Context!);
     ctor public GuidedActionEditText(android.content.Context!, android.util.AttributeSet!);
     ctor public GuidedActionEditText(android.content.Context!, android.util.AttributeSet!, int);
@@ -2113,6 +2121,10 @@
     method public void wrap(android.view.View!, android.view.View!);
   }
 
+  public class LeanbackAppCompatViewInflater extends androidx.appcompat.app.AppCompatViewInflater {
+    ctor public LeanbackAppCompatViewInflater();
+  }
+
   public class ListRow extends androidx.leanback.widget.Row {
     ctor public ListRow(androidx.leanback.widget.HeaderItem!, androidx.leanback.widget.ObjectAdapter!);
     ctor public ListRow(androidx.leanback.widget.ObjectAdapter!);
diff --git a/leanback/leanback/api/restricted_current.txt b/leanback/leanback/api/restricted_current.txt
index 7c962a9e..69d9df6 100644
--- a/leanback/leanback/api/restricted_current.txt
+++ b/leanback/leanback/api/restricted_current.txt
@@ -68,27 +68,27 @@
 
   @Deprecated public class BrandedFragment extends android.app.Fragment {
     ctor @Deprecated public BrandedFragment();
-    method @Deprecated public android.graphics.drawable.Drawable! getBadgeDrawable();
+    method @Deprecated public android.graphics.drawable.Drawable? getBadgeDrawable();
     method @Deprecated public int getSearchAffordanceColor();
-    method @Deprecated public androidx.leanback.widget.SearchOrbView.Colors! getSearchAffordanceColors();
-    method @Deprecated public CharSequence! getTitle();
-    method @Deprecated public android.view.View! getTitleView();
-    method @Deprecated public androidx.leanback.widget.TitleViewAdapter! getTitleViewAdapter();
-    method @Deprecated public void installTitleView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+    method @Deprecated public androidx.leanback.widget.SearchOrbView.Colors? getSearchAffordanceColors();
+    method @Deprecated public CharSequence? getTitle();
+    method @Deprecated public android.view.View? getTitleView();
+    method @Deprecated public androidx.leanback.widget.TitleViewAdapter? getTitleViewAdapter();
+    method @Deprecated public void installTitleView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle?);
     method @Deprecated public final boolean isShowingTitle();
     method @Deprecated public void onDestroyView();
-    method @Deprecated public android.view.View! onInflateTitleView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+    method @Deprecated public android.view.View onInflateTitleView(android.view.LayoutInflater, android.view.ViewGroup?, android.os.Bundle?);
     method @Deprecated public void onPause();
     method @Deprecated public void onResume();
     method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
     method @Deprecated public void onStart();
     method @Deprecated public void onViewCreated(android.view.View, android.os.Bundle?);
-    method @Deprecated public void setBadgeDrawable(android.graphics.drawable.Drawable!);
-    method @Deprecated public void setOnSearchClickedListener(android.view.View.OnClickListener!);
+    method @Deprecated public void setBadgeDrawable(android.graphics.drawable.Drawable?);
+    method @Deprecated public void setOnSearchClickedListener(android.view.View.OnClickListener?);
     method @Deprecated public void setSearchAffordanceColor(int);
-    method @Deprecated public void setSearchAffordanceColors(androidx.leanback.widget.SearchOrbView.Colors!);
-    method @Deprecated public void setTitle(CharSequence!);
-    method @Deprecated public void setTitleView(android.view.View!);
+    method @Deprecated public void setSearchAffordanceColors(androidx.leanback.widget.SearchOrbView.Colors);
+    method @Deprecated public void setTitle(CharSequence?);
+    method @Deprecated public void setTitleView(android.view.View?);
     method @Deprecated public void showTitle(boolean);
     method @Deprecated public void showTitle(int);
   }
@@ -134,7 +134,7 @@
     method @Deprecated public boolean isInHeadersTransition();
     method @Deprecated public boolean isShowingHeaders();
     method @Deprecated public androidx.leanback.app.HeadersFragment! onCreateHeadersFragment();
-    method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+    method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup?, android.os.Bundle!);
     method @Deprecated public void onDestroy();
     method @Deprecated public void onStop();
     method @Deprecated public void setAdapter(androidx.leanback.widget.ObjectAdapter!);
@@ -324,7 +324,7 @@
     method @Deprecated public androidx.leanback.widget.DetailsParallax! getParallax();
     method @Deprecated public androidx.leanback.app.RowsFragment! getRowsFragment();
     method @Deprecated protected android.view.View! inflateTitle(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
-    method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+    method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup?, android.os.Bundle!);
     method @Deprecated protected void onSetDetailsOverviewRowStatus(androidx.leanback.widget.FullWidthDetailsOverviewRowPresenter!, androidx.leanback.widget.FullWidthDetailsOverviewRowPresenter.ViewHolder!, int, int, int);
     method @Deprecated protected void onSetRowStatus(androidx.leanback.widget.RowPresenter!, androidx.leanback.widget.RowPresenter.ViewHolder!, int, int, int);
     method @Deprecated public void onStop();
@@ -401,19 +401,19 @@
 
   @Deprecated public class ErrorFragment extends androidx.leanback.app.BrandedFragment {
     ctor @Deprecated public ErrorFragment();
-    method @Deprecated public android.graphics.drawable.Drawable! getBackgroundDrawable();
-    method @Deprecated public android.view.View.OnClickListener! getButtonClickListener();
-    method @Deprecated public String! getButtonText();
-    method @Deprecated public android.graphics.drawable.Drawable! getImageDrawable();
-    method @Deprecated public CharSequence! getMessage();
+    method @Deprecated public android.graphics.drawable.Drawable? getBackgroundDrawable();
+    method @Deprecated public android.view.View.OnClickListener? getButtonClickListener();
+    method @Deprecated public String? getButtonText();
+    method @Deprecated public android.graphics.drawable.Drawable? getImageDrawable();
+    method @Deprecated public CharSequence? getMessage();
     method @Deprecated public boolean isBackgroundTranslucent();
-    method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
-    method @Deprecated public void setBackgroundDrawable(android.graphics.drawable.Drawable!);
-    method @Deprecated public void setButtonClickListener(android.view.View.OnClickListener!);
-    method @Deprecated public void setButtonText(String!);
+    method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup?, android.os.Bundle!);
+    method @Deprecated public void setBackgroundDrawable(android.graphics.drawable.Drawable?);
+    method @Deprecated public void setButtonClickListener(android.view.View.OnClickListener?);
+    method @Deprecated public void setButtonText(String?);
     method @Deprecated public void setDefaultBackground(boolean);
-    method @Deprecated public void setImageDrawable(android.graphics.drawable.Drawable!);
-    method @Deprecated public void setMessage(CharSequence!);
+    method @Deprecated public void setImageDrawable(android.graphics.drawable.Drawable?);
+    method @Deprecated public void setMessage(CharSequence?);
   }
 
   public class ErrorSupportFragment extends androidx.leanback.app.BrandedSupportFragment {
@@ -434,26 +434,26 @@
 
   @Deprecated public class GuidedStepFragment extends android.app.Fragment implements androidx.leanback.widget.GuidedActionAdapter.FocusListener {
     ctor @Deprecated public GuidedStepFragment();
-    method @Deprecated public static int add(android.app.FragmentManager!, androidx.leanback.app.GuidedStepFragment!);
-    method @Deprecated public static int add(android.app.FragmentManager!, androidx.leanback.app.GuidedStepFragment!, int);
-    method @Deprecated public static int addAsRoot(android.app.Activity!, androidx.leanback.app.GuidedStepFragment!, int);
+    method @Deprecated public static int add(android.app.FragmentManager, androidx.leanback.app.GuidedStepFragment);
+    method @Deprecated public static int add(android.app.FragmentManager, androidx.leanback.app.GuidedStepFragment, int);
+    method @Deprecated public static int addAsRoot(android.app.Activity, androidx.leanback.app.GuidedStepFragment, int);
     method @Deprecated public void collapseAction(boolean);
     method @Deprecated public void collapseSubActions();
-    method @Deprecated public void expandAction(androidx.leanback.widget.GuidedAction!, boolean);
-    method @Deprecated public void expandSubActions(androidx.leanback.widget.GuidedAction!);
-    method @Deprecated public androidx.leanback.widget.GuidedAction! findActionById(long);
+    method @Deprecated public void expandAction(androidx.leanback.widget.GuidedAction, boolean);
+    method @Deprecated public void expandSubActions(androidx.leanback.widget.GuidedAction);
+    method @Deprecated public androidx.leanback.widget.GuidedAction? findActionById(long);
     method @Deprecated public int findActionPositionById(long);
-    method @Deprecated public androidx.leanback.widget.GuidedAction! findButtonActionById(long);
+    method @Deprecated public androidx.leanback.widget.GuidedAction? findButtonActionById(long);
     method @Deprecated public int findButtonActionPositionById(long);
     method @Deprecated public void finishGuidedStepFragments();
-    method @Deprecated public android.view.View! getActionItemView(int);
-    method @Deprecated public java.util.List! getActions();
-    method @Deprecated public android.view.View! getButtonActionItemView(int);
-    method @Deprecated public java.util.List! getButtonActions();
-    method @Deprecated public static androidx.leanback.app.GuidedStepFragment! getCurrentGuidedStepFragment(android.app.FragmentManager!);
-    method @Deprecated public androidx.leanback.widget.GuidanceStylist! getGuidanceStylist();
-    method @Deprecated public androidx.leanback.widget.GuidedActionsStylist! getGuidedActionsStylist();
-    method @Deprecated public androidx.leanback.widget.GuidedActionsStylist! getGuidedButtonActionsStylist();
+    method @Deprecated public android.view.View? getActionItemView(int);
+    method @Deprecated public java.util.List getActions();
+    method @Deprecated public android.view.View? getButtonActionItemView(int);
+    method @Deprecated public java.util.List getButtonActions();
+    method @Deprecated public static androidx.leanback.app.GuidedStepFragment? getCurrentGuidedStepFragment(android.app.FragmentManager);
+    method @Deprecated public androidx.leanback.widget.GuidanceStylist getGuidanceStylist();
+    method @Deprecated public androidx.leanback.widget.GuidedActionsStylist getGuidedActionsStylist();
+    method @Deprecated public androidx.leanback.widget.GuidedActionsStylist getGuidedButtonActionsStylist();
     method @Deprecated public int getSelectedActionPosition();
     method @Deprecated public int getSelectedButtonActionPosition();
     method @Deprecated public int getUiStyle();
@@ -463,32 +463,32 @@
     method @Deprecated public boolean isSubActionsExpanded();
     method @Deprecated public void notifyActionChanged(int);
     method @Deprecated public void notifyButtonActionChanged(int);
-    method @Deprecated protected void onAddSharedElementTransition(android.app.FragmentTransaction!, androidx.leanback.app.GuidedStepFragment!);
-    method @Deprecated public void onCreate(android.os.Bundle!);
-    method @Deprecated public void onCreateActions(java.util.List, android.os.Bundle!);
-    method @Deprecated public androidx.leanback.widget.GuidedActionsStylist! onCreateActionsStylist();
-    method @Deprecated public android.view.View! onCreateBackgroundView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
-    method @Deprecated public void onCreateButtonActions(java.util.List, android.os.Bundle!);
-    method @Deprecated public androidx.leanback.widget.GuidedActionsStylist! onCreateButtonActionsStylist();
-    method @Deprecated public androidx.leanback.widget.GuidanceStylist.Guidance onCreateGuidance(android.os.Bundle!);
-    method @Deprecated public androidx.leanback.widget.GuidanceStylist! onCreateGuidanceStylist();
-    method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+    method @Deprecated protected void onAddSharedElementTransition(android.app.FragmentTransaction, androidx.leanback.app.GuidedStepFragment);
+    method @Deprecated public void onCreate(android.os.Bundle?);
+    method @Deprecated public void onCreateActions(java.util.List, android.os.Bundle?);
+    method @Deprecated public androidx.leanback.widget.GuidedActionsStylist onCreateActionsStylist();
+    method @Deprecated public android.view.View? onCreateBackgroundView(android.view.LayoutInflater, android.view.ViewGroup?, android.os.Bundle?);
+    method @Deprecated public void onCreateButtonActions(java.util.List, android.os.Bundle?);
+    method @Deprecated public androidx.leanback.widget.GuidedActionsStylist onCreateButtonActionsStylist();
+    method @Deprecated public androidx.leanback.widget.GuidanceStylist.Guidance onCreateGuidance(android.os.Bundle?);
+    method @Deprecated public androidx.leanback.widget.GuidanceStylist onCreateGuidanceStylist();
+    method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup?, android.os.Bundle!);
     method @Deprecated public void onDestroyView();
-    method @Deprecated public void onGuidedActionClicked(androidx.leanback.widget.GuidedAction!);
-    method @Deprecated public void onGuidedActionEditCanceled(androidx.leanback.widget.GuidedAction!);
+    method @Deprecated public void onGuidedActionClicked(androidx.leanback.widget.GuidedAction);
+    method @Deprecated public void onGuidedActionEditCanceled(androidx.leanback.widget.GuidedAction);
     method @Deprecated public void onGuidedActionEdited(androidx.leanback.widget.GuidedAction!);
-    method @Deprecated public long onGuidedActionEditedAndProceed(androidx.leanback.widget.GuidedAction!);
+    method @Deprecated public long onGuidedActionEditedAndProceed(androidx.leanback.widget.GuidedAction);
     method @Deprecated public void onGuidedActionFocused(androidx.leanback.widget.GuidedAction);
     method @Deprecated protected void onProvideFragmentTransitions();
     method @Deprecated public int onProvideTheme();
     method @Deprecated public void onResume();
     method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
-    method @Deprecated public boolean onSubGuidedActionClicked(androidx.leanback.widget.GuidedAction!);
-    method @Deprecated public void openInEditMode(androidx.leanback.widget.GuidedAction!);
-    method @Deprecated public void popBackStackToGuidedStepFragment(Class!, int);
-    method @Deprecated public void setActions(java.util.List!);
-    method @Deprecated public void setActionsDiffCallback(androidx.leanback.widget.DiffCallback!);
-    method @Deprecated public void setButtonActions(java.util.List!);
+    method @Deprecated public boolean onSubGuidedActionClicked(androidx.leanback.widget.GuidedAction);
+    method @Deprecated public void openInEditMode(androidx.leanback.widget.GuidedAction?);
+    method @Deprecated public void popBackStackToGuidedStepFragment(Class, int);
+    method @Deprecated public void setActions(java.util.List);
+    method @Deprecated public void setActionsDiffCallback(androidx.leanback.widget.DiffCallback?);
+    method @Deprecated public void setButtonActions(java.util.List);
     method @Deprecated @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setEntranceTransitionType(int);
     method @Deprecated public void setSelectedActionPosition(int);
     method @Deprecated public void setSelectedButtonActionPosition(int);
@@ -504,7 +504,7 @@
 
   @Deprecated @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static class GuidedStepFragment.DummyFragment extends android.app.Fragment {
     ctor @Deprecated public GuidedStepFragment.DummyFragment();
-    method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+    method @Deprecated public android.view.View onCreateView(android.view.LayoutInflater, android.view.ViewGroup?, android.os.Bundle?);
   }
 
   public class GuidedStepSupportFragment extends androidx.fragment.app.Fragment implements androidx.leanback.widget.GuidedActionAdapter.FocusListener {
@@ -584,7 +584,7 @@
     method @Deprecated public int getSelectedPosition();
     method @Deprecated public final androidx.leanback.widget.VerticalGridView! getVerticalGridView();
     method @Deprecated public boolean isScrolling();
-    method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+    method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup?, android.os.Bundle!);
     method @Deprecated public void onDestroyView();
     method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
     method @Deprecated public void onTransitionEnd();
@@ -646,21 +646,21 @@
     method @Deprecated public final int getIconResourceId();
     method @Deprecated public final int getLogoResourceId();
     method @Deprecated protected abstract int getPageCount();
-    method @Deprecated protected abstract CharSequence! getPageDescription(int);
-    method @Deprecated protected abstract CharSequence! getPageTitle(int);
-    method @Deprecated public final CharSequence! getStartButtonText();
+    method @Deprecated protected abstract CharSequence? getPageDescription(int);
+    method @Deprecated protected abstract CharSequence? getPageTitle(int);
+    method @Deprecated public final CharSequence? getStartButtonText();
     method @Deprecated @ColorInt public final int getTitleViewTextColor();
     method @Deprecated protected final boolean isLogoAnimationFinished();
     method @Deprecated protected void moveToNextPage();
     method @Deprecated protected void moveToPreviousPage();
-    method @Deprecated protected abstract android.view.View? onCreateBackgroundView(android.view.LayoutInflater!, android.view.ViewGroup!);
-    method @Deprecated protected abstract android.view.View? onCreateContentView(android.view.LayoutInflater!, android.view.ViewGroup!);
-    method @Deprecated protected android.animation.Animator! onCreateDescriptionAnimator();
+    method @Deprecated protected abstract android.view.View? onCreateBackgroundView(android.view.LayoutInflater, android.view.ViewGroup);
+    method @Deprecated protected abstract android.view.View? onCreateContentView(android.view.LayoutInflater, android.view.ViewGroup);
+    method @Deprecated protected android.animation.Animator onCreateDescriptionAnimator();
     method @Deprecated protected android.animation.Animator? onCreateEnterAnimation();
-    method @Deprecated protected abstract android.view.View? onCreateForegroundView(android.view.LayoutInflater!, android.view.ViewGroup!);
+    method @Deprecated protected abstract android.view.View? onCreateForegroundView(android.view.LayoutInflater, android.view.ViewGroup);
     method @Deprecated protected android.animation.Animator? onCreateLogoAnimation();
-    method @Deprecated protected android.animation.Animator! onCreateTitleAnimator();
-    method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+    method @Deprecated protected android.animation.Animator onCreateTitleAnimator();
+    method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup?, android.os.Bundle!);
     method @Deprecated protected void onFinishFragment();
     method @Deprecated protected void onLogoAnimationFinished();
     method @Deprecated protected void onPageChanged(int, int);
@@ -673,7 +673,7 @@
     method @Deprecated public void setDotBackgroundColor(@ColorInt int);
     method @Deprecated public final void setIconResouceId(int);
     method @Deprecated public final void setLogoResourceId(int);
-    method @Deprecated public void setStartButtonText(CharSequence!);
+    method @Deprecated public void setStartButtonText(CharSequence?);
     method @Deprecated public void setTitleViewTextColor(@ColorInt int);
     method @Deprecated protected final void startEnterAnimation(boolean);
   }
@@ -735,7 +735,7 @@
     method @Deprecated public void notifyPlaybackRowChanged();
     method @Deprecated protected void onBufferingStateChanged(boolean);
     method @Deprecated public void onCreate(android.os.Bundle!);
-    method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+    method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup?, android.os.Bundle!);
     method @Deprecated public void onDestroy();
     method @Deprecated public void onDestroyView();
     method @Deprecated protected void onError(int, CharSequence!);
@@ -844,7 +844,7 @@
     method @Deprecated public int getSelectedPosition();
     method @Deprecated public final androidx.leanback.widget.VerticalGridView! getVerticalGridView();
     method @Deprecated public boolean isScrolling();
-    method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+    method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup?, android.os.Bundle!);
     method @Deprecated public void onDestroyView();
     method @Deprecated public void onSaveInstanceState(android.os.Bundle!);
     method @Deprecated public void onTransitionEnd();
@@ -922,7 +922,7 @@
     method @Deprecated public String! getTitle();
     method @Deprecated public static androidx.leanback.app.SearchFragment! newInstance(String!);
     method @Deprecated public void onCreate(android.os.Bundle!);
-    method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
+    method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup?, android.os.Bundle!);
     method @Deprecated public void onDestroy();
     method @Deprecated public void onDestroyView();
     method @Deprecated public void onPause();
@@ -980,14 +980,14 @@
 
   @Deprecated public class VerticalGridFragment extends androidx.leanback.app.BaseFragment {
     ctor @Deprecated public VerticalGridFragment();
-    method @Deprecated public androidx.leanback.widget.ObjectAdapter! getAdapter();
-    method @Deprecated public androidx.leanback.widget.VerticalGridPresenter! getGridPresenter();
-    method @Deprecated public androidx.leanback.widget.OnItemViewClickedListener! getOnItemViewClickedListener();
-    method @Deprecated public android.view.View! onCreateView(android.view.LayoutInflater!, android.view.ViewGroup!, android.os.Bundle!);
-    method @Deprecated public void setAdapter(androidx.leanback.widget.ObjectAdapter!);
-    method @Deprecated public void setGridPresenter(androidx.leanback.widget.VerticalGridPresenter!);
-    method @Deprecated public void setOnItemViewClickedListener(androidx.leanback.widget.OnItemViewClickedListener!);
-    method @Deprecated public void setOnItemViewSelectedListener(androidx.leanback.widget.OnItemViewSelectedListener!);
+    method @Deprecated public androidx.leanback.widget.ObjectAdapter? getAdapter();
+    method @Deprecated public androidx.leanback.widget.VerticalGridPresenter? getGridPresenter();
+    method @Deprecated public androidx.leanback.widget.OnItemViewClickedListener? getOnItemViewClickedListener();
+    method @Deprecated public android.view.View? onCreateView(android.view.LayoutInflater!, android.view.ViewGroup?, android.os.Bundle!);
+    method @Deprecated public void setAdapter(androidx.leanback.widget.ObjectAdapter?);
+    method @Deprecated public void setGridPresenter(androidx.leanback.widget.VerticalGridPresenter);
+    method @Deprecated public void setOnItemViewClickedListener(androidx.leanback.widget.OnItemViewClickedListener?);
+    method @Deprecated public void setOnItemViewSelectedListener(androidx.leanback.widget.OnItemViewSelectedListener?);
     method @Deprecated public void setSelectedPosition(int);
   }
 
@@ -2090,6 +2090,14 @@
     method public void setEditListener(androidx.leanback.widget.GuidedActionAdapter.EditListener?);
   }
 
+  public class GuidedActionAppCompatEditText extends androidx.appcompat.widget.AppCompatEditText implements androidx.leanback.widget.GuidedActionAutofillSupport androidx.leanback.widget.ImeKeyMonitor {
+    ctor public GuidedActionAppCompatEditText(android.content.Context);
+    ctor public GuidedActionAppCompatEditText(android.content.Context, android.util.AttributeSet?);
+    ctor public GuidedActionAppCompatEditText(android.content.Context, android.util.AttributeSet?, int);
+    method public void setImeKeyListener(androidx.leanback.widget.ImeKeyMonitor.ImeKeyListener?);
+    method public void setOnAutofillListener(androidx.leanback.widget.GuidedActionAutofillSupport.OnAutofillListener?);
+  }
+
   public interface GuidedActionAutofillSupport {
     method public void setOnAutofillListener(androidx.leanback.widget.GuidedActionAutofillSupport.OnAutofillListener!);
   }
@@ -2105,7 +2113,7 @@
     method public static androidx.leanback.widget.GuidedActionDiffCallback getInstance();
   }
 
-  public class GuidedActionEditText extends androidx.appcompat.widget.AppCompatEditText implements androidx.leanback.widget.GuidedActionAutofillSupport androidx.leanback.widget.ImeKeyMonitor {
+  public class GuidedActionEditText extends android.widget.EditText implements androidx.leanback.widget.GuidedActionAutofillSupport androidx.leanback.widget.ImeKeyMonitor {
     ctor public GuidedActionEditText(android.content.Context!);
     ctor public GuidedActionEditText(android.content.Context!, android.util.AttributeSet!);
     ctor public GuidedActionEditText(android.content.Context!, android.util.AttributeSet!, int);
@@ -2326,6 +2334,10 @@
     method public void wrap(android.view.View!, android.view.View!);
   }
 
+  public class LeanbackAppCompatViewInflater extends androidx.appcompat.app.AppCompatViewInflater {
+    ctor public LeanbackAppCompatViewInflater();
+  }
+
   public class ListRow extends androidx.leanback.widget.Row {
     ctor public ListRow(androidx.leanback.widget.HeaderItem!, androidx.leanback.widget.ObjectAdapter!);
     ctor public ListRow(androidx.leanback.widget.ObjectAdapter!);
diff --git a/leanback/leanback/generatef.py b/leanback/leanback/generatef.py
index bb38d96..64dab43 100755
--- a/leanback/leanback/generatef.py
+++ b/leanback/leanback/generatef.py
@@ -18,14 +18,14 @@
 import sys
 import re
 
-print "Generate framework fragment related code for leanback"
+print("Generate framework fragment related code for leanback")
 
 cls = ['Base', 'BaseRow', 'Browse', 'Details', 'Error', 'Headers',
       'Playback', 'Rows', 'Search', 'VerticalGrid', 'Branded',
       'GuidedStep', 'Onboarding', 'Video']
 
 for w in cls:
-    print "copy {}SupportFragment to {}Fragment".format(w, w)
+    print("copy {}SupportFragment to {}Fragment".format(w, w))
 
     file = open('src/main/java/androidx/leanback/app/{}SupportFragment.java'.format(w), 'r')
     content = "// CHECKSTYLE:OFF Generated code\n"
@@ -45,10 +45,22 @@
         line = line.replace('setSharedElementEnterTransition(sharedElementTransition)', 'setSharedElementEnterTransition((android.transition.Transition) sharedElementTransition)');
         line = line.replace('setExitTransition(exitTransition)', 'setExitTransition((android.transition.Transition) exitTransition)');
         line = line.replace('requestPermissions(new', 'PermissionHelper.requestPermissions(SearchFragment.this, new');
+
         # replace getContext() with FragmentUtil.getContext(XXXFragment.this), but dont match the case "view.getContext()"
         line = re.sub(r'([^\.])getContext\(\)', r'\1FragmentUtil.getContext({}Fragment.this)'.format(w), line);
         content = content + line
     file.close()
+
+    # treat different Nullable for onCreateView
+    content = re.sub(
+        'View onCreateView\(@NonNull LayoutInflater ([a-zA-Z]+),\s*@Nullable ViewGroup ([a-zA-Z]+),\s*@Nullable Bundle ([a-zA-Z]+)',
+        r'View onCreateView(LayoutInflater \1, @Nullable ViewGroup \2, Bundle \3', content)
+
+    # treat different Nullable for onSaveInstance
+    content = re.sub(
+        'void onSaveInstanceState\(@NonNull Bundle ([a-zA-Z]+)\)',
+        r'void onSaveInstanceState(Bundle \1)', content)
+
     # add deprecated tag to fragment class and inner classes/interfaces
     content = re.sub(r'\*\/\n(@.*\n|)(public |abstract public |abstract |)class', '* @deprecated use {@link ' + w + 'SupportFragment}\n */\n@Deprecated\n\\1\\2class', content)
     content = re.sub(r'\*\/\n    public (static class|interface|final static class|abstract static class)', '* @deprecated use {@link ' + w + 'SupportFragment}\n     */\n    @Deprecated\n    public \\1', content)
@@ -58,7 +70,7 @@
 
 
 
-print "copy VideoSupportFragmentGlueHost to VideoFragmentGlueHost"
+print("copy VideoSupportFragmentGlueHost to VideoFragmentGlueHost")
 file = open('src/main/java/androidx/leanback/app/VideoSupportFragmentGlueHost.java', 'r')
 content = "// CHECKSTYLE:OFF Generated code\n"
 content = content + "/* This file is auto-generated from VideoSupportFragmentGlueHost.java.  DO NOT MODIFY. */\n\n"
@@ -76,7 +88,7 @@
 
 
 
-print "copy PlaybackSupportFragmentGlueHost to PlaybackFragmentGlueHost"
+print("copy PlaybackSupportFragmentGlueHost to PlaybackFragmentGlueHost")
 file = open('src/main/java/androidx/leanback/app/PlaybackSupportFragmentGlueHost.java', 'r')
 content = "// CHECKSTYLE:OFF Generated code\n"
 content = content + "/* This file is auto-generated from {}PlaybackSupportFragmentGlueHost.java.  DO NOT MODIFY. */\n\n"
@@ -94,7 +106,7 @@
 
 
 
-print "copy DetailsSupportFragmentBackgroundController to DetailsFragmentBackgroundController"
+print("copy DetailsSupportFragmentBackgroundController to DetailsFragmentBackgroundController")
 file = open('src/main/java/androidx/leanback/app/DetailsSupportFragmentBackgroundController.java', 'r')
 content = "// CHECKSTYLE:OFF Generated code\n"
 content = content + "/* This file is auto-generated from {}DetailsSupportFragmentBackgroundController.java.  DO NOT MODIFY. */\n\n"
diff --git a/leanback/leanback/src/main/java/androidx/leanback/app/BaseRowFragment.java b/leanback/leanback/src/main/java/androidx/leanback/app/BaseRowFragment.java
index 4f512da..873c50a 100644
--- a/leanback/leanback/src/main/java/androidx/leanback/app/BaseRowFragment.java
+++ b/leanback/leanback/src/main/java/androidx/leanback/app/BaseRowFragment.java
@@ -67,8 +67,8 @@
     }
 
     @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container,
-            Bundle savedInstanceState) {
+    @Nullable
+    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
         View view = inflater.inflate(getLayoutResourceId(), container, false);
         mVerticalGridView = findGridViewFromRoot(view);
         if (mPendingTransitionPrepare) {
diff --git a/leanback/leanback/src/main/java/androidx/leanback/app/BaseRowSupportFragment.java b/leanback/leanback/src/main/java/androidx/leanback/app/BaseRowSupportFragment.java
index 7835125..de9ab85 100644
--- a/leanback/leanback/src/main/java/androidx/leanback/app/BaseRowSupportFragment.java
+++ b/leanback/leanback/src/main/java/androidx/leanback/app/BaseRowSupportFragment.java
@@ -62,8 +62,9 @@
     }
 
     @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container,
-            Bundle savedInstanceState) {
+    @Nullable
+    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
+            @Nullable Bundle savedInstanceState) {
         View view = inflater.inflate(getLayoutResourceId(), container, false);
         mVerticalGridView = findGridViewFromRoot(view);
         if (mPendingTransitionPrepare) {
diff --git a/leanback/leanback/src/main/java/androidx/leanback/app/BrandedFragment.java b/leanback/leanback/src/main/java/androidx/leanback/app/BrandedFragment.java
index 35bd583..9808ba9f 100644
--- a/leanback/leanback/src/main/java/androidx/leanback/app/BrandedFragment.java
+++ b/leanback/leanback/src/main/java/androidx/leanback/app/BrandedFragment.java
@@ -65,12 +65,13 @@
      * @param savedInstanceState If non-null, this fragment is being re-constructed
      *                           from a previous saved state as given here.
      * @return Title view which must have a descendant with id browse_title_group that implements
-     *         {@link TitleViewAdapter.Provider}, or null for no title view.
+     * {@link TitleViewAdapter.Provider}, or null for no title view.
      */
-    public View onInflateTitleView(LayoutInflater inflater, ViewGroup parent,
-                                Bundle savedInstanceState) {
+    @NonNull
+    public View onInflateTitleView(@NonNull LayoutInflater inflater, @Nullable ViewGroup parent,
+            @Nullable Bundle savedInstanceState) {
         TypedValue typedValue = new TypedValue();
-        boolean found = parent.getContext().getTheme().resolveAttribute(
+        boolean found = parent != null && parent.getContext().getTheme().resolveAttribute(
                 R.attr.browseTitleViewLayout, typedValue, true);
         return inflater.inflate(found ? typedValue.resourceId : R.layout.lb_browse_title,
                 parent, false);
@@ -85,8 +86,8 @@
      * @param savedInstanceState If non-null, this fragment is being re-constructed
      * from a previous saved state as given here.
      */
-    public void installTitleView(LayoutInflater inflater, ViewGroup parent,
-                            Bundle savedInstanceState) {
+    public void installTitleView(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent,
+            @Nullable Bundle savedInstanceState) {
         View titleLayoutRoot = onInflateTitleView(inflater, parent, savedInstanceState);
         if (titleLayoutRoot != null) {
             parent.addView(titleLayoutRoot);
@@ -100,7 +101,7 @@
      * Sets the view that implemented {@link TitleViewAdapter}.
      * @param titleView The view that implemented {@link TitleViewAdapter.Provider}.
      */
-    public void setTitleView(View titleView) {
+    public void setTitleView(@Nullable View titleView) {
         mTitleView = titleView;
         if (mTitleView == null) {
             mTitleViewAdapter = null;
@@ -125,6 +126,7 @@
      * Returns the view that implements {@link TitleViewAdapter.Provider}.
      * @return The view that implements {@link TitleViewAdapter.Provider}.
      */
+    @Nullable
     public View getTitleView() {
         return mTitleView;
     }
@@ -133,6 +135,7 @@
      * Returns the {@link TitleViewAdapter} implemented by title view.
      * @return The {@link TitleViewAdapter} implemented by title view.
      */
+    @Nullable
     public TitleViewAdapter getTitleViewAdapter() {
         return mTitleViewAdapter;
     }
@@ -205,7 +208,7 @@
      *
      * @param drawable The Drawable to display in the fragment title.
      */
-    public void setBadgeDrawable(Drawable drawable) {
+    public void setBadgeDrawable(@Nullable Drawable drawable) {
         if (mBadgeDrawable != drawable) {
             mBadgeDrawable = drawable;
             if (mTitleViewAdapter != null) {
@@ -218,6 +221,7 @@
      * Returns the badge drawable used in the fragment title.
      * @return The badge drawable used in the fragment title.
      */
+    @Nullable
     public Drawable getBadgeDrawable() {
         return mBadgeDrawable;
     }
@@ -227,7 +231,7 @@
      *
      * @param title The title text of the fragment.
      */
-    public void setTitle(CharSequence title) {
+    public void setTitle(@Nullable CharSequence title) {
         mTitle = title;
         if (mTitleViewAdapter != null) {
             mTitleViewAdapter.setTitle(title);
@@ -238,6 +242,7 @@
      * Returns the title text for the fragment.
      * @return Title text for the fragment.
      */
+    @Nullable
     public CharSequence getTitle() {
         return mTitle;
     }
@@ -254,7 +259,7 @@
      *
      * @param listener The listener to call when the search element is clicked.
      */
-    public void setOnSearchClickedListener(View.OnClickListener listener) {
+    public void setOnSearchClickedListener(@Nullable View.OnClickListener listener) {
         mExternalOnSearchClickedListener = listener;
         if (mTitleViewAdapter != null) {
             mTitleViewAdapter.setOnSearchClickedListener(listener);
@@ -267,7 +272,7 @@
      *
      * @param colors Colors used to draw search affordance.
      */
-    public void setSearchAffordanceColors(SearchOrbView.Colors colors) {
+    public void setSearchAffordanceColors(@NonNull SearchOrbView.Colors colors) {
         mSearchAffordanceColors = colors;
         mSearchAffordanceColorSet = true;
         if (mTitleViewAdapter != null) {
@@ -279,6 +284,7 @@
      * Returns the {@link androidx.leanback.widget.SearchOrbView.Colors}
      * used to draw the search affordance.
      */
+    @Nullable
     public SearchOrbView.Colors getSearchAffordanceColors() {
         if (mSearchAffordanceColorSet) {
             return mSearchAffordanceColors;
diff --git a/leanback/leanback/src/main/java/androidx/leanback/app/BrowseFragment.java b/leanback/leanback/src/main/java/androidx/leanback/app/BrowseFragment.java
index b9d9bce..66303bc 100644
--- a/leanback/leanback/src/main/java/androidx/leanback/app/BrowseFragment.java
+++ b/leanback/leanback/src/main/java/androidx/leanback/app/BrowseFragment.java
@@ -1269,8 +1269,8 @@
     }
 
     @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container,
-            Bundle savedInstanceState) {
+    @Nullable
+    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
 
         if (getChildFragmentManager().findFragmentById(R.id.scale_frame) == null) {
             mHeadersFragment = onCreateHeadersFragment();
diff --git a/leanback/leanback/src/main/java/androidx/leanback/app/BrowseSupportFragment.java b/leanback/leanback/src/main/java/androidx/leanback/app/BrowseSupportFragment.java
index 2bf7689..d37752d 100644
--- a/leanback/leanback/src/main/java/androidx/leanback/app/BrowseSupportFragment.java
+++ b/leanback/leanback/src/main/java/androidx/leanback/app/BrowseSupportFragment.java
@@ -1246,8 +1246,9 @@
     }
 
     @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container,
-            Bundle savedInstanceState) {
+    @Nullable
+    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
+            @Nullable Bundle savedInstanceState) {
 
         if (getChildFragmentManager().findFragmentById(R.id.scale_frame) == null) {
             mHeadersSupportFragment = onCreateHeadersSupportFragment();
diff --git a/leanback/leanback/src/main/java/androidx/leanback/app/DetailsFragment.java b/leanback/leanback/src/main/java/androidx/leanback/app/DetailsFragment.java
index fd91afb..bf621a7 100644
--- a/leanback/leanback/src/main/java/androidx/leanback/app/DetailsFragment.java
+++ b/leanback/leanback/src/main/java/androidx/leanback/app/DetailsFragment.java
@@ -31,6 +31,8 @@
 import android.view.Window;
 
 import androidx.annotation.CallSuper;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
 import android.app.Fragment;
 import android.app.Activity;
 import android.app.FragmentTransaction;
@@ -477,8 +479,8 @@
     }
 
     @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container,
-            Bundle savedInstanceState) {
+    @Nullable
+    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
         mRootView = (BrowseFrameLayout) inflater.inflate(
                 R.layout.lb_details_fragment, container, false);
         mBackgroundView = mRootView.findViewById(R.id.details_background_view);
@@ -539,7 +541,7 @@
     }
 
     /**
-     * @deprecated override {@link #onInflateTitleView(LayoutInflater,ViewGroup,Bundle)} instead.
+     * @deprecated override {@link BrandedFragment#onInflateTitleView(LayoutInflater, ViewGroup, Bundle)} instead.
      */
     @Deprecated
     protected View inflateTitle(LayoutInflater inflater, ViewGroup parent,
@@ -548,8 +550,11 @@
     }
 
     @Override
-    public View onInflateTitleView(LayoutInflater inflater, ViewGroup parent,
-                                   Bundle savedInstanceState) {
+    public @NonNull View onInflateTitleView(
+            @NonNull LayoutInflater inflater,
+            @Nullable ViewGroup parent,
+            @Nullable Bundle savedInstanceState
+    ) {
         return inflateTitle(inflater, parent, savedInstanceState);
     }
 
diff --git a/leanback/leanback/src/main/java/androidx/leanback/app/DetailsSupportFragment.java b/leanback/leanback/src/main/java/androidx/leanback/app/DetailsSupportFragment.java
index f0c5a49..fa4c82b 100644
--- a/leanback/leanback/src/main/java/androidx/leanback/app/DetailsSupportFragment.java
+++ b/leanback/leanback/src/main/java/androidx/leanback/app/DetailsSupportFragment.java
@@ -474,8 +474,9 @@
     }
 
     @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container,
-            Bundle savedInstanceState) {
+    @Nullable
+    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
+            @Nullable Bundle savedInstanceState) {
         mRootView = (BrowseFrameLayout) inflater.inflate(
                 R.layout.lb_details_fragment, container, false);
         mBackgroundView = mRootView.findViewById(R.id.details_background_view);
diff --git a/leanback/leanback/src/main/java/androidx/leanback/app/ErrorFragment.java b/leanback/leanback/src/main/java/androidx/leanback/app/ErrorFragment.java
index 71d146c..d887e5f 100644
--- a/leanback/leanback/src/main/java/androidx/leanback/app/ErrorFragment.java
+++ b/leanback/leanback/src/main/java/androidx/leanback/app/ErrorFragment.java
@@ -29,6 +29,8 @@
 import android.widget.ImageView;
 import android.widget.TextView;
 
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
 import androidx.leanback.R;
 
 /**
@@ -73,7 +75,7 @@
      *
      * @param drawable The drawable used for the background.
      */
-    public void setBackgroundDrawable(Drawable drawable) {
+    public void setBackgroundDrawable(@Nullable Drawable drawable) {
         mBackgroundDrawable = drawable;
         if (drawable != null) {
             final int opacity = drawable.getOpacity();
@@ -87,6 +89,7 @@
     /**
      * Returns the background drawable.  May be null if a default is used.
      */
+    @Nullable
     public Drawable getBackgroundDrawable() {
         return mBackgroundDrawable;
     }
@@ -96,7 +99,7 @@
      *
      * @param drawable The drawable used for the error image.
      */
-    public void setImageDrawable(Drawable drawable) {
+    public void setImageDrawable(@Nullable Drawable drawable) {
         mDrawable = drawable;
         updateImageDrawable();
     }
@@ -104,6 +107,7 @@
     /**
      * Returns the drawable used for the error image.
      */
+    @Nullable
     public Drawable getImageDrawable() {
         return mDrawable;
     }
@@ -113,7 +117,7 @@
      *
      * @param message The error message.
      */
-    public void setMessage(CharSequence message) {
+    public void setMessage(@Nullable CharSequence message) {
         mMessage = message;
         updateMessage();
     }
@@ -121,6 +125,7 @@
     /**
      * Returns the error message.
      */
+    @Nullable
     public CharSequence getMessage() {
         return mMessage;
     }
@@ -130,7 +135,7 @@
      *
      * @param text The button text.
      */
-    public void setButtonText(String text) {
+    public void setButtonText(@Nullable String text) {
         mButtonText = text;
         updateButton();
     }
@@ -138,6 +143,7 @@
     /**
      * Returns the button text.
      */
+    @Nullable
     public String getButtonText() {
         return mButtonText;
     }
@@ -147,7 +153,7 @@
      *
      * @param clickListener The click listener for the button.
      */
-    public void setButtonClickListener(View.OnClickListener clickListener) {
+    public void setButtonClickListener(@Nullable View.OnClickListener clickListener) {
         mButtonClickListener = clickListener;
         updateButton();
     }
@@ -155,13 +161,14 @@
     /**
      * Returns the button click listener.
      */
+    @Nullable
     public View.OnClickListener getButtonClickListener() {
         return mButtonClickListener;
     }
 
     @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container,
-            Bundle savedInstanceState) {
+    @Nullable
+    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
         View root = inflater.inflate(R.layout.lb_error_fragment, container, false);
 
         mErrorFrame = (ViewGroup) root.findViewById(R.id.error_frame);
@@ -179,12 +186,18 @@
         updateButton();
 
         FontMetricsInt metrics = getFontMetricsInt(mTextView);
-        int underImageBaselineMargin = container.getResources().getDimensionPixelSize(
-                R.dimen.lb_error_under_image_baseline_margin);
+        int underImageBaselineMargin = 0;
+        if (container != null) {
+            underImageBaselineMargin = container.getResources().getDimensionPixelSize(
+                    R.dimen.lb_error_under_image_baseline_margin);
+        }
         setTopMargin(mTextView, underImageBaselineMargin + metrics.ascent);
 
-        int underMessageBaselineMargin = container.getResources().getDimensionPixelSize(
-                R.dimen.lb_error_under_message_baseline_margin);
+        int underMessageBaselineMargin = 0;
+        if (container != null) {
+            underMessageBaselineMargin = container.getResources().getDimensionPixelSize(
+                    R.dimen.lb_error_under_message_baseline_margin);
+        }
         setTopMargin(mButton, underMessageBaselineMargin - metrics.descent);
 
         return root;
diff --git a/leanback/leanback/src/main/java/androidx/leanback/app/ErrorSupportFragment.java b/leanback/leanback/src/main/java/androidx/leanback/app/ErrorSupportFragment.java
index b948fa1..e1afe1e 100644
--- a/leanback/leanback/src/main/java/androidx/leanback/app/ErrorSupportFragment.java
+++ b/leanback/leanback/src/main/java/androidx/leanback/app/ErrorSupportFragment.java
@@ -161,8 +161,8 @@
         return mButtonClickListener;
     }
 
-    @NonNull
     @Override
+    @Nullable
     public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
             @Nullable Bundle savedInstanceState) {
         View root = inflater.inflate(R.layout.lb_error_fragment, container, false);
diff --git a/leanback/leanback/src/main/java/androidx/leanback/app/GuidedStepFragment.java b/leanback/leanback/src/main/java/androidx/leanback/app/GuidedStepFragment.java
index 0d42f51..031433f9 100644
--- a/leanback/leanback/src/main/java/androidx/leanback/app/GuidedStepFragment.java
+++ b/leanback/leanback/src/main/java/androidx/leanback/app/GuidedStepFragment.java
@@ -34,6 +34,7 @@
 import android.widget.LinearLayout;
 
 import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
 import androidx.annotation.RestrictTo;
 import androidx.core.app.ActivityCompat;
 import android.app.Fragment;
@@ -144,8 +145,8 @@
  * @see GuidedActionsStylist
  * @deprecated use {@link GuidedStepSupportFragment}
  */
-@SuppressWarnings("HiddenSuperclass")
 @Deprecated
+@SuppressWarnings("HiddenSuperclass")
 public class GuidedStepFragment extends Fragment implements GuidedActionAdapter.FocusListener {
 
     private static final String TAG_LEAN_BACK_ACTIONS_FRAGMENT = "leanBackGuidedStepFragment";
@@ -247,9 +248,13 @@
      */
     @RestrictTo(LIBRARY_GROUP_PREFIX)
     public static class DummyFragment extends Fragment {
+        @NonNull
         @Override
-        public View onCreateView(LayoutInflater inflater, ViewGroup container,
-                Bundle savedInstanceState) {
+        public View onCreateView(
+                @NonNull LayoutInflater inflater,
+                @Nullable ViewGroup container,
+                @Nullable Bundle savedInstanceState
+        ) {
             final View v = new View(inflater.getContext());
             v.setVisibility(View.GONE);
             return v;
@@ -277,6 +282,7 @@
      * a basic GuidanceStylist.
      * @return The GuidanceStylist used in this fragment.
      */
+    @NonNull
     public GuidanceStylist onCreateGuidanceStylist() {
         return new GuidanceStylist();
     }
@@ -286,6 +292,7 @@
      * returns a basic GuidedActionsStylist.
      * @return The GuidedActionsStylist used in this fragment.
      */
+    @NonNull
     public GuidedActionsStylist onCreateActionsStylist() {
         return new GuidedActionsStylist();
     }
@@ -295,6 +302,7 @@
      * The default implementation returns a basic GuidedActionsStylist.
      * @return The GuidedActionsStylist used in this fragment.
      */
+    @NonNull
     public GuidedActionsStylist onCreateButtonActionsStylist() {
         GuidedActionsStylist stylist = new GuidedActionsStylist();
         stylist.setAsButtonActions();
@@ -319,7 +327,7 @@
      * @param savedInstanceState The saved instance state from onCreateView.
      * @return The Guidance object representing the information used to guide the user.
      */
-    public @NonNull Guidance onCreateGuidance(Bundle savedInstanceState) {
+    public @NonNull Guidance onCreateGuidance(@Nullable Bundle savedInstanceState) {
         return new Guidance("", "", "", null);
     }
 
@@ -329,7 +337,10 @@
      * @param actions A non-null, empty list ready to be populated.
      * @param savedInstanceState The saved instance state from onCreate.
      */
-    public void onCreateActions(@NonNull List actions, Bundle savedInstanceState) {
+    public void onCreateActions(
+            @NonNull List actions,
+            @Nullable Bundle savedInstanceState
+    ) {
     }
 
     /**
@@ -338,8 +349,10 @@
      * @param actions A non-null, empty list ready to be populated.
      * @param savedInstanceState The saved instance state from onCreate.
      */
-    public void onCreateButtonActions(@NonNull List actions,
-            Bundle savedInstanceState) {
+    public void onCreateButtonActions(
+            @NonNull List actions,
+            @Nullable Bundle savedInstanceState
+    ) {
     }
 
     /**
@@ -347,7 +360,7 @@
      * order to act on the user's decisions.
      * @param action The chosen action.
      */
-    public void onGuidedActionClicked(GuidedAction action) {
+    public void onGuidedActionClicked(@NonNull GuidedAction action) {
     }
 
     /**
@@ -357,7 +370,7 @@
      * @param action The chosen action.
      * @return true to collapse the sub actions list, false to keep it expanded.
      */
-    public boolean onSubGuidedActionClicked(GuidedAction action) {
+    public boolean onSubGuidedActionClicked(@NonNull GuidedAction action) {
         return true;
     }
 
@@ -381,7 +394,7 @@
      * @param action GuidedAction to expand.
      * @see #expandAction(GuidedAction, boolean)
      */
-    public void expandSubActions(GuidedAction action) {
+    public void expandSubActions(@NonNull GuidedAction action) {
         if (!action.hasSubActions()) {
             return;
         }
@@ -396,7 +409,7 @@
      * @param action GuidedAction to expand.
      * @param withTransition True to run transition animation, false otherwise.
      */
-    public void expandAction(GuidedAction action, boolean withTransition) {
+    public void expandAction(@NonNull GuidedAction action, boolean withTransition) {
         mActionsStylist.expandAction(action, withTransition);
     }
 
@@ -443,7 +456,7 @@
      * {@link #onGuidedActionEdited(GuidedAction)}.
      * @param action The action which has been canceled editing.
      */
-    public void onGuidedActionEditCanceled(GuidedAction action) {
+    public void onGuidedActionEditCanceled(@NonNull GuidedAction action) {
         onGuidedActionEdited(action);
     }
 
@@ -456,7 +469,7 @@
      * @return ID of the action will be focused or {@link GuidedAction#ACTION_ID_NEXT},
      * {@link GuidedAction#ACTION_ID_CURRENT}.
      */
-    public long onGuidedActionEditedAndProceed(GuidedAction action) {
+    public long onGuidedActionEditedAndProceed(@NonNull GuidedAction action) {
         onGuidedActionEdited(action);
         return GuidedAction.ACTION_ID_NEXT;
     }
@@ -467,9 +480,14 @@
      * transitions.  A backstack entry is added, so the fragment will be dismissed when BACK key
      * is pressed.
      * 
    - *
  • If current fragment on stack is GuidedStepFragment: assign {@link #UI_STYLE_REPLACE}
  • - *
  • If current fragment on stack is not GuidedStepFragment: assign - * {@link #UI_STYLE_ENTRANCE}
  • + *
  • + * If current fragment on stack is GuidedStepFragment: assign + * {@link #UI_STYLE_REPLACE} + *
  • + *
  • + * If current fragment on stack is not GuidedStepFragment: assign + * {@link #UI_STYLE_ENTRANCE} + *
  • *
*

* Note: currently fragments added using this method must be created programmatically rather @@ -478,7 +496,9 @@ * @param fragment The GuidedStepFragment to be inserted into the fragment stack. * @return The ID returned by the call FragmentTransaction.commit. */ - public static int add(FragmentManager fragmentManager, GuidedStepFragment fragment) { + public static int add( + @NonNull FragmentManager fragmentManager, + @NonNull GuidedStepFragment fragment) { return add(fragmentManager, fragment, android.R.id.content); } @@ -488,11 +508,16 @@ * transitions. A backstack entry is added, so the fragment will be dismissed when BACK key * is pressed. *

    - *
  • If current fragment on stack is GuidedStepFragment: assign {@link #UI_STYLE_REPLACE} and - * {@link #onAddSharedElementTransition(FragmentTransaction, GuidedStepFragment)} will be called - * to perform shared element transition between GuidedStepFragments.
  • - *
  • If current fragment on stack is not GuidedStepFragment: assign - * {@link #UI_STYLE_ENTRANCE}
  • + *
  • + * If current fragment on stack is GuidedStepFragment: assign + * {@link #UI_STYLE_REPLACE} and + * {@link #onAddSharedElementTransition(FragmentTransaction, GuidedStepFragment)} + * will be called to perform shared element transition between GuidedStepFragments. + *
  • + *
  • + * If current fragment on stack is not GuidedStepFragment: assign + * {@link #UI_STYLE_ENTRANCE} + *
  • *
*

* Note: currently fragments added using this method must be created programmatically rather @@ -502,7 +527,11 @@ * @param id The id of container to add GuidedStepFragment, can be android.R.id.content. * @return The ID returned by the call FragmentTransaction.commit. */ - public static int add(FragmentManager fragmentManager, GuidedStepFragment fragment, int id) { + public static int add( + @NonNull FragmentManager fragmentManager, + @NonNull GuidedStepFragment fragment, + int id + ) { GuidedStepFragment current = getCurrentGuidedStepFragment(fragmentManager); boolean inGuidedStep = current != null; if (IS_FRAMEWORK_FRAGMENT && Build.VERSION.SDK_INT >= 21 && Build.VERSION.SDK_INT < 23 @@ -535,8 +564,10 @@ * @param ft The FragmentTransaction to add shared element. * @param disappearing The disappearing fragment. */ - protected void onAddSharedElementTransition(FragmentTransaction ft, GuidedStepFragment - disappearing) { + protected void onAddSharedElementTransition( + @NonNull FragmentTransaction ft, + @NonNull GuidedStepFragment disappearing + ) { View fragmentView = disappearing.getView(); addNonNullSharedElementTransition(ft, fragmentView.findViewById( R.id.action_fragment_root), "action_fragment_root"); @@ -642,7 +673,11 @@ * @return The ID returned by the call FragmentTransaction.commit, or -1 there is already * GuidedStepFragment. */ - public static int addAsRoot(Activity activity, GuidedStepFragment fragment, int id) { + public static int addAsRoot( + @NonNull Activity activity, + @NonNull GuidedStepFragment fragment, + int id + ) { // Workaround b/23764120: call getDecorView() to force requestFeature of ActivityTransition. activity.getWindow().getDecorView(); FragmentManager fragmentManager = activity.getFragmentManager(); @@ -660,7 +695,10 @@ * Returns the current GuidedStepFragment on the fragment transaction stack. * @return The current GuidedStepFragment, if any, on the fragment transaction stack. */ - public static GuidedStepFragment getCurrentGuidedStepFragment(FragmentManager fm) { + @Nullable + public static GuidedStepFragment getCurrentGuidedStepFragment( + @NonNull FragmentManager fm + ) { Fragment f = fm.findFragmentByTag(TAG_LEAN_BACK_ACTIONS_FRAGMENT); if (f instanceof GuidedStepFragment) { return (GuidedStepFragment) f; @@ -672,6 +710,7 @@ * Returns the GuidanceStylist that displays guidance information for the user. * @return The GuidanceStylist for this fragment. */ + @NonNull public GuidanceStylist getGuidanceStylist() { return mGuidanceStylist; } @@ -680,6 +719,7 @@ * Returns the GuidedActionsStylist that displays the actions the user may take. * @return The GuidedActionsStylist for this fragment. */ + @NonNull public GuidedActionsStylist getGuidedActionsStylist() { return mActionsStylist; } @@ -688,6 +728,7 @@ * Returns the list of button GuidedActions that the user may take in this fragment. * @return The list of button GuidedActions for this fragment. */ + @NonNull public List getButtonActions() { return mButtonActions; } @@ -697,6 +738,7 @@ * @param id Id of the button action to search. * @return GuidedAction object or null if not found. */ + @Nullable public GuidedAction findButtonActionById(long id) { int index = findButtonActionPositionById(id); return index >= 0 ? mButtonActions.get(index) : null; @@ -722,6 +764,7 @@ * Returns the GuidedActionsStylist that displays the button actions the user may take. * @return The GuidedActionsStylist for this fragment. */ + @NonNull public GuidedActionsStylist getGuidedButtonActionsStylist() { return mButtonActionsStylist; } @@ -730,7 +773,7 @@ * Sets the list of button GuidedActions that the user may take in this fragment. * @param actions The list of button GuidedActions for this fragment. */ - public void setButtonActions(List actions) { + public void setButtonActions(@NonNull List actions) { mButtonActions = actions; if (mButtonAdapter != null) { mButtonAdapter.setActions(mButtonActions); @@ -754,6 +797,7 @@ * @return The View corresponding to the button action at the indicated position, or null if * that action is not currently onscreen. */ + @Nullable public View getButtonActionItemView(int position) { final RecyclerView.ViewHolder holder = mButtonActionsStylist.getActionsGridView() .findViewHolderForPosition(position); @@ -780,6 +824,7 @@ * Returns the list of GuidedActions that the user may take in this fragment. * @return The list of GuidedActions for this fragment. */ + @NonNull public List getActions() { return mActions; } @@ -789,6 +834,7 @@ * @param id Id of the action to search. * @return GuidedAction object or null if not found. */ + @Nullable public GuidedAction findActionById(long id) { int index = findActionPositionById(id); return index >= 0 ? mActions.get(index) : null; @@ -816,7 +862,7 @@ * * @param actions The list of GuidedActions for this fragment. */ - public void setActions(List actions) { + public void setActions(@NonNull List actions) { mActions = actions; if (mAdapter != null) { mAdapter.setActions(mActions); @@ -831,7 +877,7 @@ * * @param diffCallback DiffCallback used in {@link #setActions(List)}. */ - public void setActionsDiffCallback(DiffCallback diffCallback) { + public void setActionsDiffCallback(@Nullable DiffCallback diffCallback) { mAdapter.setDiffCallback(diffCallback); } @@ -852,6 +898,7 @@ * @return The View corresponding to the action at the indicated position, or null if that * action is not currently onscreen. */ + @Nullable public View getActionItemView(int position) { final RecyclerView.ViewHolder holder = mActionsStylist.getActionsGridView() .findViewHolderForPosition(position); @@ -961,8 +1008,12 @@ * @param savedInstanceState * @return Created background view or null if no background. */ - public View onCreateBackgroundView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { + @Nullable + public View onCreateBackgroundView( + @NonNull LayoutInflater inflater, + @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState + ) { return inflater.inflate(R.layout.lb_guidedstep_background, container, false); } @@ -1015,7 +1066,7 @@ * {@inheritDoc} */ @Override - public void onCreate(Bundle savedInstanceState) { + public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (DEBUG) Log.v(TAG, "onCreate"); @@ -1060,8 +1111,8 @@ * {@inheritDoc} */ @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { + @Nullable + public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { if (DEBUG) Log.v(TAG, "onCreateView"); resolveTheme(); @@ -1298,8 +1349,10 @@ * @param guidedStepFragmentClass Name of the Class of GuidedStepFragment to pop to. * @param flags Either 0 or {@link FragmentManager#POP_BACK_STACK_INCLUSIVE}. */ - public void popBackStackToGuidedStepFragment(Class guidedStepFragmentClass, - int flags) { + public void popBackStackToGuidedStepFragment( + @NonNull Class guidedStepFragmentClass, + int flags + ) { if (!GuidedStepFragment.class.isAssignableFrom(guidedStepFragmentClass)) { return; } @@ -1360,7 +1413,7 @@ * used to programmatically skip the extra click required to go into edit mode. This method * can be invoked in {@link #onCreateView(LayoutInflater, ViewGroup, Bundle)}. */ - public void openInEditMode(GuidedAction action) { + public void openInEditMode(@Nullable GuidedAction action) { mActionsStylist.openInEditMode(action); }

diff --git a/leanback/leanback/src/main/java/androidx/leanback/app/GuidedStepSupportFragment.java b/leanback/leanback/src/main/java/androidx/leanback/app/GuidedStepSupportFragment.java
index 3eecfb2..17ef924 100644
--- a/leanback/leanback/src/main/java/androidx/leanback/app/GuidedStepSupportFragment.java
+++ b/leanback/leanback/src/main/java/androidx/leanback/app/GuidedStepSupportFragment.java
@@ -1105,11 +1105,9 @@
     /**
      * {@inheritDoc}
      */
-    @Nullable
     @Override
-    public View onCreateView(
-            @NonNull LayoutInflater inflater,
-            @Nullable ViewGroup container,
+    @Nullable
+    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
             @Nullable Bundle savedInstanceState) {
         if (DEBUG) Log.v(TAG, "onCreateView");
 
diff --git a/leanback/leanback/src/main/java/androidx/leanback/app/OnboardingFragment.java b/leanback/leanback/src/main/java/androidx/leanback/app/OnboardingFragment.java
index ff14ba3..a0ec019 100644
--- a/leanback/leanback/src/main/java/androidx/leanback/app/OnboardingFragment.java
+++ b/leanback/leanback/src/main/java/androidx/leanback/app/OnboardingFragment.java
@@ -308,10 +308,9 @@
         }
     }
 
-    @Nullable
     @Override
-    public View onCreateView(LayoutInflater inflater, final ViewGroup container,
-            Bundle savedInstanceState) {
+    @Nullable
+    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
         resolveTheme();
         LayoutInflater localInflater = getThemeInflater(inflater);
         final ViewGroup view = (ViewGroup) localInflater.inflate(R.layout.lb_onboarding_fragment,
@@ -515,6 +514,7 @@
      * Returns the start button text if it's set through
      * {@link #setStartButtonText(CharSequence)}}. If no string was set, null is returned.
      */
+    @Nullable
     public final CharSequence getStartButtonText() {
         return mStartButtonText;
     }
@@ -525,7 +525,7 @@
      *
      * @param text the start button text
      */
-    public void setStartButtonText(CharSequence text) {
+    public void setStartButtonText(@Nullable CharSequence text) {
         mStartButtonText = text;
         mStartButtonTextSet = true;
         if (mStartButton != null) {
@@ -778,6 +778,7 @@
      * Provides the entry animation for description view. This allows users to override the
      * default fade and slide animation. Returning null will disable the animation.
      */
+    @NonNull
     protected Animator onCreateDescriptionAnimator() {
         return AnimatorInflater.loadAnimator(FragmentUtil.getContext(OnboardingFragment.this),
                 R.animator.lb_onboarding_description_enter);
@@ -787,6 +788,7 @@
      * Provides the entry animation for title view. This allows users to override the
      * default fade and slide animation. Returning null will disable the animation.
      */
+    @NonNull
     protected Animator onCreateTitleAnimator() {
         return AnimatorInflater.loadAnimator(FragmentUtil.getContext(OnboardingFragment.this),
                 R.animator.lb_onboarding_title_enter);
@@ -806,7 +808,7 @@
      *
      * @return The page count.
      */
-    abstract protected int getPageCount();
+    protected abstract int getPageCount();
 
     /**
      * Returns the title of the given page.
@@ -815,7 +817,8 @@
      *
      * @return The title of the page.
      */
-    abstract protected CharSequence getPageTitle(int pageIndex);
+    @Nullable
+    protected abstract CharSequence getPageTitle(int pageIndex);
 
     /**
      * Returns the description of the given page.
@@ -824,7 +827,8 @@
      *
      * @return The description of the page.
      */
-    abstract protected CharSequence getPageDescription(int pageIndex);
+    @Nullable
+    protected abstract CharSequence getPageDescription(int pageIndex);
 
     /**
      * Returns the index of the current page.
@@ -847,7 +851,10 @@
      * @return The background view for the onboarding screen, or {@code null}.
      */
     @Nullable
-    abstract protected View onCreateBackgroundView(LayoutInflater inflater, ViewGroup container);
+    protected abstract View onCreateBackgroundView(
+            @NonNull LayoutInflater inflater,
+            @NonNull ViewGroup container
+    );
 
     /**
      * Called to have the inherited class create content view. This is optional and the fragment
@@ -863,7 +870,10 @@
      * @return The content view for the onboarding screen, or {@code null}.
      */
     @Nullable
-    abstract protected View onCreateContentView(LayoutInflater inflater, ViewGroup container);
+    protected abstract View onCreateContentView(
+            @NonNull LayoutInflater inflater,
+            @NonNull ViewGroup container
+    );
 
     /**
      * Called to have the inherited class create foreground view. This is optional and the fragment
@@ -879,7 +889,10 @@
      * @return The foreground view for the onboarding screen, or {@code null}.
      */
     @Nullable
-    abstract protected View onCreateForegroundView(LayoutInflater inflater, ViewGroup container);
+    protected abstract View onCreateForegroundView(
+            @NonNull LayoutInflater inflater,
+            @NonNull ViewGroup container
+    );
 
     /**
      * Called when the onboarding flow finishes.
diff --git a/leanback/leanback/src/main/java/androidx/leanback/app/OnboardingSupportFragment.java b/leanback/leanback/src/main/java/androidx/leanback/app/OnboardingSupportFragment.java
index 00ceff8..92be32e 100644
--- a/leanback/leanback/src/main/java/androidx/leanback/app/OnboardingSupportFragment.java
+++ b/leanback/leanback/src/main/java/androidx/leanback/app/OnboardingSupportFragment.java
@@ -303,9 +303,9 @@
         }
     }
 
-    @Nullable
     @Override
-    public View onCreateView(@NonNull LayoutInflater inflater, final @Nullable ViewGroup container,
+    @Nullable
+    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
             @Nullable Bundle savedInstanceState) {
         resolveTheme();
         LayoutInflater localInflater = getThemeInflater(inflater);
diff --git a/leanback/leanback/src/main/java/androidx/leanback/app/PlaybackFragment.java b/leanback/leanback/src/main/java/androidx/leanback/app/PlaybackFragment.java
index efa6de9..952bd94 100644
--- a/leanback/leanback/src/main/java/androidx/leanback/app/PlaybackFragment.java
+++ b/leanback/leanback/src/main/java/androidx/leanback/app/PlaybackFragment.java
@@ -915,8 +915,8 @@
             };
 
     @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container,
-                             Bundle savedInstanceState) {
+    @Nullable
+    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
         mRootView = inflater.inflate(R.layout.lb_playback_fragment, container, false);
         mBackgroundView = mRootView.findViewById(R.id.playback_fragment_background);
         mRowsFragment = (RowsFragment) getChildFragmentManager().findFragmentById(
diff --git a/leanback/leanback/src/main/java/androidx/leanback/app/PlaybackSupportFragment.java b/leanback/leanback/src/main/java/androidx/leanback/app/PlaybackSupportFragment.java
index b9423b3..11aa41a 100644
--- a/leanback/leanback/src/main/java/androidx/leanback/app/PlaybackSupportFragment.java
+++ b/leanback/leanback/src/main/java/androidx/leanback/app/PlaybackSupportFragment.java
@@ -910,8 +910,9 @@
             };
 
     @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container,
-                             Bundle savedInstanceState) {
+    @Nullable
+    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
+                             @Nullable Bundle savedInstanceState) {
         mRootView = inflater.inflate(R.layout.lb_playback_fragment, container, false);
         mBackgroundView = mRootView.findViewById(R.id.playback_fragment_background);
         mRowsSupportFragment = (RowsSupportFragment) getChildFragmentManager().findFragmentById(
diff --git a/leanback/leanback/src/main/java/androidx/leanback/app/SearchFragment.java b/leanback/leanback/src/main/java/androidx/leanback/app/SearchFragment.java
index dc49c69..181c6e7 100644
--- a/leanback/leanback/src/main/java/androidx/leanback/app/SearchFragment.java
+++ b/leanback/leanback/src/main/java/androidx/leanback/app/SearchFragment.java
@@ -31,6 +31,8 @@
 import android.view.ViewGroup;
 import android.view.inputmethod.CompletionInfo;
 
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
 import android.app.Fragment;
 import androidx.leanback.R;
 import androidx.leanback.widget.BrowseFrameLayout;
@@ -294,8 +296,8 @@
     }
 
     @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container,
-                             Bundle savedInstanceState) {
+    @Nullable
+    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
         View root = inflater.inflate(R.layout.lb_search_fragment, container, false);
 
         BrowseFrameLayout searchFrame = root.findViewById(R.id.lb_search_frame);
diff --git a/leanback/leanback/src/main/java/androidx/leanback/app/SearchSupportFragment.java b/leanback/leanback/src/main/java/androidx/leanback/app/SearchSupportFragment.java
index 3c3a515..17ffd88 100644
--- a/leanback/leanback/src/main/java/androidx/leanback/app/SearchSupportFragment.java
+++ b/leanback/leanback/src/main/java/androidx/leanback/app/SearchSupportFragment.java
@@ -28,6 +28,8 @@
 import android.view.ViewGroup;
 import android.view.inputmethod.CompletionInfo;
 
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
 import androidx.fragment.app.Fragment;
 import androidx.leanback.R;
 import androidx.leanback.widget.BrowseFrameLayout;
@@ -289,8 +291,9 @@
     }
 
     @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container,
-                             Bundle savedInstanceState) {
+    @Nullable
+    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
+            @Nullable Bundle savedInstanceState) {
         View root = inflater.inflate(R.layout.lb_search_fragment, container, false);
 
         BrowseFrameLayout searchFrame = root.findViewById(R.id.lb_search_frame);
diff --git a/leanback/leanback/src/main/java/androidx/leanback/app/VerticalGridFragment.java b/leanback/leanback/src/main/java/androidx/leanback/app/VerticalGridFragment.java
index 73047073..85a8974 100644
--- a/leanback/leanback/src/main/java/androidx/leanback/app/VerticalGridFragment.java
+++ b/leanback/leanback/src/main/java/androidx/leanback/app/VerticalGridFragment.java
@@ -22,6 +22,8 @@
 import android.view.View;
 import android.view.ViewGroup;
 
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
 import androidx.leanback.R;
 import androidx.leanback.transition.TransitionHelper;
 import androidx.leanback.util.StateMachine.State;
@@ -81,7 +83,7 @@
     /**
      * Sets the grid presenter.
      */
-    public void setGridPresenter(VerticalGridPresenter gridPresenter) {
+    public void setGridPresenter(@NonNull VerticalGridPresenter gridPresenter) {
         if (gridPresenter == null) {
             throw new IllegalArgumentException("Grid presenter may not be null");
         }
@@ -95,6 +97,7 @@
     /**
      * Returns the grid presenter.
      */
+    @Nullable
     public VerticalGridPresenter getGridPresenter() {
         return mGridPresenter;
     }
@@ -102,7 +105,7 @@
     /**
      * Sets the object adapter for the fragment.
      */
-    public void setAdapter(ObjectAdapter adapter) {
+    public void setAdapter(@Nullable ObjectAdapter adapter) {
         mAdapter = adapter;
         updateAdapter();
     }
@@ -110,6 +113,7 @@
     /**
      * Returns the object adapter.
      */
+    @Nullable
     public ObjectAdapter getAdapter() {
         return mAdapter;
     }
@@ -132,7 +136,12 @@
     final private OnChildLaidOutListener mChildLaidOutListener =
             new OnChildLaidOutListener() {
         @Override
-        public void onChildLaidOut(ViewGroup parent, View view, int position, long id) {
+        public void onChildLaidOut(
+                @NonNull ViewGroup parent,
+                @NonNull View view,
+                int position,
+                long id
+        ) {
             if (position == 0) {
                 showOrHideTitle();
             }
@@ -142,7 +151,7 @@
     /**
      * Sets an item selection listener.
      */
-    public void setOnItemViewSelectedListener(OnItemViewSelectedListener listener) {
+    public void setOnItemViewSelectedListener(@Nullable OnItemViewSelectedListener listener) {
         mOnItemViewSelectedListener = listener;
     }
 
@@ -168,7 +177,7 @@
     /**
      * Sets an item clicked listener.
      */
-    public void setOnItemViewClickedListener(OnItemViewClickedListener listener) {
+    public void setOnItemViewClickedListener(@Nullable OnItemViewClickedListener listener) {
         mOnItemViewClickedListener = listener;
         if (mGridPresenter != null) {
             mGridPresenter.setOnItemViewClickedListener(mOnItemViewClickedListener);
@@ -178,13 +187,14 @@
     /**
      * Returns the item clicked listener.
      */
+    @Nullable
     public OnItemViewClickedListener getOnItemViewClickedListener() {
         return mOnItemViewClickedListener;
     }
 
     @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container,
-            Bundle savedInstanceState) {
+    @Nullable
+    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
         ViewGroup root = (ViewGroup) inflater.inflate(R.layout.lb_vertical_grid_fragment,
                 container, false);
         ViewGroup gridFrame = (ViewGroup) root.findViewById(R.id.grid_frame);
@@ -247,13 +257,14 @@
     }
 
     @Override
+    @NonNull
     protected Object createEntranceTransition() {
         return TransitionHelper.loadTransition(FragmentUtil.getContext(VerticalGridFragment.this),
                 R.transition.lb_vertical_grid_entrance_transition);
     }
 
     @Override
-    protected void runEntranceTransition(Object entranceTransition) {
+    protected void runEntranceTransition(@Nullable Object entranceTransition) {
         TransitionHelper.runTransition(mSceneAfterEntranceTransition, entranceTransition);
     }
 
diff --git a/leanback/leanback/src/main/java/androidx/leanback/app/VerticalGridSupportFragment.java b/leanback/leanback/src/main/java/androidx/leanback/app/VerticalGridSupportFragment.java
index 764f988..4189876 100644
--- a/leanback/leanback/src/main/java/androidx/leanback/app/VerticalGridSupportFragment.java
+++ b/leanback/leanback/src/main/java/androidx/leanback/app/VerticalGridSupportFragment.java
@@ -188,7 +188,7 @@
     }
 
     @Override
-    @NonNull
+    @Nullable
     public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
             @Nullable Bundle savedInstanceState) {
         ViewGroup root = (ViewGroup) inflater.inflate(R.layout.lb_vertical_grid_fragment,
diff --git a/leanback/leanback/src/main/java/androidx/leanback/app/VideoFragment.java b/leanback/leanback/src/main/java/androidx/leanback/app/VideoFragment.java
index 2623fd6..125240d5 100644
--- a/leanback/leanback/src/main/java/androidx/leanback/app/VideoFragment.java
+++ b/leanback/leanback/src/main/java/androidx/leanback/app/VideoFragment.java
@@ -23,6 +23,8 @@
 import android.view.View;
 import android.view.ViewGroup;
 
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
 import androidx.leanback.R;
 
 /**
@@ -43,8 +45,8 @@
     int mState = SURFACE_NOT_CREATED;
 
     @Override
-    public View onCreateView(
-            LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+    @Nullable
+    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
         ViewGroup root = (ViewGroup) super.onCreateView(inflater, container, savedInstanceState);
         mVideoSurface = (SurfaceView) LayoutInflater.from(FragmentUtil.getContext(VideoFragment.this)).inflate(
                 R.layout.lb_video_surface, root, false);
diff --git a/leanback/leanback/src/main/java/androidx/leanback/app/VideoSupportFragment.java b/leanback/leanback/src/main/java/androidx/leanback/app/VideoSupportFragment.java
index ca286a4..2a79f91 100644
--- a/leanback/leanback/src/main/java/androidx/leanback/app/VideoSupportFragment.java
+++ b/leanback/leanback/src/main/java/androidx/leanback/app/VideoSupportFragment.java
@@ -20,6 +20,8 @@
 import android.view.View;
 import android.view.ViewGroup;
 
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
 import androidx.leanback.R;
 
 /**
@@ -38,8 +40,9 @@
     int mState = SURFACE_NOT_CREATED;
 
     @Override
-    public View onCreateView(
-            LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+    @Nullable
+    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
+            @Nullable Bundle savedInstanceState) {
         ViewGroup root = (ViewGroup) super.onCreateView(inflater, container, savedInstanceState);
         mVideoSurface = (SurfaceView) LayoutInflater.from(getContext()).inflate(
                 R.layout.lb_video_surface, root, false);
diff --git a/leanback/leanback/src/main/java/androidx/leanback/widget/GuidedActionAppCompatEditText.java b/leanback/leanback/src/main/java/androidx/leanback/widget/GuidedActionAppCompatEditText.java
new file mode 100644
index 0000000..0fc46c2
--- /dev/null
+++ b/leanback/leanback/src/main/java/androidx/leanback/widget/GuidedActionAppCompatEditText.java
@@ -0,0 +1,145 @@
+/*
+ * Copyright (C) 2023 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 androidx.leanback.widget;
+
+import android.content.Context;
+import android.graphics.Rect;
+import android.graphics.drawable.Drawable;
+import android.util.AttributeSet;
+import android.view.ActionMode;
+import android.view.KeyEvent;
+import android.view.MotionEvent;
+import android.view.accessibility.AccessibilityNodeInfo;
+import android.view.autofill.AutofillValue;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.annotation.RequiresApi;
+import androidx.appcompat.widget.AppCompatEditText;
+import androidx.core.widget.TextViewCompat;
+
+/**
+ * A custom EditText that satisfies the IME key monitoring requirements of GuidedStepFragment.
+ */
+public class GuidedActionAppCompatEditText extends AppCompatEditText implements ImeKeyMonitor,
+        GuidedActionAutofillSupport {
+
+    private ImeKeyListener mKeyListener;
+    private OnAutofillListener mAutofillListener;
+    private final Drawable mSavedBackground;
+    private final Drawable mNoPaddingDrawable;
+
+    public GuidedActionAppCompatEditText(@NonNull Context ctx) {
+        this(ctx, null);
+    }
+
+    public GuidedActionAppCompatEditText(@NonNull Context ctx, @Nullable AttributeSet attrs) {
+        this(ctx, attrs, android.R.attr.editTextStyle);
+    }
+
+    public GuidedActionAppCompatEditText(@NonNull Context ctx, @Nullable AttributeSet attrs,
+            int defStyleAttr) {
+        super(ctx, attrs, defStyleAttr);
+        mSavedBackground = getBackground();
+        mNoPaddingDrawable = new GuidedActionEditText.NoPaddingDrawable();
+        setBackground(mNoPaddingDrawable);
+    }
+
+    @Override
+    public void setImeKeyListener(@Nullable ImeKeyListener listener) {
+        mKeyListener = listener;
+    }
+
+    @Override
+    public boolean onKeyPreIme(int keyCode, @Nullable KeyEvent event) {
+        boolean result = false;
+        if (mKeyListener != null) {
+            result = mKeyListener.onKeyPreIme(this, keyCode, event);
+        }
+        if (!result) {
+            result = super.onKeyPreIme(keyCode, event);
+        }
+        return result;
+    }
+
+    @Override
+    public void onInitializeAccessibilityNodeInfo(@Nullable AccessibilityNodeInfo info) {
+        super.onInitializeAccessibilityNodeInfo(info);
+        info.setClassName(isFocused()
+                ? AppCompatEditText.class.getName() : TextView.class.getName());
+    }
+
+    @Override
+    protected void onFocusChanged(boolean focused, int direction,
+            @Nullable Rect previouslyFocusedRect) {
+        super.onFocusChanged(focused, direction, previouslyFocusedRect);
+        if (focused) {
+            setBackground(mSavedBackground);
+        } else {
+            setBackground(mNoPaddingDrawable);
+        }
+        // Make the TextView focusable during editing, avoid the TextView gets accessibility focus
+        // before editing started. See also GuidedActionAdapterGroup where setFocusable(true).
+        if (!focused) {
+            setFocusable(false);
+        }
+    }
+
+    @RequiresApi(26)
+    @Override
+    public int getAutofillType() {
+        // Make it always autofillable as Guided fragment switches InputType when user clicks
+        // on the field.
+        return AUTOFILL_TYPE_TEXT;
+    }
+
+    @Override
+    public void setOnAutofillListener(@Nullable OnAutofillListener autofillListener) {
+        mAutofillListener = autofillListener;
+    }
+
+    @Override
+    public void autofill(@Nullable AutofillValue values) {
+        super.autofill(values);
+        if (mAutofillListener != null) {
+            mAutofillListener.onAutofill(this);
+        }
+    }
+
+    /**
+     * See
+     * {@link TextViewCompat#setCustomSelectionActionModeCallback(TextView, ActionMode.Callback)}
+     */
+    @Override
+    public void setCustomSelectionActionModeCallback(
+            @Nullable ActionMode.Callback actionModeCallback) {
+        super.setCustomSelectionActionModeCallback(TextViewCompat
+                .wrapCustomSelectionActionModeCallback(this, actionModeCallback));
+    }
+
+    @Override
+    public boolean onTouchEvent(@Nullable MotionEvent event) {
+        // b/143562736 when in touch screen mode, if the EditText is not focusable
+        // and not text selectable, it does not need TouchEvent; let parent handle TouchEvent,
+        // e.g. receives onClick event.
+        if (isInTouchMode() && !isFocusableInTouchMode() && !isTextSelectable()) {
+            return false;
+        }
+        return super.onTouchEvent(event);
+    }
+}
diff --git a/leanback/leanback/src/main/java/androidx/leanback/widget/GuidedActionEditText.java b/leanback/leanback/src/main/java/androidx/leanback/widget/GuidedActionEditText.java
index 4020298..49606dc 100644
--- a/leanback/leanback/src/main/java/androidx/leanback/widget/GuidedActionEditText.java
+++ b/leanback/leanback/src/main/java/androidx/leanback/widget/GuidedActionEditText.java
@@ -26,17 +26,18 @@
 import android.view.MotionEvent;
 import android.view.accessibility.AccessibilityNodeInfo;
 import android.view.autofill.AutofillValue;
+import android.widget.EditText;
 import android.widget.TextView;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.RequiresApi;
-import androidx.appcompat.widget.AppCompatEditText;
 import androidx.core.widget.TextViewCompat;
 
 /**
  * A custom EditText that satisfies the IME key monitoring requirements of GuidedStepFragment.
  */
-public class GuidedActionEditText extends AppCompatEditText implements ImeKeyMonitor,
+@SuppressLint("AppCompatCustomView")
+public class GuidedActionEditText extends EditText implements ImeKeyMonitor,
         GuidedActionAutofillSupport {
 
     /**
@@ -108,8 +109,7 @@
     @Override
     public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
         super.onInitializeAccessibilityNodeInfo(info);
-        info.setClassName(isFocused() ?
-                AppCompatEditText.class.getName() : TextView.class.getName());
+        info.setClassName(isFocused() ? EditText.class.getName() : TextView.class.getName());
     }
 
     @Override
@@ -121,7 +121,7 @@
             setBackground(mNoPaddingDrawable);
         }
         // Make the TextView focusable during editing, avoid the TextView gets accessibility focus
-        // before editing started. see also GuidedActionAdapterGroup where setFocusable(true).
+        // before editing started. See also GuidedActionAdapterGroup where setFocusable(true).
         if (!focused) {
             setFocusable(false);
         }
@@ -130,7 +130,7 @@
     @RequiresApi(26)
     @Override
     public int getAutofillType() {
-        // make it always autofillable as Guided fragment switches InputType when user clicks
+        // Make it always autofillable as Guided fragment switches InputType when user clicks
         // on the field.
         return AUTOFILL_TYPE_TEXT;
     }
diff --git a/leanback/leanback/src/main/java/androidx/leanback/widget/LeanbackAppCompatViewInflater.java b/leanback/leanback/src/main/java/androidx/leanback/widget/LeanbackAppCompatViewInflater.java
new file mode 100644
index 0000000..1993c8d
--- /dev/null
+++ b/leanback/leanback/src/main/java/androidx/leanback/widget/LeanbackAppCompatViewInflater.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2023 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 androidx.leanback.widget;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.View;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatViewInflater;
+
+/** Inflater that converts leanback non-AppCpmpat views in layout to AppCompat versions. */
+public class LeanbackAppCompatViewInflater extends AppCompatViewInflater {
+
+    @Override
+    @NonNull
+    protected View createView(@Nullable Context context, @Nullable String name,
+            @Nullable AttributeSet attrs) {
+        switch (name) {
+            case "androidx.leanback.widget.GuidedActionEditText":
+                return new GuidedActionAppCompatEditText(context, attrs);
+        }
+        return null;
+    }
+
+}
diff --git a/leanback/leanback/src/main/res/values-v18/themes_appcompat.xml b/leanback/leanback/src/main/res/values-v18/themes_appcompat.xml
index 873a34c..4a6496c 100644
--- a/leanback/leanback/src/main/res/values-v18/themes_appcompat.xml
+++ b/leanback/leanback/src/main/res/values-v18/themes_appcompat.xml
@@ -18,6 +18,7 @@