Merge "Add workaround to handle overlay package changes for non-primary users" into qt-dev

This commit is contained in:
Winson Chung
2019-05-21 05:58:33 +00:00
committed by Android (Google) Code Review
2 changed files with 19 additions and 11 deletions

View File

@@ -156,10 +156,7 @@ public class FragmentHostManager {
*/
protected void onConfigurationChanged(Configuration newConfig) {
if (mConfigChanges.applyNewConfig(mContext.getResources())) {
// Save the old state.
Parcelable p = destroyFragmentHost();
// Generate a new fragment host and restore its state.
createFragmentHost(p);
reloadFragments();
} else {
mFragments.dispatchConfigurationChanged(newConfig);
}
@@ -217,6 +214,13 @@ public class FragmentHostManager {
Dependency.get(FragmentService.class).removeAndDestroy(view);
}
public void reloadFragments() {
// Save the old state.
Parcelable p = destroyFragmentHost();
// Generate a new fragment host and restore its state.
createFragmentHost(p);
}
class HostCallbacks extends FragmentHostCallback<FragmentHostManager> {
public HostCallbacks() {
super(mContext, FragmentHostManager.this.mHandler, 0);
@@ -293,13 +297,6 @@ public class FragmentHostManager {
reloadFragments();
}
private void reloadFragments() {
// Save the old state.
Parcelable p = destroyFragmentHost();
// Generate a new fragment host and restore its state.
createFragmentHost(p);
}
Fragment instantiate(Context context, String className, Bundle arguments) {
Context extensionContext = mExtensionLookup.get(className);
if (extensionContext != null) {

View File

@@ -979,6 +979,17 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback
public void onNavigationModeChanged(int mode) {
mNavBarMode = mode;
updateScreenPinningGestures();
// Workaround for b/132825155, for secondary users, we currently don't receive configuration
// changes on overlay package change since SystemUI runs for the system user. In this case,
// trigger a new configuration change to ensure that the nav bar is updated in the same way.
int userId = ActivityManagerWrapper.getInstance().getCurrentUserId();
if (userId != UserHandle.USER_SYSTEM) {
mHandler.post(() -> {
FragmentHostManager fragmentHost = FragmentHostManager.get(mNavigationBarView);
fragmentHost.reloadFragments();
});
}
}
public void disableAnimationsDuringHide(long delay) {