Fix issue #1837610 and #1753079

Issue 1837610 Adding a Widget before Running the Associated App Causes a Force Close

We were not retrieving the shared libraries of an application when deliving a
broadcast to an explicit component.

Issue 1753079 loading class path of instrumented app into instrumentation may load wrong path when instrumented app shares process with other apps:

We were using the ApplicationInfo that was used to originally create the process, not the one that the
instrumentation is against.
diff --git a/services/java/com/android/server/am/ProcessRecord.java b/services/java/com/android/server/am/ProcessRecord.java
index b76547a..68aebc3 100644
--- a/services/java/com/android/server/am/ProcessRecord.java
+++ b/services/java/com/android/server/am/ProcessRecord.java
@@ -28,6 +28,7 @@
 import android.os.Bundle;
 import android.os.IBinder;
 import android.os.RemoteException;
+import android.util.PrintWriterPrinter;
 
 import java.io.PrintWriter;
 import java.util.ArrayList;
@@ -62,6 +63,7 @@
     IBinder forcingToForeground;// Token that is forcing this process to be foreground
     int adjSeq;                 // Sequence id for identifying repeated trav
     ComponentName instrumentationClass;// class installed to instrument app
+    ApplicationInfo instrumentationInfo; // the application being instrumented
     String instrumentationProfileFile; // where to save profiling
     IInstrumentationWatcher instrumentationWatcher; // who is waiting
     Bundle instrumentationArguments;// as given to us
@@ -125,6 +127,11 @@
                     pw.println(instrumentationProfileFile);
             pw.print(prefix); pw.print("instrumentationArguments=");
                     pw.println(instrumentationArguments);
+            pw.print(prefix); pw.print("instrumentationInfo=");
+                    pw.println(instrumentationInfo);
+            if (instrumentationInfo != null) {
+                instrumentationInfo.dump(new PrintWriterPrinter(pw), prefix + "  ");
+            }
         }
         pw.print(prefix); pw.print("thread="); pw.print(thread);
                 pw.print(" curReceiver="); pw.println(curReceiver);