[automerge] Add null checking to fix NullPointerException while creating mock tag 2p: d52c4c3e83

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17046201

Bug: 221452261
Change-Id: Ibd6b72aba6b8755d38524cda66ed5fce0f4c8aab
This commit is contained in:
chloedai
2022-03-07 03:08:43 +00:00
committed by Presubmit Automerger Backend

View File

@@ -142,9 +142,13 @@ public final class Tag implements Parcelable {
mTagService = tagService;
mConnectedTechnology = -1;
mCookie = SystemClock.elapsedRealtime();
if (tagService == null) {
return;
}
try {
mCookie = SystemClock.elapsedRealtime();
tagService.setTagUpToDate(mCookie);
} catch (RemoteException e) {
throw e.rethrowAsRuntimeException();
@@ -370,6 +374,10 @@ public final class Tag implements Parcelable {
/** @hide */
@UnsupportedAppUsage
public INfcTag getTagService() {
if (mTagService == null) {
return null;
}
try {
if (!mTagService.isTagUpToDate(mCookie)) {
String id_str = "";