Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 56ee25a2 authored by Aditya's avatar Aditya
Browse files

Hide button to turn on paused profile.

Since DocsUi does not have the permission to receive profile
available/unavailable broadcasts when launched from a non-foreground
user profile, the button to turn on a paused profile (work profile) will
not be shown.

Bug: 363183071
Test: Manual, see screenshot
Screenshot: http://screen/6vYrpxdjremdib6
Flag: EXEMPT bugfix
Change-Id: I29364c8bdc5f1baed5d9ab54dc4e2e589c711936
parent 542ebaf9
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import static com.android.documentsui.DevicePolicyResources.Strings.WORK_PROFILE
import static com.android.documentsui.DevicePolicyResources.Strings.WORK_PROFILE_OFF_ERROR_TITLE;

import android.Manifest;
import android.app.ActivityManager;
import android.app.AuthenticationRequiredException;
import android.app.admin.DevicePolicyManager;
import android.content.pm.PackageManager;
@@ -242,6 +243,11 @@ abstract class Message {

        private boolean setCanModifyQuietMode() {
            if (SdkLevel.isAtLeastV() && mConfigStore.isPrivateSpaceInDocsUIEnabled()) {
                // Quite mode cannot be modified when DocsUi is launched from a non-foreground user
                if (UserId.CURRENT_USER.getIdentifier() != ActivityManager.getCurrentUser()) {
                    return false;
                }

                if (mUserManager == null) {
                    Log.e(TAG, "can not obtain user manager class");
                    return false;