Merge "Avoiding potential NPE when dumping to proto."

am: a52b601ef3

Change-Id: I9d5e520654877e6a46ea19ad3eddd3a901e58699
This commit is contained in:
Mike Ma
2018-09-11 18:26:45 -07:00
committed by android-build-merger
3 changed files with 12 additions and 5 deletions

View File

@@ -29,7 +29,6 @@ import android.os.Handler;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
import android.os.UserHandle;
import android.os.WorkSource;
import android.text.TextUtils;
import android.util.ArrayMap;
@@ -1150,7 +1149,9 @@ public class AlarmManager {
public void writeToProto(ProtoOutputStream proto, long fieldId) {
final long token = proto.start(fieldId);
proto.write(AlarmClockInfoProto.TRIGGER_TIME_MS, mTriggerTime);
mShowIntent.writeToProto(proto, AlarmClockInfoProto.SHOW_INTENT);
if (mShowIntent != null) {
mShowIntent.writeToProto(proto, AlarmClockInfoProto.SHOW_INTENT);
}
proto.end(token);
}
}

View File

@@ -1096,7 +1096,9 @@ public final class Configuration implements Parcelable, Comparable<Configuration
protoOutputStream.write(FONT_SCALE, fontScale);
protoOutputStream.write(MCC, mcc);
protoOutputStream.write(MNC, mnc);
mLocaleList.writeToProto(protoOutputStream, LOCALES);
if (mLocaleList != null) {
mLocaleList.writeToProto(protoOutputStream, LOCALES);
}
protoOutputStream.write(SCREEN_LAYOUT, screenLayout);
protoOutputStream.write(COLOR_MODE, colorMode);
protoOutputStream.write(TOUCHSCREEN, touchscreen);
@@ -1111,7 +1113,9 @@ public final class Configuration implements Parcelable, Comparable<Configuration
protoOutputStream.write(SCREEN_HEIGHT_DP, screenHeightDp);
protoOutputStream.write(SMALLEST_SCREEN_WIDTH_DP, smallestScreenWidthDp);
protoOutputStream.write(DENSITY_DPI, densityDpi);
windowConfiguration.writeToProto(protoOutputStream, WINDOW_CONFIGURATION);
if (windowConfiguration != null) {
windowConfiguration.writeToProto(protoOutputStream, WINDOW_CONFIGURATION);
}
protoOutputStream.end(token);
}

View File

@@ -386,7 +386,9 @@ public final class Looper {
final long looperToken = proto.start(fieldId);
proto.write(LooperProto.THREAD_NAME, mThread.getName());
proto.write(LooperProto.THREAD_ID, mThread.getId());
mQueue.writeToProto(proto, LooperProto.QUEUE);
if (mQueue != null) {
mQueue.writeToProto(proto, LooperProto.QUEUE);
}
proto.end(looperToken);
}