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

Commit 2c243ad3 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix the issue "Turn on work profile?" dialog not displayed for work...

Merge "Fix the issue "Turn on work profile?" dialog not displayed for work profile deep shortcuts when disabled." into ub-launcher3-rvc-dev
parents 3d0d2292 8e5db81c
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -235,7 +235,8 @@ public class LauncherModel extends LauncherApps.Callback implements InstallSessi
                // we need to run the state change task again.
                if (Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE.equals(action) ||
                        Intent.ACTION_MANAGED_PROFILE_UNLOCKED.equals(action)) {
                    enqueueModelUpdateTask(new UserLockStateChangedTask(user));
                    enqueueModelUpdateTask(new UserLockStateChangedTask(
                            user, Intent.ACTION_MANAGED_PROFILE_UNLOCKED.equals(action)));
                }
            }
        } else if (IS_STUDIO_BUILD && ACTION_FORCE_ROLOAD.equals(action)) {
+7 −7
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import static com.android.launcher3.ItemInfoWithIcon.FLAG_DISABLED_LOCKED_USER;
import android.content.Context;
import android.content.pm.ShortcutInfo;
import android.os.UserHandle;
import android.os.UserManager;

import com.android.launcher3.ItemInfo;
import com.android.launcher3.LauncherAppState;
@@ -43,18 +42,19 @@ import java.util.Iterator;
public class UserLockStateChangedTask extends BaseModelUpdateTask {

    private final UserHandle mUser;
    private boolean mIsUserUnlocked;

    public UserLockStateChangedTask(UserHandle user) {
    public UserLockStateChangedTask(UserHandle user, boolean isUserUnlocked) {
        mUser = user;
        mIsUserUnlocked = isUserUnlocked;
    }

    @Override
    public void execute(LauncherAppState app, BgDataModel dataModel, AllAppsList apps) {
        Context context = app.getContext();
        boolean isUserUnlocked = context.getSystemService(UserManager.class).isUserUnlocked(mUser);

        HashMap<ShortcutKey, ShortcutInfo> pinnedShortcuts = new HashMap<>();
        if (isUserUnlocked) {
        if (mIsUserUnlocked) {
            QueryResult shortcuts = new ShortcutRequest(context, mUser)
                    .query(ShortcutRequest.PINNED);
            if (shortcuts.wasSuccess()) {
@@ -65,7 +65,7 @@ public class UserLockStateChangedTask extends BaseModelUpdateTask {
                // Shortcut manager can fail due to some race condition when the lock state
                // changes too frequently. For the purpose of the update,
                // consider it as still locked.
                isUserUnlocked = false;
                mIsUserUnlocked = false;
            }
        }

@@ -77,7 +77,7 @@ public class UserLockStateChangedTask extends BaseModelUpdateTask {
            if (itemInfo.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT
                    && mUser.equals(itemInfo.user)) {
                WorkspaceItemInfo si = (WorkspaceItemInfo) itemInfo;
                if (isUserUnlocked) {
                if (mIsUserUnlocked) {
                    ShortcutKey key = ShortcutKey.fromItemInfo(si);
                    ShortcutInfo shortcut = pinnedShortcuts.get(key);
                    // We couldn't verify the shortcut during loader. If its no longer available
@@ -108,7 +108,7 @@ public class UserLockStateChangedTask extends BaseModelUpdateTask {
            }
        }

        if (isUserUnlocked) {
        if (mIsUserUnlocked) {
            dataModel.updateDeepShortcutCounts(
                    null, mUser,
                    new ShortcutRequest(context, mUser).query(ShortcutRequest.ALL));