Merge "Add null check to getAppContentDescription" into mainline-prod
This commit is contained in:
committed by
Android (Google) Code Review
commit
227a23a81d
@@ -52,6 +52,9 @@ public class AppUtils {
|
|||||||
public static String getAppContentDescription(Context context, String packageName,
|
public static String getAppContentDescription(Context context, String packageName,
|
||||||
int userId) {
|
int userId) {
|
||||||
final CharSequence appLabel = getApplicationLabel(context.getPackageManager(), packageName);
|
final CharSequence appLabel = getApplicationLabel(context.getPackageManager(), packageName);
|
||||||
|
if (appLabel == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
return context.getSystemService(UserManager.class).isManagedProfile(userId)
|
return context.getSystemService(UserManager.class).isManagedProfile(userId)
|
||||||
? context.getString(R.string.accessibility_work_profile_app_description, appLabel)
|
? context.getString(R.string.accessibility_work_profile_app_description, appLabel)
|
||||||
: appLabel.toString();
|
: appLabel.toString();
|
||||||
|
|||||||
Reference in New Issue
Block a user