summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.mk6
-rw-r--r--api/current.txt1
-rw-r--r--core/java/android/text/GraphicsOperations.java13
-rw-r--r--core/java/android/text/MeasuredText.java7
-rw-r--r--core/java/android/text/SpannableStringBuilder.java63
-rw-r--r--core/java/android/text/TextLine.java24
-rw-r--r--core/java/android/text/bidi/BidiFormatter.java106
-rw-r--r--core/java/android/util/DisplayMetrics.java9
-rw-r--r--core/java/android/view/GLES20Canvas.java45
-rw-r--r--core/java/android/view/GLES20RecordingCanvas.java8
-rw-r--r--core/java/android/view/HardwareRenderer.java2
-rw-r--r--core/java/android/view/View.java3
-rw-r--r--core/java/android/widget/GridLayout.java2
-rw-r--r--core/java/android/widget/TextView.java22
-rw-r--r--core/jni/android/graphics/Canvas.cpp52
-rw-r--r--core/jni/android/graphics/Paint.cpp148
-rw-r--r--core/jni/android/graphics/TextLayout.cpp114
-rw-r--r--core/jni/android/graphics/TextLayout.h29
-rw-r--r--core/jni/android/graphics/TextLayoutCache.cpp200
-rw-r--r--core/jni/android/graphics/TextLayoutCache.h11
-rw-r--r--core/jni/android_view_GLES20Canvas.cpp58
-rw-r--r--core/res/Android.mk4
-rw-r--r--core/res/res/values-ko/strings.xml2
-rw-r--r--core/res/res/values-sw/strings.xml10
-rw-r--r--core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/AccessPointParserHelper.java8
-rw-r--r--docs/html/reference/gcm-lists.js16
-rw-r--r--docs/html/reference/gms-lists.js93
-rw-r--r--docs/html/sdk/index.jd53
-rw-r--r--docs/html/sdk/installing/installing-adt.jd6
-rw-r--r--docs/html/tools/device.jd12
-rw-r--r--docs/html/tools/help/adb.jd32
-rw-r--r--docs/html/tools/publishing/app-signing.jd24
-rw-r--r--docs/html/tools/sdk/eclipse-adt.jd57
-rw-r--r--docs/html/tools/sdk/tools-notes.jd37
-rw-r--r--graphics/java/android/graphics/Canvas.java64
-rw-r--r--graphics/java/android/graphics/Paint.java290
-rw-r--r--graphics/java/android/renderscript/Script.java5
-rw-r--r--include/androidfw/ResourceTypes.h1
-rw-r--r--libs/hwui/Android.mk1
-rw-r--r--libs/hwui/Caches.cpp4
-rw-r--r--libs/hwui/Caches.h2
-rw-r--r--libs/hwui/Debug.h3
-rw-r--r--libs/hwui/Layer.cpp3
-rw-r--r--libs/hwui/LayerCache.cpp1
-rw-r--r--libs/hwui/LayerCache.h22
-rw-r--r--libs/hwui/OpenGLRenderer.cpp5
-rw-r--r--libs/hwui/Properties.h6
-rw-r--r--libs/hwui/RenderBuffer.h25
-rw-r--r--libs/hwui/RenderBufferCache.cpp166
-rw-r--r--libs/hwui/RenderBufferCache.h130
-rw-r--r--services/java/com/android/server/NetworkManagementService.java8
-rw-r--r--services/java/com/android/server/am/ActivityManagerService.java118
-rw-r--r--services/java/com/android/server/am/ActivityRecord.java5
-rw-r--r--services/java/com/android/server/am/ActivityStack.java200
-rw-r--r--services/java/com/android/server/pm/UserManagerService.java8
-rw-r--r--services/java/com/android/server/wm/DisplayContent.java145
-rw-r--r--services/java/com/android/server/wm/TaskGroup.java (renamed from services/java/com/android/server/am/TaskGroup.java)2
-rw-r--r--services/java/com/android/server/wm/TaskList.java12
-rw-r--r--services/java/com/android/server/wm/WindowManagerService.java49
-rw-r--r--tests/BiDiTests/res/layout/canvas.xml40
-rw-r--r--tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java1
-rw-r--r--tests/BiDiTests/src/com/android/bidi/BiDiTestCanvas.java67
-rw-r--r--tests/BiDiTests/src/com/android/bidi/BiDiTestView.java212
-rw-r--r--tools/aapt/AaptAssets.cpp5
-rw-r--r--tools/layoutlib/bridge/src/android/text/format/DateFormat_Delegate.java37
-rw-r--r--tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java1
66 files changed, 1417 insertions, 1498 deletions
diff --git a/Android.mk b/Android.mk
index 1b63a91b08d5..c8576a04b511 100644
--- a/Android.mk
+++ b/Android.mk
@@ -700,9 +700,6 @@ LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=build/tools/droiddoc/templates-sdk
include $(BUILD_DROIDDOC)
-# explicitly specify that online-sdk depends on framework-res and any generated docs
-$(full_target): framework-res-package-target
-
# ==== docs for the web (on the devsite app engine server) =======================
include $(CLEAR_VARS)
LOCAL_SRC_FILES:=$(framework_docs_LOCAL_SRC_FILES)
@@ -731,9 +728,6 @@ LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=build/tools/droiddoc/templates-sdk
include $(BUILD_DROIDDOC)
-# explicitly specify that ds depends on framework-res and any generated docs
-$(full_target): framework-res-package-target
-
# ==== docs that have all of the stuff that's @hidden =======================
include $(CLEAR_VARS)
diff --git a/api/current.txt b/api/current.txt
index b54314c26666..ee4732d019f6 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -23343,6 +23343,7 @@ package android.util {
field public static final int DENSITY_TV = 213; // 0xd5
field public static final int DENSITY_XHIGH = 320; // 0x140
field public static final int DENSITY_XXHIGH = 480; // 0x1e0
+ field public static final int DENSITY_XXXHIGH = 640; // 0x280
field public float density;
field public int densityDpi;
field public int heightPixels;
diff --git a/core/java/android/text/GraphicsOperations.java b/core/java/android/text/GraphicsOperations.java
index 831ccc556bf9..60545e5cbdf2 100644
--- a/core/java/android/text/GraphicsOperations.java
+++ b/core/java/android/text/GraphicsOperations.java
@@ -38,7 +38,7 @@ extends CharSequence
* {@hide}
*/
void drawTextRun(Canvas c, int start, int end, int contextStart, int contextEnd,
- float x, float y, int flags, Paint p);
+ float x, float y, Paint p);
/**
* Just like {@link Paint#measureText}.
@@ -55,19 +55,12 @@ extends CharSequence
* @hide
*/
float getTextRunAdvances(int start, int end, int contextStart, int contextEnd,
- int flags, float[] advances, int advancesIndex, Paint paint);
-
- /**
- * Just like {@link Paint#getTextRunAdvances}.
- * @hide
- */
- float getTextRunAdvances(int start, int end, int contextStart, int contextEnd,
- int flags, float[] advances, int advancesIndex, Paint paint, int reserved);
+ float[] advances, int advancesIndex, Paint paint);
/**
* Just like {@link Paint#getTextRunCursor}.
* @hide
*/
- int getTextRunCursor(int contextStart, int contextEnd, int flags, int offset,
+ int getTextRunCursor(int contextStart, int contextEnd, int offset,
int cursorOpt, Paint p);
}
diff --git a/core/java/android/text/MeasuredText.java b/core/java/android/text/MeasuredText.java
index bd9310c1b1b2..0c881a4da6b3 100644
--- a/core/java/android/text/MeasuredText.java
+++ b/core/java/android/text/MeasuredText.java
@@ -159,18 +159,15 @@ class MeasuredText {
mPos = p + len;
if (mEasy) {
- int flags = mDir == Layout.DIR_LEFT_TO_RIGHT
- ? Canvas.DIRECTION_LTR : Canvas.DIRECTION_RTL;
- return paint.getTextRunAdvances(mChars, p, len, p, len, flags, mWidths, p);
+ return paint.getTextRunAdvances(mChars, p, len, p, len, mWidths, p);
}
float totalAdvance = 0;
int level = mLevels[p];
for (int q = p, i = p + 1, e = p + len;; ++i) {
if (i == e || mLevels[i] != level) {
- int flags = (level & 0x1) == 0 ? Canvas.DIRECTION_LTR : Canvas.DIRECTION_RTL;
totalAdvance +=
- paint.getTextRunAdvances(mChars, q, i - q, q, i - q, flags, mWidths, q);
+ paint.getTextRunAdvances(mChars, q, i - q, q, i - q, mWidths, q);
if (i == e) {
break;
}
diff --git a/core/java/android/text/SpannableStringBuilder.java b/core/java/android/text/SpannableStringBuilder.java
index 0f30d25f7d15..9e4367117a15 100644
--- a/core/java/android/text/SpannableStringBuilder.java
+++ b/core/java/android/text/SpannableStringBuilder.java
@@ -1130,20 +1130,20 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable
* {@hide}
*/
public void drawTextRun(Canvas c, int start, int end, int contextStart, int contextEnd,
- float x, float y, int flags, Paint p) {
+ float x, float y, Paint p) {
checkRange("drawTextRun", start, end);
int contextLen = contextEnd - contextStart;
int len = end - start;
if (contextEnd <= mGapStart) {
- c.drawTextRun(mText, start, len, contextStart, contextLen, x, y, flags, p);
+ c.drawTextRun(mText, start, len, contextStart, contextLen, x, y, p);
} else if (contextStart >= mGapStart) {
c.drawTextRun(mText, start + mGapLength, len, contextStart + mGapLength,
- contextLen, x, y, flags, p);
+ contextLen, x, y, p);
} else {
char[] buf = TextUtils.obtain(contextLen);
getChars(contextStart, contextEnd, buf, 0);
- c.drawTextRun(buf, start - contextStart, len, 0, contextLen, x, y, flags, p);
+ c.drawTextRun(buf, start - contextStart, len, 0, contextLen, x, y, p);
TextUtils.recycle(buf);
}
}
@@ -1200,7 +1200,7 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable
* Don't call this yourself -- exists for Paint to use internally.
* {@hide}
*/
- public float getTextRunAdvances(int start, int end, int contextStart, int contextEnd, int flags,
+ public float getTextRunAdvances(int start, int end, int contextStart, int contextEnd,
float[] advances, int advancesPos, Paint p) {
float ret;
@@ -1210,44 +1210,15 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable
if (end <= mGapStart) {
ret = p.getTextRunAdvances(mText, start, len, contextStart, contextLen,
- flags, advances, advancesPos);
+ advances, advancesPos);
} else if (start >= mGapStart) {
ret = p.getTextRunAdvances(mText, start + mGapLength, len,
- contextStart + mGapLength, contextLen, flags, advances, advancesPos);
+ contextStart + mGapLength, contextLen, advances, advancesPos);
} else {
char[] buf = TextUtils.obtain(contextLen);
getChars(contextStart, contextEnd, buf, 0);
ret = p.getTextRunAdvances(buf, start - contextStart, len,
- 0, contextLen, flags, advances, advancesPos);
- TextUtils.recycle(buf);
- }
-
- return ret;
- }
-
- /**
- * Don't call this yourself -- exists for Paint to use internally.
- * {@hide}
- */
- public float getTextRunAdvances(int start, int end, int contextStart, int contextEnd, int flags,
- float[] advances, int advancesPos, Paint p, int reserved) {
-
- float ret;
-
- int contextLen = contextEnd - contextStart;
- int len = end - start;
-
- if (end <= mGapStart) {
- ret = p.getTextRunAdvances(mText, start, len, contextStart, contextLen,
- flags, advances, advancesPos, reserved);
- } else if (start >= mGapStart) {
- ret = p.getTextRunAdvances(mText, start + mGapLength, len,
- contextStart + mGapLength, contextLen, flags, advances, advancesPos, reserved);
- } else {
- char[] buf = TextUtils.obtain(contextLen);
- getChars(contextStart, contextEnd, buf, 0);
- ret = p.getTextRunAdvances(buf, start - contextStart, len,
- 0, contextLen, flags, advances, advancesPos, reserved);
+ 0, contextLen, advances, advancesPos);
TextUtils.recycle(buf);
}
@@ -1270,7 +1241,7 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable
*
* @param contextStart the start index of the context
* @param contextEnd the (non-inclusive) end index of the context
- * @param flags either DIRECTION_RTL or DIRECTION_LTR
+ * @param flags reserved
* @param offset the cursor position to move from
* @param cursorOpt how to move the cursor, one of CURSOR_AFTER,
* CURSOR_AT_OR_AFTER, CURSOR_BEFORE,
@@ -1281,22 +1252,30 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable
*/
@Deprecated
public int getTextRunCursor(int contextStart, int contextEnd, int flags, int offset,
- int cursorOpt, Paint p) {
+ int cursorOpt, Paint p) {
+ return getTextRunCursor(contextStart, contextEnd, offset, cursorOpt, p);
+ }
+
+ /**
+ * @hide
+ */
+ public int getTextRunCursor(int contextStart, int contextEnd, int offset,
+ int cursorOpt, Paint p) {
int ret;
int contextLen = contextEnd - contextStart;
if (contextEnd <= mGapStart) {
ret = p.getTextRunCursor(mText, contextStart, contextLen,
- flags, offset, cursorOpt);
+ offset, cursorOpt);
} else if (contextStart >= mGapStart) {
ret = p.getTextRunCursor(mText, contextStart + mGapLength, contextLen,
- flags, offset + mGapLength, cursorOpt) - mGapLength;
+ offset + mGapLength, cursorOpt) - mGapLength;
} else {
char[] buf = TextUtils.obtain(contextLen);
getChars(contextStart, contextEnd, buf, 0);
ret = p.getTextRunCursor(buf, 0, contextLen,
- flags, offset - contextStart, cursorOpt) + contextStart;
+ offset - contextStart, cursorOpt) + contextStart;
TextUtils.recycle(buf);
}
diff --git a/core/java/android/text/TextLine.java b/core/java/android/text/TextLine.java
index 1fecf81d5a4f..e34a0efccf21 100644
--- a/core/java/android/text/TextLine.java
+++ b/core/java/android/text/TextLine.java
@@ -664,14 +664,13 @@ class TextLine {
}
}
- int flags = runIsRtl ? Paint.DIRECTION_RTL : Paint.DIRECTION_LTR;
int cursorOpt = after ? Paint.CURSOR_AFTER : Paint.CURSOR_BEFORE;
if (mCharsValid) {
return wp.getTextRunCursor(mChars, spanStart, spanLimit - spanStart,
- flags, offset, cursorOpt);
+ offset, cursorOpt);
} else {
return wp.getTextRunCursor(mText, mStart + spanStart,
- mStart + spanLimit, flags, mStart + offset, cursorOpt) - mStart;
+ mStart + spanLimit, mStart + offset, cursorOpt) - mStart;
}
}
@@ -738,15 +737,13 @@ class TextLine {
int contextLen = contextEnd - contextStart;
if (needWidth || (c != null && (wp.bgColor != 0 || wp.underlineColor != 0 || runIsRtl))) {
- int flags = runIsRtl ? Paint.DIRECTION_RTL : Paint.DIRECTION_LTR;
if (mCharsValid) {
ret = wp.getTextRunAdvances(mChars, start, runLen,
- contextStart, contextLen, flags, null, 0);
+ contextStart, contextLen, null, 0);
} else {
int delta = mStart;
- ret = wp.getTextRunAdvances(mText, delta + start,
- delta + end, delta + contextStart, delta + contextEnd,
- flags, null, 0);
+ ret = wp.getTextRunAdvances(mText, delta + start, delta + end,
+ delta + contextStart, delta + contextEnd, null, 0);
}
}
@@ -786,8 +783,7 @@ class TextLine {
wp.setAntiAlias(previousAntiAlias);
}
- drawTextRun(c, wp, start, end, contextStart, contextEnd, runIsRtl,
- x, y + wp.baselineShift);
+ drawTextRun(c, wp, start, end, contextStart, contextEnd, x, y + wp.baselineShift);
}
return runIsRtl ? -ret : ret;
@@ -970,23 +966,21 @@ class TextLine {
* @param end the end of the run
* @param contextStart the start of context for the run
* @param contextEnd the end of the context for the run
- * @param runIsRtl true if the run is right-to-left
* @param x the x position of the left edge of the run
* @param y the baseline of the run
*/
private void drawTextRun(Canvas c, TextPaint wp, int start, int end,
- int contextStart, int contextEnd, boolean runIsRtl, float x, int y) {
+ int contextStart, int contextEnd, float x, int y) {
- int flags = runIsRtl ? Canvas.DIRECTION_RTL : Canvas.DIRECTION_LTR;
if (mCharsValid) {
int count = end - start;
int contextCount = contextEnd - contextStart;
c.drawTextRun(mChars, start, count, contextStart, contextCount,
- x, y, flags, wp);
+ x, y, wp);
} else {
int delta = mStart;
c.drawTextRun(mText, delta + start, delta + end,
- delta + contextStart, delta + contextEnd, x, y, flags, wp);
+ delta + contextStart, delta + contextEnd, x, y, wp);
}
}
diff --git a/core/java/android/text/bidi/BidiFormatter.java b/core/java/android/text/bidi/BidiFormatter.java
index 355475154b54..370cbf77f2c0 100644
--- a/core/java/android/text/bidi/BidiFormatter.java
+++ b/core/java/android/text/bidi/BidiFormatter.java
@@ -254,13 +254,19 @@ public final class BidiFormatter {
}
}
+ //
private static final int FLAG_STEREO_RESET = 2;
private static final int DEFAULT_FLAGS = FLAG_STEREO_RESET;
- private static final BidiFormatter DEFAULT_LTR_INSTANCE =
- new BidiFormatter(false /* LTR context */, DEFAULT_FLAGS, DEFAULT_TEXT_DIRECTION_HEURISTIC);
- private static final BidiFormatter DEFAULT_RTL_INSTANCE =
- new BidiFormatter(true /* RTL context */, DEFAULT_FLAGS, DEFAULT_TEXT_DIRECTION_HEURISTIC);
+ private static final BidiFormatter DEFAULT_LTR_INSTANCE = new BidiFormatter(
+ false /* LTR context */,
+ DEFAULT_FLAGS,
+ DEFAULT_TEXT_DIRECTION_HEURISTIC);
+
+ private static final BidiFormatter DEFAULT_RTL_INSTANCE = new BidiFormatter(
+ true /* RTL context */,
+ DEFAULT_FLAGS,
+ DEFAULT_TEXT_DIRECTION_HEURISTIC);
private final boolean isRtlContext;
private final int flags;
@@ -411,10 +417,10 @@ public final class BidiFormatter {
public String markAfter(String str, TextDirectionHeuristic heuristic) {
final boolean isRtl = heuristic.isRtl(str, 0, str.length());
// getExitDir() is called only if needed (short-circuit).
- if (!isRtlContext && (isRtl || getExitDir(str) == Dir.RTL)) {
+ if (!isRtlContext && (isRtl || getExitDir(str) == DIR_RTL)) {
return LRM_STRING;
}
- if (isRtlContext && (!isRtl || getExitDir(str) == Dir.LTR)) {
+ if (isRtlContext && (!isRtl || getExitDir(str) == DIR_LTR)) {
return RLM_STRING;
}
return EMPTY_STRING;
@@ -450,10 +456,10 @@ public final class BidiFormatter {
public String markBefore(String str, TextDirectionHeuristic heuristic) {
final boolean isRtl = heuristic.isRtl(str, 0, str.length());
// getEntryDir() is called only if needed (short-circuit).
- if (!isRtlContext && (isRtl || getEntryDir(str) == Dir.RTL)) {
+ if (!isRtlContext && (isRtl || getEntryDir(str) == DIR_RTL)) {
return LRM_STRING;
}
- if (isRtlContext && (!isRtl || getEntryDir(str) == Dir.LTR)) {
+ if (isRtlContext && (!isRtl || getEntryDir(str) == DIR_LTR)) {
return RLM_STRING;
}
return EMPTY_STRING;
@@ -677,43 +683,13 @@ public final class BidiFormatter {
/**
* Enum for directionality type.
*/
- private enum Dir {
- LTR (1),
- UNKNOWN (0),
- RTL (-1);
-
- public final int ord;
-
- Dir(int ord) {this.ord = ord; }
-
- /**
- * Interprets numeric representation of directionality: positive values are
- * interpreted as RTL, negative values as LTR, and zero as UNKNOWN.
- */
- public static Dir valueOf(int dir) {
- return dir > 0 ? LTR : dir < 0 ? RTL : UNKNOWN;
- }
-
- /**
- * Interprets boolean representation of directionality: false is interpreted
- * as LTR and true as RTL.
- */
- public static Dir valueOf(boolean dir) {
- return dir ? RTL : LTR;
- }
-
- /**
- * Returns whether this directionality is opposite to the given
- * directionality.
- */
- public boolean isOppositeTo(Dir dir) {
- return this.ord * dir.ord < 0;
- }
- }
+ private static final int DIR_LTR = -1;
+ private static final int DIR_UNKNOWN = 0;
+ private static final int DIR_RTL = +1;
/**
* Returns the directionality of the last character with strong directionality in the string, or
- * Dir.UNKNOWN if none was encountered. For efficiency, actually scans backwards from the end of
+ * DIR_UNKNOWN if none was encountered. For efficiency, actually scans backwards from the end of
* the string. Treats a non-BN character between an LRE/RLE/LRO/RLO and its matching PDF as a
* strong character, LTR after LRE/LRO, and RTL after RLE/RLO. The results are undefined for a
* string containing unbalanced LRE/RLE/LRO/RLO/PDF characters. The intended use is to check
@@ -725,13 +701,13 @@ public final class BidiFormatter {
*
* @param str the string to check.
*/
- private static Dir getExitDir(String str) {
+ private static int getExitDir(String str) {
return new DirectionalityEstimator(str, false /* isHtml */).getExitDir();
}
/**
* Returns the directionality of the first character with strong directionality in the string,
- * or Dir.UNKNOWN if none was encountered. Treats a non-BN character between an
+ * or DIR_UNKNOWN if none was encountered. Treats a non-BN character between an
* LRE/RLE/LRO/RLO and its matching PDF as a strong character, LTR after LRE/LRO, and RTL after
* RLE/RLO. The results are undefined for a string containing unbalanced LRE/RLE/LRO/RLO/PDF
* characters. The intended use is to check whether a logically separate item that ends with a
@@ -742,7 +718,7 @@ public final class BidiFormatter {
*
* @param str the string to check.
*/
- private static Dir getEntryDir(String str) {
+ private static int getEntryDir(String str) {
return new DirectionalityEstimator(str, false /* isHtml */).getEntryDir();
}
@@ -821,51 +797,51 @@ public final class BidiFormatter {
/**
* Returns the directionality of the first character with strong directionality in the
- * string, or Dir.UNKNOWN if none was encountered. Treats a non-BN character between an
+ * string, or DIR_UNKNOWN if none was encountered. Treats a non-BN character between an
* LRE/RLE/LRO/RLO and its matching PDF as a strong character, LTR after LRE/LRO, and RTL
* after RLE/RLO. The results are undefined for a string containing unbalanced
* LRE/RLE/LRO/RLO/PDF characters.
*/
- Dir getEntryDir() {
+ int getEntryDir() {
// The reason for this method name, as opposed to getFirstStrongDir(), is that
// "first strong" is a commonly used description of Unicode's estimation algorithm,
// but the two must treat formatting characters quite differently. Thus, we are staying
// away from both "first" and "last" in these method names to avoid confusion.
charIndex = 0;
int embeddingLevel = 0;
- Dir embeddingLevelDir = Dir.UNKNOWN;
+ int embeddingLevelDir = DIR_UNKNOWN;
int firstNonEmptyEmbeddingLevel = 0;
while (charIndex < length && firstNonEmptyEmbeddingLevel == 0) {
switch (dirTypeForward()) {
case Character.DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING:
case Character.DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE:
++embeddingLevel;
- embeddingLevelDir = Dir.LTR;
+ embeddingLevelDir = DIR_LTR;
break;
case Character.DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING:
case Character.DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE:
++embeddingLevel;
- embeddingLevelDir = Dir.RTL;
+ embeddingLevelDir = DIR_RTL;
break;
case Character.DIRECTIONALITY_POP_DIRECTIONAL_FORMAT:
--embeddingLevel;
// To restore embeddingLevelDir to its previous value, we would need a
// stack, which we want to avoid. Thus, at this point we do not know the
// current embedding's directionality.
- embeddingLevelDir = Dir.UNKNOWN;
+ embeddingLevelDir = DIR_UNKNOWN;
break;
case Character.DIRECTIONALITY_BOUNDARY_NEUTRAL:
break;
case Character.DIRECTIONALITY_LEFT_TO_RIGHT:
if (embeddingLevel == 0) {
- return Dir.LTR;
+ return DIR_LTR;
}
firstNonEmptyEmbeddingLevel = embeddingLevel;
break;
case Character.DIRECTIONALITY_RIGHT_TO_LEFT:
case Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC:
if (embeddingLevel == 0) {
- return Dir.RTL;
+ return DIR_RTL;
}
firstNonEmptyEmbeddingLevel = embeddingLevel;
break;
@@ -880,11 +856,11 @@ public final class BidiFormatter {
if (firstNonEmptyEmbeddingLevel == 0) {
// We have not found a non-empty embedding. Thus, the string contains neither a
// non-empty embedding nor a strong character outside of an embedding.
- return Dir.UNKNOWN;
+ return DIR_UNKNOWN;
}
// We have found a non-empty embedding.
- if (embeddingLevelDir != Dir.UNKNOWN) {
+ if (embeddingLevelDir != DIR_UNKNOWN) {
// We know the directionality of the non-empty embedding.
return embeddingLevelDir;
}
@@ -896,14 +872,14 @@ public final class BidiFormatter {
case Character.DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING:
case Character.DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE:
if (firstNonEmptyEmbeddingLevel == embeddingLevel) {
- return Dir.LTR;
+ return DIR_LTR;
}
--embeddingLevel;
break;
case Character.DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING:
case Character.DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE:
if (firstNonEmptyEmbeddingLevel == embeddingLevel) {
- return Dir.RTL;
+ return DIR_RTL;
}
--embeddingLevel;
break;
@@ -913,17 +889,17 @@ public final class BidiFormatter {
}
}
// We should never get here.
- return Dir.UNKNOWN;
+ return DIR_UNKNOWN;
}
/**
* Returns the directionality of the last character with strong directionality in the
- * string, or Dir.UNKNOWN if none was encountered. For efficiency, actually scans backwards
+ * string, or DIR_UNKNOWN if none was encountered. For efficiency, actually scans backwards
* from the end of the string. Treats a non-BN character between an LRE/RLE/LRO/RLO and its
* matching PDF as a strong character, LTR after LRE/LRO, and RTL after RLE/RLO. The results
* are undefined for a string containing unbalanced LRE/RLE/LRO/RLO/PDF characters.
*/
- Dir getExitDir() {
+ int getExitDir() {
// The reason for this method name, as opposed to getLastStrongDir(), is that "last
// strong" sounds like the exact opposite of "first strong", which is a commonly used
// description of Unicode's estimation algorithm (getUnicodeDir() above), but the two
@@ -936,7 +912,7 @@ public final class BidiFormatter {
switch (dirTypeBackward()) {
case Character.DIRECTIONALITY_LEFT_TO_RIGHT:
if (embeddingLevel == 0) {
- return Dir.LTR;
+ return DIR_LTR;
}
if (lastNonEmptyEmbeddingLevel == 0) {
lastNonEmptyEmbeddingLevel = embeddingLevel;
@@ -945,14 +921,14 @@ public final class BidiFormatter {
case Character.DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING:
case Character.DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE:
if (lastNonEmptyEmbeddingLevel == embeddingLevel) {
- return Dir.LTR;
+ return DIR_LTR;
}
--embeddingLevel;
break;
case Character.DIRECTIONALITY_RIGHT_TO_LEFT:
case Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC:
if (embeddingLevel == 0) {
- return Dir.RTL;
+ return DIR_RTL;
}
if (lastNonEmptyEmbeddingLevel == 0) {
lastNonEmptyEmbeddingLevel = embeddingLevel;
@@ -961,7 +937,7 @@ public final class BidiFormatter {
case Character.DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING:
case Character.DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE:
if (lastNonEmptyEmbeddingLevel == embeddingLevel) {
- return Dir.RTL;
+ return DIR_RTL;
}
--embeddingLevel;
break;
@@ -977,7 +953,7 @@ public final class BidiFormatter {
break;
}
}
- return Dir.UNKNOWN;
+ return DIR_UNKNOWN;
}
// Internal methods
diff --git a/core/java/android/util/DisplayMetrics.java b/core/java/android/util/DisplayMetrics.java
index e856501e54bb..dae47b88c4e2 100644
--- a/core/java/android/util/DisplayMetrics.java
+++ b/core/java/android/util/DisplayMetrics.java
@@ -74,6 +74,15 @@ public class DisplayMetrics {
public static final int DENSITY_XXHIGH = 480;
/**
+ * Standard quantized DPI for extra-extra-extra-high-density screens. Applications
+ * should not generally worry about this density; relying on XHIGH graphics
+ * being scaled up to it should be sufficient for almost all cases. A typical
+ * use of this density would be 4K television screens -- 3840x2160, which
+ * is 2x a traditional HD 1920x1080 screen which runs at DENSITY_XHIGH.
+ */
+ public static final int DENSITY_XXXHIGH = 640;
+
+ /**
* The reference density used throughout the system.
*/
public static final int DENSITY_DEFAULT = DENSITY_MEDIUM;
diff --git a/core/java/android/view/GLES20Canvas.java b/core/java/android/view/GLES20Canvas.java
index 80c9324aae99..ec7c65ac65d9 100644
--- a/core/java/android/view/GLES20Canvas.java
+++ b/core/java/android/view/GLES20Canvas.java
@@ -1176,14 +1176,14 @@ class GLES20Canvas extends HardwareCanvas {
int modifiers = setupModifiers(paint);
try {
- nDrawText(mRenderer, text, index, count, x, y, paint.mBidiFlags, paint.mNativePaint);
+ nDrawText(mRenderer, text, index, count, x, y, paint.mNativePaint);
} finally {
if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
}
}
private static native void nDrawText(int renderer, char[] text, int index, int count,
- float x, float y, int bidiFlags, int paint);
+ float x, float y, int paint);
@Override
public void drawText(CharSequence text, int start, int end, float x, float y, Paint paint) {
@@ -1191,16 +1191,14 @@ class GLES20Canvas extends HardwareCanvas {
try {
if (text instanceof String || text instanceof SpannedString ||
text instanceof SpannableString) {
- nDrawText(mRenderer, text.toString(), start, end, x, y, paint.mBidiFlags,
- paint.mNativePaint);
+ nDrawText(mRenderer, text.toString(), start, end, x, y, paint.mNativePaint);
} else if (text instanceof GraphicsOperations) {
((GraphicsOperations) text).drawText(this, start, end, x, y,
paint);
} else {
char[] buf = TemporaryBuffer.obtain(end - start);
TextUtils.getChars(text, start, end, buf, 0);
- nDrawText(mRenderer, buf, 0, end - start, x, y,
- paint.mBidiFlags, paint.mNativePaint);
+ nDrawText(mRenderer, buf, 0, end - start, x, y, paint.mNativePaint);
TemporaryBuffer.recycle(buf);
}
} finally {
@@ -1216,21 +1214,20 @@ class GLES20Canvas extends HardwareCanvas {
int modifiers = setupModifiers(paint);
try {
- nDrawText(mRenderer, text, start, end, x, y, paint.mBidiFlags, paint.mNativePaint);
+ nDrawText(mRenderer, text, start, end, x, y, paint.mNativePaint);
} finally {
if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
}
}
private static native void nDrawText(int renderer, String text, int start, int end,
- float x, float y, int bidiFlags, int paint);
+ float x, float y, int paint);
@Override
public void drawText(String text, float x, float y, Paint paint) {
int modifiers = setupModifiers(paint);
try {
- nDrawText(mRenderer, text, 0, text.length(), x, y, paint.mBidiFlags,
- paint.mNativePaint);
+ nDrawText(mRenderer, text, 0, text.length(), x, y, paint.mNativePaint);
} finally {
if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
}
@@ -1246,14 +1243,14 @@ class GLES20Canvas extends HardwareCanvas {
int modifiers = setupModifiers(paint);
try {
nDrawTextOnPath(mRenderer, text, index, count, path.mNativePath, hOffset, vOffset,
- paint.mBidiFlags, paint.mNativePaint);
+ paint.mNativePaint);
} finally {
if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
}
}
private static native void nDrawTextOnPath(int renderer, char[] text, int index, int count,
- int path, float hOffset, float vOffset, int bidiFlags, int nativePaint);
+ int path, float hOffset, float vOffset, int nativePaint);
@Override
public void drawTextOnPath(String text, Path path, float hOffset, float vOffset, Paint paint) {
@@ -1262,28 +1259,25 @@ class GLES20Canvas extends HardwareCanvas {
int modifiers = setupModifiers(paint);
try {
nDrawTextOnPath(mRenderer, text, 0, text.length(), path.mNativePath, hOffset, vOffset,
- paint.mBidiFlags, paint.mNativePaint);
+ paint.mNativePaint);
} finally {
if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
}
}
private static native void nDrawTextOnPath(int renderer, String text, int start, int end,
- int path, float hOffset, float vOffset, int bidiFlags, int nativePaint);
+ int path, float hOffset, float vOffset, int nativePaint);
@Override
public void drawTextRun(char[] text, int index, int count, int contextIndex, int contextCount,
- float x, float y, int dir, Paint paint) {
+ float x, float y, Paint paint) {
if ((index | count | text.length - index - count) < 0) {
throw new IndexOutOfBoundsException();
}
- if (dir != DIRECTION_LTR && dir != DIRECTION_RTL) {
- throw new IllegalArgumentException("Unknown direction: " + dir);
- }
int modifiers = setupModifiers(paint);
try {
- nDrawTextRun(mRenderer, text, index, count, contextIndex, contextCount, x, y, dir,
+ nDrawTextRun(mRenderer, text, index, count, contextIndex, contextCount, x, y,
paint.mNativePaint);
} finally {
if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
@@ -1291,32 +1285,31 @@ class GLES20Canvas extends HardwareCanvas {
}
private static native void nDrawTextRun(int renderer, char[] text, int index, int count,
- int contextIndex, int contextCount, float x, float y, int dir, int nativePaint);
+ int contextIndex, int contextCount, float x, float y, int nativePaint);
@Override
public void drawTextRun(CharSequence text, int start, int end, int contextStart, int contextEnd,
- float x, float y, int dir, Paint paint) {
+ float x, float y, Paint paint) {
if ((start | end | end - start | text.length() - end) < 0) {
throw new IndexOutOfBoundsException();
}
int modifiers = setupModifiers(paint);
try {
- int flags = dir == 0 ? 0 : 1;
if (text instanceof String || text instanceof SpannedString ||
text instanceof SpannableString) {
nDrawTextRun(mRenderer, text.toString(), start, end, contextStart,
- contextEnd, x, y, flags, paint.mNativePaint);
+ contextEnd, x, y, paint.mNativePaint);
} else if (text instanceof GraphicsOperations) {
((GraphicsOperations) text).drawTextRun(this, start, end,
- contextStart, contextEnd, x, y, flags, paint);
+ contextStart, contextEnd, x, y, paint);
} else {
int contextLen = contextEnd - contextStart;
int len = end - start;
char[] buf = TemporaryBuffer.obtain(contextLen);
TextUtils.getChars(text, contextStart, contextEnd, buf, 0);
nDrawTextRun(mRenderer, buf, start - contextStart, len, 0, contextLen,
- x, y, flags, paint.mNativePaint);
+ x, y, paint.mNativePaint);
TemporaryBuffer.recycle(buf);
}
} finally {
@@ -1325,7 +1318,7 @@ class GLES20Canvas extends HardwareCanvas {
}
private static native void nDrawTextRun(int renderer, String text, int start, int end,
- int contextStart, int contextEnd, float x, float y, int flags, int nativePaint);
+ int contextStart, int contextEnd, float x, float y, int nativePaint);
@Override
public void drawVertices(VertexMode mode, int vertexCount, float[] verts, int vertOffset,
diff --git a/core/java/android/view/GLES20RecordingCanvas.java b/core/java/android/view/GLES20RecordingCanvas.java
index 7da245157949..947cf4413178 100644
--- a/core/java/android/view/GLES20RecordingCanvas.java
+++ b/core/java/android/view/GLES20RecordingCanvas.java
@@ -267,15 +267,15 @@ class GLES20RecordingCanvas extends GLES20Canvas {
@Override
public void drawTextRun(char[] text, int index, int count, int contextIndex, int contextCount,
- float x, float y, int dir, Paint paint) {
- super.drawTextRun(text, index, count, contextIndex, contextCount, x, y, dir, paint);
+ float x, float y, Paint paint) {
+ super.drawTextRun(text, index, count, contextIndex, contextCount, x, y, paint);
recordShaderBitmap(paint);
}
@Override
public void drawTextRun(CharSequence text, int start, int end, int contextStart,
- int contextEnd, float x, float y, int dir, Paint paint) {
- super.drawTextRun(text, start, end, contextStart, contextEnd, x, y, dir, paint);
+ int contextEnd, float x, float y, Paint paint) {
+ super.drawTextRun(text, start, end, contextStart, contextEnd, x, y, paint);
recordShaderBitmap(paint);
}
diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java
index e0d48a4dfa28..7c4bcfde5a53 100644
--- a/core/java/android/view/HardwareRenderer.java
+++ b/core/java/android/view/HardwareRenderer.java
@@ -48,7 +48,7 @@ import java.util.concurrent.locks.ReentrantLock;
import static javax.microedition.khronos.egl.EGL10.*;
/**
- * Interface for rendering a ViewAncestor using hardware acceleration.
+ * Interface for rendering a view hierarchy using hardware acceleration.
*
* @hide
*/
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index df8232b0fc32..25cad87a21e0 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -9929,8 +9929,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
outRect.set(mLeft, mTop, mRight, mBottom);
} else {
final RectF tmpRect = mAttachInfo.mTmpTransformRect;
- tmpRect.set(-info.mPivotX, -info.mPivotY,
- getWidth() - info.mPivotX, getHeight() - info.mPivotY);
+ tmpRect.set(0, 0, getWidth(), getHeight());
info.mMatrix.mapRect(tmpRect);
outRect.set((int) tmpRect.left + mLeft, (int) tmpRect.top + mTop,
(int) tmpRect.right + mLeft, (int) tmpRect.bottom + mTop);
diff --git a/core/java/android/widget/GridLayout.java b/core/java/android/widget/GridLayout.java
index 85ed8dbd4927..12cce8bdd412 100644
--- a/core/java/android/widget/GridLayout.java
+++ b/core/java/android/widget/GridLayout.java
@@ -1235,6 +1235,7 @@ public class GridLayout extends ViewGroup {
Assoc<Spec, Bounds> assoc = Assoc.of(Spec.class, Bounds.class);
for (int i = 0, N = getChildCount(); i < N; i++) {
View c = getChildAt(i);
+ if (c.getVisibility() == View.GONE) continue;
LayoutParams lp = getLayoutParams(c);
Spec spec = horizontal ? lp.columnSpec : lp.rowSpec;
Bounds bounds = getAlignment(spec.alignment, horizontal).getBounds();
@@ -1250,6 +1251,7 @@ public class GridLayout extends ViewGroup {
}
for (int i = 0, N = getChildCount(); i < N; i++) {
View c = getChildAt(i);
+ if (c.getVisibility() == View.GONE) continue;
LayoutParams lp = getLayoutParams(c);
Spec spec = horizontal ? lp.columnSpec : lp.rowSpec;
groupBounds.getValue(i).include(GridLayout.this, c, spec, this);
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 214541998931..cad7ae329530 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -8801,11 +8801,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
}
public void drawTextRun(Canvas c, int start, int end,
- int contextStart, int contextEnd, float x, float y, int flags, Paint p) {
+ int contextStart, int contextEnd, float x, float y, Paint p) {
int count = end - start;
int contextCount = contextEnd - contextStart;
c.drawTextRun(mChars, start + mStart, count, contextStart + mStart,
- contextCount, x, y, flags, p);
+ contextCount, x, y, p);
}
public float measureText(int start, int end, Paint p) {
@@ -8817,30 +8817,20 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
}
public float getTextRunAdvances(int start, int end, int contextStart,
- int contextEnd, int flags, float[] advances, int advancesIndex,
+ int contextEnd, float[] advances, int advancesIndex,
Paint p) {
int count = end - start;
int contextCount = contextEnd - contextStart;
return p.getTextRunAdvances(mChars, start + mStart, count,
- contextStart + mStart, contextCount, flags, advances,
+ contextStart + mStart, contextCount, advances,
advancesIndex);
}
- public float getTextRunAdvances(int start, int end, int contextStart,
- int contextEnd, int flags, float[] advances, int advancesIndex,
- Paint p, int reserved) {
- int count = end - start;
- int contextCount = contextEnd - contextStart;
- return p.getTextRunAdvances(mChars, start + mStart, count,
- contextStart + mStart, contextCount, flags, advances,
- advancesIndex, reserved);
- }
-
- public int getTextRunCursor(int contextStart, int contextEnd, int flags,
+ public int getTextRunCursor(int contextStart, int contextEnd,
int offset, int cursorOpt, Paint p) {
int contextCount = contextEnd - contextStart;
return p.getTextRunCursor(mChars, contextStart + mStart,
- contextCount, flags, offset + mStart, cursorOpt);
+ contextCount, offset + mStart, cursorOpt);
}
}
diff --git a/core/jni/android/graphics/Canvas.cpp b/core/jni/android/graphics/Canvas.cpp
index 7208c570f391..1f1f28f26ca9 100644
--- a/core/jni/android/graphics/Canvas.cpp
+++ b/core/jni/android/graphics/Canvas.cpp
@@ -727,35 +727,35 @@ public:
static void drawText___CIIFFIPaint(JNIEnv* env, jobject, SkCanvas* canvas,
jcharArray text, int index, int count,
- jfloat x, jfloat y, int flags, SkPaint* paint) {
+ jfloat x, jfloat y, SkPaint* paint) {
jchar* textArray = env->GetCharArrayElements(text, NULL);
- drawTextWithGlyphs(canvas, textArray + index, 0, count, x, y, flags, paint);
+ drawTextWithGlyphs(canvas, textArray + index, 0, count, x, y, paint);
env->ReleaseCharArrayElements(text, textArray, JNI_ABORT);
}
static void drawText__StringIIFFIPaint(JNIEnv* env, jobject,
SkCanvas* canvas, jstring text,
int start, int end,
- jfloat x, jfloat y, int flags, SkPaint* paint) {
+ jfloat x, jfloat y, SkPaint* paint) {
const jchar* textArray = env->GetStringChars(text, NULL);
- drawTextWithGlyphs(canvas, textArray, start, end, x, y, flags, paint);
+ drawTextWithGlyphs(canvas, textArray, start, end, x, y, paint);
env->ReleaseStringChars(text, textArray);
}
static void drawTextWithGlyphs(SkCanvas* canvas, const jchar* textArray,
int start, int end,
- jfloat x, jfloat y, int flags, SkPaint* paint) {
+ jfloat x, jfloat y, SkPaint* paint) {
jint count = end - start;
- drawTextWithGlyphs(canvas, textArray + start, 0, count, count, x, y, flags, paint);
+ drawTextWithGlyphs(canvas, textArray + start, 0, count, count, x, y, paint);
}
static void drawTextWithGlyphs(SkCanvas* canvas, const jchar* textArray,
int start, int count, int contextCount,
- jfloat x, jfloat y, int flags, SkPaint* paint) {
+ jfloat x, jfloat y, SkPaint* paint) {
sp<TextLayoutValue> value = TextLayoutEngine::getInstance().getValue(paint,
- textArray, start, count, contextCount, flags);
+ textArray, start, count, contextCount);
if (value == NULL) {
return;
}
@@ -766,7 +766,7 @@ public:
x -= value->getTotalAdvance();
}
paint->setTextAlign(SkPaint::kLeft_Align);
- doDrawGlyphsPos(canvas, value->getGlyphs(), value->getPos(), 0, value->getGlyphsCount(), x, y, flags, paint);
+ doDrawGlyphsPos(canvas, value->getGlyphs(), value->getPos(), 0, value->getGlyphsCount(), x, y, paint);
doDrawTextDecorations(canvas, x, y, value->getTotalAdvance(), paint);
paint->setTextAlign(align);
}
@@ -808,14 +808,8 @@ static void doDrawTextDecorations(SkCanvas* canvas, jfloat x, jfloat y, jfloat l
}
}
- static void doDrawGlyphs(SkCanvas* canvas, const jchar* glyphArray, int index, int count,
- jfloat x, jfloat y, int flags, SkPaint* paint) {
- // Beware: this needs Glyph encoding (already done on the Paint constructor)
- canvas->drawText(glyphArray + index * 2, count * 2, x, y, *paint);
- }
-
static void doDrawGlyphsPos(SkCanvas* canvas, const jchar* glyphArray, const jfloat* posArray,
- int index, int count, jfloat x, jfloat y, int flags, SkPaint* paint) {
+ int index, int count, jfloat x, jfloat y, SkPaint* paint) {
SkPoint* posPtr = new SkPoint[count];
for (int indx = 0; indx < count; indx++) {
posPtr[indx].fX = SkFloatToScalar(x + posArray[indx * 2]);
@@ -832,7 +826,7 @@ static void doDrawTextDecorations(SkCanvas* canvas, jfloat x, jfloat y, jfloat l
jchar* chars = env->GetCharArrayElements(text, NULL);
drawTextWithGlyphs(canvas, chars + contextIndex, index - contextIndex,
- count, contextCount, x, y, dirFlags, paint);
+ count, contextCount, x, y, paint);
env->ReleaseCharArrayElements(text, chars, JNI_ABORT);
}
@@ -845,7 +839,7 @@ static void doDrawTextDecorations(SkCanvas* canvas, jfloat x, jfloat y, jfloat l
jint contextCount = contextEnd - contextStart;
const jchar* chars = env->GetStringChars(text, NULL);
drawTextWithGlyphs(canvas, chars + contextStart, start - contextStart,
- count, contextCount, x, y, dirFlags, paint);
+ count, contextCount, x, y, paint);
env->ReleaseStringChars(text, chars);
}
@@ -908,21 +902,19 @@ static void doDrawTextDecorations(SkCanvas* canvas, jfloat x, jfloat y, jfloat l
static void drawTextOnPath___CIIPathFFPaint(JNIEnv* env, jobject,
SkCanvas* canvas, jcharArray text, int index, int count,
- SkPath* path, jfloat hOffset, jfloat vOffset, jint bidiFlags, SkPaint* paint) {
+ SkPath* path, jfloat hOffset, jfloat vOffset, SkPaint* paint) {
jchar* textArray = env->GetCharArrayElements(text, NULL);
- TextLayout::drawTextOnPath(paint, textArray + index, count, bidiFlags, hOffset, vOffset,
- path, canvas);
+ TextLayout::drawTextOnPath(paint, textArray + index, count, hOffset, vOffset, path, canvas);
env->ReleaseCharArrayElements(text, textArray, 0);
}
static void drawTextOnPath__StringPathFFPaint(JNIEnv* env, jobject,
SkCanvas* canvas, jstring text, SkPath* path,
- jfloat hOffset, jfloat vOffset, jint bidiFlags, SkPaint* paint) {
+ jfloat hOffset, jfloat vOffset, SkPaint* paint) {
const jchar* text_ = env->GetStringChars(text, NULL);
int count = env->GetStringLength(text);
- TextLayout::drawTextOnPath(paint, text_, count, bidiFlags, hOffset, vOffset,
- path, canvas);
+ TextLayout::drawTextOnPath(paint, text_, count, hOffset, vOffset, path, canvas);
env->ReleaseStringChars(text, text_);
}
@@ -1031,21 +1023,21 @@ static JNINativeMethod gCanvasMethods[] = {
(void*)SkCanvasGlue::drawBitmapMesh},
{"nativeDrawVertices", "(III[FI[FI[II[SIII)V",
(void*)SkCanvasGlue::drawVertices},
- {"native_drawText","(I[CIIFFII)V",
+ {"native_drawText","(I[CIIFFI)V",
(void*) SkCanvasGlue::drawText___CIIFFIPaint},
- {"native_drawText","(ILjava/lang/String;IIFFII)V",
+ {"native_drawText","(ILjava/lang/String;IIFFI)V",
(void*) SkCanvasGlue::drawText__StringIIFFIPaint},
- {"native_drawTextRun","(I[CIIIIFFII)V",
+ {"native_drawTextRun","(I[CIIIIFFI)V",
(void*) SkCanvasGlue::drawTextRun___CIIIIFFIPaint},
- {"native_drawTextRun","(ILjava/lang/String;IIIIFFII)V",
+ {"native_drawTextRun","(ILjava/lang/String;IIIIFFI)V",
(void*) SkCanvasGlue::drawTextRun__StringIIIIFFIPaint},
{"native_drawPosText","(I[CII[FI)V",
(void*) SkCanvasGlue::drawPosText___CII_FPaint},
{"native_drawPosText","(ILjava/lang/String;[FI)V",
(void*) SkCanvasGlue::drawPosText__String_FPaint},
- {"native_drawTextOnPath","(I[CIIIFFII)V",
+ {"native_drawTextOnPath","(I[CIIIFFI)V",
(void*) SkCanvasGlue::drawTextOnPath___CIIPathFFPaint},
- {"native_drawTextOnPath","(ILjava/lang/String;IFFII)V",
+ {"native_drawTextOnPath","(ILjava/lang/String;IFFI)V",
(void*) SkCanvasGlue::drawTextOnPath__StringPathFFPaint},
{"native_drawPicture", "(II)V", (void*) SkCanvasGlue::drawPicture},
diff --git a/core/jni/android/graphics/Paint.cpp b/core/jni/android/graphics/Paint.cpp
index 29a36de50288..e8304923230f 100644
--- a/core/jni/android/graphics/Paint.cpp
+++ b/core/jni/android/graphics/Paint.cpp
@@ -401,7 +401,7 @@ public:
jfloat result = 0;
TextLayout::getTextRunAdvances(paint, textArray, index, count, textLength,
- paint->getFlags(), NULL /* dont need all advances */, &result);
+ NULL /* dont need all advances */, &result);
env->ReleaseCharArrayElements(text, const_cast<jchar*>(textArray), JNI_ABORT);
return result;
@@ -426,7 +426,7 @@ public:
jfloat width = 0;
TextLayout::getTextRunAdvances(paint, textArray, start, count, textLength,
- paint->getFlags(), NULL /* dont need all advances */, &width);
+ NULL /* dont need all advances */, &width);
env->ReleaseStringChars(text, textArray);
return width;
@@ -446,7 +446,7 @@ public:
jfloat width = 0;
TextLayout::getTextRunAdvances(paint, textArray, 0, textLength, textLength,
- paint->getFlags(), NULL /* dont need all advances */, &width);
+ NULL /* dont need all advances */, &width);
env->ReleaseStringChars(text, textArray);
return width;
@@ -473,7 +473,7 @@ public:
jfloat* widthsArray = autoWidths.ptr();
TextLayout::getTextRunAdvances(paint, text, 0, count, count,
- paint->getFlags(), widthsArray, NULL /* dont need totalAdvance */);
+ widthsArray, NULL /* dont need totalAdvance */);
return count;
}
@@ -494,48 +494,8 @@ public:
return count;
}
- static int doTextGlyphs(JNIEnv* env, SkPaint* paint, const jchar* text, jint start, jint count,
- jint contextCount, jint flags, jcharArray glyphs) {
- NPE_CHECK_RETURN_ZERO(env, paint);
- NPE_CHECK_RETURN_ZERO(env, text);
-
- if ((start | count | contextCount) < 0 || contextCount < count || !glyphs) {
- doThrowAIOOBE(env);
- return 0;
- }
- if (count == 0) {
- return 0;
- }
- size_t glypthsLength = env->GetArrayLength(glyphs);
- if ((size_t)count > glypthsLength) {
- doThrowAIOOBE(env);
- return 0;
- }
-
- jchar* glyphsArray = env->GetCharArrayElements(glyphs, NULL);
-
- sp<TextLayoutValue> value = TextLayoutEngine::getInstance().getValue(paint,
- text, start, count, contextCount, flags);
- const jchar* shapedGlyphs = value->getGlyphs();
- size_t glyphsCount = value->getGlyphsCount();
- memcpy(glyphsArray, shapedGlyphs, sizeof(jchar) * glyphsCount);
-
- env->ReleaseCharArrayElements(glyphs, glyphsArray, JNI_ABORT);
- return glyphsCount;
- }
-
- static int getTextGlyphs__StringIIIII_C(JNIEnv* env, jobject clazz, SkPaint* paint,
- jstring text, jint start, jint end, jint contextStart, jint contextEnd, jint flags,
- jcharArray glyphs) {
- const jchar* textArray = env->GetStringChars(text, NULL);
- int count = doTextGlyphs(env, paint, textArray + contextStart, start - contextStart,
- end - start, contextEnd - contextStart, flags, glyphs);
- env->ReleaseStringChars(text, textArray);
- return count;
- }
-
static jfloat doTextRunAdvances(JNIEnv *env, SkPaint *paint, const jchar *text,
- jint start, jint count, jint contextCount, jint flags,
+ jint start, jint count, jint contextCount,
jfloatArray advances, jint advancesIndex) {
NPE_CHECK_RETURN_ZERO(env, paint);
NPE_CHECK_RETURN_ZERO(env, text);
@@ -557,7 +517,7 @@ public:
jfloat advancesArray[count];
jfloat totalAdvance = 0;
- TextLayout::getTextRunAdvances(paint, text, start, count, contextCount, flags,
+ TextLayout::getTextRunAdvances(paint, text, start, count, contextCount,
advancesArray, &totalAdvance);
if (advances != NULL) {
@@ -566,61 +526,23 @@ public:
return totalAdvance;
}
- static jfloat doTextRunAdvancesICU(JNIEnv *env, SkPaint *paint, const jchar *text,
- jint start, jint count, jint contextCount, jint flags,
- jfloatArray advances, jint advancesIndex) {
- NPE_CHECK_RETURN_ZERO(env, paint);
- NPE_CHECK_RETURN_ZERO(env, text);
-
- if ((start | count | contextCount | advancesIndex) < 0 || contextCount < count) {
- doThrowAIOOBE(env);
- return 0;
- }
- if (count == 0) {
- return 0;
- }
- if (advances) {
- size_t advancesLength = env->GetArrayLength(advances);
- if ((size_t)count > advancesLength) {
- doThrowAIOOBE(env);
- return 0;
- }
- }
-
- jfloat advancesArray[count];
- jfloat totalAdvance = 0;
-
- TextLayout::getTextRunAdvancesICU(paint, text, start, count, contextCount, flags,
- advancesArray, totalAdvance);
-
- if (advances != NULL) {
- env->SetFloatArrayRegion(advances, advancesIndex, count, advancesArray);
- }
- return totalAdvance;
- }
-
- static float getTextRunAdvances___CIIIII_FII(JNIEnv* env, jobject clazz, SkPaint* paint,
+ static float getTextRunAdvances___CIIII_FI(JNIEnv* env, jobject clazz, SkPaint* paint,
jcharArray text, jint index, jint count, jint contextIndex, jint contextCount,
- jint flags, jfloatArray advances, jint advancesIndex, jint reserved) {
+ jfloatArray advances, jint advancesIndex) {
jchar* textArray = env->GetCharArrayElements(text, NULL);
- jfloat result = (reserved == 0) ?
- doTextRunAdvances(env, paint, textArray + contextIndex, index - contextIndex,
- count, contextCount, flags, advances, advancesIndex) :
- doTextRunAdvancesICU(env, paint, textArray + contextIndex, index - contextIndex,
- count, contextCount, flags, advances, advancesIndex);
+ jfloat result = doTextRunAdvances(env, paint, textArray + contextIndex,
+ index - contextIndex, count, contextCount, advances, advancesIndex);
env->ReleaseCharArrayElements(text, textArray, JNI_ABORT);
return result;
}
- static float getTextRunAdvances__StringIIIII_FII(JNIEnv* env, jobject clazz, SkPaint* paint,
- jstring text, jint start, jint end, jint contextStart, jint contextEnd, jint flags,
- jfloatArray advances, jint advancesIndex, jint reserved) {
+ static float getTextRunAdvances__StringIIII_FI(JNIEnv* env, jobject clazz, SkPaint* paint,
+ jstring text, jint start, jint end, jint contextStart, jint contextEnd,
+ jfloatArray advances, jint advancesIndex) {
const jchar* textArray = env->GetStringChars(text, NULL);
- jfloat result = (reserved == 0) ?
- doTextRunAdvances(env, paint, textArray + contextStart, start - contextStart,
- end - start, contextEnd - contextStart, flags, advances, advancesIndex) :
- doTextRunAdvancesICU(env, paint, textArray + contextStart, start - contextStart,
- end - start, contextEnd - contextStart, flags, advances, advancesIndex);
+ jfloat result = doTextRunAdvances(env, paint, textArray + contextStart,
+ start - contextStart, end - start, contextEnd - contextStart,
+ advances, advancesIndex);
env->ReleaseStringChars(text, textArray);
return result;
}
@@ -629,7 +551,7 @@ public:
jint count, jint flags, jint offset, jint opt) {
jfloat scalarArray[count];
- TextLayout::getTextRunAdvances(paint, text, start, count, start + count, flags,
+ TextLayout::getTextRunAdvances(paint, text, start, count, start + count,
scalarArray, NULL /* dont need totalAdvance */);
jint pos = offset - start;
@@ -688,21 +610,21 @@ public:
}
static void getTextPath(JNIEnv* env, SkPaint* paint, const jchar* text, jint count,
- jint bidiFlags, jfloat x, jfloat y, SkPath *path) {
- TextLayout::getTextPath(paint, text, count, bidiFlags, x, y, path);
+ jfloat x, jfloat y, SkPath *path) {
+ TextLayout::getTextPath(paint, text, count, x, y, path);
}
- static void getTextPath___C(JNIEnv* env, jobject clazz, SkPaint* paint, jint bidiFlags,
+ static void getTextPath___C(JNIEnv* env, jobject clazz, SkPaint* paint,
jcharArray text, int index, int count, jfloat x, jfloat y, SkPath* path) {
const jchar* textArray = env->GetCharArrayElements(text, NULL);
- getTextPath(env, paint, textArray + index, count, bidiFlags, x, y, path);
+ getTextPath(env, paint, textArray + index, count, x, y, path);
env->ReleaseCharArrayElements(text, const_cast<jchar*>(textArray), JNI_ABORT);
}
- static void getTextPath__String(JNIEnv* env, jobject clazz, SkPaint* paint, jint bidiFlags,
+ static void getTextPath__String(JNIEnv* env, jobject clazz, SkPaint* paint,
jstring text, int start, int end, jfloat x, jfloat y, SkPath* path) {
const jchar* textArray = env->GetStringChars(text, NULL);
- getTextPath(env, paint, textArray + start, end - start, bidiFlags, x, y, path);
+ getTextPath(env, paint, textArray + start, end - start, x, y, path);
env->ReleaseStringChars(text, textArray);
}
@@ -726,7 +648,7 @@ public:
int count, float maxWidth, jfloatArray jmeasured,
SkPaint::TextBufferDirection tbd) {
sp<TextLayoutValue> value = TextLayoutEngine::getInstance().getValue(&paint,
- text, 0, count, count, paint.getFlags());
+ text, 0, count, count);
if (value == NULL) {
return 0;
}
@@ -798,7 +720,7 @@ public:
SkIRect ir;
sp<TextLayoutValue> value = TextLayoutEngine::getInstance().getValue(&paint,
- text, 0, count, count, paint.getFlags());
+ text, 0, count, count);
if (value == NULL) {
return;
}
@@ -886,19 +808,15 @@ static JNINativeMethod methods[] = {
{"native_breakText","(Ljava/lang/String;ZF[F)I", (void*) SkPaintGlue::breakTextS},
{"native_getTextWidths","(I[CII[F)I", (void*) SkPaintGlue::getTextWidths___CII_F},
{"native_getTextWidths","(ILjava/lang/String;II[F)I", (void*) SkPaintGlue::getTextWidths__StringII_F},
- {"native_getTextRunAdvances","(I[CIIIII[FII)F",
- (void*) SkPaintGlue::getTextRunAdvances___CIIIII_FII},
- {"native_getTextRunAdvances","(ILjava/lang/String;IIIII[FII)F",
- (void*) SkPaintGlue::getTextRunAdvances__StringIIIII_FII},
-
-
- {"native_getTextGlyphs","(ILjava/lang/String;IIIII[C)I",
- (void*) SkPaintGlue::getTextGlyphs__StringIIIII_C},
- {"native_getTextRunCursor", "(I[CIIIII)I", (void*) SkPaintGlue::getTextRunCursor___C},
- {"native_getTextRunCursor", "(ILjava/lang/String;IIIII)I",
+ {"native_getTextRunAdvances","(I[CIIII[FI)F",
+ (void*) SkPaintGlue::getTextRunAdvances___CIIII_FI},
+ {"native_getTextRunAdvances","(ILjava/lang/String;IIII[FI)F",
+ (void*) SkPaintGlue::getTextRunAdvances__StringIIII_FI},
+ {"native_getTextRunCursor", "(I[CIIII)I", (void*) SkPaintGlue::getTextRunCursor___C},
+ {"native_getTextRunCursor", "(ILjava/lang/String;IIII)I",
(void*) SkPaintGlue::getTextRunCursor__String},
- {"native_getTextPath","(II[CIIFFI)V", (void*) SkPaintGlue::getTextPath___C},
- {"native_getTextPath","(IILjava/lang/String;IIFFI)V", (void*) SkPaintGlue::getTextPath__String},
+ {"native_getTextPath","(I[CIIFFI)V", (void*) SkPaintGlue::getTextPath___C},
+ {"native_getTextPath","(ILjava/lang/String;IIFFI)V", (void*) SkPaintGlue::getTextPath__String},
{"nativeGetStringBounds", "(ILjava/lang/String;IILandroid/graphics/Rect;)V",
(void*) SkPaintGlue::getStringBounds },
{"nativeGetCharArrayBounds", "(I[CIILandroid/graphics/Rect;)V",
diff --git a/core/jni/android/graphics/TextLayout.cpp b/core/jni/android/graphics/TextLayout.cpp
index 2beedada409f..b77236c57262 100644
--- a/core/jni/android/graphics/TextLayout.cpp
+++ b/core/jni/android/graphics/TextLayout.cpp
@@ -28,33 +28,13 @@
namespace android {
-// Returns true if we might need layout. If bidiFlags force LTR, assume no layout, if
-// bidiFlags indicate there probably is RTL, assume we do, otherwise scan the text
-// looking for a character >= the first RTL character in unicode and assume we do if
-// we find one.
-bool TextLayout::needsLayout(const jchar* text, jint len, jint bidiFlags) {
- if (bidiFlags == kBidi_Force_LTR) {
- return false;
- }
- if ((bidiFlags == kBidi_RTL) || (bidiFlags == kBidi_Default_RTL) ||
- bidiFlags == kBidi_Force_RTL) {
- return true;
- }
- for (int i = 0; i < len; ++i) {
- if (text[i] >= UNICODE_FIRST_RTL_CHAR) {
- return true;
- }
- }
- return false;
-}
-
// Draws or gets the path of a paragraph of text on a single line, running bidi and shaping.
// This will draw if canvas is not null, otherwise path must be non-null and it will create
// a path representing the text that would have been drawn.
void TextLayout::handleText(SkPaint *paint, const jchar* text, jsize len,
- jint bidiFlags, jfloat x, jfloat y, SkPath *path) {
+ jfloat x, jfloat y, SkPath *path) {
sp<TextLayoutValue> value = TextLayoutEngine::getInstance().getValue(paint,
- text, 0, len, len, bidiFlags);
+ text, 0, len, len);
if (value == NULL) {
return ;
}
@@ -65,10 +45,10 @@ void TextLayout::handleText(SkPaint *paint, const jchar* text, jsize len,
}
void TextLayout::getTextRunAdvances(SkPaint* paint, const jchar* chars, jint start,
- jint count, jint contextCount, jint dirFlags,
+ jint count, jint contextCount,
jfloat* resultAdvances, jfloat* resultTotalAdvance) {
sp<TextLayoutValue> value = TextLayoutEngine::getInstance().getValue(paint,
- chars, start, count, contextCount, dirFlags);
+ chars, start, count, contextCount);
if (value == NULL) {
return ;
}
@@ -80,29 +60,20 @@ void TextLayout::getTextRunAdvances(SkPaint* paint, const jchar* chars, jint sta
}
}
-void TextLayout::getTextRunAdvancesICU(SkPaint* paint, const jchar* chars, jint start,
- jint count, jint contextCount, jint dirFlags,
- jfloat* resultAdvances, jfloat& resultTotalAdvance) {
- // Compute advances and return them
- computeAdvancesWithICU(paint, chars, start, count, contextCount, dirFlags,
- resultAdvances, &resultTotalAdvance);
-}
-
void TextLayout::getTextPath(SkPaint *paint, const jchar *text, jsize len,
- jint bidiFlags, jfloat x, jfloat y, SkPath *path) {
- handleText(paint, text, len, bidiFlags, x, y, path);
+ jfloat x, jfloat y, SkPath *path) {
+ handleText(paint, text, len, x, y, path);
}
-
void TextLayout::drawTextOnPath(SkPaint* paint, const jchar* text, int count,
- int bidiFlags, jfloat hOffset, jfloat vOffset,
+ jfloat hOffset, jfloat vOffset,
SkPath* path, SkCanvas* canvas) {
SkScalar h_ = SkFloatToScalar(hOffset);
SkScalar v_ = SkFloatToScalar(vOffset);
sp<TextLayoutValue> value = TextLayoutEngine::getInstance().getValue(paint,
- text, 0, count, count, bidiFlags);
+ text, 0, count, count);
if (value == NULL) {
return;
}
@@ -111,73 +82,4 @@ void TextLayout::drawTextOnPath(SkPaint* paint, const jchar* text, int count,
canvas->drawTextOnPathHV(value->getGlyphs(), value->getGlyphsCount() * 2, *path, h_, v_, *paint);
}
-void TextLayout::computeAdvancesWithICU(SkPaint* paint, const UChar* chars,
- size_t start, size_t count, size_t contextCount, int dirFlags,
- jfloat* outAdvances, jfloat* outTotalAdvance) {
- SkAutoSTMalloc<CHAR_BUFFER_SIZE, jchar> tempBuffer(contextCount);
- jchar* buffer = tempBuffer.get();
- SkScalar* scalarArray = (SkScalar*)outAdvances;
-
- // this is where we'd call harfbuzz
- // for now we just use ushape.c
- size_t widths;
- const jchar* text;
- if (dirFlags & 0x1) { // rtl, call arabic shaping in case
- UErrorCode status = U_ZERO_ERROR;
- // Use fixed length since we need to keep start and count valid
- u_shapeArabic(chars, contextCount, buffer, contextCount,
- U_SHAPE_LENGTH_FIXED_SPACES_NEAR |
- U_SHAPE_TEXT_DIRECTION_LOGICAL | U_SHAPE_LETTERS_SHAPE |
- U_SHAPE_X_LAMALEF_SUB_ALTERNATE, &status);
- // we shouldn't fail unless there's an out of memory condition,
- // in which case we're hosed anyway
- for (int i = start, e = i + count; i < e; ++i) {
- if (buffer[i] == UNICODE_NOT_A_CHAR) {
- buffer[i] = UNICODE_ZWSP; // zero-width-space for skia
- }
- }
- text = buffer + start;
- widths = paint->getTextWidths(text, count << 1, scalarArray);
- } else {
- text = chars + start;
- widths = paint->getTextWidths(text, count << 1, scalarArray);
- }
-
- jfloat totalAdvance = 0;
- if (widths < count) {
-#if DEBUG_ADVANCES
- ALOGD("ICU -- count=%d", widths);
-#endif
- // Skia operates on code points, not code units, so surrogate pairs return only
- // one value. Expand the result so we have one value per UTF-16 code unit.
-
- // Note, skia's getTextWidth gets confused if it encounters a surrogate pair,
- // leaving the remaining widths zero. Not nice.
- for (size_t i = 0, p = 0; i < widths; ++i) {
- totalAdvance += outAdvances[p++] = SkScalarToFloat(scalarArray[i]);
- if (p < count &&
- text[p] >= UNICODE_FIRST_LOW_SURROGATE &&
- text[p] < UNICODE_FIRST_PRIVATE_USE &&
- text[p-1] >= UNICODE_FIRST_HIGH_SURROGATE &&
- text[p-1] < UNICODE_FIRST_LOW_SURROGATE) {
- outAdvances[p++] = 0;
- }
-#if DEBUG_ADVANCES
- ALOGD("icu-adv = %f - total = %f", outAdvances[i], totalAdvance);
-#endif
- }
- } else {
-#if DEBUG_ADVANCES
- ALOGD("ICU -- count=%d", count);
-#endif
- for (size_t i = 0; i < count; i++) {
- totalAdvance += outAdvances[i] = SkScalarToFloat(scalarArray[i]);
-#if DEBUG_ADVANCES
- ALOGD("icu-adv = %f - total = %f", outAdvances[i], totalAdvance);
-#endif
- }
- }
- *outTotalAdvance = totalAdvance;
-}
-
}
diff --git a/core/jni/android/graphics/TextLayout.h b/core/jni/android/graphics/TextLayout.h
index a0f94024fcf8..fa388c8ed74f 100644
--- a/core/jni/android/graphics/TextLayout.h
+++ b/core/jni/android/graphics/TextLayout.h
@@ -42,17 +42,6 @@ namespace android {
#define USE_TEXT_LAYOUT_CACHE 1
enum {
- kBidi_LTR = 0,
- kBidi_RTL = 1,
- kBidi_Default_LTR = 2,
- kBidi_Default_RTL = 3,
- kBidi_Force_LTR = 4,
- kBidi_Force_RTL = 5,
-
- kBidi_Mask = 0x7
-};
-
-enum {
kDirection_LTR = 0,
kDirection_RTL = 1,
@@ -63,28 +52,18 @@ class TextLayout {
public:
static void getTextRunAdvances(SkPaint* paint, const jchar* chars, jint start,
- jint count, jint contextCount, jint dirFlags,
+ jint count, jint contextCount,
jfloat* resultAdvances, jfloat* resultTotalAdvance);
- static void getTextRunAdvancesICU(SkPaint* paint, const jchar* chars, jint start,
- jint count, jint contextCount, jint dirFlags,
- jfloat* resultAdvances, jfloat& resultTotalAdvance);
-
static void getTextPath(SkPaint* paint, const jchar* text, jsize len,
- jint bidiFlags, jfloat x, jfloat y, SkPath* path);
+ jfloat x, jfloat y, SkPath* path);
static void drawTextOnPath(SkPaint* paint, const jchar* text, jsize len,
- int bidiFlags, jfloat hOffset, jfloat vOffset,
+ jfloat hOffset, jfloat vOffset,
SkPath* path, SkCanvas* canvas);
private:
- static bool needsLayout(const jchar* text, jint len, jint bidiFlags);
-
static void handleText(SkPaint* paint, const jchar* text, jsize len,
- int bidiFlags, jfloat x, jfloat y, SkPath* path);
-
- static void computeAdvancesWithICU(SkPaint* paint, const UChar* chars,
- size_t start, size_t count, size_t contextCount, int dirFlags,
- jfloat* outAdvances, jfloat* outTotalAdvance);
+ jfloat x, jfloat y, SkPath* path);
};
} // namespace android
diff --git a/core/jni/android/graphics/TextLayoutCache.cpp b/core/jni/android/graphics/TextLayoutCache.cpp
index 75446459665e..1a8612e6aa11 100644
--- a/core/jni/android/graphics/TextLayoutCache.cpp
+++ b/core/jni/android/graphics/TextLayoutCache.cpp
@@ -87,7 +87,7 @@ void TextLayoutCache::purgeCaches() {
* Caching
*/
sp<TextLayoutValue> TextLayoutCache::getValue(const SkPaint* paint,
- const jchar* text, jint start, jint count, jint contextCount, jint dirFlags) {
+ const jchar* text, jint start, jint count, jint contextCount) {
AutoMutex _l(mLock);
nsecs_t startTime = 0;
if (mDebugEnabled) {
@@ -95,7 +95,7 @@ sp<TextLayoutValue> TextLayoutCache::getValue(const SkPaint* paint,
}
// Create the key
- TextLayoutCacheKey key(paint, text, start, count, contextCount, dirFlags);
+ TextLayoutCacheKey key(paint, text, start, count, contextCount);
// Get value from cache if possible
sp<TextLayoutValue> value = mCache.get(key);
@@ -111,7 +111,7 @@ sp<TextLayoutValue> TextLayoutCache::getValue(const SkPaint* paint,
// Compute advances and store them
mShaper->computeValues(value.get(), paint,
reinterpret_cast<const UChar*>(key.getText()), start, count,
- size_t(contextCount), int(dirFlags));
+ size_t(contextCount));
if (mDebugEnabled) {
value->setElapsedTime(systemTime(SYSTEM_TIME_MONOTONIC) - startTime);
@@ -218,14 +218,13 @@ void TextLayoutCache::dumpCacheStats() {
* TextLayoutCacheKey
*/
TextLayoutCacheKey::TextLayoutCacheKey(): start(0), count(0), contextCount(0),
- dirFlags(0), typeface(NULL), textSize(0), textSkewX(0), textScaleX(0), flags(0),
+ typeface(NULL), textSize(0), textSkewX(0), textScaleX(0), flags(0),
hinting(SkPaint::kNo_Hinting), variant(SkPaint::kDefault_Variant), language() {
}
TextLayoutCacheKey::TextLayoutCacheKey(const SkPaint* paint, const UChar* text,
- size_t start, size_t count, size_t contextCount, int dirFlags) :
- start(start), count(count), contextCount(contextCount),
- dirFlags(dirFlags) {
+ size_t start, size_t count, size_t contextCount) :
+ start(start), count(count), contextCount(contextCount) {
textCopy.setTo(text, contextCount);
typeface = paint->getTypeface();
textSize = paint->getTextSize();
@@ -242,7 +241,6 @@ TextLayoutCacheKey::TextLayoutCacheKey(const TextLayoutCacheKey& other) :
start(other.start),
count(other.count),
contextCount(other.contextCount),
- dirFlags(other.dirFlags),
typeface(other.typeface),
textSize(other.textSize),
textSkewX(other.textSkewX),
@@ -281,9 +279,6 @@ int TextLayoutCacheKey::compare(const TextLayoutCacheKey& lhs, const TextLayoutC
deltaInt = lhs.hinting - rhs.hinting;
if (deltaInt != 0) return (deltaInt);
- deltaInt = lhs.dirFlags - rhs.dirFlags;
- if (deltaInt) return (deltaInt);
-
deltaInt = lhs.variant - rhs.variant;
if (deltaInt) return (deltaInt);
@@ -359,9 +354,9 @@ TextLayoutShaper::~TextLayoutShaper() {
}
void TextLayoutShaper::computeValues(TextLayoutValue* value, const SkPaint* paint, const UChar* chars,
- size_t start, size_t count, size_t contextCount, int dirFlags) {
+ size_t start, size_t count, size_t contextCount) {
- computeValues(paint, chars, start, count, contextCount, dirFlags,
+ computeValues(paint, chars, start, count, contextCount,
&value->mAdvances, &value->mTotalAdvance, &value->mGlyphs, &value->mPos);
#if DEBUG_ADVANCES
ALOGD("Advances - start = %d, count = %d, contextCount = %d, totalAdvance = %f", start, count,
@@ -370,7 +365,7 @@ void TextLayoutShaper::computeValues(TextLayoutValue* value, const SkPaint* pain
}
void TextLayoutShaper::computeValues(const SkPaint* paint, const UChar* chars,
- size_t start, size_t count, size_t contextCount, int dirFlags,
+ size_t start, size_t count, size_t contextCount,
Vector<jfloat>* const outAdvances, jfloat* outTotalAdvance,
Vector<jchar>* const outGlyphs, Vector<jfloat>* const outPos) {
*outTotalAdvance = 0;
@@ -378,110 +373,94 @@ void TextLayoutShaper::computeValues(const SkPaint* paint, const UChar* chars,
return;
}
- UBiDiLevel bidiReq = 0;
- bool forceLTR = false;
- bool forceRTL = false;
-
- switch (dirFlags & kBidi_Mask) {
- case kBidi_LTR: bidiReq = 0; break; // no ICU constant, canonical LTR level
- case kBidi_RTL: bidiReq = 1; break; // no ICU constant, canonical RTL level
- case kBidi_Default_LTR: bidiReq = UBIDI_DEFAULT_LTR; break;
- case kBidi_Default_RTL: bidiReq = UBIDI_DEFAULT_RTL; break;
- case kBidi_Force_LTR: forceLTR = true; break; // every char is LTR
- case kBidi_Force_RTL: forceRTL = true; break; // every char is RTL
- }
-
+ UBiDiLevel bidiReq = UBIDI_DEFAULT_LTR;
bool useSingleRun = false;
- bool isRTL = forceRTL;
- if (forceLTR || forceRTL) {
- useSingleRun = true;
- } else {
- UBiDi* bidi = ubidi_open();
- if (bidi) {
- UErrorCode status = U_ZERO_ERROR;
+ bool isRTL = false;
+
+ UBiDi* bidi = ubidi_open();
+ if (bidi) {
+ UErrorCode status = U_ZERO_ERROR;
#if DEBUG_GLYPHS
- ALOGD("******** ComputeValues -- start");
- ALOGD(" -- string = '%s'", String8(chars + start, count).string());
- ALOGD(" -- start = %d", start);
- ALOGD(" -- count = %d", count);
- ALOGD(" -- contextCount = %d", contextCount);
- ALOGD(" -- bidiReq = %d", bidiReq);
+ ALOGD("******** ComputeValues -- start");
+ ALOGD(" -- string = '%s'", String8(chars + start, count).string());
+ ALOGD(" -- start = %d", start);
+ ALOGD(" -- count = %d", count);
+ ALOGD(" -- contextCount = %d", contextCount);
+ ALOGD(" -- bidiReq = %d", bidiReq);
#endif
- ubidi_setPara(bidi, chars, contextCount, bidiReq, NULL, &status);
- if (U_SUCCESS(status)) {
- int paraDir = ubidi_getParaLevel(bidi) & kDirection_Mask; // 0 if ltr, 1 if rtl
- ssize_t rc = ubidi_countRuns(bidi, &status);
+ ubidi_setPara(bidi, chars, contextCount, bidiReq, NULL, &status);
+ if (U_SUCCESS(status)) {
+ int paraDir = ubidi_getParaLevel(bidi) & kDirection_Mask; // 0 if ltr, 1 if rtl
+ ssize_t rc = ubidi_countRuns(bidi, &status);
#if DEBUG_GLYPHS
- ALOGD(" -- dirFlags = %d", dirFlags);
- ALOGD(" -- paraDir = %d", paraDir);
- ALOGD(" -- run-count = %d", int(rc));
+ ALOGD(" -- paraDir = %d", paraDir);
+ ALOGD(" -- run-count = %d", int(rc));
#endif
- if (U_SUCCESS(status) && rc == 1) {
- // Normal case: one run, status is ok
- isRTL = (paraDir == 1);
- useSingleRun = true;
- } else if (!U_SUCCESS(status) || rc < 1) {
- ALOGW("Need to force to single run -- string = '%s',"
- " status = %d, rc = %d",
- String8(chars + start, count).string(), status, int(rc));
- isRTL = (paraDir == 1);
- useSingleRun = true;
- } else {
- int32_t end = start + count;
- for (size_t i = 0; i < size_t(rc); ++i) {
- int32_t startRun = -1;
- int32_t lengthRun = -1;
- UBiDiDirection runDir = ubidi_getVisualRun(bidi, i, &startRun, &lengthRun);
-
- if (startRun == -1 || lengthRun == -1) {
- // Something went wrong when getting the visual run, need to clear
- // already computed data before doing a single run pass
- ALOGW("Visual run is not valid");
- outGlyphs->clear();
- outAdvances->clear();
- outPos->clear();
- *outTotalAdvance = 0;
- isRTL = (paraDir == 1);
- useSingleRun = true;
- break;
- }
-
- if (startRun >= end) {
- continue;
- }
- int32_t endRun = startRun + lengthRun;
- if (endRun <= int32_t(start)) {
- continue;
- }
- if (startRun < int32_t(start)) {
- startRun = int32_t(start);
- }
- if (endRun > end) {
- endRun = end;
- }
-
- lengthRun = endRun - startRun;
- isRTL = (runDir == UBIDI_RTL);
+ if (U_SUCCESS(status) && rc == 1) {
+ // Normal case: one run, status is ok
+ isRTL = (paraDir == 1);
+ useSingleRun = true;
+ } else if (!U_SUCCESS(status) || rc < 1) {
+ ALOGW("Need to force to single run -- string = '%s',"
+ " status = %d, rc = %d",
+ String8(chars + start, count).string(), status, int(rc));
+ isRTL = (paraDir == 1);
+ useSingleRun = true;
+ } else {
+ int32_t end = start + count;
+ for (size_t i = 0; i < size_t(rc); ++i) {
+ int32_t startRun = -1;
+ int32_t lengthRun = -1;
+ UBiDiDirection runDir = ubidi_getVisualRun(bidi, i, &startRun, &lengthRun);
+
+ if (startRun == -1 || lengthRun == -1) {
+ // Something went wrong when getting the visual run, need to clear
+ // already computed data before doing a single run pass
+ ALOGW("Visual run is not valid");
+ outGlyphs->clear();
+ outAdvances->clear();
+ outPos->clear();
+ *outTotalAdvance = 0;
+ isRTL = (paraDir == 1);
+ useSingleRun = true;
+ break;
+ }
+
+ if (startRun >= end) {
+ continue;
+ }
+ int32_t endRun = startRun + lengthRun;
+ if (endRun <= int32_t(start)) {
+ continue;
+ }
+ if (startRun < int32_t(start)) {
+ startRun = int32_t(start);
+ }
+ if (endRun > end) {
+ endRun = end;
+ }
+
+ lengthRun = endRun - startRun;
+ isRTL = (runDir == UBIDI_RTL);
#if DEBUG_GLYPHS
- ALOGD("Processing Bidi Run = %d -- run-start = %d, run-len = %d, isRTL = %d",
- i, startRun, lengthRun, isRTL);
+ ALOGD("Processing Bidi Run = %d -- run-start = %d, run-len = %d, isRTL = %d",
+ i, startRun, lengthRun, isRTL);
#endif
- computeRunValues(paint, chars, startRun, lengthRun, contextCount, isRTL,
- outAdvances, outTotalAdvance, outGlyphs, outPos);
+ computeRunValues(paint, chars, startRun, lengthRun, contextCount, isRTL,
+ outAdvances, outTotalAdvance, outGlyphs, outPos);
- }
}
- } else {
- ALOGW("Cannot set Para");
- useSingleRun = true;
- isRTL = (bidiReq = 1) || (bidiReq = UBIDI_DEFAULT_RTL);
}
- ubidi_close(bidi);
} else {
- ALOGW("Cannot ubidi_open()");
+ ALOGW("Cannot set Para");
useSingleRun = true;
isRTL = (bidiReq = 1) || (bidiReq = UBIDI_DEFAULT_RTL);
}
+ ubidi_close(bidi);
+ } else {
+ ALOGW("Cannot ubidi_open()");
+ useSingleRun = true;
+ isRTL = (bidiReq = 1) || (bidiReq = UBIDI_DEFAULT_RTL);
}
// Default single run case
@@ -785,10 +764,6 @@ void TextLayoutShaper::computeRunValues(const SkPaint* paint, const UChar* conte
/**
* Return the first typeface in the logical change, starting with this typeface,
* that contains the specified unichar, or NULL if none is found.
- *
- * Note that this function does _not_ increment the reference count on the typeface, as the
- * assumption is that its lifetime is managed elsewhere - in particular, the fallback typefaces
- * for the default font live in a global cache.
*/
SkTypeface* TextLayoutShaper::typefaceForScript(const SkPaint* paint, SkTypeface* typeface,
hb_script_t script) {
@@ -798,7 +773,7 @@ SkTypeface* TextLayoutShaper::typefaceForScript(const SkPaint* paint, SkTypeface
}
typeface = SkCreateTypefaceForScriptNG(script, currentStyle);
#if DEBUG_GLYPHS
- ALOGD("Using Harfbuzz Script %d, Style %d", script, currentStyle);
+ ALOGD("Using Harfbuzz Script %c%c%c%c, Style %d", HB_UNTAG(script), currentStyle);
#endif
return typeface;
}
@@ -845,6 +820,7 @@ size_t TextLayoutShaper::shapeFontRun(const SkPaint* paint) {
if (baseGlyphCount != 0) {
typeface = typefaceForScript(paint, typeface, hb_buffer_get_script(mBuffer));
if (!typeface) {
+ baseGlyphCount = 0;
typeface = mDefaultTypeface;
SkSafeRef(typeface);
#if DEBUG_GLYPHS
@@ -921,11 +897,11 @@ TextLayoutEngine::~TextLayoutEngine() {
}
sp<TextLayoutValue> TextLayoutEngine::getValue(const SkPaint* paint, const jchar* text,
- jint start, jint count, jint contextCount, jint dirFlags) {
+ jint start, jint count, jint contextCount) {
sp<TextLayoutValue> value;
#if USE_TEXT_LAYOUT_CACHE
value = mTextLayoutCache->getValue(paint, text, start, count,
- contextCount, dirFlags);
+ contextCount);
if (value == NULL) {
ALOGE("Cannot get TextLayoutCache value for text = '%s'",
String8(text + start, count).string());
@@ -933,7 +909,7 @@ sp<TextLayoutValue> TextLayoutEngine::getValue(const SkPaint* paint, const jchar
#else
value = new TextLayoutValue(count);
mShaper->computeValues(value.get(), paint,
- reinterpret_cast<const UChar*>(text), start, count, contextCount, dirFlags);
+ reinterpret_cast<const UChar*>(text), start, count, contextCount);
#endif
return value;
}
diff --git a/core/jni/android/graphics/TextLayoutCache.h b/core/jni/android/graphics/TextLayoutCache.h
index 704c7738d540..29805ee708f9 100644
--- a/core/jni/android/graphics/TextLayoutCache.h
+++ b/core/jni/android/graphics/TextLayoutCache.h
@@ -71,7 +71,7 @@ public:
TextLayoutCacheKey();
TextLayoutCacheKey(const SkPaint* paint, const UChar* text, size_t start, size_t count,
- size_t contextCount, int dirFlags);
+ size_t contextCount);
TextLayoutCacheKey(const TextLayoutCacheKey& other);
@@ -98,7 +98,6 @@ private:
size_t start;
size_t count;
size_t contextCount;
- int dirFlags;
SkTypeface* typeface;
SkScalar textSize;
SkScalar textSkewX;
@@ -182,7 +181,7 @@ public:
virtual ~TextLayoutShaper();
void computeValues(TextLayoutValue* value, const SkPaint* paint, const UChar* chars,
- size_t start, size_t count, size_t contextCount, int dirFlags);
+ size_t start, size_t count, size_t contextCount);
void purgeCaches();
@@ -216,7 +215,7 @@ private:
size_t shapeFontRun(const SkPaint* paint);
void computeValues(const SkPaint* paint, const UChar* chars,
- size_t start, size_t count, size_t contextCount, int dirFlags,
+ size_t start, size_t count, size_t contextCount,
Vector<jfloat>* const outAdvances, jfloat* outTotalAdvance,
Vector<jchar>* const outGlyphs, Vector<jfloat>* const outPos);
@@ -253,7 +252,7 @@ public:
void operator()(TextLayoutCacheKey& text, sp<TextLayoutValue>& desc);
sp<TextLayoutValue> getValue(const SkPaint* paint, const jchar* text, jint start,
- jint count, jint contextCount, jint dirFlags);
+ jint count, jint contextCount);
/**
* Clear the cache
@@ -305,7 +304,7 @@ public:
* the call. Be careful of this when doing optimization.
**/
sp<TextLayoutValue> getValue(const SkPaint* paint, const jchar* text, jint start,
- jint count, jint contextCount, jint dirFlags);
+ jint count, jint contextCount);
void purgeCaches();
diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp
index 895a0dc61fea..c08178df7655 100644
--- a/core/jni/android_view_GLES20Canvas.cpp
+++ b/core/jni/android_view_GLES20Canvas.cpp
@@ -567,9 +567,9 @@ static void android_view_GLES20Canvas_resetPaintFilter(JNIEnv* env, jobject claz
// ----------------------------------------------------------------------------
static void renderText(OpenGLRenderer* renderer, const jchar* text, int count,
- jfloat x, jfloat y, int flags, SkPaint* paint) {
+ jfloat x, jfloat y, SkPaint* paint) {
sp<TextLayoutValue> value = TextLayoutEngine::getInstance().getValue(paint,
- text, 0, count, count, flags);
+ text, 0, count, count);
if (value == NULL) {
return;
}
@@ -583,9 +583,9 @@ static void renderText(OpenGLRenderer* renderer, const jchar* text, int count,
}
static void renderTextOnPath(OpenGLRenderer* renderer, const jchar* text, int count,
- SkPath* path, jfloat hOffset, jfloat vOffset, int flags, SkPaint* paint) {
+ SkPath* path, jfloat hOffset, jfloat vOffset, SkPaint* paint) {
sp<TextLayoutValue> value = TextLayoutEngine::getInstance().getValue(paint,
- text, 0, count, count, flags);
+ text, 0, count, count);
if (value == NULL) {
return;
}
@@ -598,9 +598,9 @@ static void renderTextOnPath(OpenGLRenderer* renderer, const jchar* text, int co
static void renderTextRun(OpenGLRenderer* renderer, const jchar* text,
jint start, jint count, jint contextCount, jfloat x, jfloat y,
- int flags, SkPaint* paint) {
+ SkPaint* paint) {
sp<TextLayoutValue> value = TextLayoutEngine::getInstance().getValue(paint,
- text, start, count, contextCount, flags);
+ text, start, count, contextCount);
if (value == NULL) {
return;
}
@@ -615,64 +615,62 @@ static void renderTextRun(OpenGLRenderer* renderer, const jchar* text,
static void android_view_GLES20Canvas_drawTextArray(JNIEnv* env, jobject clazz,
OpenGLRenderer* renderer, jcharArray text, jint index, jint count,
- jfloat x, jfloat y, jint flags, SkPaint* paint) {
+ jfloat x, jfloat y, SkPaint* paint) {
jchar* textArray = env->GetCharArrayElements(text, NULL);
- renderText(renderer, textArray + index, count, x, y, flags, paint);
+ renderText(renderer, textArray + index, count, x, y, paint);
env->ReleaseCharArrayElements(text, textArray, JNI_ABORT);
}
static void android_view_GLES20Canvas_drawText(JNIEnv* env, jobject clazz,
OpenGLRenderer* renderer, jstring text, jint start, jint end,
- jfloat x, jfloat y, jint flags, SkPaint* paint) {
+ jfloat x, jfloat y, SkPaint* paint) {
const jchar* textArray = env->GetStringChars(text, NULL);
- renderText(renderer, textArray + start, end - start, x, y, flags, paint);
+ renderText(renderer, textArray + start, end - start, x, y, paint);
env->ReleaseStringChars(text, textArray);
}
static void android_view_GLES20Canvas_drawTextArrayOnPath(JNIEnv* env, jobject clazz,
OpenGLRenderer* renderer, jcharArray text, jint index, jint count,
- SkPath* path, jfloat hOffset, jfloat vOffset, jint flags, SkPaint* paint) {
+ SkPath* path, jfloat hOffset, jfloat vOffset, SkPaint* paint) {
jchar* textArray = env->GetCharArrayElements(text, NULL);
renderTextOnPath(renderer, textArray + index, count, path,
- hOffset, vOffset, flags, paint);
+ hOffset, vOffset, paint);
env->ReleaseCharArrayElements(text, textArray, JNI_ABORT);
}
static void android_view_GLES20Canvas_drawTextOnPath(JNIEnv* env, jobject clazz,
OpenGLRenderer* renderer, jstring text, jint start, jint end,
- SkPath* path, jfloat hOffset, jfloat vOffset, jint flags, SkPaint* paint) {
+ SkPath* path, jfloat hOffset, jfloat vOffset, SkPaint* paint) {
const jchar* textArray = env->GetStringChars(text, NULL);
renderTextOnPath(renderer, textArray + start, end - start, path,
- hOffset, vOffset, flags, paint);
+ hOffset, vOffset, paint);
env->ReleaseStringChars(text, textArray);
}
static void android_view_GLES20Canvas_drawTextRunArray(JNIEnv* env, jobject clazz,
OpenGLRenderer* renderer, jcharArray text, jint index, jint count,
- jint contextIndex, jint contextCount, jfloat x, jfloat y, jint dirFlags,
- SkPaint* paint) {
+ jint contextIndex, jint contextCount, jfloat x, jfloat y, SkPaint* paint) {
jchar* textArray = env->GetCharArrayElements(text, NULL);
renderTextRun(renderer, textArray + contextIndex, index - contextIndex,
- count, contextCount, x, y, dirFlags, paint);
+ count, contextCount, x, y, paint);
env->ReleaseCharArrayElements(text, textArray, JNI_ABORT);
}
static void android_view_GLES20Canvas_drawTextRun(JNIEnv* env, jobject clazz,
OpenGLRenderer* renderer, jstring text, jint start, jint end,
- jint contextStart, int contextEnd, jfloat x, jfloat y, jint dirFlags,
- SkPaint* paint) {
+ jint contextStart, int contextEnd, jfloat x, jfloat y, SkPaint* paint) {
const jchar* textArray = env->GetStringChars(text, NULL);
jint count = end - start;
jint contextCount = contextEnd - contextStart;
renderTextRun(renderer, textArray + contextStart, start - contextStart,
- count, contextCount, x, y, dirFlags, paint);
+ count, contextCount, x, y, paint);
env->ReleaseStringChars(text, textArray);
}
static void renderPosText(OpenGLRenderer* renderer, const jchar* text, int count,
- const jfloat* positions, jint dirFlags, SkPaint* paint) {
+ const jfloat* positions, SkPaint* paint) {
sp<TextLayoutValue> value = TextLayoutEngine::getInstance().getValue(paint,
- text, 0, count, count, dirFlags);
+ text, 0, count, count);
if (value == NULL) {
return;
}
@@ -690,7 +688,7 @@ static void android_view_GLES20Canvas_drawPosTextArray(JNIEnv* env, jobject claz
jchar* textArray = env->GetCharArrayElements(text, NULL);
jfloat* positions = env->GetFloatArrayElements(pos, NULL);
- renderPosText(renderer, textArray + index, count, positions, kBidi_LTR, paint);
+ renderPosText(renderer, textArray + index, count, positions, paint);
env->ReleaseFloatArrayElements(pos, positions, JNI_ABORT);
env->ReleaseCharArrayElements(text, textArray, JNI_ABORT);
@@ -702,7 +700,7 @@ static void android_view_GLES20Canvas_drawPosText(JNIEnv* env, jobject clazz,
const jchar* textArray = env->GetStringChars(text, NULL);
jfloat* positions = env->GetFloatArrayElements(pos, NULL);
- renderPosText(renderer, textArray + start, end - start, positions, kBidi_LTR, paint);
+ renderPosText(renderer, textArray + start, end - start, positions, paint);
env->ReleaseFloatArrayElements(pos, positions, JNI_ABORT);
env->ReleaseStringChars(text, textArray);
@@ -1025,16 +1023,16 @@ static JNINativeMethod gMethods[] = {
{ "nSetupPaintFilter", "(III)V", (void*) android_view_GLES20Canvas_setupPaintFilter },
{ "nResetPaintFilter", "(I)V", (void*) android_view_GLES20Canvas_resetPaintFilter },
- { "nDrawText", "(I[CIIFFII)V", (void*) android_view_GLES20Canvas_drawTextArray },
- { "nDrawText", "(ILjava/lang/String;IIFFII)V",
+ { "nDrawText", "(I[CIIFFI)V", (void*) android_view_GLES20Canvas_drawTextArray },
+ { "nDrawText", "(ILjava/lang/String;IIFFI)V",
(void*) android_view_GLES20Canvas_drawText },
- { "nDrawTextOnPath", "(I[CIIIFFII)V", (void*) android_view_GLES20Canvas_drawTextArrayOnPath },
- { "nDrawTextOnPath", "(ILjava/lang/String;IIIFFII)V",
+ { "nDrawTextOnPath", "(I[CIIIFFI)V", (void*) android_view_GLES20Canvas_drawTextArrayOnPath },
+ { "nDrawTextOnPath", "(ILjava/lang/String;IIIFFI)V",
(void*) android_view_GLES20Canvas_drawTextOnPath },
- { "nDrawTextRun", "(I[CIIIIFFII)V", (void*) android_view_GLES20Canvas_drawTextRunArray },
- { "nDrawTextRun", "(ILjava/lang/String;IIIIFFII)V",
+ { "nDrawTextRun", "(I[CIIIIFFI)V", (void*) android_view_GLES20Canvas_drawTextRunArray },
+ { "nDrawTextRun", "(ILjava/lang/String;IIIIFFI)V",
(void*) android_view_GLES20Canvas_drawTextRun },
{ "nDrawPosText", "(I[CII[FI)V", (void*) android_view_GLES20Canvas_drawPosTextArray },
diff --git a/core/res/Android.mk b/core/res/Android.mk
index 22f4fdc90a05..cfc791df43eb 100644
--- a/core/res/Android.mk
+++ b/core/res/Android.mk
@@ -42,7 +42,3 @@ include $(BUILD_PACKAGE)
# Make sure the system .rs files get compiled before building the package-export.apk.
# $(resource_export_package): $(framework_RenderScript_STAMP_FILE)
-
-# define a global intermediate target that other module may depend on.
-.PHONY: framework-res-package-target
-framework-res-package-target: $(LOCAL_BUILT_MODULE)
diff --git a/core/res/res/values-ko/strings.xml b/core/res/res/values-ko/strings.xml
index 1dfdf977deba..53fbeb4677cc 100644
--- a/core/res/res/values-ko/strings.xml
+++ b/core/res/res/values-ko/strings.xml
@@ -617,7 +617,7 @@
<string name="permdesc_manageNetworkPolicy" msgid="7537586771559370668">"앱이 네트워크 정책을 관리하고 앱별 규칙을 정의할 수 있도록 허용합니다."</string>
<string name="permlab_modifyNetworkAccounting" msgid="5088217309088729650">"네트워크 사용량 계산 수정"</string>
<string name="permdesc_modifyNetworkAccounting" msgid="5443412866746198123">"애플리케이션이 애플리케이션의 네트워크 사용량을 계산하는 방식을 수정할 수 있도록 허용합니다. 일반 애플리케이션에서는 사용하지 않습니다."</string>
- <string name="permlab_accessNotifications" msgid="7673416487873432268">"액세스 알림"</string>
+ <string name="permlab_accessNotifications" msgid="7673416487873432268">"알림 액세스"</string>
<string name="permdesc_accessNotifications" msgid="458457742683431387">"앱이 다른 앱에서 게시한 알림을 비롯하여 알림을 검색하고 살펴보며 삭제할 수 있도록 허용합니다."</string>
<string name="policylab_limitPassword" msgid="4497420728857585791">"비밀번호 규칙 설정"</string>
<string name="policydesc_limitPassword" msgid="3252114203919510394">"화면 잠금해제 비밀번호에 허용되는 길이 및 문자 수를 제어합니다."</string>
diff --git a/core/res/res/values-sw/strings.xml b/core/res/res/values-sw/strings.xml
index d0b151015261..554921bf24c5 100644
--- a/core/res/res/values-sw/strings.xml
+++ b/core/res/res/values-sw/strings.xml
@@ -190,8 +190,8 @@
<string name="permgroupdesc_dictionary" msgid="7921166355964764490">"Soma maneno katika kamusi ya mtumiaji."</string>
<string name="permgrouplab_writeDictionary" msgid="8090237702432576788">"Andika Kamusi ya Mtumiaji"</string>
<string name="permgroupdesc_writeDictionary" msgid="2711561994497361646">"Ongeza maneno katika kamusi mtumiaji."</string>
- <string name="permgrouplab_bookmarks" msgid="1949519673103968229">"Vialamisho na Historia"</string>
- <string name="permgroupdesc_bookmarks" msgid="4169771606257963028">"Kufikia moja kwa moja vialamisho na historia ya kivinjari"</string>
+ <string name="permgrouplab_bookmarks" msgid="1949519673103968229">"Alamisho na Historia"</string>
+ <string name="permgroupdesc_bookmarks" msgid="4169771606257963028">"Kufikia, moja kwa moja, alamisho na historia ya kivinjari."</string>
<string name="permgrouplab_deviceAlarms" msgid="6117704629728824101">"Kengele"</string>
<string name="permgroupdesc_deviceAlarms" msgid="4769356362251641175">"Weka saa ya kengele."</string>
<string name="permgrouplab_voicemail" msgid="4162237145027592133">"Barua ya sauti"</string>
@@ -863,8 +863,8 @@
<string name="js_dialog_before_unload" msgid="730366588032430474">"Toka kwa ukurasa huu?"\n\n"<xliff:g id="MESSAGE">%s</xliff:g>"\n\n"Gusa Sawa ili kuendelea, au Ghairi ili kubaki kwenye ukurasa wa sasa."</string>
<string name="save_password_label" msgid="6860261758665825069">"Thibitisha"</string>
<string name="double_tap_toast" msgid="4595046515400268881">"Kidokezo: Gonga mara mbili ili kukuza ndani na nje."</string>
- <string name="autofill_this_form" msgid="4616758841157816676">"Mjazo-otomatiki"</string>
- <string name="setup_autofill" msgid="7103495070180590814">"Sanidi Mjazo-otomati"</string>
+ <string name="autofill_this_form" msgid="4616758841157816676">"Kujaza kiotomatiki"</string>
+ <string name="setup_autofill" msgid="7103495070180590814">"Weka uwezo wa kujaza kiotomatiki"</string>
<string name="autofill_address_name_separator" msgid="6350145154779706772">" "</string>
<string name="autofill_address_summary_name_format" msgid="3268041054899214945">"$1$2$3"</string>
<string name="autofill_address_summary_separator" msgid="7483307893170324129">", "</string>
@@ -885,7 +885,7 @@
<string name="permdesc_readHistoryBookmarks" msgid="8462378226600439658">"Inaruhusu programu kusoma historia ya URL zote ambazo zimetembelewa na Kivinjari, na alamisho zote za Kivinjari. Kumbuka: idhini hii haiwezi kutekelezwa vivinjari vya vingine au programu zingine zenye uwezo wa kuvinjari."</string>
<string name="permlab_writeHistoryBookmarks" msgid="3714785165273314490">"andika alamisho na historia ya wavuti"</string>
<string name="permdesc_writeHistoryBookmarks" product="tablet" msgid="6825527469145760922">"Inaruhusu programu kurekebisha historia ya Kivinjari au alamisho zilizohifadhiwa kwenye kompyuta kibao yako. Hii inaruhusu programu kufuta au kurekebisha data ya Kivinjari. Kumbuka: huenda idhini hii isitekelezwe na kivinjari kingine au programu nyingine zenye uwezo wa kuvinjari wavuti."</string>
- <string name="permdesc_writeHistoryBookmarks" product="default" msgid="8497389531014185509">"Inaruhusu programu kurekebisha historia ya Kivinjari au vialamisho vilivyohifadhiwa kwenye simu yako. Hii huenda ikaruhusu programu kufuta au kurekebisha data ya Kivinjari. Kumbuka: huenda idhini hii isitekelezwe na vivinjari vingine au programu nyingine zenye uwezo wa kuvinjari wavuti."</string>
+ <string name="permdesc_writeHistoryBookmarks" product="default" msgid="8497389531014185509">"Inaruhusu programu kurekebisha historia ya Kivinjari au alamisho zilizohifadhiwa kwenye simu yako. Hii huenda ikaruhusu programu kufuta au kurekebisha data ya Kivinjari. Kumbuka: huenda idhini hii isitekelezwe na vivinjari vingine au programu nyingine zenye uwezo wa kuvinjari wavuti."</string>
<string name="permlab_setAlarm" msgid="1379294556362091814">"weka kengele"</string>
<string name="permdesc_setAlarm" msgid="316392039157473848">"Inaruhusu programu kuweka kengele katika programu iliyosakinishwa ya kengele. Programu zingine za kengele zinawezakosa kutekeleza kipengee hiki."</string>
<string name="permlab_addVoicemail" msgid="5525660026090959044">"ongeza barua ya sauti"</string>
diff --git a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/AccessPointParserHelper.java b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/AccessPointParserHelper.java
index 649e39d0cacb..0461c0bfdc11 100644
--- a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/AccessPointParserHelper.java
+++ b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/AccessPointParserHelper.java
@@ -213,8 +213,8 @@ public class AccessPointParserHelper {
config.allowedKeyManagement.set(KeyMgmt.IEEE8021X);
// Initialize other fields.
config.enterpriseConfig.setPhase2Method(WifiEnterpriseConfig.Phase2.NONE);
- config.enterpriseConfig.setCaCertificate("");
- config.enterpriseConfig.setClientCertificate("");
+ config.enterpriseConfig.setCaCertificateAlias("");
+ config.enterpriseConfig.setClientCertificateAlias("");
config.enterpriseConfig.setIdentity("");
config.enterpriseConfig.setAnonymousIdentity("");
break;
@@ -288,12 +288,12 @@ public class AccessPointParserHelper {
}
if (cacert) {
String cacertValue = new String(ch, start, length);
- config.enterpriseConfig.setCaCertificate(cacertValue);
+ config.enterpriseConfig.setCaCertificateAlias(cacertValue);
cacert = false;
}
if (usercert) {
String usercertValue = new String(ch, start, length);
- config.enterpriseConfig.setClientCertificate(usercertValue);
+ config.enterpriseConfig.setClientCertificateAlias(usercertValue);
usercert = false;
}
if (ip) {
diff --git a/docs/html/reference/gcm-lists.js b/docs/html/reference/gcm-lists.js
new file mode 100644
index 000000000000..44c60230ee15
--- /dev/null
+++ b/docs/html/reference/gcm-lists.js
@@ -0,0 +1,16 @@
+var GCM_DATA = [
+ { id:0, label:"com.google.android.gcm", link:"reference/com/google/android/gcm/package-summary.html", type:"package" },
+ { id:1, label:"com.google.android.gcm.GCMBaseIntentService", link:"reference/com/google/android/gcm/GCMBaseIntentService.html", type:"class" },
+ { id:2, label:"com.google.android.gcm.GCMBroadcastReceiver", link:"reference/com/google/android/gcm/GCMBroadcastReceiver.html", type:"class" },
+ { id:3, label:"com.google.android.gcm.GCMConstants", link:"reference/com/google/android/gcm/GCMConstants.html", type:"class" },
+ { id:4, label:"com.google.android.gcm.GCMRegistrar", link:"reference/com/google/android/gcm/GCMRegistrar.html", type:"class" },
+ { id:5, label:"com.google.android.gcm.server", link:"reference/com/google/android/gcm/server/package-summary.html", type:"package" },
+ { id:6, label:"com.google.android.gcm.server.Constants", link:"reference/com/google/android/gcm/server/Constants.html", type:"class" },
+ { id:7, label:"com.google.android.gcm.server.InvalidRequestException", link:"reference/com/google/android/gcm/server/InvalidRequestException.html", type:"class" },
+ { id:8, label:"com.google.android.gcm.server.Message", link:"reference/com/google/android/gcm/server/Message.html", type:"class" },
+ { id:9, label:"com.google.android.gcm.server.Message.Builder", link:"reference/com/google/android/gcm/server/Message.Builder.html", type:"class" },
+ { id:10, label:"com.google.android.gcm.server.MulticastResult", link:"reference/com/google/android/gcm/server/MulticastResult.html", type:"class" },
+ { id:11, label:"com.google.android.gcm.server.Result", link:"reference/com/google/android/gcm/server/Result.html", type:"class" },
+ { id:12, label:"com.google.android.gcm.server.Sender", link:"reference/com/google/android/gcm/server/Sender.html", type:"class" }
+
+ ];
diff --git a/docs/html/reference/gms-lists.js b/docs/html/reference/gms-lists.js
new file mode 100644
index 000000000000..a5999f7b669b
--- /dev/null
+++ b/docs/html/reference/gms-lists.js
@@ -0,0 +1,93 @@
+var GMS_DATA = [
+ { id:0, label:"com.google.android.gms", link:"reference/com/google/android/gms/package-summary.html", type:"package" },
+ { id:1, label:"com.google.android.gms.R", link:"reference/com/google/android/gms/R.html", type:"class" },
+ { id:2, label:"com.google.android.gms.R.attr", link:"reference/com/google/android/gms/R.attr.html", type:"class" },
+ { id:3, label:"com.google.android.gms.R.id", link:"reference/com/google/android/gms/R.id.html", type:"class" },
+ { id:4, label:"com.google.android.gms.R.string", link:"reference/com/google/android/gms/R.string.html", type:"class" },
+ { id:5, label:"com.google.android.gms.R.styleable", link:"reference/com/google/android/gms/R.styleable.html", type:"class" },
+ { id:6, label:"com.google.android.gms.analytics", link:"reference/com/google/android/gms/analytics/package-summary.html", type:"package" },
+ { id:7, label:"com.google.android.gms.analytics.CampaignTrackingReceiver", link:"reference/com/google/android/gms/analytics/CampaignTrackingReceiver.html", type:"class" },
+ { id:8, label:"com.google.android.gms.analytics.CampaignTrackingService", link:"reference/com/google/android/gms/analytics/CampaignTrackingService.html", type:"class" },
+ { id:9, label:"com.google.android.gms.analytics.EasyTracker", link:"reference/com/google/android/gms/analytics/EasyTracker.html", type:"class" },
+ { id:10, label:"com.google.android.gms.analytics.ExceptionParser", link:"reference/com/google/android/gms/analytics/ExceptionParser.html", type:"class" },
+ { id:11, label:"com.google.android.gms.analytics.GoogleAnalytics", link:"reference/com/google/android/gms/analytics/GoogleAnalytics.html", type:"class" },
+ { id:12, label:"com.google.android.gms.analytics.GoogleAnalytics.AppOptOutCallback", link:"reference/com/google/android/gms/analytics/GoogleAnalytics.AppOptOutCallback.html", type:"class" },
+ { id:13, label:"com.google.android.gms.analytics.ModelFields", link:"reference/com/google/android/gms/analytics/ModelFields.html", type:"class" },
+ { id:14, label:"com.google.android.gms.analytics.StandardExceptionParser", link:"reference/com/google/android/gms/analytics/StandardExceptionParser.html", type:"class" },
+ { id:15, label:"com.google.android.gms.analytics.Tracker", link:"reference/com/google/android/gms/analytics/Tracker.html", type:"class" },
+ { id:16, label:"com.google.android.gms.analytics.Transaction", link:"reference/com/google/android/gms/analytics/Transaction.html", type:"class" },
+ { id:17, label:"com.google.android.gms.analytics.Transaction.Builder", link:"reference/com/google/android/gms/analytics/Transaction.Builder.html", type:"class" },
+ { id:18, label:"com.google.android.gms.analytics.Transaction.Item", link:"reference/com/google/android/gms/analytics/Transaction.Item.html", type:"class" },
+ { id:19, label:"com.google.android.gms.analytics.Transaction.Item.Builder", link:"reference/com/google/android/gms/analytics/Transaction.Item.Builder.html", type:"class" },
+ { id:20, label:"com.google.android.gms.auth", link:"reference/com/google/android/gms/auth/package-summary.html", type:"package" },
+ { id:21, label:"com.google.android.gms.auth.GoogleAuthException", link:"reference/com/google/android/gms/auth/GoogleAuthException.html", type:"class" },
+ { id:22, label:"com.google.android.gms.auth.GoogleAuthUtil", link:"reference/com/google/android/gms/auth/GoogleAuthUtil.html", type:"class" },
+ { id:23, label:"com.google.android.gms.auth.GooglePlayServicesAvailabilityException", link:"reference/com/google/android/gms/auth/GooglePlayServicesAvailabilityException.html", type:"class" },
+ { id:24, label:"com.google.android.gms.auth.UserRecoverableAuthException", link:"reference/com/google/android/gms/auth/UserRecoverableAuthException.html", type:"class" },
+ { id:25, label:"com.google.android.gms.auth.UserRecoverableNotifiedException", link:"reference/com/google/android/gms/auth/UserRecoverableNotifiedException.html", type:"class" },
+ { id:26, label:"com.google.android.gms.common", link:"reference/com/google/android/gms/common/package-summary.html", type:"package" },
+ { id:27, label:"com.google.android.gms.common.AccountPicker", link:"reference/com/google/android/gms/common/AccountPicker.html", type:"class" },
+ { id:28, label:"com.google.android.gms.common.ConnectionResult", link:"reference/com/google/android/gms/common/ConnectionResult.html", type:"class" },
+ { id:29, label:"com.google.android.gms.common.GooglePlayServicesClient", link:"reference/com/google/android/gms/common/GooglePlayServicesClient.html", type:"class" },
+ { id:30, label:"com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks", link:"reference/com/google/android/gms/common/GooglePlayServicesClient.ConnectionCallbacks.html", type:"class" },
+ { id:31, label:"com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener", link:"reference/com/google/android/gms/common/GooglePlayServicesClient.OnConnectionFailedListener.html", type:"class" },
+ { id:32, label:"com.google.android.gms.common.GooglePlayServicesNotAvailableException", link:"reference/com/google/android/gms/common/GooglePlayServicesNotAvailableException.html", type:"class" },
+ { id:33, label:"com.google.android.gms.common.GooglePlayServicesUtil", link:"reference/com/google/android/gms/common/GooglePlayServicesUtil.html", type:"class" },
+ { id:34, label:"com.google.android.gms.common.Scopes", link:"reference/com/google/android/gms/common/Scopes.html", type:"class" },
+ { id:35, label:"com.google.android.gms.maps", link:"reference/com/google/android/gms/maps/package-summary.html", type:"package" },
+ { id:36, label:"com.google.android.gms.maps.CameraUpdate", link:"reference/com/google/android/gms/maps/CameraUpdate.html", type:"class" },
+ { id:37, label:"com.google.android.gms.maps.CameraUpdateFactory", link:"reference/com/google/android/gms/maps/CameraUpdateFactory.html", type:"class" },
+ { id:38, label:"com.google.android.gms.maps.GoogleMap", link:"reference/com/google/android/gms/maps/GoogleMap.html", type:"class" },
+ { id:39, label:"com.google.android.gms.maps.GoogleMap.CancelableCallback", link:"reference/com/google/android/gms/maps/GoogleMap.CancelableCallback.html", type:"class" },
+ { id:40, label:"com.google.android.gms.maps.GoogleMap.InfoWindowAdapter", link:"reference/com/google/android/gms/maps/GoogleMap.InfoWindowAdapter.html", type:"class" },
+ { id:41, label:"com.google.android.gms.maps.GoogleMap.OnCameraChangeListener", link:"reference/com/google/android/gms/maps/GoogleMap.OnCameraChangeListener.html", type:"class" },
+ { id:42, label:"com.google.android.gms.maps.GoogleMap.OnInfoWindowClickListener", link:"reference/com/google/android/gms/maps/GoogleMap.OnInfoWindowClickListener.html", type:"class" },
+ { id:43, label:"com.google.android.gms.maps.GoogleMap.OnMapClickListener", link:"reference/com/google/android/gms/maps/GoogleMap.OnMapClickListener.html", type:"class" },
+ { id:44, label:"com.google.android.gms.maps.GoogleMap.OnMapLongClickListener", link:"reference/com/google/android/gms/maps/GoogleMap.OnMapLongClickListener.html", type:"class" },
+ { id:45, label:"com.google.android.gms.maps.GoogleMap.OnMarkerClickListener", link:"reference/com/google/android/gms/maps/GoogleMap.OnMarkerClickListener.html", type:"class" },
+ { id:46, label:"com.google.android.gms.maps.GoogleMap.OnMarkerDragListener", link:"reference/com/google/android/gms/maps/GoogleMap.OnMarkerDragListener.html", type:"class" },
+ { id:47, label:"com.google.android.gms.maps.GoogleMapOptions", link:"reference/com/google/android/gms/maps/GoogleMapOptions.html", type:"class" },
+ { id:48, label:"com.google.android.gms.maps.LocationSource", link:"reference/com/google/android/gms/maps/LocationSource.html", type:"class" },
+ { id:49, label:"com.google.android.gms.maps.LocationSource.OnLocationChangedListener", link:"reference/com/google/android/gms/maps/LocationSource.OnLocationChangedListener.html", type:"class" },
+ { id:50, label:"com.google.android.gms.maps.MapFragment", link:"reference/com/google/android/gms/maps/MapFragment.html", type:"class" },
+ { id:51, label:"com.google.android.gms.maps.MapView", link:"reference/com/google/android/gms/maps/MapView.html", type:"class" },
+ { id:52, label:"com.google.android.gms.maps.MapsInitializer", link:"reference/com/google/android/gms/maps/MapsInitializer.html", type:"class" },
+ { id:53, label:"com.google.android.gms.maps.Projection", link:"reference/com/google/android/gms/maps/Projection.html", type:"class" },
+ { id:54, label:"com.google.android.gms.maps.SupportMapFragment", link:"reference/com/google/android/gms/maps/SupportMapFragment.html", type:"class" },
+ { id:55, label:"com.google.android.gms.maps.UiSettings", link:"reference/com/google/android/gms/maps/UiSettings.html", type:"class" },
+ { id:56, label:"com.google.android.gms.maps.model", link:"reference/com/google/android/gms/maps/model/package-summary.html", type:"package" },
+ { id:57, label:"com.google.android.gms.maps.model.BitmapDescriptor", link:"reference/com/google/android/gms/maps/model/BitmapDescriptor.html", type:"class" },
+ { id:58, label:"com.google.android.gms.maps.model.BitmapDescriptorFactory", link:"reference/com/google/android/gms/maps/model/BitmapDescriptorFactory.html", type:"class" },
+ { id:59, label:"com.google.android.gms.maps.model.CameraPosition", link:"reference/com/google/android/gms/maps/model/CameraPosition.html", type:"class" },
+ { id:60, label:"com.google.android.gms.maps.model.CameraPosition.Builder", link:"reference/com/google/android/gms/maps/model/CameraPosition.Builder.html", type:"class" },
+ { id:61, label:"com.google.android.gms.maps.model.GroundOverlay", link:"reference/com/google/android/gms/maps/model/GroundOverlay.html", type:"class" },
+ { id:62, label:"com.google.android.gms.maps.model.GroundOverlayOptions", link:"reference/com/google/android/gms/maps/model/GroundOverlayOptions.html", type:"class" },
+ { id:63, label:"com.google.android.gms.maps.model.LatLng", link:"reference/com/google/android/gms/maps/model/LatLng.html", type:"class" },
+ { id:64, label:"com.google.android.gms.maps.model.LatLngBounds", link:"reference/com/google/android/gms/maps/model/LatLngBounds.html", type:"class" },
+ { id:65, label:"com.google.android.gms.maps.model.LatLngBounds.Builder", link:"reference/com/google/android/gms/maps/model/LatLngBounds.Builder.html", type:"class" },
+ { id:66, label:"com.google.android.gms.maps.model.Marker", link:"reference/com/google/android/gms/maps/model/Marker.html", type:"class" },
+ { id:67, label:"com.google.android.gms.maps.model.MarkerOptions", link:"reference/com/google/android/gms/maps/model/MarkerOptions.html", type:"class" },
+ { id:68, label:"com.google.android.gms.maps.model.Polygon", link:"reference/com/google/android/gms/maps/model/Polygon.html", type:"class" },
+ { id:69, label:"com.google.android.gms.maps.model.PolygonOptions", link:"reference/com/google/android/gms/maps/model/PolygonOptions.html", type:"class" },
+ { id:70, label:"com.google.android.gms.maps.model.Polyline", link:"reference/com/google/android/gms/maps/model/Polyline.html", type:"class" },
+ { id:71, label:"com.google.android.gms.maps.model.PolylineOptions", link:"reference/com/google/android/gms/maps/model/PolylineOptions.html", type:"class" },
+ { id:72, label:"com.google.android.gms.maps.model.RuntimeRemoteException", link:"reference/com/google/android/gms/maps/model/RuntimeRemoteException.html", type:"class" },
+ { id:73, label:"com.google.android.gms.maps.model.Tile", link:"reference/com/google/android/gms/maps/model/Tile.html", type:"class" },
+ { id:74, label:"com.google.android.gms.maps.model.TileOverlay", link:"reference/com/google/android/gms/maps/model/TileOverlay.html", type:"class" },
+ { id:75, label:"com.google.android.gms.maps.model.TileOverlayOptions", link:"reference/com/google/android/gms/maps/model/TileOverlayOptions.html", type:"class" },
+ { id:76, label:"com.google.android.gms.maps.model.TileProvider", link:"reference/com/google/android/gms/maps/model/TileProvider.html", type:"class" },
+ { id:77, label:"com.google.android.gms.maps.model.UrlTileProvider", link:"reference/com/google/android/gms/maps/model/UrlTileProvider.html", type:"class" },
+ { id:78, label:"com.google.android.gms.maps.model.VisibleRegion", link:"reference/com/google/android/gms/maps/model/VisibleRegion.html", type:"class" },
+ { id:79, label:"com.google.android.gms.panorama", link:"reference/com/google/android/gms/panorama/package-summary.html", type:"package" },
+ { id:80, label:"com.google.android.gms.panorama.PanoramaClient", link:"reference/com/google/android/gms/panorama/PanoramaClient.html", type:"class" },
+ { id:81, label:"com.google.android.gms.panorama.PanoramaClient.OnPanoramaInfoLoadedListener", link:"reference/com/google/android/gms/panorama/PanoramaClient.OnPanoramaInfoLoadedListener.html", type:"class" },
+ { id:82, label:"com.google.android.gms.plus", link:"reference/com/google/android/gms/plus/package-summary.html", type:"package" },
+ { id:83, label:"com.google.android.gms.plus.GooglePlusUtil", link:"reference/com/google/android/gms/plus/GooglePlusUtil.html", type:"class" },
+ { id:84, label:"com.google.android.gms.plus.PlusClient", link:"reference/com/google/android/gms/plus/PlusClient.html", type:"class" },
+ { id:85, label:"com.google.android.gms.plus.PlusOneButton", link:"reference/com/google/android/gms/plus/PlusOneButton.html", type:"class" },
+ { id:86, label:"com.google.android.gms.plus.PlusOneButton.OnPlusOneClickListener", link:"reference/com/google/android/gms/plus/PlusOneButton.OnPlusOneClickListener.html", type:"class" },
+ { id:87, label:"com.google.android.gms.plus.PlusShare", link:"reference/com/google/android/gms/plus/PlusShare.html", type:"class" },
+ { id:88, label:"com.google.android.gms.plus.PlusShare.Builder", link:"reference/com/google/android/gms/plus/PlusShare.Builder.html", type:"class" },
+ { id:89, label:"com.google.android.gms.plus.PlusSignInButton", link:"reference/com/google/android/gms/plus/PlusSignInButton.html", type:"class" }
+
+ ];
diff --git a/docs/html/sdk/index.jd b/docs/html/sdk/index.jd
index cb9d2ef0ebbd..dff3a32b322e 100644
--- a/docs/html/sdk/index.jd
+++ b/docs/html/sdk/index.jd
@@ -3,43 +3,44 @@ page.template=sdk
header.hide=1
page.metaDescription=Download the official Android SDK to develop apps for Android-powered devices.
-sdk.win32_bundle_download=adt-bundle-windows-x86.zip
-sdk.win32_bundle_bytes=418030942
-sdk.win32_bundle_checksum=ce32861d8f7c93ff6ff6971bd99d228e
-sdk.win64_bundle_download=adt-bundle-windows-x86_64.zip
-sdk.win64_bundle_bytes=418155677
-sdk.win64_bundle_checksum=f09aa4557bd1dc2703fde95dcdd6b92e
+sdk.linux32_bundle_download=adt-bundle-linux-x86.zip
+sdk.linux32_bundle_bytes=418614971
+sdk.linux32_bundle_checksum=24506708af221a887326c2a9ca9625dc
+
+sdk.linux64_bundle_download=adt-bundle-linux-x86_64.zip
+sdk.linux64_bundle_bytes=418889835
+sdk.linux64_bundle_checksum=464c1fbe92ea293d6b2292c27af5066a
sdk.mac64_bundle_download=adt-bundle-mac-x86_64.zip
-sdk.mac64_bundle_bytes=383216991
-sdk.mac64_bundle_checksum=ea6c074ee30c426c503dab5c225a5076
+sdk.mac64_bundle_bytes=390649300
+sdk.mac64_bundle_checksum=f557bc61a4bff466633037839771bffb
-sdk.linux32_bundle_download=adt-bundle-linux-x86.zip
-sdk.linux32_bundle_bytes=411205048
-sdk.linux32_bundle_checksum=e64594cd339b8d9a400b9d16c616b3c3
+sdk.win32_bundle_download=adt-bundle-windows-x86.zip
+sdk.win32_bundle_bytes=425429957
+sdk.win32_bundle_checksum=cca97f12904774385a57d542e70a490f
-sdk.linux64_bundle_download=adt-bundle-linux-x86_64.zip
-sdk.linux64_bundle_bytes=411478695
-sdk.linux64_bundle_checksum=582bfc9083ff4cbcfacc8223bd8c3be1
+sdk.win64_bundle_download=adt-bundle-windows-x86_64.zip
+sdk.win64_bundle_bytes=425553759
+sdk.win64_bundle_checksum=c51679f4517e1c3ddefa1e662bbf17f6
-sdk.win_installer=installer_r21.0.1-windows.exe
-sdk.win_installer_bytes=76520869
-sdk.win_installer_checksum=e2012262471a2583d4a559b15fcf45ff
+sdk.linux_download=android-sdk_r21.1.0-linux.tgz
+sdk.linux_bytes=91617112
+sdk.linux_checksum=3369a439240cf3dbe165d6b4173900a8
-sdk.win_download=android-sdk_r21.0.1-windows.zip
-sdk.win_bytes=99107847
-sdk.win_checksum=613568d774c3bf25c5d24db16601af83
+sdk.mac_download=android-sdk_r21.1.0-macosx.zip
+sdk.mac_bytes=66077080
+sdk.mac_checksum=49903cf79e1f8e3fde54a95bd3666385
-sdk.mac_download=android-sdk_r21.0.1-macosx.zip
-sdk.mac_bytes=65804128
-sdk.mac_checksum=30401c43a014cd5d6ec9d0c62854a1d9
+sdk.win_download=android-sdk_r21.1.0-windows.zip
+sdk.win_bytes=99360755
+sdk.win_checksum=dbece8859da9b66a1e8e7cd47b1e647e
-sdk.linux_download=android-sdk_r21.0.1-linux.tgz
-sdk.linux_bytes=91394975
-sdk.linux_checksum=eaa5a8d76d692d1d027f2bbcee019644
+sdk.win_installer=installer_r21.1.0-windows.exe
+sdk.win_installer_bytes=77767013
+sdk.win_installer_checksum=594d8ff8e349db9e783a5f2229561353
diff --git a/docs/html/sdk/installing/installing-adt.jd b/docs/html/sdk/installing/installing-adt.jd
index 804030b15a13..d956af299800 100644
--- a/docs/html/sdk/installing/installing-adt.jd
+++ b/docs/html/sdk/installing/installing-adt.jd
@@ -1,8 +1,8 @@
page.title=Installing the Eclipse Plugin
adt.zip.version=21.0.1
-adt.zip.download=ADT-21.0.1.zip
-adt.zip.bytes=13569302
-adt.zip.checksum=acfb01bf3fd1240f1fc21488c3dd16bf
+adt.zip.download=ADT-21.1.0.zip
+adt.zip.bytes=13564671
+adt.zip.checksum=f1ae183891229784bb9c33bcc9c5ef1e
@jd:body
diff --git a/docs/html/tools/device.jd b/docs/html/tools/device.jd
index 61cd08a8b0f7..cf7b63f2dbf4 100644
--- a/docs/html/tools/device.jd
+++ b/docs/html/tools/device.jd
@@ -111,7 +111,17 @@ rules</a>.</p>
</li>
</ol>
-<p>When plugged in over USB, can verify that your device is connected by executing <code>adb
+
+<p class="note"><strong>Note:</strong> When you connect a device running Android 4.2.2 or higher
+to your computer, the system shows a dialog asking whether to accept an RSA key that allows
+debugging through this computer. This security mechanism protects user devices because it ensures
+that USB debugging and other adb commands cannot be executed unless you're able to unlock the
+device and acknowledge the dialog. This requires that you have adb version 1.0.31 (available with
+SDK Platform-tools r16.0.1 and higher) in order to debug on a device running Android 4.2.2 or
+higher.</p>
+
+
+<p>When plugged in over USB, you can verify that your device is connected by executing <code>adb
devices</code> from your SDK {@code platform-tools/} directory. If connected,
you'll see the device name listed as a "device."</p>
diff --git a/docs/html/tools/help/adb.jd b/docs/html/tools/help/adb.jd
index e0ee0e61fcd7..c8afca5ded1c 100644
--- a/docs/html/tools/help/adb.jd
+++ b/docs/html/tools/help/adb.jd
@@ -69,6 +69,13 @@ instances and handles commands from multiple adb clients, you can control any em
instance from any client (or from a script).</p>
+<p class="note"><strong>Note:</strong> When you connect a device running Android 4.2.2 or higher
+to your computer, the system shows a dialog asking whether to accept an RSA key that allows
+debugging through this computer. This security mechanism protects user devices because it ensures
+that USB debugging and other adb commands cannot be executed unless you're able to unlock the
+device and acknowledge the dialog. This requires that you have adb version 1.0.31 (available with
+SDK Platform-tools r16.0.1 and higher) in order to debug on a device running Android 4.2.2 or
+higher.</p>
<h2 id="issuingcommands">Syntax</h2>
@@ -871,8 +878,14 @@ list permission-groups
<td><code>
list permissions [options] &lt;GROUP>
</code></td>
-<td>Prints all known permissions, optionally only those in {@code &lt;GROUP>}. <p>Options:
-<ul> <li>{@code -g}: Organize by group. <li>{@code -f}: Print all information. <li>{@code -s}: Short summary. <li>{@code -d}: Only list dangerous permissions. <li>{@code -u}: List only the permissions users will see.
+<td>Prints all known permissions, optionally only
+ those in {@code &lt;GROUP>}. <p>Options:
+<ul>
+ <li>{@code -g}: Organize by group.
+ <li>{@code -f}: Print all information.
+ <li>{@code -s}: Short summary.
+ <li>{@code -d}: Only list dangerous permissions.
+ <li>{@code -u}: List only the permissions users will see.
</ul>
</td>
</tr>
@@ -882,7 +895,8 @@ list permissions [options] &lt;GROUP>
list instrumentation
</code></td>
<td>List all test packages. <p>Options:
- <ul> <li>{@code -f}: List the APK file for the test package.
+ <ul>
+ <li>{@code -f}: List the APK file for the test package.
<li>{@code &lt;TARGET_PACKAGE>}: List test packages for only this app.
</ul>
</td>
@@ -925,7 +939,14 @@ path &lt;PACKAGE>
install [options] &lt;PATH>
</code></td>
<td>Installs a package (specified by {@code &lt;PATH>}) to the system. <p>Options:
- <ul> <li>{@code -l}: Install the package with forward lock. <li>{@code -r}: Reinstall an exisiting app, keeping its data. <li>{@code -t}: Allow test APKs to be installed. <li>{@code -i &lt;INSTALLER_PACKAGE_NAME>}: Specify the installer package name. <li>{@code -s}: Install package on the shared mass storage (such as sdcard). <li>{@code -f}: Install package on the internal system memory. <li>{@code -d}: Allow version code downgrade.
+ <ul>
+ <li>{@code -l}: Install the package with forward lock.
+ <li>{@code -r}: Reinstall an exisiting app, keeping its data.
+ <li>{@code -t}: Allow test APKs to be installed.
+ <li>{@code -i &lt;INSTALLER_PACKAGE_NAME>}: Specify the installer package name.
+ <li>{@code -s}: Install package on the shared mass storage (such as sdcard).
+ <li>{@code -f}: Install package on the internal system memory.
+ <li>{@code -d}: Allow version code downgrade.
</ul>
</td>
</tr>
@@ -935,7 +956,8 @@ install [options] &lt;PATH>
uninstall [options] &lt;PACKAGE>
</code></td>
<td>Removes a package from the system. <p>Options:
- <ul> <li>{@code -k}: Keep the data and cache directories around after package removal.
+ <ul>
+ <li>{@code -k}: Keep the data and cache directories around after package removal.
</ul>
</td>
</tr>
diff --git a/docs/html/tools/publishing/app-signing.jd b/docs/html/tools/publishing/app-signing.jd
index ac45242516b5..608780e8ea14 100644
--- a/docs/html/tools/publishing/app-signing.jd
+++ b/docs/html/tools/publishing/app-signing.jd
@@ -96,8 +96,7 @@ you compile.</p>
you don't have a private key, you can use the Keytool utility to create one for you. When you
compile your application in release mode, the build tools use your private key along with the
Jarsigner utility to sign your application's <code>.apk</code> file. Because the certificate and
-private key you use are your own, you will have to provide the password for the keystore and key
-alias.</p>
+private key you use are your own, you must provide the password for the keystore and key alias.</p>
<p>The debug signing process happens automatically when you run or debug your application using
Eclipse with the ADT plugin. Debug signing also happens automatically when you use the Ant build
@@ -117,13 +116,13 @@ lifespan of your applications. There are several reasons why you should do so: <
<ul>
<li>Application upgrade &ndash; As you release updates to your application, you
-will want to continue to sign the updates with the same certificate or set of
-certificates, if you want users to upgrade seamlessly to the new version. When
+must continue to sign the updates with the same certificate or set of certificates,
+if you want users to be able to upgrade seamlessly to the new version. When
the system is installing an update to an application, it compares the
certificate(s) in the new version with those in the existing version. If the
certificates match exactly, including both the certificate data and order, then
the system allows the update. If you sign the new version without using matching
-certificates, you will also need to assign a different package name to the
+certificates, you must also assign a different package name to the
application &mdash; in this case, the user installs the new version as a
completely new application. </li>
@@ -314,6 +313,13 @@ your key secure and why doing so is critically important to you and to users. In
particular, when you are generating your key, you should select strong passwords
for both the keystore and key.</p>
+<p class="warning"><strong>Warning:</strong> Keep the keystore file you generate with Keytool
+in a safe, secure place. You must use the same key to sign future versions of your application. If
+you republish your app with a new key, Google Play will consider it a new app. For more information
+on settings that must remain constant over the life of your app, see the Android Developer Blog post
+<a href="http://android-developers.blogspot.com/2011/06/things-that-cannot-change.html">Things
+That Cannot Change</a>.</p>
+
<table>
<tr>
<th>Keytool Option</th>
@@ -597,6 +603,10 @@ replace your authentic applications or corrupt them. Such a person could also
sign and distribute applications under your identity that attack other
applications or the system itself, or corrupt or steal user data. </p>
+<p>Your private key is required for signing all future versions of your application. If you lose or
+misplace your key, you will not be able to publish updates to your existing application. You cannot
+regenerate a previously generated key.</p>
+
<p>Your reputation as a developer entity depends on your securing your private
key properly, at all times, until the key is expired. Here are some tips for
keeping your key secure: </p>
@@ -612,7 +622,9 @@ which any user on your computer could access.</li>
options at the command line. </li>
<li>Do not give or lend anyone your private key, and do not let unauthorized
persons know your keystore and key passwords.</li>
+<li>Keep the keystore file containing your private key that you <a href="#cert">generate with the
+Keytool</a> in a safe, secure place.</li>
</ul>
<p>In general, if you follow common-sense precautions when generating, using,
-and storing your key, it will remain secure. </p> \ No newline at end of file
+and storing your key, it will remain secure. </p>
diff --git a/docs/html/tools/sdk/eclipse-adt.jd b/docs/html/tools/sdk/eclipse-adt.jd
index 243683ccb593..4adb7b29ffff 100644
--- a/docs/html/tools/sdk/eclipse-adt.jd
+++ b/docs/html/tools/sdk/eclipse-adt.jd
@@ -57,6 +57,63 @@ href="http://tools.android.com/knownissues">http://tools.android.com/knownissues
<div class="toggle-content opened">
<p><a href="#" onclick="return toggleContent(this)">
<img src="{@docRoot}assets/images/triangle-opened.png" class="toggle-content-img"
+ alt=""/>ADT 21.1.0</a> <em>(February 2013)</em>
+ </p>
+
+ <div class="toggle-content-toggleme">
+<dl>
+ <dt>Dependencies:</dt>
+
+ <dd>
+ <ul>
+ <li>Java 1.6 or higher is required for ADT 21.1.0.</li>
+ <li>Eclipse Helios (Version 3.6.2) or higher is required for ADT 21.1.0.</li>
+ <li>ADT 21.1.0 is designed for use with <a href="{@docRoot}tools/sdk/tools-notes.html">SDK
+ Tools r21.1.0</a>. If you haven't already installed SDK Tools r21.1.0 into your SDK, use the
+ Android SDK Manager to do so.</li>
+ </ul>
+ </dd>
+
+ <dt>General Notes:</dt>
+ <dd>
+ <ul>
+ <li>Added new <a href="{@docRoot}tools/projects/templates.html">code templates</a> for
+ notifications, blank fragments and list fragments.</li>
+ <li>Added support for resource rename refactoring. Renaming a resource XML file, drawable
+ icon, an {@code R.} field name or ID in the layout editor invokes a refactoring routine
+ to update all resource references.</li>
+ <li>Added more than 15 new Lint checks, including checks for overriding older APIs, XML
+ resource problems, graphic asset issues and manifest tags.
+ <li>Updated XML Editor to respond to refactoring shortcut keys such as <strong>Refactor
+ &gt; Rename</strong>.</li>
+ <li>Updated XML Editor to improve double click handling.</li>
+ <li>Added code completion improvements for custom views, theme references and class
+ references. For example, code completion in a {@code &lt;fragment android:name=””&gt;} tag
+ now suggests completion with a list of fragment classes. Similarly, code completion in the
+ manifest now offers implementations suitable for the given tag.</li>
+ <li>Updated the <strong>Project Import</strong> dialog so that it shows a table for all
+ imported projects where you can edit the name of the imported project.</li>
+ <li>Added support for layout aliases in the Layout Editor.</li>
+ </ul>
+ </dd>
+
+ <dt>Bug fixes:</dt>
+ <dd>
+ <ul>
+ <li>Fixed issued with refactoring support for renaming and moving classes and packages.
+ </li>
+ </ul>
+ </dd>
+
+</dl>
+</div>
+</div>
+
+
+
+<div class="toggle-content closed">
+ <p><a href="#" onclick="return toggleContent(this)">
+ <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
alt=""/>ADT 21.0.1</a> <em>(December 2012)</em>
</p>
diff --git a/docs/html/tools/sdk/tools-notes.jd b/docs/html/tools/sdk/tools-notes.jd
index 9349a4e2dbc0..a5b7eee19ad1 100644
--- a/docs/html/tools/sdk/tools-notes.jd
+++ b/docs/html/tools/sdk/tools-notes.jd
@@ -28,6 +28,41 @@ href="http://tools.android.com/knownissues">http://tools.android.com/knownissues
<div class="toggle-content opened">
<p><a href="#" onclick="return toggleContent(this)">
<img src="{@docRoot}assets/images/triangle-opened.png" class="toggle-content-img"
+ alt=""/>SDK Tools, Revision 21.1.0</a> <em>(February 2013)</em>
+ </p>
+
+ <div class="toggle-content-toggleme">
+
+ <dl>
+ <dt>Dependencies:</dt>
+ <dd>
+ <ul>
+ <li>Android SDK Platform-tools revision 16 or later.</li>
+ <li>If you are developing in Eclipse with ADT, note that the SDK Tools r21.1.0 is
+ designed for use with ADT 21.1.0 and later. If you haven't already, update your
+ <a href="{@docRoot}tools/sdk/eclipse-adt.html">ADT Plugin</a> to 21.1.0.</li>
+ <li>If you are developing outside Eclipse, you must have
+ <a href="http://ant.apache.org/">Apache Ant</a> 1.8 or later.</li>
+ </ul>
+ </dd>
+
+ <dt>General Notes:</dt>
+ <dd>
+ <ul>
+ <li>Improved error reporting in {@code dx} when dex merging fails in the build
+ system.</li>
+ <li>Added more than 15 new Lint checks, including checks for overriding older APIs, XML
+ resource problems, graphic asset issues and manifest tags.</li>
+ <li>Added new aapt feature to compile resources.</li>
+ </ul>
+ </dd>
+ </dl>
+ </div>
+</div>
+
+<div class="toggle-content closed">
+ <p><a href="#" onclick="return toggleContent(this)">
+ <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
alt=""/>SDK Tools, Revision 21.0.1</a> <em>(December 2012)</em>
</p>
@@ -40,7 +75,7 @@ href="http://tools.android.com/knownissues">http://tools.android.com/knownissues
<li>Android SDK Platform-tools revision 16 or later.</li>
<li>If you are developing in Eclipse with ADT, note that the SDK Tools r21.0.1 is
designed for use with ADT 21.0.1 and later. If you haven't already, update your
- <a href="{@docRoot}tools/sdk/eclipse-adt.html">ADT Plugin</a> to 21.0.0.</li>
+ <a href="{@docRoot}tools/sdk/eclipse-adt.html">ADT Plugin</a> to 21.0.1.</li>
<li>If you are developing outside Eclipse, you must have
<a href="http://ant.apache.org/">Apache Ant</a> 1.8 or later.</li>
</ul>
diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java
index 483d11afb8f3..9684f20c9b18 100644
--- a/graphics/java/android/graphics/Canvas.java
+++ b/graphics/java/android/graphics/Canvas.java
@@ -62,18 +62,6 @@ public class Canvas {
@SuppressWarnings({"UnusedDeclaration"})
private int mSurfaceFormat;
- /**
- * Flag for drawTextRun indicating left-to-right run direction.
- * @hide
- */
- public static final int DIRECTION_LTR = 0;
-
- /**
- * Flag for drawTextRun indicating right-to-left run direction.
- * @hide
- */
- public static final int DIRECTION_RTL = 1;
-
// Maximum bitmap size as defined in Skia's native code
// (see SkCanvas.cpp, SkDraw.cpp)
private static final int MAXMIMUM_BITMAP_SIZE = 32766;
@@ -1341,8 +1329,7 @@ public class Canvas {
(text.length - index - count)) < 0) {
throw new IndexOutOfBoundsException();
}
- native_drawText(mNativeCanvas, text, index, count, x, y, paint.mBidiFlags,
- paint.mNativePaint);
+ native_drawText(mNativeCanvas, text, index, count, x, y, paint.mNativePaint);
}
/**
@@ -1355,8 +1342,7 @@ public class Canvas {
* @param paint The paint used for the text (e.g. color, size, style)
*/
public void drawText(String text, float x, float y, Paint paint) {
- native_drawText(mNativeCanvas, text, 0, text.length(), x, y, paint.mBidiFlags,
- paint.mNativePaint);
+ native_drawText(mNativeCanvas, text, 0, text.length(), x, y, paint.mNativePaint);
}
/**
@@ -1374,8 +1360,7 @@ public class Canvas {
if ((start | end | (end - start) | (text.length() - end)) < 0) {
throw new IndexOutOfBoundsException();
}
- native_drawText(mNativeCanvas, text, start, end, x, y, paint.mBidiFlags,
- paint.mNativePaint);
+ native_drawText(mNativeCanvas, text, start, end, x, y, paint.mNativePaint);
}
/**
@@ -1394,16 +1379,14 @@ public class Canvas {
public void drawText(CharSequence text, int start, int end, float x, float y, Paint paint) {
if (text instanceof String || text instanceof SpannedString ||
text instanceof SpannableString) {
- native_drawText(mNativeCanvas, text.toString(), start, end, x, y,
- paint.mBidiFlags, paint.mNativePaint);
+ native_drawText(mNativeCanvas, text.toString(), start, end, x, y, paint.mNativePaint);
} else if (text instanceof GraphicsOperations) {
((GraphicsOperations) text).drawText(this, start, end, x, y,
paint);
} else {
char[] buf = TemporaryBuffer.obtain(end - start);
TextUtils.getChars(text, start, end, buf, 0);
- native_drawText(mNativeCanvas, buf, 0, end - start, x, y,
- paint.mBidiFlags, paint.mNativePaint);
+ native_drawText(mNativeCanvas, buf, 0, end - start, x, y, paint.mNativePaint);
TemporaryBuffer.recycle(buf);
}
}
@@ -1424,13 +1407,11 @@ public class Canvas {
* + count.
* @param x the x position at which to draw the text
* @param y the y position at which to draw the text
- * @param dir the run direction, either {@link #DIRECTION_LTR} or
- * {@link #DIRECTION_RTL}.
* @param paint the paint
* @hide
*/
public void drawTextRun(char[] text, int index, int count, int contextIndex, int contextCount,
- float x, float y, int dir, Paint paint) {
+ float x, float y, Paint paint) {
if (text == null) {
throw new NullPointerException("text is null");
@@ -1441,12 +1422,9 @@ public class Canvas {
if ((index | count | text.length - index - count) < 0) {
throw new IndexOutOfBoundsException();
}
- if (dir != DIRECTION_LTR && dir != DIRECTION_RTL) {
- throw new IllegalArgumentException("unknown dir: " + dir);
- }
native_drawTextRun(mNativeCanvas, text, index, count,
- contextIndex, contextCount, x, y, dir, paint.mNativePaint);
+ contextIndex, contextCount, x, y, paint.mNativePaint);
}
/**
@@ -1462,12 +1440,11 @@ public class Canvas {
* position can be used for shaping context.
* @param x the x position at which to draw the text
* @param y the y position at which to draw the text
- * @param dir the run direction, either 0 for LTR or 1 for RTL.
* @param paint the paint
* @hide
*/
public void drawTextRun(CharSequence text, int start, int end, int contextStart, int contextEnd,
- float x, float y, int dir, Paint paint) {
+ float x, float y, Paint paint) {
if (text == null) {
throw new NullPointerException("text is null");
@@ -1479,22 +1456,20 @@ public class Canvas {
throw new IndexOutOfBoundsException();
}
- int flags = dir == 0 ? 0 : 1;
-
if (text instanceof String || text instanceof SpannedString ||
text instanceof SpannableString) {
native_drawTextRun(mNativeCanvas, text.toString(), start, end,
- contextStart, contextEnd, x, y, flags, paint.mNativePaint);
+ contextStart, contextEnd, x, y, paint.mNativePaint);
} else if (text instanceof GraphicsOperations) {
((GraphicsOperations) text).drawTextRun(this, start, end,
- contextStart, contextEnd, x, y, flags, paint);
+ contextStart, contextEnd, x, y, paint);
} else {
int contextLen = contextEnd - contextStart;
int len = end - start;
char[] buf = TemporaryBuffer.obtain(contextLen);
TextUtils.getChars(text, contextStart, contextEnd, buf, 0);
native_drawTextRun(mNativeCanvas, buf, start - contextStart, len,
- 0, contextLen, x, y, flags, paint.mNativePaint);
+ 0, contextLen, x, y, paint.mNativePaint);
TemporaryBuffer.recycle(buf);
}
}
@@ -1560,8 +1535,7 @@ public class Canvas {
throw new ArrayIndexOutOfBoundsException();
}
native_drawTextOnPath(mNativeCanvas, text, index, count,
- path.ni(), hOffset, vOffset,
- paint.mBidiFlags, paint.mNativePaint);
+ path.ni(), hOffset, vOffset, paint.mNativePaint);
}
/**
@@ -1580,7 +1554,7 @@ public class Canvas {
public void drawTextOnPath(String text, Path path, float hOffset, float vOffset, Paint paint) {
if (text.length() > 0) {
native_drawTextOnPath(mNativeCanvas, text, path.ni(), hOffset, vOffset,
- paint.mBidiFlags, paint.mNativePaint);
+ paint.mNativePaint);
}
}
@@ -1737,18 +1711,18 @@ public class Canvas {
private static native void native_drawText(int nativeCanvas, char[] text,
int index, int count, float x,
- float y, int flags, int paint);
+ float y, int paint);
private static native void native_drawText(int nativeCanvas, String text,
int start, int end, float x,
- float y, int flags, int paint);
+ float y, int paint);
private static native void native_drawTextRun(int nativeCanvas, String text,
int start, int end, int contextStart, int contextEnd,
- float x, float y, int flags, int paint);
+ float x, float y, int paint);
private static native void native_drawTextRun(int nativeCanvas, char[] text,
int start, int count, int contextStart, int contextCount,
- float x, float y, int flags, int paint);
+ float x, float y, int paint);
private static native void native_drawPosText(int nativeCanvas,
char[] text, int index,
@@ -1761,13 +1735,13 @@ public class Canvas {
char[] text, int index,
int count, int path,
float hOffset,
- float vOffset, int bidiFlags,
+ float vOffset,
int paint);
private static native void native_drawTextOnPath(int nativeCanvas,
String text, int path,
float hOffset,
float vOffset,
- int flags, int paint);
+ int paint);
private static native void native_drawPicture(int nativeCanvas,
int nativePicture);
private static native void finalizer(int nativeCanvas);
diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java
index 3285e518c920..3a83d121516e 100644
--- a/graphics/java/android/graphics/Paint.java
+++ b/graphics/java/android/graphics/Paint.java
@@ -69,11 +69,6 @@ public class Paint {
*/
public int shadowColor;
- /**
- * @hide
- */
- public int mBidiFlags = BIDI_DEFAULT_LTR;
-
static final Style[] sStyleArray = {
Style.FILL, Style.STROKE, Style.FILL_AND_STROKE
};
@@ -120,74 +115,6 @@ public class Paint {
public static final int HINTING_ON = 0x1;
/**
- * Bidi flag to set LTR paragraph direction.
- *
- * @hide
- */
- public static final int BIDI_LTR = 0x0;
-
- /**
- * Bidi flag to set RTL paragraph direction.
- *
- * @hide
- */
- public static final int BIDI_RTL = 0x1;
-
- /**
- * Bidi flag to detect paragraph direction via heuristics, defaulting to
- * LTR.
- *
- * @hide
- */
- public static final int BIDI_DEFAULT_LTR = 0x2;
-
- /**
- * Bidi flag to detect paragraph direction via heuristics, defaulting to
- * RTL.
- *
- * @hide
- */
- public static final int BIDI_DEFAULT_RTL = 0x3;
-
- /**
- * Bidi flag to override direction to all LTR (ignore bidi).
- *
- * @hide
- */
- public static final int BIDI_FORCE_LTR = 0x4;
-
- /**
- * Bidi flag to override direction to all RTL (ignore bidi).
- *
- * @hide
- */
- public static final int BIDI_FORCE_RTL = 0x5;
-
- /**
- * Maximum Bidi flag value.
- * @hide
- */
- private static final int BIDI_MAX_FLAG_VALUE = BIDI_FORCE_RTL;
-
- /**
- * Mask for bidi flags.
- * @hide
- */
- private static final int BIDI_FLAG_MASK = 0x7;
-
- /**
- * Flag for getTextRunAdvances indicating left-to-right run direction.
- * @hide
- */
- public static final int DIRECTION_LTR = 0;
-
- /**
- * Flag for getTextRunAdvances indicating right-to-left run direction.
- * @hide
- */
- public static final int DIRECTION_RTL = 1;
-
- /**
* Option for getTextRunCursor to compute the valid cursor after
* offset or the limit of the context, whichever is less.
* @hide
@@ -395,7 +322,6 @@ public class Paint {
shadowRadius = 0;
shadowColor = 0;
- mBidiFlags = BIDI_DEFAULT_LTR;
setTextLocale(Locale.getDefault());
}
@@ -435,7 +361,6 @@ public class Paint {
shadowRadius = paint.shadowRadius;
shadowColor = paint.shadowColor;
- mBidiFlags = paint.mBidiFlags;
mLocale = paint.mLocale;
}
@@ -452,29 +377,6 @@ public class Paint {
}
/**
- * Return the bidi flags on the paint.
- *
- * @return the bidi flags on the paint
- * @hide
- */
- public int getBidiFlags() {
- return mBidiFlags;
- }
-
- /**
- * Set the bidi flags on the paint.
- * @hide
- */
- public void setBidiFlags(int flags) {
- // only flag value is the 3-bit BIDI control setting
- flags &= BIDI_FLAG_MASK;
- if (flags > BIDI_MAX_FLAG_VALUE) {
- throw new IllegalArgumentException("unknown bidi flag: " + flags);
- }
- mBidiFlags = flags;
- }
-
- /**
* Return the paint's flags. Use the Flag enum to test flag values.
*
* @return the paint's flags (see enums ending in _Flag for bit masks)
@@ -1666,76 +1568,19 @@ public class Paint {
}
/**
- * Return the glyph Ids for the characters in the string.
- *
- * @param text The text to measure
- * @param start The index of the first char to to measure
- * @param end The end of the text slice to measure
- * @param contextStart the index of the first character to use for shaping context,
- * must be <= start
- * @param contextEnd the index past the last character to use for shaping context,
- * must be >= end
- * @param flags the flags to control the advances, either {@link #DIRECTION_LTR}
- * or {@link #DIRECTION_RTL}
- * @param glyphs array to receive the glyph Ids of the characters.
- * Must be at least a large as the text.
- * @return the number of glyphs in the returned array
- *
- * @hide
- *
- * Used only for BiDi / RTL Tests
- */
- public int getTextGlyphs(String text, int start, int end, int contextStart, int contextEnd,
- int flags, char[] glyphs) {
- if (text == null) {
- throw new IllegalArgumentException("text cannot be null");
- }
- if (flags != DIRECTION_LTR && flags != DIRECTION_RTL) {
- throw new IllegalArgumentException("unknown flags value: " + flags);
- }
- if ((start | end | contextStart | contextEnd | (end - start)
- | (start - contextStart) | (contextEnd - end) | (text.length() - end)
- | (text.length() - contextEnd)) < 0) {
- throw new IndexOutOfBoundsException();
- }
- if (end - start > glyphs.length) {
- throw new ArrayIndexOutOfBoundsException();
- }
- return native_getTextGlyphs(mNativePaint, text, start, end, contextStart, contextEnd,
- flags, glyphs);
- }
-
- /**
* Convenience overload that takes a char array instead of a
* String.
*
- * @see #getTextRunAdvances(String, int, int, int, int, int, float[], int)
+ * @see #getTextRunAdvances(String, int, int, int, int, float[], int)
* @hide
*/
public float getTextRunAdvances(char[] chars, int index, int count,
- int contextIndex, int contextCount, int flags, float[] advances,
+ int contextIndex, int contextCount, float[] advances,
int advancesIndex) {
- return getTextRunAdvances(chars, index, count, contextIndex, contextCount, flags,
- advances, advancesIndex, 0 /* use Harfbuzz*/);
- }
-
- /**
- * Convenience overload that takes a char array instead of a
- * String.
- *
- * @see #getTextRunAdvances(String, int, int, int, int, int, float[], int, int)
- * @hide
- */
- public float getTextRunAdvances(char[] chars, int index, int count,
- int contextIndex, int contextCount, int flags, float[] advances,
- int advancesIndex, int reserved) {
if (chars == null) {
throw new IllegalArgumentException("text cannot be null");
}
- if (flags != DIRECTION_LTR && flags != DIRECTION_RTL) {
- throw new IllegalArgumentException("unknown flags value: " + flags);
- }
if ((index | count | contextIndex | contextCount | advancesIndex
| (index - contextIndex) | (contextCount - count)
| ((contextIndex + contextCount) - (index + count))
@@ -1750,13 +1595,13 @@ public class Paint {
}
if (!mHasCompatScaling) {
return native_getTextRunAdvances(mNativePaint, chars, index, count,
- contextIndex, contextCount, flags, advances, advancesIndex, reserved);
+ contextIndex, contextCount, advances, advancesIndex);
}
final float oldSize = getTextSize();
setTextSize(oldSize * mCompatScaling);
float res = native_getTextRunAdvances(mNativePaint, chars, index, count,
- contextIndex, contextCount, flags, advances, advancesIndex, reserved);
+ contextIndex, contextCount, advances, advancesIndex);
setTextSize(oldSize);
if (advances != null) {
@@ -1771,26 +1616,12 @@ public class Paint {
* Convenience overload that takes a CharSequence instead of a
* String.
*
- * @see #getTextRunAdvances(String, int, int, int, int, int, float[], int)
+ * @see #getTextRunAdvances(String, int, int, int, int, float[], int)
* @hide
*/
public float getTextRunAdvances(CharSequence text, int start, int end,
- int contextStart, int contextEnd, int flags, float[] advances,
+ int contextStart, int contextEnd, float[] advances,
int advancesIndex) {
- return getTextRunAdvances(text, start, end, contextStart, contextEnd, flags,
- advances, advancesIndex, 0 /* use Harfbuzz */);
- }
-
- /**
- * Convenience overload that takes a CharSequence instead of a
- * String.
- *
- * @see #getTextRunAdvances(String, int, int, int, int, int, float[], int)
- * @hide
- */
- public float getTextRunAdvances(CharSequence text, int start, int end,
- int contextStart, int contextEnd, int flags, float[] advances,
- int advancesIndex, int reserved) {
if (text == null) {
throw new IllegalArgumentException("text cannot be null");
@@ -1805,16 +1636,16 @@ public class Paint {
if (text instanceof String) {
return getTextRunAdvances((String) text, start, end,
- contextStart, contextEnd, flags, advances, advancesIndex, reserved);
+ contextStart, contextEnd, advances, advancesIndex);
}
if (text instanceof SpannedString ||
text instanceof SpannableString) {
return getTextRunAdvances(text.toString(), start, end,
- contextStart, contextEnd, flags, advances, advancesIndex, reserved);
+ contextStart, contextEnd, advances, advancesIndex);
}
if (text instanceof GraphicsOperations) {
return ((GraphicsOperations) text).getTextRunAdvances(start, end,
- contextStart, contextEnd, flags, advances, advancesIndex, this);
+ contextStart, contextEnd, advances, advancesIndex, this);
}
if (text.length() == 0 || end == start) {
return 0f;
@@ -1825,7 +1656,7 @@ public class Paint {
char[] buf = TemporaryBuffer.obtain(contextLen);
TextUtils.getChars(text, contextStart, contextEnd, buf, 0);
float result = getTextRunAdvances(buf, start - contextStart, len,
- 0, contextLen, flags, advances, advancesIndex, reserved);
+ 0, contextLen, advances, advancesIndex);
TemporaryBuffer.recycle(buf);
return result;
}
@@ -1862,74 +1693,20 @@ public class Paint {
* must be <= start
* @param contextEnd the index past the last character to use for shaping context,
* must be >= end
- * @param flags the flags to control the advances, either {@link #DIRECTION_LTR}
- * or {@link #DIRECTION_RTL}
- * @param advances array to receive the advances, must have room for all advances,
- * can be null if only total advance is needed
- * @param advancesIndex the position in advances at which to put the
- * advance corresponding to the character at start
- * @return the total advance
- *
- * @hide
- */
- public float getTextRunAdvances(String text, int start, int end, int contextStart,
- int contextEnd, int flags, float[] advances, int advancesIndex) {
- return getTextRunAdvances(text, start, end, contextStart, contextEnd, flags,
- advances, advancesIndex, 0 /* use Harfbuzz*/);
- }
-
- /**
- * Returns the total advance width for the characters in the run
- * between start and end, and if advances is not null, the advance
- * assigned to each of these characters (java chars).
- *
- * <p>The trailing surrogate in a valid surrogate pair is assigned
- * an advance of 0. Thus the number of returned advances is
- * always equal to count, not to the number of unicode codepoints
- * represented by the run.
- *
- * <p>In the case of conjuncts or combining marks, the total
- * advance is assigned to the first logical character, and the
- * following characters are assigned an advance of 0.
- *
- * <p>This generates the sum of the advances of glyphs for
- * characters in a reordered cluster as the width of the first
- * logical character in the cluster, and 0 for the widths of all
- * other characters in the cluster. In effect, such clusters are
- * treated like conjuncts.
- *
- * <p>The shaping bounds limit the amount of context available
- * outside start and end that can be used for shaping analysis.
- * These bounds typically reflect changes in bidi level or font
- * metrics across which shaping does not occur.
- *
- * @param text the text to measure. Cannot be null.
- * @param start the index of the first character to measure
- * @param end the index past the last character to measure
- * @param contextStart the index of the first character to use for shaping context,
- * must be <= start
- * @param contextEnd the index past the last character to use for shaping context,
- * must be >= end
- * @param flags the flags to control the advances, either {@link #DIRECTION_LTR}
- * or {@link #DIRECTION_RTL}
* @param advances array to receive the advances, must have room for all advances,
* can be null if only total advance is needed
* @param advancesIndex the position in advances at which to put the
* advance corresponding to the character at start
- * @param reserved int reserved value
* @return the total advance
*
* @hide
*/
public float getTextRunAdvances(String text, int start, int end, int contextStart,
- int contextEnd, int flags, float[] advances, int advancesIndex, int reserved) {
+ int contextEnd, float[] advances, int advancesIndex) {
if (text == null) {
throw new IllegalArgumentException("text cannot be null");
}
- if (flags != DIRECTION_LTR && flags != DIRECTION_RTL) {
- throw new IllegalArgumentException("unknown flags value: " + flags);
- }
if ((start | end | contextStart | contextEnd | advancesIndex | (end - start)
| (start - contextStart) | (contextEnd - end)
| (text.length() - contextEnd)
@@ -1944,13 +1721,13 @@ public class Paint {
if (!mHasCompatScaling) {
return native_getTextRunAdvances(mNativePaint, text, start, end,
- contextStart, contextEnd, flags, advances, advancesIndex, reserved);
+ contextStart, contextEnd, advances, advancesIndex);
}
final float oldSize = getTextSize();
setTextSize(oldSize * mCompatScaling);
float totalAdvance = native_getTextRunAdvances(mNativePaint, text, start, end,
- contextStart, contextEnd, flags, advances, advancesIndex, reserved);
+ contextStart, contextEnd, advances, advancesIndex);
setTextSize(oldSize);
if (advances != null) {
@@ -1979,7 +1756,6 @@ public class Paint {
* @param text the text
* @param contextStart the start of the context
* @param contextLength the length of the context
- * @param flags either {@link #DIRECTION_RTL} or {@link #DIRECTION_LTR}
* @param offset the cursor position to move from
* @param cursorOpt how to move the cursor, one of {@link #CURSOR_AFTER},
* {@link #CURSOR_AT_OR_AFTER}, {@link #CURSOR_BEFORE},
@@ -1988,7 +1764,7 @@ public class Paint {
* @hide
*/
public int getTextRunCursor(char[] text, int contextStart, int contextLength,
- int flags, int offset, int cursorOpt) {
+ int offset, int cursorOpt) {
int contextEnd = contextStart + contextLength;
if (((contextStart | contextEnd | offset | (contextEnd - contextStart)
| (offset - contextStart) | (contextEnd - offset)
@@ -1998,7 +1774,7 @@ public class Paint {
}
return native_getTextRunCursor(mNativePaint, text,
- contextStart, contextLength, flags, offset, cursorOpt);
+ contextStart, contextLength, offset, cursorOpt);
}
/**
@@ -2019,7 +1795,6 @@ public class Paint {
* @param text the text
* @param contextStart the start of the context
* @param contextEnd the end of the context
- * @param flags either {@link #DIRECTION_RTL} or {@link #DIRECTION_LTR}
* @param offset the cursor position to move from
* @param cursorOpt how to move the cursor, one of {@link #CURSOR_AFTER},
* {@link #CURSOR_AT_OR_AFTER}, {@link #CURSOR_BEFORE},
@@ -2028,22 +1803,22 @@ public class Paint {
* @hide
*/
public int getTextRunCursor(CharSequence text, int contextStart,
- int contextEnd, int flags, int offset, int cursorOpt) {
+ int contextEnd, int offset, int cursorOpt) {
if (text instanceof String || text instanceof SpannedString ||
text instanceof SpannableString) {
return getTextRunCursor(text.toString(), contextStart, contextEnd,
- flags, offset, cursorOpt);
+ offset, cursorOpt);
}
if (text instanceof GraphicsOperations) {
return ((GraphicsOperations) text).getTextRunCursor(
- contextStart, contextEnd, flags, offset, cursorOpt, this);
+ contextStart, contextEnd, offset, cursorOpt, this);
}
int contextLen = contextEnd - contextStart;
char[] buf = TemporaryBuffer.obtain(contextLen);
TextUtils.getChars(text, contextStart, contextEnd, buf, 0);
- int result = getTextRunCursor(buf, 0, contextLen, flags, offset - contextStart, cursorOpt);
+ int result = getTextRunCursor(buf, 0, contextLen, offset - contextStart, cursorOpt);
TemporaryBuffer.recycle(buf);
return result;
}
@@ -2066,7 +1841,6 @@ public class Paint {
* @param text the text
* @param contextStart the start of the context
* @param contextEnd the end of the context
- * @param flags either {@link #DIRECTION_RTL} or {@link #DIRECTION_LTR}
* @param offset the cursor position to move from
* @param cursorOpt how to move the cursor, one of {@link #CURSOR_AFTER},
* {@link #CURSOR_AT_OR_AFTER}, {@link #CURSOR_BEFORE},
@@ -2084,7 +1858,7 @@ public class Paint {
}
return native_getTextRunCursor(mNativePaint, text,
- contextStart, contextEnd, flags, offset, cursorOpt);
+ contextStart, contextEnd, offset, cursorOpt);
}
/**
@@ -2105,7 +1879,7 @@ public class Paint {
if ((index | count) < 0 || index + count > text.length) {
throw new ArrayIndexOutOfBoundsException();
}
- native_getTextPath(mNativePaint, mBidiFlags, text, index, count, x, y,
+ native_getTextPath(mNativePaint, text, index, count, x, y,
path.ni());
}
@@ -2127,7 +1901,7 @@ public class Paint {
if ((start | end | (end - start) | (text.length() - end)) < 0) {
throw new IndexOutOfBoundsException();
}
- native_getTextPath(mNativePaint, mBidiFlags, text, start, end, x, y,
+ native_getTextPath(mNativePaint, text, start, end, x, y,
path.ni());
}
@@ -2219,26 +1993,22 @@ public class Paint {
private static native int native_getTextWidths(int native_object,
String text, int start, int end, float[] widths);
- private static native int native_getTextGlyphs(int native_object,
- String text, int start, int end, int contextStart, int contextEnd,
- int flags, char[] glyphs);
-
private static native float native_getTextRunAdvances(int native_object,
char[] text, int index, int count, int contextIndex, int contextCount,
- int flags, float[] advances, int advancesIndex, int reserved);
+ float[] advances, int advancesIndex);
private static native float native_getTextRunAdvances(int native_object,
String text, int start, int end, int contextStart, int contextEnd,
- int flags, float[] advances, int advancesIndex, int reserved);
+ float[] advances, int advancesIndex);
private native int native_getTextRunCursor(int native_object, char[] text,
- int contextStart, int contextLength, int flags, int offset, int cursorOpt);
+ int contextStart, int contextLength, int offset, int cursorOpt);
private native int native_getTextRunCursor(int native_object, String text,
- int contextStart, int contextEnd, int flags, int offset, int cursorOpt);
+ int contextStart, int contextEnd, int offset, int cursorOpt);
- private static native void native_getTextPath(int native_object, int bidiFlags,
- char[] text, int index, int count, float x, float y, int path);
- private static native void native_getTextPath(int native_object, int bidiFlags,
- String text, int start, int end, float x, float y, int path);
+ private static native void native_getTextPath(int native_object, char[] text,
+ int index, int count, float x, float y, int path);
+ private static native void native_getTextPath(int native_object, String text,
+ int start, int end, float x, float y, int path);
private static native void nativeGetStringBounds(int nativePaint,
String text, int start, int end, Rect bounds);
private static native void nativeGetCharArrayBounds(int nativePaint,
diff --git a/graphics/java/android/renderscript/Script.java b/graphics/java/android/renderscript/Script.java
index b53ba0d7e80a..b4055882ab2a 100644
--- a/graphics/java/android/renderscript/Script.java
+++ b/graphics/java/android/renderscript/Script.java
@@ -171,6 +171,11 @@ public class Script extends BaseObj {
throw new RSIllegalArgumentException(
"At least one of ain or aout is required to be non-null.");
}
+
+ if (sc == null) {
+ forEach(slot, ain, aout, v);
+ return;
+ }
int in_id = 0;
if (ain != null) {
in_id = ain.getID(mRS);
diff --git a/include/androidfw/ResourceTypes.h b/include/androidfw/ResourceTypes.h
index 48f5bf3ec162..5b45d708726c 100644
--- a/include/androidfw/ResourceTypes.h
+++ b/include/androidfw/ResourceTypes.h
@@ -855,6 +855,7 @@ struct ResTable_config
DENSITY_HIGH = ACONFIGURATION_DENSITY_HIGH,
DENSITY_XHIGH = ACONFIGURATION_DENSITY_XHIGH,
DENSITY_XXHIGH = ACONFIGURATION_DENSITY_XXHIGH,
+ DENSITY_XXXHIGH = ACONFIGURATION_DENSITY_XXXHIGH,
DENSITY_NONE = ACONFIGURATION_DENSITY_NONE
};
diff --git a/libs/hwui/Android.mk b/libs/hwui/Android.mk
index 2a6315357f5f..edfad4ee6426 100644
--- a/libs/hwui/Android.mk
+++ b/libs/hwui/Android.mk
@@ -28,6 +28,7 @@ ifeq ($(USE_OPENGL_RENDERER),true)
PathTessellator.cpp \
Program.cpp \
ProgramCache.cpp \
+ RenderBufferCache.cpp \
ResourceCache.cpp \
ShapeCache.cpp \
SkiaColorFilter.cpp \
diff --git a/libs/hwui/Caches.cpp b/libs/hwui/Caches.cpp
index 492bb7d171f5..74201d1fda58 100644
--- a/libs/hwui/Caches.cpp
+++ b/libs/hwui/Caches.cpp
@@ -186,6 +186,8 @@ void Caches::dumpMemoryUsage(String8 &log) {
textureCache.getSize(), textureCache.getMaxSize());
log.appendFormat(" LayerCache %8d / %8d\n",
layerCache.getSize(), layerCache.getMaxSize());
+ log.appendFormat(" RenderBufferCache %8d / %8d\n",
+ renderBufferCache.getSize(), renderBufferCache.getMaxSize());
log.appendFormat(" GradientCache %8d / %8d\n",
gradientCache.getSize(), gradientCache.getMaxSize());
log.appendFormat(" PathCache %8d / %8d\n",
@@ -215,6 +217,7 @@ void Caches::dumpMemoryUsage(String8 &log) {
uint32_t total = 0;
total += textureCache.getSize();
total += layerCache.getSize();
+ total += renderBufferCache.getSize();
total += gradientCache.getSize();
total += pathCache.getSize();
total += dropShadowCache.getSize();
@@ -298,6 +301,7 @@ void Caches::flush(FlushMode mode) {
// fall through
case kFlushMode_Layers:
layerCache.clear();
+ renderBufferCache.clear();
break;
}
diff --git a/libs/hwui/Caches.h b/libs/hwui/Caches.h
index 0fa54fb9f2f2..d70c0e3fe77a 100644
--- a/libs/hwui/Caches.h
+++ b/libs/hwui/Caches.h
@@ -29,6 +29,7 @@
#include "GammaFontRenderer.h"
#include "TextureCache.h"
#include "LayerCache.h"
+#include "RenderBufferCache.h"
#include "GradientCache.h"
#include "PatchCache.h"
#include "ProgramCache.h"
@@ -249,6 +250,7 @@ public:
TextureCache textureCache;
LayerCache layerCache;
+ RenderBufferCache renderBufferCache;
GradientCache gradientCache;
ProgramCache programCache;
PathCache pathCache;
diff --git a/libs/hwui/Debug.h b/libs/hwui/Debug.h
index 5f8baacb710c..20eb5e123e37 100644
--- a/libs/hwui/Debug.h
+++ b/libs/hwui/Debug.h
@@ -44,6 +44,9 @@
// Turn on to display info about layers
#define DEBUG_LAYERS 0
+// Turn on to display info about render buffers
+#define DEBUG_RENDER_BUFFERS 0
+
// Turn on to make stencil operations easier to debug
#define DEBUG_STENCIL 0
diff --git a/libs/hwui/Layer.cpp b/libs/hwui/Layer.cpp
index 9247b1da3df2..1899002004c4 100644
--- a/libs/hwui/Layer.cpp
+++ b/libs/hwui/Layer.cpp
@@ -101,14 +101,13 @@ bool Layer::resize(const uint32_t width, const uint32_t height) {
void Layer::removeFbo(bool flush) {
if (stencil) {
- // TODO: recycle & cache instead of simply deleting
GLuint previousFbo;
glGetIntegerv(GL_FRAMEBUFFER_BINDING, (GLint*) &previousFbo);
if (fbo != previousFbo) glBindFramebuffer(GL_FRAMEBUFFER, fbo);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0);
if (fbo != previousFbo) glBindFramebuffer(GL_FRAMEBUFFER, previousFbo);
- delete stencil;
+ Caches::getInstance().renderBufferCache.put(stencil);
stencil = NULL;
}
diff --git a/libs/hwui/LayerCache.cpp b/libs/hwui/LayerCache.cpp
index 427846459162..a0709afa010f 100644
--- a/libs/hwui/LayerCache.cpp
+++ b/libs/hwui/LayerCache.cpp
@@ -21,7 +21,6 @@
#include <utils/Log.h>
#include "Caches.h"
-#include "Debug.h"
#include "LayerCache.h"
#include "Properties.h"
diff --git a/libs/hwui/LayerCache.h b/libs/hwui/LayerCache.h
index 7720b4232ae9..221bfe000de1 100644
--- a/libs/hwui/LayerCache.h
+++ b/libs/hwui/LayerCache.h
@@ -19,7 +19,6 @@
#include "Debug.h"
#include "Layer.h"
-#include "Properties.h"
#include "utils/SortedList.h"
namespace android {
@@ -54,7 +53,7 @@ public:
* size of the cache goes down.
*
* @param width The desired width of the layer
- * @param width The desired height of the layer
+ * @param height The desired height of the layer
*/
Layer* get(const uint32_t width, const uint32_t height);
@@ -91,6 +90,7 @@ public:
*/
void dump();
+private:
struct LayerEntry {
LayerEntry():
mLayer(NULL), mWidth(0), mHeight(0) {
@@ -115,12 +115,19 @@ public:
return compare(*this, other) != 0;
}
+ friend inline int strictly_order_type(const LayerEntry& lhs, const LayerEntry& rhs) {
+ return LayerEntry::compare(lhs, rhs) < 0;
+ }
+
+ friend inline int compare_type(const LayerEntry& lhs, const LayerEntry& rhs) {
+ return LayerEntry::compare(lhs, rhs);
+ }
+
Layer* mLayer;
uint32_t mWidth;
uint32_t mHeight;
}; // struct LayerEntry
-private:
void deleteLayer(Layer* layer);
SortedList<LayerEntry> mCache;
@@ -129,15 +136,6 @@ private:
uint32_t mMaxSize;
}; // class LayerCache
-inline int strictly_order_type(const LayerCache::LayerEntry& lhs,
- const LayerCache::LayerEntry& rhs) {
- return LayerCache::LayerEntry::compare(lhs, rhs) < 0;
-}
-
-inline int compare_type(const LayerCache::LayerEntry& lhs, const LayerCache::LayerEntry& rhs) {
- return LayerCache::LayerEntry::compare(lhs, rhs);
-}
-
}; // namespace uirenderer
}; // namespace android
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 62f268dab291..2431e54cde8f 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -1273,11 +1273,8 @@ void OpenGLRenderer::attachStencilBufferToLayer(Layer* layer) {
// attach the new render buffer then turn tiling back on
endTiling();
- RenderBuffer* buffer = new RenderBuffer(
+ RenderBuffer* buffer = mCaches.renderBufferCache.get(
Stencil::getSmallestStencilFormat(), layer->getWidth(), layer->getHeight());
- buffer->bind();
- buffer->allocate();
-
layer->setStencilRenderBuffer(buffer);
startTiling(layer->clipRect, layer->layer.getHeight());
diff --git a/libs/hwui/Properties.h b/libs/hwui/Properties.h
index 1e8765bae9a2..0c7524203826 100644
--- a/libs/hwui/Properties.h
+++ b/libs/hwui/Properties.h
@@ -34,9 +34,9 @@
// Textures used by layers must have dimensions multiples of this number
#define LAYER_SIZE 64
-// Defines the size in bits of the stencil buffer
+// Defines the size in bits of the stencil buffer for the framebuffer
// Note: Only 1 bit is required for clipping but more bits are required
-// to properly implement the winding fill rule when rasterizing paths
+// to properly implement overdraw debugging
#define STENCIL_BUFFER_SIZE 8
/**
@@ -85,6 +85,7 @@ enum DebugLevel {
// These properties are defined in mega-bytes
#define PROPERTY_TEXTURE_CACHE_SIZE "ro.hwui.texture_cache_size"
#define PROPERTY_LAYER_CACHE_SIZE "ro.hwui.layer_cache_size"
+#define PROPERTY_RENDER_BUFFER_CACHE_SIZE "ro.hwui.r_buffer_cache_size"
#define PROPERTY_GRADIENT_CACHE_SIZE "ro.hwui.gradient_cache_size"
#define PROPERTY_PATH_CACHE_SIZE "ro.hwui.path_cache_size"
#define PROPERTY_SHAPE_CACHE_SIZE "ro.hwui.shape_cache_size"
@@ -130,6 +131,7 @@ enum DebugLevel {
#define DEFAULT_TEXTURE_CACHE_SIZE 24.0f
#define DEFAULT_LAYER_CACHE_SIZE 16.0f
+#define DEFAULT_RENDER_BUFFER_CACHE_SIZE 2.0f
#define DEFAULT_PATH_CACHE_SIZE 4.0f
#define DEFAULT_SHAPE_CACHE_SIZE 1.0f
#define DEFAULT_PATCH_CACHE_SIZE 512
diff --git a/libs/hwui/RenderBuffer.h b/libs/hwui/RenderBuffer.h
index 927f2659abd0..a9ad3d7df5dd 100644
--- a/libs/hwui/RenderBuffer.h
+++ b/libs/hwui/RenderBuffer.h
@@ -39,7 +39,7 @@ struct RenderBuffer {
}
~RenderBuffer() {
- if (mName && mAllocated) {
+ if (mName) {
glDeleteRenderbuffers(1, &mName);
}
}
@@ -154,6 +154,29 @@ struct RenderBuffer {
return false;
}
+ /**
+ * Returns the name of the specified render buffer format.
+ */
+ static const char* formatName(GLenum format) {
+ switch (format) {
+ case GL_STENCIL_INDEX8:
+ return "STENCIL_8";
+ case GL_STENCIL_INDEX1_OES:
+ return "STENCIL_1";
+ case GL_STENCIL_INDEX4_OES:
+ return "STENCIL_4";
+ case GL_DEPTH_COMPONENT16:
+ return "DEPTH_16";
+ case GL_RGBA4:
+ return "RGBA_444";
+ case GL_RGB565:
+ return "RGB_565";
+ case GL_RGB5_A1:
+ return "RGBA_5551";
+ }
+ return "Unknown";
+ }
+
private:
GLenum mFormat;
diff --git a/libs/hwui/RenderBufferCache.cpp b/libs/hwui/RenderBufferCache.cpp
new file mode 100644
index 000000000000..830a13ab28a7
--- /dev/null
+++ b/libs/hwui/RenderBufferCache.cpp
@@ -0,0 +1,166 @@
+/*
+ * Copyright (C) 2013 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.
+ */
+
+#define LOG_TAG "OpenGLRenderer"
+
+#include <utils/Log.h>
+
+#include "Debug.h"
+#include "Properties.h"
+#include "RenderBufferCache.h"
+
+namespace android {
+namespace uirenderer {
+
+///////////////////////////////////////////////////////////////////////////////
+// Defines
+///////////////////////////////////////////////////////////////////////////////
+
+// Debug
+#if DEBUG_RENDER_BUFFERS
+ #define RENDER_BUFFER_LOGD(...) ALOGD(__VA_ARGS__)
+#else
+ #define RENDER_BUFFER_LOGD(...)
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// Constructors/destructor
+///////////////////////////////////////////////////////////////////////////////
+
+RenderBufferCache::RenderBufferCache(): mSize(0), mMaxSize(MB(DEFAULT_RENDER_BUFFER_CACHE_SIZE)) {
+ char property[PROPERTY_VALUE_MAX];
+ if (property_get(PROPERTY_RENDER_BUFFER_CACHE_SIZE, property, NULL) > 0) {
+ INIT_LOGD(" Setting render buffer cache size to %sMB", property);
+ setMaxSize(MB(atof(property)));
+ } else {
+ INIT_LOGD(" Using default render buffer cache size of %.2fMB",
+ DEFAULT_RENDER_BUFFER_CACHE_SIZE);
+ }
+}
+
+RenderBufferCache::~RenderBufferCache() {
+ clear();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Size management
+///////////////////////////////////////////////////////////////////////////////
+
+uint32_t RenderBufferCache::getSize() {
+ return mSize;
+}
+
+uint32_t RenderBufferCache::getMaxSize() {
+ return mMaxSize;
+}
+
+void RenderBufferCache::setMaxSize(uint32_t maxSize) {
+ clear();
+ mMaxSize = maxSize;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Caching
+///////////////////////////////////////////////////////////////////////////////
+
+int RenderBufferCache::RenderBufferEntry::compare(
+ const RenderBufferCache::RenderBufferEntry& lhs,
+ const RenderBufferCache::RenderBufferEntry& rhs) {
+ int deltaInt = int(lhs.mWidth) - int(rhs.mWidth);
+ if (deltaInt != 0) return deltaInt;
+
+ deltaInt = int(lhs.mHeight) - int(rhs.mHeight);
+ if (deltaInt != 0) return deltaInt;
+
+ return int(lhs.mFormat) - int(rhs.mFormat);
+}
+
+void RenderBufferCache::deleteBuffer(RenderBuffer* buffer) {
+ if (buffer) {
+ RENDER_BUFFER_LOGD("Deleted %s render buffer (%dx%d)",
+ RenderBuffer::formatName(buffer->getFormat()),
+ buffer->getWidth(), buffer->getHeight());
+
+ mSize -= buffer->getSize();
+ delete buffer;
+ }
+}
+
+void RenderBufferCache::clear() {
+ size_t count = mCache.size();
+ for (size_t i = 0; i < count; i++) {
+ deleteBuffer(mCache.itemAt(i).mBuffer);
+ }
+ mCache.clear();
+}
+
+RenderBuffer* RenderBufferCache::get(GLenum format, const uint32_t width, const uint32_t height) {
+ RenderBuffer* buffer = NULL;
+
+ RenderBufferEntry entry(format, width, height);
+ ssize_t index = mCache.indexOf(entry);
+
+ if (index >= 0) {
+ entry = mCache.itemAt(index);
+ mCache.removeAt(index);
+
+ buffer = entry.mBuffer;
+ mSize -= buffer->getSize();
+
+ RENDER_BUFFER_LOGD("Found %s render buffer (%dx%d)",
+ RenderBuffer::formatName(format), width, height);
+ } else {
+ buffer = new RenderBuffer(format, width, height);
+
+ RENDER_BUFFER_LOGD("Created new %s render buffer (%dx%d)",
+ RenderBuffer::formatName(format), width, height);
+ }
+
+ buffer->bind();
+ buffer->allocate();
+
+ return buffer;
+}
+
+bool RenderBufferCache::put(RenderBuffer* buffer) {
+ if (!buffer) return false;
+
+ const uint32_t size = buffer->getSize();
+ if (size < mMaxSize) {
+ while (mSize + size > mMaxSize) {
+ size_t position = 0;
+
+ RenderBuffer* victim = mCache.itemAt(position).mBuffer;
+ deleteBuffer(victim);
+ mCache.removeAt(position);
+ }
+
+ RenderBufferEntry entry(buffer);
+
+ mCache.add(entry);
+ mSize += size;
+
+ RENDER_BUFFER_LOGD("Added %s render buffer (%dx%d)",
+ RenderBuffer::formatName(buffer->getFormat()),
+ buffer->getWidth(), buffer->getHeight());
+
+ return true;
+ }
+ return false;
+}
+
+}; // namespace uirenderer
+}; // namespace android
diff --git a/libs/hwui/RenderBufferCache.h b/libs/hwui/RenderBufferCache.h
new file mode 100644
index 000000000000..af8060fe2d21
--- /dev/null
+++ b/libs/hwui/RenderBufferCache.h
@@ -0,0 +1,130 @@
+/*
+ * Copyright (C) 2013 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.
+ */
+
+#ifndef ANDROID_HWUI_RENDER_BUFFER_CACHE_H
+#define ANDROID_HWUI_RENDER_BUFFER_CACHE_H
+
+#include <GLES2/gl2.h>
+
+#include "RenderBuffer.h"
+#include "utils/SortedList.h"
+
+namespace android {
+namespace uirenderer {
+
+class RenderBufferCache {
+public:
+ RenderBufferCache();
+ ~RenderBufferCache();
+
+ /**
+ * Returns a buffer with the exact specified dimensions. If no suitable
+ * buffer can be found, a new one is created and returned. If creating a
+ * new buffer fails, NULL is returned.
+ *
+ * When a buffer is obtained from the cache, it is removed and the total
+ * size of the cache goes down.
+ *
+ * The returned buffer is always allocated and bound
+ * (see RenderBuffer::isAllocated()).
+ *
+ * @param format The desired render buffer format
+ * @param width The desired width of the buffer
+ * @param height The desired height of the buffer
+ */
+ RenderBuffer* get(GLenum format, const uint32_t width, const uint32_t height);
+
+ /**
+ * Adds the buffer to the cache. The buffer will not be added if there is
+ * not enough space available. Adding a buffer can cause other buffer to
+ * be removed from the cache.
+ *
+ * @param buffer The render buffer to add to the cache
+ *
+ * @return True if the buffer was added, false otherwise.
+ */
+ bool put(RenderBuffer* buffer);
+ /**
+ * Clears the cache. This causes all layers to be deleted.
+ */
+ void clear();
+
+ /**
+ * Sets the maximum size of the cache in bytes.
+ */
+ void setMaxSize(uint32_t maxSize);
+ /**
+ * Returns the maximum size of the cache in bytes.
+ */
+ uint32_t getMaxSize();
+ /**
+ * Returns the current size of the cache in bytes.
+ */
+ uint32_t getSize();
+
+private:
+ struct RenderBufferEntry {
+ RenderBufferEntry():
+ mBuffer(NULL), mWidth(0), mHeight(0) {
+ }
+
+ RenderBufferEntry(GLenum format, const uint32_t width, const uint32_t height):
+ mBuffer(NULL), mFormat(format), mWidth(width), mHeight(height) {
+ }
+
+ RenderBufferEntry(RenderBuffer* buffer):
+ mBuffer(buffer), mFormat(buffer->getFormat()),
+ mWidth(buffer->getWidth()), mHeight(buffer->getHeight()) {
+ }
+
+ static int compare(const RenderBufferEntry& lhs, const RenderBufferEntry& rhs);
+
+ bool operator==(const RenderBufferEntry& other) const {
+ return compare(*this, other) == 0;
+ }
+
+ bool operator!=(const RenderBufferEntry& other) const {
+ return compare(*this, other) != 0;
+ }
+
+ friend inline int strictly_order_type(const RenderBufferEntry& lhs,
+ const RenderBufferEntry& rhs) {
+ return RenderBufferEntry::compare(lhs, rhs) < 0;
+ }
+
+ friend inline int compare_type(const RenderBufferEntry& lhs,
+ const RenderBufferEntry& rhs) {
+ return RenderBufferEntry::compare(lhs, rhs);
+ }
+
+ RenderBuffer* mBuffer;
+ GLenum mFormat;
+ uint32_t mWidth;
+ uint32_t mHeight;
+ }; // struct RenderBufferEntry
+
+ void deleteBuffer(RenderBuffer* buffer);
+
+ SortedList<RenderBufferEntry> mCache;
+
+ uint32_t mSize;
+ uint32_t mMaxSize;
+}; // class RenderBufferCache
+
+}; // namespace uirenderer
+}; // namespace android
+
+#endif // ANDROID_HWUI_RENDER_BUFFER_CACHE_H
diff --git a/services/java/com/android/server/NetworkManagementService.java b/services/java/com/android/server/NetworkManagementService.java
index 2b0d8243a7ee..29e4c431a7d5 100644
--- a/services/java/com/android/server/NetworkManagementService.java
+++ b/services/java/com/android/server/NetworkManagementService.java
@@ -1471,9 +1471,7 @@ public class NetworkManagementService extends INetworkManagementService.Stub
public void setDnsInterfaceForPid(String iface, int pid) throws IllegalStateException {
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
- String cmd = "resolver setifaceforpid " + iface + " " + pid;
-
- mConnector.execute(cmd);
+ mConnector.execute("resolver", "setifaceforpid", iface, pid);
} catch (NativeDaemonConnectorException e) {
throw new IllegalStateException(
"Error communicating with native deamon to set interface for pid" + iface, e);
@@ -1484,9 +1482,7 @@ public class NetworkManagementService extends INetworkManagementService.Stub
public void clearDnsInterfaceForPid(int pid) throws IllegalStateException {
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
try {
- String cmd = "resolver clearifaceforpid " + pid;
-
- mConnector.execute(cmd);
+ mConnector.execute("resolver", "clearifaceforpid", pid);
} catch (NativeDaemonConnectorException e) {
throw new IllegalStateException(
"Error communicating with native deamon to clear interface for pid " + pid, e);
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 608ad1cfb5a1..22af3d5b3357 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -2838,11 +2838,8 @@ public final class ActivityManagerService extends ActivityManagerNative
for (int i=0; i<activities.size(); i++) {
ActivityRecord r = activities.get(i);
if (!r.finishing) {
- int index = mMainStack.indexOfTokenLocked(r.appToken);
- if (index >= 0) {
- mMainStack.finishActivityLocked(r, index, Activity.RESULT_CANCELED,
- null, "finish-heavy", true);
- }
+ mMainStack.finishActivityLocked(r, Activity.RESULT_CANCELED,
+ null, "finish-heavy", true);
}
}
@@ -8002,33 +7999,7 @@ public final class ActivityManagerService extends ActivityManagerNative
}
mMainStack.resumeTopActivityLocked(null);
} else {
- ActivityRecord r = mMainStack.topRunningActivityLocked(null);
- if (r != null && r.app == app) {
- // If the top running activity is from this crashing
- // process, then terminate it to avoid getting in a loop.
- Slog.w(TAG, " Force finishing activity "
- + r.intent.getComponent().flattenToShortString());
- int index = mMainStack.indexOfActivityLocked(r);
- r.stack.finishActivityLocked(r, index,
- Activity.RESULT_CANCELED, null, "crashed", false);
- // Also terminate any activities below it that aren't yet
- // stopped, to avoid a situation where one will get
- // re-start our crashing activity once it gets resumed again.
- index--;
- if (index >= 0) {
- r = mMainStack.getActivityAtIndex(index);
- if (r.state == ActivityState.RESUMED
- || r.state == ActivityState.PAUSING
- || r.state == ActivityState.PAUSED) {
- if (!r.isHomeActivity || mHomeProcess != r.app) {
- Slog.w(TAG, " Force finishing activity "
- + r.intent.getComponent().flattenToShortString());
- r.stack.finishActivityLocked(r, index,
- Activity.RESULT_CANCELED, null, "crashed", false);
- }
- }
- }
- }
+ mMainStack.finishTopRunningActivityLocked(app);
}
// Bump up the crash count of any services currently running in the proc.
@@ -12370,7 +12341,6 @@ public final class ActivityManagerService extends ActivityManagerNative
public boolean navigateUpTo(IBinder token, Intent destIntent, int resultCode,
Intent resultData) {
- ComponentName dest = destIntent.getComponent();
synchronized (this) {
ActivityRecord srec = ActivityRecord.forToken(token);
@@ -12378,87 +12348,7 @@ public final class ActivityManagerService extends ActivityManagerNative
return false;
}
ActivityStack stack = srec.stack;
- final int start = stack.indexOfActivityLocked(srec);
- if (start < 0) {
- // Current activity is not in history stack; do nothing.
- return false;
- }
- int finishTo = start - 1;
- ActivityRecord parent = null;
- boolean foundParentInTask = false;
- if (dest != null) {
- TaskRecord tr = srec.task;
- for (int i = start - 1; i >= 0; i--) {
- ActivityRecord r = stack.getActivityAtIndex(i);
- if (tr != r.task) {
- // Couldn't find parent in the same task; stop at the one above this.
- // (Root of current task; in-app "home" behavior)
- // Always at least finish the current activity.
- finishTo = Math.min(start - 1, i + 1);
- parent = stack.getActivityAtIndex(finishTo);
- break;
- } else if (r.info.packageName.equals(dest.getPackageName()) &&
- r.info.name.equals(dest.getClassName())) {
- finishTo = i;
- parent = r;
- foundParentInTask = true;
- break;
- }
- }
- }
-
- if (mController != null) {
- ActivityRecord next = mMainStack.topRunningActivityLocked(token, 0);
- if (next != null) {
- // ask watcher if this is allowed
- boolean resumeOK = true;
- try {
- resumeOK = mController.activityResuming(next.packageName);
- } catch (RemoteException e) {
- mController = null;
- }
-
- if (!resumeOK) {
- return false;
- }
- }
- }
- final long origId = Binder.clearCallingIdentity();
- for (int i = start; i > finishTo; i--) {
- ActivityRecord r = stack.getActivityAtIndex(i);
- mMainStack.requestFinishActivityLocked(r.appToken, resultCode, resultData,
- "navigate-up", true);
- // Only return the supplied result for the first activity finished
- resultCode = Activity.RESULT_CANCELED;
- resultData = null;
- }
-
- if (parent != null && foundParentInTask) {
- final int parentLaunchMode = parent.info.launchMode;
- final int destIntentFlags = destIntent.getFlags();
- if (parentLaunchMode == ActivityInfo.LAUNCH_SINGLE_INSTANCE ||
- parentLaunchMode == ActivityInfo.LAUNCH_SINGLE_TASK ||
- parentLaunchMode == ActivityInfo.LAUNCH_SINGLE_TOP ||
- (destIntentFlags & Intent.FLAG_ACTIVITY_CLEAR_TOP) != 0) {
- parent.deliverNewIntentLocked(srec.info.applicationInfo.uid, destIntent);
- } else {
- try {
- ActivityInfo aInfo = AppGlobals.getPackageManager().getActivityInfo(
- destIntent.getComponent(), 0, srec.userId);
- int res = mMainStack.startActivityLocked(srec.app.thread, destIntent,
- null, aInfo, parent.appToken, null,
- 0, -1, parent.launchedFromUid, parent.launchedFromPackage,
- 0, null, true, null);
- foundParentInTask = res == ActivityManager.START_SUCCESS;
- } catch (RemoteException e) {
- foundParentInTask = false;
- }
- mMainStack.requestFinishActivityLocked(parent.appToken, resultCode,
- resultData, "navigate-up", true);
- }
- }
- Binder.restoreCallingIdentity(origId);
- return foundParentInTask;
+ return stack.navigateUpToLocked(srec, destIntent, resultCode, resultData);
}
}
diff --git a/services/java/com/android/server/am/ActivityRecord.java b/services/java/com/android/server/am/ActivityRecord.java
index cde17c9b39ba..c1b406ef473c 100644
--- a/services/java/com/android/server/am/ActivityRecord.java
+++ b/services/java/com/android/server/am/ActivityRecord.java
@@ -22,6 +22,7 @@ import com.android.server.am.ActivityStack.ActivityState;
import android.app.Activity;
import android.app.ActivityOptions;
+import android.app.ResultInfo;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.ActivityInfo;
@@ -95,9 +96,9 @@ final class ActivityRecord {
ActivityRecord resultTo; // who started this entry, so will get our reply
final String resultWho; // additional identifier for use by resultTo.
final int requestCode; // code given by requester (resultTo)
- ArrayList results; // pending ActivityResult objs we have received
+ ArrayList<ResultInfo> results; // pending ActivityResult objs we have received
HashSet<WeakReference<PendingIntentRecord>> pendingResults; // all pending intents for this act
- ArrayList newIntents; // any pending new intents for single-top mode
+ ArrayList<Intent> newIntents; // any pending new intents for single-top mode
ActivityOptions pendingOptions; // most recently given options
HashSet<ConnectionRecord> connections; // All ConnectionRecord we hold
UriPermissionOwner uriPermissions; // current special URI access perms.
diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java
index d969709c9a9c..76836f93074c 100644
--- a/services/java/com/android/server/am/ActivityStack.java
+++ b/services/java/com/android/server/am/ActivityStack.java
@@ -24,11 +24,13 @@ import com.android.internal.os.BatteryStatsImpl;
import com.android.server.am.ActivityManagerService.ItemMatcher;
import com.android.server.am.ActivityManagerService.PendingActivityLaunch;
import com.android.server.wm.AppTransition;
+import com.android.server.wm.TaskGroup;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityOptions;
import android.app.AppGlobals;
+import android.app.IActivityController;
import android.app.IActivityManager;
import android.app.IThumbnailReceiver;
import android.app.IThumbnailRetriever;
@@ -501,14 +503,10 @@ final class ActivityStack {
return null;
}
- final int indexOfTokenLocked(IBinder token) {
+ private final int indexOfTokenLocked(IBinder token) {
return mHistory.indexOf(ActivityRecord.forToken(token));
}
- final int indexOfActivityLocked(ActivityRecord r) {
- return mHistory.indexOf(r);
- }
-
final ActivityRecord isInStackLocked(IBinder token) {
ActivityRecord r = ActivityRecord.forToken(token);
if (mHistory.contains(r)) {
@@ -517,14 +515,6 @@ final class ActivityStack {
return null;
}
- // TODO: This exposes mHistory too much, replace usage with ActivityStack methods.
- final ActivityRecord getActivityAtIndex(int index) {
- if (index >= 0 && index < mHistory.size()) {
- return mHistory.get(index);
- }
- return null;
- }
-
int getTaskForActivityLocked(IBinder token, boolean onlyRoot) {
TaskRecord lastTask = null;
final int N = mHistory.size();
@@ -745,7 +735,13 @@ final class ActivityStack {
try {
profileFd = profileFd.dup();
} catch (IOException e) {
- profileFd = null;
+ if (profileFd != null) {
+ try {
+ profileFd.close();
+ } catch (IOException o) {
+ }
+ profileFd = null;
+ }
}
}
app.thread.scheduleLaunchActivity(new Intent(r.intent), r.appToken,
@@ -1758,7 +1754,7 @@ final class ActivityStack {
try {
// Deliver all pending results.
- ArrayList a = next.results;
+ ArrayList<ResultInfo> a = next.results;
if (a != null) {
final int N = a.size();
if (!next.finishing && N > 0) {
@@ -2156,6 +2152,7 @@ final class ActivityStack {
}
i++;
}
+ mService.mWindowManager.moveTaskToBottom(target.task.taskId);
if (taskTop == p) {
taskTop = below;
}
@@ -2304,6 +2301,8 @@ final class ActivityStack {
validateAppTokensLocked();
}
}
+ // TODO: This is wrong because it doesn't take lastReparentPos into account.
+ mService.mWindowManager.moveTaskToTop(task.taskId);
replyChainEnd = -1;
// Now we've moved it in to place... but what if this is
@@ -2413,7 +2412,7 @@ final class ActivityStack {
if (ret.launchMode == ActivityInfo.LAUNCH_MULTIPLE
&& (launchFlags&Intent.FLAG_ACTIVITY_SINGLE_TOP) == 0) {
if (!ret.finishing) {
- int index = indexOfTokenLocked(ret.appToken);
+ int index = mHistory.indexOf(ret);
if (index >= 0) {
finishActivityLocked(ret, index, Activity.RESULT_CANCELED,
null, "clear", false);
@@ -3568,7 +3567,7 @@ final class ActivityStack {
}
// Get the activity record.
- int index = indexOfActivityLocked(r);
+ int index = mHistory.indexOf(r);
if (index >= 0) {
res = r;
@@ -3654,7 +3653,7 @@ final class ActivityStack {
// Stop any activities that are scheduled to do so but have been
// waiting for the next one to start.
for (i=0; i<NS; i++) {
- ActivityRecord r = (ActivityRecord)stops.get(i);
+ ActivityRecord r = stops.get(i);
synchronized (mService) {
if (r.finishing) {
finishCurrentActivityLocked(r, FINISH_IMMEDIATELY, false);
@@ -3667,7 +3666,7 @@ final class ActivityStack {
// Finish any activities that are scheduled to do so but have been
// waiting for the next one to start.
for (i=0; i<NF; i++) {
- ActivityRecord r = (ActivityRecord)finishes.get(i);
+ ActivityRecord r = finishes.get(i);
synchronized (mService) {
activityRemoved = destroyActivityLocked(r, true, false, "finish-idle");
}
@@ -3675,7 +3674,7 @@ final class ActivityStack {
// Report back to any thumbnail receivers.
for (i=0; i<NT; i++) {
- ActivityRecord r = (ActivityRecord)thumbnails.get(i);
+ ActivityRecord r = thumbnails.get(i);
mService.sendPendingThumbnail(r, null, null, null, true);
}
@@ -3730,7 +3729,7 @@ final class ActivityStack {
int i;
for (i=mHistory.size()-1; i>=0; i--) {
- ActivityRecord r = (ActivityRecord)mHistory.get(i);
+ ActivityRecord r = mHistory.get(i);
if (r.resultTo == self && r.requestCode == requestCode) {
if ((r.resultWho == null && resultWho == null) ||
(r.resultWho != null && r.resultWho.equals(resultWho))) {
@@ -3742,6 +3741,36 @@ final class ActivityStack {
mService.updateOomAdjLocked();
}
+ final void finishTopRunningActivityLocked(ProcessRecord app) {
+ ActivityRecord r = topRunningActivityLocked(null);
+ if (r != null && r.app == app) {
+ // If the top running activity is from this crashing
+ // process, then terminate it to avoid getting in a loop.
+ Slog.w(TAG, " Force finishing activity "
+ + r.intent.getComponent().flattenToShortString());
+ int index = mHistory.indexOf(r);
+ r.stack.finishActivityLocked(r, index,
+ Activity.RESULT_CANCELED, null, "crashed", false);
+ // Also terminate any activities below it that aren't yet
+ // stopped, to avoid a situation where one will get
+ // re-start our crashing activity once it gets resumed again.
+ index--;
+ if (index >= 0) {
+ r = mHistory.get(index);
+ if (r.state == ActivityState.RESUMED
+ || r.state == ActivityState.PAUSING
+ || r.state == ActivityState.PAUSED) {
+ if (!r.isHomeActivity || mService.mHomeProcess != r.app) {
+ Slog.w(TAG, " Force finishing activity "
+ + r.intent.getComponent().flattenToShortString());
+ r.stack.finishActivityLocked(r, index,
+ Activity.RESULT_CANCELED, null, "crashed", false);
+ }
+ }
+ }
+ }
+ }
+
final boolean finishActivityAffinityLocked(IBinder token) {
int index = indexOfTokenLocked(token);
if (DEBUG_RESULTS) Slog.v(
@@ -3800,6 +3829,19 @@ final class ActivityStack {
* @return Returns true if this activity has been removed from the history
* list, or false if it is still in the list and will be removed later.
*/
+ final boolean finishActivityLocked(ActivityRecord r,
+ int resultCode, Intent resultData, String reason, boolean oomAdj) {
+ int index = mHistory.indexOf(r);
+ if (index >= 0) {
+ return finishActivityLocked(r, index, resultCode, resultData, reason, false, oomAdj);
+ }
+ return false;
+ }
+
+ /**
+ * @return Returns true if this activity has been removed from the history
+ * list, or false if it is still in the list and will be removed later.
+ */
final boolean finishActivityLocked(ActivityRecord r, int index,
int resultCode, Intent resultData, String reason, boolean oomAdj) {
return finishActivityLocked(r, index, resultCode, resultData, reason, false, oomAdj);
@@ -3892,7 +3934,7 @@ final class ActivityStack {
private final ActivityRecord finishCurrentActivityLocked(ActivityRecord r,
int mode, boolean oomAdj) {
- final int index = indexOfActivityLocked(r);
+ final int index = mHistory.indexOf(r);
if (index < 0) {
return null;
}
@@ -3948,16 +3990,102 @@ final class ActivityStack {
resumeTopActivityLocked(null);
}
return activityRemoved ? null : r;
- } else {
- // Need to go through the full pause cycle to get this
- // activity into the stopped state and then finish it.
- if (localLOGV) Slog.v(TAG, "Enqueueing pending finish: " + r);
- mFinishingActivities.add(r);
- resumeTopActivityLocked(null);
}
+
+ // Need to go through the full pause cycle to get this
+ // activity into the stopped state and then finish it.
+ if (localLOGV) Slog.v(TAG, "Enqueueing pending finish: " + r);
+ mFinishingActivities.add(r);
+ resumeTopActivityLocked(null);
return r;
}
+ final boolean navigateUpToLocked(ActivityRecord srec, Intent destIntent, int resultCode,
+ Intent resultData) {
+ final int start = mHistory.indexOf(srec);
+ if (start < 0) {
+ // Current activity is not in history stack; do nothing.
+ return false;
+ }
+ int finishTo = start - 1;
+ ActivityRecord parent = null;
+ boolean foundParentInTask = false;
+ ComponentName dest = destIntent.getComponent();
+ if (dest != null) {
+ TaskRecord tr = srec.task;
+ for (int i = start - 1; i >= 0; i--) {
+ ActivityRecord r = mHistory.get(i);
+ if (tr != r.task) {
+ // Couldn't find parent in the same task; stop at the one above this.
+ // (Root of current task; in-app "home" behavior)
+ // Always at least finish the current activity.
+ finishTo = Math.min(start - 1, i + 1);
+ parent = mHistory.get(finishTo);
+ break;
+ } else if (r.info.packageName.equals(dest.getPackageName()) &&
+ r.info.name.equals(dest.getClassName())) {
+ finishTo = i;
+ parent = r;
+ foundParentInTask = true;
+ break;
+ }
+ }
+ }
+
+ IActivityController controller = mService.mController;
+ if (controller != null) {
+ ActivityRecord next = topRunningActivityLocked(srec.appToken, 0);
+ if (next != null) {
+ // ask watcher if this is allowed
+ boolean resumeOK = true;
+ try {
+ resumeOK = controller.activityResuming(next.packageName);
+ } catch (RemoteException e) {
+ mService.mController = null;
+ }
+
+ if (!resumeOK) {
+ return false;
+ }
+ }
+ }
+ final long origId = Binder.clearCallingIdentity();
+ for (int i = start; i > finishTo; i--) {
+ ActivityRecord r = mHistory.get(i);
+ requestFinishActivityLocked(r.appToken, resultCode, resultData,
+ "navigate-up", true);
+ // Only return the supplied result for the first activity finished
+ resultCode = Activity.RESULT_CANCELED;
+ resultData = null;
+ }
+
+ if (parent != null && foundParentInTask) {
+ final int parentLaunchMode = parent.info.launchMode;
+ final int destIntentFlags = destIntent.getFlags();
+ if (parentLaunchMode == ActivityInfo.LAUNCH_SINGLE_INSTANCE ||
+ parentLaunchMode == ActivityInfo.LAUNCH_SINGLE_TASK ||
+ parentLaunchMode == ActivityInfo.LAUNCH_SINGLE_TOP ||
+ (destIntentFlags & Intent.FLAG_ACTIVITY_CLEAR_TOP) != 0) {
+ parent.deliverNewIntentLocked(srec.info.applicationInfo.uid, destIntent);
+ } else {
+ try {
+ ActivityInfo aInfo = AppGlobals.getPackageManager().getActivityInfo(
+ destIntent.getComponent(), 0, srec.userId);
+ int res = startActivityLocked(srec.app.thread, destIntent,
+ null, aInfo, parent.appToken, null,
+ 0, -1, parent.launchedFromUid, parent.launchedFromPackage,
+ 0, null, true, null);
+ foundParentInTask = res == ActivityManager.START_SUCCESS;
+ } catch (RemoteException e) {
+ foundParentInTask = false;
+ }
+ requestFinishActivityLocked(parent.appToken, resultCode,
+ resultData, "navigate-up", true);
+ }
+ }
+ Binder.restoreCallingIdentity(origId);
+ return foundParentInTask;
+ }
/**
* Perform the common clean-up of an activity record. This is called both
* as part of destroyActivityLocked() (when destroying the client-side
@@ -4216,7 +4344,7 @@ final class ActivityStack {
mHandler.removeMessages(DESTROY_TIMEOUT_MSG, r);
}
- int index = indexOfActivityLocked(r);
+ int index = mHistory.indexOf(r);
if (index >= 0) {
if (r.state == ActivityState.DESTROYING) {
cleanUpActivityLocked(r, true, false);
@@ -4230,15 +4358,15 @@ final class ActivityStack {
}
}
- private void removeHistoryRecordsForAppLocked(ArrayList list, ProcessRecord app,
- String listName) {
+ private void removeHistoryRecordsForAppLocked(ArrayList<ActivityRecord> list,
+ ProcessRecord app, String listName) {
int i = list.size();
if (DEBUG_CLEANUP) Slog.v(
TAG, "Removing app " + app + " from list " + listName
+ " with " + i + " entries");
while (i > 0) {
i--;
- ActivityRecord r = (ActivityRecord)list.get(i);
+ ActivityRecord r = list.get(i);
if (DEBUG_CLEANUP) Slog.v(TAG, "Record #" + i + " " + r);
if (r.app == app) {
if (DEBUG_CLEANUP) Slog.v(TAG, "---> REMOVING this entry!");
@@ -4264,7 +4392,7 @@ final class ActivityStack {
TAG, "Removing app " + app + " from history with " + i + " entries");
while (i > 0) {
i--;
- ActivityRecord r = (ActivityRecord)mHistory.get(i);
+ ActivityRecord r = mHistory.get(i);
if (DEBUG_CLEANUP) Slog.v(
TAG, "Record #" + i + " " + r + ": app=" + r.app);
if (r.app == app) {
@@ -4440,6 +4568,7 @@ final class ActivityStack {
if (VALIDATE_TOKENS) {
validateAppTokensLocked();
}
+ mService.mWindowManager.moveTaskToTop(task);
finishTaskMoveLocked(task);
EventLog.writeEvent(EventLogTags.AM_TASK_TO_FRONT, tr.userId, task);
@@ -4532,6 +4661,7 @@ final class ActivityStack {
if (VALIDATE_TOKENS) {
validateAppTokensLocked();
}
+ mService.mWindowManager.moveTaskToBottom(task);
finishTaskMoveLocked(task);
return true;
@@ -4561,9 +4691,8 @@ final class ActivityStack {
TaskAccessInfo info = getTaskAccessInfoLocked(tr.taskId, true);
if (info.numSubThumbbails <= 0) {
return info.mainThumbnail != null ? info.mainThumbnail : tr.lastThumbnail;
- } else {
- return info.subtasks.get(info.numSubThumbbails-1).holder.lastThumbnail;
}
+ return info.subtasks.get(info.numSubThumbbails-1).holder.lastThumbnail;
}
public ActivityRecord removeTaskActivitiesLocked(int taskId, int subTaskIndex,
@@ -4643,6 +4772,7 @@ final class ActivityStack {
}
if (thumbs.numSubThumbbails > 0) {
thumbs.retriever = new IThumbnailRetriever.Stub() {
+ @Override
public Bitmap getThumbnail(int index) {
if (index < 0 || index >= thumbs.subtasks.size()) {
return null;
diff --git a/services/java/com/android/server/pm/UserManagerService.java b/services/java/com/android/server/pm/UserManagerService.java
index 5760dcd0aece..18ccf750cd7a 100644
--- a/services/java/com/android/server/pm/UserManagerService.java
+++ b/services/java/com/android/server/pm/UserManagerService.java
@@ -547,6 +547,11 @@ public class UserManagerService extends IUserManager.Stub {
UserInfo.FLAG_ADMIN | UserInfo.FLAG_PRIMARY | UserInfo.FLAG_INITIALIZED);
mUsers.put(0, primary);
mNextSerialNumber = MIN_USER_ID;
+
+ Bundle restrictions = new Bundle();
+ initRestrictionsToDefaults(restrictions);
+ mUserRestrictions.append(0, restrictions);
+
updateUserIdsLocked();
writeUserListLocked();
@@ -805,6 +810,9 @@ public class UserManagerService extends IUserManager.Stub {
userInfo.partial = false;
writeUserLocked(userInfo);
updateUserIdsLocked();
+ Bundle restrictions = new Bundle();
+ initRestrictionsToDefaults(restrictions);
+ mUserRestrictions.append(userId, restrictions);
}
}
if (userInfo != null) {
diff --git a/services/java/com/android/server/wm/DisplayContent.java b/services/java/com/android/server/wm/DisplayContent.java
index 906ea57d7d50..43a5f0c345e6 100644
--- a/services/java/com/android/server/wm/DisplayContent.java
+++ b/services/java/com/android/server/wm/DisplayContent.java
@@ -16,12 +16,16 @@
package com.android.server.wm;
+import android.os.Debug;
+import android.util.Slog;
import android.util.SparseArray;
import android.view.Display;
import android.view.DisplayInfo;
import java.io.PrintWriter;
import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
class DisplayContentList extends ArrayList<DisplayContent> {
}
@@ -34,7 +38,7 @@ class DisplayContentList extends ArrayList<DisplayContent> {
* WindowManagerService.mWindowMap.
*/
class DisplayContent {
-// private final static String TAG = "DisplayContent";
+ private final static String TAG = "DisplayContent";
/** Unique identifier of this stack. */
private final int mDisplayId;
@@ -97,7 +101,7 @@ class DisplayContent {
/**
* Sorted most recent at top, oldest at [0].
*/
-// ArrayList<TaskList> mTaskLists = new ArrayList<TaskList>();
+ ArrayList<TaskList> mTaskLists = new ArrayList<TaskList>();
SparseArray<TaskList> mTaskIdToTaskList = new SparseArray<TaskList>();
/**
@@ -133,24 +137,28 @@ class DisplayContent {
/**
* Find the location to insert a new AppWindowToken into the window-ordered app token list.
* @param addPos The location the token was inserted into in mAppTokens.
- * @param atoken The token to insert.
+ * @param wtoken The token to insert.
*/
- void addAppToken(final int addPos, final AppWindowToken atoken) {
- mAppTokens.add(addPos, atoken);
+ void addAppToken(final int addPos, final AppWindowToken wtoken) {
+ mAppTokens.add(addPos, wtoken);
if (addPos == 0 || addPos == mAnimatingAppTokens.size()) {
// It was inserted into the beginning or end of mAppTokens. Honor that.
- mAnimatingAppTokens.add(addPos, atoken);
+ mAnimatingAppTokens.add(addPos, wtoken);
} else {
// Find the item immediately above the mAppTokens insertion point and put the token
// immediately below that one in mAnimatingAppTokens.
final AppWindowToken aboveAnchor = mAppTokens.get(addPos + 1);
- mAnimatingAppTokens.add(mAnimatingAppTokens.indexOf(aboveAnchor), atoken);
+ mAnimatingAppTokens.add(mAnimatingAppTokens.indexOf(aboveAnchor), wtoken);
}
- TaskList task = mTaskIdToTaskList.get(atoken.groupId);
+ TaskList task = mTaskIdToTaskList.get(wtoken.groupId);
if (task == null) {
- mTaskIdToTaskList.put(atoken.groupId, new TaskList(atoken));
+ task = new TaskList(wtoken, this);
+ mTaskIdToTaskList.put(wtoken.groupId, task);
+ mTaskLists.add(task);
+ } else {
+ task.mAppTokens.add(wtoken);
}
}
@@ -163,6 +171,7 @@ class DisplayContent {
AppTokenList appTokens = task.mAppTokens;
appTokens.remove(wtoken);
if (appTokens.size() == 0) {
+ mTaskLists.remove(task);
mTaskIdToTaskList.delete(taskId);
}
}
@@ -186,7 +195,7 @@ class DisplayContent {
task = mTaskIdToTaskList.get(newTaskId);
if (task == null) {
- task = new TaskList(wtoken);
+ task = new TaskList(wtoken, this);
mTaskIdToTaskList.put(newTaskId, task);
} else {
task.mAppTokens.add(wtoken);
@@ -195,6 +204,122 @@ class DisplayContent {
wtoken.groupId = newTaskId;
}
+ class TaskListsIterator implements Iterator<TaskList> {
+ private int mCur;
+ private boolean mReverse;
+
+ TaskListsIterator() {
+ this(false);
+ }
+
+ TaskListsIterator(boolean reverse) {
+ mReverse = reverse;
+ int numTaskLists = mTaskLists.size();
+ mCur = reverse ? numTaskLists - 1 : 0;
+ }
+
+ @Override
+ public boolean hasNext() {
+ if (mReverse) {
+ return mCur >= 0;
+ }
+ return mCur < mTaskLists.size();
+ }
+
+ @Override
+ public TaskList next() {
+ if (hasNext()) {
+ TaskList taskList = mTaskLists.get(mCur);
+ mCur += (mReverse ? -1 : 1);
+ return taskList;
+ }
+ throw new NoSuchElementException();
+ }
+
+ @Override
+ public void remove() {
+ throw new IllegalArgumentException();
+ }
+ }
+
+ class AppTokenIterator implements Iterator<AppWindowToken> {
+ final TaskListsIterator mIterator;
+ final boolean mReverse;
+ int mCur;
+ TaskList mTaskList;
+
+ public AppTokenIterator() {
+ this(false);
+ }
+
+ public AppTokenIterator(boolean reverse) {
+ mReverse = reverse;
+ mIterator = new TaskListsIterator(reverse);
+ getNextTaskList();
+ }
+
+ private void getNextTaskList() {
+ if (mIterator.hasNext()) {
+ mTaskList = mIterator.next();
+ mCur = mReverse ? mTaskList.mAppTokens.size() - 1 : 0;
+ }
+ }
+
+ @Override
+ public boolean hasNext() {
+ if (mTaskList == null) {
+ return false;
+ }
+ if (mReverse) {
+ return mCur >= 0;
+ }
+ return mCur < mTaskList.mAppTokens.size();
+ }
+
+ @Override
+ public AppWindowToken next() {
+ if (hasNext()) {
+ AppWindowToken wtoken = mTaskList.mAppTokens.get(mCur);
+ mCur += mReverse ? -1 : 1;
+ if (!hasNext()) {
+ getNextTaskList();
+ }
+ return wtoken;
+ }
+ throw new NoSuchElementException();
+ }
+
+ @Override
+ public void remove() {
+ throw new IllegalArgumentException();
+ }
+ }
+
+ void verifyAppTokens() {
+ AppTokenIterator iterator = new AppTokenIterator();
+ for (int i = 0; i < mAppTokens.size(); ++i) {
+ if (!iterator.hasNext()) {
+ Slog.e(TAG, "compareAppTokens: More mAppTokens than TaskList tokens. Callers="
+ + Debug.getCallers(4));
+ while (i < mAppTokens.size()) {
+ Slog.e(TAG, "compareAppTokens: mAppTokens[" + i + "]=" + mAppTokens.get(i));
+ i++;
+ }
+ return;
+ }
+ AppWindowToken appToken = mAppTokens.get(i);
+ AppWindowToken taskListToken = iterator.next();
+ if (appToken != taskListToken) {
+ Slog.e(TAG, "compareAppTokens: Mismatch at " + i + " appToken=" + appToken
+ + " taskListToken=" + taskListToken + ". Callers=" + Debug.getCallers(4));
+ }
+ }
+ if (iterator.hasNext()) {
+ Slog.e(TAG, "compareAppTokens: More TaskList tokens than mAppTokens Callers="
+ + Debug.getCallers(4));
+ }
+ }
+
public void dump(String prefix, PrintWriter pw) {
pw.print(prefix); pw.print("Display: mDisplayId="); pw.println(mDisplayId);
final String subPrefix = " " + prefix;
diff --git a/services/java/com/android/server/am/TaskGroup.java b/services/java/com/android/server/wm/TaskGroup.java
index 757410374f26..5e82af263aef 100644
--- a/services/java/com/android/server/am/TaskGroup.java
+++ b/services/java/com/android/server/wm/TaskGroup.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.server.am;
+package com.android.server.wm;
import android.view.IApplicationToken;
diff --git a/services/java/com/android/server/wm/TaskList.java b/services/java/com/android/server/wm/TaskList.java
index fe12b98efcfe..88791f206c3e 100644
--- a/services/java/com/android/server/wm/TaskList.java
+++ b/services/java/com/android/server/wm/TaskList.java
@@ -16,15 +16,15 @@
package com.android.server.wm;
-import com.android.server.am.TaskGroup;
-
-class TaskList extends TaskGroup {
+class TaskList {
// private final String TAG = "TaskGroup";
- AppTokenList mAppTokens = new AppTokenList();
+ DisplayContent mDisplayContent;
+ final AppTokenList mAppTokens = new AppTokenList();
+ final int taskId;
- TaskList(AppWindowToken wtoken) {
+ TaskList(AppWindowToken wtoken, DisplayContent displayContent) {
taskId = wtoken.groupId;
- tokens.add(wtoken.appToken);
mAppTokens.add(wtoken);
+ mDisplayContent = displayContent;
}
}
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index 03dcced31309..d51c07b467a2 100644
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -54,7 +54,6 @@ import com.android.server.AttributeCache;
import com.android.server.EventLogTags;
import com.android.server.Watchdog;
import com.android.server.am.BatteryStatsService;
-import com.android.server.am.TaskGroup;
import com.android.server.display.DisplayManagerService;
import com.android.server.input.InputManagerService;
import com.android.server.power.PowerManagerService;
@@ -330,8 +329,7 @@ public class WindowManagerService extends IWindowManager.Stub
/**
* Mapping from a token IBinder to a WindowToken object.
*/
- final HashMap<IBinder, WindowToken> mTokenMap =
- new HashMap<IBinder, WindowToken>();
+ final HashMap<IBinder, WindowToken> mTokenMap = new HashMap<IBinder, WindowToken>();
/**
* List of window tokens that have finished starting their application,
@@ -3318,6 +3316,7 @@ public class WindowManagerService extends IWindowManager.Stub
mTaskIdToDisplayContents.put(taskId, displayContent);
}
displayContent.addAppToken(addPos, atoken);
+ displayContent.verifyAppTokens();
mTokenMap.put(token.asBinder(), atoken);
mTaskIdToDisplayContents.put(taskId, displayContent);
@@ -4301,11 +4300,12 @@ public class WindowManagerService extends IWindowManager.Stub
TAG, "Removing app " + wtoken + " delayed=" + delayed
+ " animation=" + wtoken.mAppAnimator.animation
+ " animating=" + wtoken.mAppAnimator.animating);
+ DisplayContent displayContent = mTaskIdToDisplayContents.get(wtoken.groupId);
if (delayed) {
// set the token aside because it has an active animation to be finished
if (DEBUG_ADD_REMOVE || DEBUG_TOKEN_MOVEMENT) Slog.v(TAG,
"removeAppToken make exiting: " + wtoken);
- mTaskIdToDisplayContents.get(wtoken.groupId).mExitingAppTokens.add(wtoken);
+ displayContent.mExitingAppTokens.add(wtoken);
} else {
// Make sure there is no animation running on this token,
// so any windows associated with it will be removed as
@@ -4315,7 +4315,8 @@ public class WindowManagerService extends IWindowManager.Stub
}
if (DEBUG_ADD_REMOVE || DEBUG_TOKEN_MOVEMENT) Slog.v(TAG,
"removeAppToken: " + wtoken);
- mTaskIdToDisplayContents.get(wtoken.groupId).removeAppToken(wtoken);
+ displayContent.removeAppToken(wtoken);
+ displayContent.verifyAppTokens();
wtoken.removed = true;
if (wtoken.startingData != null) {
startingToken = wtoken;
@@ -4707,6 +4708,44 @@ public class WindowManagerService extends IWindowManager.Stub
Binder.restoreCallingIdentity(origId);
}
+ public void moveTaskToTop(int taskId) {
+ DisplayContent displayContent = mTaskIdToDisplayContents.get(taskId);
+ if (displayContent == null) {
+ Slog.e(TAG, "moveTaskToTop: taskId=" + taskId
+ + " not found in mTaskIdToDisplayContents");
+ return;
+ }
+ TaskList taskList = displayContent.mTaskIdToTaskList.get(taskId);
+ if (taskList == null) {
+ Slog.e(TAG, "moveTaskToTop: taskId=" + taskId + " not found in mTaskIdToTaskLists");
+ return;
+ }
+ if (!displayContent.mTaskLists.remove(taskList)) {
+ Slog.e(TAG, "moveTaskToTop: taskId=" + taskId + " not found in mTaskLists");
+ }
+ displayContent.mTaskLists.add(taskList);
+ displayContent.verifyAppTokens();
+ }
+
+ public void moveTaskToBottom(int taskId) {
+ DisplayContent displayContent = mTaskIdToDisplayContents.get(taskId);
+ if (displayContent == null) {
+ Slog.e(TAG, "moveTaskToBottom: taskId=" + taskId
+ + " not found in mTaskIdToDisplayContents");
+ return;
+ }
+ TaskList taskList = displayContent.mTaskIdToTaskList.get(taskId);
+ if (taskList == null) {
+ Slog.e(TAG, "moveTaskToTopBottomtaskId=" + taskId + " not found in mTaskIdToTaskLists");
+ return;
+ }
+ if (!displayContent.mTaskLists.remove(taskList)) {
+ Slog.e(TAG, "moveTaskToBottom: taskId=" + taskId + " not found in mTaskLists");
+ }
+ displayContent.mTaskLists.add(0, taskList);
+ displayContent.verifyAppTokens();
+ }
+
// -------------------------------------------------------------
// Misc IWindowSession methods
// -------------------------------------------------------------
diff --git a/tests/BiDiTests/res/layout/canvas.xml b/tests/BiDiTests/res/layout/canvas.xml
deleted file mode 100644
index 0319a83b0382..000000000000
--- a/tests/BiDiTests/res/layout/canvas.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 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.
--->
-
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/canvas"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
-
- <LinearLayout android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <SeekBar android:id="@+id/seekbar"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- />
-
- <view class="com.android.bidi.BiDiTestView"
- android:id="@+id/testview"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="#FF0000"
- />
-
- </LinearLayout>
-
-</FrameLayout> \ No newline at end of file
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java
index 209597e27de8..b88a885efa43 100644
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java
+++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java
@@ -101,7 +101,6 @@ public class BiDiTestActivity extends Activity {
addItem(result, "Basic", BiDiTestBasic.class, R.id.basic);
- addItem(result, "Canvas", BiDiTestCanvas.class, R.id.canvas);
addItem(result, "Canvas2", BiDiTestCanvas2.class, R.id.canvas2);
addItem(result, "TextView LTR", BiDiTestTextViewLtr.class, R.id.textview_ltr);
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestCanvas.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestCanvas.java
deleted file mode 100644
index 33ed731749e2..000000000000
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestCanvas.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2011 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 com.android.bidi;
-
-import android.app.Fragment;
-import android.os.Bundle;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.SeekBar;
-
-import static com.android.bidi.BiDiTestConstants.FONT_MAX_SIZE;
-import static com.android.bidi.BiDiTestConstants.FONT_MIN_SIZE;
-
-public class BiDiTestCanvas extends Fragment {
-
- static final int INIT_TEXT_SIZE = (FONT_MAX_SIZE - FONT_MIN_SIZE) / 2;
-
- private BiDiTestView testView;
- private SeekBar textSizeSeekBar;
- private View currentView;
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- currentView = inflater.inflate(R.layout.canvas, container, false);
- return currentView;
- }
-
- @Override
- public void onViewCreated(View view, Bundle savedInstanceState) {
- super.onViewCreated(view, savedInstanceState);
-
- testView = (BiDiTestView) currentView.findViewById(R.id.testview);
- testView.setCurrentTextSize(INIT_TEXT_SIZE);
-
- textSizeSeekBar = (SeekBar) currentView.findViewById(R.id.seekbar);
- textSizeSeekBar.setProgress(INIT_TEXT_SIZE);
- textSizeSeekBar.setMax(FONT_MAX_SIZE - FONT_MIN_SIZE);
-
- textSizeSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
- public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
- testView.setCurrentTextSize(FONT_MIN_SIZE + progress);
- }
-
- public void onStartTrackingTouch(SeekBar seekBar) {
- }
-
- public void onStopTrackingTouch(SeekBar seekBar) {
- }
- });
- }
-}
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestView.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestView.java
deleted file mode 100644
index 0b1974a5b11d..000000000000
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestView.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Copyright (C) 2011 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 com.android.bidi;
-
-import android.content.Context;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.Rect;
-import android.text.TextPaint;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.View;
-
-public class BiDiTestView extends View {
-
- private static final String TAG = "BiDiTestView";
-
- private static final int BORDER_PADDING = 4;
- private static final int TEXT_PADDING = 16;
- private static final int TEXT_SIZE = 16;
- private static final int ORIGIN = 80;
-
- private static final float DEFAULT_ITALIC_SKEW_X = -0.25f;
-
- private Rect rect = new Rect();
-
- private String NORMAL_TEXT;
- private String NORMAL_LONG_TEXT;
- private String NORMAL_LONG_TEXT_2;
- private String NORMAL_LONG_TEXT_3;
- private String ITALIC_TEXT;
- private String BOLD_TEXT;
- private String BOLD_ITALIC_TEXT;
- private String ARABIC_TEXT;
- private String CHINESE_TEXT;
- private String MIXED_TEXT_1;
- private String HEBREW_TEXT;
- private String RTL_TEXT;
- private String THAI_TEXT;
-
- private int currentTextSize;
-
- public BiDiTestView(Context context) {
- super(context);
- init(context);
- }
-
- public BiDiTestView(Context context, AttributeSet attrs) {
- super(context, attrs);
- init(context);
- }
-
- public BiDiTestView(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- init(context);
- }
-
- private void init(Context context) {
- NORMAL_TEXT = context.getString(R.string.normal_text);
- NORMAL_LONG_TEXT = context.getString(R.string.normal_long_text);
- NORMAL_LONG_TEXT_2 = context.getString(R.string.normal_long_text_2);
- NORMAL_LONG_TEXT_3 = context.getString(R.string.normal_long_text_3);
- ITALIC_TEXT = context.getString(R.string.italic_text);
- BOLD_TEXT = context.getString(R.string.bold_text);
- BOLD_ITALIC_TEXT = context.getString(R.string.bold_italic_text);
- ARABIC_TEXT = context.getString(R.string.arabic_text);
- CHINESE_TEXT = context.getString(R.string.chinese_text);
- MIXED_TEXT_1 = context.getString(R.string.mixed_text_1);
- HEBREW_TEXT = context.getString(R.string.hebrew_text);
- RTL_TEXT = context.getString(R.string.rtl);
- THAI_TEXT = context.getString(R.string.pointer_location);
- }
-
- public void setCurrentTextSize(int size) {
- currentTextSize = size;
- invalidate();
- }
-
- @Override
- public void onDraw(Canvas canvas) {
- drawInsideRect(canvas, new Paint(), Color.BLACK);
-
- int deltaX = 0;
-
- deltaX = testString(canvas, NORMAL_TEXT, ORIGIN, ORIGIN,
- false, false, Paint.DIRECTION_LTR, currentTextSize);
-
- deltaX += testString(canvas, ITALIC_TEXT, ORIGIN + deltaX, ORIGIN,
- true, false, Paint.DIRECTION_LTR, currentTextSize);
-
- deltaX += testString(canvas, BOLD_TEXT, ORIGIN + deltaX, ORIGIN,
- false, true, Paint.DIRECTION_LTR, currentTextSize);
-
- deltaX += testString(canvas, BOLD_ITALIC_TEXT, ORIGIN + deltaX, ORIGIN,
- true, true, Paint.DIRECTION_LTR, currentTextSize);
-
- // Test with a long string
- deltaX = testString(canvas, NORMAL_LONG_TEXT, ORIGIN, ORIGIN + 2 * currentTextSize,
- false, false, Paint.DIRECTION_LTR, currentTextSize);
-
- // Test with a long string
- deltaX = testString(canvas, NORMAL_LONG_TEXT_2, ORIGIN, ORIGIN + 4 * currentTextSize,
- false, false, Paint.DIRECTION_LTR, currentTextSize);
-
- // Test with a long string
- deltaX = testString(canvas, NORMAL_LONG_TEXT_3, ORIGIN, ORIGIN + 6 * currentTextSize,
- false, false, Paint.DIRECTION_LTR, currentTextSize);
-
- // Test Arabic ligature
- deltaX = testString(canvas, ARABIC_TEXT, ORIGIN, ORIGIN + 8 * currentTextSize,
- false, false, Paint.DIRECTION_RTL, currentTextSize);
-
- // Test Chinese
- deltaX = testString(canvas, CHINESE_TEXT, ORIGIN, ORIGIN + 10 * currentTextSize,
- false, false, Paint.DIRECTION_LTR, currentTextSize);
-
- // Test Mixed (English and Arabic)
- deltaX = testString(canvas, MIXED_TEXT_1, ORIGIN, ORIGIN + 12 * currentTextSize,
- false, false, Paint.DIRECTION_LTR, currentTextSize);
-
- // Test Hebrew
- deltaX = testString(canvas, RTL_TEXT, ORIGIN, ORIGIN + 14 * currentTextSize,
- false, false, Paint.DIRECTION_RTL, currentTextSize);
-
- // Test Thai
- deltaX = testString(canvas, THAI_TEXT, ORIGIN, ORIGIN + 16 * currentTextSize,
- false, false, Paint.DIRECTION_LTR, currentTextSize);
- }
-
- private int testString(Canvas canvas, String text, int x, int y,
- boolean isItalic, boolean isBold, int dir, int textSize) {
-
- TextPaint paint = new TextPaint();
- paint.setAntiAlias(true);
-
- // Set paint properties
- boolean oldFakeBold = paint.isFakeBoldText();
- paint.setFakeBoldText(isBold);
-
- float oldTextSkewX = paint.getTextSkewX();
- if (isItalic) {
- paint.setTextSkewX(DEFAULT_ITALIC_SKEW_X);
- }
-
- paint.setTextSize(textSize);
- paint.setColor(Color.WHITE);
- canvas.drawText(text, x, y, paint);
-
- int length = text.length();
- float[] advances = new float[length];
- float textWidthHB = paint.getTextRunAdvances(text, 0, length, 0, length, dir, advances, 0);
- setPaintDir(paint, dir);
- float textWidthICU = paint.getTextRunAdvances(text, 0, length, 0, length, dir, advances, 0,
- 1 /* use ICU */);
-
- logAdvances(text, textWidthHB, textWidthICU, advances);
- drawMetricsAroundText(canvas, x, y, textWidthHB, textWidthICU, textSize, Color.RED, Color.GREEN);
-
- // Restore old paint properties
- paint.setFakeBoldText(oldFakeBold);
- paint.setTextSkewX(oldTextSkewX);
-
- return (int) Math.ceil(textWidthHB) + TEXT_PADDING;
- }
-
- private void setPaintDir(Paint paint, int dir) {
- Log.v(TAG, "Setting Paint dir=" + dir);
- paint.setBidiFlags(dir);
- }
-
- private void drawInsideRect(Canvas canvas, Paint paint, int color) {
- paint.setColor(color);
- int width = getWidth();
- int height = getHeight();
- rect.set(BORDER_PADDING, BORDER_PADDING, width - BORDER_PADDING, height - BORDER_PADDING);
- canvas.drawRect(rect, paint);
- }
-
- private void drawMetricsAroundText(Canvas canvas, int x, int y, float textWidthHB,
- float textWidthICU, int textSize, int color, int colorICU) {
- Paint paint = new Paint();
- paint.setColor(color);
- canvas.drawLine(x, y - textSize, x, y + 8, paint);
- canvas.drawLine(x, y + 8, x + textWidthHB, y + 8, paint);
- canvas.drawLine(x + textWidthHB, y - textSize, x + textWidthHB, y + 8, paint);
- paint.setColor(colorICU);
- canvas.drawLine(x + textWidthICU, y - textSize, x + textWidthICU, y + 8, paint);
- }
-
- private void logAdvances(String text, float textWidth, float textWidthICU, float[] advances) {
- Log.v(TAG, "Advances for text: " + text + " total= " + textWidth + " - totalICU= " + textWidthICU);
-// int length = advances.length;
-// for(int n=0; n<length; n++){
-// Log.v(TAG, "adv[" + n + "]=" + advances[n]);
-// }
- }
-}
diff --git a/tools/aapt/AaptAssets.cpp b/tools/aapt/AaptAssets.cpp
index 5b71adc81cbe..2149190b10be 100644
--- a/tools/aapt/AaptAssets.cpp
+++ b/tools/aapt/AaptAssets.cpp
@@ -1185,6 +1185,11 @@ bool AaptGroupEntry::getDensityName(const char* name,
return true;
}
+ if (strcmp(name, "xxxhdpi") == 0) {
+ if (out) out->density = ResTable_config::DENSITY_XXXHIGH;
+ return true;
+ }
+
char* c = (char*)name;
while (*c >= '0' && *c <= '9') {
c++;
diff --git a/tools/layoutlib/bridge/src/android/text/format/DateFormat_Delegate.java b/tools/layoutlib/bridge/src/android/text/format/DateFormat_Delegate.java
new file mode 100644
index 000000000000..8cd1a695eabc
--- /dev/null
+++ b/tools/layoutlib/bridge/src/android/text/format/DateFormat_Delegate.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2013 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.text.format;
+
+import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
+
+import android.content.Context;
+
+
+/**
+ * Delegate used to provide new implementation for the native methods of {@link DateFormat}
+ *
+ * Through the layoutlib_create tool, the original methods of DateFormat have been replaced
+ * by calls to methods of the same name in this delegate class.
+ *
+ */
+public class DateFormat_Delegate {
+
+ @LayoutlibDelegate
+ /*package*/ static boolean is24HourFormat(Context context) {
+ return false;
+ }
+}
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java
index 80a1a60cb297..d9550404d48a 100644
--- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java
@@ -110,6 +110,7 @@ public final class CreateInfo implements ICreateInfo {
"android.os.Handler#sendMessageAtTime",
"android.os.HandlerThread#run",
"android.os.Build#getString",
+ "android.text.format.DateFormat#is24HourFormat",
"android.view.Choreographer#getRefreshRate",
"android.view.Display#updateDisplayInfoLocked",
"android.view.LayoutInflater#rInflate",