Improve reference table dumping.

1. Show the newest entry first; I always assume the top is the newest.
2. Use human-readable type names.
3. Improve the human-readable type name code to show _which_ Class (i.e.
   java.lang.Class<java.lang.String> rather than just java.lang.Class).
4. Make it clear when we're reporting the number of elements in an array.
5. Show the first few characters of a string.
6. Show the length of a string if we truncate it.

(I've also removed some redundant casts and improved const-correctness.)

Example:

 Last 10 entries in JNI local reference table:
    16: 0x40f8ec70 java.lang.String "android.permissi... (41 chars)
    15: 0x40f8d450 android.os.Parcel
    14: 0x40f8eb90 java.lang.String "BlackSurface"
    13: 0x408caca0 android.view.SurfaceSession
    12: 0x40f8eb60 android.view.Surface
    11: 0x406bc6f0 java.lang.Class<com.android.server.SystemServer>
    10: 0x406c0278 java.lang.String "com/android/serv... (31 chars)
     9: 0x4015d488 dalvik.system.PathClassLoader
     8: 0x40148de8 java.lang.Class<java.lang.ClassLoader>
     7: 0x406bc560 java.lang.String[]
 JNI local reference table summary (17 entries):
     6 of java.lang.Class<com.android.server.SystemServer> (5 unique instances)
     5 of java.lang.String (5 unique instances)
     1 of java.lang.String[]
     1 of java.lang.String[] (2 elements)
     1 of dalvik.system.PathClassLoader
     1 of android.os.Parcel
     1 of android.view.SurfaceSession
     1 of android.view.Surface

Change-Id: I56494104cd0daada3ecc1e610f1c94df1e11c640
7 files changed