From 3ea1acb8ca36571bdf42b441477ad8e460148a1f Mon Sep 17 00:00:00 2001 From: Oli Thompson Date: Mon, 13 May 2024 11:06:50 +0000 Subject: [PATCH] Show edu card when managed profile removed Reset the work edu card bit so the edu card shows if the managed profile is removed Also remove padding from the close button so it doesn't clip. screenshot https://screenshot.googleplex.com/96Yc6yExZ57btxG Bug: 315449027 Bug: 293642345 Test: manual Flag: NONE Change-Id: I60cfc0c258d28a6674aec41862c1770550a14955 --- res/layout/work_apps_edu.xml | 2 +- res/values/dimens.xml | 1 - src/com/android/launcher3/LauncherModel.java | 4 ++++ src/com/android/launcher3/pm/UserCache.java | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/res/layout/work_apps_edu.xml b/res/layout/work_apps_edu.xml index f557fb695c..99db8c6f41 100644 --- a/res/layout/work_apps_edu.xml +++ b/res/layout/work_apps_edu.xml @@ -50,9 +50,9 @@ android:id="@+id/action_btn" android:layout_width="@dimen/x_icon_size" android:layout_height="@dimen/x_icon_size" + android:scaleType="centerInside" android:layout_gravity="center" android:contentDescription="@string/accessibility_close" - android:padding="@dimen/x_icon_padding" android:background="@android:color/transparent" android:src="@drawable/ic_remove_no_shadow" /> diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 54edab469f..a75c989e7b 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -167,7 +167,6 @@ 24dp 16dp - 4dp 48dp diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java index e3da38937d..47a71152e0 100644 --- a/src/com/android/launcher3/LauncherModel.java +++ b/src/com/android/launcher3/LauncherModel.java @@ -19,6 +19,7 @@ package com.android.launcher3; import static android.app.admin.DevicePolicyManager.ACTION_DEVICE_POLICY_RESOURCE_UPDATED; import static com.android.launcher3.LauncherAppState.ACTION_FORCE_ROLOAD; +import static com.android.launcher3.LauncherPrefs.WORK_EDU_STEP; import static com.android.launcher3.config.FeatureFlags.IS_STUDIO_BUILD; import static com.android.launcher3.icons.cache.BaseIconCache.EMPTY_CLASS_NAME; import static com.android.launcher3.model.PackageUpdatedTask.OP_UPDATE; @@ -276,6 +277,9 @@ public class LauncherModel implements InstallSessionTracker.Callback { enqueueModelUpdateTask(new PackageUpdatedTask( PackageUpdatedTask.OP_USER_AVAILABILITY_CHANGE, user)); } + if (Intent.ACTION_MANAGED_PROFILE_REMOVED.equals(action)) { + LauncherPrefs.get(mApp.getContext()).put(WORK_EDU_STEP, 0); + } } /** diff --git a/src/com/android/launcher3/pm/UserCache.java b/src/com/android/launcher3/pm/UserCache.java index b7b557dbd4..ed25186da4 100644 --- a/src/com/android/launcher3/pm/UserCache.java +++ b/src/com/android/launcher3/pm/UserCache.java @@ -101,6 +101,7 @@ public class UserCache implements SafeCloseable { mUserChangeReceiver.register(mContext, Intent.ACTION_MANAGED_PROFILE_AVAILABLE, Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE, + Intent.ACTION_MANAGED_PROFILE_REMOVED, ACTION_PROFILE_ADDED, ACTION_PROFILE_REMOVED, ACTION_PROFILE_UNLOCKED,