Prevent orphaned fragment on the settings stack.
Remove the AppDetailsFragment from the stack if DataUsage is being destroyed. Bug: 5572241 Change-Id: Ifb2c9233bf75c8cc7b43eec5ea3f0c0b0ba65ffe
This commit is contained in:
@@ -49,6 +49,7 @@ import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.DialogFragment;
|
||||
import android.app.Fragment;
|
||||
import android.app.FragmentManager;
|
||||
import android.app.FragmentTransaction;
|
||||
import android.app.LoaderManager.LoaderCallbacks;
|
||||
import android.content.ContentResolver;
|
||||
@@ -518,6 +519,15 @@ public class DataUsageSummary extends Fragment {
|
||||
mUidDetailProvider = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if (this.isRemoving()) {
|
||||
getFragmentManager()
|
||||
.popBackStack(TAG_APP_DETAILS, FragmentManager.POP_BACK_STACK_INCLUSIVE);
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Listener to setup {@link LayoutTransition} after first layout pass.
|
||||
*/
|
||||
@@ -1502,7 +1512,6 @@ public class DataUsageSummary extends Fragment {
|
||||
final AppDetailsFragment fragment = new AppDetailsFragment();
|
||||
fragment.setArguments(args);
|
||||
fragment.setTargetFragment(parent, 0);
|
||||
|
||||
final FragmentTransaction ft = parent.getFragmentManager().beginTransaction();
|
||||
ft.add(fragment, TAG_APP_DETAILS);
|
||||
ft.addToBackStack(TAG_APP_DETAILS);
|
||||
|
Reference in New Issue
Block a user