From f58acef107d008d77ac94ab736f2f45e1e182149 Mon Sep 17 00:00:00 2001 From: josephpv Date: Mon, 22 Apr 2024 21:49:41 +0000 Subject: [PATCH] Clear settings task on deleting private space When private space is deleted from private space settings launched from the All apps settings cog the settings sub activity is not cleared and visibile in recents. With this change it is taken care to remove and clear the sub settings task hosting the Private space settings page when private space does not exist and to make sure the activity is removed if it is the last activity in that stack. Bug: 333538964 Test: Manual Change-Id: I22ba8ca8d2947c6604280cf398cd47434038d542 --- .../settings/privatespace/PrivateSpaceDashboardFragment.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/privatespace/PrivateSpaceDashboardFragment.java b/src/com/android/settings/privatespace/PrivateSpaceDashboardFragment.java index 4e904d32bf9..ed70030c314 100644 --- a/src/com/android/settings/privatespace/PrivateSpaceDashboardFragment.java +++ b/src/com/android/settings/privatespace/PrivateSpaceDashboardFragment.java @@ -58,7 +58,8 @@ public class PrivateSpaceDashboardFragment extends DashboardFragment { public void onStart() { super.onStart(); if (PrivateSpaceMaintainer.getInstance(getContext()).isPrivateSpaceLocked()) { - finish(); + // To make sure the task is removed if it is the last activity in that stack. + getActivity().finishAndRemoveTask(); } }