Merge "Avoiding potential NPE when dumping to proto." am: a52b601ef3
am: 8964390dd3
Change-Id: Ie9dc401990b4267b9bcf0469a3526db93dc438d2
diff --git a/core/java/android/app/AlarmManager.java b/core/java/android/app/AlarmManager.java
index 92fbd59..676bace 100644
--- a/core/java/android/app/AlarmManager.java
+++ b/core/java/android/app/AlarmManager.java
@@ -29,7 +29,6 @@
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 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);
}
}
diff --git a/core/java/android/content/res/Configuration.java b/core/java/android/content/res/Configuration.java
index f7aea97..57ec178 100644
--- a/core/java/android/content/res/Configuration.java
+++ b/core/java/android/content/res/Configuration.java
@@ -1096,7 +1096,9 @@
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 @@
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);
}
diff --git a/core/java/android/os/Looper.java b/core/java/android/os/Looper.java
index f17e0f0..684a8ee 100644
--- a/core/java/android/os/Looper.java
+++ b/core/java/android/os/Looper.java
@@ -386,7 +386,9 @@
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);
}