Make work challenge settings work even work profile is not enabled yet
Bug: 29090660 Change-Id: I21996700f1ee451e8420f3f257c6ed51feea4ecb
This commit is contained in:
@@ -90,6 +90,7 @@ import android.view.animation.AnimationUtils;
|
|||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.TabWidget;
|
import android.widget.TabWidget;
|
||||||
import com.android.internal.app.UnlaunchableAppActivity;
|
import com.android.internal.app.UnlaunchableAppActivity;
|
||||||
|
import com.android.internal.util.ArrayUtils;
|
||||||
import com.android.internal.util.UserIcons;
|
import com.android.internal.util.UserIcons;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -1024,12 +1025,13 @@ public final class Utils extends com.android.settingslib.Utils {
|
|||||||
* @throws SecurityException if the given userId does not belong to the current user group.
|
* @throws SecurityException if the given userId does not belong to the current user group.
|
||||||
*/
|
*/
|
||||||
public static int enforceSameOwner(Context context, int userId) {
|
public static int enforceSameOwner(Context context, int userId) {
|
||||||
UserManager um = getUserManager(context);
|
final UserManager um = getUserManager(context);
|
||||||
if (!um.getUserProfiles().contains(new UserHandle(userId))) {
|
final int[] profileIds = um.getProfileIdsWithDisabled(UserHandle.myUserId());
|
||||||
throw new SecurityException("Given user id " + userId + " does not belong to user "
|
if (ArrayUtils.contains(profileIds, userId)) {
|
||||||
+ UserHandle.myUserId());
|
return userId;
|
||||||
}
|
}
|
||||||
return userId;
|
throw new SecurityException("Given user id " + userId + " does not belong to user "
|
||||||
|
+ UserHandle.myUserId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user