add null check to prevent NPE in logging app launch

Bug: 156458241
Test: manual
Change-Id: I7327453233a1e22473967e7c0513b4e1fa282459
This commit is contained in:
Pinyao Ting 2020-05-13 11:39:24 -07:00
parent 794ca4dba5
commit 44775ad756
1 changed files with 3 additions and 1 deletions

View File

@ -145,7 +145,9 @@ public class UserEventDispatcher implements ResourceBasedOverride {
LauncherEvent event = newLauncherEvent(action, targets);
ItemInfo info = v == null ? null : (ItemInfo) v.getTag();
if (info != null && Utilities.IS_DEBUG_DEVICE && FeatureFlags.ENABLE_HYBRID_HOTSEAT.get()) {
FileLog.d(TAG, "appLaunch: packageName:" + info.getTargetComponent().getPackageName()
final String pkg = info.getTargetComponent() != null
? info.getTargetComponent().getPackageName() : "unknown";
FileLog.d(TAG, "appLaunch: packageName:" + pkg
+ ",isWorkApp:" + (info.user != null && !Process.myUserHandle().equals(
userHandle)) + ",launchLocation:" + info.container);
}