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
This commit is contained in:
@@ -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,12 +199,16 @@ public final class PinnerService extends SystemService {
|
||||
*/
|
||||
@Override
|
||||
public void onSwitchUser(int userHandle) {
|
||||
sendPinAppsMessage(userHandle);
|
||||
if (!mUserManager.isManagedProfile(userHandle)) {
|
||||
sendPinAppsMessage(userHandle);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnlockUser(int userHandle) {
|
||||
sendPinAppsMessage(userHandle);
|
||||
if (!mUserManager.isManagedProfile(userHandle)) {
|
||||
sendPinAppsMessage(userHandle);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user