Merge "Keep existing API behavior that regressed." into lmp-dev
diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java
index 90e9c69..7cb3c37 100644
--- a/core/java/android/widget/RemoteViews.java
+++ b/core/java/android/widget/RemoteViews.java
@@ -1807,7 +1807,7 @@
     }
 
     public String getPackage() {
-        return mApplication.packageName;
+        return (mApplication != null) ? mApplication.packageName : null;
     }
 
     /**
@@ -2663,6 +2663,10 @@
     }
 
     private static ApplicationInfo getApplicationInfo(String packageName, int userId) {
+        if (packageName == null) {
+            return null;
+        }
+
         // Get the application for the passed in package and user.
         Application application = ActivityThread.currentApplication();
         if (application == null) {