summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/java/android/app/ActionBar.java9
-rw-r--r--core/java/android/app/ActivityThread.java241
-rw-r--r--core/java/android/app/ApplicationThreadNative.java7
-rw-r--r--core/java/android/app/AssistStructure.java16
-rw-r--r--core/java/android/app/ContextImpl.java24
-rw-r--r--core/java/android/app/IApplicationThread.java2
-rw-r--r--core/java/android/app/admin/DevicePolicyManager.java8
-rw-r--r--core/java/android/bluetooth/BluetoothAdapter.java11
-rw-r--r--core/java/android/content/pm/PackageManager.java7
-rw-r--r--core/java/android/content/res/Resources.java22
-rw-r--r--core/java/android/ddm/DdmHandleViewDebug.java16
-rw-r--r--core/java/android/os/Build.java21
-rw-r--r--core/java/android/os/Debug.java236
-rw-r--r--core/java/android/provider/Settings.java11
-rw-r--r--core/java/android/view/ContextThemeWrapper.java9
-rw-r--r--core/java/android/view/GhostView.java3
-rw-r--r--core/java/android/view/View.java186
-rw-r--r--core/java/android/view/ViewAssistStructure.java67
-rw-r--r--core/java/android/view/ViewDebug.java24
-rw-r--r--core/java/android/view/ViewGroup.java54
-rw-r--r--core/java/android/view/ViewHierarchyEncoder.java201
-rw-r--r--core/java/android/view/ViewRootImpl.java4
-rw-r--r--core/java/android/view/ViewStructure.java86
-rw-r--r--core/java/android/view/WindowManager.java24
-rw-r--r--core/java/android/webkit/WebView.java20
-rw-r--r--core/java/android/webkit/WebViewProvider.java4
-rw-r--r--core/java/android/widget/AbsListView.java31
-rw-r--r--core/java/android/widget/ActionMenuView.java14
-rw-r--r--core/java/android/widget/AdapterView.java14
-rw-r--r--core/java/android/widget/CheckedTextView.java9
-rw-r--r--core/java/android/widget/CompoundButton.java11
-rw-r--r--core/java/android/widget/FrameLayout.java13
-rw-r--r--core/java/android/widget/GridView.java9
-rw-r--r--core/java/android/widget/HorizontalScrollView.java9
-rw-r--r--core/java/android/widget/ImageView.java9
-rw-r--r--core/java/android/widget/LinearLayout.java25
-rw-r--r--core/java/android/widget/ListView.java10
-rw-r--r--core/java/android/widget/ProgressBar.java13
-rw-r--r--core/java/android/widget/RelativeLayout.java9
-rw-r--r--core/java/android/widget/ScrollView.java9
-rw-r--r--core/java/android/widget/Switch.java8
-rw-r--r--core/java/android/widget/TableRow.java11
-rw-r--r--core/java/android/widget/TextClock.java16
-rw-r--r--core/java/android/widget/TextView.java27
-rw-r--r--core/res/res/values/attrs.xml5
-rw-r--r--core/res/res/values/public.xml4
46 files changed, 1287 insertions, 282 deletions
diff --git a/core/java/android/app/ActionBar.java b/core/java/android/app/ActionBar.java
index 94e3b66..4d34349 100644
--- a/core/java/android/app/ActionBar.java
+++ b/core/java/android/app/ActionBar.java
@@ -33,6 +33,7 @@ import android.view.KeyEvent;
import android.view.View;
import android.view.ViewDebug;
import android.view.ViewGroup;
+import android.view.ViewHierarchyEncoder;
import android.view.Window;
import android.widget.SpinnerAdapter;
import java.lang.annotation.Retention;
@@ -1373,5 +1374,13 @@ public abstract class ActionBar {
* version of the SDK an app can end up statically linking to the new MarginLayoutParams
* overload, causing a crash when running on older platform versions with no other changes.
*/
+
+ /** @hide */
+ @Override
+ protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) {
+ super.encodeProperties(encoder);
+
+ encoder.addProperty("gravity", gravity);
+ }
}
}
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index f16406a..f506d59 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -571,8 +571,6 @@ public final class ActivityThread {
private native void dumpGraphicsInfo(FileDescriptor fd);
private class ApplicationThread extends ApplicationThreadNative {
- 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";
private int mLastProcessState = -1;
@@ -972,18 +970,18 @@ public final class ActivityThread {
@Override
public void dumpMemInfo(FileDescriptor fd, Debug.MemoryInfo mem, boolean checkin,
- boolean dumpFullInfo, boolean dumpDalvik, String[] args) {
+ boolean dumpFullInfo, boolean dumpDalvik, boolean dumpSummaryOnly, String[] args) {
FileOutputStream fout = new FileOutputStream(fd);
PrintWriter pw = new FastPrintWriter(fout);
try {
- dumpMemInfo(pw, mem, checkin, dumpFullInfo, dumpDalvik);
+ dumpMemInfo(pw, mem, checkin, dumpFullInfo, dumpDalvik, dumpSummaryOnly);
} finally {
pw.flush();
}
}
private void dumpMemInfo(PrintWriter pw, Debug.MemoryInfo memInfo, boolean checkin,
- boolean dumpFullInfo, boolean dumpDalvik) {
+ boolean dumpFullInfo, boolean dumpDalvik, boolean dumpSummaryOnly) {
long nativeMax = Debug.getNativeHeapSize() / 1024;
long nativeAllocated = Debug.getNativeHeapAllocatedSize() / 1024;
long nativeFree = Debug.getNativeHeapFreeSize() / 1024;
@@ -1007,7 +1005,8 @@ public final class ActivityThread {
long openSslSocketCount = Debug.countInstancesOfClass(OpenSSLSocketImpl.class);
SQLiteDebug.PagerStats stats = SQLiteDebug.getDatabaseInfo();
- dumpMemInfoTable(pw, memInfo, checkin, dumpFullInfo, dumpDalvik, Process.myPid(),
+ dumpMemInfoTable(pw, memInfo, checkin, dumpFullInfo, dumpDalvik, dumpSummaryOnly,
+ Process.myPid(),
(mBoundApplication != null) ? mBoundApplication.processName : "unknown",
nativeMax, nativeAllocated, nativeFree,
dalvikMax, dalvikAllocated, dalvikFree);
@@ -1935,6 +1934,9 @@ public final class ActivityThread {
= "%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 ONE_COUNT_COLUMN_HEADER = "%21s %8s";
// Formatting for checkin service - update version if row format changes
private static final int ACTIVITY_THREAD_CHECKIN_VERSION = 3;
@@ -1944,7 +1946,8 @@ public final class ActivityThread {
}
public static void dumpMemInfoTable(PrintWriter pw, Debug.MemoryInfo memInfo, boolean checkin,
- boolean dumpFullInfo, boolean dumpDalvik, int pid, String processName,
+ boolean dumpFullInfo, boolean dumpDalvik, boolean dumpSummaryOnly,
+ int pid, String processName,
long nativeMax, long nativeAllocated, long nativeFree,
long dalvikMax, long dalvikAllocated, long dalvikFree) {
@@ -2025,106 +2028,50 @@ 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");
+ if (!dumpSummaryOnly) {
+ 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=Debug.MemoryInfo.NUM_OTHER_STATS;
- i<Debug.MemoryInfo.NUM_OTHER_STATS + Debug.MemoryInfo.NUM_DVK_STATS; i++) {
+ 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);
@@ -2133,7 +2080,7 @@ public final class ActivityThread {
final int myPrivateClean = memInfo.getOtherPrivateClean(i);
final int mySwappedOut = memInfo.getOtherSwappedOut(i);
if (myPss != 0 || mySharedDirty != 0 || myPrivateDirty != 0
- || mySharedClean != 0 || myPrivateClean != 0) {
+ || mySharedClean != 0 || myPrivateClean != 0 || mySwappedOut != 0) {
if (dumpFullInfo) {
printRow(pw, HEAP_FULL_COLUMN, Debug.MemoryInfo.getOtherLabel(i),
myPss, mySwappablePss, mySharedDirty, myPrivateDirty,
@@ -2143,9 +2090,89 @@ public final class ActivityThread {
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(" App Summary");
+ printRow(pw, ONE_COUNT_COLUMN_HEADER, "", "Pss(KB)");
+ printRow(pw, ONE_COUNT_COLUMN_HEADER, "", "------");
+ printRow(pw, ONE_COUNT_COLUMN,
+ "Java Heap:", memInfo.getSummaryJavaHeap());
+ printRow(pw, ONE_COUNT_COLUMN,
+ "Native Heap:", memInfo.getSummaryNativeHeap());
+ printRow(pw, ONE_COUNT_COLUMN,
+ "Code:", memInfo.getSummaryCode());
+ printRow(pw, ONE_COUNT_COLUMN,
+ "Stack:", memInfo.getSummaryStack());
+ printRow(pw, ONE_COUNT_COLUMN,
+ "Graphics:", memInfo.getSummaryGraphics());
+ printRow(pw, ONE_COUNT_COLUMN,
+ "Private Other:", memInfo.getSummaryPrivateOther());
+ printRow(pw, ONE_COUNT_COLUMN,
+ "System:", memInfo.getSummarySystem());
+ pw.println(" ");
+ printRow(pw, TWO_COUNT_COLUMNS,
+ "TOTAL:", memInfo.getSummaryTotalPss(),
+ "TOTAL SWAP (KB):", memInfo.getSummaryTotalSwap());
}
public void registerOnActivityPausedListener(Activity activity,
diff --git a/core/java/android/app/ApplicationThreadNative.java b/core/java/android/app/ApplicationThreadNative.java
index b6989ab..1461380 100644
--- a/core/java/android/app/ApplicationThreadNative.java
+++ b/core/java/android/app/ApplicationThreadNative.java
@@ -529,10 +529,12 @@ public abstract class ApplicationThreadNative extends Binder
boolean checkin = data.readInt() != 0;
boolean dumpInfo = data.readInt() != 0;
boolean dumpDalvik = data.readInt() != 0;
+ boolean dumpSummaryOnly = data.readInt() != 0;
String[] args = data.readStringArray();
if (fd != null) {
try {
- dumpMemInfo(fd.getFileDescriptor(), mi, checkin, dumpInfo, dumpDalvik, args);
+ dumpMemInfo(fd.getFileDescriptor(), mi, checkin, dumpInfo,
+ dumpDalvik, dumpSummaryOnly, args);
} finally {
try {
fd.close();
@@ -1248,7 +1250,7 @@ class ApplicationThreadProxy implements IApplicationThread {
}
public void dumpMemInfo(FileDescriptor fd, Debug.MemoryInfo mem, boolean checkin,
- boolean dumpInfo, boolean dumpDalvik, String[] args) throws RemoteException {
+ boolean dumpInfo, boolean dumpDalvik, boolean dumpSummaryOnly, String[] args) throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken(IApplicationThread.descriptor);
@@ -1257,6 +1259,7 @@ class ApplicationThreadProxy implements IApplicationThread {
data.writeInt(checkin ? 1 : 0);
data.writeInt(dumpInfo ? 1 : 0);
data.writeInt(dumpDalvik ? 1 : 0);
+ data.writeInt(dumpSummaryOnly ? 1 : 0);
data.writeStringArray(args);
mRemote.transact(DUMP_MEM_INFO_TRANSACTION, data, reply, 0);
reply.readException();
diff --git a/core/java/android/app/AssistStructure.java b/core/java/android/app/AssistStructure.java
index 3abbb5b..a06bc31 100644
--- a/core/java/android/app/AssistStructure.java
+++ b/core/java/android/app/AssistStructure.java
@@ -35,6 +35,7 @@ import android.util.Log;
import android.view.View;
import android.view.ViewAssistStructure;
import android.view.ViewRootImpl;
+import android.view.WindowManager;
import android.view.WindowManagerGlobal;
import java.util.ArrayList;
@@ -140,7 +141,14 @@ final public class AssistStructure implements Parcelable {
mTitle = root.getTitle();
mRoot = new ViewNode();
ViewNodeBuilder builder = new ViewNodeBuilder(assist, mRoot, false);
- view.dispatchProvideAssistStructure(builder);
+ if ((root.getWindowFlags()&WindowManager.LayoutParams.FLAG_SECURE) != 0) {
+ // This is a secure window, so it doesn't want a screenshot, and that
+ // means we should also not copy out its view hierarchy.
+ view.onProvideStructure(builder);
+ builder.setAssistBlocked(true);
+ return;
+ }
+ view.dispatchProvideStructure(builder);
}
WindowNode(Parcel in, PooledStringReader preader) {
@@ -652,7 +660,7 @@ final public class AssistStructure implements Parcelable {
}
@Override
- public Bundle editExtras() {
+ public Bundle getExtras() {
if (mNode.mExtras != null) {
return mNode.mExtras;
}
@@ -661,8 +669,8 @@ final public class AssistStructure implements Parcelable {
}
@Override
- public void clearExtras() {
- mNode.mExtras = null;
+ public boolean hasExtras() {
+ return mNode.mExtras != null;
}
@Override
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index 81a78f6..cb20cb8 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -237,8 +237,11 @@ class ContextImpl extends Context {
}
@Override
- public void setTheme(int resid) {
- mThemeResource = resid;
+ public void setTheme(int resId) {
+ if (mThemeResource != resId) {
+ mThemeResource = resId;
+ initializeTheme();
+ }
}
@Override
@@ -248,13 +251,22 @@ class ContextImpl extends Context {
@Override
public Resources.Theme getTheme() {
+ if (mTheme != null) {
+ return mTheme;
+ }
+
+ mThemeResource = Resources.selectDefaultTheme(mThemeResource,
+ getOuterContext().getApplicationInfo().targetSdkVersion);
+ initializeTheme();
+
+ return mTheme;
+ }
+
+ private void initializeTheme() {
if (mTheme == null) {
- mThemeResource = Resources.selectDefaultTheme(mThemeResource,
- getOuterContext().getApplicationInfo().targetSdkVersion);
mTheme = mResources.newTheme();
- mTheme.applyStyle(mThemeResource, true);
}
- return mTheme;
+ mTheme.applyStyle(mThemeResource, true);
}
@Override
diff --git a/core/java/android/app/IApplicationThread.java b/core/java/android/app/IApplicationThread.java
index 3fb82f6..185578f 100644
--- a/core/java/android/app/IApplicationThread.java
+++ b/core/java/android/app/IApplicationThread.java
@@ -131,7 +131,7 @@ public interface IApplicationThread extends IInterface {
void updatePackageCompatibilityInfo(String pkg, CompatibilityInfo info) throws RemoteException;
void scheduleTrimMemory(int level) throws RemoteException;
void dumpMemInfo(FileDescriptor fd, Debug.MemoryInfo mem, boolean checkin, boolean dumpInfo,
- boolean dumpDalvik, String[] args) throws RemoteException;
+ boolean dumpDalvik, boolean dumpSummaryOnly, String[] args) throws RemoteException;
void dumpGfxInfo(FileDescriptor fd, String[] args) throws RemoteException;
void dumpDbInfo(FileDescriptor fd, String[] args) throws RemoteException;
void unstableProviderDied(IBinder provider) throws RemoteException;
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 8009b6c..355f298 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -1653,9 +1653,9 @@ public class DevicePolicyManager {
}
/**
- * Queries whether {@link #DO_NOT_ASK_CREDENTIALS_ON_BOOT} flag is set.
+ * Queries whether {@link #RESET_PASSWORD_DO_NOT_ASK_CREDENTIALS_ON_BOOT} flag is set.
*
- * @return true if DO_NOT_ASK_CREDENTIALS_ON_BOOT flag is set.
+ * @return true if RESET_PASSWORD_DO_NOT_ASK_CREDENTIALS_ON_BOOT flag is set.
* @hide
*/
public boolean getDoNotAskCredentialsOnBoot() {
@@ -1753,7 +1753,7 @@ public class DevicePolicyManager {
* is ignored. Once the flag is set, it cannot be reverted back without resetting the
* device to factory defaults.
*/
- public static final int DO_NOT_ASK_CREDENTIALS_ON_BOOT = 0x0002;
+ public static final int RESET_PASSWORD_DO_NOT_ASK_CREDENTIALS_ON_BOOT = 0x0002;
/**
* Force a new device unlock password (the password needed to access the
@@ -1779,7 +1779,7 @@ public class DevicePolicyManager {
*
* @param password The new password for the user. Null or empty clears the password.
* @param flags May be 0 or combination of {@link #RESET_PASSWORD_REQUIRE_ENTRY} and
- * {@link #DO_NOT_ASK_CREDENTIALS_ON_BOOT}.
+ * {@link #RESET_PASSWORD_DO_NOT_ASK_CREDENTIALS_ON_BOOT}.
* @return Returns true if the password was applied, or false if it is
* not acceptable for the current constraints.
*/
diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java
index 0a77868..ec6f18d 100644
--- a/core/java/android/bluetooth/BluetoothAdapter.java
+++ b/core/java/android/bluetooth/BluetoothAdapter.java
@@ -28,14 +28,11 @@ import android.bluetooth.le.ScanRecord;
import android.bluetooth.le.ScanResult;
import android.bluetooth.le.ScanSettings;
import android.content.Context;
+import android.os.Binder;
import android.os.IBinder;
import android.os.ParcelUuid;
import android.os.RemoteException;
import android.os.ServiceManager;
-import android.app.ActivityThread;
-import android.os.SystemProperties;
-import android.provider.Settings;
-import android.os.Binder;
import android.util.Log;
import android.util.Pair;
@@ -1255,7 +1252,7 @@ public final class BluetoothAdapter {
* @return true if chipset supports on-chip filtering
*/
public boolean isOffloadedFilteringSupported() {
- if (getState() != STATE_ON) return false;
+ if (!getLeAccess()) return false;
try {
return mService.isOffloadedFilteringSupported();
} catch (RemoteException e) {
@@ -1270,7 +1267,7 @@ public final class BluetoothAdapter {
* @return true if chipset supports on-chip scan batching
*/
public boolean isOffloadedScanBatchingSupported() {
- if (getState() != STATE_ON) return false;
+ if (!getLeAccess()) return false;
try {
return mService.isOffloadedScanBatchingSupported();
} catch (RemoteException e) {
@@ -1286,7 +1283,7 @@ public final class BluetoothAdapter {
* @hide
*/
public boolean isHardwareTrackingFiltersAvailable() {
- if (getState() != STATE_ON) return false;
+ if (!getLeAccess()) return false;
try {
IBluetoothGatt iGatt = mManagerService.getBluetoothGatt();
if (iGatt == null) {
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 7ff6ec3..51fa075 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -1067,6 +1067,13 @@ public abstract class PackageManager {
public static final String FEATURE_AUDIO_OUTPUT = "android.hardware.audio.output";
/**
+ * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
+ * The device has professional audio level of functionality, performance, and acoustics.
+ */
+ @SdkConstant(SdkConstantType.FEATURE)
+ public static final String FEATURE_AUDIO_PRO = "android.hardware.audio.pro";
+
+ /**
* Feature for {@link #getSystemAvailableFeatures} and
* {@link #hasSystemFeature}: The device is capable of communicating with
* other devices via Bluetooth.
diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java
index 1d108a2..a572590 100644
--- a/core/java/android/content/res/Resources.java
+++ b/core/java/android/content/res/Resources.java
@@ -20,7 +20,6 @@ import android.annotation.AttrRes;
import android.annotation.ColorInt;
import android.annotation.StyleRes;
import android.annotation.StyleableRes;
-
import com.android.internal.util.GrowingArrayUtils;
import com.android.internal.util.XmlUtils;
@@ -62,6 +61,7 @@ import android.util.Pools.SynchronizedPool;
import android.util.Slog;
import android.util.TypedValue;
import android.view.ViewDebug;
+import android.view.ViewHierarchyEncoder;
import java.io.IOException;
import java.io.InputStream;
@@ -1804,14 +1804,28 @@ public class Resources {
final int N = mKey.mCount;
final String[] themes = new String[N * 2];
for (int i = 0, j = N - 1; i < themes.length; i += 2, --j) {
- final int resId = mKey.mResId[i];
- final boolean forced = mKey.mForce[i];
- themes[i] = getResourceName(resId);
+ final int resId = mKey.mResId[j];
+ final boolean forced = mKey.mForce[j];
+ try {
+ themes[i] = getResourceName(resId);
+ } catch (NotFoundException e) {
+ themes[i] = Integer.toHexString(i);
+ }
themes[i + 1] = forced ? "forced" : "not forced";
}
return themes;
}
+ /** @hide */
+ public void encode(@NonNull ViewHierarchyEncoder encoder) {
+ encoder.beginObject(this);
+ final String[] properties = getTheme();
+ for (int i = 0; i < properties.length; i += 2) {
+ encoder.addProperty(properties[i], properties[i+1]);
+ }
+ encoder.endObject();
+ }
+
/**
* Rebases the theme against the parent Resource object's current
* configuration by re-applying the styles passed to
diff --git a/core/java/android/ddm/DdmHandleViewDebug.java b/core/java/android/ddm/DdmHandleViewDebug.java
index 3a36b0a..be48633 100644
--- a/core/java/android/ddm/DdmHandleViewDebug.java
+++ b/core/java/android/ddm/DdmHandleViewDebug.java
@@ -229,15 +229,25 @@ public class DdmHandleViewDebug extends ChunkHandler {
private Chunk dumpHierarchy(View rootView, ByteBuffer in) {
boolean skipChildren = in.getInt() > 0;
boolean includeProperties = in.getInt() > 0;
+ boolean v2 = in.hasRemaining() && in.getInt() > 0;
- ByteArrayOutputStream b = new ByteArrayOutputStream(1024);
+ long start = System.currentTimeMillis();
+
+ ByteArrayOutputStream b = new ByteArrayOutputStream(2*1024*1024);
try {
- ViewDebug.dump(rootView, skipChildren, includeProperties, b);
- } catch (IOException e) {
+ if (v2) {
+ ViewDebug.dumpv2(rootView, b);
+ } else {
+ ViewDebug.dump(rootView, skipChildren, includeProperties, b);
+ }
+ } catch (IOException | InterruptedException e) {
return createFailChunk(1, "Unexpected error while obtaining view hierarchy: "
+ e.getMessage());
}
+ long end = System.currentTimeMillis();
+ Log.d(TAG, "Time to obtain view hierarchy (ms): " + (end - start));
+
byte[] data = b.toByteArray();
return new Chunk(CHUNK_VURT, data, 0, data.length);
}
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index 36fc4f9..50eed3e 100644
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -173,6 +173,27 @@ public class Build {
"ro.build.version.sdk", 0);
/**
+ * The developer preview revision of a prerelease SDK. This value will always
+ * be <code>0</code> on production platform builds/devices.
+ *
+ * <p>When this value is nonzero, any new API added since the last
+ * officially published {@link #SDK_INT API level} is only guaranteed to be present
+ * on that specific preview revision. For example, an API <code>Activity.fooBar()</code>
+ * might be present in preview revision 1 but renamed or removed entirely in
+ * preview revision 2, which may cause an app attempting to call it to crash
+ * at runtime.</p>
+ *
+ * <p>Experimental apps targeting preview APIs should check this value for
+ * equality (<code>==</code>) with the preview SDK revision they were built for
+ * before using any prerelease platform APIs. Apps that detect a preview SDK revision
+ * other than the specific one they expect should fall back to using APIs from
+ * the previously published API level only to avoid unwanted runtime exceptions.
+ * </p>
+ */
+ public static final int PREVIEW_SDK_INT = SystemProperties.getInt(
+ "ro.build.version.preview_sdk", 0);
+
+ /**
* The current development codename, or the string "REL" if this is
* a release build.
*/
diff --git a/core/java/android/os/Debug.java b/core/java/android/os/Debug.java
index 4aff7a1..19c8fa9 100644
--- a/core/java/android/os/Debug.java
+++ b/core/java/android/os/Debug.java
@@ -169,6 +169,65 @@ public final class Debug
public int otherSwappedOut;
/** @hide */
+ public static final int HEAP_UNKNOWN = 0;
+ /** @hide */
+ public static final int HEAP_DALVIK = 1;
+ /** @hide */
+ public static final int HEAP_NATIVE = 2;
+
+ /** @hide */
+ public static final int OTHER_DALVIK_OTHER = 0;
+ /** @hide */
+ public static final int OTHER_STACK = 1;
+ /** @hide */
+ public static final int OTHER_CURSOR = 2;
+ /** @hide */
+ public static final int OTHER_ASHMEM = 3;
+ /** @hide */
+ public static final int OTHER_GL_DEV = 4;
+ /** @hide */
+ public static final int OTHER_UNKNOWN_DEV = 5;
+ /** @hide */
+ public static final int OTHER_SO = 6;
+ /** @hide */
+ public static final int OTHER_JAR = 7;
+ /** @hide */
+ public static final int OTHER_APK = 8;
+ /** @hide */
+ public static final int OTHER_TTF = 9;
+ /** @hide */
+ public static final int OTHER_DEX = 10;
+ /** @hide */
+ public static final int OTHER_OAT = 11;
+ /** @hide */
+ public static final int OTHER_ART = 12;
+ /** @hide */
+ public static final int OTHER_UNKNOWN_MAP = 13;
+ /** @hide */
+ public static final int OTHER_GRAPHICS = 14;
+ /** @hide */
+ public static final int OTHER_GL = 15;
+ /** @hide */
+ public static final int OTHER_OTHER_MEMTRACK = 16;
+
+ /** @hide */
+ public static final int OTHER_DALVIK_NORMAL = 17;
+ /** @hide */
+ public static final int OTHER_DALVIK_LARGE = 18;
+ /** @hide */
+ public static final int OTHER_DALVIK_LINEARALLOC = 19;
+ /** @hide */
+ public static final int OTHER_DALVIK_ACCOUNTING = 20;
+ /** @hide */
+ public static final int OTHER_DALVIK_CODE_CACHE = 21;
+ /** @hide */
+ public static final int OTHER_DALVIK_ZYGOTE = 22;
+ /** @hide */
+ public static final int OTHER_DALVIK_NON_MOVING = 23;
+ /** @hide */
+ public static final int OTHER_DALVIK_INDIRECT_REFERENCE_TABLE = 24;
+
+ /** @hide */
public static final int NUM_OTHER_STATS = 17;
/** @hide */
@@ -284,6 +343,11 @@ public final class Debug
}
/** @hide */
+ public int getOtherPrivate(int which) {
+ return getOtherPrivateClean(which) + getOtherPrivateDirty(which);
+ }
+
+ /** @hide */
public int getOtherSharedClean(int which) {
return otherStats[which*NUM_CATEGORIES + offsetSharedClean];
}
@@ -296,35 +360,157 @@ public final class Debug
/** @hide */
public static String getOtherLabel(int which) {
switch (which) {
- case 0: return "Dalvik Other";
- case 1: return "Stack";
- case 2: return "Cursor";
- case 3: return "Ashmem";
- case 4: return "Gfx dev";
- case 5: return "Other dev";
- case 6: return ".so mmap";
- case 7: return ".jar mmap";
- case 8: return ".apk mmap";
- case 9: return ".ttf mmap";
- case 10: return ".dex mmap";
- case 11: return ".oat mmap";
- case 12: return ".art mmap";
- case 13: return "Other mmap";
- case 14: return "EGL mtrack";
- case 15: return "GL mtrack";
- case 16: return "Other mtrack";
- case 17: return ".Heap";
- case 18: return ".LOS";
- case 19: return ".LinearAlloc";
- case 20: return ".GC";
- case 21: return ".JITCache";
- case 22: return ".Zygote";
- case 23: return ".NonMoving";
- case 24: return ".IndirectRef";
+ case OTHER_DALVIK_OTHER: return "Dalvik Other";
+ case OTHER_STACK: return "Stack";
+ case OTHER_CURSOR: return "Cursor";
+ case OTHER_ASHMEM: return "Ashmem";
+ case OTHER_GL_DEV: return "Gfx dev";
+ case OTHER_UNKNOWN_DEV: return "Other dev";
+ case OTHER_SO: return ".so mmap";
+ case OTHER_JAR: return ".jar mmap";
+ case OTHER_APK: return ".apk mmap";
+ case OTHER_TTF: return ".ttf mmap";
+ case OTHER_DEX: return ".dex mmap";
+ case OTHER_OAT: return ".oat mmap";
+ case OTHER_ART: return ".art mmap";
+ case OTHER_UNKNOWN_MAP: return "Other mmap";
+ case OTHER_GRAPHICS: return "EGL mtrack";
+ case OTHER_GL: return "GL mtrack";
+ case OTHER_OTHER_MEMTRACK: return "Other mtrack";
+ case OTHER_DALVIK_NORMAL: return ".Heap";
+ case OTHER_DALVIK_LARGE: return ".LOS";
+ case OTHER_DALVIK_LINEARALLOC: return ".LinearAlloc";
+ case OTHER_DALVIK_ACCOUNTING: return ".GC";
+ case OTHER_DALVIK_CODE_CACHE: return ".JITCache";
+ case OTHER_DALVIK_ZYGOTE: return ".Zygote";
+ case OTHER_DALVIK_NON_MOVING: return ".NonMoving";
+ case OTHER_DALVIK_INDIRECT_REFERENCE_TABLE: return ".IndirectRef";
default: return "????";
}
}
+ /**
+ * Pss of Java Heap bytes in KB due to the application.
+ * Notes:
+ * * OTHER_ART is the boot image. Anything private here is blamed on
+ * the application, not the system.
+ * * dalvikPrivateDirty includes private zygote, which means the
+ * application dirtied something allocated by the zygote. We blame
+ * the application for that memory, not the system.
+ * * Does not include OTHER_DALVIK_OTHER, which is considered VM
+ * Overhead and lumped into Private Other.
+ * * We don't include dalvikPrivateClean, because there should be no
+ * such thing as private clean for the Java Heap.
+ * @hide
+ */
+ public int getSummaryJavaHeap() {
+ return dalvikPrivateDirty + getOtherPrivate(OTHER_ART);
+ }
+
+ /**
+ * Pss of Native Heap bytes in KB due to the application.
+ * Notes:
+ * * Includes private dirty malloc space.
+ * * We don't include nativePrivateClean, because there should be no
+ * such thing as private clean for the Native Heap.
+ * @hide
+ */
+ public int getSummaryNativeHeap() {
+ return nativePrivateDirty;
+ }
+
+ /**
+ * Pss of code and other static resource bytes in KB due to
+ * the application.
+ * @hide
+ */
+ public int getSummaryCode() {
+ return getOtherPrivate(OTHER_SO)
+ + getOtherPrivate(OTHER_JAR)
+ + getOtherPrivate(OTHER_APK)
+ + getOtherPrivate(OTHER_TTF)
+ + getOtherPrivate(OTHER_DEX)
+ + getOtherPrivate(OTHER_OAT);
+ }
+
+ /**
+ * Pss in KB of the stack due to the application.
+ * Notes:
+ * * Includes private dirty stack, which includes both Java and Native
+ * stack.
+ * * Does not include private clean stack, because there should be no
+ * such thing as private clean for the stack.
+ * @hide
+ */
+ public int getSummaryStack() {
+ return getOtherPrivateDirty(OTHER_STACK);
+ }
+
+ /**
+ * Pss in KB of graphics due to the application.
+ * Notes:
+ * * Includes private Gfx, EGL, and GL.
+ * * Warning: These numbers can be misreported by the graphics drivers.
+ * * We don't include shared graphics. It may make sense to, because
+ * shared graphics are likely buffers due to the application
+ * anyway, but it's simpler to implement to just group all shared
+ * memory into the System category.
+ * @hide
+ */
+ public int getSummaryGraphics() {
+ return getOtherPrivate(OTHER_GL_DEV)
+ + getOtherPrivate(OTHER_GRAPHICS)
+ + getOtherPrivate(OTHER_GL);
+ }
+
+ /**
+ * Pss in KB due to the application that haven't otherwise been
+ * accounted for.
+ * @hide
+ */
+ public int getSummaryPrivateOther() {
+ return getTotalPrivateClean()
+ + getTotalPrivateDirty()
+ - getSummaryJavaHeap()
+ - getSummaryNativeHeap()
+ - getSummaryCode()
+ - getSummaryStack()
+ - getSummaryGraphics();
+ }
+
+ /**
+ * Pss in KB due to the system.
+ * Notes:
+ * * Includes all shared memory.
+ * @hide
+ */
+ public int getSummarySystem() {
+ return getTotalPss()
+ - getTotalPrivateClean()
+ - getTotalPrivateDirty();
+ }
+
+ /**
+ * Total Pss in KB.
+ * @hide
+ */
+ public int getSummaryTotalPss() {
+ return getTotalPss();
+ }
+
+ /**
+ * Total Swap in KB.
+ * Notes:
+ * * Some of this memory belongs in other categories, but we don't
+ * know if the Swap memory is shared or private, so we don't know
+ * what to blame on the application and what on the system.
+ * For now, just lump all the Swap in one place.
+ * @hide
+ */
+ public int getSummaryTotalSwap() {
+ return getTotalSwappedOut();
+ }
+
public int describeContents() {
return 0;
}
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index a7af838..7c3c11b 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -6156,6 +6156,17 @@ public final class Settings {
*/
public static final String MOBILE_DATA = "mobile_data";
+ /**
+ * Whether the mobile data connection should remain active even when higher
+ * priority networks like WiFi are active, to help make network switching faster.
+ *
+ * See ConnectivityService for more info.
+ *
+ * (0 = disabled, 1 = enabled)
+ * @hide
+ */
+ public static final String MOBILE_DATA_ALWAYS_ON = "mobile_data_always_on";
+
/** {@hide} */
public static final String NETSTATS_ENABLED = "netstats_enabled";
/** {@hide} */
diff --git a/core/java/android/view/ContextThemeWrapper.java b/core/java/android/view/ContextThemeWrapper.java
index 9047b1d..ce50091 100644
--- a/core/java/android/view/ContextThemeWrapper.java
+++ b/core/java/android/view/ContextThemeWrapper.java
@@ -87,9 +87,12 @@ public class ContextThemeWrapper extends ContextWrapper {
}
}
- @Override public void setTheme(int resid) {
- mThemeResource = resid;
- initializeTheme();
+ @Override
+ public void setTheme(int resid) {
+ if (mThemeResource != resid) {
+ mThemeResource = resid;
+ initializeTheme();
+ }
}
/** @hide */
diff --git a/core/java/android/view/GhostView.java b/core/java/android/view/GhostView.java
index 9f46f45..41502b6 100644
--- a/core/java/android/view/GhostView.java
+++ b/core/java/android/view/GhostView.java
@@ -82,8 +82,7 @@ public class GhostView extends View {
mView.mGhostView = null;
final ViewGroup parent = (ViewGroup) mView.getParent();
if (parent != null) {
- parent.mRecreateDisplayList = true;
- parent.updateDisplayListIfDirty();
+ parent.invalidate();
}
}
}
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index f62e6a2..e1f1816 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -633,7 +633,6 @@ import java.util.concurrent.atomic.AtomicInteger;
* </p>
*
* @attr ref android.R.styleable#View_alpha
- * @attr ref android.R.styleable#View_assistBlocked
* @attr ref android.R.styleable#View_background
* @attr ref android.R.styleable#View_clickable
* @attr ref android.R.styleable#View_contentDescription
@@ -2533,7 +2532,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
PFLAG3_SCROLL_INDICATOR_END >> SCROLL_INDICATORS_TO_PFLAGS3_LSHIFT;
/**
- * <p>Indicates that we are allowing {@link android.view.ViewAssistStructure} to traverse
+ * <p>Indicates that we are allowing {@link ViewStructure} to traverse
* into this view.<p>
*/
static final int PFLAG3_ASSIST_BLOCKED = 0x100;
@@ -4050,11 +4049,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
viewFlagMasks |= SAVE_DISABLED_MASK;
}
break;
- case com.android.internal.R.styleable.View_assistBlocked:
- if (a.getBoolean(attr, false)) {
- mPrivateFlags3 |= PFLAG3_ASSIST_BLOCKED;
- }
- break;
case com.android.internal.R.styleable.View_duplicateParentState:
if (a.getBoolean(attr, false)) {
viewFlagValues |= DUPLICATE_PARENT_STATE;
@@ -6163,7 +6157,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* @param structure Fill in with structured view data. The default implementation
* fills in all data that can be inferred from the view itself.
*/
- public void onProvideAssistStructure(ViewAssistStructure structure) {
+ public void onProvideStructure(ViewStructure structure) {
final int id = mID;
if (id > 0 && (id&0xff000000) != 0 && (id&0x00ff0000) != 0
&& (id&0x0000ffff) != 0) {
@@ -6217,6 +6211,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
structure.setContentDescription(getContentDescription());
}
+ /** @hide */
+ public void onProvideAssistStructure(ViewStructure structure) {
+ onProvideStructure(structure);
+ }
+
/**
* Called when assist structure is being retrieved from a view as part of
* {@link android.app.Activity#onProvideAssistData Activity.onProvideAssistData} to
@@ -6225,19 +6224,24 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* view's virtual accessibility nodes, if any. You can override this for a more
* optimal implementation providing this data.
*/
- public void onProvideVirtualAssistStructure(ViewAssistStructure structure) {
+ public void onProvideVirtualStructure(ViewStructure structure) {
AccessibilityNodeProvider provider = getAccessibilityNodeProvider();
if (provider != null) {
AccessibilityNodeInfo info = createAccessibilityNodeInfo();
Log.i("View", "Provider of " + this + ": children=" + info.getChildCount());
structure.setChildCount(1);
- ViewAssistStructure root = structure.newChild(0);
- populateVirtualAssistStructure(root, provider, info);
+ ViewStructure root = structure.newChild(0);
+ populateVirtualStructure(root, provider, info);
info.recycle();
}
}
- private void populateVirtualAssistStructure(ViewAssistStructure structure,
+ /** @hide */
+ public void onProvideVirtualAssistStructure(ViewStructure structure) {
+ onProvideVirtualStructure(structure);
+ }
+
+ private void populateVirtualStructure(ViewStructure structure,
AccessibilityNodeProvider provider, AccessibilityNodeInfo info) {
structure.setId(AccessibilityNodeInfo.getVirtualDescendantId(info.getSourceNodeId()),
null, null, null);
@@ -6288,19 +6292,19 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
for (int i=0; i<NCHILDREN; i++) {
AccessibilityNodeInfo cinfo = provider.createAccessibilityNodeInfo(
AccessibilityNodeInfo.getVirtualDescendantId(info.getChildId(i)));
- ViewAssistStructure child = structure.newChild(i);
- populateVirtualAssistStructure(child, provider, cinfo);
+ ViewStructure child = structure.newChild(i);
+ populateVirtualStructure(child, provider, cinfo);
cinfo.recycle();
}
}
}
/**
- * Dispatch creation of {@link ViewAssistStructure} down the hierarchy. The default
- * implementation calls {@link #onProvideAssistStructure} and
- * {@link #onProvideVirtualAssistStructure}.
+ * Dispatch creation of {@link ViewStructure} down the hierarchy. The default
+ * implementation calls {@link #onProvideStructure} and
+ * {@link #onProvideVirtualStructure}.
*/
- public void dispatchProvideAssistStructure(ViewAssistStructure structure) {
+ public void dispatchProvideStructure(ViewStructure structure) {
if (!isAssistBlocked()) {
onProvideAssistStructure(structure);
onProvideVirtualAssistStructure(structure);
@@ -7904,8 +7908,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
}
/**
+ * @hide
* Indicates whether this view will participate in data collection through
- * {@link android.view.ViewAssistStructure}. If true, it will not provide any data
+ * {@link ViewStructure}. If true, it will not provide any data
* for itself or its children. If false, the normal data collection will be allowed.
*
* @return Returns false if assist data collection is not blocked, else true.
@@ -7918,17 +7923,18 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
}
/**
+ * @hide
* Controls whether assist data collection from this view and its children is enabled
- * (that is, whether {@link #onProvideAssistStructure} and
- * {@link #onProvideVirtualAssistStructure} will be called). The default value is false,
+ * (that is, whether {@link #onProvideStructure} and
+ * {@link #onProvideVirtualStructure} will be called). The default value is false,
* allowing normal assist collection. Setting this to false will disable assist collection.
*
* @param enabled Set to true to <em>disable</em> assist data collection, or false
* (the default) to allow it.
*
* @see #isAssistBlocked()
- * @see #onProvideAssistStructure
- * @see #onProvideVirtualAssistStructure
+ * @see #onProvideStructure
+ * @see #onProvideVirtualStructure
* @attr ref android.R.styleable#View_assistBlocked
*/
public void setAssistBlocked(boolean enabled) {
@@ -22353,4 +22359,138 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
final String output = bits + " " + name;
found.put(key, output);
}
+
+ /** {@hide} */
+ public void encode(@NonNull ViewHierarchyEncoder stream) {
+ stream.beginObject(this);
+ encodeProperties(stream);
+ stream.endObject();
+ }
+
+ /** {@hide} */
+ @CallSuper
+ protected void encodeProperties(@NonNull ViewHierarchyEncoder stream) {
+ Object resolveId = ViewDebug.resolveId(getContext(), mID);
+ if (resolveId instanceof String) {
+ stream.addProperty("id", (String) resolveId);
+ } else {
+ stream.addProperty("id", mID);
+ }
+
+ stream.addProperty("misc:transformation.alpha",
+ mTransformationInfo != null ? mTransformationInfo.mAlpha : 0);
+ stream.addProperty("misc:transitionName", getTransitionName());
+
+ // layout
+ stream.addProperty("layout:left", mLeft);
+ stream.addProperty("layout:right", mRight);
+ stream.addProperty("layout:top", mTop);
+ stream.addProperty("layout:bottom", mBottom);
+ stream.addProperty("layout:width", getWidth());
+ stream.addProperty("layout:height", getHeight());
+ stream.addProperty("layout:layoutDirection", getLayoutDirection());
+ stream.addProperty("layout:layoutRtl", isLayoutRtl());
+ stream.addProperty("layout:hasTransientState", hasTransientState());
+ stream.addProperty("layout:baseline", getBaseline());
+
+ // layout params
+ ViewGroup.LayoutParams layoutParams = getLayoutParams();
+ if (layoutParams != null) {
+ stream.addPropertyKey("layoutParams");
+ layoutParams.encode(stream);
+ }
+
+ // scrolling
+ stream.addProperty("scrolling:scrollX", mScrollX);
+ stream.addProperty("scrolling:scrollY", mScrollY);
+
+ // padding
+ stream.addProperty("padding:paddingLeft", mPaddingLeft);
+ stream.addProperty("padding:paddingRight", mPaddingRight);
+ stream.addProperty("padding:paddingTop", mPaddingTop);
+ stream.addProperty("padding:paddingBottom", mPaddingBottom);
+ stream.addProperty("padding:userPaddingRight", mUserPaddingRight);
+ stream.addProperty("padding:userPaddingLeft", mUserPaddingLeft);
+ stream.addProperty("padding:userPaddingBottom", mUserPaddingBottom);
+ stream.addProperty("padding:userPaddingStart", mUserPaddingStart);
+ stream.addProperty("padding:userPaddingEnd", mUserPaddingEnd);
+
+ // measurement
+ stream.addProperty("measurement:minHeight", mMinHeight);
+ stream.addProperty("measurement:minWidth", mMinWidth);
+ stream.addProperty("measurement:measuredWidth", mMeasuredWidth);
+ stream.addProperty("measurement:measuredHeight", mMeasuredHeight);
+
+ // drawing
+ stream.addProperty("drawing:elevation", getElevation());
+ stream.addProperty("drawing:translationX", getTranslationX());
+ stream.addProperty("drawing:translationY", getTranslationY());
+ stream.addProperty("drawing:translationZ", getTranslationZ());
+ stream.addProperty("drawing:rotation", getRotation());
+ stream.addProperty("drawing:rotationX", getRotationX());
+ stream.addProperty("drawing:rotationY", getRotationY());
+ stream.addProperty("drawing:scaleX", getScaleX());
+ stream.addProperty("drawing:scaleY", getScaleY());
+ stream.addProperty("drawing:pivotX", getPivotX());
+ stream.addProperty("drawing:pivotY", getPivotY());
+ stream.addProperty("drawing:opaque", isOpaque());
+ stream.addProperty("drawing:alpha", getAlpha());
+ stream.addProperty("drawing:transitionAlpha", getTransitionAlpha());
+ stream.addProperty("drawing:shadow", hasShadow());
+ stream.addProperty("drawing:solidColor", getSolidColor());
+ stream.addProperty("drawing:layerType", mLayerType);
+ stream.addProperty("drawing:willNotDraw", willNotDraw());
+ stream.addProperty("drawing:hardwareAccelerated", isHardwareAccelerated());
+ stream.addProperty("drawing:willNotCacheDrawing", willNotCacheDrawing());
+ stream.addProperty("drawing:drawingCacheEnabled", isDrawingCacheEnabled());
+ stream.addProperty("drawing:overlappingRendering", hasOverlappingRendering());
+
+ // focus
+ stream.addProperty("focus:hasFocus", hasFocus());
+ stream.addProperty("focus:isFocused", isFocused());
+ stream.addProperty("focus:isFocusable", isFocusable());
+ stream.addProperty("focus:isFocusableInTouchMode", isFocusableInTouchMode());
+
+ stream.addProperty("misc:clickable", isClickable());
+ stream.addProperty("misc:pressed", isPressed());
+ stream.addProperty("misc:selected", isSelected());
+ stream.addProperty("misc:touchMode", isInTouchMode());
+ stream.addProperty("misc:hovered", isHovered());
+ stream.addProperty("misc:activated", isActivated());
+
+ stream.addProperty("misc:visibility", getVisibility());
+ stream.addProperty("misc:fitsSystemWindows", getFitsSystemWindows());
+ stream.addProperty("misc:filterTouchesWhenObscured", getFilterTouchesWhenObscured());
+
+ stream.addProperty("misc:enabled", isEnabled());
+ stream.addProperty("misc:soundEffectsEnabled", isSoundEffectsEnabled());
+ stream.addProperty("misc:hapticFeedbackEnabled", isHapticFeedbackEnabled());
+
+ // theme attributes
+ Resources.Theme theme = getContext().getTheme();
+ if (theme != null) {
+ stream.addPropertyKey("theme");
+ theme.encode(stream);
+ }
+
+ // view attribute information
+ int n = mAttributes != null ? mAttributes.length : 0;
+ stream.addProperty("meta:__attrCount__", n/2);
+ for (int i = 0; i < n; i += 2) {
+ stream.addProperty("meta:__attr__" + mAttributes[i], mAttributes[i+1]);
+ }
+
+ stream.addProperty("misc:scrollBarStyle", getScrollBarStyle());
+
+ // text
+ stream.addProperty("text:textDirection", getTextDirection());
+ stream.addProperty("text:textAlignment", getTextAlignment());
+
+ // accessibility
+ CharSequence contentDescription = getContentDescription();
+ stream.addProperty("accessibility:contentDescription",
+ contentDescription == null ? "" : contentDescription.toString());
+ stream.addProperty("accessibility:labelFor", getLabelFor());
+ stream.addProperty("accessibility:importantForAccessibility", getImportantForAccessibility());
+ }
}
diff --git a/core/java/android/view/ViewAssistStructure.java b/core/java/android/view/ViewAssistStructure.java
index fccfbb8..a66d93c 100644
--- a/core/java/android/view/ViewAssistStructure.java
+++ b/core/java/android/view/ViewAssistStructure.java
@@ -16,70 +16,9 @@
package android.view;
-import android.graphics.Rect;
-import android.os.Bundle;
-import android.text.TextPaint;
-
/**
- * Container for storing additional per-view data generated by {@link View#onProvideAssistStructure
- * View.onProvideAssistStructure}.
+ * @deprecated Temporary until old apps can move off this.
*/
-public abstract class ViewAssistStructure {
- public abstract void setId(int id, String packageName, String typeName, String entryName);
-
- public abstract void setDimens(int left, int top, int scrollX, int scrollY, int width,
- int height);
-
- public abstract void setVisibility(int visibility);
-
- public abstract void setAssistBlocked(boolean state);
-
- public abstract void setEnabled(boolean state);
-
- public abstract void setClickable(boolean state);
-
- public abstract void setLongClickable(boolean state);
-
- public abstract void setStylusButtonPressable(boolean state);
-
- public abstract void setFocusable(boolean state);
-
- public abstract void setFocused(boolean state);
-
- public abstract void setAccessibilityFocused(boolean state);
-
- public abstract void setCheckable(boolean state);
-
- public abstract void setChecked(boolean state);
-
- public abstract void setSelected(boolean state);
-
- public abstract void setActivated(boolean state);
-
- public abstract void setClassName(String className);
-
- public abstract void setContentDescription(CharSequence contentDescription);
-
- public abstract void setText(CharSequence text);
- public abstract void setText(CharSequence text, int selectionStart, int selectionEnd);
- public abstract void setTextPaint(TextPaint paint);
- public abstract void setHint(CharSequence hint);
-
- public abstract CharSequence getText();
- public abstract int getTextSelectionStart();
- public abstract int getTextSelectionEnd();
- public abstract CharSequence getHint();
-
- public abstract Bundle editExtras();
- public abstract void clearExtras();
-
- public abstract void setChildCount(int num);
- public abstract int getChildCount();
- public abstract ViewAssistStructure newChild(int index);
-
- public abstract ViewAssistStructure asyncNewChild(int index);
- public abstract void asyncCommit();
-
- /** @hide */
- public abstract Rect getTempRect();
+@Deprecated
+public abstract class ViewAssistStructure extends ViewStructure {
}
diff --git a/core/java/android/view/ViewDebug.java b/core/java/android/view/ViewDebug.java
index 27304f5..8bf53a8 100644
--- a/core/java/android/view/ViewDebug.java
+++ b/core/java/android/view/ViewDebug.java
@@ -16,6 +16,7 @@
package android.view;
+import android.annotation.NonNull;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
@@ -800,6 +801,7 @@ public class ViewDebug {
/**
* Dumps the view hierarchy starting from the given view.
+ * @deprecated See {@link #dumpv2(View, ByteArrayOutputStream)} below.
* @hide
*/
public static void dump(View root, boolean skipChildren, boolean includeProperties,
@@ -825,6 +827,28 @@ public class ViewDebug {
}
/**
+ * Dumps the view hierarchy starting from the given view.
+ * Rather than using reflection, it uses View's encode method to obtain all the properties.
+ * @hide
+ */
+ public static void dumpv2(@NonNull final View view, @NonNull ByteArrayOutputStream out)
+ throws InterruptedException {
+ final ViewHierarchyEncoder encoder = new ViewHierarchyEncoder(out);
+ final CountDownLatch latch = new CountDownLatch(1);
+
+ view.post(new Runnable() {
+ @Override
+ public void run() {
+ view.encode(encoder);
+ latch.countDown();
+ }
+ });
+
+ latch.await(2, TimeUnit.SECONDS);
+ encoder.endStream();
+ }
+
+ /**
* Dumps the theme attributes from the given View.
* @hide
*/
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index babb4e9..51c4760 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -2878,12 +2878,12 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
}
/**
- * Dispatch creation of {@link ViewAssistStructure} down the hierarchy. This implementation
+ * Dispatch creation of {@link ViewStructure} down the hierarchy. This implementation
* adds in all child views of the view group, in addition to calling the default View
* implementation.
*/
- public void dispatchProvideAssistStructure(ViewAssistStructure structure) {
- super.dispatchProvideAssistStructure(structure);
+ public void dispatchProvideStructure(ViewStructure structure) {
+ super.dispatchProvideStructure(structure);
if (!isAssistBlocked()) {
if (structure.getChildCount() == 0) {
final int childrenCount = getChildCount();
@@ -2898,8 +2898,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
? getChildDrawingOrder(childrenCount, i) : i;
final View child = (preorderedList == null)
? children[childIndex] : preorderedList.get(childIndex);
- ViewAssistStructure cstructure = structure.newChild(i);
- child.dispatchProvideAssistStructure(cstructure);
+ ViewStructure cstructure = structure.newChild(i);
+ child.dispatchProvideStructure(cstructure);
}
}
}
@@ -6861,6 +6861,19 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
}
return String.valueOf(size);
}
+
+ /** @hide */
+ void encode(@NonNull ViewHierarchyEncoder encoder) {
+ encoder.beginObject(this);
+ encodeProperties(encoder);
+ encoder.endObject();
+ }
+
+ /** @hide */
+ protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) {
+ encoder.addProperty("width", width);
+ encoder.addProperty("height", height);
+ }
}
/**
@@ -7329,6 +7342,18 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
bottomMargin,
paint);
}
+
+ /** @hide */
+ @Override
+ protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) {
+ super.encodeProperties(encoder);
+ encoder.addProperty("leftMargin", leftMargin);
+ encoder.addProperty("topMargin", topMargin);
+ encoder.addProperty("rightMargin", rightMargin);
+ encoder.addProperty("bottomMargin", bottomMargin);
+ encoder.addProperty("startMargin", startMargin);
+ encoder.addProperty("endMargin", endMargin);
+ }
}
/* Describes a touched view and the ids of the pointers that it has captured.
@@ -7665,4 +7690,23 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
canvas.drawLines(sDebugLines, paint);
}
+
+ /** @hide */
+ @Override
+ protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) {
+ super.encodeProperties(encoder);
+
+ encoder.addProperty("focus:descendantFocusability", getDescendantFocusability());
+ encoder.addProperty("drawing:clipChildren", getClipChildren());
+ encoder.addProperty("drawing:clipToPadding", getClipToPadding());
+ encoder.addProperty("drawing:childrenDrawingOrderEnabled", isChildrenDrawingOrderEnabled());
+ encoder.addProperty("drawing:persistentDrawingCache", getPersistentDrawingCache());
+
+ int n = getChildCount();
+ encoder.addProperty("meta:__childCount__", (short)n);
+ for (int i = 0; i < n; i++) {
+ encoder.addPropertyKey("meta:__child__" + i);
+ getChildAt(i).encode(encoder);
+ }
+ }
}
diff --git a/core/java/android/view/ViewHierarchyEncoder.java b/core/java/android/view/ViewHierarchyEncoder.java
new file mode 100644
index 0000000..8770216
--- /dev/null
+++ b/core/java/android/view/ViewHierarchyEncoder.java
@@ -0,0 +1,201 @@
+package android.view;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * {@link ViewHierarchyEncoder} is a serializer that is tailored towards writing out
+ * view hierarchies (the view tree, along with the properties for each view) to a stream.
+ *
+ * It is typically used as follows:
+ * <pre>
+ * ViewHierarchyEncoder e = new ViewHierarchyEncoder();
+ *
+ * for (View view : views) {
+ * e.beginObject(view);
+ * e.addProperty("prop1", value);
+ * ...
+ * e.endObject();
+ * }
+ *
+ * // repeat above snippet for each view, finally end with:
+ * e.endStream();
+ * </pre>
+ *
+ * <p>On the stream, a snippet such as the above gets encoded as a series of Map's (one
+ * corresponding to each view) with the property name as the key and the property value
+ * as the value.
+ *
+ * <p>Since the property names are practically the same across all views, rather than using
+ * the property name directly as the key, we use a short integer id corresponding to each
+ * property name as the key. A final map is added at the end which contains the mapping
+ * from the integer to its property name.
+ *
+ * <p>A value is encoded as a single byte type identifier followed by the encoding of the
+ * value. Only primitive types are supported as values, in addition to the Map type.
+ *
+ * @hide
+ */
+public class ViewHierarchyEncoder {
+ // Prefixes for simple primitives. These match the JNI definitions.
+ private static final byte SIG_BOOLEAN = 'Z';
+ private static final byte SIG_BYTE = 'B';
+ private static final byte SIG_SHORT = 'S';
+ private static final byte SIG_INT = 'I';
+ private static final byte SIG_LONG = 'J';
+ private static final byte SIG_FLOAT = 'F';
+ private static final byte SIG_DOUBLE = 'D';
+
+ // Prefixes for some commonly used objects
+ private static final byte SIG_STRING = 'R';
+
+ private static final byte SIG_MAP = 'M'; // a map with an short key
+ private static final short SIG_END_MAP = 0;
+
+ private final DataOutputStream mStream;
+
+ private final Map<String,Short> mPropertyNames = new HashMap<String, Short>(200);
+ private short mPropertyId = 1;
+ private Charset mCharset = Charset.forName("utf-8");
+
+ public ViewHierarchyEncoder(@NonNull ByteArrayOutputStream stream) {
+ mStream = new DataOutputStream(stream);
+ }
+
+ public void beginObject(@NonNull Object o) {
+ startPropertyMap();
+ addProperty("meta:__name__", o.getClass().getName());
+ addProperty("meta:__hash__", o.hashCode());
+ }
+
+ public void endObject() {
+ endPropertyMap();
+ }
+
+ public void endStream() {
+ // write out the string table
+ startPropertyMap();
+ addProperty("__name__", "propertyIndex");
+ for (Map.Entry<String,Short> entry : mPropertyNames.entrySet()) {
+ writeShort(entry.getValue());
+ writeString(entry.getKey());
+ }
+ endPropertyMap();
+ }
+
+ public void addProperty(@NonNull String name, boolean v) {
+ writeShort(createPropertyIndex(name));
+ writeBoolean(v);
+ }
+
+ public void addProperty(@NonNull String name, short s) {
+ writeShort(createPropertyIndex(name));
+ writeShort(s);
+ }
+
+ public void addProperty(@NonNull String name, int v) {
+ writeShort(createPropertyIndex(name));
+ writeInt(v);
+ }
+
+ public void addProperty(@NonNull String name, float v) {
+ writeShort(createPropertyIndex(name));
+ writeFloat(v);
+ }
+
+ public void addProperty(@NonNull String name, @Nullable String s) {
+ writeShort(createPropertyIndex(name));
+ writeString(s);
+ }
+
+ /**
+ * Writes the given name as the property name, and leaves it to the callee
+ * to fill in value for this property.
+ */
+ public void addPropertyKey(@NonNull String name) {
+ writeShort(createPropertyIndex(name));
+ }
+
+ private short createPropertyIndex(@NonNull String name) {
+ Short index = mPropertyNames.get(name);
+ if (index == null) {
+ index = mPropertyId++;
+ mPropertyNames.put(name, index);
+ }
+
+ return index;
+ }
+
+ private void startPropertyMap() {
+ try {
+ mStream.write(SIG_MAP);
+ } catch (IOException e) {
+ // does not happen since the stream simply wraps a ByteArrayOutputStream
+ }
+ }
+
+ private void endPropertyMap() {
+ writeShort(SIG_END_MAP);
+ }
+
+ private void writeBoolean(boolean v) {
+ try {
+ mStream.write(SIG_BOOLEAN);
+ mStream.write(v ? 1 : 0);
+ } catch (IOException e) {
+ // does not happen since the stream simply wraps a ByteArrayOutputStream
+ }
+ }
+
+ private void writeShort(short s) {
+ try {
+ mStream.write(SIG_SHORT);
+ mStream.writeShort(s);
+ } catch (IOException e) {
+ // does not happen since the stream simply wraps a ByteArrayOutputStream
+ }
+ }
+
+ private void writeInt(int i) {
+ try {
+ mStream.write(SIG_INT);
+ mStream.writeInt(i);
+ } catch (IOException e) {
+ // does not happen since the stream simply wraps a ByteArrayOutputStream
+ }
+ }
+
+ private void writeFloat(float v) {
+ try {
+ mStream.write(SIG_FLOAT);
+ mStream.writeFloat(v);
+ } catch (IOException e) {
+ // does not happen since the stream simply wraps a ByteArrayOutputStream
+ }
+ }
+
+ private void writeString(@Nullable String s) {
+ if (s == null) {
+ s = "";
+ }
+
+ try {
+ mStream.write(SIG_STRING);
+ byte[] bytes = s.getBytes(mCharset);
+
+ short len = (short)Math.min(bytes.length, Short.MAX_VALUE);
+ mStream.writeShort(len);
+
+ mStream.write(bytes, 0, len);
+ } catch (IOException e) {
+ // does not happen since the stream simply wraps a ByteArrayOutputStream
+ }
+ }
+}
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index c9c2a82..ea1dadb 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -654,6 +654,10 @@ public final class ViewRootImpl implements ViewParent,
return (mWindowAttributes.flags & WindowManager.LayoutParams.FLAG_LOCAL_FOCUS_MODE) != 0;
}
+ public int getWindowFlags() {
+ return mWindowAttributes.flags;
+ }
+
public CharSequence getTitle() {
return mWindowAttributes.getTitle();
}
diff --git a/core/java/android/view/ViewStructure.java b/core/java/android/view/ViewStructure.java
new file mode 100644
index 0000000..8dc49ac
--- /dev/null
+++ b/core/java/android/view/ViewStructure.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.view;
+
+import android.graphics.Rect;
+import android.os.Bundle;
+import android.text.TextPaint;
+
+/**
+ * Container for storing additional per-view data generated by {@link View#onProvideStructure
+ * View.onProvideStructure}.
+ */
+public abstract class ViewStructure {
+ public abstract void setId(int id, String packageName, String typeName, String entryName);
+
+ public abstract void setDimens(int left, int top, int scrollX, int scrollY, int width,
+ int height);
+
+ public abstract void setVisibility(int visibility);
+
+ /** @hide */
+ public abstract void setAssistBlocked(boolean state);
+
+ public abstract void setEnabled(boolean state);
+
+ public abstract void setClickable(boolean state);
+
+ public abstract void setLongClickable(boolean state);
+
+ public abstract void setStylusButtonPressable(boolean state);
+
+ public abstract void setFocusable(boolean state);
+
+ public abstract void setFocused(boolean state);
+
+ public abstract void setAccessibilityFocused(boolean state);
+
+ public abstract void setCheckable(boolean state);
+
+ public abstract void setChecked(boolean state);
+
+ public abstract void setSelected(boolean state);
+
+ public abstract void setActivated(boolean state);
+
+ public abstract void setClassName(String className);
+
+ public abstract void setContentDescription(CharSequence contentDescription);
+
+ public abstract void setText(CharSequence text);
+ public abstract void setText(CharSequence text, int selectionStart, int selectionEnd);
+ public abstract void setTextPaint(TextPaint paint);
+ public abstract void setHint(CharSequence hint);
+
+ public abstract CharSequence getText();
+ public abstract int getTextSelectionStart();
+ public abstract int getTextSelectionEnd();
+ public abstract CharSequence getHint();
+
+ public abstract Bundle getExtras();
+ public abstract boolean hasExtras();
+
+ public abstract void setChildCount(int num);
+ public abstract int getChildCount();
+ public abstract ViewAssistStructure newChild(int index);
+
+ public abstract ViewAssistStructure asyncNewChild(int index);
+ public abstract void asyncCommit();
+
+ /** @hide */
+ public abstract Rect getTempRect();
+}
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java
index e983910..2797b6e 100644
--- a/core/java/android/view/WindowManager.java
+++ b/core/java/android/view/WindowManager.java
@@ -16,11 +16,11 @@
package android.view;
+import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.app.Presentation;
import android.content.Context;
import android.content.pm.ActivityInfo;
-import android.graphics.Insets;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.os.IBinder;
@@ -1119,6 +1119,15 @@ public interface WindowManager extends ViewManager {
public static final int PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS = 0x00000800;
/**
+ * Flag to force the status bar window to be visible all the time. If the bar is hidden when
+ * this flag is set it will be shown again and the bar will have a transparent background.
+ * This can only be set by {@link LayoutParams#TYPE_STATUS_BAR}.
+ *
+ * {@hide}
+ */
+ public static final int PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT = 0x00001000;
+
+ /**
* Control flags that are private to the platform.
* @hide
*/
@@ -2066,5 +2075,18 @@ public interface WindowManager extends ViewManager {
}
private CharSequence mTitle = "";
+
+ /** @hide */
+ @Override
+ protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) {
+ super.encodeProperties(encoder);
+
+ encoder.addProperty("x", x);
+ encoder.addProperty("y", y);
+ encoder.addProperty("horizontalWeight", horizontalWeight);
+ encoder.addProperty("verticalWeight", verticalWeight);
+ encoder.addProperty("type", type);
+ encoder.addProperty("flags", flags);
+ }
}
}
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 7ab5aaa..e27e253 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -16,6 +16,7 @@
package android.webkit;
+import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.annotation.Widget;
import android.content.Context;
@@ -40,9 +41,10 @@ import android.util.Log;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
-import android.view.ViewAssistStructure;
+import android.view.ViewStructure;
import android.view.ViewDebug;
import android.view.ViewGroup;
+import android.view.ViewHierarchyEncoder;
import android.view.ViewTreeObserver;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
@@ -2426,7 +2428,7 @@ public class WebView extends AbsoluteLayout
}
@Override
- public void onProvideVirtualAssistStructure(ViewAssistStructure structure) {
+ public void onProvideVirtualStructure(ViewStructure structure) {
mProvider.getViewDelegate().onProvideVirtualAssistStructure(structure);
}
@@ -2576,4 +2578,18 @@ public class WebView extends AbsoluteLayout
super.onFinishTemporaryDetach();
mProvider.getViewDelegate().onFinishTemporaryDetach();
}
+
+ /** @hide */
+ @Override
+ protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) {
+ super.encodeProperties(encoder);
+
+ checkThread();
+ encoder.addProperty("webview:contentHeight", mProvider.getContentHeight());
+ encoder.addProperty("webview:contentWidth", mProvider.getContentWidth());
+ encoder.addProperty("webview:scale", mProvider.getScale());
+ encoder.addProperty("webview:title", mProvider.getTitle());
+ encoder.addProperty("webview:url", mProvider.getUrl());
+ encoder.addProperty("webview:originalUrl", mProvider.getOriginalUrl());
+ }
}
diff --git a/core/java/android/webkit/WebViewProvider.java b/core/java/android/webkit/WebViewProvider.java
index d5787de..e367192 100644
--- a/core/java/android/webkit/WebViewProvider.java
+++ b/core/java/android/webkit/WebViewProvider.java
@@ -32,7 +32,7 @@ import android.print.PrintDocumentAdapter;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
-import android.view.ViewAssistStructure;
+import android.view.ViewStructure;
import android.view.ViewGroup.LayoutParams;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
@@ -299,7 +299,7 @@ public interface WebViewProvider {
interface ViewDelegate {
public boolean shouldDelayChildPressedState();
- public void onProvideVirtualAssistStructure(ViewAssistStructure structure);
+ public void onProvideVirtualAssistStructure(ViewStructure structure);
public AccessibilityNodeProvider getAccessibilityNodeProvider();
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index c57a53a..9903b7e 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -18,6 +18,7 @@ package android.widget;
import android.annotation.ColorInt;
import android.annotation.DrawableRes;
+import android.annotation.NonNull;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
@@ -56,6 +57,7 @@ import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewDebug;
import android.view.ViewGroup;
+import android.view.ViewHierarchyEncoder;
import android.view.ViewParent;
import android.view.ViewTreeObserver;
import android.view.accessibility.AccessibilityEvent;
@@ -6330,6 +6332,16 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
public LayoutParams(ViewGroup.LayoutParams source) {
super(source);
}
+
+ /** @hide */
+ @Override
+ protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) {
+ super.encodeProperties(encoder);
+
+ encoder.addProperty("list:viewType", viewType);
+ encoder.addProperty("list:recycledHeaderFooter", recycledHeaderFooter);
+ encoder.addProperty("list:forceAdd", forceAdd);
+ }
}
/**
@@ -6912,6 +6924,25 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
}
}
+ /** @hide */
+ @Override
+ protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) {
+ super.encodeProperties(encoder);
+
+ encoder.addProperty("drawing:cacheColorHint", getCacheColorHint());
+ encoder.addProperty("list:fastScrollEnabled", isFastScrollEnabled());
+ encoder.addProperty("list:scrollingCacheEnabled", isScrollingCacheEnabled());
+ encoder.addProperty("list:smoothScrollbarEnabled", isSmoothScrollbarEnabled());
+ encoder.addProperty("list:stackFromBottom", isStackFromBottom());
+ encoder.addProperty("list:textFilterEnabled", isTextFilterEnabled());
+
+ View selectedView = getSelectedView();
+ if (selectedView != null) {
+ encoder.addPropertyKey("selectedView");
+ selectedView.encode(encoder);
+ }
+ }
+
/**
* Abstract positon scroller used to handle smooth scrolling.
*/
diff --git a/core/java/android/widget/ActionMenuView.java b/core/java/android/widget/ActionMenuView.java
index d6f2276..278a8fb 100644
--- a/core/java/android/widget/ActionMenuView.java
+++ b/core/java/android/widget/ActionMenuView.java
@@ -15,6 +15,7 @@
*/
package android.widget;
+import android.annotation.NonNull;
import android.annotation.StyleRes;
import android.content.Context;
import android.content.res.ColorStateList;
@@ -28,6 +29,7 @@ import android.view.MenuItem;
import android.view.View;
import android.view.ViewDebug;
import android.view.ViewGroup;
+import android.view.ViewHierarchyEncoder;
import android.view.accessibility.AccessibilityEvent;
import com.android.internal.view.menu.ActionMenuItemView;
import com.android.internal.view.menu.MenuBuilder;
@@ -835,5 +837,17 @@ public class ActionMenuView extends LinearLayout implements MenuBuilder.ItemInvo
super(width, height);
this.isOverflowButton = isOverflowButton;
}
+
+ /** @hide */
+ @Override
+ protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) {
+ super.encodeProperties(encoder);
+
+ encoder.addProperty("layout:overFlowButton", isOverflowButton);
+ encoder.addProperty("layout:cellsUsed", cellsUsed);
+ encoder.addProperty("layout:extraPixels", extraPixels);
+ encoder.addProperty("layout:expandable", expandable);
+ encoder.addProperty("layout:preventEdgeOffset", preventEdgeOffset);
+ }
}
}
diff --git a/core/java/android/widget/AdapterView.java b/core/java/android/widget/AdapterView.java
index 72cb0b5..54e3996 100644
--- a/core/java/android/widget/AdapterView.java
+++ b/core/java/android/widget/AdapterView.java
@@ -16,6 +16,7 @@
package android.widget;
+import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
import android.database.DataSetObserver;
@@ -29,6 +30,7 @@ import android.view.SoundEffectConstants;
import android.view.View;
import android.view.ViewDebug;
import android.view.ViewGroup;
+import android.view.ViewHierarchyEncoder;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityNodeInfo;
@@ -1245,4 +1247,16 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup {
}
}
}
+
+ /** @hide */
+ @Override
+ protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) {
+ super.encodeProperties(encoder);
+
+ encoder.addProperty("scrolling:firstPosition", mFirstPosition);
+ encoder.addProperty("list:nextSelectedPosition", mNextSelectedPosition);
+ encoder.addProperty("list:nextSelectedRowId", mNextSelectedRowId);
+ encoder.addProperty("list:selectedPosition", mSelectedPosition);
+ encoder.addProperty("list:itemCount", mItemCount);
+ }
}
diff --git a/core/java/android/widget/CheckedTextView.java b/core/java/android/widget/CheckedTextView.java
index 22e079c..6b4b2c7 100644
--- a/core/java/android/widget/CheckedTextView.java
+++ b/core/java/android/widget/CheckedTextView.java
@@ -16,6 +16,8 @@
package android.widget;
+import android.annotation.NonNull;
+import android.view.ViewHierarchyEncoder;
import com.android.internal.R;
import android.annotation.DrawableRes;
@@ -459,4 +461,11 @@ public class CheckedTextView extends TextView implements Checkable {
info.setCheckable(true);
info.setChecked(mChecked);
}
+
+ /** @hide */
+ @Override
+ protected void encodeProperties(@NonNull ViewHierarchyEncoder stream) {
+ super.encodeProperties(stream);
+ stream.addProperty("text:checked", isChecked());
+ }
}
diff --git a/core/java/android/widget/CompoundButton.java b/core/java/android/widget/CompoundButton.java
index f2afeeb..770077d 100644
--- a/core/java/android/widget/CompoundButton.java
+++ b/core/java/android/widget/CompoundButton.java
@@ -17,8 +17,10 @@
package android.widget;
import android.annotation.DrawableRes;
+import android.annotation.NonNull;
import android.annotation.Nullable;
import android.graphics.PorterDuff;
+import android.view.ViewHierarchyEncoder;
import com.android.internal.R;
import android.content.Context;
@@ -530,9 +532,16 @@ public abstract class CompoundButton extends Button implements Checkable {
@Override
public void onRestoreInstanceState(Parcelable state) {
SavedState ss = (SavedState) state;
-
+
super.onRestoreInstanceState(ss.getSuperState());
setChecked(ss.checked);
requestLayout();
}
+
+ /** @hide */
+ @Override
+ protected void encodeProperties(@NonNull ViewHierarchyEncoder stream) {
+ super.encodeProperties(stream);
+ stream.addProperty("checked", isChecked());
+ }
}
diff --git a/core/java/android/widget/FrameLayout.java b/core/java/android/widget/FrameLayout.java
index 0602944..7ca450a 100644
--- a/core/java/android/widget/FrameLayout.java
+++ b/core/java/android/widget/FrameLayout.java
@@ -33,6 +33,7 @@ import android.view.Gravity;
import android.view.View;
import android.view.ViewDebug;
import android.view.ViewGroup;
+import android.view.ViewHierarchyEncoder;
import android.widget.RemoteViews.RemoteView;
import com.android.internal.R;
@@ -407,6 +408,18 @@ public class FrameLayout extends ViewGroup {
return FrameLayout.class.getName();
}
+ /** @hide */
+ @Override
+ protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) {
+ super.encodeProperties(encoder);
+
+ encoder.addProperty("measurement:measureAllChildren", mMeasureAllChildren);
+ encoder.addProperty("padding:foregroundPaddingLeft", mForegroundPaddingLeft);
+ encoder.addProperty("padding:foregroundPaddingTop", mForegroundPaddingTop);
+ encoder.addProperty("padding:foregroundPaddingRight", mForegroundPaddingRight);
+ encoder.addProperty("padding:foregroundPaddingBottom", mForegroundPaddingBottom);
+ }
+
/**
* Per-child layout information for layouts that support margins.
* See {@link android.R.styleable#FrameLayout_Layout FrameLayout Layout Attributes}
diff --git a/core/java/android/widget/GridView.java b/core/java/android/widget/GridView.java
index c959774..dcaafa5 100644
--- a/core/java/android/widget/GridView.java
+++ b/core/java/android/widget/GridView.java
@@ -17,6 +17,7 @@
package android.widget;
import android.annotation.IntDef;
+import android.annotation.NonNull;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
@@ -31,6 +32,7 @@ import android.view.SoundEffectConstants;
import android.view.View;
import android.view.ViewDebug;
import android.view.ViewGroup;
+import android.view.ViewHierarchyEncoder;
import android.view.ViewRootImpl;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction;
@@ -2420,4 +2422,11 @@ public class GridView extends AbsListView {
row, 1, column, 1, isHeading, isSelected);
info.setCollectionItemInfo(itemInfo);
}
+
+ /** @hide */
+ @Override
+ protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) {
+ super.encodeProperties(encoder);
+ encoder.addProperty("numColumns", getNumColumns());
+ }
}
diff --git a/core/java/android/widget/HorizontalScrollView.java b/core/java/android/widget/HorizontalScrollView.java
index 0879c5d..cf67905 100644
--- a/core/java/android/widget/HorizontalScrollView.java
+++ b/core/java/android/widget/HorizontalScrollView.java
@@ -16,6 +16,7 @@
package android.widget;
+import android.annotation.NonNull;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
@@ -35,6 +36,7 @@ import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewDebug;
import android.view.ViewGroup;
+import android.view.ViewHierarchyEncoder;
import android.view.ViewParent;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
@@ -1695,6 +1697,13 @@ public class HorizontalScrollView extends FrameLayout {
return ss;
}
+ /** @hide */
+ @Override
+ protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) {
+ super.encodeProperties(encoder);
+ encoder.addProperty("layout:fillViewPort", mFillViewport);
+ }
+
static class SavedState extends BaseSavedState {
public int scrollPosition;
public boolean isLayoutRtl;
diff --git a/core/java/android/widget/ImageView.java b/core/java/android/widget/ImageView.java
index 6d2f368..05059bc 100644
--- a/core/java/android/widget/ImageView.java
+++ b/core/java/android/widget/ImageView.java
@@ -17,6 +17,7 @@
package android.widget;
import android.annotation.DrawableRes;
+import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.ContentResolver;
import android.content.Context;
@@ -43,6 +44,7 @@ import android.util.Log;
import android.view.RemotableViewMethod;
import android.view.View;
import android.view.ViewDebug;
+import android.view.ViewHierarchyEncoder;
import android.view.accessibility.AccessibilityEvent;
import android.widget.RemoteViews.RemoteView;
@@ -1431,4 +1433,11 @@ public class ImageView extends View {
public CharSequence getAccessibilityClassName() {
return ImageView.class.getName();
}
+
+ /** @hide */
+ @Override
+ protected void encodeProperties(@NonNull ViewHierarchyEncoder stream) {
+ super.encodeProperties(stream);
+ stream.addProperty("layout:baseline", getBaseline());
+ }
}
diff --git a/core/java/android/widget/LinearLayout.java b/core/java/android/widget/LinearLayout.java
index 72f51c9..f153ce5 100644
--- a/core/java/android/widget/LinearLayout.java
+++ b/core/java/android/widget/LinearLayout.java
@@ -19,6 +19,7 @@ package android.widget;
import com.android.internal.R;
import android.annotation.IntDef;
+import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
import android.content.res.TypedArray;
@@ -29,6 +30,7 @@ import android.view.Gravity;
import android.view.View;
import android.view.ViewDebug;
import android.view.ViewGroup;
+import android.view.ViewHierarchyEncoder;
import android.widget.RemoteViews.RemoteView;
import java.lang.annotation.Retention;
@@ -1813,6 +1815,20 @@ public class LinearLayout extends ViewGroup {
return LinearLayout.class.getName();
}
+ /** @hide */
+ @Override
+ protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) {
+ super.encodeProperties(encoder);
+ encoder.addProperty("layout:baselineAligned", mBaselineAligned);
+ encoder.addProperty("layout:baselineAlignedChildIndex", mBaselineAlignedChildIndex);
+ encoder.addProperty("measurement:baselineChildTop", mBaselineChildTop);
+ encoder.addProperty("measurement:orientation", mOrientation);
+ encoder.addProperty("measurement:gravity", mGravity);
+ encoder.addProperty("measurement:totalLength", mTotalLength);
+ encoder.addProperty("layout:totalLength", mTotalLength);
+ encoder.addProperty("layout:useLargestChild", mUseLargestChild);
+ }
+
/**
* Per-child layout information associated with ViewLinearLayout.
*
@@ -1921,5 +1937,14 @@ public class LinearLayout extends ViewGroup {
return output + "LinearLayout.LayoutParams={width=" + sizeToString(width) +
", height=" + sizeToString(height) + " weight=" + weight + "}";
}
+
+ /** @hide */
+ @Override
+ protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) {
+ super.encodeProperties(encoder);
+
+ encoder.addProperty("layout:weight", weight);
+ encoder.addProperty("layout:gravity", gravity);
+ }
}
}
diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java
index a79c8e8..7dcaa1f 100644
--- a/core/java/android/widget/ListView.java
+++ b/core/java/android/widget/ListView.java
@@ -23,6 +23,7 @@ import com.android.internal.util.Predicate;
import com.google.android.collect.Lists;
import android.annotation.IdRes;
+import android.annotation.NonNull;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
@@ -40,6 +41,7 @@ import android.view.SoundEffectConstants;
import android.view.View;
import android.view.ViewDebug;
import android.view.ViewGroup;
+import android.view.ViewHierarchyEncoder;
import android.view.ViewParent;
import android.view.ViewRootImpl;
import android.view.accessibility.AccessibilityNodeInfo;
@@ -3938,4 +3940,12 @@ public class ListView extends AbsListView {
position, 1, 0, 1, isHeading, isSelected);
info.setCollectionItemInfo(itemInfo);
}
+
+ /** @hide */
+ @Override
+ protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) {
+ super.encodeProperties(encoder);
+
+ encoder.addProperty("recycleOnMeasure", recycleOnMeasure());
+ }
}
diff --git a/core/java/android/widget/ProgressBar.java b/core/java/android/widget/ProgressBar.java
index b59ae17..639a09c 100644
--- a/core/java/android/widget/ProgressBar.java
+++ b/core/java/android/widget/ProgressBar.java
@@ -16,6 +16,7 @@
package android.widget;
+import android.annotation.NonNull;
import android.annotation.Nullable;
import android.graphics.PorterDuff;
@@ -49,6 +50,7 @@ import android.view.Gravity;
import android.view.RemotableViewMethod;
import android.view.View;
import android.view.ViewDebug;
+import android.view.ViewHierarchyEncoder;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.animation.AlphaAnimation;
@@ -1893,6 +1895,17 @@ public class ProgressBar extends View {
postDelayed(mAccessibilityEventSender, TIMEOUT_SEND_ACCESSIBILITY_EVENT);
}
+ /** @hide */
+ @Override
+ protected void encodeProperties(@NonNull ViewHierarchyEncoder stream) {
+ super.encodeProperties(stream);
+
+ stream.addProperty("progress:max", getMax());
+ stream.addProperty("progress:progress", getProgress());
+ stream.addProperty("progress:secondaryProgress", getSecondaryProgress());
+ stream.addProperty("progress:indeterminate", isIndeterminate());
+ }
+
/**
* Command for sending an accessibility event.
*/
diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java
index d12739f..affc5da 100644
--- a/core/java/android/widget/RelativeLayout.java
+++ b/core/java/android/widget/RelativeLayout.java
@@ -16,6 +16,7 @@
package android.widget;
+import android.annotation.NonNull;
import android.util.ArrayMap;
import com.android.internal.R;
@@ -36,6 +37,7 @@ import android.view.Gravity;
import android.view.View;
import android.view.ViewDebug;
import android.view.ViewGroup;
+import android.view.ViewHierarchyEncoder;
import android.view.accessibility.AccessibilityEvent;
import android.widget.RemoteViews.RemoteView;
@@ -1616,6 +1618,13 @@ public class RelativeLayout extends ViewGroup {
// This will set the layout direction
super.resolveLayoutDirection(layoutDirection);
}
+
+ /** @hide */
+ @Override
+ protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) {
+ super.encodeProperties(encoder);
+ encoder.addProperty("layout:alignWithParent", alignWithParent);
+ }
}
private static class DependencyGraph {
diff --git a/core/java/android/widget/ScrollView.java b/core/java/android/widget/ScrollView.java
index 98d61d3..2709f25 100644
--- a/core/java/android/widget/ScrollView.java
+++ b/core/java/android/widget/ScrollView.java
@@ -16,6 +16,7 @@
package android.widget;
+import android.annotation.NonNull;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
@@ -38,6 +39,7 @@ import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewDebug;
import android.view.ViewGroup;
+import android.view.ViewHierarchyEncoder;
import android.view.ViewParent;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
@@ -1787,6 +1789,13 @@ public class ScrollView extends FrameLayout {
return ss;
}
+ /** @hide */
+ @Override
+ protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) {
+ super.encodeProperties(encoder);
+ encoder.addProperty("fillViewport", mFillViewport);
+ }
+
static class SavedState extends BaseSavedState {
public int scrollPosition;
diff --git a/core/java/android/widget/Switch.java b/core/java/android/widget/Switch.java
index f94f97c..ff587c2 100644
--- a/core/java/android/widget/Switch.java
+++ b/core/java/android/widget/Switch.java
@@ -26,13 +26,11 @@ import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Insets;
-import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.graphics.Region.Op;
import android.graphics.drawable.Drawable;
-import android.os.Bundle;
import android.text.Layout;
import android.text.StaticLayout;
import android.text.TextPaint;
@@ -46,7 +44,7 @@ import android.view.Gravity;
import android.view.MotionEvent;
import android.view.SoundEffectConstants;
import android.view.VelocityTracker;
-import android.view.ViewAssistStructure;
+import android.view.ViewStructure;
import android.view.ViewConfiguration;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
@@ -1363,8 +1361,8 @@ public class Switch extends CompoundButton {
}
@Override
- public void onProvideAssistStructure(ViewAssistStructure structure) {
- super.onProvideAssistStructure(structure);
+ public void onProvideStructure(ViewStructure structure) {
+ super.onProvideStructure(structure);
CharSequence switchText = isChecked() ? mTextOn : mTextOff;
if (!TextUtils.isEmpty(switchText)) {
CharSequence oldText = structure.getText();
diff --git a/core/java/android/widget/TableRow.java b/core/java/android/widget/TableRow.java
index f73ee49..d4288d6 100644
--- a/core/java/android/widget/TableRow.java
+++ b/core/java/android/widget/TableRow.java
@@ -16,6 +16,7 @@
package android.widget;
+import android.annotation.NonNull;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
@@ -24,7 +25,7 @@ import android.view.Gravity;
import android.view.View;
import android.view.ViewDebug;
import android.view.ViewGroup;
-
+import android.view.ViewHierarchyEncoder;
/**
* <p>A layout that arranges its children horizontally. A TableRow should
@@ -509,6 +510,14 @@ public class TableRow extends LinearLayout {
height = WRAP_CONTENT;
}
}
+
+ /** @hide */
+ @Override
+ protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) {
+ super.encodeProperties(encoder);
+ encoder.addProperty("layout:column", column);
+ encoder.addProperty("layout:span", span);
+ }
}
// special transparent hierarchy change listener
diff --git a/core/java/android/widget/TextClock.java b/core/java/android/widget/TextClock.java
index e2acaac..5d7b569 100644
--- a/core/java/android/widget/TextClock.java
+++ b/core/java/android/widget/TextClock.java
@@ -16,6 +16,7 @@
package android.widget;
+import android.annotation.NonNull;
import android.app.ActivityManager;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
@@ -32,6 +33,7 @@ import android.provider.Settings;
import android.text.format.DateFormat;
import android.util.AttributeSet;
import android.view.RemotableViewMethod;
+import android.view.ViewHierarchyEncoder;
import com.android.internal.R;
@@ -546,4 +548,18 @@ public class TextClock extends TextView {
mTime.setTimeInMillis(System.currentTimeMillis());
setText(DateFormat.format(mFormat, mTime));
}
+
+ /** @hide */
+ @Override
+ protected void encodeProperties(@NonNull ViewHierarchyEncoder stream) {
+ super.encodeProperties(stream);
+
+ CharSequence s = getFormat12Hour();
+ stream.addProperty("format12Hour", s == null ? null : s.toString());
+
+ s = getFormat24Hour();
+ stream.addProperty("format24Hour", s == null ? null : s.toString());
+ stream.addProperty("format", mFormat == null ? null : mFormat.toString());
+ stream.addProperty("hasSeconds", mHasSeconds);
+ }
}
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 449173f..68c49cd 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -114,12 +114,13 @@ import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
-import android.view.ViewAssistStructure;
+import android.view.ViewStructure;
import android.view.ViewConfiguration;
import android.view.ViewDebug;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewRootImpl;
import android.view.ViewTreeObserver;
+import android.view.ViewHierarchyEncoder;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityNodeInfo;
@@ -2844,7 +2845,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
@ViewDebug.IntToString(from = Typeface.BOLD_ITALIC, to = "BOLD_ITALIC")
})
public int getTypefaceStyle() {
- return mTextPaint.getTypeface().getStyle();
+ Typeface typeface = mTextPaint.getTypeface();
+ return typeface != null ? typeface.getStyle() : Typeface.NORMAL;
}
/**
@@ -8713,8 +8715,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
}
@Override
- public void onProvideAssistStructure(ViewAssistStructure structure) {
- super.onProvideAssistStructure(structure);
+ public void onProvideStructure(ViewStructure structure) {
+ super.onProvideStructure(structure);
final boolean isPassword = hasPasswordTransformationMethod();
if (!isPassword) {
structure.setText(getText(), getSelectionStart(), getSelectionEnd());
@@ -9556,6 +9558,23 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
}
}
+ /** @hide */
+ @Override
+ protected void encodeProperties(@NonNull ViewHierarchyEncoder stream) {
+ super.encodeProperties(stream);
+
+ TruncateAt ellipsize = getEllipsize();
+ stream.addProperty("text:ellipsize", ellipsize == null ? null : ellipsize.name());
+ stream.addProperty("text:textSize", getTextSize());
+ stream.addProperty("text:scaledTextSize", getScaledTextSize());
+ stream.addProperty("text:typefaceStyle", getTypefaceStyle());
+ stream.addProperty("text:selectionStart", getSelectionStart());
+ stream.addProperty("text:selectionEnd", getSelectionEnd());
+ stream.addProperty("text:curTextColor", mCurTextColor);
+ stream.addProperty("text:text", mText == null ? null : mText.toString());
+ stream.addProperty("text:gravity", mGravity);
+ }
+
/**
* User interface state that is stored by TextView for implementing
* {@link View#onSaveInstanceState}.
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index eaa6278..0b96d22 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -2347,11 +2347,6 @@
be saved. -->
<attr name="saveEnabled" format="boolean" />
- <!-- If true, no {@link android.view.ViewAssistStructure} data will be collected from
- this view or any of its children. The default is false, allowing assist structure
- to be reported by it. -->
- <attr name="assistBlocked" format="boolean" />
-
<!-- Specifies whether to filter touches when the view's window is obscured by
another visible window. When set to true, the view will not receive touches
whenever a toast, dialog or other window appears above the view's window.
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 297b302..e403a16 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2682,7 +2682,9 @@
<!-- NFC CardEmulation: dynamically load service resources -->
<public type="attr" name="dynamicResources" />
- <public type="attr" name="assistBlocked" />
+ <attr name="__reserved0" format="boolean" />
+ <public type="attr" name="__reserved0" />
+
<public type="attr" name="stylusButtonPressable" />
<public type="attr" name="supportsLaunchVoiceAssistFromKeyguard" />
<public type="attr" name="scrollIndicators" />