Merge "Avoid security exception when requesting badging"
This commit is contained in:
committed by
Android (Google) Code Review
commit
cc4e9e69d2
@@ -176,6 +176,9 @@ public class LauncherApps {
|
|||||||
*/
|
*/
|
||||||
public void startActivityForProfile(ComponentName component, Rect sourceBounds,
|
public void startActivityForProfile(ComponentName component, Rect sourceBounds,
|
||||||
Bundle opts, UserHandle user) {
|
Bundle opts, UserHandle user) {
|
||||||
|
if (DEBUG) {
|
||||||
|
Log.i(TAG, "StartActivityForProfile " + component + " " + user.getIdentifier());
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
mService.startActivityAsUser(component, sourceBounds, opts, user);
|
mService.startActivityAsUser(component, sourceBounds, opts, user);
|
||||||
} catch (RemoteException re) {
|
} catch (RemoteException re) {
|
||||||
|
|||||||
@@ -524,15 +524,14 @@ public class UserManager {
|
|||||||
|
|
||||||
private int getBadgeResIdForUser(int userHandle) {
|
private int getBadgeResIdForUser(int userHandle) {
|
||||||
// Return the framework-provided badge.
|
// Return the framework-provided badge.
|
||||||
if (userHandle == UserHandle.myUserId()) {
|
List<UserInfo> userProfiles = getProfiles(UserHandle.myUserId());
|
||||||
UserInfo user = getUserInfo(userHandle);
|
for (UserInfo user : userProfiles) {
|
||||||
/* TODO: Allow managed profiles for other users in the future */
|
if (user.id == userHandle
|
||||||
if (!user.isManagedProfile()
|
&& user.isManagedProfile()) {
|
||||||
|| user.profileGroupId != getUserInfo(UserHandle.USER_OWNER).profileGroupId) {
|
return com.android.internal.R.drawable.ic_corp_badge;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return com.android.internal.R.drawable.ic_corp_badge;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Drawable getMergedDrawable(Drawable icon, Drawable badge) {
|
private Drawable getMergedDrawable(Drawable icon, Drawable badge) {
|
||||||
|
|||||||
Reference in New Issue
Block a user