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

Commit 279b4136 authored by Carmen Jackson's avatar Carmen Jackson Committed by android-build-merger
Browse files

Merge "Pinner: Don't pin apps for work profile." into pi-dev am: 1f91ee38

am: f8f5704d

Change-Id: I79863dcc1111ea1fb6d590f55905709a1a7b7866
parents 88ee680e f8f5704d
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.