Add null check to getAppContentDescription

Bug: 173798457
Test: atest LocationPermissionAppsFragmentTest
Change-Id: I547222211e99645443354bd262b6833990fc3792
This commit is contained in:
Nate Myren
2020-11-23 13:53:08 -08:00
parent d141faef24
commit d1dea94ffe

View File

@@ -52,6 +52,9 @@ public class AppUtils {
public static String getAppContentDescription(Context context, String packageName,
int userId) {
final CharSequence appLabel = getApplicationLabel(context.getPackageManager(), packageName);
if (appLabel == null) {
return "";
}
return context.getSystemService(UserManager.class).isManagedProfile(userId)
? context.getString(R.string.accessibility_work_profile_app_description, appLabel)
: appLabel.toString();