Add new activity manager method to get list of running applications installed on sdcard.
Use new method in UsbStorageActivity.
Fix moving dex files.
moveDex should be suffixed with LI since it uses Installer

Change-Id: Id5ef0254578e84b9aae2c2ac44f722eb5a0fda1c
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index adadfeb..f694285 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -491,6 +491,14 @@
             return true;
         }
 
+        case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
+            data.enforceInterface(IActivityManager.descriptor);
+            List<ApplicationInfo> list = getRunningExternalApplications();
+            reply.writeNoException();
+            reply.writeTypedList(list);
+            return true;
+        }
+
         case MOVE_TASK_TO_FRONT_TRANSACTION: {
             data.enforceInterface(IActivityManager.descriptor);
             int task = data.readInt();
@@ -1716,6 +1724,19 @@
         reply.recycle();
         return list;
     }
+    public List<ApplicationInfo> getRunningExternalApplications()
+            throws RemoteException {
+        Parcel data = Parcel.obtain();
+        Parcel reply = Parcel.obtain();
+        data.writeInterfaceToken(IActivityManager.descriptor);
+        mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
+        reply.readException();
+        ArrayList<ApplicationInfo> list
+        = reply.createTypedArrayList(ApplicationInfo.CREATOR);
+        data.recycle();
+        reply.recycle();
+        return list;
+    }
     public void moveTaskToFront(int task) throws RemoteException
     {
         Parcel data = Parcel.obtain();