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

Commit 0ff9946a authored by Carmen Jackson's avatar Carmen Jackson
Browse files

Pinner: Don't pin apps for work profile.

Since the Home and Camera intents aren't set to relevant apps for the
work profile, we don't want to pin those. However, the pinner will
trigger on boot for the work profile, after the primary profile has
pinned, and clear the currently pinned apps to try to pin the work
profile apps. This change skips rerunning the pinner for the work
profile.

Bug: 112357464
Test: Added logging and tested device with a work profile. After reboot,
saw that the apps for the primary profile are pinned and the ones for
the work profile are not. Previously, apps for the work profile were
attempted to be pinned.
Change-Id: I0a7fdeab4287dcb6765c0fb47647ddc36db405b6
parent 4deb5938
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import android.os.Looper;
import android.os.Message;
import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.MediaStore;
import android.provider.Settings;
import android.system.ErrnoException;
@@ -104,6 +105,7 @@ public final class PinnerService extends SystemService {
    private final Context mContext;
    private final ActivityManagerInternal mAmInternal;
    private final IActivityManager mAm;
    private final UserManager mUserManager;

    /** The list of the statically pinned files. */
    @GuardedBy("this")
@@ -165,6 +167,8 @@ public final class PinnerService extends SystemService {
        mAmInternal = LocalServices.getService(ActivityManagerInternal.class);
        mAm = ActivityManager.getService();

        mUserManager = mContext.getSystemService(UserManager.class);

        IntentFilter filter = new IntentFilter();
        filter.addAction(Intent.ACTION_PACKAGE_REPLACED);
        filter.addDataScheme("package");
@@ -195,13 +199,17 @@ public final class PinnerService extends SystemService {
     */
    @Override
    public void onSwitchUser(int userHandle) {
        if (!mUserManager.isManagedProfile(userHandle)) {
            sendPinAppsMessage(userHandle);
        }
    }

    @Override
    public void onUnlockUser(int userHandle) {
        if (!mUserManager.isManagedProfile(userHandle)) {
            sendPinAppsMessage(userHandle);
        }
    }

    /**
     * Update the currently pinned files.