diff options
86 files changed, 2502 insertions, 1754 deletions
@@ -409,7 +409,9 @@ web_docs_sample_code_flags := \ -samplecode $(sample_dir)/Wiktionary \ resources/samples/Wiktionary "Wiktionary" \ -samplecode $(sample_dir)/WiktionarySimple \ - resources/samples/WiktionarySimple "Wiktionary (Simplified)" + resources/samples/WiktionarySimple "Wiktionary (Simplified)" \ + -samplecode $(sample_dir)/VoiceRecognitionService \ + resources/samples/VoiceRecognitionService "Voice Recognition Service" ## SDK version identifiers used in the published docs # major[.minor] version for current SDK. (full releases only) diff --git a/api/current.xml b/api/current.xml index d3ec86a..5b8b40c 100644 --- a/api/current.xml +++ b/api/current.xml @@ -1537,6 +1537,17 @@ visibility="public" > </field> +<field name="cycle_interpolator" + type="int" + transient="false" + volatile="false" + value="17432588" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> <field name="decelerate_interpolator" type="int" transient="false" @@ -43257,6 +43268,19 @@ <parameter name="activity" type="android.content.ComponentName"> </parameter> </method> +<method name="canonicalToCurrentPackageNames" + return="java.lang.String[]" + abstract="true" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="names" type="java.lang.String[]"> +</parameter> +</method> <method name="checkPermission" return="int" abstract="true" @@ -43315,6 +43339,19 @@ <parameter name="packageName" type="java.lang.String"> </parameter> </method> +<method name="currentToCanonicalPackageNames" + return="java.lang.String[]" + abstract="true" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="names" type="java.lang.String[]"> +</parameter> +</method> <method name="getActivityIcon" return="android.graphics.drawable.Drawable" abstract="true" @@ -139858,7 +139895,7 @@ deprecated="not deprecated" visibility="public" > -<parameter name="bundleWithValues" type="android.os.Bundle"> +<parameter name="bundle" type="android.os.Bundle"> </parameter> </constructor> <method name="fillInNotifierBundle" @@ -140867,7 +140904,7 @@ type="android.test.ActivityInstrumentationTestCase2" static="false" final="false" - deprecated="not deprecated" + deprecated="deprecated" visibility="public" > <parameter name="pkg" type="java.lang.String"> @@ -140875,6 +140912,16 @@ <parameter name="activityClass" type="java.lang.Class<T>"> </parameter> </constructor> +<constructor name="ActivityInstrumentationTestCase2" + type="android.test.ActivityInstrumentationTestCase2" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="activityClass" type="java.lang.Class<T>"> +</parameter> +</constructor> <method name="getActivity" return="T" abstract="false" @@ -145995,6 +146042,19 @@ <parameter name="activity" type="android.content.ComponentName"> </parameter> </method> +<method name="canonicalToCurrentPackageNames" + return="java.lang.String[]" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="names" type="java.lang.String[]"> +</parameter> +</method> <method name="checkPermission" return="int" abstract="false" @@ -146053,6 +146113,19 @@ <parameter name="packageName" type="java.lang.String"> </parameter> </method> +<method name="currentToCanonicalPackageNames" + return="java.lang.String[]" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="names" type="java.lang.String[]"> +</parameter> +</method> <method name="getActivityIcon" return="android.graphics.drawable.Drawable" abstract="false" @@ -164663,6 +164736,17 @@ visibility="public" > </field> +<field name="KEYBOARD_TAP" + type="int" + transient="false" + volatile="false" + value="3" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> <field name="LONG_PRESS" type="int" transient="false" @@ -164674,6 +164758,17 @@ visibility="public" > </field> +<field name="SCROLL_BARRIER" + type="int" + transient="false" + volatile="false" + value="2" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> <field name="VIRTUAL_KEY" type="int" transient="false" @@ -173088,6 +173183,25 @@ <parameter name="heightMeasureSpec" type="int"> </parameter> </method> +<method name="onOverscrolled" + return="void" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="protected" +> +<parameter name="scrollX" type="int"> +</parameter> +<parameter name="scrollY" type="int"> +</parameter> +<parameter name="clampedX" type="boolean"> +</parameter> +<parameter name="clampedY" type="boolean"> +</parameter> +</method> <method name="onRestoreInstanceState" return="void" abstract="false" @@ -173241,6 +173355,33 @@ <parameter name="visibility" type="int"> </parameter> </method> +<method name="overscrollBy" + return="boolean" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="protected" +> +<parameter name="deltaX" type="int"> +</parameter> +<parameter name="deltaY" type="int"> +</parameter> +<parameter name="scrollX" type="int"> +</parameter> +<parameter name="scrollY" type="int"> +</parameter> +<parameter name="scrollRangeX" type="int"> +</parameter> +<parameter name="scrollRangeY" type="int"> +</parameter> +<parameter name="maxOverscrollX" type="int"> +</parameter> +<parameter name="maxOverscrollY" type="int"> +</parameter> +</method> <method name="performClick" return="boolean" abstract="false" diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c index cd0302c..a447f53 100644 --- a/cmds/installd/commands.c +++ b/cmds/installd/commands.c @@ -690,6 +690,83 @@ void mkinnerdirs(char* path, int basepos, mode_t mode, int uid, int gid) } } +int movefileordir(char* srcpath, char* dstpath, int dstuid, int dstgid, + struct stat* statbuf) +{ + DIR *d; + struct dirent *de; + int res; + + int srcend = strlen(srcpath); + int dstend = strlen(dstpath); + + if (lstat(srcpath, statbuf) < 0) { + LOGW("Unable to stat %s: %s\n", srcpath, strerror(errno)); + return 1; + } + + if ((statbuf->st_mode&S_IFDIR) == 0) { + LOGI("Renaming %s to %s (uid %d)\n", srcpath, dstpath, dstuid); + mkinnerdirs(dstpath, dstend-1, S_IRWXU|S_IRWXG|S_IXOTH, dstuid, dstgid); + if (rename(srcpath, dstpath) >= 0) { + if (chown(dstpath, dstuid, dstgid) < 0) { + LOGE("cannot chown %s: %s\n", dstpath, strerror(errno)); + unlink(dstpath); + return 1; + } + } else { + LOGW("Unable to rename %s to %s: %s\n", + srcpath, dstpath, strerror(errno)); + return 1; + } + return 0; + } + + d = opendir(srcpath); + if (d == NULL) { + LOGW("Unable to opendir %s: %s\n", srcpath, strerror(errno)); + return 1; + } + + res = 0; + + while ((de = readdir(d))) { + const char *name = de->d_name; + /* always skip "." and ".." */ + if (name[0] == '.') { + if (name[1] == 0) continue; + if ((name[1] == '.') && (name[2] == 0)) continue; + } + + if ((srcend+strlen(name)) >= (PKG_PATH_MAX-2)) { + LOGW("Source path too long; skipping: %s/%s\n", srcpath, name); + continue; + } + + if ((dstend+strlen(name)) >= (PKG_PATH_MAX-2)) { + LOGW("Destination path too long; skipping: %s/%s\n", dstpath, name); + continue; + } + + srcpath[srcend] = dstpath[dstend] = '/'; + strcpy(srcpath+srcend+1, name); + strcpy(dstpath+dstend+1, name); + + if (movefileordir(srcpath, dstpath, dstuid, dstgid, statbuf) != 0) { + res = 1; + } + + // Note: we will be leaving empty directories behind in srcpath, + // but that is okay, the package manager will be erasing all of the + // data associated with .apks that disappear. + + srcpath[srcend] = dstpath[dstend] = 0; + } + + closedir(d); + return res; +} + int movefiles() { DIR *d; @@ -703,7 +780,7 @@ int movefiles() char dstpkg[PKG_NAME_MAX]; char srcpath[PKG_PATH_MAX]; char dstpath[PKG_PATH_MAX]; - int dstuid, dstgid; + int dstuid=-1, dstgid=-1; int hasspace; d = opendir(UPDATE_COMMANDS_DIR_PREFIX); @@ -757,18 +834,7 @@ int movefiles() LOGV("Move file: %s (from %s to %s)\n", buf+bufp, srcpkg, dstpkg); if (!create_move_path(srcpath, PKG_DIR_PREFIX, srcpkg, buf+bufp) && !create_move_path(dstpath, PKG_DIR_PREFIX, dstpkg, buf+bufp)) { - LOGI("Renaming %s to %s (uid %d)\n", srcpath, dstpath, dstuid); - mkinnerdirs(dstpath, strlen(dstpath)-(bufi-bufp), - S_IRWXU|S_IRWXG|S_IXOTH, dstuid, dstgid); - if (rename(srcpath, dstpath) >= 0) { - if (chown(dstpath, dstuid, dstgid) < 0) { - LOGE("cannot chown %s: %s\n", dstpath, strerror(errno)); - unlink(dstpath); - } - } else { - LOGW("Unable to rename %s to %s: %s\n", - srcpath, dstpath, strerror(errno)); - } + movefileordir(srcpath, dstpath, dstuid, dstgid, &s); } } } else { @@ -812,10 +878,11 @@ int movefiles() dstuid = s.st_uid; dstgid = s.st_gid; } else { + // Destination package doesn't + // exist... due to original-package, + // this is normal, so don't be + // noisy about it. srcpkg[0] = 0; - LOGW("Can't stat path %s in %s%s: %s\n", - dstpath, UPDATE_COMMANDS_DIR_PREFIX, - name, strerror(errno)); } } else { srcpkg[0] = 0; diff --git a/common/java/com/android/common/Base64.java b/common/java/com/android/common/Base64.java index 772d567..d65e24e 100644 --- a/common/java/com/android/common/Base64.java +++ b/common/java/com/android/common/Base64.java @@ -51,6 +51,13 @@ public class Base64 { */ public static final int WEB_SAFE = 8; + /** + * Flag to pass to Base64OutputStream to indicate that it should + * not close the output stream it is wrapping when it itself is + * closed. + */ + public static final int NO_CLOSE = 16; + // -------------------------------------------------------- // decoding // -------------------------------------------------------- diff --git a/common/java/com/android/common/Base64InputStream.java b/common/java/com/android/common/Base64InputStream.java new file mode 100644 index 0000000..1969bc4 --- /dev/null +++ b/common/java/com/android/common/Base64InputStream.java @@ -0,0 +1,169 @@ +/* + * Copyright (C) 2010 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.common; + +import java.io.FilterInputStream; +import java.io.IOException; +import java.io.InputStream; + +/** + * An OutputStream that does either Base64 encoding or decoding on the + * data written to it, writing the resulting data to another + * OutputStream. + */ +public class Base64InputStream extends FilterInputStream { + private final boolean encode; + private final Base64.EncoderState estate; + private final Base64.DecoderState dstate; + + private static byte[] EMPTY = new byte[0]; + + private static final int BUFFER_SIZE = 2048; + private boolean eof; + private byte[] inputBuffer; + private byte[] outputBuffer; + private int outputStart; + private int outputEnd; + + /** + * An InputStream that performs Base64 decoding on the data read + * from the wrapped stream. + * + * @param in the InputStream to read the source data from + * @param flags bit flags for controlling the decoder; see the + * constants in {@link Base64} + */ + public Base64InputStream(InputStream out, int flags) { + this(out, flags, false); + } + + /** + * Performs Base64 encoding or decoding on the data read from the + * wrapped InputStream. + * + * @param in the InputStream to read the source data from + * @param flags bit flags for controlling the decoder; see the + * constants in {@link Base64} + * @param encode true to encode, false to decode + */ + public Base64InputStream(InputStream out, int flags, boolean encode) { + super(out); + this.encode = encode; + eof = false; + inputBuffer = new byte[BUFFER_SIZE]; + if (encode) { + // len*8/5+10 is an overestimate of the most bytes the + // encoder can produce for len bytes of input. + outputBuffer = new byte[BUFFER_SIZE * 8/5 + 10]; + estate = new Base64.EncoderState(flags, outputBuffer); + dstate = null; + } else { + // len*3/4+10 is an overestimate of the most bytes the + // decoder can produce for len bytes of input. + outputBuffer = new byte[BUFFER_SIZE * 3/4 + 10]; + estate = null; + dstate = new Base64.DecoderState(flags, outputBuffer); + } + outputStart = 0; + outputEnd = 0; + } + + public boolean markSupported() { + return false; + } + + public void mark(int readlimit) { + throw new UnsupportedOperationException(); + } + + public void reset() { + throw new UnsupportedOperationException(); + } + + public void close() throws IOException { + in.close(); + inputBuffer = null; + } + + public int available() { + return outputEnd - outputStart; + } + + public long skip(long n) throws IOException { + if (outputStart >= outputEnd) { + refill(); + } + if (outputStart >= outputEnd) { + return 0; + } + long bytes = Math.min(n, outputEnd-outputStart); + outputStart += bytes; + return bytes; + } + + public int read() throws IOException { + if (outputStart >= outputEnd) { + refill(); + } + if (outputStart >= outputEnd) { + return -1; + } else { + return outputBuffer[outputStart++]; + } + } + + public int read(byte[] b, int off, int len) throws IOException { + if (outputStart >= outputEnd) { + refill(); + } + if (outputStart >= outputEnd) { + return -1; + } + int bytes = Math.min(len, outputEnd-outputStart); + System.arraycopy(outputBuffer, outputStart, b, off, bytes); + outputStart += bytes; + return bytes; + } + + /** + * Read data from the input stream into inputBuffer, then + * decode/encode it into the empty outputBuffer, and reset the + * outputStart and outputEnd pointers. + */ + private void refill() throws IOException { + if (eof) return; + int bytesRead = in.read(inputBuffer); + if (encode) { + if (bytesRead == -1) { + eof = true; + Base64.encodeInternal(EMPTY, 0, 0, estate, true); + } else { + Base64.encodeInternal(inputBuffer, 0, bytesRead, estate, false); + } + outputEnd = estate.op; + } else { + if (bytesRead == -1) { + eof = true; + Base64.decodeInternal(EMPTY, 0, 0, dstate, true); + } else { + Base64.decodeInternal(inputBuffer, 0, bytesRead, dstate, false); + } + outputEnd = dstate.op; + } + outputStart = 0; + } +} diff --git a/common/java/com/android/common/Base64OutputStream.java b/common/java/com/android/common/Base64OutputStream.java index 7c37428..76e1b6a 100644 --- a/common/java/com/android/common/Base64OutputStream.java +++ b/common/java/com/android/common/Base64OutputStream.java @@ -29,6 +29,7 @@ public class Base64OutputStream extends FilterOutputStream { private final boolean encode; private final Base64.EncoderState estate; private final Base64.DecoderState dstate; + private final int flags; private byte[] buffer = null; private int bpos = 0; @@ -59,6 +60,7 @@ public class Base64OutputStream extends FilterOutputStream { */ public Base64OutputStream(OutputStream out, int flags, boolean encode) { super(out); + this.flags = flags; this.encode = encode; if (encode) { estate = new Base64.EncoderState(flags, null); @@ -106,7 +108,11 @@ public class Base64OutputStream extends FilterOutputStream { public void close() throws IOException { flushBuffer(); internalWrite(EMPTY, 0, 0, true); - out.close(); + if ((flags & Base64.NO_CLOSE) == 0) { + out.close(); + } else { + out.flush(); + } } /** diff --git a/common/java/com/android/common/ui/PointerLocationView.java b/common/java/com/android/common/ui/PointerLocationView.java new file mode 100644 index 0000000..e83c5ae --- /dev/null +++ b/common/java/com/android/common/ui/PointerLocationView.java @@ -0,0 +1,333 @@ +package com.android.common.ui; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.graphics.Paint.FontMetricsInt; +import android.util.Log; +import android.view.MotionEvent; +import android.view.VelocityTracker; +import android.view.View; +import android.view.ViewConfiguration; + +import java.util.ArrayList; + +public class PointerLocationView extends View { + public static class PointerState { + private final ArrayList<Float> mXs = new ArrayList<Float>(); + private final ArrayList<Float> mYs = new ArrayList<Float>(); + private boolean mCurDown; + private int mCurX; + private int mCurY; + private float mCurPressure; + private float mCurSize; + private int mCurWidth; + private VelocityTracker mVelocity; + } + + private final ViewConfiguration mVC; + private final Paint mTextPaint; + private final Paint mTextBackgroundPaint; + private final Paint mTextLevelPaint; + private final Paint mPaint; + private final Paint mTargetPaint; + private final Paint mPathPaint; + private final FontMetricsInt mTextMetrics = new FontMetricsInt(); + private int mHeaderBottom; + private boolean mCurDown; + private int mCurNumPointers; + private int mMaxNumPointers; + private final ArrayList<PointerState> mPointers + = new ArrayList<PointerState>(); + + private boolean mPrintCoords = true; + + public PointerLocationView(Context c) { + super(c); + mVC = ViewConfiguration.get(c); + mTextPaint = new Paint(); + mTextPaint.setAntiAlias(true); + mTextPaint.setTextSize(10 + * getResources().getDisplayMetrics().density); + mTextPaint.setARGB(255, 0, 0, 0); + mTextBackgroundPaint = new Paint(); + mTextBackgroundPaint.setAntiAlias(false); + mTextBackgroundPaint.setARGB(128, 255, 255, 255); + mTextLevelPaint = new Paint(); + mTextLevelPaint.setAntiAlias(false); + mTextLevelPaint.setARGB(192, 255, 0, 0); + mPaint = new Paint(); + mPaint.setAntiAlias(true); + mPaint.setARGB(255, 255, 255, 255); + mPaint.setStyle(Paint.Style.STROKE); + mPaint.setStrokeWidth(2); + mTargetPaint = new Paint(); + mTargetPaint.setAntiAlias(false); + mTargetPaint.setARGB(255, 0, 0, 192); + mPathPaint = new Paint(); + mPathPaint.setAntiAlias(false); + mPathPaint.setARGB(255, 0, 96, 255); + mPaint.setStyle(Paint.Style.STROKE); + mPaint.setStrokeWidth(1); + + PointerState ps = new PointerState(); + ps.mVelocity = VelocityTracker.obtain(); + mPointers.add(ps); + } + + public void setPrintCoords(boolean state) { + mPrintCoords = state; + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + mTextPaint.getFontMetricsInt(mTextMetrics); + mHeaderBottom = -mTextMetrics.ascent+mTextMetrics.descent+2; + if (false) { + Log.i("foo", "Metrics: ascent=" + mTextMetrics.ascent + + " descent=" + mTextMetrics.descent + + " leading=" + mTextMetrics.leading + + " top=" + mTextMetrics.top + + " bottom=" + mTextMetrics.bottom); + } + } + + @Override + protected void onDraw(Canvas canvas) { + synchronized (mPointers) { + final int w = getWidth(); + final int itemW = w/7; + final int base = -mTextMetrics.ascent+1; + final int bottom = mHeaderBottom; + + final int NP = mPointers.size(); + + if (NP > 0) { + final PointerState ps = mPointers.get(0); + canvas.drawRect(0, 0, itemW-1, bottom,mTextBackgroundPaint); + canvas.drawText("P: " + mCurNumPointers + " / " + mMaxNumPointers, + 1, base, mTextPaint); + + final int N = ps.mXs.size(); + if ((mCurDown && ps.mCurDown) || N == 0) { + canvas.drawRect(itemW, 0, (itemW * 2) - 1, bottom, mTextBackgroundPaint); + canvas.drawText("X: " + ps.mCurX, 1 + itemW, base, mTextPaint); + canvas.drawRect(itemW * 2, 0, (itemW * 3) - 1, bottom, mTextBackgroundPaint); + canvas.drawText("Y: " + ps.mCurY, 1 + itemW * 2, base, mTextPaint); + } else { + float dx = ps.mXs.get(N-1) - ps.mXs.get(0); + float dy = ps.mYs.get(N-1) - ps.mYs.get(0); + canvas.drawRect(itemW, 0, (itemW * 2) - 1, bottom, + Math.abs(dx) < mVC.getScaledTouchSlop() + ? mTextBackgroundPaint : mTextLevelPaint); + canvas.drawText("dX: " + String.format("%.1f", dx), 1 + itemW, base, mTextPaint); + canvas.drawRect(itemW * 2, 0, (itemW * 3) - 1, bottom, + Math.abs(dy) < mVC.getScaledTouchSlop() + ? mTextBackgroundPaint : mTextLevelPaint); + canvas.drawText("dY: " + String.format("%.1f", dy), 1 + itemW * 2, base, mTextPaint); + } + + canvas.drawRect(itemW * 3, 0, (itemW * 4) - 1, bottom, mTextBackgroundPaint); + int velocity = ps.mVelocity == null ? 0 : (int) (ps.mVelocity.getXVelocity() * 1000); + canvas.drawText("Xv: " + velocity, 1 + itemW * 3, base, mTextPaint); + + canvas.drawRect(itemW * 4, 0, (itemW * 5) - 1, bottom, mTextBackgroundPaint); + velocity = ps.mVelocity == null ? 0 : (int) (ps.mVelocity.getYVelocity() * 1000); + canvas.drawText("Yv: " + velocity, 1 + itemW * 4, base, mTextPaint); + + canvas.drawRect(itemW * 5, 0, (itemW * 6) - 1, bottom, mTextBackgroundPaint); + canvas.drawRect(itemW * 5, 0, (itemW * 5) + (ps.mCurPressure * itemW) - 1, + bottom, mTextLevelPaint); + canvas.drawText("Prs: " + String.format("%.2f", ps.mCurPressure), 1 + itemW * 5, + base, mTextPaint); + + canvas.drawRect(itemW * 6, 0, w, bottom, mTextBackgroundPaint); + canvas.drawRect(itemW * 6, 0, (itemW * 6) + (ps.mCurSize * itemW) - 1, + bottom, mTextLevelPaint); + canvas.drawText("Size: " + String.format("%.2f", ps.mCurSize), 1 + itemW * 6, + base, mTextPaint); + } + + for (int p=0; p<NP; p++) { + final PointerState ps = mPointers.get(p); + + if (mCurDown && ps.mCurDown) { + canvas.drawLine(0, (int)ps.mCurY, getWidth(), (int)ps.mCurY, mTargetPaint); + canvas.drawLine((int)ps.mCurX, 0, (int)ps.mCurX, getHeight(), mTargetPaint); + int pressureLevel = (int)(ps.mCurPressure*255); + mPaint.setARGB(255, pressureLevel, 128, 255-pressureLevel); + canvas.drawPoint(ps.mCurX, ps.mCurY, mPaint); + canvas.drawCircle(ps.mCurX, ps.mCurY, ps.mCurWidth, mPaint); + } + } + + for (int p=0; p<NP; p++) { + final PointerState ps = mPointers.get(p); + + final int N = ps.mXs.size(); + float lastX=0, lastY=0; + boolean haveLast = false; + boolean drawn = false; + mPaint.setARGB(255, 128, 255, 255); + for (int i=0; i<N; i++) { + float x = ps.mXs.get(i); + float y = ps.mYs.get(i); + if (Float.isNaN(x)) { + haveLast = false; + continue; + } + if (haveLast) { + canvas.drawLine(lastX, lastY, x, y, mPathPaint); + canvas.drawPoint(lastX, lastY, mPaint); + drawn = true; + } + lastX = x; + lastY = y; + haveLast = true; + } + + if (drawn) { + if (ps.mVelocity != null) { + mPaint.setARGB(255, 255, 64, 128); + float xVel = ps.mVelocity.getXVelocity() * (1000/60); + float yVel = ps.mVelocity.getYVelocity() * (1000/60); + canvas.drawLine(lastX, lastY, lastX+xVel, lastY+yVel, mPaint); + } else { + canvas.drawPoint(lastX, lastY, mPaint); + } + } + } + } + } + + public void addTouchEvent(MotionEvent event) { + synchronized (mPointers) { + int action = event.getAction(); + + //Log.i("Pointer", "Motion: action=0x" + Integer.toHexString(action) + // + " pointers=" + event.getPointerCount()); + + int NP = mPointers.size(); + + //mRect.set(0, 0, getWidth(), mHeaderBottom+1); + //invalidate(mRect); + //if (mCurDown) { + // mRect.set(mCurX-mCurWidth-3, mCurY-mCurWidth-3, + // mCurX+mCurWidth+3, mCurY+mCurWidth+3); + //} else { + // mRect.setEmpty(); + //} + if (action == MotionEvent.ACTION_DOWN) { + for (int p=0; p<NP; p++) { + final PointerState ps = mPointers.get(p); + ps.mXs.clear(); + ps.mYs.clear(); + ps.mVelocity = VelocityTracker.obtain(); + ps.mCurDown = false; + } + mPointers.get(0).mCurDown = true; + mMaxNumPointers = 0; + if (mPrintCoords) { + Log.i("Pointer", "Pointer 1: DOWN"); + } + } + + if ((action&MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_DOWN) { + final int id = (action&MotionEvent.ACTION_POINTER_ID_MASK) + >> MotionEvent.ACTION_POINTER_ID_SHIFT; + while (NP <= id) { + PointerState ps = new PointerState(); + ps.mVelocity = VelocityTracker.obtain(); + mPointers.add(ps); + NP++; + } + final PointerState ps = mPointers.get(id); + ps.mVelocity = VelocityTracker.obtain(); + ps.mCurDown = true; + if (mPrintCoords) { + Log.i("Pointer", "Pointer " + (id+1) + ": DOWN"); + } + } + + final int NI = event.getPointerCount(); + + mCurDown = action != MotionEvent.ACTION_UP + && action != MotionEvent.ACTION_CANCEL; + mCurNumPointers = mCurDown ? NI : 0; + if (mMaxNumPointers < mCurNumPointers) { + mMaxNumPointers = mCurNumPointers; + } + + for (int i=0; i<NI; i++) { + final PointerState ps = mPointers.get(event.getPointerId(i)); + ps.mVelocity.addMovement(event); + ps.mVelocity.computeCurrentVelocity(1); + final int N = event.getHistorySize(); + for (int j=0; j<N; j++) { + if (mPrintCoords) { + Log.i("Pointer", "Pointer " + (i+1) + ": (" + + event.getHistoricalX(i, j) + + ", " + event.getHistoricalY(i, j) + ")" + + " Prs=" + event.getHistoricalPressure(i, j) + + " Size=" + event.getHistoricalSize(i, j)); + } + ps.mXs.add(event.getHistoricalX(i, j)); + ps.mYs.add(event.getHistoricalY(i, j)); + } + if (mPrintCoords) { + Log.i("Pointer", "Pointer " + (i+1) + ": (" + + event.getX(i) + ", " + event.getY(i) + ")" + + " Prs=" + event.getPressure(i) + + " Size=" + event.getSize(i)); + } + ps.mXs.add(event.getX(i)); + ps.mYs.add(event.getY(i)); + ps.mCurX = (int)event.getX(i); + ps.mCurY = (int)event.getY(i); + //Log.i("Pointer", "Pointer #" + p + ": (" + ps.mCurX + // + "," + ps.mCurY + ")"); + ps.mCurPressure = event.getPressure(i); + ps.mCurSize = event.getSize(i); + ps.mCurWidth = (int)(ps.mCurSize*(getWidth()/3)); + } + + if ((action&MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_UP) { + final int id = (action&MotionEvent.ACTION_POINTER_ID_MASK) + >> MotionEvent.ACTION_POINTER_ID_SHIFT; + final PointerState ps = mPointers.get(id); + ps.mXs.add(Float.NaN); + ps.mYs.add(Float.NaN); + ps.mCurDown = false; + if (mPrintCoords) { + Log.i("Pointer", "Pointer " + (id+1) + ": UP"); + } + } + + if (action == MotionEvent.ACTION_UP) { + for (int i=0; i<NI; i++) { + final PointerState ps = mPointers.get(event.getPointerId(i)); + if (ps.mCurDown) { + ps.mCurDown = false; + if (mPrintCoords) { + Log.i("Pointer", "Pointer " + (i+1) + ": UP"); + } + } + } + } + + //if (mCurDown) { + // mRect.union(mCurX-mCurWidth-3, mCurY-mCurWidth-3, + // mCurX+mCurWidth+3, mCurY+mCurWidth+3); + //} + //invalidate(mRect); + postInvalidate(); + } + } + + @Override + public boolean onTouchEvent(MotionEvent event) { + addTouchEvent(event); + return true; + } +} diff --git a/common/tests/src/com/android/common/Base64Test.java b/common/tests/src/com/android/common/Base64Test.java index e6b491f..1064625f2 100644 --- a/common/tests/src/com/android/common/Base64Test.java +++ b/common/tests/src/com/android/common/Base64Test.java @@ -18,6 +18,7 @@ package com.android.common; import junit.framework.TestCase; +import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.util.Random; @@ -228,8 +229,13 @@ public class Base64Test extends TestCase { /** * Tests that Base64.encodeInternal does correct handling of the * tail for each call. + * + * This test is disabled because while it passes if you can get it + * to run, android's test infrastructure currently doesn't allow + * us to get at package-private members (Base64.EncoderState in + * this case). */ - public void testEncodeInternal() throws Exception { + public void XXXtestEncodeInternal() throws Exception { byte[] input = { (byte) 0x61, (byte) 0x62, (byte) 0x63 }; byte[] output = new byte[100]; @@ -272,6 +278,132 @@ public class Base64Test extends TestCase { assertEquals("YQ".getBytes(), 2, state.output, state.op); } + private static final String lipsum = + "Lorem ipsum dolor sit amet, consectetur adipiscing elit. " + + "Quisque congue eleifend odio, eu ornare nulla facilisis eget. " + + "Integer eget elit diam, sit amet laoreet nibh. Quisque enim " + + "urna, pharetra vitae consequat eget, adipiscing eu ante. " + + "Aliquam venenatis arcu nec nibh imperdiet tempor. In id dui " + + "eget lorem aliquam rutrum vel vitae eros. In placerat ornare " + + "pretium. Curabitur non fringilla mi. Fusce ultricies, turpis " + + "eu ultrices suscipit, ligula nisi consectetur eros, dapibus " + + "aliquet dui sapien a turpis. Donec ultricies varius ligula, " + + "ut hendrerit arcu malesuada at. Praesent sed elit pretium " + + "eros luctus gravida. In ac dolor lorem. Cras condimentum " + + "convallis elementum. Phasellus vel felis in nulla ultrices " + + "venenatis. Nam non tortor non orci convallis convallis. " + + "Nam tristique lacinia hendrerit. Pellentesque habitant morbi " + + "tristique senectus et netus et malesuada fames ac turpis " + + "egestas. Vivamus cursus, nibh eu imperdiet porta, magna " + + "ipsum mollis mauris, sit amet fringilla mi nisl eu mi. " + + "Phasellus posuere, leo at ultricies vehicula, massa risus " + + "volutpat sapien, eu tincidunt diam ipsum eget nulla. Cras " + + "molestie dapibus commodo. Ut vel tellus at massa gravida " + + "semper non sed orci."; + + public void testInputStream() throws Exception { + int[] flagses = { Base64.DEFAULT, + Base64.NO_PADDING, + Base64.NO_WRAP, + Base64.NO_PADDING | Base64.NO_WRAP, + Base64.CRLF, + Base64.WEB_SAFE }; + int[] writeLengths = { -10, -5, -1, 0, 1, 1, 2, 2, 3, 10, 100 }; + Random rng = new Random(32176L); + + // Test input needs to be at least 2048 bytes to fill up the + // read buffer of Base64InputStream. + byte[] plain = (lipsum + lipsum + lipsum + lipsum + lipsum).getBytes(); + + for (int flags: flagses) { + byte[] encoded = Base64.encode(plain, flags); + + ByteArrayInputStream bais; + Base64InputStream b64is; + byte[] actual = new byte[plain.length * 2]; + int ap; + int b; + + // ----- test decoding ("encoded" -> "plain") ----- + + // read as much as it will give us in one chunk + bais = new ByteArrayInputStream(encoded); + b64is = new Base64InputStream(bais, flags); + ap = 0; + while ((b = b64is.read(actual, ap, actual.length-ap)) != -1) { + ap += b; + } + assertEquals(actual, ap, plain); + + // read individual bytes + bais = new ByteArrayInputStream(encoded); + b64is = new Base64InputStream(bais, flags); + ap = 0; + while ((b = b64is.read()) != -1) { + actual[ap++] = (byte) b; + } + assertEquals(actual, ap, plain); + + // mix reads of variously-sized arrays with one-byte reads + bais = new ByteArrayInputStream(encoded); + b64is = new Base64InputStream(bais, flags); + ap = 0; + readloop: while (true) { + int l = writeLengths[rng.nextInt(writeLengths.length)]; + if (l >= 0) { + b = b64is.read(actual, ap, l); + if (b == -1) break readloop; + ap += b; + } else { + for (int i = 0; i < -l; ++i) { + if ((b = b64is.read()) == -1) break readloop; + actual[ap++] = (byte) b; + } + } + } + assertEquals(actual, ap, plain); + + // ----- test encoding ("plain" -> "encoded") ----- + + // read as much as it will give us in one chunk + bais = new ByteArrayInputStream(plain); + b64is = new Base64InputStream(bais, flags, true); + ap = 0; + while ((b = b64is.read(actual, ap, actual.length-ap)) != -1) { + ap += b; + } + assertEquals(actual, ap, encoded); + + // read individual bytes + bais = new ByteArrayInputStream(plain); + b64is = new Base64InputStream(bais, flags, true); + ap = 0; + while ((b = b64is.read()) != -1) { + actual[ap++] = (byte) b; + } + assertEquals(actual, ap, encoded); + + // mix reads of variously-sized arrays with one-byte reads + bais = new ByteArrayInputStream(plain); + b64is = new Base64InputStream(bais, flags, true); + ap = 0; + readloop: while (true) { + int l = writeLengths[rng.nextInt(writeLengths.length)]; + if (l >= 0) { + b = b64is.read(actual, ap, l); + if (b == -1) break readloop; + ap += b; + } else { + for (int i = 0; i < -l; ++i) { + if ((b = b64is.read()) == -1) break readloop; + actual[ap++] = (byte) b; + } + } + } + assertEquals(actual, ap, encoded); + } + } + /** * Tests that Base64OutputStream produces exactly the same results * as calling Base64.encode/.decode on an in-memory array. @@ -286,125 +418,103 @@ public class Base64Test extends TestCase { int[] writeLengths = { -10, -5, -1, 0, 1, 1, 2, 2, 3, 10, 100 }; Random rng = new Random(32176L); - // input needs to be at least 1024 bytes to test filling up - // the write(int) buffer. - byte[] input = ("Lorem ipsum dolor sit amet, consectetur adipiscing elit. " + - "Quisque congue eleifend odio, eu ornare nulla facilisis eget. " + - "Integer eget elit diam, sit amet laoreet nibh. Quisque enim " + - "urna, pharetra vitae consequat eget, adipiscing eu ante. " + - "Aliquam venenatis arcu nec nibh imperdiet tempor. In id dui " + - "eget lorem aliquam rutrum vel vitae eros. In placerat ornare " + - "pretium. Curabitur non fringilla mi. Fusce ultricies, turpis " + - "eu ultrices suscipit, ligula nisi consectetur eros, dapibus " + - "aliquet dui sapien a turpis. Donec ultricies varius ligula, " + - "ut hendrerit arcu malesuada at. Praesent sed elit pretium " + - "eros luctus gravida. In ac dolor lorem. Cras condimentum " + - "convallis elementum. Phasellus vel felis in nulla ultrices " + - "venenatis. Nam non tortor non orci convallis convallis. " + - "Nam tristique lacinia hendrerit. Pellentesque habitant morbi " + - "tristique senectus et netus et malesuada fames ac turpis " + - "egestas. Vivamus cursus, nibh eu imperdiet porta, magna " + - "ipsum mollis mauris, sit amet fringilla mi nisl eu mi. " + - "Phasellus posuere, leo at ultricies vehicula, massa risus " + - "volutpat sapien, eu tincidunt diam ipsum eget nulla. Cras " + - "molestie dapibus commodo. Ut vel tellus at massa gravida " + - "semper non sed orci.").getBytes(); - - for (int f = 0; f < flagses.length; ++f) { - int flags = flagses[f]; - - byte[] expected = Base64.encode(input, flags); + // Test input needs to be at least 1024 bytes to test filling + // up the write(int) buffer of Base64OutputStream. + byte[] plain = (lipsum + lipsum).getBytes(); + + for (int flags: flagses) { + byte[] encoded = Base64.encode(plain, flags); ByteArrayOutputStream baos; Base64OutputStream b64os; byte[] actual; int p; - // ----- test encoding ("input" -> "expected") ----- + // ----- test encoding ("plain" -> "encoded") ----- // one large write(byte[]) of the whole input baos = new ByteArrayOutputStream(); b64os = new Base64OutputStream(baos, flags); - b64os.write(input); + b64os.write(plain); b64os.close(); actual = baos.toByteArray(); - assertEquals(expected, actual); + assertEquals(encoded, actual); // many calls to write(int) baos = new ByteArrayOutputStream(); b64os = new Base64OutputStream(baos, flags); - for (int i = 0; i < input.length; ++i) { - b64os.write(input[i]); + for (int i = 0; i < plain.length; ++i) { + b64os.write(plain[i]); } b64os.close(); actual = baos.toByteArray(); - assertEquals(expected, actual); + assertEquals(encoded, actual); // intermixed sequences of write(int) with // write(byte[],int,int) of various lengths. baos = new ByteArrayOutputStream(); b64os = new Base64OutputStream(baos, flags); p = 0; - while (p < input.length) { + while (p < plain.length) { int l = writeLengths[rng.nextInt(writeLengths.length)]; - l = Math.min(l, input.length-p); + l = Math.min(l, plain.length-p); if (l >= 0) { - b64os.write(input, p, l); + b64os.write(plain, p, l); p += l; } else { - l = Math.min(-l, input.length-p); + l = Math.min(-l, plain.length-p); for (int i = 0; i < l; ++i) { - b64os.write(input[p+i]); + b64os.write(plain[p+i]); } p += l; } } b64os.close(); actual = baos.toByteArray(); - assertEquals(expected, actual); + assertEquals(encoded, actual); - // ----- test decoding ("expected" -> "input") ----- + // ----- test decoding ("encoded" -> "plain") ----- // one large write(byte[]) of the whole input baos = new ByteArrayOutputStream(); b64os = new Base64OutputStream(baos, flags, false); - b64os.write(expected); + b64os.write(encoded); b64os.close(); actual = baos.toByteArray(); - assertEquals(input, actual); + assertEquals(plain, actual); // many calls to write(int) baos = new ByteArrayOutputStream(); b64os = new Base64OutputStream(baos, flags, false); - for (int i = 0; i < expected.length; ++i) { - b64os.write(expected[i]); + for (int i = 0; i < encoded.length; ++i) { + b64os.write(encoded[i]); } b64os.close(); actual = baos.toByteArray(); - assertEquals(input, actual); + assertEquals(plain, actual); // intermixed sequences of write(int) with // write(byte[],int,int) of various lengths. baos = new ByteArrayOutputStream(); b64os = new Base64OutputStream(baos, flags, false); p = 0; - while (p < expected.length) { + while (p < encoded.length) { int l = writeLengths[rng.nextInt(writeLengths.length)]; - l = Math.min(l, expected.length-p); + l = Math.min(l, encoded.length-p); if (l >= 0) { - b64os.write(expected, p, l); + b64os.write(encoded, p, l); p += l; } else { - l = Math.min(-l, expected.length-p); + l = Math.min(-l, encoded.length-p); for (int i = 0; i < l; ++i) { - b64os.write(expected[p+i]); + b64os.write(encoded[p+i]); } p += l; } } b64os.close(); actual = baos.toByteArray(); - assertEquals(input, actual); + assertEquals(plain, actual); } } } diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java index 0a18fe5..b4fe698 100644 --- a/core/java/android/app/ContextImpl.java +++ b/core/java/android/app/ContextImpl.java @@ -1615,6 +1615,24 @@ class ContextImpl extends Context { } @Override + public String[] currentToCanonicalPackageNames(String[] names) { + try { + return mPM.currentToCanonicalPackageNames(names); + } catch (RemoteException e) { + throw new RuntimeException("Package manager has died", e); + } + } + + @Override + public String[] canonicalToCurrentPackageNames(String[] names) { + try { + return mPM.canonicalToCurrentPackageNames(names); + } catch (RemoteException e) { + throw new RuntimeException("Package manager has died", e); + } + } + + @Override public Intent getLaunchIntentForPackage(String packageName) { // First see if the package has an INFO activity; the existence of // such an activity is implied to be the desired front-door for the diff --git a/core/java/android/app/DeviceAdminInfo.java b/core/java/android/app/DeviceAdminInfo.java index 031bc8e..159fa75 100644 --- a/core/java/android/app/DeviceAdminInfo.java +++ b/core/java/android/app/DeviceAdminInfo.java @@ -303,8 +303,8 @@ public final class DeviceAdminInfo implements Parcelable { * Return true if the device admin has requested that it be able to use * the given policy control. The possible policy identifier inputs are: * {@link #USES_POLICY_LIMIT_PASSWORD}, {@link #USES_POLICY_WATCH_LOGIN}, - * {@link #USES_POLICY_RESET_PASSWORD}, {@link #USES_POLICY_LIMIT_UNLOCK}, - * {@link #USES_POLICY_FORCE_LOCK}, {@link #USES_POLICY_WIPE_DATA}. + * {@link #USES_POLICY_RESET_PASSWORD}, {@link #USES_POLICY_FORCE_LOCK}, + * {@link #USES_POLICY_WIPE_DATA}. */ public boolean usesPolicy(int policyIdent) { return (mUsesPolicies & (1<<policyIdent)) != 0; diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java index bdbe341..45f361e 100644 --- a/core/java/android/content/ContentResolver.java +++ b/core/java/android/content/ContentResolver.java @@ -31,6 +31,7 @@ import android.os.IBinder; import android.os.ParcelFileDescriptor; import android.os.RemoteException; import android.os.ServiceManager; +import android.os.SystemClock; import android.text.TextUtils; import android.util.Config; import android.util.EventLog; @@ -243,13 +244,13 @@ public abstract class ContentResolver { return null; } try { - long startTime = System.currentTimeMillis(); + long startTime = SystemClock.uptimeMillis(); Cursor qCursor = provider.query(uri, projection, selection, selectionArgs, sortOrder); if (qCursor == null) { releaseProvider(provider); return null; } - long durationMillis = System.currentTimeMillis() - startTime; + long durationMillis = SystemClock.uptimeMillis() - startTime; maybeLogQueryToEventLog(durationMillis, uri, projection, selection, sortOrder); // Wrap the cursor object into CursorWrapperInner object return new CursorWrapperInner(qCursor, provider); @@ -583,9 +584,9 @@ public abstract class ContentResolver { throw new IllegalArgumentException("Unknown URL " + url); } try { - long startTime = System.currentTimeMillis(); + long startTime = SystemClock.uptimeMillis(); Uri createdRow = provider.insert(url, values); - long durationMillis = System.currentTimeMillis() - startTime; + long durationMillis = SystemClock.uptimeMillis() - startTime; maybeLogUpdateToEventLog(durationMillis, url, "insert", null /* where */); return createdRow; } catch (RemoteException e) { @@ -642,9 +643,9 @@ public abstract class ContentResolver { throw new IllegalArgumentException("Unknown URL " + url); } try { - long startTime = System.currentTimeMillis(); + long startTime = SystemClock.uptimeMillis(); int rowsCreated = provider.bulkInsert(url, values); - long durationMillis = System.currentTimeMillis() - startTime; + long durationMillis = SystemClock.uptimeMillis() - startTime; maybeLogUpdateToEventLog(durationMillis, url, "bulkinsert", null /* where */); return rowsCreated; } catch (RemoteException e) { @@ -671,9 +672,9 @@ public abstract class ContentResolver { throw new IllegalArgumentException("Unknown URL " + url); } try { - long startTime = System.currentTimeMillis(); + long startTime = SystemClock.uptimeMillis(); int rowsDeleted = provider.delete(url, where, selectionArgs); - long durationMillis = System.currentTimeMillis() - startTime; + long durationMillis = SystemClock.uptimeMillis() - startTime; maybeLogUpdateToEventLog(durationMillis, url, "delete", where); return rowsDeleted; } catch (RemoteException e) { @@ -703,9 +704,9 @@ public abstract class ContentResolver { throw new IllegalArgumentException("Unknown URI " + uri); } try { - long startTime = System.currentTimeMillis(); + long startTime = SystemClock.uptimeMillis(); int rowsUpdated = provider.update(uri, values, where, selectionArgs); - long durationMillis = System.currentTimeMillis() - startTime; + long durationMillis = SystemClock.uptimeMillis() - startTime; maybeLogUpdateToEventLog(durationMillis, uri, "update", where); return rowsUpdated; } catch (RemoteException e) { diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl index 2c8c112..47789a5 100644 --- a/core/java/android/content/pm/IPackageManager.aidl +++ b/core/java/android/content/pm/IPackageManager.aidl @@ -47,6 +47,9 @@ interface IPackageManager { PackageInfo getPackageInfo(String packageName, int flags); int getPackageUid(String packageName); int[] getPackageGids(String packageName); + + String[] currentToCanonicalPackageNames(in String[] names); + String[] canonicalToCurrentPackageNames(in String[] names); PermissionInfo getPermissionInfo(String name, int flags); diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index a61eab9..17bee48 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -691,6 +691,23 @@ public abstract class PackageManager { throws NameNotFoundException; /** + * Map from the current package names in use on the device to whatever + * the current canonical name of that package is. + * @param names Array of current names to be mapped. + * @return Returns an array of the same size as the original, containing + * the canonical name for each package. + */ + public abstract String[] currentToCanonicalPackageNames(String[] names); + + /** + * Map from a packages canonical name to the current name in use on the device. + * @param names Array of new names to be mapped. + * @return Returns an array of the same size as the original, containing + * the current name for each package. + */ + public abstract String[] canonicalToCurrentPackageNames(String[] names); + + /** * Return a "good" intent to launch a front-door activity in a package, * for use for example to implement an "open" button when browsing through * packages. The current implementation will look first for a main diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java index 5d1e7cf..9ac8a4d 100644 --- a/core/java/android/database/sqlite/SQLiteDatabase.java +++ b/core/java/android/database/sqlite/SQLiteDatabase.java @@ -201,10 +201,17 @@ public class SQLiteDatabase extends SQLiteClosable { private long mLastLockMessageTime = 0L; - // always log queries which take 100ms+; shorter queries are sampled accordingly - private static final int QUERY_LOG_TIME_IN_NANOS = 100 * 1000000; + // Things related to query logging/sampling for debugging + // slow/frequent queries during development. Always log queries + // which take 100ms+; shorter queries are sampled accordingly. + // Commit statements, which are typically slow, are logged + // together with the most recently executed SQL statement, for + // disambiguation. + private static final int QUERY_LOG_TIME_IN_MILLIS = 100; private static final int QUERY_LOG_SQL_LENGTH = 64; + private static final String COMMIT_SQL = "COMMIT;"; private final Random mRandom = new Random(); + private String mLastSqlStatement = null; /** Used by native code, do not rename */ /* package */ int mNativeHandle = 0; @@ -540,7 +547,7 @@ public class SQLiteDatabase extends SQLiteClosable { } } if (mTransactionIsSuccessful) { - execSQL("COMMIT;"); + execSQL(COMMIT_SQL); } else { try { execSQL("ROLLBACK;"); @@ -1650,7 +1657,7 @@ public class SQLiteDatabase extends SQLiteClosable { * @throws SQLException If the SQL string is invalid for some reason */ public void execSQL(String sql) throws SQLException { - long timeStart = Debug.threadCpuTimeNanos(); + long timeStart = SystemClock.uptimeMillis(); lock(); try { native_execSQL(sql); @@ -1660,7 +1667,15 @@ public class SQLiteDatabase extends SQLiteClosable { } finally { unlock(); } - logTimeStat(sql, timeStart); + + // Log commit statements along with the most recently executed + // SQL statement for disambiguation. Note that instance + // equality to COMMIT_SQL is safe here. + if (sql == COMMIT_SQL) { + logTimeStat(sql + mLastSqlStatement, timeStart); + } else { + logTimeStat(sql, timeStart); + } } /** @@ -1676,7 +1691,7 @@ public class SQLiteDatabase extends SQLiteClosable { if (bindArgs == null) { throw new IllegalArgumentException("Empty bindArgs"); } - long timeStart = Debug.threadCpuTimeNanos(); + long timeStart = SystemClock.uptimeMillis(); lock(); SQLiteStatement statement = null; try { @@ -1785,17 +1800,22 @@ public class SQLiteDatabase extends SQLiteClosable { - /* package */ void logTimeStat(String sql, long beginNanos) { + /* package */ void logTimeStat(String sql, long beginMillis) { + // Keep track of the last statement executed here, as this is + // the common funnel through which all methods of hitting + // libsqlite eventually flow. + mLastSqlStatement = sql; + // Sample fast queries in proportion to the time taken. // Quantize the % first, so the logged sampling probability // exactly equals the actual sampling rate for this query. int samplePercent; - long nanos = Debug.threadCpuTimeNanos() - beginNanos; - if (nanos >= QUERY_LOG_TIME_IN_NANOS) { + long durationMillis = SystemClock.uptimeMillis() - beginMillis; + if (durationMillis >= QUERY_LOG_TIME_IN_MILLIS) { samplePercent = 100; } else { - samplePercent = (int) (100 * nanos / QUERY_LOG_TIME_IN_NANOS) + 1; + samplePercent = (int) (100 * durationMillis / QUERY_LOG_TIME_IN_MILLIS) + 1; if (mRandom.nextInt(100) >= samplePercent) return; } @@ -1812,8 +1832,8 @@ public class SQLiteDatabase extends SQLiteClosable { String blockingPackage = ActivityThread.currentPackageName(); if (blockingPackage == null) blockingPackage = ""; - int millis = (int) (nanos / 1000000); - EventLog.writeEvent(EVENT_DB_OPERATION, mPath, sql, millis, blockingPackage, samplePercent); + EventLog.writeEvent( + EVENT_DB_OPERATION, mPath, sql, durationMillis, blockingPackage, samplePercent); } /** diff --git a/core/java/android/database/sqlite/SQLiteQuery.java b/core/java/android/database/sqlite/SQLiteQuery.java index 5bcad4b..7cd9561 100644 --- a/core/java/android/database/sqlite/SQLiteQuery.java +++ b/core/java/android/database/sqlite/SQLiteQuery.java @@ -17,7 +17,7 @@ package android.database.sqlite; import android.database.CursorWindow; -import android.os.Debug; +import android.os.SystemClock; import android.util.Log; /** @@ -57,7 +57,7 @@ public class SQLiteQuery extends SQLiteProgram { */ /* package */ int fillWindow(CursorWindow window, int maxRead, int lastPos) { - long timeStart = Debug.threadCpuTimeNanos(); + long timeStart = SystemClock.uptimeMillis(); mDatabase.lock(); try { diff --git a/core/java/android/database/sqlite/SQLiteStatement.java b/core/java/android/database/sqlite/SQLiteStatement.java index f1f5a2a..f29b69f 100644 --- a/core/java/android/database/sqlite/SQLiteStatement.java +++ b/core/java/android/database/sqlite/SQLiteStatement.java @@ -16,7 +16,7 @@ package android.database.sqlite; -import android.os.Debug; +import android.os.SystemClock; /** * A pre-compiled statement against a {@link SQLiteDatabase} that can be reused. @@ -44,7 +44,7 @@ public class SQLiteStatement extends SQLiteProgram * some reason */ public void execute() { - long timeStart = Debug.threadCpuTimeNanos(); + long timeStart = SystemClock.uptimeMillis(); mDatabase.lock(); acquireReference(); @@ -68,7 +68,7 @@ public class SQLiteStatement extends SQLiteProgram * some reason */ public long executeInsert() { - long timeStart = Debug.threadCpuTimeNanos(); + long timeStart = SystemClock.uptimeMillis(); mDatabase.lock(); acquireReference(); @@ -91,7 +91,7 @@ public class SQLiteStatement extends SQLiteProgram * @throws android.database.sqlite.SQLiteDoneException if the query returns zero rows */ public long simpleQueryForLong() { - long timeStart = Debug.threadCpuTimeNanos(); + long timeStart = SystemClock.uptimeMillis(); mDatabase.lock(); acquireReference(); @@ -114,7 +114,7 @@ public class SQLiteStatement extends SQLiteProgram * @throws android.database.sqlite.SQLiteDoneException if the query returns zero rows */ public String simpleQueryForString() { - long timeStart = Debug.threadCpuTimeNanos(); + long timeStart = SystemClock.uptimeMillis(); mDatabase.lock(); acquireReference(); diff --git a/core/java/android/inputmethodservice/KeyboardView.java b/core/java/android/inputmethodservice/KeyboardView.java index 28a86b8..9201e3b 100644 --- a/core/java/android/inputmethodservice/KeyboardView.java +++ b/core/java/android/inputmethodservice/KeyboardView.java @@ -165,6 +165,7 @@ public class KeyboardView extends View implements View.OnClickListener { private static final int DELAY_BEFORE_PREVIEW = 0; private static final int DELAY_AFTER_PREVIEW = 70; + private static final int DEBOUNCE_TIME = 70; private int mVerticalCorrection; private int mProximityThreshold; @@ -1122,7 +1123,8 @@ public class KeyboardView extends View implements View.OnClickListener { mSwipeTracker.addMovement(me); // Ignore all motion events until a DOWN. - if (mAbortKey && action != MotionEvent.ACTION_DOWN) { + if (mAbortKey + && action != MotionEvent.ACTION_DOWN && action != MotionEvent.ACTION_CANCEL) { return true; } @@ -1206,6 +1208,7 @@ public class KeyboardView extends View implements View.OnClickListener { } } showPreview(mCurrentKey); + mLastMoveTime = eventTime; break; case MotionEvent.ACTION_UP: @@ -1219,7 +1222,8 @@ public class KeyboardView extends View implements View.OnClickListener { mCurrentKey = keyIndex; mCurrentKeyTime = 0; } - if (mCurrentKeyTime < mLastKeyTime && mLastKey != NOT_A_KEY) { + if (mCurrentKeyTime < mLastKeyTime && mCurrentKeyTime < DEBOUNCE_TIME + && mLastKey != NOT_A_KEY) { mCurrentKey = mLastKey; touchX = mLastCodeX; touchY = mLastCodeY; diff --git a/core/java/android/net/Downloads.java b/core/java/android/net/Downloads.java new file mode 100644 index 0000000..b86a0e2 --- /dev/null +++ b/core/java/android/net/Downloads.java @@ -0,0 +1,306 @@ +/* + * Copyright (C) 2008 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.net; + +import android.content.ContentResolver; +import android.content.ContentUris; +import android.content.ContentValues; +import android.content.Context; +import android.database.Cursor; +import android.net.Uri; +import android.os.SystemClock; +import android.provider.BaseColumns; +import android.util.Log; + +import java.io.File; + +/** + * The Download Manager + * + * @pending + */ +public final class Downloads { + + public static final class ByUri { + + /** @hide */ + private ByUri() {} + + /** + * Initiate a download where the download will be tracked by its URI. + * @pending + */ + public static boolean startDownloadByUri( + Context context, + String url, + boolean showDownload, + boolean allowRoaming, + String title, + String notification_package, + String notification_class) { + ContentResolver cr = context.getContentResolver(); + + // Tell download manager to start downloading update. + ContentValues values = new ContentValues(); + values.put(android.provider.Downloads.Impl.COLUMN_URI, url); + values.put(android.provider.Downloads.Impl.COLUMN_VISIBILITY, + showDownload ? android.provider.Downloads.Impl.VISIBILITY_VISIBLE + : android.provider.Downloads.Impl.VISIBILITY_HIDDEN); + if (title != null) { + values.put(android.provider.Downloads.Impl.COLUMN_TITLE, title); + } + values.put(android.provider.Downloads.Impl.COLUMN_APP_DATA, url); + values.put(android.provider.Downloads.Impl.COLUMN_DESTINATION, + allowRoaming ? android.provider.Downloads.Impl.DESTINATION_CACHE_PARTITION : + android.provider.Downloads.Impl.DESTINATION_CACHE_PARTITION_NOROAMING); + values.put(android.provider.Downloads.Impl.COLUMN_NO_INTEGRITY, true); // Don't check ETag + if (notification_package != null && notification_class != null) { + values.put(android.provider.Downloads.Impl.COLUMN_NOTIFICATION_PACKAGE, notification_package); + values.put(android.provider.Downloads.Impl.COLUMN_NOTIFICATION_CLASS, notification_class); + } + + if (cr.insert(android.provider.Downloads.Impl.CONTENT_URI, values) == null) { + return false; + } + return true; + } + + public static final class StatusInfo { + public boolean completed = false; + /** The filename of the active download. */ + public String filename = null; + /** An opaque id for the download */ + public long id = -1; + /** An opaque status code for the download */ + public int statusCode = -1; + /** Approximate number of bytes downloaded so far, for debugging purposes. */ + public long bytesSoFar = -1; + } + + /** @hide */ + private static final int STATUS_INVALID = 0; + /** @hide */ + private static final int STATUS_DOWNLOADING_UPDATE = 3; + /** @hide */ + private static final int STATUS_DOWNLOADED_UPDATE = 4; + + /** + * Column projection for the query to the download manager. This must match + * with the constants DOWNLOADS_COLUMN_*. + * @hide + */ + private static final String[] DOWNLOADS_PROJECTION = { + BaseColumns._ID, + android.provider.Downloads.Impl.COLUMN_APP_DATA, + android.provider.Downloads.Impl.COLUMN_STATUS, + android.provider.Downloads.Impl._DATA, + android.provider.Downloads.Impl.COLUMN_LAST_MODIFICATION, + android.provider.Downloads.Impl.COLUMN_CURRENT_BYTES, + }; + + /** + * The column index for the ID. + * @hide + */ + private static final int DOWNLOADS_COLUMN_ID = 0; + /** + * The column index for the URI. + * @hide + */ + private static final int DOWNLOADS_COLUMN_URI = 1; + /** + * The column index for the status code. + * @hide + */ + private static final int DOWNLOADS_COLUMN_STATUS = 2; + /** + * The column index for the filename. + * @hide + */ + private static final int DOWNLOADS_COLUMN_FILENAME = 3; + /** + * The column index for the last modification time. + * @hide + */ + private static final int DOWNLOADS_COLUMN_LAST_MODIFICATION = 4; + /** + * The column index for the number of bytes downloaded so far. + * @hide + */ + private static final int DOWNLOADS_COLUMN_CURRENT_BYTES = 5; + + /** + * Gets the status of a download. + * + * @param c A Cursor pointing to a download. The URL column is assumed to be valid. + * @return The status of the download. + * @hide + */ + private static final int getStatusOfDownload( + Cursor c, + long redownload_threshold) { + int status = c.getInt(DOWNLOADS_COLUMN_STATUS); + long realtime = SystemClock.elapsedRealtime(); + + // TODO(dougz): special handling of 503, 404? (eg, special + // explanatory messages to user) + + if (!android.provider.Downloads.Impl.isStatusCompleted(status)) { + // Check if it's stuck + long modified = c.getLong(DOWNLOADS_COLUMN_LAST_MODIFICATION); + long now = System.currentTimeMillis(); + if (now < modified || now - modified > redownload_threshold) { + return STATUS_INVALID; + } + + return STATUS_DOWNLOADING_UPDATE; + } + + if (android.provider.Downloads.Impl.isStatusError(status)) { + return STATUS_INVALID; + } + + String filename = c.getString(DOWNLOADS_COLUMN_FILENAME); + if (filename == null) { + return STATUS_INVALID; + } + + return STATUS_DOWNLOADED_UPDATE; + } + + /** + * Gets a Cursor pointing to the download(s) of the current system update. + * @hide + */ + private static final Cursor getCurrentOtaDownloads(Context context, String url) { + return context.getContentResolver().query( + android.provider.Downloads.Impl.CONTENT_URI, + DOWNLOADS_PROJECTION, + android.provider.Downloads.Impl.COLUMN_APP_DATA + "='" + url.replace("'", "''") + "'", + null, + null); + } + + /** + * Returns a StatusInfo with the result of trying to download the + * given URL. Returns null if no attempts have been made. + * @pending + */ + public static final StatusInfo getStatus( + Context context, + String url, + long redownload_threshold) { + StatusInfo result = null; + boolean hasFailedDownload = false; + long failedDownloadModificationTime = 0; + Cursor c = getCurrentOtaDownloads(context, url); + try { + while (c != null && c.moveToNext()) { + if (result == null) { + result = new StatusInfo(); + } + int status = getStatusOfDownload(c, redownload_threshold); + if (status == STATUS_DOWNLOADING_UPDATE || + status == STATUS_DOWNLOADED_UPDATE) { + result.completed = (status == STATUS_DOWNLOADED_UPDATE); + result.filename = c.getString(DOWNLOADS_COLUMN_FILENAME); + result.id = c.getLong(DOWNLOADS_COLUMN_ID); + result.statusCode = c.getInt(DOWNLOADS_COLUMN_STATUS); + result.bytesSoFar = c.getLong(DOWNLOADS_COLUMN_CURRENT_BYTES); + return result; + } + + long modTime = c.getLong(DOWNLOADS_COLUMN_LAST_MODIFICATION); + if (hasFailedDownload && + modTime < failedDownloadModificationTime) { + // older than the one already in result; skip it. + continue; + } + + hasFailedDownload = true; + failedDownloadModificationTime = modTime; + result.statusCode = c.getInt(DOWNLOADS_COLUMN_STATUS); + result.bytesSoFar = c.getLong(DOWNLOADS_COLUMN_CURRENT_BYTES); + } + } finally { + c.close(); + } + return result; + } + + /** + * Query where clause for general querying. + * @hide + */ + private static final String QUERY_WHERE_CLAUSE = + android.provider.Downloads.Impl.COLUMN_NOTIFICATION_PACKAGE + "=? AND " + + android.provider.Downloads.Impl.COLUMN_NOTIFICATION_CLASS + "=?"; + + /** + * Delete all the downloads for a package/class pair. + * @pending + */ + public static final void removeAllDownloadsByPackage( + Context context, + String notification_package, + String notification_class) { + context.getContentResolver().delete( + android.provider.Downloads.Impl.CONTENT_URI, + QUERY_WHERE_CLAUSE, + new String[] { notification_package, notification_class }); + } + + /** + * @pending + */ + public static final int getProgressColumnId() { + return 0; + } + + /** + * @pending + */ + public static final int getProgressColumnCurrentBytes() { + return 1; + } + + /** + * @pending + */ + public static final int getProgressColumnTotalBytes() { + return 2; + } + + /** @hide */ + private static final String[] PROJECTION = { + BaseColumns._ID, android.provider.Downloads.Impl.COLUMN_CURRENT_BYTES, android.provider.Downloads.Impl.COLUMN_TOTAL_BYTES + }; + + /** + * @pending + */ + public static final Cursor getProgressCursor(Context context, long id) { + Uri downloadUri = Uri.withAppendedPath(android.provider.Downloads.Impl.CONTENT_URI, String.valueOf(id)); + return context.getContentResolver().query(downloadUri, PROJECTION, null, null, null); + } + } + + /** + * @hide + */ + private Downloads() {} +} diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index ee7193b..bfab30a 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -1489,6 +1489,14 @@ public final class Settings { public static final String DEFAULT_INSTALL_LOCATION = "default_install_location"; /** + * Show pointer location on screen? + * 0 = no + * 1 = yes + * @hide + */ + public static final String POINTER_LOCATION = "pointer_location"; + + /** * Settings to backup. This is here so that it's in the same place as the settings * keys and easy to update. * @hide diff --git a/core/java/android/speech/RecognitionManager.java b/core/java/android/speech/RecognitionManager.java index edb7067..7f55ad6 100644 --- a/core/java/android/speech/RecognitionManager.java +++ b/core/java/android/speech/RecognitionManager.java @@ -171,7 +171,7 @@ public class RecognitionManager { */ public static boolean isRecognitionAvailable(final Context context) { final List<ResolveInfo> list = context.getPackageManager().queryIntentServices( - new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0); + new Intent(RecognitionService.SERVICE_INTERFACE), 0); return list != null && list.size() != 0; } @@ -221,7 +221,7 @@ public class RecognitionManager { if (mConnection == null) { // first time connection mConnection = new Connection(); - Intent serviceIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); + Intent serviceIntent = new Intent(RecognitionService.SERVICE_INTERFACE); String serviceComponent = Settings.Secure.getString(mContext.getContentResolver(), Settings.Secure.VOICE_RECOGNITION_SERVICE); diff --git a/core/java/android/speech/RecognitionService.java b/core/java/android/speech/RecognitionService.java index 5de6cf0..941b70c 100644 --- a/core/java/android/speech/RecognitionService.java +++ b/core/java/android/speech/RecognitionService.java @@ -30,8 +30,8 @@ import android.util.Log; /** * This class provides a base class for recognition service implementations. This class should be - * extended only in case you wish to implement a new speech recognizer. Please not that the - * implementation of this service is state-less. + * extended only in case you wish to implement a new speech recognizer. Please note that the + * implementation of this service is stateless. */ public abstract class RecognitionService extends Service { /** diff --git a/core/java/android/speech/tts/TextToSpeech.java b/core/java/android/speech/tts/TextToSpeech.java index bbbeb3f..0db2198 100755 --- a/core/java/android/speech/tts/TextToSpeech.java +++ b/core/java/android/speech/tts/TextToSpeech.java @@ -256,6 +256,31 @@ public class TextToSpeech { * the TextToSpeech engine specifies the locale associated with each resource file. */ public static final String EXTRA_VOICE_DATA_FILES_INFO = "dataFilesInfo"; + /** + * Extra information received with the {@link #ACTION_CHECK_TTS_DATA} intent where + * the TextToSpeech engine returns an ArrayList<String> of all the available voices. + * The format of each voice is: lang-COUNTRY-variant where COUNTRY and variant are + * optional (ie, "eng" or "eng-USA" or "eng-USA-FEMALE"). + * {@hide} + */ + public static final String EXTRA_AVAILABLE_VOICES = "availableVoices"; + /** + * Extra information received with the {@link #ACTION_CHECK_TTS_DATA} intent where + * the TextToSpeech engine returns an ArrayList<String> of all the unavailable voices. + * The format of each voice is: lang-COUNTRY-variant where COUNTRY and variant are + * optional (ie, "eng" or "eng-USA" or "eng-USA-FEMALE"). + * {@hide} + */ + public static final String EXTRA_UNAVAILABLE_VOICES = "unavailableVoices"; + /** + * Extra information sent with the {@link #ACTION_CHECK_TTS_DATA} intent where the + * caller indicates to the TextToSpeech engine which specific sets of voice data to + * check for by sending an ArrayList<String> of the voices that are of interest. + * The format of each voice is: lang-COUNTRY-variant where COUNTRY and variant are + * optional (ie, "eng" or "eng-USA" or "eng-USA-FEMALE"). + * {@hide} + */ + public static final String EXTRA_CHECK_VOICE_DATA_FOR = "checkVoiceDataFor"; // extras for a TTS engine's data installation /** diff --git a/core/java/android/view/HapticFeedbackConstants.java b/core/java/android/view/HapticFeedbackConstants.java index e1f2823..d31c8dc 100644 --- a/core/java/android/view/HapticFeedbackConstants.java +++ b/core/java/android/view/HapticFeedbackConstants.java @@ -34,8 +34,18 @@ public class HapticFeedbackConstants { * The user has pressed on a virtual on-screen key. */ public static final int VIRTUAL_KEY = 1; + + /** + * The user has hit the barrier point while scrolling a view. + */ + public static final int SCROLL_BARRIER = 2; /** + * The user has pressed a soft keyboard key. + */ + public static final int KEYBOARD_TAP = 3; + + /** * This is a private constant. Feel free to renumber as desired. * @hide */ diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index fb19dcf..57fdd8b 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -8547,7 +8547,119 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility LayoutInflater factory = LayoutInflater.from(context); return factory.inflate(resource, root); } + + /** + * Scroll the view with standard behavior for scrolling beyond the normal + * content boundaries. Views that call this method should override + * {@link #onOverscrolled(int, int, boolean, boolean)} to respond to the + * results of an overscroll operation. + * + * Views can use this method to handle any touch or fling-based scrolling. + * + * @param deltaX Change in X in pixels + * @param deltaY Change in Y in pixels + * @param scrollX Current X scroll value in pixels before applying deltaX + * @param scrollY Current Y scroll value in pixels before applying deltaY + * @param scrollRangeX Maximum content scroll range along the X axis + * @param scrollRangeY Maximum content scroll range along the Y axis + * @param maxOverscrollX Number of pixels to overscroll by in either direction + * along the X axis. + * @param maxOverscrollY Number of pixels to overscroll by in either direction + * along the Y axis. + * @return true if scrolling was clamped to an overscroll boundary along either + * axis, false otherwise. + */ + protected boolean overscrollBy(int deltaX, int deltaY, + int scrollX, int scrollY, + int scrollRangeX, int scrollRangeY, + int maxOverscrollX, int maxOverscrollY) { + // Scale the scroll amount if we're in the dropoff zone + final int dropoffX = maxOverscrollX / 2; + final int dropoffLeft = -dropoffX; + final int dropoffRight = dropoffX + scrollRangeX; + int newScrollX; + if ((scrollX < dropoffLeft && deltaX < 0) || + (scrollX > dropoffRight && deltaX > 0)) { + newScrollX = scrollX + deltaX / 2; + } else { + newScrollX = scrollX + deltaX; + if (newScrollX > dropoffRight && deltaX > 0) { + int extra = newScrollX - dropoffRight; + newScrollX = dropoffRight + extra / 2; + } else if (newScrollX < dropoffLeft && deltaX < 0) { + int extra = newScrollX - dropoffLeft; + newScrollX = dropoffLeft + extra / 2; + } + } + + final int dropoffY = maxOverscrollY / 2; + final int dropoffTop = -dropoffY; + final int dropoffBottom = dropoffY + scrollRangeY; + int newScrollY; + if ((scrollY < dropoffTop && deltaY < 0) || + (scrollY > dropoffBottom && deltaY > 0)) { + newScrollY = scrollY + deltaY / 2; + } else { + newScrollY = scrollY + deltaY; + if (newScrollY > dropoffBottom && deltaY > 0) { + int extra = newScrollY - dropoffBottom; + newScrollY = dropoffBottom + extra / 2; + } else if (newScrollY < dropoffTop && deltaY < 0) { + int extra = newScrollY - dropoffTop; + newScrollY = dropoffTop + extra / 2; + } + } + + // Clamp values if at the limits and record + final int left = -maxOverscrollX; + final int right = maxOverscrollX + scrollRangeX; + final int top = -maxOverscrollY; + final int bottom = maxOverscrollY + scrollRangeY; + + boolean clampedX = false; + if (newScrollX > right) { + newScrollX = right; + clampedX = true; + } else if (newScrollX < left) { + newScrollX = left; + clampedX = true; + } + + boolean clampedY = false; + if (newScrollY > bottom) { + newScrollY = bottom; + clampedY = true; + } else if (newScrollY < top) { + newScrollY = top; + clampedY = true; + } + + // Bump the device with some haptic feedback if we're at the edge + // and didn't start there. + if ((clampedX && scrollX != left && scrollX != right) || + (clampedY && scrollY != top && scrollY != bottom)) { + performHapticFeedback(HapticFeedbackConstants.SCROLL_BARRIER); + } + onOverscrolled(newScrollX, newScrollY, clampedX, clampedY); + + return clampedX || clampedY; + } + + /** + * Called by {@link #overscrollBy(int, int, int, int, int, int, int, int)} to + * respond to the results of an overscroll operation. + * + * @param scrollX New X scroll value in pixels + * @param scrollY New Y scroll value in pixels + * @param clampedX True if scrollX was clamped to an overscroll boundary + * @param clampedY True if scrollY was clamped to an overscroll boundary + */ + protected void onOverscrolled(int scrollX, int scrollY, + boolean clampedX, boolean clampedY) { + // Intentionally empty. + } + /** * A MeasureSpec encapsulates the layout requirements passed from parent to child. * Each MeasureSpec represents a requirement for either the width or the height. diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index cdf9eb0..2ed623d 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -3398,7 +3398,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager /** * Special value for the height or width requested by a View. - * MATCH_PARENT means that the view wants to be as bigas its parent, + * MATCH_PARENT means that the view wants to be as big as its parent, * minus the parent's padding, if any. */ public static final int MATCH_PARENT = -1; diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java index 7bc5cce..ab3260e 100644 --- a/core/java/android/view/WindowManagerPolicy.java +++ b/core/java/android/view/WindowManagerPolicy.java @@ -851,6 +851,11 @@ public interface WindowManagerPolicy { */ public boolean isCheekPressedAgainstScreen(MotionEvent ev); + /** + * Called every time the window manager is dispatching a pointer event. + */ + public void dispatchedPointerEventLw(MotionEvent ev, int targetX, int targetY); + public void setCurrentOrientationLw(int newOrientation); /** diff --git a/core/java/android/webkit/JWebCoreJavaBridge.java b/core/java/android/webkit/JWebCoreJavaBridge.java index e496d97..9dc7079 100644 --- a/core/java/android/webkit/JWebCoreJavaBridge.java +++ b/core/java/android/webkit/JWebCoreJavaBridge.java @@ -21,6 +21,8 @@ import android.os.Handler; import android.os.Message; import android.util.Log; +import java.util.Set; + final class JWebCoreJavaBridge extends Handler { // Identifier for the timer message. private static final int TIMER_MESSAGE = 1; @@ -248,4 +250,7 @@ final class JWebCoreJavaBridge extends Handler { boolean reload); public native void setNetworkOnLine(boolean online); public native void setNetworkType(String type, String subtype); + public native void addPackageNames(Set<String> packageNames); + public native void addPackageName(String packageName); + public native void removePackageName(String packageName); } diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index b0233ab..9148a18 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -86,6 +86,7 @@ import java.util.ArrayList; import java.util.List; import java.util.HashMap; import java.util.Map; +import java.util.Set; import junit.framework.Assert; @@ -213,8 +214,6 @@ public class WebView extends AbsoluteLayout // true means redraw the screen all-the-time. Only with AUTO_REDRAW_HACK private boolean mAutoRedraw; private int mRootLayer; // C++ pointer to the root layer - private boolean mLayersHaveAnimations; - private EvaluateLayersAnimations mEvaluateThread; static final String LOGTAG = "webview"; @@ -2904,6 +2903,45 @@ public class WebView extends AbsoluteLayout return mWebViewCore.getSettings(); } + /** + * Use this method to inform the webview about packages that are installed + * in the system. This information will be used by the + * navigator.isApplicationInstalled() API. + * @param packageNames is a set of package names that are known to be + * installed in the system. + * + * @hide not a public API + */ + public void addPackageNames(Set<String> packageNames) { + mWebViewCore.sendMessage(EventHub.ADD_PACKAGE_NAMES, packageNames); + } + + /** + * Use this method to inform the webview about single packages that are + * installed in the system. This information will be used by the + * navigator.isApplicationInstalled() API. + * @param packageName is the name of a package that is known to be + * installed in the system. + * + * @hide not a public API + */ + public void addPackageName(String packageName) { + mWebViewCore.sendMessage(EventHub.ADD_PACKAGE_NAME, packageName); + } + + /** + * Use this method to inform the webview about packages that are uninstalled + * in the system. This information will be used by the + * navigator.isApplicationInstalled() API. + * @param packageName is the name of a package that has been uninstalled in + * the system. + * + * @hide not a public API + */ + public void removePackageName(String packageName) { + mWebViewCore.sendMessage(EventHub.REMOVE_PACKAGE_NAME, packageName); + } + /** * Return the list of currently loaded plugins. * @return The list of currently loaded plugins. @@ -3072,6 +3110,15 @@ public class WebView extends AbsoluteLayout int scrollY = computeVerticalScrollOffset(); int viewHeight = getHeight() - getVisibleTitleHeight(); + // Currently for each draw we compute the animation values; + // We may in the future decide to do that independently. + if (nativeEvaluateLayersAnimations(mRootLayer)) { + // If we have unfinished (or unstarted) animations, + // we ask for a repaint. + invalidate(); + } + + // We can now draw the layers. nativeDrawLayers(mRootLayer, mScrollX, scrollY, getWidth(), viewHeight, mActualScale, canvas); @@ -3415,40 +3462,6 @@ public class WebView extends AbsoluteLayout } /* - * This class runs the layers animations in their own thread, - * so that we do not slow down the UI. - */ - private class EvaluateLayersAnimations extends Thread { - boolean mRunning = true; - // delay corresponds to 40fps, no need to go faster. - int mDelay = 25; // in ms - public void run() { - while (mRunning) { - if (mLayersHaveAnimations && mRootLayer != 0) { - // updates is a C++ pointer to a Vector of AnimationValues - int updates = nativeEvaluateLayersAnimations(mRootLayer); - if (updates == 0) { - mRunning = false; - } - Message.obtain(mPrivateHandler, - WebView.IMMEDIATE_REPAINT_MSG_ID, - updates, 0).sendToTarget(); - } else { - mRunning = false; - } - try { - Thread.currentThread().sleep(mDelay); - } catch (InterruptedException e) { - mRunning = false; - } - } - } - public void cancel() { - mRunning = false; - } - } - - /* * This class requests an Adapter for the WebTextView which shows past * entries stored in the database. It is a Runnable so that it can be done * in its own thread, without slowing down the UI. @@ -5929,13 +5942,6 @@ public class WebView extends AbsoluteLayout break; } case IMMEDIATE_REPAINT_MSG_ID: { - int updates = msg.arg1; - if (updates != 0) { - // updates is a C++ pointer to a Vector of - // AnimationValues that we apply to the layers. - // The Vector is deallocated in nativeUpdateLayers(). - nativeUpdateLayers(updates); - } invalidate(); break; } @@ -5945,18 +5951,6 @@ public class WebView extends AbsoluteLayout if (oldLayer > 0) { nativeDestroyLayer(oldLayer); } - if (mRootLayer == 0) { - mLayersHaveAnimations = false; - } - if (mEvaluateThread != null) { - mEvaluateThread.cancel(); - mEvaluateThread = null; - } - if (nativeLayersHaveAnimations(mRootLayer)) { - mLayersHaveAnimations = true; - mEvaluateThread = new EvaluateLayersAnimations(); - mEvaluateThread.start(); - } invalidate(); break; } @@ -6729,9 +6723,7 @@ public class WebView extends AbsoluteLayout private native void nativeDestroy(); private native void nativeDrawCursorRing(Canvas content); private native void nativeDestroyLayer(int layer); - private native int nativeEvaluateLayersAnimations(int layer); - private native boolean nativeLayersHaveAnimations(int layer); - private native void nativeUpdateLayers(int updates); + private native boolean nativeEvaluateLayersAnimations(int layer); private native void nativeDrawLayers(int layer, int scrollX, int scrollY, int width, int height, diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java index 9c91919..3a3e445 100644 --- a/core/java/android/webkit/WebViewCore.java +++ b/core/java/android/webkit/WebViewCore.java @@ -892,6 +892,11 @@ final class WebViewCore { static final int SET_NETWORK_TYPE = 183; + // navigator.isApplicationInstalled() + static final int ADD_PACKAGE_NAMES = 184; + static final int ADD_PACKAGE_NAME = 185; + static final int REMOVE_PACKAGE_NAME = 186; + // private message ids private static final int DESTROY = 200; @@ -1363,6 +1368,33 @@ final class WebViewCore { case HIDE_FULLSCREEN: nativeFullScreenPluginHidden(msg.arg1); break; + + case ADD_PACKAGE_NAMES: + if (BrowserFrame.sJavaBridge == null) { + throw new IllegalStateException("No WebView " + + "has been created in this process!"); + } + BrowserFrame.sJavaBridge.addPackageNames( + (Set<String>) msg.obj); + break; + + case ADD_PACKAGE_NAME: + if (BrowserFrame.sJavaBridge == null) { + throw new IllegalStateException("No WebView " + + "has been created in this process!"); + } + BrowserFrame.sJavaBridge.addPackageName( + (String) msg.obj); + break; + + case REMOVE_PACKAGE_NAME: + if (BrowserFrame.sJavaBridge == null) { + throw new IllegalStateException("No WebView " + + "has been created in this process!"); + } + BrowserFrame.sJavaBridge.removePackageName( + (String) msg.obj); + break; } } }; diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index 2f96aef..4c77bdc 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -377,6 +377,16 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te int mResurrectToPosition = INVALID_POSITION; private ContextMenuInfo mContextMenuInfo = null; + + /** + * Maximum distance to overscroll by + */ + private int mOverscrollMax; + + /** + * Content height divided by this is the overscroll limit. + */ + private static final int OVERSCROLL_LIMIT_DIVISOR = 3; /** * Used to request a layout when we changed touch mode @@ -1048,7 +1058,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te final int top = view.getTop(); int height = view.getHeight(); if (height > 0) { - return Math.max(firstPosition * 100 - (top * 100) / height, 0); + return Math.max(firstPosition * 100 - (top * 100) / height + + (int)((float)mScrollY / getHeight() * mItemCount * 100), 0); } } else { int index; @@ -1068,7 +1079,17 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te @Override protected int computeVerticalScrollRange() { - return mSmoothScrollbarEnabled ? Math.max(mItemCount * 100, 0) : mItemCount; + int result; + if (mSmoothScrollbarEnabled) { + result = Math.max(mItemCount * 100, 0); + if (mScrollY != 0) { + // Compensate for overscroll + result += Math.abs((int) ((float) mScrollY / getHeight() * mItemCount * 100)); + } + } else { + result = mItemCount; + } + return result; } @Override @@ -1129,6 +1150,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te mInLayout = true; layoutChildren(); mInLayout = false; + + mOverscrollMax = (b - t) / OVERSCROLL_LIMIT_DIVISOR; } /** @@ -2078,11 +2101,13 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te // Check if the top of the motion view is where it is // supposed to be final int motionViewRealTop = motionView.getTop(); - final int motionViewNewTop = mMotionViewNewTop; if (atEdge) { // Apply overscroll - mScrollY -= incrementalDeltaY - (motionViewRealTop - motionViewPrevTop); + int overscroll = -incrementalDeltaY - + (motionViewRealTop - motionViewPrevTop); + overscrollBy(0, overscroll, 0, mScrollY, 0, 0, + 0, getOverscrollMax()); mTouchMode = TOUCH_MODE_OVERSCROLL; invalidate(); } @@ -2126,7 +2151,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te mMotionPosition = motionPosition; } } else { - mScrollY -= incrementalDeltaY; + overscrollBy(0, -incrementalDeltaY, 0, mScrollY, 0, 0, + 0, getOverscrollMax()); invalidate(); } mLastY = y; @@ -2311,6 +2337,28 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te return true; } + + @Override + protected void onOverscrolled(int scrollX, int scrollY, + boolean clampedX, boolean clampedY) { + mScrollY = scrollY; + if (clampedY) { + // Velocity is broken by hitting the limit; don't start a fling off of this. + if (mVelocityTracker != null) { + mVelocityTracker.clear(); + } + } + } + + private int getOverscrollMax() { + final int childCount = getChildCount(); + if (childCount > 0) { + return Math.min(mOverscrollMax, + getChildAt(childCount - 1).getBottom() / OVERSCROLL_LIMIT_DIVISOR); + } else { + return mOverscrollMax; + } + } @Override public void draw(Canvas canvas) { @@ -2532,22 +2580,23 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te delta = Math.max(-(getHeight() - mPaddingBottom - mPaddingTop - 1), delta); } - // Do something different on overscroll - offsetChildrenTopAndBottom() - trackMotionScroll(delta, delta); - // Check to see if we have bumped into the scroll limit View motionView = getChildAt(mMotionPosition - mFirstPosition); + int oldTop = 0; if (motionView != null) { - // Check if the top of the motion view is where it is - // supposed to be - if (motionView.getTop() != mMotionViewNewTop) { - float vel = scroller.getCurrVelocity(); - if (delta > 0) { - vel = -vel; - } - startOverfling(Math.round(vel)); - break; + oldTop = motionView.getTop(); + } + if (trackMotionScroll(delta, delta)) { + if (motionView != null) { + // Tweak the scroll for how far we overshot + mScrollY -= delta - (motionView.getTop() - oldTop); + } + float vel = scroller.getCurrVelocity(); + if (delta > 0) { + vel = -vel; } + startOverfling(Math.round(vel)); + break; } if (more) { @@ -2570,9 +2619,14 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te case TOUCH_MODE_OVERFLING: { final OverScroller scroller = mScroller; if (scroller.computeScrollOffset()) { - mScrollY = scroller.getCurrY(); - invalidate(); - post(this); + final int scrollY = mScrollY; + final int deltaY = scroller.getCurrY() - scrollY; + if (overscrollBy(0, deltaY, 0, scrollY, 0, 0, 0, getOverscrollMax())) { + startSpringback(); + } else { + invalidate(); + post(this); + } } else { endFling(); } @@ -2702,6 +2756,10 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te case MOVE_DOWN_POS: { final int lastViewIndex = getChildCount() - 1; final int lastPos = firstPos + lastViewIndex; + + if (lastViewIndex < 0) { + return; + } if (lastPos == mLastSeenPos) { // No new views, let things keep going. @@ -2764,6 +2822,9 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te } final View firstView = getChildAt(0); + if (firstView == null) { + return; + } final int firstViewTop = firstView.getTop(); smoothScrollBy(firstViewTop - mExtraScroll, mScrollDuration); diff --git a/core/java/android/widget/EditText.java b/core/java/android/widget/EditText.java index 57aca24..1532db1 100644 --- a/core/java/android/widget/EditText.java +++ b/core/java/android/widget/EditText.java @@ -16,9 +16,13 @@ package android.widget; -import android.text.*; -import android.text.method.*; import android.content.Context; +import android.text.Editable; +import android.text.Selection; +import android.text.Spannable; +import android.text.TextUtils; +import android.text.method.ArrowKeyMovementMethod; +import android.text.method.MovementMethod; import android.util.AttributeSet; diff --git a/core/java/android/widget/HorizontalScrollView.java b/core/java/android/widget/HorizontalScrollView.java index 0078fec..c62724c 100644 --- a/core/java/android/widget/HorizontalScrollView.java +++ b/core/java/android/widget/HorizontalScrollView.java @@ -461,7 +461,8 @@ public class HorizontalScrollView extends FrameLayout { final int deltaX = (int) (mLastMotionX - x); mLastMotionX = x; - super.scrollTo(mScrollX + deltaX, mScrollY); + overscrollBy(deltaX, 0, mScrollX, 0, getScrollRange(), 0, + getOverscrollMax(), 0); break; case MotionEvent.ACTION_UP: final VelocityTracker velocityTracker = mVelocityTracker; @@ -472,8 +473,7 @@ public class HorizontalScrollView extends FrameLayout { if ((Math.abs(initialVelocity) > mMinimumVelocity)) { fling(-initialVelocity); } else { - final int right = Math.max(0, getChildAt(0).getHeight() - - (getHeight() - mPaddingRight - mPaddingLeft)); + final int right = getScrollRange(); if (mScroller.springback(mScrollX, mScrollY, 0, 0, right, 0)) { invalidate(); } @@ -487,6 +487,41 @@ public class HorizontalScrollView extends FrameLayout { } return true; } + + @Override + protected void onOverscrolled(int scrollX, int scrollY, + boolean clampedX, boolean clampedY) { + // Treat animating scrolls differently; see #computeScroll() for why. + if (!mScroller.isFinished()) { + mScrollX = scrollX; + mScrollY = scrollY; + if (clampedX) { + mScroller.springback(mScrollX, mScrollY, 0, getScrollRange(), 0, 0); + } + } else { + super.scrollTo(scrollX, scrollY); + } + } + + private int getOverscrollMax() { + int childCount = getChildCount(); + int containerOverscroll = (getWidth() - mPaddingLeft - mPaddingRight) / 3; + if (childCount > 0) { + return Math.min(containerOverscroll, getChildAt(0).getWidth() / 3); + } else { + return containerOverscroll; + } + } + + private int getScrollRange() { + int scrollRange = 0; + if (getChildCount() > 0) { + View child = getChildAt(0); + scrollRange = Math.max(0, + child.getWidth() - getWidth() - mPaddingLeft - mPaddingRight); + } + return scrollRange; + } /** * <p> @@ -856,9 +891,26 @@ public class HorizontalScrollView extends FrameLayout { @Override protected int computeHorizontalScrollRange() { int count = getChildCount(); - return count == 0 ? getWidth() : getChildAt(0).getRight(); + if (count == 0) { + return getWidth(); + } + + int scrollRange = getChildAt(0).getRight(); + int scrollX = mScrollX; + int overscrollRight = scrollRange - getWidth() - mPaddingLeft - mPaddingRight; + if (scrollX < 0) { + scrollRange -= scrollX; + } else if (scrollX > overscrollRight) { + scrollRange += scrollX - overscrollRight; + } + + return scrollRange; + } + + @Override + protected int computeHorizontalScrollOffset() { + return Math.max(0, super.computeHorizontalScrollOffset()); } - @Override protected void measureChild(View child, int parentWidthMeasureSpec, int parentHeightMeasureSpec) { @@ -913,10 +965,9 @@ public class HorizontalScrollView extends FrameLayout { int x = mScroller.getCurrX(); int y = mScroller.getCurrY(); - mScrollX = x; - mScrollY = y; - - if (oldX != mScrollX || oldY != mScrollY) { + if (oldX != x || oldY != y) { + overscrollBy(x - oldX, y - oldY, oldX, oldY, getScrollRange(), 0, + getOverscrollMax(), 0); onScrollChanged(mScrollX, mScrollY, oldX, oldY); } diff --git a/core/java/android/widget/LinearLayout.java b/core/java/android/widget/LinearLayout.java index ea5841a..9fcb829 100644 --- a/core/java/android/widget/LinearLayout.java +++ b/core/java/android/widget/LinearLayout.java @@ -16,6 +16,8 @@ package android.widget; +import com.android.internal.R; + import android.content.Context; import android.content.res.TypedArray; import android.util.AttributeSet; @@ -25,8 +27,6 @@ import android.view.ViewDebug; import android.view.ViewGroup; import android.widget.RemoteViews.RemoteView; -import com.android.internal.R; - /** * A Layout that arranges its children in a single column or a single row. The direction of @@ -366,14 +366,15 @@ public class LinearLayout extends ViewGroup { int oldHeight = Integer.MIN_VALUE; if (lp.height == 0 && lp.weight > 0) { - // heightMode is either UNSPECIFIED OR AT_MOST, and this child - // wanted to stretch to fill available space. Translate that to - // WRAP_CONTENT so that it does not end up with a height of 0 - oldHeight = 0; - lp.height = LayoutParams.WRAP_CONTENT; + // heightMode is either UNSPECIFIED or AT_MOST, and this + // child wanted to stretch to fill available space. + // Translate that to WRAP_CONTENT so that it does not end up + // with a height of 0 + oldHeight = 0; + lp.height = LayoutParams.WRAP_CONTENT; } - // Determine how big this child would like to. If this or + // Determine how big this child would like to be. If this or // previous children have given a weight, then we allow it to // use all available space (and we will shrink things later // if needed). @@ -673,7 +674,8 @@ public class LinearLayout extends ViewGroup { int oldWidth = Integer.MIN_VALUE; if (lp.width == 0 && lp.weight > 0) { - // widthMode is either UNSPECIFIED OR AT_MOST, and this child + // widthMode is either UNSPECIFIED or AT_MOST, and this + // child // wanted to stretch to fill available space. Translate that to // WRAP_CONTENT so that it does not end up with a width of 0 oldWidth = 0; diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java index 401e7ff..c428dc0 100644 --- a/core/java/android/widget/ListView.java +++ b/core/java/android/widget/ListView.java @@ -2916,7 +2916,14 @@ public class ListView extends AbsListView { if (!mStackFromBottom) { int bottom; - int listBottom = mBottom - mTop - mListPadding.bottom; + int listBottom = mBottom - mTop - mListPadding.bottom + mScrollY; + + // Draw top divider for overscroll + if (count > 0 && mScrollY < 0) { + bounds.bottom = 0; + bounds.top = -dividerHeight; + drawDivider(canvas, bounds, -1); + } for (int i = 0; i < count; i++) { if ((headerDividers || first + i >= headerCount) && diff --git a/core/java/android/widget/ScrollView.java b/core/java/android/widget/ScrollView.java index 4a1d871..2ee7ad5 100644 --- a/core/java/android/widget/ScrollView.java +++ b/core/java/android/widget/ScrollView.java @@ -459,7 +459,8 @@ public class ScrollView extends FrameLayout { final int deltaY = (int) (mLastMotionY - y); mLastMotionY = y; - super.scrollTo(mScrollX, mScrollY + deltaY); + overscrollBy(0, deltaY, 0, mScrollY, 0, getScrollRange(), + 0, getOverscrollMax()); break; case MotionEvent.ACTION_UP: final VelocityTracker velocityTracker = mVelocityTracker; @@ -470,8 +471,7 @@ public class ScrollView extends FrameLayout { if ((Math.abs(initialVelocity) > mMinimumVelocity)) { fling(-initialVelocity); } else { - final int bottom = Math.max(0, getChildAt(0).getHeight() - - (getHeight() - mPaddingBottom - mPaddingTop)); + final int bottom = getScrollRange(); if (mScroller.springback(mScrollX, mScrollY, 0, 0, 0, bottom)) { invalidate(); } @@ -485,6 +485,41 @@ public class ScrollView extends FrameLayout { } return true; } + + @Override + protected void onOverscrolled(int scrollX, int scrollY, + boolean clampedX, boolean clampedY) { + // Treat animating scrolls differently; see #computeScroll() for why. + if (!mScroller.isFinished()) { + mScrollX = scrollX; + mScrollY = scrollY; + if (clampedY) { + mScroller.springback(mScrollX, mScrollY, 0, 0, 0, getScrollRange()); + } + } else { + super.scrollTo(scrollX, scrollY); + } + } + + private int getOverscrollMax() { + int childCount = getChildCount(); + int containerOverscroll = (getHeight() - mPaddingBottom - mPaddingTop) / 3; + if (childCount > 0) { + return Math.min(containerOverscroll, getChildAt(0).getHeight() / 3); + } else { + return containerOverscroll; + } + } + + private int getScrollRange() { + int scrollRange = 0; + if (getChildCount() > 0) { + View child = getChildAt(0); + scrollRange = Math.max(0, + child.getHeight() - getHeight() - mPaddingBottom - mPaddingTop); + } + return scrollRange; + } /** * <p> @@ -858,9 +893,26 @@ public class ScrollView extends FrameLayout { @Override protected int computeVerticalScrollRange() { int count = getChildCount(); - return count == 0 ? getHeight() : (getChildAt(0)).getBottom(); + if (count == 0) { + return getHeight(); + } + + int scrollRange = getChildAt(0).getBottom(); + int scrollY = mScrollY; + int overscrollBottom = scrollRange - getHeight() - mPaddingBottom - mPaddingTop; + if (scrollY < 0) { + scrollRange -= scrollY; + } else if (scrollY > overscrollBottom) { + scrollRange += scrollY - overscrollBottom; + } + + return scrollRange; } + @Override + protected int computeVerticalScrollOffset() { + return Math.max(0, super.computeVerticalScrollOffset()); + } @Override protected void measureChild(View child, int parentWidthMeasureSpec, int parentHeightMeasureSpec) { @@ -915,10 +967,9 @@ public class ScrollView extends FrameLayout { int x = mScroller.getCurrX(); int y = mScroller.getCurrY(); - mScrollX = x; - mScrollY = y; - - if (oldX != mScrollX || oldY != mScrollY) { + if (oldX != x || oldY != y) { + overscrollBy(x - oldX, y - oldY, oldX, oldY, 0, getScrollRange(), + 0, getOverscrollMax()); onScrollChanged(mScrollX, mScrollY, oldX, oldY); } diff --git a/core/java/android/widget/TabHost.java b/core/java/android/widget/TabHost.java index 78e2fee..d4d9063 100644 --- a/core/java/android/widget/TabHost.java +++ b/core/java/android/widget/TabHost.java @@ -16,6 +16,8 @@ package android.widget; +import com.android.internal.R; + import android.app.LocalActivityManager; import android.content.Context; import android.content.Intent; @@ -33,8 +35,6 @@ import android.view.Window; import java.util.ArrayList; import java.util.List; -import com.android.internal.R; - /** * Container for a tabbed window view. This object holds two children: a set of tab labels that the * user clicks to select a specific tab, and a FrameLayout object that displays the contents of that @@ -624,7 +624,7 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1"); } public void tabClosed() { - mTabContent.setVisibility(View.INVISIBLE); + mTabContent.setVisibility(View.GONE); } } diff --git a/core/java/android/widget/TableLayout.java b/core/java/android/widget/TableLayout.java index 66500a3..73760ac 100644 --- a/core/java/android/widget/TableLayout.java +++ b/core/java/android/widget/TableLayout.java @@ -575,6 +575,16 @@ public class TableLayout extends LinearLayout { final int totalExtraSpace = size - totalWidth; int extraSpace = totalExtraSpace / count; + // Column's widths are changed: force child table rows to re-measure. + // (done by super.measureVertical after shrinkAndStretchColumns.) + final int nbChildren = getChildCount(); + for (int i = 0; i < nbChildren; i++) { + View child = getChildAt(i); + if (child instanceof TableRow) { + child.forceLayout(); + } + } + if (!allColumns) { for (int i = 0; i < count; i++) { int column = columns.keyAt(i); diff --git a/core/java/android/widget/TableRow.java b/core/java/android/widget/TableRow.java index abf08bf..48d12df 100644 --- a/core/java/android/widget/TableRow.java +++ b/core/java/android/widget/TableRow.java @@ -22,8 +22,8 @@ import android.util.AttributeSet; import android.util.SparseIntArray; import android.view.Gravity; import android.view.View; -import android.view.ViewGroup; import android.view.ViewDebug; +import android.view.ViewGroup; /** diff --git a/core/java/com/android/internal/widget/PasswordEntryKeyboard.java b/core/java/com/android/internal/widget/PasswordEntryKeyboard.java index c901472..e1a6737 100644 --- a/core/java/com/android/internal/widget/PasswordEntryKeyboard.java +++ b/core/java/com/android/internal/widget/PasswordEntryKeyboard.java @@ -93,7 +93,7 @@ public class PasswordEntryKeyboard extends Keyboard { LatinKey key = new LatinKey(res, parent, x, y, parser); final int code = key.codes[0]; if (code >=0 && code != '\n' && (code < 32 || code > 127)) { - Log.w(TAG, "Key code for " + key.label + " is not latin-1"); + // Log.w(TAG, "Key code for " + key.label + " is not latin-1"); key.label = " "; key.setEnabled(false); } diff --git a/core/jni/android_text_AndroidCharacter.cpp b/core/jni/android_text_AndroidCharacter.cpp index 450cee2..05d7b73 100644 --- a/core/jni/android_text_AndroidCharacter.cpp +++ b/core/jni/android_text_AndroidCharacter.cpp @@ -20,8 +20,32 @@ #include <jni.h> #include <android_runtime/AndroidRuntime.h> #include "utils/misc.h" -#include "utils/AndroidUnicode.h" #include "utils/Log.h" +#include "unicode/uchar.h" + +#define DIRECTIONALITY_UNDEFINED (-1) +// ICU => JDK mapping +static int directionality_map[U_CHAR_DIRECTION_COUNT] = { + 0, // U_LEFT_TO_RIGHT (0) => DIRECTIONALITY_LEFT_TO_RIGHT (0) + 1, // U_RIGHT_TO_LEFT (1) => DIRECTIONALITY_RIGHT_TO_LEFT (1) + 3, // U_EUROPEAN_NUMBER (2) => DIRECTIONALITY_EUROPEAN_NUMBER (3) + 4, // U_EUROPEAN_NUMBER_SEPARATOR (3) => DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR (4) + 5, // U_EUROPEAN_NUMBER_TERMINATOR (4) => DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR (5) + 6, // U_ARABIC_NUMBER (5) => DIRECTIONALITY_ARABIC_NUMBER (6) + 7, // U_COMMON_NUMBER_SEPARATOR (6) => DIRECTIONALITY_COMMON_NUMBER_SEPARATOR (7) + 10, // U_BLOCK_SEPARATOR (7) => DIRECTIONALITY_PARAGRAPH_SEPARATOR (10) + 11, // U_SEGMENT_SEPARATOR (8) => DIRECTIONALITY_SEGMENT_SEPARATOR (11) + 12, // U_WHITE_SPACE_NEUTRAL (9) => DIRECTIONALITY_WHITESPACE (12) + 13, // U_OTHER_NEUTRAL (10) => DIRECTIONALITY_OTHER_NEUTRALS (13) + 14, // U_LEFT_TO_RIGHT_EMBEDDING (11) => DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING (14) + 15, // U_LEFT_TO_RIGHT_OVERRIDE (12) => DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE (15) + 2, // U_RIGHT_TO_LEFT_ARABIC (13) => DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC (2) + 16, // U_RIGHT_TO_LEFT_EMBEDDING (14) => DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING (16) + 17, // U_RIGHT_TO_LEFT_OVERRIDE (15) => DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE (17) + 18, // U_POP_DIRECTIONAL_FORMAT (16) => DIRECTIONALITY_POP_DIRECTIONAL_FORMAT (18) + 8, // U_DIR_NON_SPACING_MARK (17) => DIRECTIONALITY_NONSPACING_MARK (8) + 9, // U_BOUNDARY_NEUTRAL (18) => DIRECTIONALITY_BOUNDARY_NEUTRAL (9) +}; namespace android { @@ -53,15 +77,21 @@ static void getDirectionalities(JNIEnv* env, jobject obj, jcharArray srcArray, j src[i + 1] >= 0xDC00 && src[i + 1] <= 0xDFFF) { int c = 0x00010000 + ((src[i] - 0xD800) << 10) + (src[i + 1] & 0x3FF); - int dir = android::Unicode::getDirectionality(c); + int dir = u_charDirection(c); + if (dir < 0 || dir >= U_CHAR_DIRECTION_COUNT) + dir = DIRECTIONALITY_UNDEFINED; + else + dir = directionality_map[dir]; dest[i++] = dir; dest[i] = dir; } else { int c = src[i]; - int dir = android::Unicode::getDirectionality(c); - - dest[i] = dir; + int dir = u_charDirection(c); + if (dir < 0 || dir >= U_CHAR_DIRECTION_COUNT) + dest[i] = DIRECTIONALITY_UNDEFINED; + else + dest[i] = directionality_map[dir]; } } @@ -89,7 +119,7 @@ static jboolean mirror(JNIEnv* env, jobject obj, jcharArray charArray, int start // XXX this thinks it knows that surrogates are never mirrored int c1 = data[i]; - int c2 = android::Unicode::toMirror(c1); + int c2 = u_charMirror(c1); if (c1 != c2) { data[i] = c2; @@ -104,7 +134,7 @@ MIRROR_END: static jchar getMirror(JNIEnv* env, jobject obj, jchar c) { - return android::Unicode::toMirror(c); + return u_charMirror(c); } static JNINativeMethod gMethods[] = { diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index f5f5a27..8273dbf 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -1161,13 +1161,6 @@ android:description="@string/permdesc_backup" android:protectionLevel="signatureOrSystem" /> - <!-- Allows an application to participate in the backup and restore process - @hide --> - <permission android:name="android.permission.BACKUP_DATA" - android:label="@string/permlab_backup_data" - android:description="@string/permdesc_backup_data" - android:protectionLevel="signatureOrSystem" /> - <!-- Allows an application to tell the AppWidget service which application can access AppWidget's data. The normal user flow is that a user picks an AppWidget to go into a particular host, thereby giving that diff --git a/core/res/res/anim/cycle_interpolator.xml b/core/res/res/anim/cycle_interpolator.xml new file mode 100644 index 0000000..70ebcb1 --- /dev/null +++ b/core/res/res/anim/cycle_interpolator.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2010, 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. +*/ +--> + +<cycleInterpolator /> diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 2b8ddc4..40c78f7 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -138,6 +138,11 @@ <item>30</item> </integer-array> + <!-- Vibrator pattern for a very short but reliable vibration for soft keyboard tap --> + <integer-array name="config_keyboardTapVibePattern"> + <item>40</item> + </integer-array> + <!-- Vibrator pattern for feedback about booting with safe mode disabled --> <integer-array name="config_safeModeDisabledVibePattern"> <item>0</item> @@ -156,6 +161,14 @@ <item>600</item> </integer-array> + <!-- Vibrator pattern for feedback about hitting a scroll barrier --> + <integer-array name="config_scrollBarrierVibePattern"> + <item>0</item> + <item>15</item> + <item>10</item> + <item>10</item> + </integer-array> + <bool name="config_use_strict_phone_number_comparation">false</bool> <!-- Display low battery warning when battery level dips to this value --> diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 7706f30..3c6338e 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -1230,5 +1230,7 @@ <public type="attr" name="neverEncrypt" id="0x010102b7" /> <public type="attr" name="installLocation" id="0x010102b8" /> <public type="attr" name="safeMode" id="0x010102b9" /> + + <public type="anim" name="cycle_interpolator" id="0x010a000c" /> </resources> diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 9e596ef..6f34b4f 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -565,11 +565,6 @@ <string name="permdesc_backup">Allows the application to control the system\'s backup and restore mechanism. Not for use by normal applications.</string> <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> - <string name="permlab_backup_data">back up and restore the application\'s data</string> - <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> - <string name="permdesc_backup_data">Allows the application to participate in the system\'s backup and restore mechanism.</string> - - <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permlab_internalSystemWindow">display unauthorized windows</string> <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permdesc_internalSystemWindow">Allows the creation of diff --git a/core/res/res/xml-land/password_kbd_qwerty.xml b/core/res/res/xml-land/password_kbd_qwerty.xml index 8245cc1..700c527 100755 --- a/core/res/res/xml-land/password_kbd_qwerty.xml +++ b/core/res/res/xml-land/password_kbd_qwerty.xml @@ -77,10 +77,9 @@ android:iconPreview="@drawable/sym_keyboard_feedback_space" android:keyWidth="20%p"/> <Key android:keyLabel="=" /> - <Key android:keyLabel="." - android:keyWidth="10%p"/> - <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return" - android:iconPreview="@drawable/sym_keyboard_feedback_return" + <Key android:keyLabel="." android:keyWidth="10%p"/> + <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_ok" + android:iconPreview="@drawable/sym_keyboard_feedback_ok" android:keyWidth="20%p" android:keyEdgeFlags="right"/> </Row> diff --git a/core/res/res/xml-land/password_kbd_qwerty_shifted.xml b/core/res/res/xml-land/password_kbd_qwerty_shifted.xml index 6117e78..1e37b6c 100755 --- a/core/res/res/xml-land/password_kbd_qwerty_shifted.xml +++ b/core/res/res/xml-land/password_kbd_qwerty_shifted.xml @@ -79,8 +79,8 @@ android:keyWidth="20%p"/> <Key android:keyLabel="+" /> <Key android:keyLabel="."/> - <Key android:keyIcon="@drawable/sym_keyboard_return" - android:iconPreview="@drawable/sym_keyboard_feedback_return" + <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_ok" + android:iconPreview="@drawable/sym_keyboard_feedback_ok" android:keyWidth="20%p" android:keyEdgeFlags="right"/> </Row> diff --git a/docs/html/sitemap.txt b/docs/html/sitemap.txt index f82b2fe..5039dfc 100644 --- a/docs/html/sitemap.txt +++ b/docs/html/sitemap.txt @@ -2864,11 +2864,6 @@ http://developer.android.com/reference/org/xmlpull/v1/XmlSerializer.html http://developer.android.com/reference/org/apache/http/cookie/params/package-descr.html http://developer.android.com/reference/java/util/concurrent/locks/package-descr.html http://developer.android.com/reference/org/apache/http/conn/routing/package-descr.html -http://developer.android.com/guide/samples/index.html -http://developer.android.com/guide/tutorials/notepad/notepad-ex1.html -http://developer.android.com/guide/tutorials/notepad/notepad-ex2.html -http://developer.android.com/guide/tutorials/notepad/notepad-ex3.html -http://developer.android.com/guide/tutorials/notepad/notepad-extra-credit.html http://developer.android.com/guide/appendix/faq/commontasks.html http://developer.android.com/reference/javax/security/cert/package-descr.html http://developer.android.com/reference/org/xml/sax/ext/package-descr.html @@ -3029,7 +3024,6 @@ http://developer.android.com/reference/javax/security/auth/x500/package-descr.ht http://developer.android.com/sdk/api_diff/6/changes/android.view.WindowManager.LayoutParams.html http://developer.android.com/reference/android/net/package-descr.html http://developer.android.com/reference/org/apache/http/client/package-descr.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/app/RemoteService.html http://developer.android.com/sdk/download.html?v=archives/android-sdk-windows-1.6_r1.zip http://developer.android.com/sdk/download.html?v=archives/android-sdk-mac_x86-1.6_r1.zip http://developer.android.com/sdk/download.html?v=archives/android-sdk-linux_x86-1.6_r1.tgz @@ -3299,7 +3293,6 @@ http://developer.android.com/resources/samples/BluetoothChat/res/layout/main.htm http://developer.android.com/resources/samples/BluetoothChat/res/layout/message.html http://developer.android.com/resources/samples/NotePad/res/drawable-ldpi-v6/app_notes.html http://developer.android.com/resources/samples/NotePad/res/drawable-ldpi-v6/live_folder_notes.html -http://developer.android.com/guide/tutorials/views/index.html http://developer.android.com/sdk/api_diff/4/changes/pkg_android.html http://developer.android.com/sdk/api_diff/4/changes/pkg_android.app.html http://developer.android.com/sdk/api_diff/4/changes/pkg_android.content.res.html @@ -3523,21 +3516,6 @@ http://developer.android.com/reference/javax/security/auth/login/package-descr.h http://developer.android.com/resources/samples/ApiDemos/tests/src/com/example/android/apis/index.html http://developer.android.com/reference/org/apache/http/conn/ssl/package-descr.html http://developer.android.com/resources/samples/ContactManager/res/drawable-hdpi/icon.html -http://developer.android.com/guide/tutorials/views/hello-linearlayout.html -http://developer.android.com/guide/tutorials/views/hello-relativelayout.html -http://developer.android.com/guide/tutorials/views/hello-tablelayout.html -http://developer.android.com/guide/tutorials/views/hello-datepicker.html -http://developer.android.com/guide/tutorials/views/hello-timepicker.html -http://developer.android.com/guide/tutorials/views/hello-formstuff.html -http://developer.android.com/guide/tutorials/views/hello-spinner.html -http://developer.android.com/guide/tutorials/views/hello-autocomplete.html -http://developer.android.com/guide/tutorials/views/hello-listview.html -http://developer.android.com/guide/tutorials/views/hello-gridview.html -http://developer.android.com/guide/tutorials/views/hello-gallery.html -http://developer.android.com/guide/tutorials/views/hello-tabwidget.html -http://developer.android.com/guide/tutorials/views/hello-mapview.html -http://developer.android.com/guide/tutorials/views/hello-webview.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/index.html http://developer.android.com/sdk/api_diff/5/changes/packages_index_all.html http://developer.android.com/sdk/api_diff/5/changes/classes_index_all.html http://developer.android.com/sdk/api_diff/5/changes/constructors_index_all.html @@ -3858,112 +3836,6 @@ http://developer.android.com/resources/samples/Home/res/anim/show_applications.h http://developer.android.com/reference/org/w3c/dom/package-descr.html http://developer.android.com/reference/org/apache/http/package-descr.html http://developer.android.com/resources/samples/MultiResolution/src/com/example/index.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/RelativeLayout1.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/RelativeLayout2.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/LinearLayout1.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/LinearLayout2.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/LinearLayout3.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/LinearLayout4.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/LinearLayout5.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/LinearLayout6.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/LinearLayout7.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/LinearLayout8.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/LinearLayout9.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/ScrollView1.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/ScrollView2.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/TableLayout1.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/TableLayout2.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/TableLayout3.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/TableLayout4.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/TableLayout5.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/TableLayout6.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/TableLayout7.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/TableLayout8.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/TableLayout9.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/TableLayout10.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/TableLayout11.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/TableLayout12.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/Baseline1.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/Baseline2.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/Baseline3.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/Baseline4.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/Baseline6.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/Baseline7.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/BaselineNested1.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/BaselineNested2.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/BaselineNested3.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/RadioGroup1.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/ScrollBar1.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/ScrollBar2.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/Visibility1.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/List1.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/List2.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/List3.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/List4.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/List5.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/List6.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/List7.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/List8.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/CustomView1.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/ImageButton1.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/DateWidgets1.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/DateWidgets2.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/Gallery1.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/Gallery2.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/Spinner1.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/Grid1.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/Grid2.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/ImageSwitcher1.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/TextSwitcher1.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/Animation1.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/Animation2.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/Controls1.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/Controls2.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/AutoComplete1.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/AutoComplete2.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/AutoComplete3.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/AutoComplete4.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/AutoComplete5.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/ProgressBar1.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/ProgressBar2.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/ProgressBar3.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/ProgressBar4.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/Focus1.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/Focus2.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/Focus3.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/Animation3.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/AutoComplete6.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/Buttons1.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/ChronometerDemo.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/ExpandableList1.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/ExpandableList2.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/ExpandableList3.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/ImageView1.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/InternalSelectionFocus.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/InternalSelectionScroll.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/InternalSelectionView.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/LabelView.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/LayoutAnimation1.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/LayoutAnimation2.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/LayoutAnimation3.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/LayoutAnimation4.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/LayoutAnimation5.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/LayoutAnimation6.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/LayoutAnimation7.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/LinearLayout10.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/List10.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/List11.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/List12.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/List13.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/List14.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/List9.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/RatingBar1.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/ScrollBar3.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/SeekBar1.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/Tabs1.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/Tabs2.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/Tabs3.html -http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/view/WebView1.html http://developer.android.com/resources/samples/Home/res/drawable/all_applications.html http://developer.android.com/resources/samples/Home/res/drawable/all_applications_background.html http://developer.android.com/resources/samples/Home/res/drawable/all_applications_button_background.html diff --git a/include/media/IMediaPlayer.h b/include/media/IMediaPlayer.h index b6f654f..2619691 100644 --- a/include/media/IMediaPlayer.h +++ b/include/media/IMediaPlayer.h @@ -46,6 +46,8 @@ public: virtual status_t setAudioStreamType(int type) = 0; virtual status_t setLooping(int loop) = 0; virtual status_t setVolume(float leftVolume, float rightVolume) = 0; + virtual status_t suspend() = 0; + virtual status_t resume() = 0; // Invoke a generic method on the player by using opaque parcels // for the request and reply. diff --git a/include/media/MediaPlayerInterface.h b/include/media/MediaPlayerInterface.h index ecb20e8..9e606d9 100644 --- a/include/media/MediaPlayerInterface.h +++ b/include/media/MediaPlayerInterface.h @@ -118,6 +118,9 @@ public: virtual status_t reset() = 0; virtual status_t setLooping(int loop) = 0; virtual player_type playerType() = 0; + virtual status_t suspend() { return INVALID_OPERATION; } + virtual status_t resume() { return INVALID_OPERATION; } + virtual void setNotifyCallback(void* cookie, notify_callback_f notifyFunc) { mCookie = cookie; mNotify = notifyFunc; } // Invoke a generic method on the player by using opaque parcels diff --git a/include/media/mediaplayer.h b/include/media/mediaplayer.h index 8dc7c8a..7fad1b7 100644 --- a/include/media/mediaplayer.h +++ b/include/media/mediaplayer.h @@ -165,6 +165,8 @@ public: status_t invoke(const Parcel& request, Parcel *reply); status_t setMetadataFilter(const Parcel& filter); status_t getMetadata(bool update_only, bool apply_filter, Parcel *metadata); + status_t suspend(); + status_t resume(); private: void clear_l(); status_t seekTo_l(int msec); diff --git a/include/utils/AndroidUnicode.h b/include/utils/AndroidUnicode.h deleted file mode 100644 index 563fcd0..0000000 --- a/include/utils/AndroidUnicode.h +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Copyright (C) 2006 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_UNICODE_H -#define ANDROID_UNICODE_H - -#include <stdint.h> -#include <sys/types.h> - -#define REPLACEMENT_CHAR (0xFFFD) - -// this part of code is copied from umachine.h under ICU -/** - * Define UChar32 as a type for single Unicode code points. - * UChar32 is a signed 32-bit integer (same as int32_t). - * - * The Unicode code point range is 0..0x10ffff. - * All other values (negative or >=0x110000) are illegal as Unicode code points. - * They may be used as sentinel values to indicate "done", "error" - * or similar non-code point conditions. - * - * @stable ICU 2.4 - */ -typedef int32_t UChar32; - -namespace android { - - class Encoding; - /** - * \class Unicode - * - * Helper class for getting properties of Unicode characters. Characters - * can have one of the types listed in CharType and each character can have the - * directionality of Direction. - */ - class Unicode - { - public: - /** - * Directions specified in the Unicode standard. These directions map directly - * to java.lang.Character. - */ - enum Direction { - DIRECTIONALITY_UNDEFINED = -1, - DIRECTIONALITY_LEFT_TO_RIGHT, - DIRECTIONALITY_RIGHT_TO_LEFT, - DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC, - DIRECTIONALITY_EUROPEAN_NUMBER, - DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR, - DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR, - DIRECTIONALITY_ARABIC_NUMBER, - DIRECTIONALITY_COMMON_NUMBER_SEPARATOR, - DIRECTIONALITY_NONSPACING_MARK, - DIRECTIONALITY_BOUNDARY_NEUTRAL, - DIRECTIONALITY_PARAGRAPH_SEPARATOR, - DIRECTIONALITY_SEGMENT_SEPARATOR, - DIRECTIONALITY_WHITESPACE, - DIRECTIONALITY_OTHER_NEUTRALS, - DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING, - DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE, - DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING, - DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE, - DIRECTIONALITY_POP_DIRECTIONAL_FORMAT - }; - - /** - * Character types as specified in the Unicode standard. These map directly to - * java.lang.Character. - */ - enum CharType { - CHARTYPE_UNASSIGNED = 0, - CHARTYPE_UPPERCASE_LETTER, - CHARTYPE_LOWERCASE_LETTER, - CHARTYPE_TITLECASE_LETTER, - CHARTYPE_MODIFIER_LETTER, - CHARTYPE_OTHER_LETTER, - CHARTYPE_NON_SPACING_MARK, - CHARTYPE_ENCLOSING_MARK, - CHARTYPE_COMBINING_SPACING_MARK, - CHARTYPE_DECIMAL_DIGIT_NUMBER, - CHARTYPE_LETTER_NUMBER, - CHARTYPE_OTHER_NUMBER, - CHARTYPE_SPACE_SEPARATOR, - CHARTYPE_LINE_SEPARATOR, - CHARTYPE_PARAGRAPH_SEPARATOR, - CHARTYPE_CONTROL, - CHARTYPE_FORMAT, - CHARTYPE_MISSING_VALUE_FOR_JAVA, /* This is the mysterious missing 17 value from the java constants */ - CHARTYPE_PRIVATE_USE, - CHARTYPE_SURROGATE, - CHARTYPE_DASH_PUNCTUATION, - CHARTYPE_START_PUNCTUATION, - CHARTYPE_END_PUNCTUATION, - CHARTYPE_CONNECTOR_PUNCTUATION, - CHARTYPE_OTHER_PUNCTUATION, - CHARTYPE_MATH_SYMBOL, - CHARTYPE_CURRENCY_SYMBOL, - CHARTYPE_MODIFIER_SYMBOL, - CHARTYPE_OTHER_SYMBOL, - CHARTYPE_INITIAL_QUOTE_PUNCTUATION, - CHARTYPE_FINAL_QUOTE_PUNCTUATION - }; - - /** - * Decomposition types as described by the unicode standard. These values map to - * the same values in uchar.h in ICU. - */ - enum DecompositionType { - DECOMPOSITION_NONE = 0, - DECOMPOSITION_CANONICAL, - DECOMPOSITION_COMPAT, - DECOMPOSITION_CIRCLE, - DECOMPOSITION_FINAL, - DECOMPOSITION_FONT, - DECOMPOSITION_FRACTION, - DECOMPOSITION_INITIAL, - DECOMPOSITION_ISOLATED, - DECOMPOSITION_MEDIAL, - DECOMPOSITION_NARROW, - DECOMPOSITION_NOBREAK, - DECOMPOSITION_SMALL, - DECOMPOSITION_SQUARE, - DECOMPOSITION_SUB, - DECOMPOSITION_SUPER, - DECOMPOSITION_VERTICAL, - DECOMPOSITION_WIDE - }; - - /** - * Returns the packed data for java calls - * @param c The unicode character. - * @return The packed data for the character. - * - * Copied from java.lang.Character implementation: - * 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - * F E D C B A 9 8 7 6 5 4 3 2 1 0 F E D C B A 9 8 7 6 5 4 3 2 1 0 - * - * 31 types --------- - * 18 directionalities --------- - * 2 mirroreds - - * ----------- 56 toupper diffs - * ----------- 48 tolower diffs - * --- 4 totitlecase diffs - * ------------- 84 numeric values - * --------- 24 mirror char diffs - */ - static uint32_t getPackedData(UChar32 c); - - /** - * Get the Character type. - * @param c The unicode character. - * @return The character's type or CHARTYPE_UNASSIGNED if the character is invalid - * or has an unassigned class. - */ - static CharType getType(UChar32 c); - - /** - * Get the Character's decomposition type. - * @param c The unicode character. - * @return The character's decomposition type or DECOMPOSITION_NONE is there - * is no decomposition. - */ - static DecompositionType getDecompositionType(UChar32 c); - - /** - * Returns the digit value of a character or -1 if the character - * is not within the specified radix. - * - * The digit value is computed for integer characters and letters - * within the given radix. This function does not handle Roman Numerals, - * fractions, or any other characters that may represent numbers. - * - * @param c The unicode character - * @param radix The intended radix. - * @return The digit value or -1 if there is no digit value or if the value is outside the radix. - */ - static int getDigitValue(UChar32 c, int radix = 10); - - /** - * Return the numeric value of a character - * - * @param c The unicode character. - * @return The numeric value of the character. -1 if the character has no numeric value, - * -2 if the character has a numeric value that is not representable by an integer. - */ - static int getNumericValue(UChar32 c); - - /** - * Convert the character to lowercase - * @param c The unicode character. - * @return The lowercase character equivalent of c. If c does not have a lowercase equivalent, - * the original character is returned. - */ - static UChar32 toLower(UChar32 c); - - /** - * Convert the character to uppercase - * @param c The unicode character. - * @return The uppercase character equivalent of c. If c does not have an uppercase equivalent, - * the original character is returned. - */ - static UChar32 toUpper(UChar32 c); - - /** - * Get the directionality of the character. - * @param c The unicode character. - * @return The direction of the character or DIRECTIONALITY_UNDEFINED. - */ - static Direction getDirectionality(UChar32 c); - - /** - * Check if the character is a mirrored character. This means that the character - * has an equivalent character that is the mirror image of itself. - * @param c The unicode character. - * @return True iff c has a mirror equivalent. - */ - static bool isMirrored(UChar32 c); - - /** - * Return the mirror of the given character. - * @param c The unicode character. - * @return The mirror equivalent of c. If c does not have a mirror equivalent, - * the original character is returned. - * @see isMirrored - */ - static UChar32 toMirror(UChar32 c); - - /** - * Convert the character to title case. - * @param c The unicode character. - * @return The titlecase equivalent of c. If c does not have a titlecase equivalent, - * the original character is returned. - */ - static UChar32 toTitle(UChar32 c); - - }; - -} - -#endif diff --git a/libs/rs/rs.spec b/libs/rs/rs.spec index ac115d3..10e5285 100644 --- a/libs/rs/rs.spec +++ b/libs/rs/rs.spec @@ -29,7 +29,7 @@ ContextResume { ContextSetSurface { param uint32_t width param uint32_t height - param void *sur + param android_native_window_t *sur } ContextDump { diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp index e94aece..dec993a 100644 --- a/libs/rs/rsContext.cpp +++ b/libs/rs/rsContext.cpp @@ -857,9 +857,9 @@ void rsi_ContextResume(Context *rsc) rsc->resume(); } -void rsi_ContextSetSurface(Context *rsc, uint32_t w, uint32_t h, void *sur) +void rsi_ContextSetSurface(Context *rsc, uint32_t w, uint32_t h, android_native_window_t *sur) { - rsc->setSurface(w, h, (android_native_window_t *)sur); + rsc->setSurface(w, h, sur); } void rsi_ContextSetPriority(Context *rsc, int32_t p) diff --git a/libs/utils/Android.mk b/libs/utils/Android.mk index 59409a2..d2cfd3b 100644 --- a/libs/utils/Android.mk +++ b/libs/utils/Android.mk @@ -75,7 +75,6 @@ include $(CLEAR_VARS) # we have the common sources, plus some device-specific stuff LOCAL_SRC_FILES:= \ $(commonSources) \ - Unicode.cpp \ BackupData.cpp \ BackupHelpers.cpp diff --git a/libs/utils/CharacterData.h b/libs/utils/CharacterData.h deleted file mode 100644 index e931d99..0000000 --- a/libs/utils/CharacterData.h +++ /dev/null @@ -1,730 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -// Automatically generated on 07-11-2006 by make-CharacterDataC -// DO NOT EDIT DIRECTLY -namespace CharacterData { - - // Structure containing an array of ranges - struct Range { - int length; - const uint32_t* array; - }; - - // For Latin1 characters just index into this array to get the index and decomposition - static const uint16_t LATIN1_DATA[] = { - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0002, 0x0003, 0x0002, 0x0004, 0x0003, 0x0001, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0003, 0x0003, 0x0003, 0x0002, - 0x0005, 0x0006, 0x0006, 0x0007, 0x0008, 0x0007, 0x0006, 0x0006, - 0x0009, 0x000A, 0x0006, 0x000B, 0x000C, 0x000D, 0x000C, 0x000C, - 0x000E, 0x000F, 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, - 0x0016, 0x0017, 0x000C, 0x0006, 0x0018, 0x0019, 0x001A, 0x0006, - 0x0006, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, 0x0020, 0x0021, - 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, - 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, 0x0030, 0x0031, - 0x0032, 0x0033, 0x0034, 0x0035, 0x0006, 0x0036, 0x0037, 0x0038, - 0x0037, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - 0x0050, 0x0051, 0x0052, 0x0035, 0x0019, 0x0036, 0x0019, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0003, 0x0001, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x5853, 0x0006, 0x0008, 0x0008, 0x0008, 0x0008, 0x0054, 0x0054, - 0x1037, 0x0054, 0x7855, 0x0056, 0x0019, 0x0057, 0x0054, 0x1037, - 0x0058, 0x0059, 0x785A, 0x785B, 0x1037, 0x105C, 0x0054, 0x0006, - 0x1037, 0x785D, 0x7855, 0x005E, 0x305F, 0x305F, 0x305F, 0x0006, - 0x0860, 0x0860, 0x0860, 0x0860, 0x0860, 0x0860, 0x0060, 0x0860, - 0x0860, 0x0860, 0x0860, 0x0860, 0x0860, 0x0860, 0x0860, 0x0860, - 0x0060, 0x0860, 0x0860, 0x0860, 0x0860, 0x0860, 0x0860, 0x0019, - 0x0060, 0x0860, 0x0860, 0x0860, 0x0860, 0x0860, 0x0060, 0x0055, - 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0061, 0x0861, - 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, - 0x0061, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0019, - 0x0061, 0x0861, 0x0861, 0x0861, 0x0861, 0x0861, 0x0061, 0x0862 - }; - - // Each of these arrays is stripped into ranges. In order to build the arrays, each - // codepoint was bit-shifted so that even and odd characters were separated into different - // arrays. The identifier of each array is the top byte after bit-shifting. - // The numbers stored in the array are the bit-shifted codepoint, the decomposition, and an - // index into another array of all possible packed data values. The top 16 bits are the - // codepoint and the bottom 16 are the decomposition and index. The top 5 bits for the decomposition - // and the rest for the index. - static const uint32_t a0[] = { - 0x00800863, 0x00880063, 0x00890863, 0x00930063, 0x00940863, 0x00980864, 0x00991063, 0x009A0863, - 0x009C0055, 0x009D0865, 0x00A01065, 0x00A10065, 0x00A20865, 0x00A50063, 0x00A60863, 0x00A90063, - 0x00AA0863, 0x00B30063, 0x00B40863, 0x00BC0866, 0x00BD0865, 0x00C00055, 0x00C10063, 0x00C30067, - 0x00C40065, 0x00C50068, 0x00C60065, 0x00C70069, 0x00C8006A, 0x00C90065, 0x00CA006B, 0x00CB006C, - 0x00CC0063, 0x00CD006D, 0x00CE006C, 0x00CF006E, 0x00D00863, 0x00D10063, 0x00D3006F, 0x00D40065, - 0x00D50055, 0x00D60063, 0x00D7006F, 0x00D80865, 0x00D90070, 0x00DA0065, 0x00DC0063, 0x00DD0055, - 0x00DE0063, 0x00DF0055, 0x00E00071, 0x00E21072, 0x00E31073, 0x00E41074, 0x00E51072, 0x00E61073, - 0x00E70865, 0x00EF0863, 0x00F20063, 0x00F30863, 0x00F80855, 0x00F91074, 0x00FA0863, 0x00FB0075, - 0x00FC0863, 0x010E0063, 0x010F0863, 0x01100076, 0x01110063, 0x01130863, 0x011A0055, 0x011D0077, - 0x011E0065, 0x011F0077, 0x01200055, 0x01210078, 0x01280055, 0x012A0079, 0x012B007A, 0x012C0055, - 0x0130007A, 0x01310055, 0x0134007B, 0x01350055, 0x0139007C, 0x013A0055, 0x0140007D, 0x01410055, - 0x0144007D, 0x0145007E, 0x01460055, 0x0149007F, 0x014A0080, 0x014B0055, 0x01587881, 0x015D0082, - 0x015E0081, 0x01610037, 0x01630082, 0x01680081, 0x01690037, 0x016C1037, 0x016F0037, 0x01707881, - 0x01730037, 0x01770081, 0x01780037, 0x01800083, 0x01A00883, 0x01A10083, 0x01A20883, 0x01A30083, - 0x01B80078, 0x01BA0837, 0x01BB0078, 0x01BD1081, 0x01BE0078, 0x01BF0806, 0x01C00078, 0x01C21037, - 0x01C30884, 0x01C40885, 0x01C60886, 0x01C70887, 0x01C80855, 0x01C90060, 0x01D10078, 0x01D20060, - 0x01D50860, 0x01D60888, 0x01D70889, 0x01D80855, 0x01D90061, 0x01E1008A, 0x01E20061, 0x01E50861, - 0x01E6088B, 0x01E7088C, 0x01E8108D, 0x01E91077, 0x01EA0877, 0x01EB108E, 0x01EC0063, 0x01F8108F, - 0x01F91090, 0x01FA1091, 0x01FB0019, 0x01FC0065, 0x01FD0063, 0x01FE0055, 0x01FF0077, 0x02000892, - 0x02010092, 0x02060892, 0x02080060, 0x02180061, 0x02280893, 0x02290093, 0x022E0893, 0x02300063, - 0x023B0863, 0x023C0063, 0x02410094, 0x02420083, 0x02440095, 0x02450063, 0x02600077, 0x02610865, - 0x02620065, 0x02680863, 0x026A0063, 0x026B0863, 0x026C0063, 0x026D0863, 0x02700063, 0x02710863, - 0x02740063, 0x02750863, 0x027B0063, 0x027C0863, 0x027D0078, 0x02800063, 0x02880078, 0x02990096, - 0x02AC0078, 0x02AD0097, 0x02B00078, 0x02B10098, 0x02C40078, 0x02C50099, 0x02C60078, 0x02C90083, - 0x02DD0078, 0x02DE0083, 0x02DF009A, 0x02E10083, 0x02E3009A, 0x02E40078, 0x02E8009B, 0x02F60078, - 0x02F8009B, 0x02FA009A, 0x02FB0078, 0x0300009C, 0x03020078, 0x0306000C, 0x03070054, 0x03080083, - 0x030B0078, 0x030F009D, 0x03100078, 0x0311089E, 0x0314009E, 0x031E0078, 0x0320009F, 0x0321009E, - 0x03260083, 0x033000A0, 0x033100A1, 0x033200A2, 0x033300A3, 0x033400A4, 0x03350007, 0x033600A5, - 0x0337009E, 0x03380083, 0x0339009E, 0x033B109E, 0x033D009E, 0x0360089E, 0x0362009E, 0x036A009D, - 0x036B0083, 0x036F0095, 0x03700083, 0x0373009F, 0x03740083, 0x0377009E, 0x0378000E, 0x03790010, - 0x037A0012, 0x037B0014, 0x037C0016, 0x037D009E, 0x037F00A6, 0x0380009D, 0x03870078, 0x0388009E, - 0x03980083, 0x03A60078, 0x03A7009E, 0x03B70078, 0x03C0009E, 0x03D30083, 0x03D90078, 0x04810083, - 0x04820071, 0x049A0871, 0x049B0071, 0x049D0078, 0x049E0083, 0x049F00A7, 0x04A10083, 0x04A500A7, - 0x04A70078, 0x04A80071, 0x04A90083, 0x04AB0078, 0x04AC0871, 0x04B00071, 0x04B10083, 0x04B20097, - 0x04B300A8, 0x04B400A9, 0x04B500AA, 0x04B600AB, 0x04B700AC, 0x04B80097, 0x04B90078, 0x04C100A7, - 0x04C20078, 0x04C30071, 0x04C70078, 0x04C80071, 0x04C90078, 0x04CA0071, 0x04DA0078, 0x04DB0071, - 0x04DD0078, 0x04DE0083, 0x04DF00A7, 0x04E10083, 0x04E30078, 0x04E400A7, 0x04E50078, 0x04E608A7, - 0x04E70071, 0x04E80078, 0x04EE0871, 0x04EF0078, 0x04F00071, 0x04F10083, 0x04F20078, 0x04F300A8, - 0x04F400A9, 0x04F500AA, 0x04F600AB, 0x04F700AC, 0x04F80071, 0x04F90008, 0x04FA00AD, 0x04FB00AE, - 0x04FC00AF, 0x04FD0094, 0x04FE0078, 0x05010083, 0x05020078, 0x05030071, 0x05060078, 0x05080071, - 0x05090078, 0x050A0071, 0x051A0078, 0x051B0871, 0x051C0071, 0x051D0078, 0x051E0083, 0x051F00A7, - 0x05210083, 0x05220078, 0x05240083, 0x05250078, 0x05260083, 0x05270078, 0x052D0871, 0x052E0071, - 0x052F0871, 0x05300078, 0x053300A8, 0x053400A9, 0x053500AA, 0x053600AB, 0x053700AC, 0x05380083, - 0x05390071, 0x053B0078, 0x05410083, 0x05420078, 0x05430071, 0x05470078, 0x05480071, 0x05490078, - 0x054A0071, 0x055A0078, 0x055B0071, 0x055D0078, 0x055E0083, 0x055F00A7, 0x05610083, 0x05630078, - 0x05640083, 0x05650078, 0x056600A7, 0x05670078, 0x05680071, 0x05690078, 0x05700071, 0x05710083, - 0x05720078, 0x057300A8, 0x057400A9, 0x057500AA, 0x057600AB, 0x057700AC, 0x05780078, 0x058100A7, - 0x05820078, 0x05830071, 0x05870078, 0x05880071, 0x05890078, 0x058A0071, 0x059A0078, 0x059B0071, - 0x059D0078, 0x059E0083, 0x059F00A7, 0x05A10083, 0x05A20078, 0x05A408A7, 0x05A50078, 0x05A608A7, - 0x05A70078, 0x05AB0083, 0x05AC0078, 0x05AE0871, 0x05AF0078, 0x05B00071, 0x05B10078, 0x05B300A8, - 0x05B400A9, 0x05B500AA, 0x05B600AB, 0x05B700AC, 0x05B80094, 0x05B90078, 0x05C10083, 0x05C20078, - 0x05C30071, 0x05C60078, 0x05C70071, 0x05CA0871, 0x05CB0078, 0x05CD0071, 0x05D00078, 0x05D20071, - 0x05D30078, 0x05D40071, 0x05D60078, 0x05D70071, 0x05DD0078, 0x05DF00A7, 0x05E00083, 0x05E100A7, - 0x05E20078, 0x05E300A7, 0x05E508A7, 0x05E70078, 0x05F300A8, 0x05F400A9, 0x05F500AA, 0x05F600AB, - 0x05F700AC, 0x05F800B0, 0x05F900B1, 0x05FA0054, 0x05FE0078, 0x060100A7, 0x06020078, 0x06030071, - 0x061A0078, 0x061B0071, 0x061D0078, 0x061F0083, 0x062100A7, 0x06230083, 0x06240883, 0x06250083, - 0x06270078, 0x062B0083, 0x062C0078, 0x06300071, 0x06310078, 0x063300A8, 0x063400A9, 0x063500AA, - 0x063600AB, 0x063700AC, 0x06380078, 0x064100A7, 0x06420078, 0x06430071, 0x065A0078, 0x065B0071, - 0x065D0078, 0x065E0083, 0x065F00A7, 0x066008A7, 0x066100A7, 0x066300B2, 0x066408A7, 0x06660083, - 0x06670078, 0x066B00A7, 0x066C0078, 0x066F0071, 0x06710078, 0x067300A8, 0x067400A9, 0x067500AA, - 0x067600AB, 0x067700AC, 0x06780078, 0x068100A7, 0x06820078, 0x06830071, 0x069D0078, 0x069F00A7, - 0x06A10083, 0x06A20078, 0x06A300A7, 0x06A508A7, 0x06A70078, 0x06B00071, 0x06B10078, 0x06B300A8, - 0x06B400A9, 0x06B500AA, 0x06B600AB, 0x06B700AC, 0x06B80078, 0x06C100A7, 0x06C20078, 0x06C30071, - 0x06CC0078, 0x06CD0071, 0x06D90078, 0x06DA0071, 0x06DE0078, 0x06E00071, 0x06E40078, 0x06E50083, - 0x06E60078, 0x06E800A7, 0x06E90083, 0x06EC00A7, 0x06ED08A7, 0x06F00078, 0x06F900A7, 0x06FA0097, - 0x06FB0078, 0x07010071, 0x071A0083, 0x071E0078, 0x07200071, 0x07230081, 0x07240083, 0x072800A8, - 0x072900A9, 0x072A00AA, 0x072B00AB, 0x072C00AC, 0x072D0097, 0x072E0078, 0x07410071, 0x07430078, - 0x07440071, 0x07460078, 0x074A0071, 0x074C0078, 0x074D0071, 0x07500078, 0x07510071, 0x07520078, - 0x07550071, 0x07560078, 0x07570071, 0x075A0083, 0x075D0078, 0x075E0083, 0x075F0078, 0x07600071, - 0x07630081, 0x07640083, 0x07670078, 0x076800A8, 0x076900A9, 0x076A00AA, 0x076B00AB, 0x076C00AC, - 0x076D0078, 0x076E1071, 0x076F0078, 0x07800071, 0x07810094, 0x07820097, 0x07865897, 0x07870097, - 0x078A0094, 0x078C0083, 0x078D0094, 0x079000A8, 0x079100A9, 0x079200AA, 0x079300AB, 0x079400AC, - 0x079500B3, 0x079A0094, 0x079D00B4, 0x079F00A7, 0x07A00071, 0x07A40078, 0x07A50071, 0x07A90871, - 0x07AA0071, 0x07AE0871, 0x07AF0071, 0x07B60078, 0x07B90083, 0x07BB0883, 0x07BD0083, 0x07C40071, - 0x07C60078, 0x07C80083, 0x07CC0078, 0x07CD0083, 0x07D10883, 0x07D20083, 0x07D60883, 0x07D70083, - 0x07DF0094, 0x07E30083, 0x07E40094, 0x07E70078, 0x07E80097, 0x07E90078, 0x08000071, 0x08110078, - 0x08120071, 0x08130871, 0x08140078, 0x08150071, 0x081600A7, 0x08170083, 0x081A0078, 0x081B0083, - 0x081C00A7, 0x081D0078, 0x082000A8, 0x082100A9, 0x082200AA, 0x082300AB, 0x082400AC, 0x08250097, - 0x08280071, 0x082B00A7, 0x082C0083, 0x082D0078, 0x085000B5, 0x08630078, 0x08680071, 0x087E7881, - 0x087F0078, 0x08800071, 0x08AD0078, 0x08B00071, 0x08D20078, 0x08D40071, 0x08FD0078, 0x09000071, - 0x09270078, 0x09280071, 0x092F0078, 0x09300071, 0x09470078, 0x09480071, 0x095B0078, 0x095C0071, - 0x09630078, 0x09640071, 0x098B0078, 0x098C0071, 0x09AE0078, 0x09B00094, 0x09B10097, 0x09B500B6, - 0x09B600B7, 0x09B700B8, 0x09B800B9, 0x09B900B0, 0x09BA00BA, 0x09BB00BB, 0x09BC00BC, 0x09BD00BD, - 0x09BE00BE, 0x09BF0078, 0x09C00071, 0x09C80054, 0x09CD0078, 0x09D00071, 0x09FB0078, 0x0A010071, - 0x0B370097, 0x0B380071, 0x0B3C0078, 0x0B400005, 0x0B410071, 0x0B4E00BF, 0x0B4F0078, 0x0B500071, - 0x0B760097, 0x0B7700C0, 0x0B7800C1, 0x0B790078, 0x0B800071, 0x0B890083, 0x0B8B0078, 0x0B900071, - 0x0B990083, 0x0B9B0097, 0x0B9C0078, 0x0BA00071, 0x0BA90083, 0x0BAA0078, 0x0BB00071, 0x0BB90083, - 0x0BBA0078, 0x0BC00071, 0x0BDA00C2, 0x0BDB00A7, 0x0BDC0083, 0x0BDF00A7, 0x0BE30083, 0x0BE400A7, - 0x0BE50083, 0x0BEA0097, 0x0BEE0071, 0x0BEF0078, 0x0BF000A8, 0x0BF100A9, 0x0BF200AA, 0x0BF300AB, - 0x0BF400AC, 0x0BF50078, 0x0BF800C3, 0x0BF900C4, 0x0BFA00C5, 0x0BFB00C6, 0x0BFC00C7, 0x0BFD0078, - 0x0C000006, 0x0C030099, 0x0C040006, 0x0C060083, 0x0C070005, 0x0C0800A8, 0x0C0900A9, 0x0C0A00AA, - 0x0C0B00AB, 0x0C0C00AC, 0x0C0D0078, 0x0C100071, 0x0C3C0078, 0x0C400071, 0x0C550078, 0x0C800071, - 0x0C8F0078, 0x0C900083, 0x0C9200A7, 0x0C940083, 0x0C9500C8, 0x0C960078, 0x0C9800A7, 0x0C990083, - 0x0C9A00A7, 0x0C9D0083, 0x0C9E0078, 0x0CA00054, 0x0CA10078, 0x0CA20006, 0x0CA300A8, 0x0CA400A9, - 0x0CA500AA, 0x0CA600AB, 0x0CA700AC, 0x0CA80071, 0x0CB70078, 0x0CB80071, 0x0CBB0078, 0x0CC00071, - 0x0CD50078, 0x0CD800A7, 0x0CE10071, 0x0CE400A7, 0x0CE50078, 0x0CE800A8, 0x0CE900A9, 0x0CEA00AA, - 0x0CEB00AB, 0x0CEC00AC, 0x0CED0078, 0x0CEF0006, 0x0CF00054, 0x0D000071, 0x0D0C0083, 0x0D0D00A7, - 0x0D0E0078, 0x0D0F0097, 0x0D100078, 0x0E800055, 0x0E967881, 0x0EA70081, 0x0EA87881, 0x0EB17055, - 0x0EB60055, 0x0EBC7881, 0x0EBD0055, 0x0ECE7881, 0x0EE00083, 0x0EE20078, 0x0F000863, 0x0F4B0855, - 0x0F4D1055, 0x0F4E0078, 0x0F500863, 0x0F7D0078, 0x0F8008C9, 0x0F8408CA, 0x0F8808C9, 0x0F8B0078, - 0x0F8C08CA, 0x0F8F0078, 0x0F9008C9, 0x0F9408CA, 0x0F9808C9, 0x0F9C08CA, 0x0FA008C9, 0x0FA30078, - 0x0FA408CA, 0x0FA70078, 0x0FA80855, 0x0FAC0078, 0x0FB008C9, 0x0FB408CA, 0x0FB808CB, 0x0FB908CC, - 0x0FBB08CD, 0x0FBC08CE, 0x0FBD08CF, 0x0FBE08D0, 0x0FBF0078, 0x0FC008C9, 0x0FC408D1, 0x0FC808C9, - 0x0FCC08D1, 0x0FD008C9, 0x0FD408D1, 0x0FD808C9, 0x0FD90855, 0x0FDC08CA, 0x0FDD08D2, 0x0FDE08D3, - 0x0FDF08D4, 0x0FE01037, 0x0FE10855, 0x0FE408D5, 0x0FE608D3, 0x0FE70837, 0x0FE808C9, 0x0FE90855, - 0x0FEA0078, 0x0FEB0855, 0x0FEC08CA, 0x0FED08D6, 0x0FEE0078, 0x0FEF0837, 0x0FF008C9, 0x0FF10855, - 0x0FF408CA, 0x0FF508D7, 0x0FF608D8, 0x0FF70837, 0x0FF80078, 0x0FF90855, 0x0FFC08D9, 0x0FFD08DA, - 0x0FFE08D3, 0x0FFF1037, 0x10000805, 0x10011005, 0x10060057, 0x100700C2, 0x10080099, 0x100B0006, - 0x100C00DB, 0x100D00B4, 0x100E00DB, 0x100F00B4, 0x10100006, 0x10121006, 0x101400DC, 0x101500DD, - 0x101600DE, 0x101700DF, 0x10180007, 0x101A1007, 0x101B1006, 0x101C0006, 0x101D00E0, 0x101E1006, - 0x10200038, 0x10210006, 0x102200E1, 0x1023000A, 0x10241006, 0x10250006, 0x10290019, 0x102A0038, - 0x102B0006, 0x10300057, 0x10320078, 0x10350057, 0x103878E2, 0x10390078, 0x103A78E3, 0x103B78E4, - 0x103C78E5, 0x103D780B, 0x103E7819, 0x103F780A, 0x104070E2, 0x1041705A, 0x104270E3, 0x104370E4, - 0x104470E5, 0x1045700B, 0x10467019, 0x1047700A, 0x10487081, 0x104B0078, 0x10500008, 0x10541008, - 0x10550008, 0x105B0078, 0x10680083, 0x106F0095, 0x10730083, 0x10760078, 0x10801054, 0x10812877, - 0x10820054, 0x10831054, 0x10840054, 0x10852855, 0x10862877, 0x10872855, 0x10882877, 0x108A0054, - 0x108B1054, 0x108C0054, 0x108D2877, 0x108F0054, 0x10907854, 0x10922877, 0x109308E6, 0x10942877, - 0x109508E7, 0x10962877, 0x10970058, 0x10982877, 0x10990054, 0x109A2855, 0x109B1071, 0x109D0054, - 0x109E2855, 0x109F2877, 0x10A028E8, 0x10A10019, 0x10A32855, 0x10A50054, 0x10A70078, 0x10AA305F, - 0x10B010E9, 0x10B110EA, 0x10B210EB, 0x10B310EC, 0x10B410ED, 0x10B510EE, 0x10B610EF, 0x10B710F0, - 0x10B810F1, 0x10B910F2, 0x10BA10F3, 0x10BB10F4, 0x10BC10F5, 0x10BD10F6, 0x10BE10F7, 0x10BF10F8, - 0x10C000F9, 0x10C100FA, 0x10C20078, 0x10C80019, 0x10CB0054, 0x10CD0819, 0x10CE0054, 0x10D00019, - 0x10D10054, 0x10D30019, 0x10D40054, 0x10D70819, 0x10D80054, 0x10E70819, 0x10E80054, 0x10E90019, - 0x10EB0054, 0x10FA0019, 0x110100E8, 0x110208E8, 0x11030019, 0x110400FB, 0x110608FC, 0x11070019, - 0x1109000B, 0x110A0019, 0x110B00E8, 0x110C0019, 0x110D00E8, 0x110F0019, 0x111000E8, 0x111208E8, - 0x11140019, 0x111610E8, 0x111700E8, 0x111810E8, 0x111900E8, 0x111A0019, 0x111E00FD, 0x111F00E8, - 0x112208E8, 0x112300E8, 0x11270019, 0x112900FD, 0x112B0019, 0x113008E8, 0x113200FD, 0x11360019, - 0x113708FD, 0x113900FD, 0x113A08FD, 0x113B00FD, 0x113C08FD, 0x113D00FD, 0x114008FD, 0x114100FD, - 0x114208FD, 0x114300FD, 0x114408FD, 0x114500FD, 0x114600E8, 0x11470019, 0x114800FE, 0x114A0019, - 0x114C00FF, 0x114D0019, 0x115100FD, 0x11520019, 0x11530100, 0x11540101, 0x115500E8, 0x115608E8, - 0x115800FD, 0x115C00E8, 0x115D0019, 0x115F00E8, 0x11600019, 0x116500FE, 0x11670019, 0x116800FD, - 0x11690019, 0x116B00FD, 0x117008FD, 0x117200FD, 0x117508FD, 0x11770019, 0x117800FD, 0x11790102, - 0x117B0103, 0x117C00E8, 0x117D0104, 0x117F0105, 0x11800054, 0x118400FD, 0x11860054, 0x119000E8, - 0x11910054, 0x1195080A, 0x11960054, 0x119B0094, 0x11BE0019, 0x11BF0054, 0x11CE0019, 0x11DA00B4, - 0x11DB0006, 0x11DC0054, 0x11EE0078, 0x12000054, 0x12140078, 0x12200054, 0x12260078, 0x12301906, - 0x12311907, 0x12321908, 0x12331909, 0x1234190A, 0x1235190B, 0x1236190C, 0x1237190D, 0x1238190E, - 0x1239190F, 0x123A1106, 0x123B1107, 0x123C1108, 0x123D1109, 0x123E110A, 0x123F110B, 0x1240110C, - 0x1241110D, 0x1242110E, 0x1243110F, 0x1244105D, 0x1245105B, 0x12461110, 0x12471111, 0x12481112, - 0x12491113, 0x124A1114, 0x124B1115, 0x124C1116, 0x124D1117, 0x124E1094, 0x125B1918, 0x12681919, - 0x127518C3, 0x1276011A, 0x1277011B, 0x1278011C, 0x1279011D, 0x127A011E, 0x127B00C4, 0x127C00C5, - 0x127D00C6, 0x127E00C7, 0x127F011F, 0x12800054, 0x12FC0019, 0x13000054, 0x134F0078, 0x13500054, - 0x13560094, 0x13570054, 0x13590078, 0x13810054, 0x13850078, 0x13860054, 0x13940078, 0x13950054, - 0x13A60078, 0x13A80054, 0x13AA0078, 0x13AB0054, 0x13B00078, 0x13B10054, 0x13B40009, 0x13BB0106, - 0x13BC0107, 0x13BD0108, 0x13BE0109, 0x13BF010A, 0x13C00106, 0x13C10107, 0x13C20108, 0x13C30109, - 0x13C4010A, 0x13C50106, 0x13C60107, 0x13C70108, 0x13C80109, 0x13C9010A, 0x13CA0054, 0x13CB0078, - 0x13CC0054, 0x13D80078, 0x13D90054, 0x13E000E8, 0x13E10019, 0x13E200FE, 0x13E3000A, 0x13E40078, - 0x13E80019, 0x13EA00E8, 0x13EB00FE, 0x13EC0019, 0x13EE00E8, 0x13EF00FE, 0x13F00019, 0x13F100FD, - 0x13F30009, 0x13F60078, 0x13F80019, 0x14000094, 0x14800019, 0x14C2000A, 0x14C70120, 0x14C80121, - 0x14C9000A, 0x14CD0019, 0x14CE00E8, 0x14D80019, 0x14DC0122, 0x14DD0019, 0x14E000FD, 0x14E100E8, - 0x14E200FD, 0x14E30019, 0x14E700E8, 0x14E800FE, 0x14EA00FD, 0x14EB0019, 0x14EC0009, 0x14EE00E8, - 0x14EF0019, 0x14F200E8, 0x14F30019, 0x14F400E8, 0x14F50019, 0x14FA00E8, 0x14FC00FD, 0x14FD0019, - 0x14FE0009, 0x14FF0019, 0x150500E8, 0x150610E8, 0x150700E8, 0x15110019, 0x151200E8, 0x15140019, - 0x151600FE, 0x15180019, 0x151A00FD, 0x151B0019, 0x151E00FD, 0x151F00E8, 0x15200019, 0x152C00E8, - 0x152D0019, 0x153200FD, 0x15330019, 0x153500E8, 0x15370019, 0x153800E8, 0x15390019, 0x153A10E8, - 0x153B1019, 0x153C0019, 0x153D00FE, 0x153E00E8, 0x153F00FE, 0x154300E8, 0x154600FE, 0x154700E8, - 0x154900FE, 0x154F00E8, 0x155100FE, 0x15520019, 0x155300FD, 0x15570019, 0x155800FE, 0x155900E8, - 0x155A00FE, 0x155B00E8, 0x155E00FE, 0x156400E8, 0x156700FE, 0x156C0019, 0x156E08E8, 0x156F0123, - 0x15700019, 0x157100E8, 0x15720124, 0x157300E8, 0x15740019, 0x157600FD, 0x157700E8, 0x15780019, - 0x157C00FE, 0x157E0019, 0x15800054, 0x158A0078, 0x16000096, 0x16180098, 0x16300078, 0x16400063, - 0x16720055, 0x16730054, 0x16760078, 0x167D0006, 0x16800125, 0x16930078, 0x16980071, 0x16B30078, - 0x16C00071, 0x16CC0078, 0x16D00071, 0x16F00078, 0x17000006, 0x17010126, 0x17030006, 0x170500E0, - 0x17060126, 0x17070006, 0x170C0078, 0x170E0126, 0x170F0078, 0x17400054, 0x174D0078, 0x174E0054, - 0x177A0078, 0x17801054, 0x17EB0078, 0x17F80054, 0x17FE0078, 0x18008805, 0x18010006, 0x18020054, - 0x18030071, 0x18040009, 0x18090054, 0x180A0009, 0x180E0099, 0x180F00BF, 0x18100054, 0x18110127, - 0x18120128, 0x18130129, 0x1814012A, 0x18150083, 0x18180099, 0x18190081, 0x181B1054, 0x181C112B, - 0x181D112C, 0x181E0071, 0x181F0054, 0x18200078, 0x18210071, 0x18260871, 0x18320071, 0x18380871, - 0x18390071, 0x183A0871, 0x183C0071, 0x183D0871, 0x183F0071, 0x184A0871, 0x184B0071, 0x184C0078, - 0x184D0083, 0x184E1037, 0x184F0881, 0x18500099, 0x18510071, 0x18560871, 0x18620071, 0x18680871, - 0x18690071, 0x186A0871, 0x186C0071, 0x186D0871, 0x186F0071, 0x187A0871, 0x187B0071, 0x187C0871, - 0x187E0081, 0x187F0881, 0x18800078, 0x18830071, 0x18970078, 0x18991071, 0x18C80094, 0x18C978AD, - 0x18CA78AE, 0x18CB7894, 0x18D00071, 0x18DC0078, 0x18E00054, 0x18E80078, 0x18F80071, 0x19001094, - 0x190F1054, 0x191010AD, 0x191110AE, 0x1912112D, 0x1913112E, 0x1914112F, 0x19151094, 0x19220078, - 0x19286854, 0x19291930, 0x192A1931, 0x192B1932, 0x192C1933, 0x192D1934, 0x192E1935, 0x192F1936, - 0x19301894, 0x193E1854, 0x194018AD, 0x194118AE, 0x1942192D, 0x1943192E, 0x1944192F, 0x19451894, - 0x19591937, 0x195A1938, 0x195B1939, 0x195C193A, 0x195D193B, 0x195E193C, 0x195F193D, 0x19601094, - 0x19666854, 0x19681894, 0x19806894, 0x19AC1094, 0x19B96894, 0x19BC6854, 0x19BE6894, 0x19EF6854, - 0x19F01094, 0x1A000071, 0x26DB0078, 0x26E00054, 0x27000071, 0x4FDE0078, 0x50000071, 0x52470078, - 0x52480054, 0x52640078, 0x53800037, 0x538C0078, 0x54000071, 0x540100C8, 0x54020071, 0x54030083, - 0x54040071, 0x541200A7, 0x54130083, 0x54140054, 0x54160078, 0x56000071, 0x6BD20078, 0x6C00013E, - 0x7000013F, 0x7C800871, 0x7D070071, 0x7D080871, 0x7D0A0071, 0x7D0B0871, 0x7D120071, 0x7D130871, - 0x7D140071, 0x7D150871, 0x7D170078, 0x7D180871, 0x7D360078, 0x7D380871, 0x7D6D0078, 0x7D801055, - 0x7D840078, 0x7D8A1055, 0x7D8C0078, 0x7D8F0083, 0x7D90289B, 0x7D95089B, 0x7DA10078, 0x7DA2089B, - 0x7DA8409E, 0x7DAA389E, 0x7DAB409E, 0x7DAC389E, 0x7DAD409E, 0x7DAE389E, 0x7DAF409E, 0x7DB0389E, - 0x7DB1409E, 0x7DB2389E, 0x7DB3409E, 0x7DB4389E, 0x7DB5409E, 0x7DB6389E, 0x7DB7409E, 0x7DB8389E, - 0x7DB9409E, 0x7DBA389E, 0x7DBB409E, 0x7DBC389E, 0x7DBD409E, 0x7DBE389E, 0x7DBF409E, 0x7DC0389E, - 0x7DC1409E, 0x7DC8389E, 0x7DC9409E, 0x7DCA389E, 0x7DCB409E, 0x7DCC389E, 0x7DCD409E, 0x7DCE389E, - 0x7DCF409E, 0x7DD1389E, 0x7DD2409E, 0x7DD4389E, 0x7DD5409E, 0x7DD6389E, 0x7DD7409E, 0x7DD90078, - 0x7DEA209E, 0x7DEB489E, 0x7DEC209E, 0x7DEF409E, 0x7DF3389E, 0x7DF5409E, 0x7DFC389E, 0x7DFD209E, - 0x7DFE409E, 0x7DFF389E, 0x7E00409E, 0x7E32209E, 0x7E4C389E, 0x7E70489E, 0x7E7B409E, 0x7E89209E, - 0x7E97389E, 0x7E9A489E, 0x7E9E209E, 0x7E9F00B4, 0x7EA00078, 0x7EA8389E, 0x7EAC209E, 0x7EAE389E, - 0x7EAF209E, 0x7EB0389E, 0x7EB1209E, 0x7EB4389E, 0x7EB5209E, 0x7EB8389E, 0x7EBA209E, 0x7EC3389E, - 0x7EC80078, 0x7EC9389E, 0x7ECB209E, 0x7ECC389E, 0x7ECD209E, 0x7EDA389E, 0x7EDB209E, 0x7EDC389E, - 0x7EDE209E, 0x7EE2389E, 0x7EE3209E, 0x7EE40078, 0x7EF8409E, 0x7EFE4140, 0x7EFF0078, 0x7F000083, - 0x7F088006, 0x7F0C80BF, 0x7F0D0078, 0x7F100083, 0x7F120078, 0x7F188006, 0x7F198099, 0x7F1A8038, - 0x7F1B80BF, 0x7F230006, 0x7F2480BF, 0x7F251006, 0x7F271038, 0x7F28600C, 0x7F2A6006, 0x7F2C6099, - 0x7F2D60BF, 0x7F306006, 0x7F31600B, 0x7F326019, 0x7F346006, 0x7F356007, 0x7F360078, 0x7F38409E, - 0x7F41209E, 0x7F46489E, 0x7F47209E, 0x7F49489E, 0x7F4A209E, 0x7F4C489E, 0x7F4D209E, 0x7F4E489E, - 0x7F4F209E, 0x7F50489E, 0x7F51209E, 0x7F52489E, 0x7F53209E, 0x7F54489E, 0x7F55209E, 0x7F5A489E, - 0x7F5B209E, 0x7F5C489E, 0x7F5D209E, 0x7F5E489E, 0x7F5F209E, 0x7F60489E, 0x7F61209E, 0x7F62489E, - 0x7F63209E, 0x7F64489E, 0x7F65209E, 0x7F66489E, 0x7F67209E, 0x7F68489E, 0x7F69209E, 0x7F6A489E, - 0x7F6B209E, 0x7F6C489E, 0x7F6D209E, 0x7F6E489E, 0x7F6F209E, 0x7F70489E, 0x7F71209E, 0x7F72489E, - 0x7F73209E, 0x7F74489E, 0x7F75209E, 0x7F76489E, 0x7F77209E, 0x7F7A489E, 0x7F7B209E, 0x7F7F0078, - 0x7F818806, 0x7F828808, 0x7F838806, 0x7F848809, 0x7F858806, 0x7F86880C, 0x7F88880E, 0x7F898810, - 0x7F8A8812, 0x7F8B8814, 0x7F8C8816, 0x7F8D880C, 0x7F8E8818, 0x7F8F881A, 0x7F908806, 0x7F918860, - 0x7F9E8806, 0x7F9F8837, 0x7FA18861, 0x7FAE8819, 0x7FB0880A, 0x7FB15009, 0x7FB25006, 0x7FB35071, - 0x7FB85081, 0x7FB95071, 0x7FCF5081, 0x7FD05071, 0x7FE00078, 0x7FE15071, 0x7FE40078, 0x7FE55071, - 0x7FE80078, 0x7FE95071, 0x7FEC0078, 0x7FED5071, 0x7FEF0078, 0x7FF08808, 0x7FF18819, 0x7FF28854, - 0x7FF38808, 0x7FF45054, 0x7FF55019, 0x7FF75054, 0x7FF80078, 0x7FFD0141, 0x7FFE0054, 0x7FFF0078, - 0x80000071, 0x80060078, 0x80070071, 0x801F0078, 0x80200071, 0x80270078, 0x80280071, 0x802F0078, - 0x80400071, 0x807E0078, 0x80800097, 0x80810094, 0x80820078, 0x808400B6, 0x808500B7, 0x808600B8, - 0x808700B9, 0x808800B0, 0x808900BA, 0x808A00BB, 0x808B00BC, 0x808C00BD, 0x808D0142, 0x808E0143, - 0x808F0144, 0x80900145, 0x809100B1, 0x80920146, 0x80930147, 0x80940148, 0x80950149, 0x8096014A, - 0x8097014B, 0x8098014C, 0x8099014D, 0x809A0078, 0x809C0094, 0x80A0014E, 0x80A1014F, 0x80A20150, - 0x80A30151, 0x80A40152, 0x80A50150, 0x80A60153, 0x80A70151, 0x80A80154, 0x80A90155, 0x80AA0156, - 0x80AB0157, 0x80AC014F, 0x80AE0158, 0x80B00154, 0x80B30150, 0x80B50155, 0x80B60153, 0x80B90151, - 0x80BA0150, 0x80BB005F, 0x80BD0054, 0x80C500C3, 0x80C60078, 0x81800071, 0x819000AD, 0x819100B0, - 0x81920078, 0x81980071, 0x81A50159, 0x81A60078, 0x81C00071, 0x81CF0078, 0x81D00071, 0x81E20078, - 0x81E40071, 0x81E80094, 0x81E90158, 0x81EA015A, 0x81EB0078, 0x8200015B, 0x8214015C, 0x82280071, - 0x824F0078, 0x825000A8, 0x825100A9, 0x825200AA, 0x825300AB, 0x825400AC, 0x82550078, 0x8400009B, - 0x84030078, 0x8404009B, 0x841B0078, 0x841C009B, 0x841D0078, 0x841E009B, 0x841F0078, 0x8500009B, - 0x85010083, 0x85020078, 0x85030083, 0x85040078, 0x85060083, 0x8508009B, 0x850A0078, 0x850B009B, - 0x850C0078, 0x850D009B, 0x851A0078, 0x851C0083, 0x851E0078, 0x8520015D, 0x8521015E, 0x8522015F, - 0x85230160, 0x85240078, 0x8528009A, 0x852D0078, 0xE8000094, 0xE87B0078, 0xE8800094, 0xE8940078, - 0xE8950094, 0xE8AF0894, 0xE8B300A7, 0xE8B40083, 0xE8B50094, 0xE8B700A7, 0xE8BA0057, 0xE8BE0083, - 0xE8C20094, 0xE8C30083, 0xE8C60094, 0xE8D50083, 0xE8D70094, 0xE8DE0894, 0xE8E10094, 0xE8EF0078, - 0xE9000054, 0xE9210083, 0xE9230078, 0xE9800054, 0xE9AC0078, 0xEA002877, 0xEA0D2855, 0xEA1A2877, - 0xEA272855, 0xEA342877, 0xEA412855, 0xEA4E2877, 0xEA500078, 0xEA512877, 0xEA520078, 0xEA532877, - 0xEA540078, 0xEA552877, 0xEA5B2855, 0xEA5D0078, 0xEA5F2855, 0xEA620078, 0xEA632855, 0xEA682877, - 0xEA752855, 0xEA822877, 0xEA830078, 0xEA842877, 0xEA860078, 0xEA872877, 0xEA8F2855, 0xEA9C2877, - 0xEA9D0078, 0xEA9E2877, 0xEAA40078, 0xEAA52877, 0xEAA92855, 0xEAB62877, 0xEAC32855, 0xEAD02877, - 0xEADD2855, 0xEAEA2877, 0xEAF72855, 0xEB042877, 0xEB112855, 0xEB1E2877, 0xEB2B2855, 0xEB382877, - 0xEB452855, 0xEB530078, 0xEB542877, 0xEB612855, 0xEB712877, 0xEB7E2855, 0xEB8E2877, 0xEB9B2855, - 0xEBAB2877, 0xEBB82855, 0xEBC82877, 0xEBD52855, 0xEBE50078, 0xEBE7280E, 0xEBE82810, 0xEBE92812, - 0xEBEA2814, 0xEBEB2816, 0xEBEC280E, 0xEBED2810, 0xEBEE2812, 0xEBEF2814, 0xEBF02816, 0xEBF1280E, - 0xEBF22810, 0xEBF32812, 0xEBF42814, 0xEBF52816, 0xEBF6280E, 0xEBF72810, 0xEBF82812, 0xEBF92814, - 0xEBFA2816, 0xEBFB280E, 0xEBFC2810, 0xEBFD2812, 0xEBFE2814, 0xEBFF2816, 0xEC000078 - }; - - static const uint32_t a1[] = { - 0x00000071, 0x536C0078, 0x7C000871, 0x7D0F0078 - }; - - static const uint32_t a7[] = { - 0x00100057, 0x00400078, 0x00800083, 0x00F80078, 0x8000013F, 0xFFFF0078 - }; - - static const uint32_t a8[] = { - 0x0000013F, 0x7FFF0078 - }; - - static const uint32_t a16[] = { - 0x00800865, 0x00880065, 0x00890865, 0x00930065, 0x00940865, 0x00980161, 0x00991065, 0x009A0865, - 0x009C0863, 0x009F1063, 0x00A00063, 0x00A10863, 0x00A41055, 0x00A50065, 0x00A60865, 0x00A90065, - 0x00AA0865, 0x00B30065, 0x00B40865, 0x00BC0863, 0x00BF1162, 0x00C00163, 0x00C10065, 0x00C30063, - 0x00C40068, 0x00C50063, 0x00C60055, 0x00C70164, 0x00C80063, 0x00C90068, 0x00CA0165, 0x00CB0166, - 0x00CC0065, 0x00CD0055, 0x00CE0167, 0x00CF0168, 0x00D00865, 0x00D10065, 0x00D30063, 0x00D4006F, - 0x00D50055, 0x00D60065, 0x00D70863, 0x00D80070, 0x00D90063, 0x00DB0169, 0x00DC0065, 0x00DD0071, - 0x00DE0065, 0x00DF016A, 0x00E00071, 0x00E21074, 0x00E31072, 0x00E41073, 0x00E51074, 0x00E60863, - 0x00EE016B, 0x00EF0865, 0x00F20065, 0x00F30865, 0x00F81072, 0x00F91073, 0x00FA0865, 0x00FB016C, - 0x00FC0865, 0x010E0065, 0x010F0865, 0x01100055, 0x01110065, 0x01130865, 0x011A0055, 0x011D0063, - 0x011E016D, 0x011F0055, 0x0120016E, 0x01210078, 0x01280055, 0x0129016F, 0x012A0055, 0x012B007A, - 0x012C0170, 0x012D0171, 0x012E0055, 0x01310172, 0x01320055, 0x01340173, 0x01350055, 0x01370173, - 0x01380055, 0x013A0174, 0x013B0055, 0x0141007D, 0x01420055, 0x0145007E, 0x01460055, 0x01587881, - 0x015C0082, 0x015D0081, 0x01610037, 0x01630082, 0x01680081, 0x01690037, 0x016C1037, 0x016F0037, - 0x01707881, 0x01720037, 0x01800083, 0x01A00883, 0x01A20175, 0x01A30083, 0x01B80078, 0x01BA0037, - 0x01BB0078, 0x01C20837, 0x01C30806, 0x01C40885, 0x01C50078, 0x01C70887, 0x01C80060, 0x01D50860, - 0x01D60889, 0x01D80061, 0x01E50861, 0x01E6088C, 0x01E70078, 0x01E81176, 0x01E90877, 0x01EA1177, - 0x01EB0055, 0x01EC0065, 0x01F81093, 0x01F90055, 0x01FA1178, 0x01FB0063, 0x01FC10D8, 0x01FD0065, - 0x01FE0077, 0x02000892, 0x02020092, 0x02030892, 0x02040092, 0x02060892, 0x02070092, 0x02080060, - 0x020C0860, 0x020D0060, 0x02180061, 0x021C0861, 0x021D0061, 0x02280893, 0x022A0093, 0x022B0893, - 0x022C0093, 0x022E0893, 0x022F0093, 0x02300065, 0x023B0865, 0x023C0065, 0x02410083, 0x02430078, - 0x02440095, 0x02450065, 0x02600863, 0x02610063, 0x02670078, 0x02680865, 0x026A0065, 0x026B0865, - 0x026C0065, 0x026D0865, 0x02700065, 0x02710865, 0x02740065, 0x02750865, 0x027B0065, 0x027C0865, - 0x027D0078, 0x02800065, 0x02880078, 0x02980096, 0x02AB0078, 0x02AC0081, 0x02AD0097, 0x02B00098, - 0x02C31055, 0x02C40097, 0x02C50078, 0x02C80083, 0x02E1009A, 0x02E20083, 0x02E40078, 0x02E8009B, - 0x02F50078, 0x02F8009B, 0x02F9009A, 0x02FA0078, 0x0300009C, 0x03020078, 0x03050140, 0x0306009D, - 0x03070054, 0x03080083, 0x030B0078, 0x030D009D, 0x030E0078, 0x030F009D, 0x0310009E, 0x0311089E, - 0x0313009E, 0x031D0078, 0x0320009E, 0x03250083, 0x032F0078, 0x03300179, 0x0331017A, 0x0332017B, - 0x0333017C, 0x0334017D, 0x033500A5, 0x0336009D, 0x0337009E, 0x033A109E, 0x033C009E, 0x0369089E, - 0x036A009E, 0x036B0083, 0x036E009C, 0x036F0083, 0x0372009F, 0x03730083, 0x03740054, 0x03750083, - 0x0377009E, 0x0378000F, 0x03790011, 0x037A0013, 0x037B0015, 0x037C0017, 0x037D009E, 0x037E00A6, - 0x037F009E, 0x0380009D, 0x03870057, 0x03880083, 0x0389009E, 0x03980083, 0x03A50078, 0x03A6009E, - 0x03B70078, 0x03C0009E, 0x03D30083, 0x03D8009E, 0x03D90078, 0x04800083, 0x048100A7, 0x04820071, - 0x04940871, 0x04950071, 0x04980871, 0x04990071, 0x049D0078, 0x049E0071, 0x049F00A7, 0x04A00083, - 0x04A400A7, 0x04A60083, 0x04A70078, 0x04A80083, 0x04AA0078, 0x04AC0871, 0x04B00071, 0x04B10083, - 0x04B20097, 0x04B3017E, 0x04B4017F, 0x04B50180, 0x04B60181, 0x04B70182, 0x04B80078, 0x04BE0071, - 0x04BF0078, 0x04C00083, 0x04C100A7, 0x04C20071, 0x04C60078, 0x04C70071, 0x04C80078, 0x04C90071, - 0x04D40078, 0x04D50071, 0x04D80078, 0x04DB0071, 0x04DD0078, 0x04DE0071, 0x04DF00A7, 0x04E00083, - 0x04E20078, 0x04E300A7, 0x04E40078, 0x04E508A7, 0x04E60083, 0x04E70078, 0x04EB00A7, 0x04EC0078, - 0x04EE0871, 0x04F00071, 0x04F10083, 0x04F20078, 0x04F3017E, 0x04F4017F, 0x04F50180, 0x04F60181, - 0x04F70182, 0x04F80071, 0x04F90008, 0x04FA00B6, 0x04FB00B7, 0x04FC0183, 0x04FD0078, 0x05000083, - 0x050100A7, 0x05020071, 0x05050078, 0x05070071, 0x05080078, 0x05090071, 0x05140078, 0x05150071, - 0x05180078, 0x05190871, 0x051A0071, 0x051B0078, 0x051C0071, 0x051D0078, 0x051F00A7, 0x05200083, - 0x05210078, 0x05230083, 0x05240078, 0x05250083, 0x05270078, 0x052C0871, 0x052E0078, 0x0533017E, - 0x0534017F, 0x05350180, 0x05360181, 0x05370182, 0x05380083, 0x05390071, 0x053A0078, 0x05400083, - 0x054100A7, 0x05420071, 0x05540078, 0x05550071, 0x05580078, 0x05590071, 0x055D0078, 0x055E0071, - 0x055F00A7, 0x05600083, 0x056400A7, 0x05660083, 0x05670078, 0x05700071, 0x05710083, 0x05720078, - 0x0573017E, 0x0574017F, 0x05750180, 0x05760181, 0x05770182, 0x05780008, 0x05790078, 0x05800083, - 0x058100A7, 0x05820071, 0x05860078, 0x05870071, 0x05880078, 0x05890071, 0x05940078, 0x05950071, - 0x05980078, 0x05990071, 0x059D0078, 0x059E0071, 0x059F0083, 0x05A20078, 0x05A300A7, 0x05A40078, - 0x05A508A7, 0x05A60083, 0x05A70078, 0x05AB00A7, 0x05AC0078, 0x05AE0871, 0x05AF0071, 0x05B10078, - 0x05B3017E, 0x05B4017F, 0x05B50180, 0x05B60181, 0x05B70182, 0x05B80071, 0x05B90078, 0x05C10071, - 0x05C50078, 0x05C70071, 0x05C80078, 0x05C90071, 0x05CB0078, 0x05CC0071, 0x05CD0078, 0x05CF0071, - 0x05D00078, 0x05D10071, 0x05D20078, 0x05D40071, 0x05D50078, 0x05D70071, 0x05DD0078, 0x05DF00A7, - 0x05E10078, 0x05E300A7, 0x05E40078, 0x05E508A7, 0x05E60083, 0x05E70078, 0x05EB00A7, 0x05EC0078, - 0x05F3017E, 0x05F4017F, 0x05F50180, 0x05F60181, 0x05F70182, 0x05F80184, 0x05F90054, 0x05FC0008, - 0x05FD0078, 0x060000A7, 0x06020071, 0x06060078, 0x06070071, 0x06080078, 0x06090071, 0x06140078, - 0x06150071, 0x061D0078, 0x061F0083, 0x062000A7, 0x06220078, 0x06230083, 0x06240078, 0x06250083, - 0x06270078, 0x062A0083, 0x062B0078, 0x06300071, 0x06310078, 0x0633017E, 0x0634017F, 0x06350180, - 0x06360181, 0x06370182, 0x06380078, 0x064100A7, 0x06420071, 0x06460078, 0x06470071, 0x06480078, - 0x06490071, 0x06540078, 0x06550071, 0x065D0078, 0x065E0071, 0x065F00B2, 0x066000A7, 0x06620078, - 0x066308A7, 0x06640078, 0x066508A7, 0x06660083, 0x06670078, 0x066A00A7, 0x066B0078, 0x06700071, - 0x06710078, 0x0673017E, 0x0674017F, 0x06750180, 0x06760181, 0x06770182, 0x06780078, 0x068100A7, - 0x06820071, 0x06860078, 0x06870071, 0x06880078, 0x06890071, 0x06940078, 0x06950071, 0x069D0078, - 0x069F00A7, 0x06A00083, 0x06A20078, 0x06A300A7, 0x06A40078, 0x06A508A7, 0x06A60083, 0x06A70078, - 0x06AB00A7, 0x06AC0078, 0x06B00071, 0x06B10078, 0x06B3017E, 0x06B4017F, 0x06B50180, 0x06B60181, - 0x06B70182, 0x06B80078, 0x06C100A7, 0x06C20071, 0x06CB0078, 0x06CD0071, 0x06DF0078, 0x06E00071, - 0x06E30078, 0x06E700A7, 0x06E90083, 0x06EA0078, 0x06EC00A7, 0x06EE08A7, 0x06EF00A7, 0x06F00078, - 0x06F900A7, 0x06FA0078, 0x07000071, 0x07180083, 0x07191071, 0x071A0083, 0x071D0078, 0x071F0008, - 0x07200071, 0x07230083, 0x07270097, 0x0728017E, 0x0729017F, 0x072A0180, 0x072B0181, 0x072C0182, - 0x072D0097, 0x072E0078, 0x07400071, 0x07410078, 0x07430071, 0x07440078, 0x07460071, 0x07470078, - 0x074A0071, 0x07540078, 0x07550071, 0x07580083, 0x07591071, 0x075A0083, 0x075E0071, 0x075F0078, - 0x07600071, 0x07620078, 0x07640083, 0x07670078, 0x0768017E, 0x0769017F, 0x076A0180, 0x076B0181, - 0x076C0182, 0x076D0078, 0x076E1071, 0x076F0078, 0x07800094, 0x07820097, 0x07890094, 0x078C0083, - 0x078D0094, 0x0790017E, 0x0791017F, 0x07920180, 0x07930181, 0x07940182, 0x079500B3, 0x079A0083, - 0x079D00BF, 0x079F00A7, 0x07A00071, 0x07A10871, 0x07A20071, 0x07A60871, 0x07A70071, 0x07AB0871, - 0x07AC0071, 0x07B40871, 0x07B50078, 0x07B80083, 0x07B90883, 0x07BB1083, 0x07BD0083, 0x07BF00A7, - 0x07C00883, 0x07C10083, 0x07C20097, 0x07C30083, 0x07C40071, 0x07C60078, 0x07C80083, 0x07C90883, - 0x07CA0083, 0x07CE0883, 0x07CF0083, 0x07D30883, 0x07D40083, 0x07DC0883, 0x07DD0083, 0x07DE0078, - 0x07DF0094, 0x07E60078, 0x07E70094, 0x07E80097, 0x07E90078, 0x08000071, 0x08150078, 0x08160083, - 0x081800A7, 0x08190078, 0x081B0083, 0x081D0078, 0x0820017E, 0x0821017F, 0x08220180, 0x08230181, - 0x08240182, 0x08250097, 0x08280071, 0x082B00A7, 0x082C0083, 0x082D0078, 0x085000B5, 0x08630078, - 0x08680071, 0x087D0097, 0x087E0078, 0x08800071, 0x08AD0078, 0x08AF0071, 0x08D10078, 0x08D40071, - 0x08FD0078, 0x09000071, 0x09240078, 0x09250071, 0x09270078, 0x09280071, 0x092B0078, 0x092D0071, - 0x092F0078, 0x09300071, 0x09440078, 0x09450071, 0x09470078, 0x09480071, 0x09580078, 0x09590071, - 0x095B0078, 0x095C0071, 0x095F0078, 0x09610071, 0x09630078, 0x09640071, 0x096B0078, 0x096C0071, - 0x09880078, 0x09890071, 0x098B0078, 0x098C0071, 0x09AD0078, 0x09AF0083, 0x09B00097, 0x09B400AD, - 0x09B500AE, 0x09B6012D, 0x09B7012E, 0x09B8012F, 0x09B90185, 0x09BA0186, 0x09BB0187, 0x09BC0188, - 0x09BD0184, 0x09BE0078, 0x09C00071, 0x09C80054, 0x09CD0078, 0x09D00071, 0x09FA0078, 0x0A000071, - 0x0B360097, 0x0B370071, 0x0B3B0078, 0x0B400071, 0x0B4D00B4, 0x0B4E0078, 0x0B500071, 0x0B750097, - 0x0B770189, 0x0B780078, 0x0B800071, 0x0B860078, 0x0B870071, 0x0B890083, 0x0B8A0078, 0x0B900071, - 0x0B990083, 0x0B9A0097, 0x0B9B0078, 0x0BA00071, 0x0BA90083, 0x0BAA0078, 0x0BB00071, 0x0BB60078, - 0x0BB70071, 0x0BB80078, 0x0BB90083, 0x0BBA0078, 0x0BC00071, 0x0BDA00C2, 0x0BDB0083, 0x0BDF00A7, - 0x0BE40083, 0x0BEA0097, 0x0BEB0081, 0x0BEC0097, 0x0BED0008, 0x0BEE0083, 0x0BEF0078, 0x0BF0017E, - 0x0BF1017F, 0x0BF20180, 0x0BF30181, 0x0BF40182, 0x0BF50078, 0x0BF80106, 0x0BF90107, 0x0BFA0108, - 0x0BFB0109, 0x0BFC010A, 0x0BFD0078, 0x0C000006, 0x0C050083, 0x0C070078, 0x0C08017E, 0x0C09017F, - 0x0C0A0180, 0x0C0B0181, 0x0C0C0182, 0x0C0D0078, 0x0C100071, 0x0C210081, 0x0C220071, 0x0C3C0078, - 0x0C400071, 0x0C540083, 0x0C550078, 0x0C800071, 0x0C8E0078, 0x0C900083, 0x0C9100A7, 0x0C930083, - 0x0C9400C8, 0x0C960078, 0x0C9800A7, 0x0C9C0083, 0x0C9E0078, 0x0CA20006, 0x0CA3017E, 0x0CA4017F, - 0x0CA50180, 0x0CA60181, 0x0CA70182, 0x0CA80071, 0x0CB70078, 0x0CB80071, 0x0CBA0078, 0x0CC00071, - 0x0CD50078, 0x0CD800A7, 0x0CE00071, 0x0CE400A7, 0x0CE50078, 0x0CE8017E, 0x0CE9017F, 0x0CEA0180, - 0x0CEB0181, 0x0CEC0182, 0x0CED0078, 0x0CEF0006, 0x0CF00054, 0x0D000071, 0x0D0B0083, 0x0D0C00A7, - 0x0D0E0078, 0x0D0F0097, 0x0D100078, 0x0E800055, 0x0E967881, 0x0E970081, 0x0E987881, 0x0E9D0081, - 0x0E9E7881, 0x0EB17055, 0x0EB50055, 0x0ECD7881, 0x0EE00083, 0x0EE20078, 0x0F000865, 0x0F4B0855, - 0x0F4D098A, 0x0F4E0078, 0x0F500865, 0x0F7D0078, 0x0F8008C9, 0x0F8408CA, 0x0F8808C9, 0x0F8B0078, - 0x0F8C08CA, 0x0F8F0078, 0x0F9008C9, 0x0F9408CA, 0x0F9808C9, 0x0F9C08CA, 0x0FA008C9, 0x0FA30078, - 0x0FA408CA, 0x0FA70078, 0x0FA808C9, 0x0FAC08CA, 0x0FB008C9, 0x0FB408CA, 0x0FB808CB, 0x0FB908CC, - 0x0FBB08CD, 0x0FBC08CE, 0x0FBD08CF, 0x0FBE08D0, 0x0FBF0078, 0x0FC008C9, 0x0FC408D1, 0x0FC808C9, - 0x0FCC08D1, 0x0FD008C9, 0x0FD408D1, 0x0FD808C9, 0x0FD9098B, 0x0FDA0078, 0x0FDB0855, 0x0FDC08CA, - 0x0FDD08D2, 0x0FDE1037, 0x0FE00837, 0x0FE1098B, 0x0FE20078, 0x0FE30855, 0x0FE408D5, 0x0FE60837, - 0x0FE808C9, 0x0FE90855, 0x0FEA0078, 0x0FEB0855, 0x0FEC08CA, 0x0FED08D6, 0x0FEE0837, 0x0FF008C9, - 0x0FF10855, 0x0FF20890, 0x0FF30855, 0x0FF408CA, 0x0FF508D7, 0x0FF60837, 0x0FF80078, 0x0FF9098B, - 0x0FFA0078, 0x0FFB0855, 0x0FFC08D9, 0x0FFD08DA, 0x0FFE0837, 0x0FFF0078, 0x10000805, 0x10011005, - 0x10035805, 0x10041005, 0x10050057, 0x1007018C, 0x10085899, 0x10090099, 0x100B1006, 0x100C018D, - 0x100D00DB, 0x100E018D, 0x100F00DB, 0x10100006, 0x10121006, 0x10130006, 0x1014018E, 0x1015018F, - 0x10160190, 0x10175853, 0x10180007, 0x10191007, 0x101A0006, 0x101B1006, 0x101C0126, 0x101D0006, - 0x101F0038, 0x10200006, 0x10220009, 0x10231006, 0x10250006, 0x102B1006, 0x102C0006, 0x102F1005, - 0x10300057, 0x10320078, 0x10350057, 0x10387855, 0x10390078, 0x103A7910, 0x103B7911, 0x103C7912, - 0x103D780B, 0x103E7809, 0x103F7855, 0x1040705D, 0x1041705B, 0x10427110, 0x10437111, 0x10447112, - 0x1045700B, 0x10467009, 0x10470078, 0x10487081, 0x104A0078, 0x10500008, 0x105B0078, 0x10680083, - 0x106E0095, 0x10700083, 0x10710095, 0x10720083, 0x10760078, 0x10801054, 0x10831077, 0x10841054, - 0x10852877, 0x10872855, 0x10882877, 0x10892855, 0x108A2877, 0x108B0054, 0x108C2877, 0x108F0054, - 0x10901054, 0x10910054, 0x10950991, 0x10962877, 0x10972855, 0x10982877, 0x109A1071, 0x109C2855, - 0x109D1054, 0x109E2855, 0x109F2877, 0x10A00019, 0x10A22877, 0x10A32855, 0x10A50019, 0x10A60078, - 0x10A9305F, 0x10AF3106, 0x10B01192, 0x10B11193, 0x10B21194, 0x10B31195, 0x10B41196, 0x10B51197, - 0x10B61198, 0x10B71199, 0x10B8119A, 0x10B9119B, 0x10BA119C, 0x10BB119D, 0x10BC119E, 0x10BD119F, - 0x10BE11A0, 0x10BF11A1, 0x10C001A2, 0x10C101A3, 0x10C20078, 0x10C80019, 0x10CA0054, 0x10CD0819, - 0x10CE0054, 0x10D10019, 0x10D20054, 0x10E60854, 0x10E70819, 0x10E80054, 0x10FA0019, 0x110000E8, - 0x11020019, 0x110408FB, 0x110500FC, 0x11070019, 0x110800E8, 0x11090059, 0x110A01A4, 0x110B0019, - 0x110D00E8, 0x11110019, 0x111500E8, 0x111610E8, 0x111800E8, 0x111A0019, 0x111C00E8, 0x111E00FE, - 0x111F00E8, 0x112008E8, 0x112101A5, 0x112200E8, 0x112308E8, 0x112500E8, 0x11260019, 0x112900FE, - 0x112B0019, 0x112F00E8, 0x11300019, 0x113200FE, 0x11360819, 0x113708FE, 0x113900FE, 0x113A08FE, - 0x113B00FE, 0x113C08FE, 0x113D00FE, 0x114008FE, 0x114100FE, 0x114208FE, 0x114300FE, 0x114408FE, - 0x114500FE, 0x11460019, 0x114700FD, 0x11490019, 0x115100FE, 0x11520019, 0x115300E8, 0x115401A6, - 0x115608E8, 0x115800FE, 0x115C0019, 0x115F00E8, 0x11600019, 0x116400FD, 0x116601A7, 0x11670019, - 0x116800FE, 0x11690019, 0x116B00FE, 0x117008FE, 0x117200FE, 0x117508FE, 0x11770019, 0x117800FE, - 0x11790102, 0x117A00E8, 0x117B0103, 0x117C00E8, 0x117D0104, 0x117E0105, 0x117F00E8, 0x11800054, - 0x118400FE, 0x11860054, 0x119000E8, 0x11910054, 0x11940809, 0x11950054, 0x119B0094, 0x11BD0054, - 0x11CA0094, 0x11CB0054, 0x11CD0019, 0x11DA00BF, 0x11DB0054, 0x11EE0078, 0x12000054, 0x12130078, - 0x12200054, 0x12250078, 0x123018C4, 0x123118C5, 0x123218C6, 0x123318C7, 0x1234191F, 0x1235191A, - 0x1236191B, 0x1237191C, 0x1238191D, 0x1239191E, 0x123A10C4, 0x123B10C5, 0x123C10C6, 0x123D10C7, - 0x123E111F, 0x123F111A, 0x1240111B, 0x1241111C, 0x1242111D, 0x1243111E, 0x1244105A, 0x124510E3, - 0x124610E4, 0x124710E5, 0x124811A8, 0x124911A9, 0x124A11AA, 0x124B11AB, 0x124C11AC, 0x124D11AD, - 0x124E1094, 0x125B1918, 0x12681919, 0x1275010B, 0x1276010C, 0x1277010D, 0x1278010E, 0x1279010F, - 0x127A0106, 0x127B0107, 0x127C0108, 0x127D0109, 0x127E010A, 0x127F00C3, 0x12800054, 0x12DB0019, - 0x12DC0054, 0x12E00019, 0x12E10054, 0x12FC0019, 0x13000054, 0x13370019, 0x13380054, 0x134E0078, - 0x13500054, 0x13590078, 0x13800054, 0x13820078, 0x13830054, 0x13850078, 0x13860054, 0x13A90078, - 0x13AC0054, 0x13AF0078, 0x13B00054, 0x13B4000A, 0x13BB00C4, 0x13BC00C5, 0x13BD00C6, 0x13BE00C7, - 0x13BF011F, 0x13C000C4, 0x13C100C5, 0x13C200C6, 0x13C300C7, 0x13C4011F, 0x13C500C4, 0x13C600C5, - 0x13C700C6, 0x13C800C7, 0x13C9011F, 0x13CA0078, 0x13CC0054, 0x13DF0078, 0x13E00019, 0x13E100FD, - 0x13E20009, 0x13E30078, 0x13E80019, 0x13E900E8, 0x13EA00FD, 0x13EB0019, 0x13EE00FD, 0x13EF0019, - 0x13F100FE, 0x13F3000A, 0x13F60078, 0x13F80019, 0x14000094, 0x14800019, 0x14C10009, 0x14C601AE, - 0x14C701AF, 0x14C80009, 0x14CC0019, 0x14CD00E8, 0x14D80019, 0x14E000FE, 0x14E100E8, 0x14E200FE, - 0x14E30019, 0x14E400E8, 0x14E50019, 0x14E700FD, 0x14E90019, 0x14EA00FE, 0x14EB0019, 0x14EC000A, - 0x14EE0019, 0x14F000E8, 0x14F30019, 0x14F400E8, 0x14F50019, 0x14FA01B0, 0x14FB00E8, 0x14FC00FE, - 0x14FD0019, 0x14FE000A, 0x14FF0019, 0x150500E8, 0x150E0019, 0x150F00E8, 0x15110019, 0x151400E8, - 0x151500FD, 0x15170019, 0x151A00FE, 0x151B0019, 0x151E00FE, 0x151F0019, 0x152B00E8, 0x152C0019, - 0x153200FE, 0x15330019, 0x153500E8, 0x15380019, 0x153900E8, 0x153A1019, 0x153B0019, 0x153C00FD, - 0x153D00E8, 0x153E00FD, 0x154200E8, 0x154500FD, 0x154600E8, 0x154800FD, 0x154E00E8, 0x155000FD, - 0x155100E8, 0x15520019, 0x155300FE, 0x155700FD, 0x155800E8, 0x155900FD, 0x155A00E8, 0x155D00FD, - 0x156300E8, 0x156600FD, 0x156B0019, 0x157101B1, 0x15730019, 0x157600FE, 0x15770019, 0x157900E8, - 0x157A0019, 0x157B00FD, 0x157D00E8, 0x157F0019, 0x15800054, 0x158A0078, 0x16000096, 0x16170078, - 0x16180098, 0x162F0078, 0x16400065, 0x16720054, 0x16750078, 0x167C0006, 0x167E005F, 0x167F0006, - 0x16800125, 0x16930078, 0x16980071, 0x16B30078, 0x16B77881, 0x16B80078, 0x16C00071, 0x16CB0078, - 0x16D00071, 0x16D30078, 0x16D40071, 0x16D70078, 0x16D80071, 0x16DB0078, 0x16DC0071, 0x16DF0078, - 0x16E00071, 0x16E30078, 0x16E40071, 0x16E70078, 0x16E80071, 0x16EB0078, 0x16EC0071, 0x16EF0078, - 0x17000006, 0x170100E0, 0x17030006, 0x17040126, 0x17050006, 0x170600E0, 0x17070006, 0x170B0099, - 0x170C0078, 0x170E00E0, 0x170F0078, 0x17400054, 0x174F1054, 0x17500054, 0x17791054, 0x177A0078, - 0x17801054, 0x17EB0078, 0x17F80054, 0x17FE0078, 0x18000006, 0x18020081, 0x180301B2, 0x1804000A, - 0x18090054, 0x180A000A, 0x180E00B4, 0x180F00BF, 0x181001B3, 0x181101B4, 0x181201B5, 0x181301B6, - 0x181401B7, 0x18150083, 0x18180081, 0x181B0054, 0x181C11B8, 0x181D0081, 0x181E0006, 0x181F0054, - 0x18200071, 0x18320871, 0x18350071, 0x18380871, 0x183A0071, 0x183B0871, 0x183D0071, 0x183E0871, - 0x183F0071, 0x184B0078, 0x184C0083, 0x184D1037, 0x184E0081, 0x184F8071, 0x18500071, 0x18620871, - 0x18650071, 0x18680871, 0x186A0071, 0x186B0871, 0x186D0071, 0x186E0871, 0x186F0071, 0x187B0871, - 0x187D0006, 0x187E0081, 0x187F8071, 0x18800078, 0x18820071, 0x18960078, 0x18981071, 0x18C70078, - 0x18C80094, 0x18C978B6, 0x18CA78B7, 0x18CB7894, 0x18D00071, 0x18DC0078, 0x18E00054, 0x18E80078, - 0x18F80071, 0x19001094, 0x190E1054, 0x190F0078, 0x191010B6, 0x191110B7, 0x191210B8, 0x191310B9, - 0x191410B0, 0x19151094, 0x19220078, 0x192819B9, 0x192919BA, 0x192A19BB, 0x192B19BC, 0x192C19BD, - 0x192D19BE, 0x192E19BF, 0x192F19C0, 0x19301894, 0x193E1854, 0x193F0094, 0x194018B6, 0x194118B7, - 0x194218B8, 0x194318B9, 0x194418B0, 0x19451894, 0x195819C1, 0x195919C2, 0x195A19C3, 0x195B19C4, - 0x195C19C5, 0x195D19C6, 0x195E19C7, 0x195F19C8, 0x19601094, 0x19666854, 0x19681894, 0x197F0078, - 0x19806894, 0x19AC1094, 0x19B86894, 0x19BB6854, 0x19BD6894, 0x19EF6854, 0x19F01094, 0x19FF6854, - 0x1A000071, 0x26DB0078, 0x26E00054, 0x27000071, 0x4FDE0078, 0x50000071, 0x500A0081, 0x500B0071, - 0x52460078, 0x52480054, 0x52630078, 0x53800037, 0x538B0078, 0x54000071, 0x54050083, 0x54060071, - 0x541100A7, 0x54120083, 0x541300A7, 0x54140054, 0x54160078, 0x56000071, 0x6BD20078, 0x6C00013E, - 0x7000013F, 0x7C800871, 0x7D070071, 0x7D0A0871, 0x7D0F0071, 0x7D120871, 0x7D130071, 0x7D150871, - 0x7D170078, 0x7D180871, 0x7D350078, 0x7D380871, 0x7D6D0078, 0x7D801055, 0x7D830078, 0x7D891055, - 0x7D8C0078, 0x7D8E089B, 0x7D90289B, 0x7D94280B, 0x7D95089B, 0x7D9B0078, 0x7D9C089B, 0x7D9E0078, - 0x7DA0089B, 0x7DA20078, 0x7DA3089B, 0x7DA7109B, 0x7DA8209E, 0x7DAA489E, 0x7DAB209E, 0x7DAC489E, - 0x7DAD209E, 0x7DAE489E, 0x7DAF209E, 0x7DB0489E, 0x7DB1209E, 0x7DB2489E, 0x7DB3209E, 0x7DB4489E, - 0x7DB5209E, 0x7DB6489E, 0x7DB7209E, 0x7DB8489E, 0x7DB9209E, 0x7DBA489E, 0x7DBB209E, 0x7DBC489E, - 0x7DBD209E, 0x7DBE489E, 0x7DBF209E, 0x7DC0489E, 0x7DC1209E, 0x7DC8489E, 0x7DC9209E, 0x7DCA489E, - 0x7DCB209E, 0x7DCC489E, 0x7DCD209E, 0x7DCE489E, 0x7DCF209E, 0x7DD1489E, 0x7DD2209E, 0x7DD4489E, - 0x7DD5209E, 0x7DD6489E, 0x7DD7209E, 0x7DD90078, 0x7DE9409E, 0x7DEA389E, 0x7DEB409E, 0x7DEF209E, - 0x7DF3489E, 0x7DF5209E, 0x7DFC409E, 0x7DFD389E, 0x7DFE209E, 0x7DFF489E, 0x7E00409E, 0x7E32209E, - 0x7E4B389E, 0x7E6F489E, 0x7E7A409E, 0x7E88209E, 0x7E96389E, 0x7E9A489E, 0x7E9E409E, 0x7E9F00BF, - 0x7EA00078, 0x7EA8209E, 0x7EA9389E, 0x7EAD209E, 0x7EAE389E, 0x7EAF209E, 0x7EB0389E, 0x7EB3209E, - 0x7EB5389E, 0x7EB7209E, 0x7EB9389E, 0x7EBA209E, 0x7EBB389E, 0x7EBC209E, 0x7EBE389E, 0x7EBF209E, - 0x7EC1389E, 0x7EC2209E, 0x7EC4389E, 0x7EC5209E, 0x7EC6389E, 0x7EC80078, 0x7EC9389E, 0x7ECB209E, - 0x7ECE389E, 0x7ECF209E, 0x7EDA389E, 0x7EDB209E, 0x7EE1389E, 0x7EE3209E, 0x7EE40078, 0x7EF8409E, - 0x7EFE0054, 0x7EFF0078, 0x7F000083, 0x7F088006, 0x7F0B80B4, 0x7F0C8006, 0x7F0D0078, 0x7F100083, - 0x7F120078, 0x7F188099, 0x7F198038, 0x7F1A80B4, 0x7F220006, 0x7F2380B4, 0x7F241006, 0x7F261038, - 0x7F286006, 0x7F290078, 0x7F2A600C, 0x7F2B6006, 0x7F2C60B4, 0x7F2F6007, 0x7F306006, 0x7F31600D, - 0x7F326019, 0x7F330078, 0x7F346008, 0x7F356006, 0x7F360078, 0x7F38489E, 0x7F39009E, 0x7F3A0078, - 0x7F3B489E, 0x7F40409E, 0x7F45389E, 0x7F46409E, 0x7F48389E, 0x7F49409E, 0x7F4B389E, 0x7F4C409E, - 0x7F4D389E, 0x7F4E409E, 0x7F4F389E, 0x7F50409E, 0x7F51389E, 0x7F52409E, 0x7F53389E, 0x7F54409E, - 0x7F59389E, 0x7F5A409E, 0x7F5B389E, 0x7F5C409E, 0x7F5D389E, 0x7F5E409E, 0x7F5F389E, 0x7F60409E, - 0x7F61389E, 0x7F62409E, 0x7F63389E, 0x7F64409E, 0x7F65389E, 0x7F66409E, 0x7F67389E, 0x7F68409E, - 0x7F69389E, 0x7F6A409E, 0x7F6B389E, 0x7F6C409E, 0x7F6D389E, 0x7F6E409E, 0x7F6F389E, 0x7F70409E, - 0x7F71389E, 0x7F72409E, 0x7F73389E, 0x7F74409E, 0x7F75389E, 0x7F76409E, 0x7F79389E, 0x7F7A409E, - 0x7F7E0078, 0x7F7F0057, 0x7F808806, 0x7F818807, 0x7F838806, 0x7F84880A, 0x7F85880B, 0x7F86880D, - 0x7F87880C, 0x7F88880F, 0x7F898811, 0x7F8A8813, 0x7F8B8815, 0x7F8C8817, 0x7F8D8806, 0x7F8E8819, - 0x7F8F8806, 0x7F908860, 0x7F9D8835, 0x7F9E8836, 0x7F9F8838, 0x7FA08861, 0x7FAD8835, 0x7FAE8836, - 0x7FAF8809, 0x7FB05006, 0x7FB1500A, 0x7FB25006, 0x7FB35071, 0x7FCF5081, 0x7FD05071, 0x7FDF0078, - 0x7FE15071, 0x7FE40078, 0x7FE55071, 0x7FE80078, 0x7FE95071, 0x7FEC0078, 0x7FED5071, 0x7FEE0078, - 0x7FF08808, 0x7FF18837, 0x7FF28808, 0x7FF30078, 0x7FF45019, 0x7FF65054, 0x7FF70078, 0x7FFC0141, - 0x7FFE0054, 0x7FFF0078, 0x80000071, 0x80130078, 0x80140071, 0x801D0078, 0x801E0071, 0x80270078, - 0x80280071, 0x802F0078, 0x80400071, 0x807D0078, 0x80800006, 0x80810078, 0x808300AD, 0x808400AE, - 0x8085012D, 0x8086012E, 0x8087012F, 0x80880185, 0x80890186, 0x808A0187, 0x808B0188, 0x808C0184, - 0x808D01C9, 0x808E01CA, 0x808F01CB, 0x809001CC, 0x809101CD, 0x809201CE, 0x809301CF, 0x809401D0, - 0x809500BE, 0x809601D1, 0x809701D2, 0x809801D3, 0x809901D4, 0x809A0078, 0x809B0094, 0x80A0014E, - 0x80A10152, 0x80A20153, 0x80A30157, 0x80A40154, 0x80A50155, 0x80A60156, 0x80A70152, 0x80A80150, - 0x80A90153, 0x80AA01D5, 0x80AB0154, 0x80AC014F, 0x80AD0158, 0x80AF0152, 0x80B00154, 0x80B201D6, - 0x80B30150, 0x80B501D7, 0x80B60153, 0x80B80156, 0x80B90152, 0x80BA005F, 0x80BC0054, 0x80C50078, - 0x81800071, 0x818F0078, 0x8190012D, 0x819100BB, 0x81920078, 0x81980071, 0x81A50078, 0x81C00071, - 0x81CF0097, 0x81D00071, 0x81E20078, 0x81E40071, 0x81E8014F, 0x81E90154, 0x81EA0155, 0x81EB0078, - 0x8200015B, 0x8214015C, 0x82280071, 0x824F0078, 0x8250017E, 0x8251017F, 0x82520180, 0x82530181, - 0x82540182, 0x82550078, 0x8400009B, 0x84030078, 0x8405009B, 0x841C0078, 0x841F009B, 0x84200078, - 0x85000083, 0x85030078, 0x85060083, 0x8508009B, 0x851A0078, 0x851C0083, 0x851D0078, 0x851F0083, - 0x852001D8, 0x852101D9, 0x852201DA, 0x852301DB, 0x85240078, 0x8528009A, 0x852C0078, 0xE8000094, - 0xE87B0078, 0xE8800094, 0xE8930078, 0xE8950094, 0xE8AF0894, 0xE8B200A7, 0xE8B30083, 0xE8B50094, - 0xE8B600A7, 0xE8B90057, 0xE8BD0083, 0xE8C10094, 0xE8C20083, 0xE8C60094, 0xE8D50083, 0xE8D70094, - 0xE8DD0894, 0xE8E00094, 0xE8EF0078, 0xE9000054, 0xE9210083, 0xE9220054, 0xE9230078, 0xE9800054, - 0xE9AB0078, 0xEA002877, 0xEA0D2855, 0xEA1A2877, 0xEA272855, 0xEA2A0078, 0xEA2B2855, 0xEA342877, - 0xEA412855, 0xEA4E0078, 0xEA4F2877, 0xEA500078, 0xEA522877, 0xEA530078, 0xEA542877, 0xEA560078, - 0xEA572877, 0xEA5B2855, 0xEA682877, 0xEA752855, 0xEA822877, 0xEA850078, 0xEA862877, 0xEA8A0078, - 0xEA8B2877, 0xEA8E0078, 0xEA8F2855, 0xEA9C2877, 0xEA9F0078, 0xEAA02877, 0xEAA20078, 0xEAA52877, - 0xEAA80078, 0xEAA92855, 0xEAB62877, 0xEAC32855, 0xEAD02877, 0xEADD2855, 0xEAEA2877, 0xEAF72855, - 0xEB042877, 0xEB112855, 0xEB1E2877, 0xEB2B2855, 0xEB382877, 0xEB452855, 0xEB530078, 0xEB542877, - 0xEB6029DC, 0xEB612855, 0xEB6D29DC, 0xEB6E2855, 0xEB712877, 0xEB7D29DC, 0xEB7E2855, 0xEB8A29DC, - 0xEB8B2855, 0xEB8E2877, 0xEB9A29DC, 0xEB9B2855, 0xEBA729DC, 0xEBA82855, 0xEBAB2877, 0xEBB729DC, - 0xEBB82855, 0xEBC429DC, 0xEBC52855, 0xEBC82877, 0xEBD429DC, 0xEBD52855, 0xEBE129DC, 0xEBE22855, - 0xEBE50078, 0xEBE7280F, 0xEBE82811, 0xEBE92813, 0xEBEA2815, 0xEBEB2817, 0xEBEC280F, 0xEBED2811, - 0xEBEE2813, 0xEBEF2815, 0xEBF02817, 0xEBF1280F, 0xEBF22811, 0xEBF32813, 0xEBF42815, 0xEBF52817, - 0xEBF6280F, 0xEBF72811, 0xEBF82813, 0xEBF92815, 0xEBFA2817, 0xEBFB280F, 0xEBFC2811, 0xEBFD2813, - 0xEBFE2815, 0xEBFF2817, 0xEC000078 - }; - - static const uint32_t a17[] = { - 0x00000071, 0x536B0078, 0x7C000871, 0x7D0F0078 - }; - - static const uint32_t a23[] = { - 0x00000057, 0x00010078, 0x00100057, 0x00400078, 0x00800083, 0x00F80078, 0x8000013F, 0xFFFF0078 - }; - - static const uint32_t a24[] = { - 0x0000013F, 0x7FFF0078 - }; - - - // The full set of all arrays to be searched. - static const Range FULL_DATA[] = { - {sizeof(a0)/sizeof(uint32_t), a0}, - {sizeof(a1)/sizeof(uint32_t), a1}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {sizeof(a7)/sizeof(uint32_t), a7}, - {sizeof(a8)/sizeof(uint32_t), a8}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {sizeof(a16)/sizeof(uint32_t), a16}, - {sizeof(a17)/sizeof(uint32_t), a17}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {sizeof(a23)/sizeof(uint32_t), a23}, - {sizeof(a24)/sizeof(uint32_t), a24}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0} - }; - - // Array of uppercase differences - static const short UCDIFF[] = { - 0, -32, 743, 121, -1, -232, -300, 97, - 163, 130, 56, -2, -79, -210, -206, -205, - -202, -203, -207, -209, -211, -213, -214, -218, - -217, -219, -83, 84, -38, -37, -31, -64, - -63, -62, -57, -47, -54, -86, -80, 7, - -96, -48, -59, 8, 74, 86, 100, 128, - 112, 126, 9, -7205, -16, -26, -7264, -40 - }; - - // Array of lowercase differences - static const short LCDIFF[] = { - 0, 32, 1, -199, -121, 210, 206, 205, - 79, 202, 203, 207, 211, 209, 213, 214, - 218, 217, 219, 2, -97, -56, -130, -163, - 83, 38, 37, 64, 63, -60, -7, 80, - 48, 7264, -8, -74, -9, -86, -100, -112, - -128, -126, -7517, -8383, -8262, 16, 26, 40 - }; - - // Array of titlecase differences - static const short TCDIFF[] = { - 3, 1, 0, -1 - }; - - // Array of mirrored character differences - static const short MIRROR_DIFF[] = { - 0, 1, -1, 2, -2, 16, -16, 3, - -3, 2016, 138, 1824, 2104, 2108, 2106, -138, - 8, 7, -8, -7, -1824, -2016, -2104, -2106, - -2108 - }; - - // Array of all possible numeric values - static const int NUMERICS[] = { - -1, 0, 1, 2, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, -2, 100, 1000, - 40, 50, 60, 70, 80, 90, 10000, 500, - 5000, 36, 37, 38, 39, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 200, 300, - 400, 600, 700, 800, 900, 2000, 3000, 4000, - 6000, 7000, 8000, 9000, 20000, 30000, 40000, 50000, - 60000, 70000, 80000, 90000 - }; - - // All possible packed data values, no duplicates - static const uint32_t PACKED_DATA[] = { - 0x00000000, 0x0000012F, 0x0000016F, 0x0000014F, 0x0000018F, 0x0000018C, 0x000001B8, 0x000000B8, - 0x000000BA, 0x020005B5, 0x040005B6, 0x00000099, 0x000000F8, 0x00000094, 0x02000069, 0x04000069, - 0x06000069, 0x08000069, 0x0A000069, 0x0C000069, 0x0E000069, 0x10000069, 0x12000069, 0x14000069, - 0x060005B9, 0x000001B9, 0x080005B9, 0x16020001, 0x18020001, 0x1A020001, 0x1C020001, 0x1E020001, - 0x20020001, 0x22020001, 0x24020001, 0x26020001, 0x28020001, 0x2A020001, 0x2C020001, 0x2E020001, - 0x30020001, 0x32020001, 0x34020001, 0x36020001, 0x38020001, 0x3A020001, 0x3C020001, 0x3E020001, - 0x40020001, 0x42020001, 0x44020001, 0x46020001, 0x48020001, 0x060005B5, 0x080005B6, 0x000001BB, - 0x000001B7, 0x16000802, 0x18000802, 0x1A000802, 0x1C000802, 0x1E000802, 0x20000802, 0x22000802, - 0x24000802, 0x26000802, 0x28000802, 0x2A000802, 0x2C000802, 0x2E000802, 0x30000802, 0x32000802, - 0x34000802, 0x36000802, 0x38000802, 0x3A000802, 0x3C000802, 0x3E000802, 0x40000802, 0x42000802, - 0x44000802, 0x46000802, 0x48000802, 0x000000EC, 0x000001BC, 0x00000002, 0x0A0005BD, 0x00000130, - 0x000000BC, 0x000000B9, 0x0600006B, 0x0800006B, 0x00001002, 0x0400006B, 0x0C0005BE, 0x4A0001AB, - 0x00020001, 0x00000802, 0x00001802, 0x00040001, 0x00060001, 0x00002002, 0x00080001, 0x000C0001, - 0x000E0001, 0x00100001, 0x00140001, 0x00160001, 0x00180001, 0x00004002, 0x00004802, 0x00200001, - 0x00220001, 0x00000005, 0x00A60001, 0x01805802, 0x01042003, 0x00280001, 0x002C0001, 0x00000001, - 0x00000000, 0x00007002, 0x00007802, 0x00009802, 0x0000A802, 0x0000B802, 0x0000C002, 0x0000C802, - 0x0000D002, 0x00000004, 0x000001A4, 0x00000106, 0x00320001, 0x00340001, 0x00360001, 0x00380001, - 0x0000E002, 0x0000E802, 0x0000F002, 0x0000F802, 0x00010002, 0x00010802, 0x00012002, 0x00012802, - 0x00013802, 0x003A0001, 0x003E0001, 0x00013002, 0x0000001C, 0x00000107, 0x00400001, 0x00000018, - 0x00014802, 0x000001B4, 0x00000038, 0x00000025, 0x00000050, 0x00000058, 0x00000045, 0x00000044, - 0x020000C9, 0x060000C9, 0x0A0000C9, 0x0E0000C9, 0x120000C9, 0x000000D8, 0x0000005C, 0x00000008, - 0x02000009, 0x06000009, 0x0A000009, 0x0E000009, 0x12000009, 0x0400000B, 0x0800000B, 0x0000000B, - 0x1600000B, 0x4E00000B, 0x00000006, 0x4A00000B, 0x000001B5, 0x00420001, 0x0600000B, 0x0A00000B, - 0x0E00000B, 0x1200000B, 0x3E00000B, 0x5200000B, 0x5600000B, 0x5A00000B, 0x5C00000B, 0x000001B6, - 0x2400000A, 0x2800000A, 0x00000010, 0x020001AB, 0x060001AB, 0x0A0001AB, 0x0E0001AB, 0x120001AB, - 0x00000108, 0x00015802, 0x00440001, 0x00016002, 0x00016802, 0x00017002, 0x00017802, 0x00018002, - 0x00018802, 0x00440003, 0x00460001, 0x00480003, 0x00019802, 0x004A0001, 0x004C0001, 0x004E0001, - 0x003C0001, 0x00500001, 0x00520001, 0x000001BD, 0x0000018D, 0x000001D0, 0x00000250, 0x00000230, - 0x040005BE, 0x000000F9, 0x0200006B, 0x0A00006B, 0x0E00006B, 0x1200006B, 0x00540001, 0x00560001, - 0x000005B9, 0x045A000A, 0x085A000A, 0x0C5A000A, 0x105A000A, 0x145A000A, 0x185A000A, 0x525A000A, - 0x5E5A000A, 0x0401A00A, 0x0801A00A, 0x0C01A00A, 0x1001A00A, 0x1401A00A, 0x1801A00A, 0x5201A00A, - 0x5E01A00A, 0x4E00000A, 0x5C00000A, 0x0E0005B9, 0x100005B9, 0x020005B9, 0x040005B9, 0x160005B9, - 0x180005B9, 0x1A0005B9, 0x200005B9, 0x220005B9, 0x240005B9, 0x260005B9, 0x040001AB, 0x080001AB, - 0x0C0001AB, 0x100001AB, 0x140001AB, 0x180001AB, 0x1C0001AB, 0x200001AB, 0x240001AB, 0x280001AB, - 0x0C00006B, 0x1000006B, 0x1400006B, 0x1800006B, 0x1C00006B, 0x2000006B, 0x2400006B, 0x2800006B, - 0x005C001C, 0x0001A81C, 0x1A0001AB, 0x1E0001AB, 0x220001AB, 0x260001AB, 0x2A0001AB, 0x160001AB, - 0x020005B6, 0x100005B6, 0x280005B9, 0x2C0005B9, 0x300005B9, 0x0001B002, 0x020005BD, 0x0600000A, - 0x0A00000A, 0x0E00000A, 0x1200000A, 0x1600000A, 0x3E00000A, 0x0C00000B, 0x1000000B, 0x1400000B, - 0x2E0001AB, 0x320001AB, 0x360001AB, 0x3A0001AB, 0x3E0001AB, 0x420001AB, 0x460001AB, 0x640001AB, - 0x680001AB, 0x6A0001AB, 0x6E0001AB, 0x720001AB, 0x760001AB, 0x7A0001AB, 0x00000013, 0x00000012, - 0x0000005A, 0x000001B0, 0x7C00000B, 0x8000000B, 0x8200000B, 0x8600000B, 0x8C00000B, 0x6000000B, - 0x9200000B, 0x9600000B, 0x9800000B, 0x9C00000B, 0xA000000B, 0xA400000B, 0x4A0001AA, 0x040001AA, - 0x520001AA, 0x600001AA, 0x0C0001AA, 0x5E0001AA, 0x160001AA, 0x4C0001AA, 0x4E0001AA, 0x9E0001AA, - 0x060001AA, 0x8800000A, 0x2A0001AA, 0x005E0001, 0x0001B802, 0x0400002B, 0x0800002B, 0x1600002B, - 0x4C00002B, 0x00002802, 0x00003002, 0x000A0001, 0x00120001, 0x00003802, 0x001A0001, 0x001C0001, - 0x001E0001, 0x00240001, 0x00005002, 0x00006002, 0x002A0001, 0x002E0001, 0x00300001, 0x00006802, - 0x00008002, 0x00008802, 0x00009002, 0x0000A002, 0x0000B002, 0x0000D906, 0x00011002, 0x00011802, - 0x00014002, 0x040000C9, 0x080000C9, 0x0C0000C9, 0x100000C9, 0x140000C9, 0x04000009, 0x08000009, - 0x0C000009, 0x10000009, 0x14000009, 0x2200000B, 0x4C00000B, 0x2A00000B, 0x5000000B, 0x5400000B, - 0x5800000B, 0x2600000A, 0x00015002, 0x00019002, 0x00000030, 0x000001BE, 0x0000014E, 0x00000210, - 0x000001F0, 0x00580001, 0x065A000A, 0x0A5A000A, 0x0E5A000A, 0x125A000A, 0x165A000A, 0x1A5A000A, - 0x4C5A000A, 0x4E5A000A, 0x0601A00A, 0x0A01A00A, 0x0E01A00A, 0x1201A00A, 0x1601A00A, 0x1A01A00A, - 0x4C01A00A, 0x4E01A00A, 0x6000000A, 0x0000000A, 0x120005B9, 0x140005B9, 0x1C0005B9, 0x1E0005B9, - 0x1600006B, 0x1A00006B, 0x1E00006B, 0x2200006B, 0x2600006B, 0x2A00006B, 0x0E0005B5, 0x040005B5, - 0x2A0005B9, 0x2E0005B9, 0x0200000A, 0x0400000A, 0x0800000A, 0x0C00000A, 0x1000000A, 0x1400000A, - 0x2A00000A, 0x2C0001AB, 0x300001AB, 0x340001AB, 0x380001AB, 0x3C0001AB, 0x400001AB, 0x440001AB, - 0x480001AB, 0x620001AB, 0x660001AB, 0x500001AB, 0x6C0001AB, 0x700001AB, 0x740001AB, 0x780001AB, - 0x520001AB, 0x7E00000B, 0x5E00000B, 0x8400000B, 0x8800000B, 0x8A00000B, 0x8E00000B, 0x9000000B, - 0x9400000B, 0x9A00000B, 0x9E00000B, 0xA200000B, 0xA600000B, 0x5C0001AA, 0x3E0001AA, 0x7E0001AA, - 0x0600002B, 0x0A00002B, 0x2A00002B, 0x4E00002B, 0x00000019 - }; -} diff --git a/libs/utils/Unicode.cpp b/libs/utils/Unicode.cpp deleted file mode 100644 index f92703e..0000000 --- a/libs/utils/Unicode.cpp +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -#include <utils/AndroidUnicode.h> -#include "CharacterData.h" - -#define LOG_TAG "Unicode" -#include <utils/Log.h> - -// ICU headers for using macros -#include <unicode/utf16.h> - -#define MIN_RADIX 2 -#define MAX_RADIX 36 - -#define TYPE_SHIFT 0 -#define TYPE_MASK ((1<<5)-1) - -#define DIRECTION_SHIFT (TYPE_SHIFT+5) -#define DIRECTION_MASK ((1<<5)-1) - -#define MIRRORED_SHIFT (DIRECTION_SHIFT+5) -#define MIRRORED_MASK ((1<<1)-1) - -#define TOUPPER_SHIFT (MIRRORED_SHIFT+1) -#define TOUPPER_MASK ((1<<6)-1) - -#define TOLOWER_SHIFT (TOUPPER_SHIFT+6) -#define TOLOWER_MASK ((1<<6)-1) - -#define TOTITLE_SHIFT (TOLOWER_SHIFT+6) -#define TOTITLE_MASK ((1<<2)-1) - -#define MIRROR_SHIFT (TOTITLE_SHIFT+2) -#define MIRROR_MASK ((1<<5)-1) - -#define NUMERIC_SHIFT (TOTITLE_SHIFT+2) -#define NUMERIC_MASK ((1<<7)-1) - -#define DECOMPOSITION_SHIFT (11) -#define DECOMPOSITION_MASK ((1<<5)-1) - -/* - * Returns the value stored in the CharacterData tables that contains - * an index into the packed data table and the decomposition type. - */ -static uint16_t findCharacterValue(UChar32 c) -{ - LOG_ASSERT(c >= 0 && c <= 0x10FFFF, "findCharacterValue received an invalid codepoint"); - if (c < 256) - return CharacterData::LATIN1_DATA[c]; - - // Rotate the bits because the tables are separated into even and odd codepoints - c = (c >> 1) | ((c & 1) << 20); - - CharacterData::Range search = CharacterData::FULL_DATA[c >> 16]; - const uint32_t* array = search.array; - - // This trick is so that that compare in the while loop does not - // need to shift the array entry down by 16 - c <<= 16; - c |= 0xFFFF; - - int high = (int)search.length - 1; - int low = 0; - - if (high < 0) - return 0; - - while (low < high - 1) - { - int probe = (high + low) >> 1; - - // The entries contain the codepoint in the high 16 bits and the index - // into PACKED_DATA in the low 16. - if (array[probe] > (unsigned)c) - high = probe; - else - low = probe; - } - - LOG_ASSERT((array[low] <= (unsigned)c), "A suitable range was not found"); - return array[low] & 0xFFFF; -} - -uint32_t android::Unicode::getPackedData(UChar32 c) -{ - // findCharacterValue returns a 16-bit value with the top 5 bits containing a decomposition type - // and the remaining bits containing an index. - return CharacterData::PACKED_DATA[findCharacterValue(c) & 0x7FF]; -} - -android::Unicode::CharType android::Unicode::getType(UChar32 c) -{ - if (c < 0 || c >= 0x10FFFF) - return CHARTYPE_UNASSIGNED; - return (CharType)((getPackedData(c) >> TYPE_SHIFT) & TYPE_MASK); -} - -android::Unicode::DecompositionType android::Unicode::getDecompositionType(UChar32 c) -{ - // findCharacterValue returns a 16-bit value with the top 5 bits containing a decomposition type - // and the remaining bits containing an index. - return (DecompositionType)((findCharacterValue(c) >> DECOMPOSITION_SHIFT) & DECOMPOSITION_MASK); -} - -int android::Unicode::getDigitValue(UChar32 c, int radix) -{ - if (radix < MIN_RADIX || radix > MAX_RADIX) - return -1; - - int tempValue = radix; - - if (c >= '0' && c <= '9') - tempValue = c - '0'; - else if (c >= 'a' && c <= 'z') - tempValue = c - 'a' + 10; - else if (c >= 'A' && c <= 'Z') - tempValue = c - 'A' + 10; - - return tempValue < radix ? tempValue : -1; -} - -int android::Unicode::getNumericValue(UChar32 c) -{ - if (isMirrored(c)) - return -1; - - return (int) CharacterData::NUMERICS[((getPackedData(c) >> NUMERIC_SHIFT) & NUMERIC_MASK)]; -} - -UChar32 android::Unicode::toLower(UChar32 c) -{ - return c + CharacterData::LCDIFF[(getPackedData(c) >> TOLOWER_SHIFT) & TOLOWER_MASK]; -} - -UChar32 android::Unicode::toUpper(UChar32 c) -{ - return c + CharacterData::UCDIFF[(getPackedData(c) >> TOUPPER_SHIFT) & TOUPPER_MASK]; -} - -android::Unicode::Direction android::Unicode::getDirectionality(UChar32 c) -{ - uint32_t data = getPackedData(c); - - if (0 == data) - return DIRECTIONALITY_UNDEFINED; - - Direction d = (Direction) ((data >> DIRECTION_SHIFT) & DIRECTION_MASK); - - if (DIRECTION_MASK == d) - return DIRECTIONALITY_UNDEFINED; - - return d; -} - -bool android::Unicode::isMirrored(UChar32 c) -{ - return ((getPackedData(c) >> MIRRORED_SHIFT) & MIRRORED_MASK) != 0; -} - -UChar32 android::Unicode::toMirror(UChar32 c) -{ - if (!isMirrored(c)) - return c; - - return c + CharacterData::MIRROR_DIFF[(getPackedData(c) >> MIRROR_SHIFT) & MIRROR_MASK]; -} - -UChar32 android::Unicode::toTitle(UChar32 c) -{ - int32_t diff = CharacterData::TCDIFF[(getPackedData(c) >> TOTITLE_SHIFT) & TOTITLE_MASK]; - - if (TOTITLE_MASK == diff) - return toUpper(c); - - return c + diff; -} - - diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java index 171881f..70c27c2 100644 --- a/media/java/android/media/AudioManager.java +++ b/media/java/android/media/AudioManager.java @@ -751,6 +751,8 @@ public class AudioManager { */ public boolean isWiredHeadsetOn() { if (AudioSystem.getDeviceConnectionState(AudioSystem.DEVICE_OUT_WIRED_HEADSET,"") + == AudioSystem.DEVICE_STATE_UNAVAILABLE && + AudioSystem.getDeviceConnectionState(AudioSystem.DEVICE_OUT_WIRED_HEADPHONE,"") == AudioSystem.DEVICE_STATE_UNAVAILABLE) { return false; } else { diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java index 89ee7d3..e8b89e0 100644 --- a/media/java/android/media/MediaPlayer.java +++ b/media/java/android/media/MediaPlayer.java @@ -1064,6 +1064,53 @@ public class MediaPlayer private native void _reset(); /** + * Suspends the MediaPlayer. The only methods that may be called while + * suspended are {@link #reset()}, {@link #release()} and {@link #resume()}. + * MediaPlayer will release its hardware resources as far as + * possible and reasonable. A successfully suspended MediaPlayer will + * cease sending events. + * If suspension is successful, this method returns true, otherwise + * false is returned and the player's state is not affected. + * @hide + */ + public boolean suspend() { + if (native_suspend_resume(true) < 0) { + return false; + } + + stayAwake(false); + + // make sure none of the listeners get called anymore + mEventHandler.removeCallbacksAndMessages(null); + + return true; + } + + /** + * Resumes the MediaPlayer. Only to be called after a previous (successful) + * call to {@link #suspend()}. + * MediaPlayer will return to a state close to what it was in before + * suspension. + * @hide + */ + public boolean resume() { + if (native_suspend_resume(false) < 0) { + return false; + } + + if (isPlaying()) { + stayAwake(true); + } + + return true; + } + + /** + * @hide + */ + private native int native_suspend_resume(boolean isSuspend); + + /** * Sets the audio stream type for this MediaPlayer. See {@link AudioManager} * for a list of stream types. * diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp index 2773e5c..8ed3730 100644 --- a/media/jni/android_media_MediaPlayer.cpp +++ b/media/jni/android_media_MediaPlayer.cpp @@ -692,6 +692,19 @@ android_media_MediaPlayer_snoop(JNIEnv* env, jobject thiz, jobject data, jint ki return ret; } +static jint +android_media_MediaPlayer_native_suspend_resume( + JNIEnv *env, jobject thiz, jboolean isSuspend) { + LOGV("suspend_resume(%d)", isSuspend); + sp<MediaPlayer> mp = getMediaPlayer(env, thiz); + if (mp == NULL ) { + jniThrowException(env, "java/lang/IllegalStateException", NULL); + return UNKNOWN_ERROR; + } + + return isSuspend ? mp->suspend() : mp->resume(); +} + // ---------------------------------------------------------------------------- static JNINativeMethod gMethods[] = { @@ -724,6 +737,7 @@ static JNINativeMethod gMethods[] = { {"native_setup", "(Ljava/lang/Object;)V", (void *)android_media_MediaPlayer_native_setup}, {"native_finalize", "()V", (void *)android_media_MediaPlayer_native_finalize}, {"snoop", "([SI)I", (void *)android_media_MediaPlayer_snoop}, + {"native_suspend_resume", "(Z)I", (void *)android_media_MediaPlayer_native_suspend_resume}, }; static const char* const kClassPathName = "android/media/MediaPlayer"; diff --git a/media/libmedia/IMediaPlayer.cpp b/media/libmedia/IMediaPlayer.cpp index 9c127d4..ed792b3 100644 --- a/media/libmedia/IMediaPlayer.cpp +++ b/media/libmedia/IMediaPlayer.cpp @@ -43,6 +43,8 @@ enum { INVOKE, SET_METADATA_FILTER, GET_METADATA, + SUSPEND, + RESUME, }; class BpMediaPlayer: public BpInterface<IMediaPlayer> @@ -199,6 +201,26 @@ public: remote()->transact(GET_METADATA, request, reply); return reply->readInt32(); } + + status_t suspend() { + Parcel request; + request.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); + + Parcel reply; + remote()->transact(SUSPEND, request, &reply); + + return reply.readInt32(); + } + + status_t resume() { + Parcel request; + request.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); + + Parcel reply; + remote()->transact(RESUME, request, &reply); + + return reply.readInt32(); + } }; IMPLEMENT_META_INTERFACE(MediaPlayer, "android.media.IMediaPlayer"); @@ -299,6 +321,16 @@ status_t BnMediaPlayer::onTransact( reply->writeInt32(setMetadataFilter(data)); return NO_ERROR; } break; + case SUSPEND: { + CHECK_INTERFACE(IMediaPlayer, data, reply); + reply->writeInt32(suspend()); + return NO_ERROR; + } break; + case RESUME: { + CHECK_INTERFACE(IMediaPlayer, data, reply); + reply->writeInt32(resume()); + return NO_ERROR; + } break; case GET_METADATA: { CHECK_INTERFACE(IMediaPlayer, data, reply); const status_t retcode = getMetadata(data.readInt32(), data.readInt32(), reply); diff --git a/media/libmedia/mediaplayer.cpp b/media/libmedia/mediaplayer.cpp index 01cd8ce..2157814 100644 --- a/media/libmedia/mediaplayer.cpp +++ b/media/libmedia/mediaplayer.cpp @@ -167,6 +167,16 @@ status_t MediaPlayer::invoke(const Parcel& request, Parcel *reply) return INVALID_OPERATION; } +status_t MediaPlayer::suspend() { + Mutex::Autolock _l(mLock); + return mPlayer->suspend(); +} + +status_t MediaPlayer::resume() { + Mutex::Autolock _l(mLock); + return mPlayer->resume(); +} + status_t MediaPlayer::setMetadataFilter(const Parcel& filter) { LOGD("setMetadataFilter"); diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp index 55b06f4..b4fc035 100644 --- a/media/libmediaplayerservice/MediaPlayerService.cpp +++ b/media/libmediaplayerservice/MediaPlayerService.cpp @@ -970,6 +970,20 @@ status_t MediaPlayerService::Client::getMetadata( return OK; } +status_t MediaPlayerService::Client::suspend() { + sp<MediaPlayerBase> p = getPlayer(); + if (p == 0) return UNKNOWN_ERROR; + + return p->suspend(); +} + +status_t MediaPlayerService::Client::resume() { + sp<MediaPlayerBase> p = getPlayer(); + if (p == 0) return UNKNOWN_ERROR; + + return p->resume(); +} + status_t MediaPlayerService::Client::prepareAsync() { LOGV("[%d] prepareAsync", mConnId); diff --git a/media/libmediaplayerservice/MediaPlayerService.h b/media/libmediaplayerservice/MediaPlayerService.h index c9cae35..2408c62 100644 --- a/media/libmediaplayerservice/MediaPlayerService.h +++ b/media/libmediaplayerservice/MediaPlayerService.h @@ -222,6 +222,8 @@ private: virtual status_t getMetadata(bool update_only, bool apply_filter, Parcel *reply); + virtual status_t suspend(); + virtual status_t resume(); sp<MediaPlayerBase> createPlayer(player_type playerType); diff --git a/media/libmediaplayerservice/StagefrightPlayer.cpp b/media/libmediaplayerservice/StagefrightPlayer.cpp index 1bfcf65..7776b4e 100644 --- a/media/libmediaplayerservice/StagefrightPlayer.cpp +++ b/media/libmediaplayerservice/StagefrightPlayer.cpp @@ -136,6 +136,16 @@ player_type StagefrightPlayer::playerType() { return STAGEFRIGHT_PLAYER; } +status_t StagefrightPlayer::suspend() { + LOGV("suspend"); + return mPlayer->suspend(); +} + +status_t StagefrightPlayer::resume() { + LOGV("resume"); + return mPlayer->resume(); +} + status_t StagefrightPlayer::invoke(const Parcel &request, Parcel *reply) { return INVALID_OPERATION; } diff --git a/media/libmediaplayerservice/StagefrightPlayer.h b/media/libmediaplayerservice/StagefrightPlayer.h index 9e6674a..4446582 100644 --- a/media/libmediaplayerservice/StagefrightPlayer.h +++ b/media/libmediaplayerservice/StagefrightPlayer.h @@ -50,6 +50,8 @@ public: virtual player_type playerType(); virtual status_t invoke(const Parcel &request, Parcel *reply); virtual void setAudioSink(const sp<AudioSink> &audioSink); + virtual status_t suspend(); + virtual status_t resume(); private: AwesomePlayer *mPlayer; diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp index 5d2127b..1c9f4fd 100644 --- a/media/libstagefright/AwesomePlayer.cpp +++ b/media/libstagefright/AwesomePlayer.cpp @@ -84,6 +84,7 @@ private: struct AwesomeLocalRenderer : public AwesomeRenderer { AwesomeLocalRenderer( + bool previewOnly, const char *componentName, OMX_COLOR_FORMATTYPE colorFormat, const sp<ISurface> &surface, @@ -91,15 +92,18 @@ struct AwesomeLocalRenderer : public AwesomeRenderer { size_t decodedWidth, size_t decodedHeight) : mTarget(NULL), mLibHandle(NULL) { - init(componentName, + init(previewOnly, componentName, colorFormat, surface, displayWidth, displayHeight, decodedWidth, decodedHeight); } virtual void render(MediaBuffer *buffer) { - mTarget->render( - (const uint8_t *)buffer->data() + buffer->range_offset(), - buffer->range_length(), NULL); + render((const uint8_t *)buffer->data() + buffer->range_offset(), + buffer->range_length()); + } + + void render(const void *data, size_t size) { + mTarget->render(data, size, NULL); } protected: @@ -118,6 +122,7 @@ private: void *mLibHandle; void init( + bool previewOnly, const char *componentName, OMX_COLOR_FORMATTYPE colorFormat, const sp<ISurface> &surface, @@ -129,31 +134,39 @@ private: }; void AwesomeLocalRenderer::init( + bool previewOnly, const char *componentName, OMX_COLOR_FORMATTYPE colorFormat, const sp<ISurface> &surface, size_t displayWidth, size_t displayHeight, size_t decodedWidth, size_t decodedHeight) { - mLibHandle = dlopen("libstagefrighthw.so", RTLD_NOW); - - if (mLibHandle) { - typedef VideoRenderer *(*CreateRendererFunc)( - const sp<ISurface> &surface, - const char *componentName, - OMX_COLOR_FORMATTYPE colorFormat, - size_t displayWidth, size_t displayHeight, - size_t decodedWidth, size_t decodedHeight); - - CreateRendererFunc func = - (CreateRendererFunc)dlsym( - mLibHandle, - "_Z14createRendererRKN7android2spINS_8ISurfaceEEEPKc20" - "OMX_COLOR_FORMATTYPEjjjj"); - - if (func) { - mTarget = - (*func)(surface, componentName, colorFormat, - displayWidth, displayHeight, decodedWidth, decodedHeight); + if (!previewOnly) { + // We will stick to the vanilla software-color-converting renderer + // for "previewOnly" mode, to avoid unneccessarily switching overlays + // more often than necessary. + + mLibHandle = dlopen("libstagefrighthw.so", RTLD_NOW); + + if (mLibHandle) { + typedef VideoRenderer *(*CreateRendererFunc)( + const sp<ISurface> &surface, + const char *componentName, + OMX_COLOR_FORMATTYPE colorFormat, + size_t displayWidth, size_t displayHeight, + size_t decodedWidth, size_t decodedHeight); + + CreateRendererFunc func = + (CreateRendererFunc)dlsym( + mLibHandle, + "_Z14createRendererRKN7android2spINS_8ISurfaceEEEPKc20" + "OMX_COLOR_FORMATTYPEjjjj"); + + if (func) { + mTarget = + (*func)(surface, componentName, colorFormat, + displayWidth, displayHeight, + decodedWidth, decodedHeight); + } } } @@ -166,10 +179,12 @@ void AwesomeLocalRenderer::init( AwesomePlayer::AwesomePlayer() : mTimeSource(NULL), + mVideoRendererIsPreview(false), mAudioPlayer(NULL), mFlags(0), mLastVideoBuffer(NULL), - mVideoBuffer(NULL) { + mVideoBuffer(NULL), + mSuspensionState(NULL) { CHECK_EQ(mClient.connect(), OK); DataSource::RegisterDefaultSniffers(); @@ -221,7 +236,11 @@ void AwesomePlayer::setListener(const wp<MediaPlayerBase> &listener) { status_t AwesomePlayer::setDataSource( const char *uri, const KeyedVector<String8, String8> *headers) { Mutex::Autolock autoLock(mLock); + return setDataSource_l(uri, headers); +} +status_t AwesomePlayer::setDataSource_l( + const char *uri, const KeyedVector<String8, String8> *headers) { reset_l(); mUri = uri; @@ -243,15 +262,22 @@ status_t AwesomePlayer::setDataSource( reset_l(); - sp<DataSource> source = new FileSource(fd, offset, length); + sp<DataSource> dataSource = new FileSource(fd, offset, length); - status_t err = source->initCheck(); + status_t err = dataSource->initCheck(); if (err != OK) { return err; } - sp<MediaExtractor> extractor = MediaExtractor::Create(source); + mFileSource = dataSource; + + return setDataSource_l(dataSource); +} + +status_t AwesomePlayer::setDataSource_l( + const sp<DataSource> &dataSource) { + sp<MediaExtractor> extractor = MediaExtractor::Create(dataSource); if (extractor == NULL) { return UNKNOWN_ERROR; @@ -299,6 +325,26 @@ void AwesomePlayer::reset_l() { cancelPlayerEvents(); + if (mPrefetcher != NULL) { + CHECK_EQ(mPrefetcher->getStrongCount(), 1); + } + mPrefetcher.clear(); + + // Shutdown audio first, so that the respone to the reset request + // appears to happen instantaneously as far as the user is concerned + // If we did this later, audio would continue playing while we + // shutdown the video-related resources and the player appear to + // not be as responsive to a reset request. + mAudioSource.clear(); + + if (mTimeSource != mAudioPlayer) { + delete mTimeSource; + } + mTimeSource = NULL; + + delete mAudioPlayer; + mAudioPlayer = NULL; + mVideoRenderer.clear(); if (mLastVideoBuffer) { @@ -325,16 +371,6 @@ void AwesomePlayer::reset_l() { IPCThreadState::self()->flushCommands(); } - mAudioSource.clear(); - - if (mTimeSource != mAudioPlayer) { - delete mTimeSource; - } - mTimeSource = NULL; - - delete mAudioPlayer; - mAudioPlayer = NULL; - mDurationUs = -1; mFlags = 0; mVideoWidth = mVideoHeight = -1; @@ -344,10 +380,13 @@ void AwesomePlayer::reset_l() { mSeeking = false; mSeekTimeUs = 0; - mPrefetcher.clear(); - mUri.setTo(""); mUriHeaders.clear(); + + mFileSource.clear(); + + delete mSuspensionState; + mSuspensionState = NULL; } void AwesomePlayer::notifyListener_l(int msg, int ext1, int ext2) { @@ -403,7 +442,10 @@ void AwesomePlayer::onStreamDone() { status_t AwesomePlayer::play() { Mutex::Autolock autoLock(mLock); + return play_l(); +} +status_t AwesomePlayer::play_l() { if (mFlags & PLAYING) { return OK; } @@ -504,6 +546,7 @@ void AwesomePlayer::initRenderer_l() { // Other decoders are instantiated locally and as a consequence // allocate their buffers in local address space. mVideoRenderer = new AwesomeLocalRenderer( + false, // previewOnly component, (OMX_COLOR_FORMATTYPE)format, mISurface, @@ -579,7 +622,10 @@ status_t AwesomePlayer::getDuration(int64_t *durationUs) { status_t AwesomePlayer::getPosition(int64_t *positionUs) { Mutex::Autolock autoLock(mLock); + return getPosition_l(positionUs); +} +status_t AwesomePlayer::getPosition_l(int64_t *positionUs) { if (mVideoSource != NULL) { *positionUs = mVideoTimeUs; } else if (mAudioPlayer != NULL) { @@ -697,7 +743,11 @@ status_t AwesomePlayer::setVideoSource(sp<MediaSource> source) { void AwesomePlayer::onVideoEvent() { Mutex::Autolock autoLock(mLock); - + if (!mVideoEventPending) { + // The event has been cancelled in reset_l() but had already + // been scheduled for execution at that time. + return; + } mVideoEventPending = false; if (mSeeking) { @@ -730,6 +780,7 @@ void AwesomePlayer::onVideoEvent() { LOGV("VideoSource signalled format change."); if (mVideoRenderer != NULL) { + mVideoRendererIsPreview = false; initRenderer_l(); } continue; @@ -808,7 +859,9 @@ void AwesomePlayer::onVideoEvent() { return; } - if (mVideoRenderer == NULL) { + if (mVideoRendererIsPreview || mVideoRenderer == NULL) { + mVideoRendererIsPreview = false; + initRenderer_l(); } @@ -985,6 +1038,7 @@ void AwesomePlayer::onPrepareAsyncEvent() { if (prefetcher != NULL) { prefetcher->prepare(); + prefetcher.clear(); } Mutex::Autolock autoLock(mLock); @@ -1006,5 +1060,113 @@ void AwesomePlayer::onPrepareAsyncEvent() { mPreparedCondition.broadcast(); } +status_t AwesomePlayer::suspend() { + LOGI("suspend"); + Mutex::Autolock autoLock(mLock); + + if (mSuspensionState != NULL) { + return INVALID_OPERATION; + } + + while (mFlags & PREPARING) { + mPreparedCondition.wait(mLock); + } + + SuspensionState *state = new SuspensionState; + state->mUri = mUri; + state->mUriHeaders = mUriHeaders; + state->mFileSource = mFileSource; + + state->mFlags = mFlags & (PLAYING | LOOPING); + getPosition_l(&state->mPositionUs); + + if (mLastVideoBuffer) { + size_t size = mLastVideoBuffer->range_length(); + if (size) { + state->mLastVideoFrameSize = size; + state->mLastVideoFrame = malloc(size); + memcpy(state->mLastVideoFrame, + (const uint8_t *)mLastVideoBuffer->data() + + mLastVideoBuffer->range_offset(), + size); + + state->mVideoWidth = mVideoWidth; + state->mVideoHeight = mVideoHeight; + + sp<MetaData> meta = mVideoSource->getFormat(); + CHECK(meta->findInt32(kKeyColorFormat, &state->mColorFormat)); + CHECK(meta->findInt32(kKeyWidth, &state->mDecodedWidth)); + CHECK(meta->findInt32(kKeyHeight, &state->mDecodedHeight)); + } + } + + reset_l(); + + mSuspensionState = state; + + return OK; +} + +status_t AwesomePlayer::resume() { + LOGI("resume"); + Mutex::Autolock autoLock(mLock); + + if (mSuspensionState == NULL) { + return INVALID_OPERATION; + } + + SuspensionState *state = mSuspensionState; + mSuspensionState = NULL; + + status_t err; + if (state->mFileSource != NULL) { + err = setDataSource_l(state->mFileSource); + + if (err == OK) { + mFileSource = state->mFileSource; + } + } else { + err = setDataSource_l(state->mUri, &state->mUriHeaders); + } + + if (err != OK) { + delete state; + state = NULL; + + return err; + } + + seekTo_l(state->mPositionUs); + + mFlags = state->mFlags & LOOPING; + + if (state->mLastVideoFrame && mISurface != NULL) { + mVideoRenderer = + new AwesomeLocalRenderer( + true, // previewOnly + "", + (OMX_COLOR_FORMATTYPE)state->mColorFormat, + mISurface, + state->mVideoWidth, + state->mVideoHeight, + state->mDecodedWidth, + state->mDecodedHeight); + + mVideoRendererIsPreview = true; + + ((AwesomeLocalRenderer *)mVideoRenderer.get())->render( + state->mLastVideoFrame, state->mLastVideoFrameSize); + } + + if (state->mFlags & PLAYING) { + play_l(); + } + + delete state; + state = NULL; + + return OK; +} + } // namespace android diff --git a/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp index 666ed08..16635d3 100644 --- a/media/libstagefright/MPEG4Extractor.cpp +++ b/media/libstagefright/MPEG4Extractor.cpp @@ -60,6 +60,8 @@ protected: virtual ~MPEG4Source(); private: + Mutex mLock; + sp<MetaData> mFormat; sp<DataSource> mDataSource; int32_t mTimescale; @@ -1300,6 +1302,8 @@ MPEG4Source::~MPEG4Source() { } status_t MPEG4Source::start(MetaData *params) { + Mutex::Autolock autoLock(mLock); + CHECK(!mStarted); int32_t val; @@ -1325,6 +1329,8 @@ status_t MPEG4Source::start(MetaData *params) { } status_t MPEG4Source::stop() { + Mutex::Autolock autoLock(mLock); + CHECK(mStarted); if (mBuffer != NULL) { @@ -1345,6 +1351,8 @@ status_t MPEG4Source::stop() { } sp<MetaData> MPEG4Source::getFormat() { + Mutex::Autolock autoLock(mLock); + return mFormat; } @@ -1369,6 +1377,8 @@ size_t MPEG4Source::parseNALSize(const uint8_t *data) const { status_t MPEG4Source::read( MediaBuffer **out, const ReadOptions *options) { + Mutex::Autolock autoLock(mLock); + CHECK(mStarted); *out = NULL; @@ -1428,6 +1438,7 @@ status_t MPEG4Source::read( return ERROR_IO; } + CHECK(mBuffer != NULL); mBuffer->set_range(0, size); mBuffer->meta_data()->clear(); mBuffer->meta_data()->setInt64( @@ -1461,8 +1472,10 @@ status_t MPEG4Source::read( } MediaBuffer *clone = mBuffer->clone(); + CHECK(clone != NULL); clone->set_range(mBuffer->range_offset() + mNALLengthSize, nal_size); + CHECK(mBuffer != NULL); mBuffer->set_range( mBuffer->range_offset() + mNALLengthSize + nal_size, mBuffer->range_length() - mNALLengthSize - nal_size); @@ -1521,6 +1534,7 @@ status_t MPEG4Source::read( } CHECK_EQ(srcOffset, size); + CHECK(mBuffer != NULL); mBuffer->set_range(0, dstOffset); mBuffer->meta_data()->clear(); mBuffer->meta_data()->setInt64( diff --git a/media/libstagefright/Prefetcher.cpp b/media/libstagefright/Prefetcher.cpp index 835e167..cb03979 100644 --- a/media/libstagefright/Prefetcher.cpp +++ b/media/libstagefright/Prefetcher.cpp @@ -31,7 +31,6 @@ namespace android { struct PrefetchedSource : public MediaSource { PrefetchedSource( - const sp<Prefetcher> &prefetcher, size_t index, const sp<MediaSource> &source); @@ -52,13 +51,13 @@ private: Mutex mLock; Condition mCondition; - sp<Prefetcher> mPrefetcher; sp<MediaSource> mSource; size_t mIndex; bool mStarted; bool mReachedEOS; int64_t mSeekTimeUs; int64_t mCacheDurationUs; + bool mPrefetcherStopped; List<MediaBuffer *> mCachedBuffers; @@ -69,6 +68,7 @@ private: void clearCache_l(); void cacheMore(); + void onPrefetcherStopped(); PrefetchedSource(const PrefetchedSource &); PrefetchedSource &operator=(const PrefetchedSource &); @@ -88,7 +88,7 @@ sp<MediaSource> Prefetcher::addSource(const sp<MediaSource> &source) { Mutex::Autolock autoLock(mLock); sp<PrefetchedSource> psource = - new PrefetchedSource(this, mSources.size(), source); + new PrefetchedSource(mSources.size(), source); mSources.add(psource); @@ -130,8 +130,6 @@ void Prefetcher::threadFunc() { for (;;) { Mutex::Autolock autoLock(mLock); if (mDone) { - mThreadExited = true; - mCondition.signal(); break; } mCondition.waitRelative(mLock, 10000000ll); @@ -169,6 +167,19 @@ void Prefetcher::threadFunc() { source->cacheMore(); } } + + for (size_t i = 0; i < mSources.size(); ++i) { + sp<PrefetchedSource> source = mSources[i].promote(); + + if (source == NULL) { + continue; + } + + source->onPrefetcherStopped(); + } + + mThreadExited = true; + mCondition.signal(); } int64_t Prefetcher::getCachedDurationUs(bool *noMoreData) { @@ -219,16 +230,15 @@ status_t Prefetcher::prepare() { //////////////////////////////////////////////////////////////////////////////// PrefetchedSource::PrefetchedSource( - const sp<Prefetcher> &prefetcher, size_t index, const sp<MediaSource> &source) - : mPrefetcher(prefetcher), - mSource(source), + : mSource(source), mIndex(index), mStarted(false), mReachedEOS(false), mSeekTimeUs(0), - mCacheDurationUs(0) { + mCacheDurationUs(0), + mPrefetcherStopped(false) { } PrefetchedSource::~PrefetchedSource() { @@ -238,6 +248,8 @@ PrefetchedSource::~PrefetchedSource() { } status_t PrefetchedSource::start(MetaData *params) { + CHECK(!mStarted); + Mutex::Autolock autoLock(mLock); status_t err = mSource->start(params); @@ -252,6 +264,8 @@ status_t PrefetchedSource::start(MetaData *params) { } status_t PrefetchedSource::stop() { + CHECK(mStarted); + Mutex::Autolock autoLock(mLock); clearCache_l(); @@ -281,7 +295,7 @@ status_t PrefetchedSource::read( mSeekTimeUs = seekTimeUs; } - while (!mReachedEOS && mCachedBuffers.empty()) { + while (!mPrefetcherStopped && !mReachedEOS && mCachedBuffers.empty()) { mCondition.wait(mLock); } @@ -390,4 +404,10 @@ void PrefetchedSource::clearCache_l() { updateCacheDuration_l(); } +void PrefetchedSource::onPrefetcherStopped() { + Mutex::Autolock autoLock(mLock); + mPrefetcherStopped = true; + mCondition.signal(); +} + } // namespace android diff --git a/media/libstagefright/include/AwesomePlayer.h b/media/libstagefright/include/AwesomePlayer.h index a19784b..114d4c6 100644 --- a/media/libstagefright/include/AwesomePlayer.h +++ b/media/libstagefright/include/AwesomePlayer.h @@ -21,12 +21,14 @@ #include "TimedEventQueue.h" #include <media/MediaPlayerInterface.h> +#include <media/stagefright/DataSource.h> #include <media/stagefright/OMXClient.h> #include <utils/threads.h> namespace android { struct AudioPlayer; +struct DataSource; struct MediaBuffer; struct MediaExtractor; struct MediaSource; @@ -78,6 +80,9 @@ struct AwesomePlayer { status_t getVideoDimensions(int32_t *width, int32_t *height) const; + status_t suspend(); + status_t resume(); + private: friend struct AwesomeEvent; @@ -103,8 +108,11 @@ private: String8 mUri; KeyedVector<String8, String8> mUriHeaders; + sp<DataSource> mFileSource; + sp<MediaSource> mVideoSource; sp<AwesomeRenderer> mVideoRenderer; + bool mVideoRendererIsPreview; sp<MediaSource> mAudioSource; AudioPlayer *mAudioPlayer; @@ -140,12 +148,45 @@ private: void postBufferingEvent_l(); void postStreamDoneEvent_l(); void postCheckAudioStatusEvent_l(); + status_t getPosition_l(int64_t *positionUs); + status_t play_l(); MediaBuffer *mLastVideoBuffer; MediaBuffer *mVideoBuffer; sp<Prefetcher> mPrefetcher; + struct SuspensionState { + String8 mUri; + KeyedVector<String8, String8> mUriHeaders; + sp<DataSource> mFileSource; + + uint32_t mFlags; + int64_t mPositionUs; + + void *mLastVideoFrame; + size_t mLastVideoFrameSize; + int32_t mColorFormat; + int32_t mVideoWidth, mVideoHeight; + int32_t mDecodedWidth, mDecodedHeight; + + SuspensionState() + : mLastVideoFrame(NULL) { + } + + ~SuspensionState() { + if (mLastVideoFrame) { + free(mLastVideoFrame); + mLastVideoFrame = NULL; + } + } + } *mSuspensionState; + + status_t setDataSource_l( + const char *uri, + const KeyedVector<String8, String8> *headers = NULL); + + status_t setDataSource_l(const sp<DataSource> &dataSource); status_t setDataSource_l(const sp<MediaExtractor> &extractor); void reset_l(); status_t seekTo_l(int64_t timeUs); diff --git a/packages/SettingsProvider/AndroidManifest.xml b/packages/SettingsProvider/AndroidManifest.xml index a542518..c92b9d7 100644 --- a/packages/SettingsProvider/AndroidManifest.xml +++ b/packages/SettingsProvider/AndroidManifest.xml @@ -2,8 +2,6 @@ package="com.android.providers.settings" android:sharedUserId="android.uid.system"> - <uses-permission android:name="android.permission.BACKUP_DATA" /> - <application android:allowClearUserData="false" android:label="@string/app_label" android:process="system" diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java index 4e1e0a2..57503f7 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java @@ -38,6 +38,7 @@ import android.net.ConnectivityManager; import android.os.Environment; import android.os.SystemProperties; import android.provider.Settings; +import android.speech.RecognitionService; import android.speech.RecognizerIntent; import android.text.TextUtils; import android.util.Config; @@ -599,7 +600,7 @@ public class DatabaseHelper extends SQLiteOpenHelper { upgradeVersion = 47; } - + if (upgradeVersion == 47) { /* * The password mode constants have changed again; reset back to no @@ -614,7 +615,7 @@ public class DatabaseHelper extends SQLiteOpenHelper { } upgradeVersion = 48; } - + if (upgradeVersion == 48) { /* * Adding a new setting for which voice recognition service to use. @@ -647,6 +648,11 @@ public class DatabaseHelper extends SQLiteOpenHelper { db.execSQL("DROP INDEX IF EXISTS bookmarksIndex2"); db.execSQL("DROP TABLE IF EXISTS favorites"); onCreate(db); + + // Added for diagnosing settings.db wipes after the fact + String wipeReason = oldVersion + "/" + upgradeVersion + "/" + currentVersion; + db.execSQL("INSERT INTO secure(name,value) values('" + + "wiped_db_reason" + "','" + wipeReason + "');"); } } @@ -975,7 +981,7 @@ public class DatabaseHelper extends SQLiteOpenHelper { loadBooleanSetting(stmt, Settings.Secure.MOUNT_UMS_NOTIFY_ENABLED, R.bool.def_mount_ums_notify_enabled); - + loadVoiceRecognitionServiceSetting(stmt); stmt.close(); @@ -988,7 +994,7 @@ public class DatabaseHelper extends SQLiteOpenHelper { loadStringSetting(stmt, Settings.Secure.BACKUP_TRANSPORT, R.string.def_backup_transport); } - + /** * Introduced in database version 49. */ @@ -996,21 +1002,21 @@ public class DatabaseHelper extends SQLiteOpenHelper { String selectedService = null; List<ResolveInfo> availableRecognitionServices = mContext.getPackageManager().queryIntentServices( - new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0); + new Intent(RecognitionService.SERVICE_INTERFACE), 0); int numAvailable = availableRecognitionServices.size(); - + if (numAvailable == 0) { Log.w(TAG, "no available voice recognition services found"); } else { if (numAvailable > 1) { Log.w(TAG, "more than one voice recognition service found, picking first"); } - + ServiceInfo serviceInfo = availableRecognitionServices.get(0).serviceInfo; selectedService = new ComponentName(serviceInfo.packageName, serviceInfo.name).flattenToString(); } - + loadSetting(stmt, Settings.Secure.VOICE_RECOGNITION_SERVICE, selectedService == null ? "" : selectedService); } diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java index 27055ed..a7a6df5 100644 --- a/services/java/com/android/server/BackupManagerService.java +++ b/services/java/com/android/server/BackupManagerService.java @@ -896,9 +896,7 @@ class BackupManagerService extends IBackupManager.Stub { try { ApplicationInfo app = pkg.applicationInfo; if (((app.flags&ApplicationInfo.FLAG_ALLOW_BACKUP) == 0) - || app.backupAgentName == null - || (mPackageManager.checkPermission(android.Manifest.permission.BACKUP_DATA, - pkg.packageName) != PackageManager.PERMISSION_GRANTED)) { + || app.backupAgentName == null) { packages.remove(a); } else { @@ -1282,15 +1280,6 @@ class BackupManagerService extends IBackupManager.Stub { for (BackupRequest request : mQueue) { Log.d(TAG, "starting agent for backup of " + request); - // Don't run backup, even if requested, if the target app does not have - // the requisite permission - if (mPackageManager.checkPermission(android.Manifest.permission.BACKUP_DATA, - request.appInfo.packageName) != PackageManager.PERMISSION_GRANTED) { - Log.w(TAG, "Skipping backup of unprivileged package " - + request.appInfo.packageName); - continue; - } - IBackupAgent agent = null; int mode = (request.fullBackup) ? IApplicationThread.BACKUP_MODE_FULL @@ -1760,12 +1749,6 @@ class BackupManagerService extends IBackupManager.Stub { if (DEBUG) Log.d(TAG, "processOneRestore packageName=" + packageName); - // Don't restore to unprivileged packages - if (mPackageManager.checkPermission(android.Manifest.permission.BACKUP_DATA, - packageName) != PackageManager.PERMISSION_GRANTED) { - Log.d(TAG, "Skipping restore of unprivileged package " + packageName); - } - // !!! TODO: get the dirs from the transport File backupDataName = new File(mDataDir, packageName + ".restore"); File newStateName = new File(mStateDir, packageName + ".new"); diff --git a/services/java/com/android/server/DockObserver.java b/services/java/com/android/server/DockObserver.java index 742a7d8..c907368 100644 --- a/services/java/com/android/server/DockObserver.java +++ b/services/java/com/android/server/DockObserver.java @@ -21,6 +21,7 @@ import android.app.ActivityManagerNative; import android.app.IActivityManager; import android.app.IUiModeManager; import android.app.KeyguardManager; +import android.app.StatusBarManager; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.content.ActivityNotFoundException; @@ -71,6 +72,8 @@ class DockObserver extends UEventObserver { private boolean mKeyguardDisabled; private LockPatternUtils mLockPatternUtils; + private StatusBarManager mStatusBarManager; + // The broadcast receiver which receives the result of the ordered broadcast sent when // the dock state changes. The original ordered broadcast is sent with an initial result // code of RESULT_OK. If any of the registered broadcast receivers changes this value, e.g., @@ -234,6 +237,21 @@ class DockObserver extends UEventObserver { // Disabling the car mode clears the night mode. setMode(Configuration.UI_MODE_TYPE_NORMAL, MODE_NIGHT_NO); } + + if (mStatusBarManager == null) { + mStatusBarManager = (StatusBarManager) mContext.getSystemService(Context.STATUS_BAR_SERVICE); + } + + // Fear not: StatusBarService manages a list of requests to disable + // features of the status bar; these are ORed together to form the + // active disabled list. So if (for example) the device is locked and + // the status bar should be totally disabled, the calls below will + // have no effect until the device is unlocked. + if (mStatusBarManager != null) { + mStatusBarManager.disable(enabled + ? StatusBarManager.DISABLE_NOTIFICATION_TICKER + : StatusBarManager.DISABLE_NONE); + } } private void setMode(int modeType, int modeNight) throws RemoteException { diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java index 4a60445..a5213a0 100644 --- a/services/java/com/android/server/PackageManagerService.java +++ b/services/java/com/android/server/PackageManagerService.java @@ -1076,6 +1076,28 @@ class PackageManagerService extends IPackageManager.Stub { return null; } + public String[] currentToCanonicalPackageNames(String[] names) { + String[] out = new String[names.length]; + synchronized (mPackages) { + for (int i=names.length-1; i>=0; i--) { + PackageSetting ps = mSettings.mPackages.get(names[i]); + out[i] = ps != null && ps.realName != null ? ps.realName : names[i]; + } + } + return out; + } + + public String[] canonicalToCurrentPackageNames(String[] names) { + String[] out = new String[names.length]; + synchronized (mPackages) { + for (int i=names.length-1; i>=0; i--) { + String cur = mSettings.mRenamedPackages.get(names[i]); + out[i] = cur != null ? cur : names[i]; + } + } + return out; + } + public int getPackageUid(String packageName) { synchronized (mPackages) { PackageParser.Package p = mPackages.get(packageName); diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java index 73223ee..7fcf900 100644 --- a/services/java/com/android/server/WindowManagerService.java +++ b/services/java/com/android/server/WindowManagerService.java @@ -1773,6 +1773,32 @@ public class WindowManagerService extends IWindowManager.Stub } } + void dispatchPointerElsewhereLocked(WindowState srcWin, WindowState relWin, + MotionEvent pointer, long eventTime, boolean skipped) { + if (relWin != null) { + mPolicy.dispatchedPointerEventLw(pointer, relWin.mFrame.left, relWin.mFrame.top); + } else { + mPolicy.dispatchedPointerEventLw(pointer, 0, 0); + } + + // If we sent an initial down to the wallpaper, then continue + // sending events until the final up. + if (mSendingPointersToWallpaper) { + if (skipped) { + Log.i(TAG, "Sending skipped pointer to wallpaper!"); + } + sendPointerToWallpaperLocked(relWin, pointer, eventTime); + + // If we are on top of the wallpaper, then the wallpaper also + // gets to see this movement. + } else if (srcWin != null + && pointer.getAction() == MotionEvent.ACTION_DOWN + && mWallpaperTarget == srcWin + && srcWin.mAttrs.type != WindowManager.LayoutParams.TYPE_KEYGUARD) { + sendPointerToWallpaperLocked(relWin, pointer, eventTime); + } + } + public int addWindow(Session session, IWindow client, WindowManager.LayoutParams attrs, int viewVisibility, Rect outContentInsets) { @@ -4918,10 +4944,7 @@ public class WindowManagerService extends IWindowManager.Stub Log.w(TAG, "No window to dispatch pointer action " + ev.getAction()); } synchronized (mWindowMap) { - if (mSendingPointersToWallpaper) { - Log.i(TAG, "Sending skipped pointer to wallpaper!"); - sendPointerToWallpaperLocked(null, ev, ev.getEventTime()); - } + dispatchPointerElsewhereLocked(null, null, ev, ev.getEventTime(), true); } if (qev != null) { mQueue.recycleEvent(qev); @@ -4931,10 +4954,7 @@ public class WindowManagerService extends IWindowManager.Stub } if (targetObj == mKeyWaiter.CONSUMED_EVENT_TOKEN) { synchronized (mWindowMap) { - if (mSendingPointersToWallpaper) { - Log.i(TAG, "Sending skipped pointer to wallpaper!"); - sendPointerToWallpaperLocked(null, ev, ev.getEventTime()); - } + dispatchPointerElsewhereLocked(null, null, ev, ev.getEventTime(), true); } if (qev != null) { mQueue.recycleEvent(qev); @@ -5059,9 +5079,7 @@ public class WindowManagerService extends IWindowManager.Stub if (!target.isVisibleLw()) { // During this motion dispatch, the target window has become // invisible. - if (mSendingPointersToWallpaper) { - sendPointerToWallpaperLocked(null, ev, eventTime); - } + dispatchPointerElsewhereLocked(null, null, ev, ev.getEventTime(), false); if (qev != null) { mQueue.recycleEvent(qev); } @@ -5094,13 +5112,7 @@ public class WindowManagerService extends IWindowManager.Stub } } - // If we are on top of the wallpaper, then the wallpaper also - // gets to see this movement. - if ((mWallpaperTarget == target && - target.mAttrs.type != WindowManager.LayoutParams.TYPE_KEYGUARD) - || mSendingPointersToWallpaper) { - sendPointerToWallpaperLocked(null, ev, eventTime); - } + dispatchPointerElsewhereLocked(target, null, ev, ev.getEventTime(), false); final Rect frame = target.mFrame; ev.offsetLocation(-(float)frame.left, -(float)frame.top); @@ -5610,7 +5622,7 @@ public class WindowManagerService extends IWindowManager.Stub // If an app switch key has been pressed, and we have // waited too long for the current app to finish // processing keys, then wait no more! - doFinishedKeyLocked(true); + doFinishedKeyLocked(false); continue; } long switchTimeout = mTimeToSwitch - now; @@ -6008,7 +6020,7 @@ public class WindowManagerService extends IWindowManager.Stub + ((mLastWin != null) ? mLastWin.mToken.paused : "null")); if (mLastWin != null && (!mLastWin.mToken.paused || force || !mEventDispatching)) { - doFinishedKeyLocked(false); + doFinishedKeyLocked(true); } else { // Make sure to wake up anyone currently waiting to // dispatch a key, so they can re-evaluate their @@ -6031,11 +6043,7 @@ public class WindowManagerService extends IWindowManager.Stub if (res != null && returnWhat == RETURN_PENDING_POINTER) { synchronized (mWindowMap) { - if ((mWallpaperTarget == win && - win.mAttrs.type != WindowManager.LayoutParams.TYPE_KEYGUARD) - || mSendingPointersToWallpaper) { - sendPointerToWallpaperLocked(win, res, res.getEventTime()); - } + dispatchPointerElsewhereLocked(win, win, res, res.getEventTime(), false); } } @@ -6086,13 +6094,9 @@ public class WindowManagerService extends IWindowManager.Stub // The new window is above the old; finish pending input to the last // window and start directing it to the new one. mLastWin.mToken.paused = false; - doFinishedKeyLocked(true); // does a notifyAll() + doFinishedKeyLocked(false); // does a notifyAll() + return; } - // Either the new window is lower, so there is no need to wake key waiters, - // or we just finished key input to the previous window, which implicitly - // notified the key waiters. In both cases, we don't need to issue the - // notification here. - return; } // Now that we've put a new window state in place, make the event waiter @@ -6134,7 +6138,7 @@ public class WindowManagerService extends IWindowManager.Stub + token.paused); token.paused = false; if (mLastWin != null && mLastWin.mToken == token && mFinished) { - doFinishedKeyLocked(true); + doFinishedKeyLocked(false); } else { notifyAll(); } @@ -6162,14 +6166,14 @@ public class WindowManagerService extends IWindowManager.Stub } } - private final void doFinishedKeyLocked(boolean doRecycle) { + private final void doFinishedKeyLocked(boolean force) { if (mLastWin != null) { releasePendingPointerLocked(mLastWin.mSession); releasePendingTrackballLocked(mLastWin.mSession); } - if (mLastWin == null || !mLastWin.mToken.paused - || !mLastWin.isVisibleLw()) { + if (force || mLastWin == null || !mLastWin.mToken.paused + || !mLastWin.isVisibleLw()) { // If the current window has been paused, we aren't -really- // finished... so let the waiters still wait. mLastWin = null; diff --git a/telephony/java/android/telephony/cdma/CdmaCellLocation.java b/telephony/java/android/telephony/cdma/CdmaCellLocation.java index 7ef7747..2a0f8cd 100644 --- a/telephony/java/android/telephony/cdma/CdmaCellLocation.java +++ b/telephony/java/android/telephony/cdma/CdmaCellLocation.java @@ -26,12 +26,17 @@ public class CdmaCellLocation extends CellLocation { private int mBaseStationId = -1; /** + * @hide + */ + public final static int INVALID_LAT_LONG = Integer.MAX_VALUE; + + /** * Latitude is a decimal number as specified in 3GPP2 C.S0005-A v6.0. * It is represented in units of 0.25 seconds and ranges from -1296000 * to 1296000, both values inclusive (corresponding to a range of -90 * to +90 degrees). Integer.MAX_VALUE is considered invalid value. */ - private int mBaseStationLatitude = Integer.MAX_VALUE; + private int mBaseStationLatitude = INVALID_LAT_LONG; /** * Longitude is a decimal number as specified in 3GPP2 C.S0005-A v6.0. @@ -39,7 +44,7 @@ public class CdmaCellLocation extends CellLocation { * to 2592000, both values inclusive (corresponding to a range of -180 * to +180 degrees). Integer.MAX_VALUE is considered invalid value. */ - private int mBaseStationLongitude = Integer.MAX_VALUE; + private int mBaseStationLongitude = INVALID_LAT_LONG; private int mSystemId = -1; private int mNetworkId = -1; @@ -51,8 +56,8 @@ public class CdmaCellLocation extends CellLocation { */ public CdmaCellLocation() { this.mBaseStationId = -1; - this.mBaseStationLatitude = Integer.MAX_VALUE; - this.mBaseStationLongitude = Integer.MAX_VALUE; + this.mBaseStationLatitude = INVALID_LAT_LONG; + this.mBaseStationLongitude = INVALID_LAT_LONG; this.mSystemId = -1; this.mNetworkId = -1; } @@ -60,12 +65,12 @@ public class CdmaCellLocation extends CellLocation { /** * Initialize the object from a bundle. */ - public CdmaCellLocation(Bundle bundleWithValues) { - this.mBaseStationId = bundleWithValues.getInt("baseStationId"); - this.mBaseStationLatitude = bundleWithValues.getInt("baseStationLatitude"); - this.mBaseStationLongitude = bundleWithValues.getInt("baseStationLongitude"); - this.mSystemId = bundleWithValues.getInt("systemId"); - this.mNetworkId = bundleWithValues.getInt("networkId"); + public CdmaCellLocation(Bundle bundle) { + this.mBaseStationId = bundle.getInt("baseStationId", mBaseStationId); + this.mBaseStationLatitude = bundle.getInt("baseStationLatitude", mBaseStationLatitude); + this.mBaseStationLongitude = bundle.getInt("baseStationLongitude", mBaseStationLongitude); + this.mSystemId = bundle.getInt("systemId", mSystemId); + this.mNetworkId = bundle.getInt("networkId", mNetworkId); } /** @@ -108,8 +113,8 @@ public class CdmaCellLocation extends CellLocation { */ public void setStateInvalid() { this.mBaseStationId = -1; - this.mBaseStationLatitude = Integer.MAX_VALUE; - this.mBaseStationLongitude = Integer.MAX_VALUE; + this.mBaseStationLatitude = INVALID_LAT_LONG; + this.mBaseStationLongitude = INVALID_LAT_LONG; this.mSystemId = -1; this.mNetworkId = -1; } diff --git a/telephony/java/android/telephony/gsm/GsmCellLocation.java b/telephony/java/android/telephony/gsm/GsmCellLocation.java index 637a11c..0d4e0be 100644 --- a/telephony/java/android/telephony/gsm/GsmCellLocation.java +++ b/telephony/java/android/telephony/gsm/GsmCellLocation.java @@ -38,8 +38,8 @@ public class GsmCellLocation extends CellLocation { * Initialize the object from a bundle. */ public GsmCellLocation(Bundle bundle) { - mLac = bundle.getInt("lac"); - mCid = bundle.getInt("cid"); + mLac = bundle.getInt("lac", mLac); + mCid = bundle.getInt("cid", mCid); } /** @@ -120,5 +120,3 @@ public class GsmCellLocation extends CellLocation { m.putInt("cid", mCid); } } - - diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java index b64e5bd..c351289 100644 --- a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java +++ b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java @@ -357,8 +357,8 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { if (ar.exception == null) { String states[] = (String[])ar.result; int baseStationId = -1; - int baseStationLatitude = Integer.MAX_VALUE; - int baseStationLongitude = Integer.MAX_VALUE; + int baseStationLatitude = CdmaCellLocation.INVALID_LAT_LONG; + int baseStationLongitude = CdmaCellLocation.INVALID_LAT_LONG; int systemId = -1; int networkId = -1; @@ -373,6 +373,11 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { if (states[6] != null) { baseStationLongitude = Integer.parseInt(states[6]); } + // Some carriers only return lat-lngs of 0,0 + if (baseStationLatitude == 0 && baseStationLongitude == 0) { + baseStationLatitude = CdmaCellLocation.INVALID_LAT_LONG; + baseStationLongitude = CdmaCellLocation.INVALID_LAT_LONG; + } if (states[8] != null) { systemId = Integer.parseInt(states[8]); } @@ -662,8 +667,10 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { int registrationState = 4; //[0] registrationState int radioTechnology = -1; //[3] radioTechnology int baseStationId = -1; //[4] baseStationId - int baseStationLatitude = Integer.MAX_VALUE; //[5] baseStationLatitude - int baseStationLongitude = Integer.MAX_VALUE; //[6] baseStationLongitude + //[5] baseStationLatitude + int baseStationLatitude = CdmaCellLocation.INVALID_LAT_LONG; + //[6] baseStationLongitude + int baseStationLongitude = CdmaCellLocation.INVALID_LAT_LONG; int cssIndicator = 0; //[7] init with 0, because it is treated as a boolean int systemId = 0; //[8] systemId int networkId = 0; //[9] networkId @@ -689,6 +696,11 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { if (states[6] != null) { baseStationLongitude = Integer.parseInt(states[6]); } + // Some carriers only return lat-lngs of 0,0 + if (baseStationLatitude == 0 && baseStationLongitude == 0) { + baseStationLatitude = CdmaCellLocation.INVALID_LAT_LONG; + baseStationLongitude = CdmaCellLocation.INVALID_LAT_LONG; + } if (states[7] != null) { cssIndicator = Integer.parseInt(states[7]); } diff --git a/test-runner/android/test/ActivityInstrumentationTestCase.java b/test-runner/android/test/ActivityInstrumentationTestCase.java index f6b31ad..d12ff6f 100644 --- a/test-runner/android/test/ActivityInstrumentationTestCase.java +++ b/test-runner/android/test/ActivityInstrumentationTestCase.java @@ -40,29 +40,26 @@ public abstract class ActivityInstrumentationTestCase<T extends Activity> boolean mInitialTouchMode = false; /** - * <b>NOTE:</b> The parameter <i>pkg</i> must refer to the package identifier of the - * package hosting the activity to be launched, which is specified in the AndroidManifest.xml - * file. This is not necessarily the same as the java package name. + * Creates an {@link ActivityInstrumentationTestCase} in non-touch mode. * - * @param pkg The package hosting the activity to be launched. - * @param activityClass The activity to test. + * @param pkg ignored - no longer in use. + * @param activityClass The activity to test. This must be a class in the instrumentation + * targetPackage specified in the AndroidManifest.xml */ public ActivityInstrumentationTestCase(String pkg, Class<T> activityClass) { this(pkg, activityClass, false); } /** - * <b>NOTE:</b> The parameter <i>pkg</i> must refer to the package identifier of the - * package hosting the activity to be launched, which is specified in the AndroidManifest.xml - * file. This is not necessarily the same as the java package name. - * - * @param pkg The package hosting the activity to be launched. - * @param activityClass The activity to test. + * Creates an {@link ActivityInstrumentationTestCase}. + * + * @param pkg ignored - no longer in use. + * @param activityClass The activity to test. This must be a class in the instrumentation + * targetPackage specified in the AndroidManifest.xml * @param initialTouchMode true = in touch mode */ public ActivityInstrumentationTestCase(String pkg, Class<T> activityClass, boolean initialTouchMode) { - mPackage = pkg; mActivityClass = activityClass; mInitialTouchMode = initialTouchMode; } @@ -77,7 +74,8 @@ public abstract class ActivityInstrumentationTestCase<T extends Activity> super.setUp(); // set initial touch mode getInstrumentation().setInTouchMode(mInitialTouchMode); - setActivity(launchActivity(mPackage, mActivityClass, null)); + final String targetPackageName = getInstrumentation().getTargetContext().getPackageName(); + setActivity(launchActivity(targetPackageName, mActivityClass, null)); } @Override diff --git a/test-runner/android/test/ActivityInstrumentationTestCase2.java b/test-runner/android/test/ActivityInstrumentationTestCase2.java index 679f634..e8570bd 100644 --- a/test-runner/android/test/ActivityInstrumentationTestCase2.java +++ b/test-runner/android/test/ActivityInstrumentationTestCase2.java @@ -40,21 +40,31 @@ import java.lang.reflect.Method; */ public abstract class ActivityInstrumentationTestCase2<T extends Activity> extends ActivityTestCase { - String mPackage; Class<T> mActivityClass; boolean mInitialTouchMode = false; Intent mActivityIntent = null; /** - * <b>NOTE:</b> The parameter <i>pkg</i> must refer to the package identifier of the - * package hosting the activity to be launched, which is specified in the AndroidManifest.xml - * file. This is not necessarily the same as the java package name. - * - * @param pkg The package hosting the activity to be launched. - * @param activityClass The activity to test. + * Creates an {@link ActivityInstrumentationTestCase2}. + * + * @param pkg ignored - no longer in use. + * @param activityClass The activity to test. This must be a class in the instrumentation + * targetPackage specified in the AndroidManifest.xml + * + * @deprecated use {@link #ActivityInstrumentationTestCase2(Class)} instead */ + @Deprecated public ActivityInstrumentationTestCase2(String pkg, Class<T> activityClass) { - mPackage = pkg; + this(activityClass); + } + + /** + * Creates an {@link ActivityInstrumentationTestCase2}. + * + * @param activityClass The activity to test. This must be a class in the instrumentation + * targetPackage specified in the AndroidManifest.xml + */ + public ActivityInstrumentationTestCase2(Class<T> activityClass) { mActivityClass = activityClass; } @@ -82,11 +92,12 @@ public abstract class ActivityInstrumentationTestCase2<T extends Activity> if (a == null) { // set initial touch mode getInstrumentation().setInTouchMode(mInitialTouchMode); + final String targetPackage = getInstrumentation().getTargetContext().getPackageName(); // inject custom intent, if provided if (mActivityIntent == null) { - a = launchActivity(mPackage, mActivityClass, null); + a = launchActivity(targetPackage, mActivityClass, null); } else { - a = launchActivityWithIntent(mPackage, mActivityClass, mActivityIntent); + a = launchActivityWithIntent(targetPackage, mActivityClass, mActivityIntent); } setActivity(a); } diff --git a/test-runner/android/test/mock/MockPackageManager.java b/test-runner/android/test/mock/MockPackageManager.java index c8339ed..2a4b3f7 100644 --- a/test-runner/android/test/mock/MockPackageManager.java +++ b/test-runner/android/test/mock/MockPackageManager.java @@ -59,6 +59,16 @@ public class MockPackageManager extends PackageManager { } @Override + public String[] currentToCanonicalPackageNames(String[] names) { + throw new UnsupportedOperationException(); + } + + @Override + public String[] canonicalToCurrentPackageNames(String[] names) { + throw new UnsupportedOperationException(); + } + + @Override public Intent getLaunchIntentForPackage(String packageName) { throw new UnsupportedOperationException(); } diff --git a/tests/backup/AndroidManifest.xml b/tests/backup/AndroidManifest.xml index d992627..3778742 100644 --- a/tests/backup/AndroidManifest.xml +++ b/tests/backup/AndroidManifest.xml @@ -1,6 +1,5 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.backuptest"> - <uses-permission android:name="android.permission.BACKUP_DATA" /> <application android:backupAgent="BackupTestAgent"> <activity android:name="BackupTestActivity" android:label="_BackupTest"> <intent-filter> diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp index 5d345e6..ee07415 100644 --- a/tools/aapt/Command.cpp +++ b/tools/aapt/Command.cpp @@ -741,6 +741,15 @@ int doDump(Bundle* bundle) error.string()); goto bail; } + } else if (tag == "original-package") { + String8 name = getAttribute(tree, NAME_ATTR, &error); + if (name != "" && error == "") { + printf("original-package:'%s'\n", name.string()); + } else { + fprintf(stderr, "ERROR getting 'android:name' attribute: %s\n", + error.string()); + goto bail; + } } } else if (depth == 3 && withinApplication) { withinActivity = false; diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeAssetManager.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeAssetManager.java index 43ff424..71803fc 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeAssetManager.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeAssetManager.java @@ -17,12 +17,9 @@ package com.android.layoutlib.bridge; import android.content.res.AssetManager; -import android.content.res.Configuration; - -import java.util.Locale; public class BridgeAssetManager extends AssetManager { - + /** * This initializes the static field {@link AssetManager#mSystem} which is used * by methods who get a global asset manager using {@link AssetManager#getSystem()}. @@ -40,7 +37,7 @@ public class BridgeAssetManager extends AssetManager { } return AssetManager.sSystem; } - + /** * Clears the static {@link AssetManager#sSystem} to make sure we don't leave objects * around that would prevent us from unloading the library. @@ -48,29 +45,7 @@ public class BridgeAssetManager extends AssetManager { /*package*/ static void clearSystem() { AssetManager.sSystem = null; } - + private BridgeAssetManager() { } - - /** - * Change the configuration used when retrieving resources. Not for use by applications. - */ - @Override - public void setConfiguration(int mcc, int mnc, String locale, - int orientation, int touchscreen, int density, int keyboard, - int keyboardHidden, int navigation, int screenWidth, int screenHeight, - int screenLayout, int uiMode, int version) { - - Configuration c = new Configuration(); - c.mcc = mcc; - c.mnc = mnc; - c.locale = new Locale(locale); - c.touchscreen = touchscreen; - c.keyboard = keyboard; - c.keyboardHidden = keyboardHidden; - c.navigation = navigation; - c.orientation = orientation; - c.screenLayout = screenLayout; - c.uiMode = uiMode; - } } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeContext.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeContext.java index 57b5d4e..73a3986 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeContext.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeContext.java @@ -66,14 +66,14 @@ import java.util.Map.Entry; */ public final class BridgeContext extends Context { - private Resources mResources; - private Theme mTheme; - private HashMap<View, Object> mViewKeyMap = new HashMap<View, Object>(); - private IStyleResourceValue mThemeValues; + private final Resources mResources; + private final Theme mTheme; + private final HashMap<View, Object> mViewKeyMap = new HashMap<View, Object>(); + private final IStyleResourceValue mThemeValues; private final Object mProjectKey; - private Map<String, Map<String, IResourceValue>> mProjectResources; - private Map<String, Map<String, IResourceValue>> mFrameworkResources; - private Map<IStyleResourceValue, IStyleResourceValue> mStyleInheritanceMap; + private final Map<String, Map<String, IResourceValue>> mProjectResources; + private final Map<String, Map<String, IResourceValue>> mFrameworkResources; + private final Map<IStyleResourceValue, IStyleResourceValue> mStyleInheritanceMap; // maps for dynamically generated id representing style objects (IStyleResourceValue) private Map<Integer, IStyleResourceValue> mDynamicIdToStyleMap; @@ -927,7 +927,6 @@ public final class BridgeContext extends Context { return null; } - @Override public File getExternalCacheDir() { // TODO Auto-generated method stub return null; @@ -965,7 +964,6 @@ public final class BridgeContext extends Context { return null; } - @Override public File getExternalFilesDir(String type) { // TODO Auto-generated method stub return null; |
