Merge "Fixed mUserId_shouldDeriveUidFromMainCaller test case fail"
diff --git a/src/com/android/settings/SettingsApplication.java b/src/com/android/settings/SettingsApplication.java
index 0d2cfe9..e6e6df3 100644
--- a/src/com/android/settings/SettingsApplication.java
+++ b/src/com/android/settings/SettingsApplication.java
@@ -43,7 +43,11 @@
     @Override
     public void onCreate() {
         super.onCreate();
-        ElapsedTimeUtils.assignSuwFinishedTimeStamp(this.getApplicationContext());
+
+        // Add null checking to avoid test case failed.
+        if (getApplicationContext() != null) {
+            ElapsedTimeUtils.assignSuwFinishedTimeStamp(getApplicationContext());
+        }
 
         // Set Spa environment.
         setSpaEnvironment();