Loading src/com/android/settings/applications/AppStateClonedAppsBridge.java +5 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,11 @@ public class AppStateClonedAppsBridge extends AppStateBaseBridge{ mCloneProfileApps = mContext.getPackageManager() .getInstalledPackagesAsUser(GET_ACTIVITIES, mCloneUserId).stream().map(x -> x.packageName).toList(); } else if (!mCloneProfileApps.isEmpty()) { // In case we remove clone profile (mCloneUserId becomes -1), the bridge state should // reflect the same by setting cloneProfileApps as empty, without building the entire // page. mCloneProfileApps = new ArrayList<>(); } final List<ApplicationsState.AppEntry> allApps = mAppSession.getAllApps(); Loading src/com/android/settings/applications/manageapplications/CloneBackend.java +9 −0 Original line number Diff line number Diff line Loading @@ -165,4 +165,13 @@ public class CloneBackend { public int getCloneUserId() { return mCloneUserId; } /** * Resets {@link #mCloneUserId} to -1. * Typically called after the cloneUser is removed, so that the obsolete clonedUserId present * with the CloneBackend instance can be cleared. */ public void resetCloneUserId() { mCloneUserId = -1; } } src/com/android/settings/applications/manageapplications/ManageApplications.java +7 −2 Original line number Diff line number Diff line Loading @@ -923,10 +923,15 @@ public class ManageApplications extends InstrumentedFragment } IUserManager um = IUserManager.Stub.asInterface( ServiceManager.getService(Context.USER_SERVICE)); CloneBackend cloneBackend = CloneBackend.getInstance(getContext()); try { // Warning: This removes all the data, media & images present in cloned user. um.removeUser(clonedUserId); if (um.removeUser(clonedUserId)) { cloneBackend.resetCloneUserId(); mApplications.rebuild(); } else if (ManageApplications.DEBUG) { Log.e(TAG, "Failed to remove cloned user"); } } catch (RemoteException e) { Log.e(TAG, "Failed to remove cloned apps", e); Toast.makeText(getContext(), Loading Loading
src/com/android/settings/applications/AppStateClonedAppsBridge.java +5 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,11 @@ public class AppStateClonedAppsBridge extends AppStateBaseBridge{ mCloneProfileApps = mContext.getPackageManager() .getInstalledPackagesAsUser(GET_ACTIVITIES, mCloneUserId).stream().map(x -> x.packageName).toList(); } else if (!mCloneProfileApps.isEmpty()) { // In case we remove clone profile (mCloneUserId becomes -1), the bridge state should // reflect the same by setting cloneProfileApps as empty, without building the entire // page. mCloneProfileApps = new ArrayList<>(); } final List<ApplicationsState.AppEntry> allApps = mAppSession.getAllApps(); Loading
src/com/android/settings/applications/manageapplications/CloneBackend.java +9 −0 Original line number Diff line number Diff line Loading @@ -165,4 +165,13 @@ public class CloneBackend { public int getCloneUserId() { return mCloneUserId; } /** * Resets {@link #mCloneUserId} to -1. * Typically called after the cloneUser is removed, so that the obsolete clonedUserId present * with the CloneBackend instance can be cleared. */ public void resetCloneUserId() { mCloneUserId = -1; } }
src/com/android/settings/applications/manageapplications/ManageApplications.java +7 −2 Original line number Diff line number Diff line Loading @@ -923,10 +923,15 @@ public class ManageApplications extends InstrumentedFragment } IUserManager um = IUserManager.Stub.asInterface( ServiceManager.getService(Context.USER_SERVICE)); CloneBackend cloneBackend = CloneBackend.getInstance(getContext()); try { // Warning: This removes all the data, media & images present in cloned user. um.removeUser(clonedUserId); if (um.removeUser(clonedUserId)) { cloneBackend.resetCloneUserId(); mApplications.rebuild(); } else if (ManageApplications.DEBUG) { Log.e(TAG, "Failed to remove cloned user"); } } catch (RemoteException e) { Log.e(TAG, "Failed to remove cloned apps", e); Toast.makeText(getContext(), Loading