summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/ActivityThread.java428
-rw-r--r--core/java/android/print/PrintJobInfo.java116
-rw-r--r--core/java/android/printservice/PrintJob.java6
-rw-r--r--core/java/android/printservice/PrintService.java8
-rw-r--r--core/java/android/printservice/PrintServiceInfo.java30
5 files changed, 349 insertions, 239 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 347850a..5e3dc02 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -534,17 +534,10 @@ public final class ActivityThread {
private native void dumpGraphicsInfo(FileDescriptor fd);
private class ApplicationThread extends ApplicationThreadNative {
- private static final String HEAP_FULL_COLUMN
- = "%13s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s";
- private static final String HEAP_COLUMN
- = "%13s %8s %8s %8s %8s %8s %8s %8s";
private static final String ONE_COUNT_COLUMN = "%21s %8d";
private static final String TWO_COUNT_COLUMNS = "%21s %8d %21s %8d";
private static final String DB_INFO_FORMAT = " %8s %8s %14s %14s %s";
- // Formatting for checkin service - update version if row format changes
- private static final int ACTIVITY_THREAD_CHECKIN_VERSION = 3;
-
private int mLastProcessState = -1;
private void updatePendingConfiguration(Configuration config) {
@@ -929,82 +922,14 @@ public final class ActivityThread {
long openSslSocketCount = Debug.countInstancesOfClass(OpenSSLSocketImpl.class);
SQLiteDebug.PagerStats stats = SQLiteDebug.getDatabaseInfo();
- // For checkin, we print one long comma-separated list of values
+ dumpMemInfoTable(pw, memInfo, checkin, dumpFullInfo, dumpDalvik, Process.myPid(),
+ (mBoundApplication != null) ? mBoundApplication.processName : "unknown",
+ nativeMax, nativeAllocated, nativeFree,
+ dalvikMax, dalvikAllocated, dalvikFree);
+
if (checkin) {
// NOTE: if you change anything significant below, also consider changing
// ACTIVITY_THREAD_CHECKIN_VERSION.
- String processName = (mBoundApplication != null)
- ? mBoundApplication.processName : "unknown";
-
- // Header
- pw.print(ACTIVITY_THREAD_CHECKIN_VERSION); pw.print(',');
- pw.print(Process.myPid()); pw.print(',');
- pw.print(processName); pw.print(',');
-
- // Heap info - max
- pw.print(nativeMax); pw.print(',');
- pw.print(dalvikMax); pw.print(',');
- pw.print("N/A,");
- pw.print(nativeMax + dalvikMax); pw.print(',');
-
- // Heap info - allocated
- pw.print(nativeAllocated); pw.print(',');
- pw.print(dalvikAllocated); pw.print(',');
- pw.print("N/A,");
- pw.print(nativeAllocated + dalvikAllocated); pw.print(',');
-
- // Heap info - free
- pw.print(nativeFree); pw.print(',');
- pw.print(dalvikFree); pw.print(',');
- pw.print("N/A,");
- pw.print(nativeFree + dalvikFree); pw.print(',');
-
- // Heap info - proportional set size
- pw.print(memInfo.nativePss); pw.print(',');
- pw.print(memInfo.dalvikPss); pw.print(',');
- pw.print(memInfo.otherPss); pw.print(',');
- pw.print(memInfo.getTotalPss()); pw.print(',');
-
- // Heap info - swappable set size
- pw.print(memInfo.nativeSwappablePss); pw.print(',');
- pw.print(memInfo.dalvikSwappablePss); pw.print(',');
- pw.print(memInfo.otherSwappablePss); pw.print(',');
- pw.print(memInfo.getTotalSwappablePss()); pw.print(',');
-
- // Heap info - shared dirty
- pw.print(memInfo.nativeSharedDirty); pw.print(',');
- pw.print(memInfo.dalvikSharedDirty); pw.print(',');
- pw.print(memInfo.otherSharedDirty); pw.print(',');
- pw.print(memInfo.getTotalSharedDirty()); pw.print(',');
-
- // Heap info - shared clean
- pw.print(memInfo.nativeSharedClean); pw.print(',');
- pw.print(memInfo.dalvikSharedClean); pw.print(',');
- pw.print(memInfo.otherSharedClean); pw.print(',');
- pw.print(memInfo.getTotalSharedClean()); pw.print(',');
-
- // Heap info - private Dirty
- pw.print(memInfo.nativePrivateDirty); pw.print(',');
- pw.print(memInfo.dalvikPrivateDirty); pw.print(',');
- pw.print(memInfo.otherPrivateDirty); pw.print(',');
- pw.print(memInfo.getTotalPrivateDirty()); pw.print(',');
-
- // Heap info - private Clean
- pw.print(memInfo.nativePrivateClean); pw.print(',');
- pw.print(memInfo.dalvikPrivateClean); pw.print(',');
- pw.print(memInfo.otherPrivateClean); pw.print(',');
- pw.print(memInfo.getTotalPrivateClean()); pw.print(',');
-
- // Heap info - other areas
- for (int i=0; i<Debug.MemoryInfo.NUM_OTHER_STATS; i++) {
- pw.print(Debug.MemoryInfo.getOtherLabel(i)); pw.print(',');
- pw.print(memInfo.getOtherPss(i)); pw.print(',');
- pw.print(memInfo.getOtherSwappablePss(i)); pw.print(',');
- pw.print(memInfo.getOtherSharedDirty(i)); pw.print(',');
- pw.print(memInfo.getOtherSharedClean(i)); pw.print(',');
- pw.print(memInfo.getOtherPrivateDirty(i)); pw.print(',');
- pw.print(memInfo.getOtherPrivateClean(i)); pw.print(',');
- }
// Object counts
pw.print(viewInstanceCount); pw.print(',');
@@ -1039,128 +964,6 @@ public final class ActivityThread {
return;
}
- // otherwise, show human-readable format
- if (dumpFullInfo) {
- printRow(pw, HEAP_FULL_COLUMN, "", "Pss", "Pss", "Shared", "Private",
- "Shared", "Private", "Swapped", "Heap", "Heap", "Heap");
- printRow(pw, HEAP_FULL_COLUMN, "", "Total", "Clean", "Dirty", "Dirty",
- "Clean", "Clean", "Dirty", "Size", "Alloc", "Free");
- printRow(pw, HEAP_FULL_COLUMN, "", "------", "------", "------", "------",
- "------", "------", "------", "------", "------", "------");
- printRow(pw, HEAP_FULL_COLUMN, "Native Heap", memInfo.nativePss,
- memInfo.nativeSwappablePss, memInfo.nativeSharedDirty,
- memInfo.nativePrivateDirty, memInfo.nativeSharedClean,
- memInfo.nativePrivateClean, memInfo.nativeSwappedOut,
- nativeMax, nativeAllocated, nativeFree);
- printRow(pw, HEAP_FULL_COLUMN, "Dalvik Heap", memInfo.dalvikPss,
- memInfo.dalvikSwappablePss, memInfo.dalvikSharedDirty,
- memInfo.dalvikPrivateDirty, memInfo.dalvikSharedClean,
- memInfo.dalvikPrivateClean, memInfo.dalvikSwappedOut,
- dalvikMax, dalvikAllocated, dalvikFree);
- } else {
- printRow(pw, HEAP_COLUMN, "", "Pss", "Private",
- "Private", "Swapped", "Heap", "Heap", "Heap");
- printRow(pw, HEAP_COLUMN, "", "Total", "Dirty",
- "Clean", "Dirty", "Size", "Alloc", "Free");
- printRow(pw, HEAP_COLUMN, "", "------", "------", "------",
- "------", "------", "------", "------", "------");
- printRow(pw, HEAP_COLUMN, "Native Heap", memInfo.nativePss,
- memInfo.nativePrivateDirty,
- memInfo.nativePrivateClean, memInfo.nativeSwappedOut,
- nativeMax, nativeAllocated, nativeFree);
- printRow(pw, HEAP_COLUMN, "Dalvik Heap", memInfo.dalvikPss,
- memInfo.dalvikPrivateDirty,
- memInfo.dalvikPrivateClean, memInfo.dalvikSwappedOut,
- dalvikMax, dalvikAllocated, dalvikFree);
- }
-
- int otherPss = memInfo.otherPss;
- int otherSwappablePss = memInfo.otherSwappablePss;
- int otherSharedDirty = memInfo.otherSharedDirty;
- int otherPrivateDirty = memInfo.otherPrivateDirty;
- int otherSharedClean = memInfo.otherSharedClean;
- int otherPrivateClean = memInfo.otherPrivateClean;
- int otherSwappedOut = memInfo.otherSwappedOut;
-
- for (int i=0; i<Debug.MemoryInfo.NUM_OTHER_STATS; i++) {
- final int myPss = memInfo.getOtherPss(i);
- final int mySwappablePss = memInfo.getOtherSwappablePss(i);
- final int mySharedDirty = memInfo.getOtherSharedDirty(i);
- final int myPrivateDirty = memInfo.getOtherPrivateDirty(i);
- final int mySharedClean = memInfo.getOtherSharedClean(i);
- final int myPrivateClean = memInfo.getOtherPrivateClean(i);
- final int mySwappedOut = memInfo.getOtherSwappedOut(i);
- if (myPss != 0 || mySharedDirty != 0 || myPrivateDirty != 0
- || mySharedClean != 0 || myPrivateClean != 0 || mySwappedOut != 0) {
- if (dumpFullInfo) {
- printRow(pw, HEAP_FULL_COLUMN, Debug.MemoryInfo.getOtherLabel(i),
- myPss, mySwappablePss, mySharedDirty, myPrivateDirty,
- mySharedClean, myPrivateClean, mySwappedOut, "", "", "");
- } else {
- printRow(pw, HEAP_COLUMN, Debug.MemoryInfo.getOtherLabel(i),
- myPss, myPrivateDirty,
- myPrivateClean, mySwappedOut, "", "", "");
- }
- otherPss -= myPss;
- otherSwappablePss -= mySwappablePss;
- otherSharedDirty -= mySharedDirty;
- otherPrivateDirty -= myPrivateDirty;
- otherSharedClean -= mySharedClean;
- otherPrivateClean -= myPrivateClean;
- otherSwappedOut -= mySwappedOut;
- }
- }
-
- if (dumpFullInfo) {
- printRow(pw, HEAP_FULL_COLUMN, "Unknown", otherPss, otherSwappablePss,
- otherSharedDirty, otherPrivateDirty, otherSharedClean, otherPrivateClean,
- otherSwappedOut, "", "", "");
- printRow(pw, HEAP_FULL_COLUMN, "TOTAL", memInfo.getTotalPss(),
- memInfo.getTotalSwappablePss(),
- memInfo.getTotalSharedDirty(), memInfo.getTotalPrivateDirty(),
- memInfo.getTotalSharedClean(), memInfo.getTotalPrivateClean(),
- memInfo.getTotalSwappedOut(), nativeMax+dalvikMax,
- nativeAllocated+dalvikAllocated, nativeFree+dalvikFree);
- } else {
- printRow(pw, HEAP_COLUMN, "Unknown", otherPss,
- otherPrivateDirty, otherPrivateClean, otherSwappedOut,
- "", "", "");
- printRow(pw, HEAP_COLUMN, "TOTAL", memInfo.getTotalPss(),
- memInfo.getTotalPrivateDirty(),
- memInfo.getTotalPrivateClean(),
- memInfo.getTotalSwappedOut(),
- nativeMax+dalvikMax,
- nativeAllocated+dalvikAllocated, nativeFree+dalvikFree);
- }
-
- if (dumpDalvik) {
- pw.println(" ");
- pw.println(" Dalvik Details");
-
- for (int i=Debug.MemoryInfo.NUM_OTHER_STATS;
- i<Debug.MemoryInfo.NUM_OTHER_STATS + Debug.MemoryInfo.NUM_DVK_STATS; i++) {
- final int myPss = memInfo.getOtherPss(i);
- final int mySwappablePss = memInfo.getOtherSwappablePss(i);
- final int mySharedDirty = memInfo.getOtherSharedDirty(i);
- final int myPrivateDirty = memInfo.getOtherPrivateDirty(i);
- final int mySharedClean = memInfo.getOtherSharedClean(i);
- final int myPrivateClean = memInfo.getOtherPrivateClean(i);
- final int mySwappedOut = memInfo.getOtherSwappedOut(i);
- if (myPss != 0 || mySharedDirty != 0 || myPrivateDirty != 0
- || mySharedClean != 0 || myPrivateClean != 0) {
- if (dumpFullInfo) {
- printRow(pw, HEAP_FULL_COLUMN, Debug.MemoryInfo.getOtherLabel(i),
- myPss, mySwappablePss, mySharedDirty, myPrivateDirty,
- mySharedClean, myPrivateClean, mySwappedOut, "", "", "");
- } else {
- printRow(pw, HEAP_COLUMN, Debug.MemoryInfo.getOtherLabel(i),
- myPss, myPrivateDirty,
- myPrivateClean, mySwappedOut, "", "", "");
- }
- }
- }
- }
-
pw.println(" ");
pw.println(" Objects");
printRow(pw, TWO_COUNT_COLUMNS, "Views:", viewInstanceCount, "ViewRootImpl:",
@@ -1238,10 +1041,6 @@ public final class ActivityThread {
sendMessage(H.REQUEST_ASSIST_CONTEXT_EXTRAS, cmd);
}
- private void printRow(PrintWriter pw, String format, Object...objs) {
- pw.println(String.format(format, objs));
- }
-
public void setCoreSettings(Bundle coreSettings) {
sendMessage(H.SET_CORE_SETTINGS, coreSettings);
}
@@ -1959,6 +1758,223 @@ public final class ActivityThread {
}
}
+ private static final String HEAP_FULL_COLUMN
+ = "%13s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s";
+ private static final String HEAP_COLUMN
+ = "%13s %8s %8s %8s %8s %8s %8s %8s";
+
+ // Formatting for checkin service - update version if row format changes
+ private static final int ACTIVITY_THREAD_CHECKIN_VERSION = 3;
+
+ static void printRow(PrintWriter pw, String format, Object...objs) {
+ pw.println(String.format(format, objs));
+ }
+
+ public static void dumpMemInfoTable(PrintWriter pw, Debug.MemoryInfo memInfo, boolean checkin,
+ boolean dumpFullInfo, boolean dumpDalvik, int pid, String processName,
+ long nativeMax, long nativeAllocated, long nativeFree,
+ long dalvikMax, long dalvikAllocated, long dalvikFree) {
+
+ // For checkin, we print one long comma-separated list of values
+ if (checkin) {
+ // NOTE: if you change anything significant below, also consider changing
+ // ACTIVITY_THREAD_CHECKIN_VERSION.
+
+ // Header
+ pw.print(ACTIVITY_THREAD_CHECKIN_VERSION); pw.print(',');
+ pw.print(pid); pw.print(',');
+ pw.print(processName); pw.print(',');
+
+ // Heap info - max
+ pw.print(nativeMax); pw.print(',');
+ pw.print(dalvikMax); pw.print(',');
+ pw.print("N/A,");
+ pw.print(nativeMax + dalvikMax); pw.print(',');
+
+ // Heap info - allocated
+ pw.print(nativeAllocated); pw.print(',');
+ pw.print(dalvikAllocated); pw.print(',');
+ pw.print("N/A,");
+ pw.print(nativeAllocated + dalvikAllocated); pw.print(',');
+
+ // Heap info - free
+ pw.print(nativeFree); pw.print(',');
+ pw.print(dalvikFree); pw.print(',');
+ pw.print("N/A,");
+ pw.print(nativeFree + dalvikFree); pw.print(',');
+
+ // Heap info - proportional set size
+ pw.print(memInfo.nativePss); pw.print(',');
+ pw.print(memInfo.dalvikPss); pw.print(',');
+ pw.print(memInfo.otherPss); pw.print(',');
+ pw.print(memInfo.getTotalPss()); pw.print(',');
+
+ // Heap info - swappable set size
+ pw.print(memInfo.nativeSwappablePss); pw.print(',');
+ pw.print(memInfo.dalvikSwappablePss); pw.print(',');
+ pw.print(memInfo.otherSwappablePss); pw.print(',');
+ pw.print(memInfo.getTotalSwappablePss()); pw.print(',');
+
+ // Heap info - shared dirty
+ pw.print(memInfo.nativeSharedDirty); pw.print(',');
+ pw.print(memInfo.dalvikSharedDirty); pw.print(',');
+ pw.print(memInfo.otherSharedDirty); pw.print(',');
+ pw.print(memInfo.getTotalSharedDirty()); pw.print(',');
+
+ // Heap info - shared clean
+ pw.print(memInfo.nativeSharedClean); pw.print(',');
+ pw.print(memInfo.dalvikSharedClean); pw.print(',');
+ pw.print(memInfo.otherSharedClean); pw.print(',');
+ pw.print(memInfo.getTotalSharedClean()); pw.print(',');
+
+ // Heap info - private Dirty
+ pw.print(memInfo.nativePrivateDirty); pw.print(',');
+ pw.print(memInfo.dalvikPrivateDirty); pw.print(',');
+ pw.print(memInfo.otherPrivateDirty); pw.print(',');
+ pw.print(memInfo.getTotalPrivateDirty()); pw.print(',');
+
+ // Heap info - private Clean
+ pw.print(memInfo.nativePrivateClean); pw.print(',');
+ pw.print(memInfo.dalvikPrivateClean); pw.print(',');
+ pw.print(memInfo.otherPrivateClean); pw.print(',');
+ pw.print(memInfo.getTotalPrivateClean()); pw.print(',');
+
+ // Heap info - other areas
+ for (int i=0; i<Debug.MemoryInfo.NUM_OTHER_STATS; i++) {
+ pw.print(Debug.MemoryInfo.getOtherLabel(i)); pw.print(',');
+ pw.print(memInfo.getOtherPss(i)); pw.print(',');
+ pw.print(memInfo.getOtherSwappablePss(i)); pw.print(',');
+ pw.print(memInfo.getOtherSharedDirty(i)); pw.print(',');
+ pw.print(memInfo.getOtherSharedClean(i)); pw.print(',');
+ pw.print(memInfo.getOtherPrivateDirty(i)); pw.print(',');
+ pw.print(memInfo.getOtherPrivateClean(i)); pw.print(',');
+ }
+ return;
+ }
+
+ // otherwise, show human-readable format
+ if (dumpFullInfo) {
+ printRow(pw, HEAP_FULL_COLUMN, "", "Pss", "Pss", "Shared", "Private",
+ "Shared", "Private", "Swapped", "Heap", "Heap", "Heap");
+ printRow(pw, HEAP_FULL_COLUMN, "", "Total", "Clean", "Dirty", "Dirty",
+ "Clean", "Clean", "Dirty", "Size", "Alloc", "Free");
+ printRow(pw, HEAP_FULL_COLUMN, "", "------", "------", "------", "------",
+ "------", "------", "------", "------", "------", "------");
+ printRow(pw, HEAP_FULL_COLUMN, "Native Heap", memInfo.nativePss,
+ memInfo.nativeSwappablePss, memInfo.nativeSharedDirty,
+ memInfo.nativePrivateDirty, memInfo.nativeSharedClean,
+ memInfo.nativePrivateClean, memInfo.nativeSwappedOut,
+ nativeMax, nativeAllocated, nativeFree);
+ printRow(pw, HEAP_FULL_COLUMN, "Dalvik Heap", memInfo.dalvikPss,
+ memInfo.dalvikSwappablePss, memInfo.dalvikSharedDirty,
+ memInfo.dalvikPrivateDirty, memInfo.dalvikSharedClean,
+ memInfo.dalvikPrivateClean, memInfo.dalvikSwappedOut,
+ dalvikMax, dalvikAllocated, dalvikFree);
+ } else {
+ printRow(pw, HEAP_COLUMN, "", "Pss", "Private",
+ "Private", "Swapped", "Heap", "Heap", "Heap");
+ printRow(pw, HEAP_COLUMN, "", "Total", "Dirty",
+ "Clean", "Dirty", "Size", "Alloc", "Free");
+ printRow(pw, HEAP_COLUMN, "", "------", "------", "------",
+ "------", "------", "------", "------", "------");
+ printRow(pw, HEAP_COLUMN, "Native Heap", memInfo.nativePss,
+ memInfo.nativePrivateDirty,
+ memInfo.nativePrivateClean, memInfo.nativeSwappedOut,
+ nativeMax, nativeAllocated, nativeFree);
+ printRow(pw, HEAP_COLUMN, "Dalvik Heap", memInfo.dalvikPss,
+ memInfo.dalvikPrivateDirty,
+ memInfo.dalvikPrivateClean, memInfo.dalvikSwappedOut,
+ dalvikMax, dalvikAllocated, dalvikFree);
+ }
+
+ int otherPss = memInfo.otherPss;
+ int otherSwappablePss = memInfo.otherSwappablePss;
+ int otherSharedDirty = memInfo.otherSharedDirty;
+ int otherPrivateDirty = memInfo.otherPrivateDirty;
+ int otherSharedClean = memInfo.otherSharedClean;
+ int otherPrivateClean = memInfo.otherPrivateClean;
+ int otherSwappedOut = memInfo.otherSwappedOut;
+
+ for (int i=0; i<Debug.MemoryInfo.NUM_OTHER_STATS; i++) {
+ final int myPss = memInfo.getOtherPss(i);
+ final int mySwappablePss = memInfo.getOtherSwappablePss(i);
+ final int mySharedDirty = memInfo.getOtherSharedDirty(i);
+ final int myPrivateDirty = memInfo.getOtherPrivateDirty(i);
+ final int mySharedClean = memInfo.getOtherSharedClean(i);
+ final int myPrivateClean = memInfo.getOtherPrivateClean(i);
+ final int mySwappedOut = memInfo.getOtherSwappedOut(i);
+ if (myPss != 0 || mySharedDirty != 0 || myPrivateDirty != 0
+ || mySharedClean != 0 || myPrivateClean != 0 || mySwappedOut != 0) {
+ if (dumpFullInfo) {
+ printRow(pw, HEAP_FULL_COLUMN, Debug.MemoryInfo.getOtherLabel(i),
+ myPss, mySwappablePss, mySharedDirty, myPrivateDirty,
+ mySharedClean, myPrivateClean, mySwappedOut, "", "", "");
+ } else {
+ printRow(pw, HEAP_COLUMN, Debug.MemoryInfo.getOtherLabel(i),
+ myPss, myPrivateDirty,
+ myPrivateClean, mySwappedOut, "", "", "");
+ }
+ otherPss -= myPss;
+ otherSwappablePss -= mySwappablePss;
+ otherSharedDirty -= mySharedDirty;
+ otherPrivateDirty -= myPrivateDirty;
+ otherSharedClean -= mySharedClean;
+ otherPrivateClean -= myPrivateClean;
+ otherSwappedOut -= mySwappedOut;
+ }
+ }
+
+ if (dumpFullInfo) {
+ printRow(pw, HEAP_FULL_COLUMN, "Unknown", otherPss, otherSwappablePss,
+ otherSharedDirty, otherPrivateDirty, otherSharedClean, otherPrivateClean,
+ otherSwappedOut, "", "", "");
+ printRow(pw, HEAP_FULL_COLUMN, "TOTAL", memInfo.getTotalPss(),
+ memInfo.getTotalSwappablePss(),
+ memInfo.getTotalSharedDirty(), memInfo.getTotalPrivateDirty(),
+ memInfo.getTotalSharedClean(), memInfo.getTotalPrivateClean(),
+ memInfo.getTotalSwappedOut(), nativeMax+dalvikMax,
+ nativeAllocated+dalvikAllocated, nativeFree+dalvikFree);
+ } else {
+ printRow(pw, HEAP_COLUMN, "Unknown", otherPss,
+ otherPrivateDirty, otherPrivateClean, otherSwappedOut,
+ "", "", "");
+ printRow(pw, HEAP_COLUMN, "TOTAL", memInfo.getTotalPss(),
+ memInfo.getTotalPrivateDirty(),
+ memInfo.getTotalPrivateClean(),
+ memInfo.getTotalSwappedOut(),
+ nativeMax+dalvikMax,
+ nativeAllocated+dalvikAllocated, nativeFree+dalvikFree);
+ }
+
+ if (dumpDalvik) {
+ pw.println(" ");
+ pw.println(" Dalvik Details");
+
+ for (int i=Debug.MemoryInfo.NUM_OTHER_STATS;
+ i<Debug.MemoryInfo.NUM_OTHER_STATS + Debug.MemoryInfo.NUM_DVK_STATS; i++) {
+ final int myPss = memInfo.getOtherPss(i);
+ final int mySwappablePss = memInfo.getOtherSwappablePss(i);
+ final int mySharedDirty = memInfo.getOtherSharedDirty(i);
+ final int myPrivateDirty = memInfo.getOtherPrivateDirty(i);
+ final int mySharedClean = memInfo.getOtherSharedClean(i);
+ final int myPrivateClean = memInfo.getOtherPrivateClean(i);
+ final int mySwappedOut = memInfo.getOtherSwappedOut(i);
+ if (myPss != 0 || mySharedDirty != 0 || myPrivateDirty != 0
+ || mySharedClean != 0 || myPrivateClean != 0) {
+ if (dumpFullInfo) {
+ printRow(pw, HEAP_FULL_COLUMN, Debug.MemoryInfo.getOtherLabel(i),
+ myPss, mySwappablePss, mySharedDirty, myPrivateDirty,
+ mySharedClean, myPrivateClean, mySwappedOut, "", "", "");
+ } else {
+ printRow(pw, HEAP_COLUMN, Debug.MemoryInfo.getOtherLabel(i),
+ myPss, myPrivateDirty,
+ myPrivateClean, mySwappedOut, "", "", "");
+ }
+ }
+ }
+ }
+ }
+
public void registerOnActivityPausedListener(Activity activity,
OnActivityPausedListener listener) {
synchronized (mOnPauseListeners) {
diff --git a/core/java/android/print/PrintJobInfo.java b/core/java/android/print/PrintJobInfo.java
index c2f190d..63f94fe 100644
--- a/core/java/android/print/PrintJobInfo.java
+++ b/core/java/android/print/PrintJobInfo.java
@@ -16,6 +16,7 @@
package android.print;
+import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
@@ -160,6 +161,9 @@ public final class PrintJobInfo implements Parcelable {
/** Information about the printed document. */
private PrintDocumentInfo mDocumentInfo;
+ /** Advanced printer specific options. */
+ private Bundle mAdvancedOptions;
+
/** Whether we are trying to cancel this print job. */
private boolean mCanceling;
@@ -184,6 +188,7 @@ public final class PrintJobInfo implements Parcelable {
mAttributes = other.mAttributes;
mDocumentInfo = other.mDocumentInfo;
mCanceling = other.mCanceling;
+ mAdvancedOptions = other.mAdvancedOptions;
}
private PrintJobInfo(Parcel parcel) {
@@ -197,20 +202,17 @@ public final class PrintJobInfo implements Parcelable {
mCreationTime = parcel.readLong();
mCopies = parcel.readInt();
mStateReason = parcel.readString();
- if (parcel.readInt() == 1) {
- Parcelable[] parcelables = parcel.readParcelableArray(null);
+ Parcelable[] parcelables = parcel.readParcelableArray(null);
+ if (parcelables != null) {
mPageRanges = new PageRange[parcelables.length];
for (int i = 0; i < parcelables.length; i++) {
mPageRanges[i] = (PageRange) parcelables[i];
}
}
- if (parcel.readInt() == 1) {
- mAttributes = PrintAttributes.CREATOR.createFromParcel(parcel);
- }
- if (parcel.readInt() == 1) {
- mDocumentInfo = PrintDocumentInfo.CREATOR.createFromParcel(parcel);
- }
+ mAttributes = (PrintAttributes) parcel.readParcelable(null);
+ mDocumentInfo = (PrintDocumentInfo) parcel.readParcelable(null);
mCanceling = (parcel.readInt() == 1);
+ mAdvancedOptions = parcel.readBundle();
}
/**
@@ -521,6 +523,71 @@ public final class PrintJobInfo implements Parcelable {
mCanceling = cancelling;
}
+ /**
+ * Gets whether this job has a given advanced (printer specific) print
+ * option.
+ *
+ * @param key The option key.
+ * @return Whether the option is present.
+ *
+ * @hide
+ */
+ public boolean hasAdvancedOption(String key) {
+ return mAdvancedOptions != null && mAdvancedOptions.containsKey(key);
+ }
+
+ /**
+ * Gets the value of an advanced (printer specific) print option.
+ *
+ * @param key The option key.
+ * @return The option value.
+ *
+ * @hide
+ */
+ public String getAdvancedStringOption(String key) {
+ if (mAdvancedOptions != null) {
+ return mAdvancedOptions.getString(key);
+ }
+ return null;
+ }
+
+ /**
+ * Gets the value of an advanced (printer specific) print option.
+ *
+ * @param key The option key.
+ * @return The option value.
+ *
+ * @hide
+ */
+ public int getAdvancedIntOption(String key) {
+ if (mAdvancedOptions != null) {
+ return mAdvancedOptions.getInt(key);
+ }
+ return 0;
+ }
+
+ /**
+ * Gets the advanced options.
+ *
+ * @return The advanced options.
+ *
+ * @hide
+ */
+ public Bundle getAdvancedOptions() {
+ return mAdvancedOptions;
+ }
+
+ /**
+ * Sets the advanced options.
+ *
+ * @param options The advanced options.
+ *
+ * @hide
+ */
+ public void setAdvancedOptions(Bundle options) {
+ mAdvancedOptions = options;
+ }
+
@Override
public int describeContents() {
return 0;
@@ -538,25 +605,11 @@ public final class PrintJobInfo implements Parcelable {
parcel.writeLong(mCreationTime);
parcel.writeInt(mCopies);
parcel.writeString(mStateReason);
- if (mPageRanges != null) {
- parcel.writeInt(1);
- parcel.writeParcelableArray(mPageRanges, flags);
- } else {
- parcel.writeInt(0);
- }
- if (mAttributes != null) {
- parcel.writeInt(1);
- mAttributes.writeToParcel(parcel, flags);
- } else {
- parcel.writeInt(0);
- }
- if (mDocumentInfo != null) {
- parcel.writeInt(1);
- mDocumentInfo.writeToParcel(parcel, flags);
- } else {
- parcel.writeInt(0);
- }
+ parcel.writeParcelableArray(mPageRanges, flags);
+ parcel.writeParcelable(mAttributes, flags);
+ parcel.writeParcelable(mDocumentInfo, 0);
parcel.writeInt(mCanceling ? 1 : 0);
+ parcel.writeBundle(mAdvancedOptions);
}
@Override
@@ -577,6 +630,7 @@ public final class PrintJobInfo implements Parcelable {
builder.append(", cancelling: " + mCanceling);
builder.append(", pages: " + (mPageRanges != null
? Arrays.toString(mPageRanges) : null));
+ builder.append(", hasAdvancedOptions: " + (mAdvancedOptions != null));
builder.append("}");
return builder.toString();
}
@@ -663,7 +717,10 @@ public final class PrintJobInfo implements Parcelable {
* @param value The option value.
*/
public void putAdvancedOption(String key, String value) {
-
+ if (mPrototype.mAdvancedOptions == null) {
+ mPrototype.mAdvancedOptions = new Bundle();
+ }
+ mPrototype.mAdvancedOptions.putString(key, value);
}
/**
@@ -673,7 +730,10 @@ public final class PrintJobInfo implements Parcelable {
* @param value The option value.
*/
public void putAdvancedOption(String key, int value) {
-
+ if (mPrototype.mAdvancedOptions == null) {
+ mPrototype.mAdvancedOptions = new Bundle();
+ }
+ mPrototype.mAdvancedOptions.putInt(key, value);
}
/**
diff --git a/core/java/android/printservice/PrintJob.java b/core/java/android/printservice/PrintJob.java
index fdeb373..6fa0bdd 100644
--- a/core/java/android/printservice/PrintJob.java
+++ b/core/java/android/printservice/PrintJob.java
@@ -321,7 +321,7 @@ public final class PrintJob {
*/
public String getAdvancedStringOption(String key) {
PrintService.throwIfNotCalledOnMainThread();
- return null;
+ return getInfo().getAdvancedStringOption(key);
}
/**
@@ -333,7 +333,7 @@ public final class PrintJob {
*/
public boolean hasAdvancedOption(String key) {
PrintService.throwIfNotCalledOnMainThread();
- return false;
+ return getInfo().hasAdvancedOption(key);
}
/**
@@ -344,7 +344,7 @@ public final class PrintJob {
*/
public int getAdvancedIntOption(String key) {
PrintService.throwIfNotCalledOnMainThread();
- return 0;
+ return getInfo().getAdvancedIntOption(key);
}
@Override
diff --git a/core/java/android/printservice/PrintService.java b/core/java/android/printservice/PrintService.java
index 0fc5f7f..eb0ac2e 100644
--- a/core/java/android/printservice/PrintService.java
+++ b/core/java/android/printservice/PrintService.java
@@ -209,6 +209,14 @@ public abstract class PrintService extends Service {
* PrintJob#getAdvancedStringOption(String) PrintJob.getAdvancedStringOption(String)}
* and {@link PrintJob#getAdvancedIntOption(String) PrintJob.getAdvancedIntOption(String)}.
* </p>
+ * <p>
+ * If the advanced print options activity offers changes to the standard print
+ * options, you can get the current {@link android.print.PrinterInfo} using the
+ * "android.intent.extra.print.EXTRA_PRINTER_INFO" extra which will allow you to
+ * present the user with UI options supported by the current printer. For example,
+ * if the current printer does not support a give media size, you should not
+ * offer it in the advanced print options dialog.
+ * </p>
*/
public static final String EXTRA_PRINT_JOB_INFO = "android.intent.extra.print.PRINT_JOB_INFO";
diff --git a/core/java/android/printservice/PrintServiceInfo.java b/core/java/android/printservice/PrintServiceInfo.java
index 8e9636c..a2c6c09 100644
--- a/core/java/android/printservice/PrintServiceInfo.java
+++ b/core/java/android/printservice/PrintServiceInfo.java
@@ -60,6 +60,8 @@ public final class PrintServiceInfo implements Parcelable {
private final String mAddPrintersActivityName;
+ private final String mAdvancedPrintOptionsActivityName;
+
/**
* Creates a new instance.
*
@@ -70,6 +72,7 @@ public final class PrintServiceInfo implements Parcelable {
mResolveInfo = parcel.readParcelable(null);
mSettingsActivityName = parcel.readString();
mAddPrintersActivityName = parcel.readString();
+ mAdvancedPrintOptionsActivityName = parcel.readString();
}
/**
@@ -78,14 +81,16 @@ public final class PrintServiceInfo implements Parcelable {
* @param resolveInfo The service resolve info.
* @param settingsActivityName Optional settings activity name.
* @param addPrintersActivityName Optional add printers activity name.
+ * @param advancedPrintOptionsActivityName Optional advanced print options activity.
*/
public PrintServiceInfo(ResolveInfo resolveInfo, String settingsActivityName,
- String addPrintersActivityName) {
+ String addPrintersActivityName, String advancedPrintOptionsActivityName) {
mId = new ComponentName(resolveInfo.serviceInfo.packageName,
resolveInfo.serviceInfo.name).flattenToString();
mResolveInfo = resolveInfo;
mSettingsActivityName = settingsActivityName;
mAddPrintersActivityName = addPrintersActivityName;
+ mAdvancedPrintOptionsActivityName = advancedPrintOptionsActivityName;
}
/**
@@ -99,6 +104,7 @@ public final class PrintServiceInfo implements Parcelable {
public static PrintServiceInfo create(ResolveInfo resolveInfo, Context context) {
String settingsActivityName = null;
String addPrintersActivityName = null;
+ String advancedPrintOptionsActivityName = null;
XmlResourceParser parser = null;
PackageManager packageManager = context.getPackageManager();
@@ -128,6 +134,9 @@ public final class PrintServiceInfo implements Parcelable {
addPrintersActivityName = attributes.getString(
com.android.internal.R.styleable.PrintService_addPrintersActivity);
+ advancedPrintOptionsActivityName = attributes.getString(com.android.internal
+ .R.styleable.PrintService_advancedPrintOptionsActivity);
+
attributes.recycle();
}
} catch (IOException ioe) {
@@ -144,7 +153,8 @@ public final class PrintServiceInfo implements Parcelable {
}
}
- return new PrintServiceInfo(resolveInfo, settingsActivityName, addPrintersActivityName);
+ return new PrintServiceInfo(resolveInfo, settingsActivityName,
+ addPrintersActivityName, advancedPrintOptionsActivityName);
}
/**
@@ -195,6 +205,19 @@ public final class PrintServiceInfo implements Parcelable {
}
/**
+ * The advanced print options activity name.
+ * <p>
+ * <strong>Statically set from
+ * {@link PrintService#SERVICE_META_DATA meta-data}.</strong>
+ * </p>
+ *
+ * @return The advanced print options activity name.
+ */
+ public String getAdvancedOptionsActivityName() {
+ return mAdvancedPrintOptionsActivityName;
+ }
+
+ /**
* {@inheritDoc}
*/
public int describeContents() {
@@ -206,6 +229,7 @@ public final class PrintServiceInfo implements Parcelable {
parcel.writeParcelable(mResolveInfo, 0);
parcel.writeString(mSettingsActivityName);
parcel.writeString(mAddPrintersActivityName);
+ parcel.writeString(mAdvancedPrintOptionsActivityName);
}
@Override
@@ -243,6 +267,8 @@ public final class PrintServiceInfo implements Parcelable {
builder.append(", resolveInfo=").append(mResolveInfo);
builder.append(", settingsActivityName=").append(mSettingsActivityName);
builder.append(", addPrintersActivityName=").append(mAddPrintersActivityName);
+ builder.append(", advancedPrintOptionsActivityName=")
+ .append(mAdvancedPrintOptionsActivityName);
builder.append("}");
return builder.toString();
}