From cdbaea44865297a31a3c14c620c7e526c5765911 Mon Sep 17 00:00:00 2001 From: Jon Spivack Date: Mon, 17 May 2021 19:15:25 -0700 Subject: [PATCH] Disable NIU Actions on Work Profile apps If the currently selected Recent app belongs to a Work Profile, do not allow the user to invoke any of the overview actions. Instead, show the standard blocked by policy message (R.string.blocked_by_policy). Bug: 187491010 Test: Manual (Pixel 3A) Test: m -j RunLauncherGoGoogleRoboTests Change-Id: I552da9512ab19993eb4bb65fe9269d2aee9f0c4e --- .../src/com/android/quickstep/TaskOverlayFactoryGo.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java b/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java index 907767551c..117b8e6b92 100644 --- a/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java +++ b/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java @@ -27,6 +27,7 @@ import android.content.Intent; import android.graphics.Matrix; import android.net.Uri; import android.os.SystemClock; +import android.os.UserManager; import android.provider.Settings; import android.text.TextUtils; @@ -96,7 +97,10 @@ public final class TaskOverlayFactoryGo extends TaskOverlayFactory { } getActionsView().updateDisabledFlags(DISABLED_ROTATED, rotated); - boolean isAllowedByPolicy = mThumbnailView.isRealSnapshot(); + // Disable Overview Actions for Work Profile apps + boolean isManagedProfileTask = + UserManager.get(mApplicationContext).isManagedProfile(task.key.userId); + boolean isAllowedByPolicy = mThumbnailView.isRealSnapshot() && !isManagedProfileTask; getActionsView().setCallbacks(new OverlayUICallbacksGoImpl(isAllowedByPolicy, task)); mTaskPackageName = task.key.getPackageName(); @@ -127,8 +131,7 @@ public final class TaskOverlayFactoryGo extends TaskOverlayFactory { /** * Creates and sends an Intent corresponding to the button that was clicked */ - @VisibleForTesting - public void sendNIUIntent(String actionType) { + private void sendNIUIntent(String actionType) { Intent intent = createNIUIntent(actionType); // Only add and send the image if the appropriate permissions are held if (mAssistPermissionsEnabled) {