|
27 | 27 | import android.content.SharedPreferences ;
|
28 | 28 | import android.content.pm.LauncherActivityInfo ;
|
29 | 29 | import android.content.pm.LauncherApps ;
|
| 30 | +import android.content.pm.PackageManager ; |
30 | 31 | import android.content.res.Resources ;
|
31 | 32 | import android.graphics.Bitmap ;
|
32 | 33 | import android.graphics.Canvas ;
|
@@ -110,6 +111,7 @@ public void update(Context context)
|
110 | 111 | // Retrieve the list of user profiles
|
111 | 112 | UserManager userManager = (UserManager)context.getSystemService(Context.USER_SERVICE) ;
|
112 | 113 | List<UserHandle> userProfiles = userManager.getUserProfiles() ;
|
| 114 | + PackageManager apkManager = context.getPackageManager() ; |
113 | 115 |
|
114 | 116 | // Browse all user profiles
|
115 | 117 | Drawable icon ;
|
@@ -137,6 +139,11 @@ public void update(Context context)
|
137 | 139 | if(color_tint == 0) icon = activity.getIcon(0) ;
|
138 | 140 | else icon = applyColorTint(resources, activity.getIcon(0), color_tint) ;
|
139 | 141 | }
|
| 142 | + |
| 143 | + // Add a badge to the chosen icon if the app is in a work profile |
| 144 | + if(userHandle != null) icon = apkManager.getUserBadgedIcon(icon, profile) ; |
| 145 | + |
| 146 | + // Resize the icon to the user-defined size |
140 | 147 | icon.setBounds(0, 0, icon_size, icon_size) ;
|
141 | 148 |
|
142 | 149 | // Check if the application is the launcher to provide menu access using its icon
|
|
0 commit comments