Merge "Fix themed attributes resolution"
diff --git a/bridge/src/android/graphics/Bitmap_Delegate.java b/bridge/src/android/graphics/Bitmap_Delegate.java
index f1da3a2..e1fc5ec 100644
--- a/bridge/src/android/graphics/Bitmap_Delegate.java
+++ b/bridge/src/android/graphics/Bitmap_Delegate.java
@@ -92,8 +92,7 @@
@Nullable
public static Bitmap_Delegate getDelegate(@Nullable Bitmap bitmap) {
- // refSkPixelRef is a hack to get the native pointer: see #nativeRefPixelRef()
- return bitmap == null ? null : getDelegate(bitmap.refSkPixelRef());
+ return bitmap == null ? null : getDelegate(bitmap.getNativeInstance());
}
/**
@@ -601,14 +600,6 @@
return Arrays.equals(argb1, argb2);
}
- // Only used by AssetAtlasService, which we don't care about.
- @LayoutlibDelegate
- /*package*/ static long nativeRefPixelRef(long nativeBitmap) {
- // Hack: This is called by Bitmap.refSkPixelRef() and LayoutLib uses that method to get
- // the native pointer from a Bitmap. So, we return nativeBitmap here.
- return nativeBitmap;
- }
-
// ---- Private delegate/helper methods ----
private Bitmap_Delegate(BufferedImage image, Config config) {
@@ -627,7 +618,7 @@
boolean isPremultiplied = createFlags.contains(BitmapCreateFlags.PREMULTIPLIED);
// and create/return a new Bitmap with it
- return new Bitmap(nativeInt, null /* buffer */, width, height, density, isMutable,
+ return new Bitmap(nativeInt, width, height, density, isMutable,
isPremultiplied, null /*ninePatchChunk*/, null /* layoutBounds */);
}
diff --git a/bridge/src/android/graphics/Canvas_Delegate.java b/bridge/src/android/graphics/Canvas_Delegate.java
index fa880f0..4a4c6c8 100644
--- a/bridge/src/android/graphics/Canvas_Delegate.java
+++ b/bridge/src/android/graphics/Canvas_Delegate.java
@@ -123,7 +123,7 @@
/*package*/ static long initRaster(@Nullable Bitmap bitmap) {
long nativeBitmapOrZero = 0;
if (bitmap != null) {
- nativeBitmapOrZero = bitmap.refSkPixelRef();
+ nativeBitmapOrZero = bitmap.getNativeInstance();
}
if (nativeBitmapOrZero > 0) {
// get the Bitmap from the int
diff --git a/bridge/src/android/view/IWindowManagerImpl.java b/bridge/src/android/view/IWindowManagerImpl.java
index 4a70060..4596210 100644
--- a/bridge/src/android/view/IWindowManagerImpl.java
+++ b/bridge/src/android/view/IWindowManagerImpl.java
@@ -86,7 +86,7 @@
}
@Override
- public void addWindowToken(IBinder arg0, int arg1) throws RemoteException {
+ public void addWindowToken(IBinder arg0, int arg1, int arg2) throws RemoteException {
// TODO Auto-generated method stub
}
@@ -277,13 +277,13 @@
}
@Override
- public void removeAppToken(IBinder arg0) throws RemoteException {
+ public void removeAppToken(IBinder arg0, int arg1) throws RemoteException {
// TODO Auto-generated method stub
}
@Override
- public void removeWindowToken(IBinder arg0) throws RemoteException {
+ public void removeWindowToken(IBinder arg0, int arg1) throws RemoteException {
// TODO Auto-generated method stub
}
@@ -413,7 +413,8 @@
}
@Override
- public int[] setNewConfiguration(Configuration arg0) throws RemoteException {
+ public int[] setNewDisplayOverrideConfiguration(Configuration arg0, int displayId)
+ throws RemoteException {
// TODO Auto-generated method stub
return null;
}
@@ -461,6 +462,16 @@
}
@Override
+ public void setRecentsVisibility(boolean visible) {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void setTvPipVisibility(boolean visible) {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
public void stopAppFreezingScreen(IBinder arg0, boolean arg1) throws RemoteException {
// TODO Auto-generated method stub
}
@@ -477,7 +488,7 @@
}
@Override
- public Configuration updateOrientationFromAppTokens(Configuration arg0, IBinder arg1)
+ public Configuration updateOrientationFromAppTokens(Configuration arg0, IBinder arg1, int arg2)
throws RemoteException {
// TODO Auto-generated method stub
return null;
@@ -513,10 +524,6 @@
}
@Override
- public void setKeyguardAnimatingIn(boolean animating) throws RemoteException {
- }
-
- @Override
public void setSwitchingUser(boolean switching) throws RemoteException {
}
@@ -580,6 +587,20 @@
}
@Override
+ public void registerPinnedStackListener(int displayId, IPinnedStackListener listener) throws RemoteException {
+ }
+
+ @Override
+ public Rect getPictureInPictureDefaultBounds(int displayId) {
+ return null;
+ }
+
+ @Override
+ public Rect getPictureInPictureMovementBounds(int displayId) {
+ return null;
+ }
+
+ @Override
public void setResizeDimLayer(boolean visible, int targetStackId, float alpha)
throws RemoteException {
}
@@ -594,7 +615,7 @@
}
@Override
- public void getStableInsets(Rect outInsets) throws RemoteException {
+ public void getStableInsets(int displayId, Rect outInsets) throws RemoteException {
}
@Override
@@ -602,10 +623,13 @@
throws RemoteException {}
@Override
- public void createWallpaperInputConsumer(InputChannel inputChannel) throws RemoteException {}
+ public void createInputConsumer(String name, InputChannel inputChannel)
+ throws RemoteException {}
@Override
- public void removeWallpaperInputConsumer() throws RemoteException {}
+ public boolean destroyInputConsumer(String name) throws RemoteException {
+ return false;
+ }
@Override
public Bitmap screenshotWallpaper() throws RemoteException {
diff --git a/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java b/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
index ff9ad9f..1b3b563 100644
--- a/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
+++ b/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
@@ -76,6 +76,7 @@
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.ResultReceiver;
+import android.os.ShellCallback;
import android.os.UserHandle;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
@@ -1182,7 +1183,7 @@
@Override
public void shellCommand(FileDescriptor in, FileDescriptor out, FileDescriptor err,
- String[] args, ResultReceiver resultReceiver) {
+ String[] args, ShellCallback shellCallback, ResultReceiver resultReceiver) {
}
};
}
diff --git a/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java b/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
index feed045..91a783a 100644
--- a/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
+++ b/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
@@ -358,7 +358,8 @@
mMeasuredScreenWidth, MeasureSpec.EXACTLY,
mMeasuredScreenHeight, MeasureSpec.EXACTLY);
mViewRoot.layout(0, 0, mMeasuredScreenWidth, mMeasuredScreenHeight);
- mSystemViewInfoList = visitAllChildren(mViewRoot, 0, params.getExtendedViewInfoMode(),
+ mSystemViewInfoList =
+ visitAllChildren(mViewRoot, 0, 0, params.getExtendedViewInfoMode(),
false);
return SUCCESS.createResult();
@@ -521,7 +522,8 @@
mMeasuredScreenHeight);
}
- mSystemViewInfoList = visitAllChildren(mViewRoot, 0, params.getExtendedViewInfoMode(),
+ mSystemViewInfoList =
+ visitAllChildren(mViewRoot, 0, 0, params.getExtendedViewInfoMode(),
false);
// success!
@@ -1242,20 +1244,22 @@
* bounds of all the views.
*
* @param view the root View
- * @param offset an offset for the view bounds.
+ * @param hOffset horizontal offset for the view bounds.
+ * @param vOffset vertical offset for the view bounds.
* @param setExtendedInfo whether to set the extended view info in the {@link ViewInfo} object.
* @param isContentFrame {@code true} if the {@code ViewInfo} to be created is part of the
* content frame.
*
* @return {@code ViewInfo} containing the bounds of the view and it children otherwise.
*/
- private ViewInfo visit(View view, int offset, boolean setExtendedInfo,
+ private ViewInfo visit(View view, int hOffset, int vOffset, boolean setExtendedInfo,
boolean isContentFrame) {
- ViewInfo result = createViewInfo(view, offset, setExtendedInfo, isContentFrame);
+ ViewInfo result = createViewInfo(view, hOffset, vOffset, setExtendedInfo, isContentFrame);
if (view instanceof ViewGroup) {
ViewGroup group = ((ViewGroup) view);
- result.setChildren(visitAllChildren(group, isContentFrame ? 0 : offset,
+ result.setChildren(visitAllChildren(group, isContentFrame ? 0 : hOffset,
+ isContentFrame ? 0 : vOffset,
setExtendedInfo, isContentFrame));
}
return result;
@@ -1267,20 +1271,22 @@
* the children of the {@code mContentRoot}.
*
* @param viewGroup the root View
- * @param offset an offset from the top for the content view frame.
+ * @param hOffset horizontal offset from the top for the content view frame.
+ * @param vOffset vertical offset from the top for the content view frame.
* @param setExtendedInfo whether to set the extended view info in the {@link ViewInfo} object.
* @param isContentFrame {@code true} if the {@code ViewInfo} to be created is part of the
* content frame. {@code false} if the {@code ViewInfo} to be created is
* part of the system decor.
*/
- private List<ViewInfo> visitAllChildren(ViewGroup viewGroup, int offset,
+ private List<ViewInfo> visitAllChildren(ViewGroup viewGroup, int hOffset, int vOffset,
boolean setExtendedInfo, boolean isContentFrame) {
if (viewGroup == null) {
return null;
}
if (!isContentFrame) {
- offset += viewGroup.getTop();
+ vOffset += viewGroup.getTop();
+ hOffset += viewGroup.getLeft();
}
int childCount = viewGroup.getChildCount();
@@ -1288,7 +1294,8 @@
List<ViewInfo> childrenWithoutOffset = new ArrayList<ViewInfo>(childCount);
List<ViewInfo> childrenWithOffset = new ArrayList<ViewInfo>(childCount);
for (int i = 0; i < childCount; i++) {
- ViewInfo[] childViewInfo = visitContentRoot(viewGroup.getChildAt(i), offset,
+ ViewInfo[] childViewInfo =
+ visitContentRoot(viewGroup.getChildAt(i), hOffset, vOffset,
setExtendedInfo);
childrenWithoutOffset.add(childViewInfo[0]);
childrenWithOffset.add(childViewInfo[1]);
@@ -1298,7 +1305,7 @@
} else {
List<ViewInfo> children = new ArrayList<ViewInfo>(childCount);
for (int i = 0; i < childCount; i++) {
- children.add(visit(viewGroup.getChildAt(i), offset, setExtendedInfo,
+ children.add(visit(viewGroup.getChildAt(i), hOffset, vOffset, setExtendedInfo,
isContentFrame));
}
return children;
@@ -1317,16 +1324,18 @@
* index 1 is with the offset.
*/
@NonNull
- private ViewInfo[] visitContentRoot(View view, int offset, boolean setExtendedInfo) {
+ private ViewInfo[] visitContentRoot(View view, int hOffset, int vOffset,
+ boolean setExtendedInfo) {
ViewInfo[] result = new ViewInfo[2];
if (view == null) {
return result;
}
- result[0] = createViewInfo(view, 0, setExtendedInfo, true);
- result[1] = createViewInfo(view, offset, setExtendedInfo, true);
+ result[0] = createViewInfo(view, 0, 0, setExtendedInfo, true);
+ result[1] = createViewInfo(view, hOffset, vOffset, setExtendedInfo, true);
if (view instanceof ViewGroup) {
- List<ViewInfo> children = visitAllChildren((ViewGroup) view, 0, setExtendedInfo, true);
+ List<ViewInfo> children =
+ visitAllChildren((ViewGroup) view, 0, 0, setExtendedInfo, true);
result[0].setChildren(children);
result[1].setChildren(children);
}
@@ -1337,9 +1346,12 @@
* Creates a {@link ViewInfo} for the view. The {@code ViewInfo} corresponding to the children
* of the {@code view} are not created. Consequently, the children of {@code ViewInfo} is not
* set.
- * @param offset an offset for the view bounds. Used only if view is part of the content frame.
+ * @param hOffset horizontal offset for the view bounds. Used only if view is part of the
+ * content frame.
+ * @param vOffset vertial an offset for the view bounds. Used only if view is part of the
+ * content frame.
*/
- private ViewInfo createViewInfo(View view, int offset, boolean setExtendedInfo,
+ private ViewInfo createViewInfo(View view, int hOffset, int vOffset, boolean setExtendedInfo,
boolean isContentFrame) {
if (view == null) {
return null;
@@ -1355,9 +1367,9 @@
// The view is part of the layout added by the user. Hence,
// the ViewCookie may be obtained only through the Context.
result = new ViewInfo(view.getClass().getName(),
- getContext().getViewKey(view),
- -scrollX + view.getLeft(), -scrollY + view.getTop() + offset,
- -scrollX + view.getRight(), -scrollY + view.getBottom() + offset,
+ getContext().getViewKey(view), -scrollX + view.getLeft() + hOffset,
+ -scrollY + view.getTop() + vOffset, -scrollX + view.getRight() + hOffset,
+ -scrollY + view.getBottom() + vOffset,
view, view.getLayoutParams());
} else {
// We are part of the system decor.