Merge "Don't crash Launcher on config change." into honeycomb
diff --git a/core/java/com/android/internal/view/menu/MenuBuilder.java b/core/java/com/android/internal/view/menu/MenuBuilder.java
index d0faea6..830c2c1 100644
--- a/core/java/com/android/internal/view/menu/MenuBuilder.java
+++ b/core/java/com/android/internal/view/menu/MenuBuilder.java
@@ -353,8 +353,7 @@
mNonActionItems = new ArrayList<MenuItemImpl>();
mIsActionItemsStale = true;
- mShortcutsVisible =
- (mResources.getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS);
+ setShortcutsVisibleInner(true);
}
public MenuBuilder setDefaultShowAsAction(int defaultShowAsAction) {
@@ -782,14 +781,18 @@
*/
public void setShortcutsVisible(boolean shortcutsVisible) {
if (mShortcutsVisible == shortcutsVisible) return;
-
- mShortcutsVisible =
- (mResources.getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS)
- && shortcutsVisible;
-
+
+ setShortcutsVisibleInner(shortcutsVisible);
refreshShortcuts(mShortcutsVisible, isQwertyMode());
}
+ private void setShortcutsVisibleInner(boolean shortcutsVisible) {
+ mShortcutsVisible = shortcutsVisible
+ && mResources.getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS
+ && mResources.getBoolean(
+ com.android.internal.R.bool.config_showMenuShortcutsWhenKeyboardPresent);
+ }
+
/**
* @return Whether shortcuts should be visible on menus.
*/
diff --git a/core/res/res/layout/volume_adjust.xml b/core/res/res/layout/volume_adjust.xml
index c44ed0b..18da85f 100644
--- a/core/res/res/layout/volume_adjust.xml
+++ b/core/res/res/layout/volume_adjust.xml
@@ -14,24 +14,32 @@
limitations under the License.
-->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:background="@android:drawable/toast_frame"
- android:orientation="vertical"
- android:gravity="center_horizontal">
+ android:background="@android:drawable/dialog_full_holo_dark"
+ android:gravity="left">
+
+ <LinearLayout
+ android:layout_width="416dip"
+ android:layout_height="wrap_content"
+ android:paddingLeft="16dip"
+ android:paddingTop="16dip"
+ android:paddingRight="16dip"
+ android:paddingBottom="8dip"
+ android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginTop="14dip"
- android:gravity="center_vertical">
+ android:layout_marginBottom="8dip"
+ android:gravity="left">
<ImageView
android:id="@+id/other_stream_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginRight="6dip" />
+ android:layout_marginRight="16dip" />
<TextView
android:layout_width="wrap_content"
@@ -56,13 +64,9 @@
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:id="@+id/level"
- android:layout_width="200dip"
- android:layout_height="wrap_content"
- android:layout_marginTop="14dip"
- android:layout_marginBottom="14dip"
- android:layout_marginLeft="25dip"
- android:layout_marginRight="25dip" />
-
-</LinearLayout>
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+ </LinearLayout>
+</FrameLayout>
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 590baf1..8bb05fb 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -529,4 +529,8 @@
<!-- When a database query is executed, the results retuned are paginated
in pages of size (in KB) indicated by this value -->
<integer name="config_cursorWindowSize">2048</integer>
+
+ <!-- Sets whether menu shortcuts should be displayed on panel menus when
+ a keyboard is present. -->
+ <bool name="config_showMenuShortcutsWhenKeyboardPresent">false</bool>
</resources>
diff --git a/libs/ui/KeyCharacterMap.cpp b/libs/ui/KeyCharacterMap.cpp
index 9bfa8f6..2decfe9 100644
--- a/libs/ui/KeyCharacterMap.cpp
+++ b/libs/ui/KeyCharacterMap.cpp
@@ -185,9 +185,11 @@
const Key* key;
const Behavior* behavior;
if (getKeyBehavior(keyCode, metaState, &key, &behavior)) {
- outFallbackAction->keyCode = behavior->fallbackKeyCode;
- outFallbackAction->metaState = metaState & ~behavior->metaState;
- result = true;
+ if (behavior->fallbackKeyCode) {
+ outFallbackAction->keyCode = behavior->fallbackKeyCode;
+ outFallbackAction->metaState = metaState & ~behavior->metaState;
+ result = true;
+ }
}
#if DEBUG_MAPPING
LOGD("getFallbackKeyCode: keyCode=%d, metaState=0x%08x ~ Result %s, "
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index 1fc2e6c..d6b7366 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -1624,24 +1624,7 @@
// First handle chording of panel key: if a panel key is held
// but not released, try to execute a shortcut in it.
if ((mPanelChordingKey > 0) && (mPanelChordingKey != keyCode)) {
- // Perform the shortcut (mPreparedPanel can be null since
- // global shortcuts (such as search) don't rely on a
- // prepared panel or menu).
- boolean handled = performPanelShortcut(mPreparedPanel, keyCode, event,
- Menu.FLAG_PERFORM_NO_CLOSE);
-
- if (!handled) {
- /*
- * If not handled, then pass it to the view hierarchy
- * and anyone else that may be interested.
- */
- handled = dispatchKeyShortcutEvent(event);
-
- if (handled && mPreparedPanel != null) {
- mPreparedPanel.isHandled = true;
- }
- }
-
+ boolean handled = dispatchKeyShortcutEvent(event);
if (handled) {
return true;
}
@@ -1676,6 +1659,19 @@
@Override
public boolean dispatchKeyShortcutEvent(KeyEvent ev) {
+ // Perform the shortcut (mPreparedPanel can be null since
+ // global shortcuts (such as search) don't rely on a
+ // prepared panel or menu).
+ boolean handled = performPanelShortcut(mPreparedPanel, ev.getKeyCode(), ev,
+ Menu.FLAG_PERFORM_NO_CLOSE);
+ if (handled) {
+ if (mPreparedPanel != null) {
+ mPreparedPanel.isHandled = true;
+ }
+ return true;
+ }
+
+ // Shortcut not handled by the panel. Dispatch to the view hierarchy.
final Callback cb = getCallback();
return cb != null && mFeatureId < 0 ? cb.dispatchKeyShortcutEvent(ev) : super
.dispatchKeyShortcutEvent(ev);
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index ee1a141..2a39322 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -239,9 +239,14 @@
volatile boolean mPowerKeyHandled;
RecentApplicationsDialog mRecentAppsDialog;
Handler mHandler;
-
+
+ private static final int LID_ABSENT = -1;
+ private static final int LID_CLOSED = 0;
+ private static final int LID_OPEN = 1;
+
+ int mLidOpen = LID_ABSENT;
+
boolean mSystemReady;
- boolean mLidOpen;
boolean mHdmiPlugged;
int mUiMode = Configuration.UI_MODE_TYPE_NORMAL;
int mDockMode = Intent.EXTRA_DOCK_STATE_UNDOCKED;
@@ -896,21 +901,31 @@
void readLidState() {
try {
int sw = mWindowManager.getSwitchState(SW_LID);
- if (sw >= 0) {
- mLidOpen = sw == 0;
+ if (sw > 0) {
+ mLidOpen = LID_OPEN;
+ } else if (sw == 0) {
+ mLidOpen = LID_CLOSED;
+ } else {
+ mLidOpen = LID_ABSENT;
}
} catch (RemoteException e) {
// Ignore
}
}
- private int determineHiddenState(boolean lidOpen,
- int mode, int hiddenValue, int visibleValue) {
+ private int determineHiddenState(int mode, int hiddenValue, int visibleValue) {
+ if (KEYBOARD_ALWAYS_HIDDEN) {
+ return hiddenValue;
+ }
+ if (mLidOpen == LID_ABSENT) {
+ return visibleValue;
+ }
+
switch (mode) {
case 1:
- return lidOpen ? visibleValue : hiddenValue;
+ return mLidOpen == LID_OPEN ? visibleValue : hiddenValue;
case 2:
- return lidOpen ? hiddenValue : visibleValue;
+ return mLidOpen == LID_OPEN ? hiddenValue : visibleValue;
}
return visibleValue;
}
@@ -918,12 +933,11 @@
/** {@inheritDoc} */
public void adjustConfigurationLw(Configuration config) {
readLidState();
- final boolean lidOpen = !KEYBOARD_ALWAYS_HIDDEN && mLidOpen;
- mPowerManager.setKeyboardVisibility(lidOpen);
- config.hardKeyboardHidden = determineHiddenState(lidOpen,
+ mPowerManager.setKeyboardVisibility(mLidOpen == LID_OPEN);
+ config.hardKeyboardHidden = determineHiddenState(
mLidKeyboardAccessibility, Configuration.HARDKEYBOARDHIDDEN_YES,
Configuration.HARDKEYBOARDHIDDEN_NO);
- config.navigationHidden = determineHiddenState(lidOpen,
+ config.navigationHidden = determineHiddenState(
mLidNavigationAccessibility, Configuration.NAVIGATIONHIDDEN_YES,
Configuration.NAVIGATIONHIDDEN_NO);
config.keyboardHidden = (config.hardKeyboardHidden
@@ -1973,8 +1987,8 @@
/** {@inheritDoc} */
public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen) {
// lid changed state
- mLidOpen = lidOpen;
- boolean awakeNow = mKeyguardMediator.doLidChangeTq(mLidOpen);
+ mLidOpen = lidOpen ? LID_OPEN : LID_CLOSED;
+ boolean awakeNow = mKeyguardMediator.doLidChangeTq(lidOpen);
updateRotation(Surface.FLAGS_ORIENTATION_ANIMATION_DISABLE);
if (awakeNow) {
// If the lid is opening and we don't have to keep the
@@ -1982,7 +1996,7 @@
// immediately.
mKeyguardMediator.pokeWakelock();
} else if (keyguardIsShowingTq()) {
- if (mLidOpen) {
+ if (lidOpen) {
// If we are opening the lid and not hiding the
// keyguard, then we need to have it turn on the
// screen once it is shown.
@@ -1991,7 +2005,7 @@
}
} else {
// Light up the keyboard if we are sliding up.
- if (mLidOpen) {
+ if (lidOpen) {
mPowerManager.userActivity(SystemClock.uptimeMillis(), false,
LocalPowerManager.BUTTON_EVENT);
} else {
@@ -2473,7 +2487,7 @@
//or case.unspecified
if (mHdmiPlugged) {
return Surface.ROTATION_0;
- } else if (mLidOpen) {
+ } else if (mLidOpen == LID_OPEN) {
return mLidOpenRotation;
} else if (mDockMode == Intent.EXTRA_DOCK_STATE_CAR && mCarDockRotation >= 0) {
return mCarDockRotation;
@@ -2641,11 +2655,11 @@
}
void updateRotation(int animFlags) {
- mPowerManager.setKeyboardVisibility(mLidOpen);
+ mPowerManager.setKeyboardVisibility(mLidOpen == LID_OPEN);
int rotation = Surface.ROTATION_0;
if (mHdmiPlugged) {
rotation = Surface.ROTATION_0;
- } else if (mLidOpen) {
+ } else if (mLidOpen == LID_OPEN) {
rotation = mLidOpenRotation;
} else if (mDockMode == Intent.EXTRA_DOCK_STATE_CAR && mCarDockRotation >= 0) {
rotation = mCarDockRotation;
diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp
index 7a45de6..f6a8859 100644
--- a/services/input/InputReader.cpp
+++ b/services/input/InputReader.cpp
@@ -1183,10 +1183,18 @@
if (downChanged) {
if (mAccumulator.btnMouse) {
- mLocked.down = true;
- mLocked.downTime = when;
+ if (!mLocked.down) {
+ mLocked.down = true;
+ mLocked.downTime = when;
+ } else {
+ downChanged = false;
+ }
} else {
- mLocked.down = false;
+ if (mLocked.down) {
+ mLocked.down = false;
+ } else {
+ downChanged = false;
+ }
}
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/BitmapFactory.java b/tools/layoutlib/bridge/src/android/graphics/BitmapFactory.java
index 7020d9c..db3cf44 100644
--- a/tools/layoutlib/bridge/src/android/graphics/BitmapFactory.java
+++ b/tools/layoutlib/bridge/src/android/graphics/BitmapFactory.java
@@ -353,7 +353,7 @@
If it happened on close, bm is still valid.
*/
Bridge.getLog().error(LayoutLog.TAG_RESOURCES_READ,
- String.format("Error decoding bitmap of id 0x%x", id), e);
+ String.format("Error decoding bitmap of id 0x%x", id), e, null /*data*/);
} finally {
try {
if (is != null) is.close();
@@ -454,7 +454,7 @@
if (is instanceof AssetManager.AssetInputStream) {
Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
"Bitmap.decodeStream: " +
- "InputStream is unsupported (AssetManager.AssetInputStream)");
+ "InputStream is unsupported (AssetManager.AssetInputStream)", null /*data*/);
return null;
} else {
// pass some temp storage down to the native code. 1024 is made up,
diff --git a/tools/layoutlib/bridge/src/android/graphics/BitmapShader_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/BitmapShader_Delegate.java
index 03d65b2..73c5a1a 100644
--- a/tools/layoutlib/bridge/src/android/graphics/BitmapShader_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/BitmapShader_Delegate.java
@@ -114,7 +114,7 @@
canvasMatrix = xform.createInverse();
} catch (java.awt.geom.NoninvertibleTransformException e) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE,
- "Unable to inverse matrix in BitmapShader", e);
+ "Unable to inverse matrix in BitmapShader", e, null /*data*/);
canvasMatrix = new java.awt.geom.AffineTransform();
}
@@ -123,7 +123,7 @@
localMatrix = localMatrix.createInverse();
} catch (java.awt.geom.NoninvertibleTransformException e) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE,
- "Unable to inverse matrix in BitmapShader", e);
+ "Unable to inverse matrix in BitmapShader", e, null /*data*/);
localMatrix = new java.awt.geom.AffineTransform();
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
index 18bf4b5..108d183 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
@@ -250,7 +250,7 @@
/*package*/ static boolean nativeCompress(int nativeBitmap, int format, int quality,
OutputStream stream, byte[] tempStorage) {
Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
- "Bitmap.compress() is not supported");
+ "Bitmap.compress() is not supported", null /*data*/);
return true;
}
@@ -386,7 +386,8 @@
// This is only called by Bitmap.CREATOR (Parcelable.Creator<Bitmap>), which is only
// used during aidl call so really this should not be called.
Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
- "AIDL is not suppored, and therefore Bitmaps cannot be created from parcels.");
+ "AIDL is not suppored, and therefore Bitmaps cannot be created from parcels.",
+ null /*data*/);
return null;
}
@@ -395,7 +396,8 @@
// This is only called when sending a bitmap through aidl, so really this should not
// be called.
Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
- "AIDL is not suppored, and therefore Bitmaps cannot be written to parcels.");
+ "AIDL is not suppored, and therefore Bitmaps cannot be written to parcels.",
+ null /*data*/);
return false;
}
@@ -412,7 +414,7 @@
if (paint != null && paint.getMaskFilter() != null) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MASKFILTER,
"MaskFilter not supported in Bitmap.extractAlpha",
- null);
+ null, null /*data*/);
}
int alpha = paint != null ? paint.getAlpha() : 0xFF;
diff --git a/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
index 8bfaf40..5a6902c 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
@@ -425,7 +425,7 @@
assert false;
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_AFFINE,
"android.graphics.Canvas#setMatrix(android.graphics.Matrix) only " +
- "supports affine transformations.", null);
+ "supports affine transformations.", null, null /*data*/);
}
}
@@ -494,7 +494,7 @@
if (filterDelegate.isSupported() == false) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_DRAWFILTER,
- filterDelegate.getSupportMessage(), null);
+ filterDelegate.getSupportMessage(), null, null /*data*/);
}
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/LinearGradient_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/LinearGradient_Delegate.java
index aab310a..9525dcf 100644
--- a/tools/layoutlib/bridge/src/android/graphics/LinearGradient_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/LinearGradient_Delegate.java
@@ -137,7 +137,7 @@
canvasMatrix = xform.createInverse();
} catch (java.awt.geom.NoninvertibleTransformException e) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE,
- "Unable to inverse matrix in LinearGradient", e);
+ "Unable to inverse matrix in LinearGradient", e, null /*data*/);
canvasMatrix = new java.awt.geom.AffineTransform();
}
@@ -146,7 +146,7 @@
localMatrix = localMatrix.createInverse();
} catch (java.awt.geom.NoninvertibleTransformException e) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE,
- "Unable to inverse matrix in LinearGradient", e);
+ "Unable to inverse matrix in LinearGradient", e, null /*data*/);
localMatrix = new java.awt.geom.AffineTransform();
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
index 0c934fc..2d77d40 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
@@ -615,7 +615,7 @@
// FIXME
Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
"Matrix.setPolyToPoly is not supported.",
- null);
+ null, null /*data*/);
return false;
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java
index 049ac45..7a6da95 100644
--- a/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java
@@ -74,7 +74,7 @@
oos = new ObjectOutputStream(baos);
oos.writeObject(chunk);
} catch (IOException e) {
- Bridge.getLog().error(null, "Failed to serialize NinePatchChunk.", e);
+ Bridge.getLog().error(null, "Failed to serialize NinePatchChunk.", e, null /*data*/);
return null;
} finally {
if (oos != null) {
@@ -198,11 +198,11 @@
}
} catch (IOException e) {
Bridge.getLog().error(LayoutLog.TAG_BROKEN,
- "Failed to deserialize NinePatchChunk content.", e);
+ "Failed to deserialize NinePatchChunk content.", e, null /*data*/);
return null;
} catch (ClassNotFoundException e) {
Bridge.getLog().error(LayoutLog.TAG_BROKEN,
- "Failed to deserialize NinePatchChunk class.", e);
+ "Failed to deserialize NinePatchChunk class.", e, null /*data*/);
return null;
} finally {
if (ois != null) {
diff --git a/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java
index 67afeca..87164fb 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java
@@ -182,7 +182,7 @@
} else {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_PATHEFFECT,
effectDelegate.getSupportMessage(),
- null);
+ null, null /*data*/);
}
}
@@ -377,7 +377,7 @@
int color) {
// FIXME
Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
- "Paint.setShadowLayer is not supported.", null);
+ "Paint.setShadowLayer is not supported.", null, null /*data*/);
}
/*package*/ static float getTextSize(Paint thisPaint) {
@@ -694,7 +694,7 @@
ColorFilter_Delegate filterDelegate = delegate.getColorFilter();
if (filterDelegate != null && filterDelegate.isSupported() == false) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_COLORFILTER,
- filterDelegate.getSupportMessage(), null);
+ filterDelegate.getSupportMessage(), null, null /*data*/);
}
return filter;
@@ -733,7 +733,7 @@
MaskFilter_Delegate filterDelegate = delegate.getMaskFilter();
if (filterDelegate != null && filterDelegate.isSupported() == false) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MASKFILTER,
- filterDelegate.getSupportMessage(), null);
+ filterDelegate.getSupportMessage(), null, null /*data*/);
}
return maskfilter;
@@ -764,7 +764,7 @@
Rasterizer_Delegate rasterizerDelegate = delegate.getRasterizer();
if (rasterizerDelegate != null && rasterizerDelegate.isSupported() == false) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_RASTERIZER,
- rasterizerDelegate.getSupportMessage(), null);
+ rasterizerDelegate.getSupportMessage(), null, null /*data*/);
}
return rasterizer;
diff --git a/tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java
index 62ea622..a4e43c1 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java
@@ -698,7 +698,7 @@
assert false;
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_AFFINE,
"android.graphics.Path#transform() only " +
- "supports affine transformations.", null);
+ "supports affine transformations.", null, null /*data*/);
}
GeneralPath newPath = new GeneralPath();
diff --git a/tools/layoutlib/bridge/src/android/graphics/PorterDuffXfermode_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/PorterDuffXfermode_Delegate.java
index 314dcff..147e1d0 100644
--- a/tools/layoutlib/bridge/src/android/graphics/PorterDuffXfermode_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/PorterDuffXfermode_Delegate.java
@@ -74,7 +74,7 @@
}
Bridge.getLog().error(LayoutLog.TAG_BROKEN,
- String.format("Unknown PorterDuff.Mode: %d", mode));
+ String.format("Unknown PorterDuff.Mode: %d", mode), null /*data*/);
assert false;
return PorterDuff.Mode.SRC_OVER;
}
@@ -118,7 +118,7 @@
Bridge.getLog().fidelityWarning(LayoutLog.TAG_BROKEN,
String.format("Unsupported PorterDuff Mode: %s", mode.name()),
- null);
+ null, null /*data*/);
return AlphaComposite.getInstance(AlphaComposite.SRC_OVER, falpha);
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/RadialGradient_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/RadialGradient_Delegate.java
index 2c26175..ffdf5dd 100644
--- a/tools/layoutlib/bridge/src/android/graphics/RadialGradient_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/RadialGradient_Delegate.java
@@ -126,7 +126,7 @@
canvasMatrix = xform.createInverse();
} catch (java.awt.geom.NoninvertibleTransformException e) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE,
- "Unable to inverse matrix in RadialGradient", e);
+ "Unable to inverse matrix in RadialGradient", e, null /*data*/);
canvasMatrix = new java.awt.geom.AffineTransform();
}
@@ -135,7 +135,7 @@
localMatrix = localMatrix.createInverse();
} catch (java.awt.geom.NoninvertibleTransformException e) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE,
- "Unable to inverse matrix in RadialGradient", e);
+ "Unable to inverse matrix in RadialGradient", e, null /*data*/);
localMatrix = new java.awt.geom.AffineTransform();
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/Region_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Region_Delegate.java
index f86c56c..9b6fb82 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Region_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Region_Delegate.java
@@ -417,7 +417,8 @@
// This is only called by Region.CREATOR (Parcelable.Creator<Region>), which is only
// used during aidl call so really this should not be called.
Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
- "AIDL is not suppored, and therefore Regions cannot be created from parcels.");
+ "AIDL is not suppored, and therefore Regions cannot be created from parcels.",
+ null /*data*/);
return 0;
}
@@ -426,7 +427,8 @@
// This is only called when sending a region through aidl, so really this should not
// be called.
Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
- "AIDL is not suppored, and therefore Regions cannot be written to parcels.");
+ "AIDL is not suppored, and therefore Regions cannot be written to parcels.",
+ null /*data*/);
return false;
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/SweepGradient_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/SweepGradient_Delegate.java
index e812f7f..048990a 100644
--- a/tools/layoutlib/bridge/src/android/graphics/SweepGradient_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/SweepGradient_Delegate.java
@@ -118,7 +118,7 @@
canvasMatrix = xform.createInverse();
} catch (java.awt.geom.NoninvertibleTransformException e) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE,
- "Unable to inverse matrix in SweepGradient", e);
+ "Unable to inverse matrix in SweepGradient", e, null /*data*/);
canvasMatrix = new java.awt.geom.AffineTransform();
}
@@ -127,7 +127,7 @@
localMatrix = localMatrix.createInverse();
} catch (java.awt.geom.NoninvertibleTransformException e) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE,
- "Unable to inverse matrix in SweepGradient", e);
+ "Unable to inverse matrix in SweepGradient", e, null /*data*/);
localMatrix = new java.awt.geom.AffineTransform();
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/Typeface_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Typeface_Delegate.java
index 44275d6..00a2a57 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Typeface_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Typeface_Delegate.java
@@ -127,13 +127,13 @@
/*package*/ static synchronized int nativeCreateFromAsset(AssetManager mgr, String path) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
- "Typeface.createFromAsset() is not supported.", null);
+ "Typeface.createFromAsset() is not supported.", null /*throwable*/, null /*data*/);
return 0;
}
/*package*/ static synchronized int nativeCreateFromFile(String path) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
- "Typeface.createFromFile() is not supported.", null);
+ "Typeface.createFromFile() is not supported.", null /*throwable*/, null /*data*/);
return 0;
}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java
index 6e9f4d5..37576b4 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java
@@ -137,17 +137,17 @@
*/
private final static LayoutLog sDefaultLog = new LayoutLog() {
@Override
- public void error(String tag, String message) {
+ public void error(String tag, String message, Object data) {
System.err.println(message);
}
@Override
- public void error(String tag, String message, Throwable throwable) {
+ public void error(String tag, String message, Throwable throwable, Object data) {
System.err.println(message);
}
@Override
- public void warning(String tag, String message) {
+ public void warning(String tag, String message, Object data) {
System.out.println(message);
}
};
@@ -207,7 +207,7 @@
@Override
public void onInvokeV(String signature, boolean isNative, Object caller) {
sDefaultLog.error(null, "Missing Stub: " + signature +
- (isNative ? " (native)" : ""));
+ (isNative ? " (native)" : ""), null /*data*/);
if (debug.equalsIgnoreCase("throw")) {
// Throwing this exception doesn't seem that useful. It breaks
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
index f5fc036..82e217a 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
@@ -343,7 +343,7 @@
} else if (set != null) { // null parser is ok
// really this should not be happening since its instantiated in Bridge
Bridge.getLog().error(LayoutLog.TAG_BROKEN,
- "Parser is not a BridgeXmlBlockParser!");
+ "Parser is not a BridgeXmlBlockParser!", null /*data*/);
return null;
}
@@ -391,7 +391,8 @@
} else {
Bridge.getLog().error(null,
String.format(
- "Failed to find style '%s' in current theme", defStyleName));
+ "Failed to find style '%s' in current theme", defStyleName),
+ null /*data*/);
}
}
}
@@ -726,7 +727,8 @@
if ("+id".equals(resType) == false && "+android:id".equals(resType) == false) { //$NON-NLS-1$ //$NON-NLS-2$
Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_RESOLVE,
"Couldn't resolve resource @" +
- (frameworkOnly ? "android:" : "") + resType + "/" + resName);
+ (frameworkOnly ? "android:" : "") + resType + "/" + resName,
+ new ResourceValue(resType, resName, frameworkOnly));
}
return null;
}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeInflater.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeInflater.java
index 61ac81b..e95d295b 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeInflater.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeInflater.java
@@ -180,7 +180,7 @@
return inflate(bridgeParser, root);
} catch (Exception e) {
Bridge.getLog().error(LayoutLog.TAG_RESOURCES_READ,
- "Failed to parse file " + f.getAbsolutePath(), e);
+ "Failed to parse file " + f.getAbsolutePath(), e, null /*data*/);
return null;
}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeResources.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeResources.java
index 8446a99..23d81a2 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeResources.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeResources.java
@@ -143,7 +143,8 @@
try {
return ResourceHelper.getColor(value.getValue());
} catch (NumberFormatException e) {
- Bridge.getLog().error(LayoutLog.TAG_RESOURCES_FORMAT, e.getMessage(), e);
+ Bridge.getLog().error(LayoutLog.TAG_RESOURCES_FORMAT, e.getMessage(), e,
+ null /*data*/);
return 0;
}
}
@@ -176,13 +177,13 @@
new BridgeXmlBlockParser(parser, mContext, resValue.isFramework()));
} catch (XmlPullParserException e) {
Bridge.getLog().error(LayoutLog.TAG_BROKEN,
- "Failed to configure parser for " + value, e);
+ "Failed to configure parser for " + value, e, null /*data*/);
// we'll return null below.
} catch (Exception e) {
// this is an error and not warning since the file existence is checked before
// attempting to parse it.
Bridge.getLog().error(LayoutLog.TAG_RESOURCES_READ,
- "Failed to parse file " + value, e);
+ "Failed to parse file " + value, e, null /*data*/);
return null;
}
@@ -193,7 +194,8 @@
return ColorStateList.valueOf(color);
} catch (NumberFormatException e) {
Bridge.getLog().error(LayoutLog.TAG_RESOURCES_FORMAT,
- "Failed to convert " + value + " into a ColorStateList", e);
+ "Failed to convert " + value + " into a ColorStateList", e,
+ null /*data*/);
return null;
}
}
@@ -253,7 +255,7 @@
}
} catch (XmlPullParserException e) {
Bridge.getLog().error(LayoutLog.TAG_BROKEN,
- "Failed to configure parser for " + value.getValue(), e);
+ "Failed to configure parser for " + value.getValue(), e, null /*data*/);
// we'll return null below.
} catch (FileNotFoundException e) {
// this shouldn't happen since we check above.
@@ -288,7 +290,7 @@
}
} catch (XmlPullParserException e) {
Bridge.getLog().error(LayoutLog.TAG_BROKEN,
- "Failed to configure parser for " + value.getValue(), e);
+ "Failed to configure parser for " + value.getValue(), e, null /*data*/);
// we'll return null below.
} catch (FileNotFoundException e) {
// this shouldn't happen since we check above.
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java
index 42f05e3..84bb4d1 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java
@@ -207,10 +207,10 @@
if (i != null) {
result |= i.intValue();
} else {
- Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_RESOLVE,
+ Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_FORMAT,
String.format(
- "Unknown constant \"%s\" in attribute \"%2$s\"",
- keyword, mNames[index]));
+ "\"%s\" in attribute \"%2$s\" is not a valid value",
+ keyword, mNames[index]), null /*data*/);
}
}
return result;
@@ -238,10 +238,10 @@
try {
return Float.parseFloat(s);
} catch (NumberFormatException e) {
- Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_RESOLVE,
+ Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_FORMAT,
String.format(
- "Unable to convert \"%s\" into a float in attribute \"%2$s\"",
- s, mNames[index]));
+ "\"%s\" in attribute \"%2$s\" cannot be converted to float.",
+ s, mNames[index]), null /*data*/);
// we'll return the default value below.
}
@@ -271,7 +271,7 @@
try {
return ResourceHelper.getColor(s);
} catch (NumberFormatException e) {
- Bridge.getLog().error(LayoutLog.TAG_RESOURCES_FORMAT, e.getMessage(), e);
+ Bridge.getLog().error(LayoutLog.TAG_RESOURCES_FORMAT, e.getMessage(), e, null /*data*/);
// we'll return the default value below.
}
@@ -315,13 +315,13 @@
return colorStateList;
} catch (XmlPullParserException e) {
Bridge.getLog().error(LayoutLog.TAG_BROKEN,
- "Failed to configure parser for " + value, e);
+ "Failed to configure parser for " + value, e, null /*data*/);
return null;
} catch (Exception e) {
// this is an error and not warning since the file existence is checked before
// attempting to parse it.
Bridge.getLog().error(LayoutLog.TAG_RESOURCES_READ,
- "Failed to parse file " + value, e);
+ "Failed to parse file " + value, e, null /*data*/);
return null;
}
@@ -331,7 +331,7 @@
int color = ResourceHelper.getColor(value);
return ColorStateList.valueOf(color);
} catch (NumberFormatException e) {
- Bridge.getLog().error(LayoutLog.TAG_RESOURCES_FORMAT, e.getMessage(), e);
+ Bridge.getLog().error(LayoutLog.TAG_RESOURCES_FORMAT, e.getMessage(), e, null /*data*/);
}
assert false;
@@ -360,10 +360,10 @@
try {
return Integer.parseInt(s);
} catch (NumberFormatException e) {
- Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_RESOLVE,
+ Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_FORMAT,
String.format(
- "Unable to convert \"%s\" into a integer in attribute \"%2$s\"",
- s, mNames[index]));
+ "\"%s\" in attribute \"%2$s\" cannont be converted to an integer.",
+ s, mNames[index]), null /*data*/);
// The default value is returned below.
}
@@ -410,10 +410,10 @@
}
// looks like we were unable to resolve the dimension value
- Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_RESOLVE,
+ Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_FORMAT,
String.format(
- "Unable to resolve dimension value \"%1$s\" in attribute \"%2$s\"",
- s, mNames[index]));
+ "\"%1$s\" in attribute \"%2$s\" is not a valid format.",
+ s, mNames[index]), null /*data*/);
assert false;
@@ -542,10 +542,10 @@
}
// looks like we were unable to resolve the fraction value
- Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_RESOLVE,
+ Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_FORMAT,
String.format(
- "Unable to resolve fraction value \"%1$s\" in attribute \"%2$s\"",
- value, mNames[index]));
+ "\"%1$s\" in attribute \"%2$s\" cannont be converted to a fraction.",
+ value, mNames[index]), null /*data*/);
assert false;
@@ -656,7 +656,8 @@
Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_RESOLVE,
String.format(
- "Unable to resolve id \"%1$s\" for attribute \"%2$s\"", value, mNames[index]));
+ "Unable to resolve id \"%1$s\" for attribute \"%2$s\"", value, mNames[index]),
+ resValue);
assert false;
@@ -685,21 +686,7 @@
return null;
}
- Drawable d = ResourceHelper.getDrawable(value, mContext, mResourceData[index].isFramework());
-
- if (d != null) {
- return d;
- }
-
- // looks like we were unable to resolve the drawable
- Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_RESOLVE,
- String.format(
- "Unable to resolve drawable \"%1$s\" in attribute \"%2$s\"", stringValue,
- mNames[index]));
-
- assert false;
-
- return null;
+ return ResourceHelper.getDrawable(value, mContext, mResourceData[index].isFramework());
}
@@ -724,10 +711,10 @@
return new CharSequence[] { value };
}
- Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_RESOLVE,
+ Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_FORMAT,
String.format(
String.format("Unknown value for getTextArray(%d) => %s", //DEBUG
- index, mResourceData[index].getName())));
+ index, mResourceData[index].getName())), null /*data*/);
return null;
}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/GcSnapshot.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/GcSnapshot.java
index c4ebb8a..21d6b1a 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/GcSnapshot.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/GcSnapshot.java
@@ -730,7 +730,7 @@
} else {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_SHADER,
shaderDelegate.getSupportMessage(),
- null);
+ null /*throwable*/, null /*data*/);
}
}
@@ -764,7 +764,7 @@
} else {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_XFERMODE,
xfermodeDelegate.getSupportMessage(),
- null);
+ null /*throwable*/, null /*data*/);
}
}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
index 566d4d4..2439791 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
@@ -1046,7 +1046,8 @@
assert false;
mParams.getLog().error(LayoutLog.TAG_RESOURCES_RESOLVE,
- String.format("Unable to resolve parent style name: %s", parentName));
+ String.format("Unable to resolve parent style name: %s", parentName),
+ null /*data*/);
return null;
}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
index 4e331d1..475b4be2 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
@@ -166,7 +166,7 @@
} catch (IOException e) {
// failed to read the file, we'll return null below.
Bridge.getLog().error(LayoutLog.TAG_RESOURCES_READ,
- "Failed lot load " + file.getAbsolutePath(), e);
+ "Failed lot load " + file.getAbsolutePath(), e, null /*data*/);
}
}
@@ -197,11 +197,12 @@
} catch (Exception e) {
// this is an error and not warning since the file existence is checked before
// attempting to parse it.
- Bridge.getLog().error(null, "Failed to parse file " + value, e);
+ Bridge.getLog().error(null, "Failed to parse file " + value, e, null /*data*/);
}
} else {
Bridge.getLog().error(LayoutLog.TAG_BROKEN,
- String.format("File %s does not exist (or is not a file)", stringValue));
+ String.format("File %s does not exist (or is not a file)", stringValue),
+ null /*data*/);
}
return null;
@@ -228,7 +229,7 @@
} catch (IOException e) {
// we'll return null below
Bridge.getLog().error(LayoutLog.TAG_RESOURCES_READ,
- "Failed lot load " + bmpFile.getAbsolutePath(), e);
+ "Failed lot load " + bmpFile.getAbsolutePath(), e, null /*data*/);
}
} else {
// attempt to get a color from the value
@@ -238,7 +239,8 @@
} catch (NumberFormatException e) {
// we'll return null below.
Bridge.getLog().error(LayoutLog.TAG_RESOURCES_FORMAT,
- "Failed to convert " + stringValue + " into a drawable", e);
+ "Failed to convert " + stringValue + " into a drawable", e,
+ null /*data*/);
}
}
}