Fix a race condition that causes BackAnimation to be null.
The race happens between attaching NavigationBarView and initializing
NavigationEdgeBackPlugin. When NavBarView is attached after the plugin
is initialized, the plugin doesn't receive the mBackAnimation instance
passed from NavBarView.
This caused the mBackAnimation to be null and broke back gesture on
tablets.
Bug: 220709601
Test: m -j. Test gesture back on tablets.
Change-Id: I8cf70a24ba5340d27bbd48a8e809d8f922992689
(cherry picked from commit 3d010dbc6d)
This commit is contained in:
@@ -936,6 +936,9 @@ public class EdgeBackGestureHandler extends CurrentUserTracker
|
||||
|
||||
public void setBackAnimation(BackAnimation backAnimation) {
|
||||
mBackAnimation = backAnimation;
|
||||
if (mEdgeBackPlugin != null && mEdgeBackPlugin instanceof NavigationBarEdgePanel) {
|
||||
((NavigationBarEdgePanel) mEdgeBackPlugin).setBackAnimation(backAnimation);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -280,7 +280,7 @@ public class NavigationBarEdgePanel extends View implements NavigationEdgeBackPl
|
||||
}
|
||||
};
|
||||
private BackCallback mBackCallback;
|
||||
private final BackAnimation mBackAnimation;
|
||||
private BackAnimation mBackAnimation;
|
||||
|
||||
public NavigationBarEdgePanel(Context context,
|
||||
BackAnimation backAnimation) {
|
||||
@@ -385,6 +385,10 @@ public class NavigationBarEdgePanel extends View implements NavigationEdgeBackPl
|
||||
mShowProtection = !isPrimaryDisplay;
|
||||
}
|
||||
|
||||
public void setBackAnimation(BackAnimation backAnimation) {
|
||||
mBackAnimation = backAnimation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
cancelFailsafe();
|
||||
|
||||
Reference in New Issue
Block a user