summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/current.txt47
-rw-r--r--core/java/android/app/ActivityManagerNative.java20
-rw-r--r--core/java/android/app/IActivityManager.java4
-rwxr-xr-xcore/java/android/content/res/Resources.java51
-rw-r--r--core/java/android/inputmethodservice/InputMethodService.java4
-rw-r--r--core/java/android/net/nsd/DnsSdServiceInfo.java47
-rw-r--r--core/java/android/net/nsd/NsdManager.java50
-rw-r--r--core/java/android/provider/BrowserContract.java191
-rw-r--r--core/java/android/provider/ContactsContract.java8
-rw-r--r--core/java/android/text/SpannableStringBuilder.java220
-rw-r--r--core/java/android/view/TextureView.java4
-rw-r--r--core/java/android/view/View.java6
-rw-r--r--core/java/android/view/ViewRootImpl.java27
-rw-r--r--core/java/android/view/WindowManagerPolicy.java2
-rw-r--r--core/java/android/webkit/WebViewClassic.java132
-rw-r--r--core/java/android/webkit/WebViewInputDispatcher.java6
-rw-r--r--core/java/android/widget/CheckBox.java12
-rw-r--r--core/java/android/widget/NumberPicker.java11
-rw-r--r--core/java/android/widget/Switch.java11
-rw-r--r--core/jni/AndroidRuntime.cpp4
-rw-r--r--core/jni/android/graphics/Paint.cpp8
-rw-r--r--core/jni/android/graphics/TextLayoutCache.cpp5
-rw-r--r--core/res/res/anim/lock_screen_behind_enter.xml4
-rw-r--r--core/res/res/anim/lock_screen_wallpaper_behind_enter.xml36
-rw-r--r--core/res/res/anim/screen_rotate_180_enter.xml2
-rw-r--r--core/res/res/anim/screen_rotate_180_exit.xml5
-rw-r--r--core/res/res/anim/screen_rotate_180_frame.xml2
-rw-r--r--core/res/res/anim/screen_rotate_minus_90_enter.xml8
-rw-r--r--core/res/res/anim/screen_rotate_minus_90_exit.xml20
-rw-r--r--core/res/res/anim/screen_rotate_plus_90_enter.xml8
-rw-r--r--core/res/res/anim/screen_rotate_plus_90_exit.xml20
-rw-r--r--core/res/res/values/public.xml9
-rwxr-xr-xcore/res/res/values/strings.xml24
-rw-r--r--data/fonts/Android.mk2
-rw-r--r--data/fonts/DroidNaskh-Regular-Shift.ttfbin0 -> 396864 bytes
-rw-r--r--data/fonts/fallback_fonts-ja.xml2
-rw-r--r--data/fonts/fallback_fonts.xml2
-rw-r--r--data/fonts/fonts.mk2
-rw-r--r--graphics/java/android/graphics/ImageFormat.java38
-rw-r--r--graphics/java/android/graphics/Paint.java41
-rw-r--r--graphics/java/android/renderscript/Allocation.java80
-rw-r--r--graphics/java/android/renderscript/Element.java40
-rw-r--r--graphics/java/android/renderscript/Program.java23
-rw-r--r--graphics/java/android/renderscript/ProgramRaster.java7
-rw-r--r--graphics/java/android/renderscript/ProgramStore.java34
-rw-r--r--graphics/java/android/renderscript/ProgramVertex.java5
-rw-r--r--graphics/java/android/renderscript/ProgramVertexFixedFunction.java2
-rw-r--r--graphics/java/android/renderscript/RenderScript.java1
-rw-r--r--graphics/java/android/renderscript/Sampler.java7
-rw-r--r--libs/hwui/DisplayListRenderer.cpp5
-rw-r--r--libs/hwui/OpenGLRenderer.cpp5
-rw-r--r--libs/hwui/OpenGLRenderer.h1
-rw-r--r--policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java12
-rwxr-xr-xpolicy/src/com/android/internal/policy/impl/PhoneWindowManager.java17
-rw-r--r--services/java/com/android/server/NsdService.java376
-rw-r--r--services/java/com/android/server/am/ActivityManagerService.java75
-rw-r--r--services/java/com/android/server/wm/ScreenRotationAnimation.java40
-rw-r--r--services/java/com/android/server/wm/WindowAnimator.java32
-rw-r--r--services/java/com/android/server/wm/WindowManagerService.java22
-rw-r--r--telephony/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java21
-rwxr-xr-xtelephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java48
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java41
-rw-r--r--tests/RenderScriptTests/tests/src/com/android/rs/test/UT_element.java2
-rw-r--r--tests/RenderScriptTests/tests/src/com/android/rs/test/UT_program_raster.java8
-rw-r--r--tests/RenderScriptTests/tests/src/com/android/rs/test/UT_program_store.java12
65 files changed, 1514 insertions, 497 deletions
diff --git a/api/current.txt b/api/current.txt
index bb313cd..b2a8b2d 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -8492,6 +8492,7 @@ package android.graphics {
method public android.graphics.Paint.Align getTextAlign();
method public void getTextBounds(java.lang.String, int, int, android.graphics.Rect);
method public void getTextBounds(char[], int, int, android.graphics.Rect);
+ method public java.util.Locale getTextLocale();
method public void getTextPath(char[], int, int, float, float, android.graphics.Path);
method public void getTextPath(java.lang.String, int, int, float, float, android.graphics.Path);
method public float getTextScaleX();
@@ -8541,6 +8542,7 @@ package android.graphics {
method public void setStyle(android.graphics.Paint.Style);
method public void setSubpixelText(boolean);
method public void setTextAlign(android.graphics.Paint.Align);
+ method public void setTextLocale(java.util.Locale);
method public void setTextScaleX(float);
method public void setTextSize(float);
method public void setTextSkewX(float);
@@ -17993,15 +17995,24 @@ package android.renderscript {
method public static android.renderscript.Allocation createTyped(android.renderscript.RenderScript, android.renderscript.Type, int);
method public static android.renderscript.Allocation createTyped(android.renderscript.RenderScript, android.renderscript.Type);
method public void generateMipmaps();
+ method public int getBytesSize();
+ method public android.renderscript.Element getElement();
+ method public android.view.Surface getSurface();
method public android.renderscript.Type getType();
+ method public int getUsage();
+ method public void ioReceive();
+ method public void ioSend();
method public synchronized void resize(int);
method public void setFromFieldPacker(int, android.renderscript.FieldPacker);
method public void setFromFieldPacker(int, int, android.renderscript.FieldPacker);
+ method public void setSurface(android.view.Surface);
method public void syncAll(int);
field public static final int USAGE_GRAPHICS_CONSTANTS = 8; // 0x8
field public static final int USAGE_GRAPHICS_RENDER_TARGET = 16; // 0x10
field public static final int USAGE_GRAPHICS_TEXTURE = 2; // 0x2
field public static final int USAGE_GRAPHICS_VERTEX = 4; // 0x4
+ field public static final int USAGE_IO_INPUT = 32; // 0x20
+ field public static final int USAGE_IO_OUTPUT = 64; // 0x40
field public static final int USAGE_SCRIPT = 1; // 0x1
}
@@ -18089,6 +18100,7 @@ package android.renderscript {
method public static android.renderscript.Element F64_2(android.renderscript.RenderScript);
method public static android.renderscript.Element F64_3(android.renderscript.RenderScript);
method public static android.renderscript.Element F64_4(android.renderscript.RenderScript);
+ method public static android.renderscript.Element FONT(android.renderscript.RenderScript);
method public static android.renderscript.Element I16(android.renderscript.RenderScript);
method public static android.renderscript.Element I16_2(android.renderscript.RenderScript);
method public static android.renderscript.Element I16_3(android.renderscript.RenderScript);
@@ -18140,6 +18152,15 @@ package android.renderscript {
method public static android.renderscript.Element U8_4(android.renderscript.RenderScript);
method public static android.renderscript.Element createPixel(android.renderscript.RenderScript, android.renderscript.Element.DataType, android.renderscript.Element.DataKind);
method public static android.renderscript.Element createVector(android.renderscript.RenderScript, android.renderscript.Element.DataType, int);
+ method public int getBytesSize();
+ method public android.renderscript.Element.DataKind getDataKind();
+ method public android.renderscript.Element.DataType getDataType();
+ method public android.renderscript.Element getSubElement(int);
+ method public int getSubElementArraySize(int);
+ method public int getSubElementCount();
+ method public java.lang.String getSubElementName(int);
+ method public int getSubElementOffsetBytes(int);
+ method public int getVectorSize();
method public boolean isCompatible(android.renderscript.Element);
method public boolean isComplex();
}
@@ -18172,8 +18193,10 @@ package android.renderscript {
enum_constant public static final android.renderscript.Element.DataType MATRIX_2X2;
enum_constant public static final android.renderscript.Element.DataType MATRIX_3X3;
enum_constant public static final android.renderscript.Element.DataType MATRIX_4X4;
+ enum_constant public static final android.renderscript.Element.DataType NONE;
enum_constant public static final android.renderscript.Element.DataType RS_ALLOCATION;
enum_constant public static final android.renderscript.Element.DataType RS_ELEMENT;
+ enum_constant public static final android.renderscript.Element.DataType RS_FONT;
enum_constant public static final android.renderscript.Element.DataType RS_MESH;
enum_constant public static final android.renderscript.Element.DataType RS_PROGRAM_FRAGMENT;
enum_constant public static final android.renderscript.Element.DataType RS_PROGRAM_RASTER;
@@ -18486,12 +18509,18 @@ package android.renderscript {
method public void bindConstants(android.renderscript.Allocation, int);
method public void bindSampler(android.renderscript.Sampler, int) throws java.lang.IllegalArgumentException;
method public void bindTexture(android.renderscript.Allocation, int) throws java.lang.IllegalArgumentException;
+ method public android.renderscript.Type getConstant(int);
+ method public int getConstantCount();
+ method public int getTextureCount();
+ method public java.lang.String getTextureName(int);
+ method public android.renderscript.Program.TextureType getTextureType(int);
}
public static class Program.BaseProgramBuilder {
ctor protected Program.BaseProgramBuilder(android.renderscript.RenderScript);
method public android.renderscript.Program.BaseProgramBuilder addConstant(android.renderscript.Type) throws java.lang.IllegalStateException;
method public android.renderscript.Program.BaseProgramBuilder addTexture(android.renderscript.Program.TextureType) throws java.lang.IllegalArgumentException;
+ method public android.renderscript.Program.BaseProgramBuilder addTexture(android.renderscript.Program.TextureType, java.lang.String) throws java.lang.IllegalArgumentException;
method public int getCurrentConstantIndex();
method public int getCurrentTextureIndex();
method protected void initProgram(android.renderscript.Program);
@@ -18547,6 +18576,8 @@ package android.renderscript {
method public static android.renderscript.ProgramRaster CULL_BACK(android.renderscript.RenderScript);
method public static android.renderscript.ProgramRaster CULL_FRONT(android.renderscript.RenderScript);
method public static android.renderscript.ProgramRaster CULL_NONE(android.renderscript.RenderScript);
+ method public android.renderscript.ProgramRaster.CullMode getCullMode();
+ method public boolean isPointSpriteEnabled();
}
public static class ProgramRaster.Builder {
@@ -18569,6 +18600,15 @@ package android.renderscript {
method public static android.renderscript.ProgramStore BLEND_ALPHA_DEPTH_TEST(android.renderscript.RenderScript);
method public static android.renderscript.ProgramStore BLEND_NONE_DEPTH_NONE(android.renderscript.RenderScript);
method public static android.renderscript.ProgramStore BLEND_NONE_DEPTH_TEST(android.renderscript.RenderScript);
+ method public android.renderscript.ProgramStore.BlendDstFunc getBlendDstFunc();
+ method public android.renderscript.ProgramStore.BlendSrcFunc getBlendSrcFunc();
+ method public android.renderscript.ProgramStore.DepthFunc getDepthFunc();
+ method public boolean isColorMaskAlphaEnabled();
+ method public boolean isColorMaskBlueEnabled();
+ method public boolean isColorMaskGreenEnabled();
+ method public boolean isColorMaskRedEnabled();
+ method public boolean isDepthMaskEnabled();
+ method public boolean isDitherEnabled();
}
public static final class ProgramStore.BlendDstFunc extends java.lang.Enum {
@@ -18621,6 +18661,8 @@ package android.renderscript {
}
public class ProgramVertex extends android.renderscript.Program {
+ method public android.renderscript.Element getInput(int);
+ method public int getInputCount();
}
public static class ProgramVertex.Builder extends android.renderscript.Program.BaseProgramBuilder {
@@ -18758,6 +18800,11 @@ package android.renderscript {
method public static android.renderscript.Sampler WRAP_LINEAR(android.renderscript.RenderScript);
method public static android.renderscript.Sampler WRAP_LINEAR_MIP_LINEAR(android.renderscript.RenderScript);
method public static android.renderscript.Sampler WRAP_NEAREST(android.renderscript.RenderScript);
+ method public float getAnisotropy();
+ method public android.renderscript.Sampler.Value getMagnification();
+ method public android.renderscript.Sampler.Value getMinification();
+ method public android.renderscript.Sampler.Value getWrapS();
+ method public android.renderscript.Sampler.Value getWrapT();
}
public static class Sampler.Builder {
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index a3fdf3e..7e1589f 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -1000,7 +1000,7 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
}
return true;
}
-
+
case GOING_TO_SLEEP_TRANSACTION: {
data.enforceInterface(IActivityManager.descriptor);
goingToSleep();
@@ -1015,6 +1015,13 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
return true;
}
+ case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
+ data.enforceInterface(IActivityManager.descriptor);
+ setLockScreenShown(data.readInt() != 0);
+ reply.writeNoException();
+ return true;
+ }
+
case SET_DEBUG_APP_TRANSACTION: {
data.enforceInterface(IActivityManager.descriptor);
String pn = data.readString();
@@ -2912,6 +2919,17 @@ class ActivityManagerProxy implements IActivityManager
data.recycle();
reply.recycle();
}
+ public void setLockScreenShown(boolean shown) throws RemoteException
+ {
+ Parcel data = Parcel.obtain();
+ Parcel reply = Parcel.obtain();
+ data.writeInterfaceToken(IActivityManager.descriptor);
+ data.writeInt(shown ? 1 : 0);
+ mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
+ reply.readException();
+ data.recycle();
+ reply.recycle();
+ }
public void setDebugApp(
String packageName, boolean waitForDebugger, boolean persistent)
throws RemoteException
diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java
index c71b186..3fc2280 100644
--- a/core/java/android/app/IActivityManager.java
+++ b/core/java/android/app/IActivityManager.java
@@ -205,7 +205,8 @@ public interface IActivityManager extends IInterface {
// Note: probably don't want to allow applications access to these.
public void goingToSleep() throws RemoteException;
public void wakingUp() throws RemoteException;
-
+ public void setLockScreenShown(boolean shown) throws RemoteException;
+
public void unhandledBack() throws RemoteException;
public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException;
public void setDebugApp(
@@ -588,4 +589,5 @@ public interface IActivityManager extends IInterface {
int GET_CURRENT_USER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+144;
int TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+145;
int NAVIGATE_UP_TO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+146;
+ int SET_LOCK_SCREEN_SHOWN_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+147;
}
diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java
index 2af58be..c682852 100755
--- a/core/java/android/content/res/Resources.java
+++ b/core/java/android/content/res/Resources.java
@@ -32,7 +32,6 @@ import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.Slog;
-import android.util.SparseArray;
import android.util.TypedValue;
import android.util.LongSparseArray;
@@ -86,8 +85,8 @@ public class Resources {
// single-threaded, and after that these are immutable.
private static final LongSparseArray<Drawable.ConstantState> sPreloadedDrawables
= new LongSparseArray<Drawable.ConstantState>();
- private static final SparseArray<ColorStateList> mPreloadedColorStateLists
- = new SparseArray<ColorStateList>();
+ private static final LongSparseArray<ColorStateList> sPreloadedColorStateLists
+ = new LongSparseArray<ColorStateList>();
private static final LongSparseArray<Drawable.ConstantState> sPreloadedColorDrawables
= new LongSparseArray<Drawable.ConstantState>();
private static boolean mPreloaded;
@@ -98,8 +97,8 @@ public class Resources {
// These are protected by the mTmpValue lock.
private final LongSparseArray<WeakReference<Drawable.ConstantState> > mDrawableCache
= new LongSparseArray<WeakReference<Drawable.ConstantState> >();
- private final SparseArray<WeakReference<ColorStateList> > mColorStateListCache
- = new SparseArray<WeakReference<ColorStateList> >();
+ private final LongSparseArray<WeakReference<ColorStateList> > mColorStateListCache
+ = new LongSparseArray<WeakReference<ColorStateList> >();
private final LongSparseArray<WeakReference<Drawable.ConstantState> > mColorDrawableCache
= new LongSparseArray<WeakReference<Drawable.ConstantState> >();
private boolean mPreloading;
@@ -118,22 +117,6 @@ public class Resources {
private CompatibilityInfo mCompatibilityInfo;
- private static final LongSparseArray<Object> EMPTY_ARRAY = new LongSparseArray<Object>(0) {
- @Override
- public void put(long k, Object o) {
- throw new UnsupportedOperationException();
- }
- @Override
- public void append(long k, Object o) {
- throw new UnsupportedOperationException();
- }
- };
-
- @SuppressWarnings("unchecked")
- private static <T> LongSparseArray<T> emptySparseArray() {
- return (LongSparseArray<T>) EMPTY_ARRAY;
- }
-
/** @hide */
public static int selectDefaultTheme(int curTheme, int targetSdkVersion) {
return selectSystemTheme(curTheme, targetSdkVersion,
@@ -180,9 +163,8 @@ public class Resources {
* @param config Desired device configuration to consider when
* selecting/computing resource values (optional).
*/
- public Resources(AssetManager assets, DisplayMetrics metrics,
- Configuration config) {
- this(assets, metrics, config, (CompatibilityInfo) null);
+ public Resources(AssetManager assets, DisplayMetrics metrics, Configuration config) {
+ this(assets, metrics, config, null);
}
/**
@@ -1883,7 +1865,8 @@ public class Resources {
return dr;
}
- Drawable.ConstantState cs = isColorDrawable ? sPreloadedColorDrawables.get(key) : sPreloadedDrawables.get(key);
+ Drawable.ConstantState cs = isColorDrawable ?
+ sPreloadedColorDrawables.get(key) : sPreloadedDrawables.get(key);
if (cs != null) {
dr = cs.newDrawable(this);
} else {
@@ -2005,21 +1988,21 @@ public class Resources {
}
}
- final int key = (value.assetCookie << 24) | value.data;
+ final long key = (((long) value.assetCookie) << 32) | value.data;
ColorStateList csl;
if (value.type >= TypedValue.TYPE_FIRST_COLOR_INT &&
value.type <= TypedValue.TYPE_LAST_COLOR_INT) {
- csl = mPreloadedColorStateLists.get(key);
+ csl = sPreloadedColorStateLists.get(key);
if (csl != null) {
return csl;
}
csl = ColorStateList.valueOf(value.data);
if (mPreloading) {
- mPreloadedColorStateLists.put(key, csl);
+ sPreloadedColorStateLists.put(key, csl);
}
return csl;
@@ -2030,7 +2013,7 @@ public class Resources {
return csl;
}
- csl = mPreloadedColorStateLists.get(key);
+ csl = sPreloadedColorStateLists.get(key);
if (csl != null) {
return csl;
}
@@ -2063,14 +2046,13 @@ public class Resources {
if (csl != null) {
if (mPreloading) {
- mPreloadedColorStateLists.put(key, csl);
+ sPreloadedColorStateLists.put(key, csl);
} else {
synchronized (mTmpValue) {
//Log.i(TAG, "Saving cached color state list @ #" +
// Integer.toHexString(key.intValue())
// + " in " + this + ": " + csl);
- mColorStateListCache.put(
- key, new WeakReference<ColorStateList>(csl));
+ mColorStateListCache.put(key, new WeakReference<ColorStateList>(csl));
}
}
}
@@ -2078,7 +2060,7 @@ public class Resources {
return csl;
}
- private ColorStateList getCachedColorStateList(int key) {
+ private ColorStateList getCachedColorStateList(long key) {
synchronized (mTmpValue) {
WeakReference<ColorStateList> wr = mColorStateListCache.get(key);
if (wr != null) { // we have the key
@@ -2088,8 +2070,7 @@ public class Resources {
// Integer.toHexString(((Integer)key).intValue())
// + " in " + this + ": " + entry);
return entry;
- }
- else { // our entry has been purged
+ } else { // our entry has been purged
mColorStateListCache.delete(key);
}
}
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java
index ba7dc4a..332f40a 100644
--- a/core/java/android/inputmethodservice/InputMethodService.java
+++ b/core/java/android/inputmethodservice/InputMethodService.java
@@ -1712,8 +1712,8 @@ public class InputMethodService extends AbstractInputMethodService {
/**
* Override this to intercept key down events before they are processed by the
- * application. If you return true, the application will not itself
- * process the event. If you return true, the normal application processing
+ * application. If you return true, the application will not
+ * process the event itself. If you return false, the normal application processing
* will occur as if the IME had not seen the event at all.
*
* <p>The default implementation intercepts {@link KeyEvent#KEYCODE_BACK
diff --git a/core/java/android/net/nsd/DnsSdServiceInfo.java b/core/java/android/net/nsd/DnsSdServiceInfo.java
index 47d6ec6..33c3eb9 100644
--- a/core/java/android/net/nsd/DnsSdServiceInfo.java
+++ b/core/java/android/net/nsd/DnsSdServiceInfo.java
@@ -19,6 +19,8 @@ package android.net.nsd;
import android.os.Parcelable;
import android.os.Parcel;
+import java.net.InetAddress;
+
/**
* Defines a service based on DNS service discovery
* {@hide}
@@ -27,20 +29,20 @@ public class DnsSdServiceInfo implements NetworkServiceInfo, Parcelable {
private String mServiceName;
- private String mRegistrationType;
+ private String mServiceType;
private DnsSdTxtRecord mTxtRecord;
- private String mHostname;
+ private InetAddress mHost;
private int mPort;
- DnsSdServiceInfo() {
+ public DnsSdServiceInfo() {
}
- DnsSdServiceInfo(String sn, String rt, DnsSdTxtRecord tr) {
+ public DnsSdServiceInfo(String sn, String rt, DnsSdTxtRecord tr) {
mServiceName = sn;
- mRegistrationType = rt;
+ mServiceType = rt;
mTxtRecord = tr;
}
@@ -59,13 +61,13 @@ public class DnsSdServiceInfo implements NetworkServiceInfo, Parcelable {
@Override
/** @hide */
public String getServiceType() {
- return mRegistrationType;
+ return mServiceType;
}
@Override
/** @hide */
public void setServiceType(String s) {
- mRegistrationType = s;
+ mServiceType = s;
}
public DnsSdTxtRecord getTxtRecord() {
@@ -76,12 +78,12 @@ public class DnsSdServiceInfo implements NetworkServiceInfo, Parcelable {
mTxtRecord = new DnsSdTxtRecord(t);
}
- public String getHostName() {
- return mHostname;
+ public InetAddress getHost() {
+ return mHost;
}
- public void setHostName(String s) {
- mHostname = s;
+ public void setHost(InetAddress s) {
+ mHost = s;
}
public int getPort() {
@@ -96,7 +98,9 @@ public class DnsSdServiceInfo implements NetworkServiceInfo, Parcelable {
StringBuffer sb = new StringBuffer();
sb.append("name: ").append(mServiceName).
- append("type: ").append(mRegistrationType).
+ append("type: ").append(mServiceType).
+ append("host: ").append(mHost).
+ append("port: ").append(mPort).
append("txtRecord: ").append(mTxtRecord);
return sb.toString();
}
@@ -109,9 +113,14 @@ public class DnsSdServiceInfo implements NetworkServiceInfo, Parcelable {
/** Implement the Parcelable interface */
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(mServiceName);
- dest.writeString(mRegistrationType);
+ dest.writeString(mServiceType);
dest.writeParcelable(mTxtRecord, flags);
- dest.writeString(mHostname);
+ if (mHost != null) {
+ dest.writeByte((byte)1);
+ dest.writeByteArray(mHost.getAddress());
+ } else {
+ dest.writeByte((byte)0);
+ }
dest.writeInt(mPort);
}
@@ -121,9 +130,15 @@ public class DnsSdServiceInfo implements NetworkServiceInfo, Parcelable {
public DnsSdServiceInfo createFromParcel(Parcel in) {
DnsSdServiceInfo info = new DnsSdServiceInfo();
info.mServiceName = in.readString();
- info.mRegistrationType = in.readString();
+ info.mServiceType = in.readString();
info.mTxtRecord = in.readParcelable(null);
- info.mHostname = in.readString();
+
+ if (in.readByte() == 1) {
+ try {
+ info.mHost = InetAddress.getByAddress(in.createByteArray());
+ } catch (java.net.UnknownHostException e) {}
+ }
+
info.mPort = in.readInt();
return info;
}
diff --git a/core/java/android/net/nsd/NsdManager.java b/core/java/android/net/nsd/NsdManager.java
index a109a98..505f11b 100644
--- a/core/java/android/net/nsd/NsdManager.java
+++ b/core/java/android/net/nsd/NsdManager.java
@@ -93,6 +93,15 @@ public class NsdManager {
/** @hide */
public static final int RESOLVE_SERVICE_SUCCEEDED = BASE + 17;
+ /** @hide */
+ public static final int STOP_RESOLVE = BASE + 18;
+ /** @hide */
+ public static final int STOP_RESOLVE_FAILED = BASE + 19;
+ /** @hide */
+ public static final int STOP_RESOLVE_SUCCEEDED = BASE + 20;
+
+
+
/**
* Create a new Nsd instance. Applications use
* {@link android.content.Context#getSystemService Context.getSystemService()} to retrieve
@@ -117,10 +126,23 @@ public class NsdManager {
/**
* Indicates that the operation failed because the framework is busy and
- * unable to service the request
+ * unable to service the request.
*/
public static final int BUSY = 2;
+ /**
+ * Indicates that the operation failed because it is already active.
+ */
+ public static final int ALREADY_ACTIVE = 3;
+
+ /**
+ * Indicates that the operation failed because maximum limit on
+ * service registrations has reached.
+ */
+ public static final int MAX_REGS_REACHED = 4;
+
+
+
/** Interface for callback invocation when framework channel is connected or lost */
public interface ChannelListener {
public void onChannelConnected(Channel c);
@@ -188,6 +210,7 @@ public class NsdManager {
private DnsSdRegisterListener mDnsSdRegisterListener;
private DnsSdUpdateRegistrationListener mDnsSdUpdateListener;
private DnsSdResolveListener mDnsSdResolveListener;
+ private ActionListener mDnsSdStopResolveListener;
AsyncChannel mAsyncChannel;
ServiceHandler mHandler;
@@ -278,6 +301,16 @@ public class NsdManager {
(DnsSdServiceInfo) message.obj);
}
break;
+ case STOP_RESOLVE_FAILED:
+ if (mDnsSdStopResolveListener!= null) {
+ mDnsSdStopResolveListener.onFailure(message.arg1);
+ }
+ break;
+ case STOP_RESOLVE_SUCCEEDED:
+ if (mDnsSdStopResolveListener != null) {
+ mDnsSdStopResolveListener.onSuccess();
+ }
+ break;
default:
Log.d(TAG, "Ignored " + message);
break;
@@ -345,6 +378,14 @@ public class NsdManager {
c.mDnsSdResolveListener = b;
}
+ /**
+ * Set the listener for stopping service resolution. Can be null.
+ */
+ public void setStopResolveListener(Channel c, ActionListener b) {
+ if (c == null) throw new IllegalArgumentException("Channel needs to be initialized");
+ c.mDnsSdStopResolveListener = b;
+ }
+
public void registerService(Channel c, DnsSdServiceInfo serviceInfo) {
if (c == null) throw new IllegalArgumentException("Channel needs to be initialized");
if (serviceInfo == null) throw new IllegalArgumentException("Null serviceInfo");
@@ -378,6 +419,13 @@ public class NsdManager {
c.mAsyncChannel.sendMessage(RESOLVE_SERVICE, serviceInfo);
}
+ public void stopServiceResolve(Channel c) {
+ if (c == null) throw new IllegalArgumentException("Channel needs to be initialized");
+ if (c.mDnsSdResolveListener == null) throw new
+ IllegalStateException("Resolve listener needs to be set first");
+ c.mAsyncChannel.sendMessage(STOP_RESOLVE);
+ }
+
/**
* Get a reference to NetworkService handler. This is used to establish
* an AsyncChannel communication with the service
diff --git a/core/java/android/provider/BrowserContract.java b/core/java/android/provider/BrowserContract.java
index d678205..118b5eb 100644
--- a/core/java/android/provider/BrowserContract.java
+++ b/core/java/android/provider/BrowserContract.java
@@ -30,6 +30,15 @@ import android.os.RemoteException;
import android.util.Pair;
/**
+ * <p>
+ * The contract between the browser provider and applications. Contains the definition
+ * for the supported URIS and columns.
+ * </p>
+ * <h3>Overview</h3>
+ * <p>
+ * BrowserContract defines an database of browser-related information which are bookmarks,
+ * history, images and the mapping between the image and URL.
+ * </p>
* @hide
*/
public class BrowserContract {
@@ -45,12 +54,14 @@ public class BrowserContract {
* the dirty flag is not automatically set and the "syncToNetwork" parameter
* is set to false when calling
* {@link ContentResolver#notifyChange(android.net.Uri, android.database.ContentObserver, boolean)}.
+ * @hide
*/
public static final String CALLER_IS_SYNCADAPTER = "caller_is_syncadapter";
/**
* A parameter for use when querying any table that allows specifying a limit on the number
* of rows returned.
+ * @hide
*/
public static final String PARAM_LIMIT = "limit";
@@ -58,6 +69,8 @@ public class BrowserContract {
* Generic columns for use by sync adapters. The specific functions of
* these columns are private to the sync adapter. Other clients of the API
* should not attempt to either read or write these columns.
+ *
+ * @hide
*/
interface BaseSyncColumns {
/** Generic column for use by sync adapters. */
@@ -74,6 +87,7 @@ public class BrowserContract {
/**
* Convenience definitions for use in implementing chrome bookmarks sync in the Bookmarks table.
+ * @hide
*/
public static final class ChromeSyncColumns {
private ChromeSyncColumns() {}
@@ -93,6 +107,7 @@ public class BrowserContract {
/**
* Columns that appear when each row of a table belongs to a specific
* account, including sync information that an account may need.
+ * @hide
*/
interface SyncColumns extends BaseSyncColumns {
/**
@@ -144,13 +159,14 @@ public class BrowserContract {
public static final String _ID = "_id";
/**
- * The URL of the bookmark.
+ * This column is valid when the row is a URL. The history table's URL
+ * can not be updated.
* <P>Type: TEXT (URL)</P>
*/
public static final String URL = "url";
/**
- * The user visible title of the bookmark.
+ * The user visible title.
* <P>Type: TEXT</P>
*/
public static final String TITLE = "title";
@@ -159,10 +175,14 @@ public class BrowserContract {
* The time that this row was created on its originating client (msecs
* since the epoch).
* <P>Type: INTEGER</P>
+ * @hide
*/
public static final String DATE_CREATED = "created";
}
+ /**
+ * @hide
+ */
interface ImageColumns {
/**
* The favicon of the bookmark, may be NULL.
@@ -182,7 +202,6 @@ public class BrowserContract {
* The touch icon for the web page, may be NULL.
* Must decode via {@link BitmapFactory#decodeByteArray}.
* <p>Type: BLOB (image)</p>
- * @hide
*/
public static final String TOUCH_ICON = "touch_icon";
}
@@ -200,9 +219,26 @@ public class BrowserContract {
*/
public static final String VISITS = "visits";
+ /**
+ * @hide
+ */
public static final String USER_ENTERED = "user_entered";
}
+ interface ImageMappingColumns {
+ /**
+ * The ID of the image in Images. One image can map onto the multiple URLs.
+ * <P>Type: INTEGER (long)</P>
+ */
+ public static final String IMAGE_ID = "image_id";
+
+ /**
+ * The URL. The URL can map onto the different type of images.
+ * <P>Type: TEXT (URL)</P>
+ */
+ public static final String URL = "url";
+ }
+
/**
* The bookmarks table, which holds the user's browser bookmarks.
*/
@@ -218,24 +254,71 @@ public class BrowserContract {
public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "bookmarks");
/**
+ * Used in {@link Bookmarks#TYPE} column and indicats the row is a bookmark.
+ */
+ public static final int BOOKMARK_TYPE_BOOKMARK = 1;
+
+ /**
+ * Used in {@link Bookmarks#TYPE} column and indicats the row is a folder.
+ */
+ public static final int BOOKMARK_TYPE_FOLDER = 2;
+
+ /**
+ * Used in {@link Bookmarks#TYPE} column and indicats the row is the bookmark bar folder.
+ */
+ public static final int BOOKMARK_TYPE_BOOKMARK_BAR_FOLDER = 3;
+
+ /**
+ * Used in {@link Bookmarks#TYPE} column and indicats the row is other folder and
+ */
+ public static final int BOOKMARK_TYPE_OTHER_FOLDER = 4;
+
+ /**
+ * Used in {@link Bookmarks#TYPE} column and indicats the row is other folder, .
+ */
+ public static final int BOOKMARK_TYPE_MOBILE_FOLDER = 5;
+
+ /**
+ * The type of the item.
+ * <P>Type: INTEGER</P>
+ * <p>Allowed values are:</p>
+ * <p>
+ * <ul>
+ * <li>{@link #BOOKMARK_TYPE_BOOKMARK}</li>
+ * <li>{@link #BOOKMARK_TYPE_FOLDER}</li>
+ * <li>{@link #BOOKMARK_TYPE_BOOKMARK_BAR_FOLDER}</li>
+ * <li>{@link #BOOKMARK_TYPE_OTHER_FOLDER}</li>
+ * <li>{@link #BOOKMARK_TYPE_MOBILE_FOLDER}</li>
+ * </ul>
+ * </p>
+ * <p> The TYPE_BOOKMARK_BAR_FOLDER, TYPE_OTHER_FOLDER and TYPE_MOBILE_FOLDER
+ * can not be updated or deleted.</p>
+ */
+ public static final String TYPE = "type";
+
+ /**
* The content:// style URI for the default folder
+ * @hide
*/
public static final Uri CONTENT_URI_DEFAULT_FOLDER =
Uri.withAppendedPath(CONTENT_URI, "folder");
/**
* Query parameter used to specify an account name
+ * @hide
*/
public static final String PARAM_ACCOUNT_NAME = "acct_name";
/**
* Query parameter used to specify an account type
+ * @hide
*/
public static final String PARAM_ACCOUNT_TYPE = "acct_type";
/**
* Builds a URI that points to a specific folder.
* @param folderId the ID of the folder to point to
+ * @hide
*/
public static final Uri buildFolderUri(long folderId) {
return ContentUris.withAppendedId(CONTENT_URI_DEFAULT_FOLDER, folderId);
@@ -255,6 +338,7 @@ public class BrowserContract {
* Query parameter to use if you want to see deleted bookmarks that are still
* around on the device and haven't been synced yet.
* @see #IS_DELETED
+ * @hide
*/
public static final String QUERY_PARAMETER_SHOW_DELETED = "show_deleted";
@@ -262,6 +346,7 @@ public class BrowserContract {
* Flag indicating if an item is a folder or bookmark. Non-zero values indicate
* a folder and zero indicates a bookmark.
* <P>Type: INTEGER (boolean)</P>
+ * @hide
*/
public static final String IS_FOLDER = "folder";
@@ -274,6 +359,7 @@ public class BrowserContract {
/**
* The source ID for an item's parent. Read-only.
* @see #PARENT
+ * @hide
*/
public static final String PARENT_SOURCE_ID = "parent_source";
@@ -281,6 +367,7 @@ public class BrowserContract {
* The position of the bookmark in relation to it's siblings that share the same
* {@link #PARENT}. May be negative.
* <P>Type: INTEGER</P>
+ * @hide
*/
public static final String POSITION = "position";
@@ -288,6 +375,7 @@ public class BrowserContract {
* The item that the bookmark should be inserted after.
* May be negative.
* <P>Type: INTEGER</P>
+ * @hide
*/
public static final String INSERT_AFTER = "insert_after";
@@ -296,6 +384,7 @@ public class BrowserContract {
* May be negative.
* <P>Type: INTEGER</P>
* @see #INSERT_AFTER
+ * @hide
*/
public static final String INSERT_AFTER_SOURCE_ID = "insert_after_source";
@@ -305,12 +394,14 @@ public class BrowserContract {
* to the URI when performing your query.
* <p>Type: INTEGER (non-zero if the item has been deleted, zero if it hasn't)
* @see #QUERY_PARAMETER_SHOW_DELETED
+ * @hide
*/
public static final String IS_DELETED = "deleted";
}
/**
* Read-only table that lists all the accounts that are used to provide bookmarks.
+ * @hide
*/
public static final class Accounts {
/**
@@ -410,6 +501,7 @@ public class BrowserContract {
* A table provided for sync adapters to use for storing private sync state data.
*
* @see SyncStateContract
+ * @hide
*/
public static final class SyncState implements SyncStateContract.Columns {
/**
@@ -459,8 +551,18 @@ public class BrowserContract {
}
/**
- * Stores images for URLs. Only support query() and update().
- * @hide
+ * <p>
+ * Stores images for URLs.
+ * </p>
+ * <p>
+ * The rows in this table can not be updated since there might have multiple URLs mapping onto
+ * the same image. If you want to update a URL's image, you need to add the new image in this
+ * table, then update the mapping onto the added image.
+ * </p>
+ * <p>
+ * Every image should be at least associated with one URL, otherwise it will be removed after a
+ * while.
+ * </p>
*/
public static final class Images implements ImageColumns {
/**
@@ -474,15 +576,93 @@ public class BrowserContract {
public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "images");
/**
+ * The MIME type of {@link #CONTENT_URI} providing a directory of images.
+ */
+ public static final String CONTENT_TYPE = "vnd.android.cursor.dir/images";
+
+ /**
+ * The MIME type of a {@link #CONTENT_URI} of a single image.
+ */
+ public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/images";
+
+ /**
+ * Used in {@link Images#TYPE} column and indicats the row is a favicon.
+ */
+ public static final int IMAGE_TYPE_FAVICON = 1;
+
+ /**
+ * Used in {@link Images#TYPE} column and indicats the row is a precomposed touch icon.
+ */
+ public static final int IMAGE_TYPE_PRECOMPOSED_TOUCH_ICON = 2;
+
+ /**
+ * Used in {@link Images#TYPE} column and indicats the row is a touch icon.
+ */
+ public static final int IMAGE_TYPE_TOUCH_ICON = 4;
+
+ /**
+ * The type of item in the table.
+ * <P>Type: INTEGER</P>
+ * <p>Allowed values are:</p>
+ * <p>
+ * <ul>
+ * <li>{@link #IMAGE_TYPE_FAVICON}</li>
+ * <li>{@link #IMAGE_TYPE_PRECOMPOSED_TOUCH_ICON}</li>
+ * <li>{@link #IMAGE_TYPE_TOUCH_ICON}</li>
+ * </ul>
+ * </p>
+ */
+ public static final String TYPE = "type";
+
+ /**
+ * The image data.
+ * <p>Type: BLOB (image)</p>
+ */
+ public static final String DATA = "data";
+
+ /**
* The URL the images came from.
* <P>Type: TEXT (URL)</P>
+ * @hide
*/
public static final String URL = "url_key";
}
/**
+ * <p>
+ * A table that stores the mappings between the image and the URL.
+ * </p>
+ * <p>
+ * Deleting or Updating a mapping might also deletes the mapped image if there is no other URL
+ * maps onto it.
+ * </p>
+ */
+ public static final class ImageMappings implements ImageMappingColumns {
+ /**
+ * This utility class cannot be instantiated
+ */
+ private ImageMappings() {}
+
+ /**
+ * The content:// style URI for this table
+ */
+ public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "image_mappings");
+
+ /**
+ * The MIME type of {@link #CONTENT_URI} providing a directory of image mappings.
+ */
+ public static final String CONTENT_TYPE = "vnd.android.cursor.dir/image_mappings";
+
+ /**
+ * The MIME type of a {@link #CONTENT_URI} of a single image mapping.
+ */
+ public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/image_mappings";
+ }
+
+ /**
* A combined view of bookmarks and history. All bookmarks in all folders are included and
* no folders are included.
+ * @hide
*/
public static final class Combined implements CommonColumns, HistoryColumns, ImageColumns {
/**
@@ -505,6 +685,7 @@ public class BrowserContract {
/**
* A table that stores settings specific to the browser. Only support query and insert.
+ * @hide
*/
public static final class Settings {
/**
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java
index 0e9306b..e4729c7 100644
--- a/core/java/android/provider/ContactsContract.java
+++ b/core/java/android/provider/ContactsContract.java
@@ -7452,7 +7452,7 @@ public final class ContactsContract {
/**
* <p>
* API allowing applications to send usage information for each {@link Data} row to the
- * Contacts Provider.
+ * Contacts Provider. Applications can also clear all usage information.
* </p>
* <p>
* With the feedback, Contacts Provider may return more contextually appropriate results for
@@ -7497,6 +7497,12 @@ public final class ContactsContract {
* boolean successful = resolver.update(uri, new ContentValues(), null, null) > 0;
* </pre>
* </p>
+ * <p>
+ * Applications can also clear all usage information with:
+ * <pre>
+ * boolean successful = resolver.delete(DataUsageFeedback.FEEDBACK_URI, null, null) > 0;
+ * </pre>
+ * </p>
*/
public static final class DataUsageFeedback {
diff --git a/core/java/android/text/SpannableStringBuilder.java b/core/java/android/text/SpannableStringBuilder.java
index 6056c75..11c169e 100644
--- a/core/java/android/text/SpannableStringBuilder.java
+++ b/core/java/android/text/SpannableStringBuilder.java
@@ -75,7 +75,7 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable
if (spans[i] instanceof NoCopySpan) {
continue;
}
-
+
int st = sp.getSpanStart(spans[i]) - start;
int en = sp.getSpanEnd(spans[i]) - start;
int fl = sp.getSpanFlags(spans[i]);
@@ -212,7 +212,7 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable
if (mGapLength > 2 * length())
resizeFor(length());
-
+
return ret; // == this
}
@@ -220,7 +220,7 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable
public void clear() {
replace(0, length(), "", 0, 0);
}
-
+
// Documentation from interface
public void clearSpans() {
for (int i = mSpanCount - 1; i >= 0; i--) {
@@ -257,45 +257,50 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable
return append(String.valueOf(text));
}
- private void change(int start, int end, CharSequence tb, int tbstart, int tbend) {
- checkRange("replace", start, end);
+ private void change(int start, int end, CharSequence cs, int csStart, int csEnd) {
+ // Can be negative
+ final int nbNewChars = (csEnd - csStart) - (end - start);
for (int i = mSpanCount - 1; i >= 0; i--) {
- if ((mSpanFlags[i] & SPAN_PARAGRAPH) == SPAN_PARAGRAPH) {
- int st = mSpanStarts[i];
- if (st > mGapStart)
- st -= mGapLength;
+ int spanStart = mSpanStarts[i];
+ if (spanStart > mGapStart)
+ spanStart -= mGapLength;
- int en = mSpanEnds[i];
- if (en > mGapStart)
- en -= mGapLength;
+ int spanEnd = mSpanEnds[i];
+ if (spanEnd > mGapStart)
+ spanEnd -= mGapLength;
- int ost = st;
- int oen = en;
+ if ((mSpanFlags[i] & SPAN_PARAGRAPH) == SPAN_PARAGRAPH) {
+ int ost = spanStart;
+ int oen = spanEnd;
int clen = length();
- if (st > start && st <= end) {
- for (st = end; st < clen; st++)
- if (st > end && charAt(st - 1) == '\n')
+ if (spanStart > start && spanStart <= end) {
+ for (spanStart = end; spanStart < clen; spanStart++)
+ if (spanStart > end && charAt(spanStart - 1) == '\n')
break;
}
- if (en > start && en <= end) {
- for (en = end; en < clen; en++)
- if (en > end && charAt(en - 1) == '\n')
+ if (spanEnd > start && spanEnd <= end) {
+ for (spanEnd = end; spanEnd < clen; spanEnd++)
+ if (spanEnd > end && charAt(spanEnd - 1) == '\n')
break;
}
- if (st != ost || en != oen)
- setSpan(false, mSpans[i], st, en, mSpanFlags[i]);
+ if (spanStart != ost || spanEnd != oen)
+ setSpan(false, mSpans[i], spanStart, spanEnd, mSpanFlags[i]);
}
+
+ int flags = 0;
+ if (spanStart == start) flags |= SPAN_START_AT_START;
+ else if (spanStart == end + nbNewChars) flags |= SPAN_START_AT_END;
+ if (spanEnd == start) flags |= SPAN_END_AT_START;
+ else if (spanEnd == end + nbNewChars) flags |= SPAN_END_AT_END;
+ mSpanFlags[i] |= flags;
}
moveGapTo(end);
- // Can be negative
- final int nbNewChars = (tbend - tbstart) - (end - start);
-
if (nbNewChars >= mGapLength) {
resizeFor(mText.length + nbNewChars - mGapLength);
}
@@ -306,7 +311,7 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable
if (mGapLength < 1)
new Exception("mGapLength < 1").printStackTrace();
- TextUtils.getChars(tb, tbstart, tbend, mText, start);
+ TextUtils.getChars(cs, csStart, csEnd, mText, start);
if (end > start) {
// no need for span fixup on pure insertion
@@ -340,21 +345,23 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable
}
}
- if (tb instanceof Spanned) {
- Spanned sp = (Spanned) tb;
- Object[] spans = sp.getSpans(tbstart, tbend, Object.class);
+ mSpanCountBeforeAdd = mSpanCount;
+
+ if (cs instanceof Spanned) {
+ Spanned sp = (Spanned) cs;
+ Object[] spans = sp.getSpans(csStart, csEnd, Object.class);
for (int i = 0; i < spans.length; i++) {
int st = sp.getSpanStart(spans[i]);
int en = sp.getSpanEnd(spans[i]);
- if (st < tbstart) st = tbstart;
- if (en > tbend) en = tbend;
+ if (st < csStart) st = csStart;
+ if (en > csEnd) en = csEnd;
// Add span only if this object is not yet used as a span in this string
- if (getSpanStart(spans[i]) < 0) {
- setSpan(false, spans[i], st - tbstart + start, en - tbstart + start,
- sp.getSpanFlags(spans[i]));
+ if (getSpanStart(spans[i]) < 0 && !(spans[i] instanceof SpanWatcher)) {
+ setSpan(false, spans[i], st - csStart + start, en - csStart + start,
+ sp.getSpanFlags(spans[i]));
}
}
}
@@ -390,6 +397,8 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable
// Documentation from interface
public SpannableStringBuilder replace(final int start, final int end,
CharSequence tb, int tbstart, int tbend) {
+ checkRange("replace", start, end);
+
int filtercount = mFilters.length;
for (int i = 0; i < filtercount; i++) {
CharSequence repl = mFilters[i].filter(tb, tbstart, tbend, this, start, end);
@@ -404,10 +413,6 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable
final int origLen = end - start;
final int newLen = tbend - tbstart;
- if (origLen == 0 && newLen == 0) {
- return this;
- }
-
TextWatcher[] textWatchers = getSpans(start, start + origLen, TextWatcher.class);
sendBeforeTextChanged(textWatchers, start, origLen, newLen);
@@ -415,43 +420,101 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable
// a text replacement. If replaced or replacement text length is zero, this
// is already taken care of.
boolean adjustSelection = origLen != 0 && newLen != 0;
- int selstart = 0;
- int selend = 0;
+ int selectionStart = 0;
+ int selectionEnd = 0;
if (adjustSelection) {
- selstart = Selection.getSelectionStart(this);
- selend = Selection.getSelectionEnd(this);
+ selectionStart = Selection.getSelectionStart(this);
+ selectionEnd = Selection.getSelectionEnd(this);
}
- checkRange("replace", start, end);
-
change(start, end, tb, tbstart, tbend);
if (adjustSelection) {
- if (selstart > start && selstart < end) {
- long off = selstart - start;
-
- off = off * newLen / origLen;
- selstart = (int) off + start;
+ if (selectionStart > start && selectionStart < end) {
+ final int offset = (selectionStart - start) * newLen / origLen;
+ selectionStart = start + offset;
- setSpan(false, Selection.SELECTION_START, selstart, selstart,
+ setSpan(false, Selection.SELECTION_START, selectionStart, selectionStart,
Spanned.SPAN_POINT_POINT);
}
- if (selend > start && selend < end) {
- long off = selend - start;
+ if (selectionEnd > start && selectionEnd < end) {
+ final int offset = (selectionEnd - start) * newLen / origLen;
+ selectionEnd = start + offset;
- off = off * newLen / origLen;
- selend = (int) off + start;
-
- setSpan(false, Selection.SELECTION_END, selend, selend, Spanned.SPAN_POINT_POINT);
+ setSpan(false, Selection.SELECTION_END, selectionEnd, selectionEnd,
+ Spanned.SPAN_POINT_POINT);
}
}
sendTextChanged(textWatchers, start, origLen, newLen);
sendAfterTextChanged(textWatchers);
+ // Span watchers need to be called after text watchers, which may update the layout
+ sendToSpanWatchers(start, end, newLen - origLen);
+
return this;
}
+ private void sendToSpanWatchers(int replaceStart, int replaceEnd, int nbNewChars) {
+ for (int i = 0; i < mSpanCountBeforeAdd; i++) {
+ int spanStart = mSpanStarts[i];
+ int spanEnd = mSpanEnds[i];
+ if (spanStart > mGapStart) spanStart -= mGapLength;
+ if (spanEnd > mGapStart) spanEnd -= mGapLength;
+ int spanFlags = mSpanFlags[i];
+
+ int newReplaceEnd = replaceEnd + nbNewChars;
+ boolean spanChanged = false;
+ int previousSpanStart = spanStart;
+ if (spanStart > newReplaceEnd) {
+ if (nbNewChars != 0) {
+ previousSpanStart -= nbNewChars;
+ spanChanged = true;
+ }
+ } else if (spanStart >= replaceStart) {
+ // No change if span start was already at replace interval boundaries before replace
+ if ((spanStart != replaceStart ||
+ ((spanFlags & SPAN_START_AT_START) != SPAN_START_AT_START)) &&
+ (spanStart != newReplaceEnd ||
+ ((spanFlags & SPAN_START_AT_END) != SPAN_START_AT_END))) {
+ // TODO previousSpanStart is incorrect, but we would need to save all the
+ // previous spans' positions before replace to provide it
+ spanChanged = true;
+ }
+ }
+ int previousSpanEnd = spanEnd;
+ if (spanEnd > newReplaceEnd) {
+ if (nbNewChars != 0) {
+ previousSpanEnd -= nbNewChars;
+ spanChanged = true;
+ }
+ } else if (spanEnd >= replaceStart) {
+ // No change if span start was already at replace interval boundaries before replace
+ if ((spanEnd != replaceStart ||
+ ((spanFlags & SPAN_END_AT_START) != SPAN_END_AT_START)) &&
+ (spanEnd != newReplaceEnd ||
+ ((spanFlags & SPAN_END_AT_END) != SPAN_END_AT_END))) {
+ // TODO same as above for previousSpanEnd
+ spanChanged = true;
+ }
+ }
+
+ if (spanChanged) {
+ sendSpanChanged(mSpans[i], previousSpanStart, previousSpanEnd, spanStart, spanEnd);
+ }
+ mSpanFlags[i] &= ~SPAN_START_END_MASK;
+ }
+
+ // The spans starting at mIntermediateSpanCount were added from the replacement text
+ for (int i = mSpanCountBeforeAdd; i < mSpanCount; i++) {
+ int spanStart = mSpanStarts[i];
+ int spanEnd = mSpanEnds[i];
+ if (spanStart > mGapStart) spanStart -= mGapLength;
+ if (spanEnd > mGapStart) spanEnd -= mGapLength;
+ sendSpanAdded(mSpans[i], spanStart, spanEnd);
+ }
+ }
+
/**
* Mark the specified range of text with the specified object.
* The flags determine how the span will behave when text is
@@ -788,13 +851,12 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable
if (end <= mGapStart) {
System.arraycopy(mText, start, dest, destoff, end - start);
} else if (start >= mGapStart) {
- System.arraycopy(mText, start + mGapLength,
- dest, destoff, end - start);
+ System.arraycopy(mText, start + mGapLength, dest, destoff, end - start);
} else {
System.arraycopy(mText, start, dest, destoff, mGapStart - start);
System.arraycopy(mText, mGapStart + mGapLength,
- dest, destoff + (mGapStart - start),
- end - mGapStart);
+ dest, destoff + (mGapStart - start),
+ end - mGapStart);
}
}
@@ -863,12 +925,14 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable
}
}
- private void sendSpanChanged(Object what, int s, int e, int st, int en) {
- SpanWatcher[] recip = getSpans(Math.min(s, st), Math.max(e, en), SpanWatcher.class);
- int n = recip.length;
-
+ private void sendSpanChanged(Object what, int oldStart, int oldEnd, int start, int end) {
+ // The bounds of a possible SpanWatcher are guaranteed to be set before this method is
+ // called, so that the order of the span does not affect this broadcast.
+ SpanWatcher[] spanWatchers = getSpans(Math.min(oldStart, start),
+ Math.min(Math.max(oldEnd, end), length()), SpanWatcher.class);
+ int n = spanWatchers.length;
for (int i = 0; i < n; i++) {
- recip[i].onSpanChanged(this, what, s, e, st, en);
+ spanWatchers[i].onSpanChanged(this, what, oldStart, oldEnd, start, end);
}
}
@@ -879,26 +943,23 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable
private void checkRange(final String operation, int start, int end) {
if (end < start) {
throw new IndexOutOfBoundsException(operation + " " +
- region(start, end) +
- " has end before start");
+ region(start, end) + " has end before start");
}
int len = length();
if (start > len || end > len) {
throw new IndexOutOfBoundsException(operation + " " +
- region(start, end) +
- " ends beyond length " + len);
+ region(start, end) + " ends beyond length " + len);
}
if (start < 0 || end < 0) {
throw new IndexOutOfBoundsException(operation + " " +
- region(start, end) +
- " starts before 0");
+ region(start, end) + " starts before 0");
}
}
-/*
+ /*
private boolean isprint(char c) { // XXX
if (c >= ' ' && c <= '~')
return true;
@@ -977,7 +1038,7 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable
System.out.print("\n");
}
-*/
+ */
/**
* Don't call this yourself -- exists for Canvas to use internally.
@@ -1023,7 +1084,7 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable
}
}
- /**
+ /**
* Don't call this yourself -- exists for Paint to use internally.
* {@hide}
*/
@@ -1059,8 +1120,7 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable
if (end <= mGapStart) {
ret = p.getTextWidths(mText, start, end - start, widths);
} else if (start >= mGapStart) {
- ret = p.getTextWidths(mText, start + mGapLength, end - start,
- widths);
+ ret = p.getTextWidths(mText, start + mGapLength, end - start, widths);
} else {
char[] buf = TextUtils.obtain(end - start);
@@ -1205,6 +1265,7 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable
private int[] mSpanEnds;
private int[] mSpanFlags;
private int mSpanCount;
+ private int mSpanCountBeforeAdd;
// TODO These value are tightly related to the public SPAN_MARK/POINT values in {@link Spanned}
private static final int MARK = 1;
@@ -1214,4 +1275,11 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable
private static final int START_MASK = 0xF0;
private static final int END_MASK = 0x0F;
private static final int START_SHIFT = 4;
+
+ // These bits are not (currently) used by SPANNED flags
+ private static final int SPAN_START_AT_START = 0x1000;
+ private static final int SPAN_START_AT_END = 0x2000;
+ private static final int SPAN_END_AT_START = 0x4000;
+ private static final int SPAN_END_AT_END = 0x8000;
+ private static final int SPAN_START_END_MASK = 0xF000;
}
diff --git a/core/java/android/view/TextureView.java b/core/java/android/view/TextureView.java
index ba62e65..32029ba 100644
--- a/core/java/android/view/TextureView.java
+++ b/core/java/android/view/TextureView.java
@@ -187,7 +187,9 @@ public class TextureView extends View {
public void setOpaque(boolean opaque) {
if (opaque != mOpaque) {
mOpaque = opaque;
- updateLayer();
+ if (mLayer != null) {
+ updateLayer();
+ }
}
}
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index adc6dda..1fa19d1 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -4483,10 +4483,8 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
getDrawingRect(bounds);
info.setBoundsInParent(bounds);
- int[] locationOnScreen = mAttachInfo.mInvalidateChildLocation;
- getLocationOnScreen(locationOnScreen);
- bounds.offsetTo(0, 0);
- bounds.offset(locationOnScreen[0], locationOnScreen[1]);
+ getGlobalVisibleRect(bounds);
+ bounds.offset(mAttachInfo.mWindowLeft, mAttachInfo.mWindowTop);
info.setBoundsInScreen(bounds);
if ((mPrivateFlags & IS_ROOT_NAMESPACE) == 0) {
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 899fb32..2e3ff38 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -5065,6 +5065,19 @@ public final class ViewRootImpl implements ViewParent,
}
/**
+ * Computes whether a view is visible on the screen.
+ *
+ * @param view The view to check.
+ * @return Whether the view is visible on the screen.
+ */
+ private boolean isDisplayedOnScreen(View view) {
+ return (view.mAttachInfo != null
+ && view.mAttachInfo.mWindowVisibility == View.VISIBLE
+ && view.getVisibility() == View.VISIBLE
+ && view.getGlobalVisibleRect(mTempRect));
+ }
+
+ /**
* Class for managing accessibility interactions initiated from the system
* and targeting the view hierarchy. A *ClientThread method is to be
* called from the interaction connection this ViewAncestor gives the
@@ -5175,7 +5188,7 @@ public final class ViewRootImpl implements ViewParent,
} else {
target = findViewByAccessibilityId(accessibilityViewId);
}
- if (target != null && target.getVisibility() == View.VISIBLE) {
+ if (target != null && isDisplayedOnScreen(target)) {
getAccessibilityNodePrefetcher().prefetchAccessibilityNodeInfos(target,
virtualDescendantId, prefetchFlags, infos);
}
@@ -5231,7 +5244,7 @@ public final class ViewRootImpl implements ViewParent,
}
if (root != null) {
View target = root.findViewById(viewId);
- if (target != null && target.getVisibility() == View.VISIBLE) {
+ if (target != null && isDisplayedOnScreen(target)) {
info = target.createAccessibilityNodeInfo();
}
}
@@ -5287,7 +5300,7 @@ public final class ViewRootImpl implements ViewParent,
} else {
target = ViewRootImpl.this.mView;
}
- if (target != null && target.getVisibility() == View.VISIBLE) {
+ if (target != null && isDisplayedOnScreen(target)) {
AccessibilityNodeProvider provider = target.getAccessibilityNodeProvider();
if (provider != null) {
infos = provider.findAccessibilityNodeInfosByText(text,
@@ -5304,7 +5317,7 @@ public final class ViewRootImpl implements ViewParent,
final int viewCount = foundViews.size();
for (int i = 0; i < viewCount; i++) {
View foundView = foundViews.get(i);
- if (foundView.getVisibility() == View.VISIBLE) {
+ if (isDisplayedOnScreen(foundView)) {
provider = foundView.getAccessibilityNodeProvider();
if (provider != null) {
List<AccessibilityNodeInfo> infosFromProvider =
@@ -5367,7 +5380,7 @@ public final class ViewRootImpl implements ViewParent,
boolean succeeded = false;
try {
View target = findViewByAccessibilityId(accessibilityViewId);
- if (target != null && target.getVisibility() == View.VISIBLE) {
+ if (target != null && isDisplayedOnScreen(target)) {
AccessibilityNodeProvider provider = target.getAccessibilityNodeProvider();
if (provider != null) {
succeeded = provider.performAccessibilityAction(action,
@@ -5505,7 +5518,7 @@ public final class ViewRootImpl implements ViewParent,
View child = parentGroup.getChildAt(i);
if (outInfos.size() < MAX_ACCESSIBILITY_NODE_INFO_BATCH_SIZE
&& child.getAccessibilityViewId() != current.getAccessibilityViewId()
- && child.getVisibility() == View.VISIBLE) {
+ && isDisplayedOnScreen(child)) {
final long childNodeId = AccessibilityNodeInfo.makeNodeId(
child.getAccessibilityViewId(), AccessibilityNodeInfo.UNDEFINED);
AccessibilityNodeInfo info = null;
@@ -5533,7 +5546,7 @@ public final class ViewRootImpl implements ViewParent,
final int childCount = rootGroup.getChildCount();
for (int i = 0; i < childCount; i++) {
View child = rootGroup.getChildAt(i);
- if (child.getVisibility() == View.VISIBLE
+ if (isDisplayedOnScreen(child)
&& outInfos.size() < MAX_ACCESSIBILITY_NODE_INFO_BATCH_SIZE) {
final long childNodeId = AccessibilityNodeInfo.makeNodeId(
child.getAccessibilityViewId(), AccessibilityNodeInfo.UNDEFINED);
diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java
index 66bdc5d..27baaea 100644
--- a/core/java/android/view/WindowManagerPolicy.java
+++ b/core/java/android/view/WindowManagerPolicy.java
@@ -667,7 +667,7 @@ public interface WindowManagerPolicy {
/**
* Create and return an animation to re-display a force hidden window.
*/
- public Animation createForceHideEnterAnimation();
+ public Animation createForceHideEnterAnimation(boolean onWallpaper);
/**
* Called from the input reader thread before a key is enqueued.
diff --git a/core/java/android/webkit/WebViewClassic.java b/core/java/android/webkit/WebViewClassic.java
index 9895a87..851fd22 100644
--- a/core/java/android/webkit/WebViewClassic.java
+++ b/core/java/android/webkit/WebViewClassic.java
@@ -828,6 +828,13 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
// if AUTO_REDRAW_HACK is true, then the CALL key will toggle redrawing
// the screen all-the-time. Good for profiling our drawing code
static private final boolean AUTO_REDRAW_HACK = false;
+
+ // The rate at which edit text is scrolled in content pixels per millisecond
+ static private final float TEXT_SCROLL_RATE = 0.01f;
+
+ // The presumed scroll rate for the first scroll of edit text
+ static private final long TEXT_SCROLL_FIRST_SCROLL_MS = 16;
+
// true means redraw the screen all-the-time. Only with AUTO_REDRAW_HACK
private boolean mAutoRedraw;
@@ -853,6 +860,7 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
boolean mIsEditingText = false;
ArrayList<Message> mBatchedTextChanges = new ArrayList<Message>();
boolean mIsBatchingTextChanges = false;
+ private long mLastEditScroll = 0;
private static class OnTrimMemoryListener implements ComponentCallbacks2 {
private static OnTrimMemoryListener sInstance = null;
@@ -1037,9 +1045,6 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
// pages with the space bar, in pixels.
private static final int PAGE_SCROLL_OVERLAP = 24;
- // Time between successive calls to text scroll fling animation
- private static final int TEXT_SCROLL_ANIMATION_DELAY_MS = 16;
-
/**
* These prevent calling requestLayout if either dimension is fixed. This
* depends on the layout parameters and the measure specs.
@@ -1207,7 +1212,7 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
static final int RELOCATE_AUTO_COMPLETE_POPUP = 146;
static final int FOCUS_NODE_CHANGED = 147;
static final int AUTOFILL_FORM = 148;
- static final int ANIMATE_TEXT_SCROLL = 149;
+ static final int SCROLL_EDIT_TEXT = 149;
static final int EDIT_TEXT_SIZE_CHANGED = 150;
static final int SHOW_CARET_HANDLE = 151;
static final int UPDATE_CONTENT_BOUNDS = 152;
@@ -6002,9 +6007,9 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
data.mNativeLayer = nativeScrollableLayer(
contentX, contentY, data.mNativeLayerRect, null);
data.mSlop = viewToContentDimension(mNavSlop);
- mTouchHighlightRegion.setEmpty();
+ removeTouchHighlight();
if (!mBlockWebkitViewMessages) {
- mTouchHighlightRequested = System.currentTimeMillis();
+ mTouchHighlightRequested = SystemClock.uptimeMillis();
mWebViewCore.sendMessageAtFrontOfQueue(
EventHub.HIT_TEST, data);
}
@@ -6091,6 +6096,11 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
mSelectDraggingTextQuad.containsPoint(handleX, handleY);
boolean inEditBounds = mEditTextContentBounds
.contains(handleX, handleY);
+ if (mIsEditingText && !inEditBounds) {
+ beginScrollEdit();
+ } else {
+ endScrollEdit();
+ }
if (inCursorText || (mIsEditingText && !inEditBounds)) {
snapDraggingCursor();
}
@@ -6240,6 +6250,7 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
break;
}
case MotionEvent.ACTION_UP: {
+ endScrollEdit();
if (!mConfirmMove && mIsEditingText && mSelectionStarted &&
mIsCaretSelection) {
showPasteWindow();
@@ -6335,6 +6346,86 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
}
}
+ /**
+ * Returns the text scroll speed in content pixels per millisecond based on
+ * the touch location.
+ * @param coordinate The x or y touch coordinate in content space
+ * @param min The minimum coordinate (x or y) of the edit content bounds
+ * @param max The maximum coordinate (x or y) of the edit content bounds
+ */
+ private static float getTextScrollSpeed(int coordinate, int min, int max) {
+ if (coordinate < min) {
+ return (coordinate - min) * TEXT_SCROLL_RATE;
+ } else if (coordinate >= max) {
+ return (coordinate - max + 1) * TEXT_SCROLL_RATE;
+ } else {
+ return 0.0f;
+ }
+ }
+
+ private void beginScrollEdit() {
+ if (mLastEditScroll == 0) {
+ mLastEditScroll = SystemClock.uptimeMillis() -
+ TEXT_SCROLL_FIRST_SCROLL_MS;
+ scrollEditWithCursor();
+ }
+ }
+
+ private void endScrollEdit() {
+ mLastEditScroll = 0;
+ }
+
+ private static int getTextScrollDelta(float speed, long deltaT) {
+ float distance = speed * deltaT;
+ int intDistance = (int)Math.floor(distance);
+ float probability = distance - intDistance;
+ if (Math.random() < probability) {
+ intDistance++;
+ }
+ return intDistance;
+ }
+ /**
+ * Scrolls edit text a distance based on the last touch point,
+ * the last scroll time, and the edit text content bounds.
+ */
+ private void scrollEditWithCursor() {
+ if (mLastEditScroll != 0) {
+ int x = viewToContentX(mLastTouchX + getScrollX() + mSelectDraggingOffset.x);
+ float scrollSpeedX = getTextScrollSpeed(x, mEditTextContentBounds.left,
+ mEditTextContentBounds.right);
+ int y = viewToContentY(mLastTouchY + getScrollY() + mSelectDraggingOffset.y);
+ float scrollSpeedY = getTextScrollSpeed(y, mEditTextContentBounds.top,
+ mEditTextContentBounds.bottom);
+ if (scrollSpeedX == 0.0f && scrollSpeedY == 0.0f) {
+ endScrollEdit();
+ } else {
+ long currentTime = SystemClock.uptimeMillis();
+ long timeSinceLastUpdate = currentTime - mLastEditScroll;
+ int deltaX = getTextScrollDelta(scrollSpeedX, timeSinceLastUpdate);
+ int deltaY = getTextScrollDelta(scrollSpeedY, timeSinceLastUpdate);
+ mLastEditScroll = currentTime;
+ if (deltaX == 0 && deltaY == 0) {
+ // By probability no text scroll this time. Try again later.
+ mPrivateHandler.sendEmptyMessageDelayed(SCROLL_EDIT_TEXT,
+ TEXT_SCROLL_FIRST_SCROLL_MS);
+ } else {
+ int scrollX = getTextScrollX() + deltaX;
+ scrollX = Math.min(getMaxTextScrollX(), scrollX);
+ scrollX = Math.max(0, scrollX);
+ int scrollY = getTextScrollY() + deltaY;
+ scrollY = Math.min(getMaxTextScrollY(), scrollY);
+ scrollY = Math.max(0, scrollY);
+ scrollEditText(scrollX, scrollY);
+ int cursorX = mSelectDraggingCursor.x;
+ int cursorY = mSelectDraggingCursor.y;
+ mSelectDraggingCursor.set(x - deltaX, y - deltaY);
+ updateWebkitSelection();
+ mSelectDraggingCursor.set(cursorX, cursorY);
+ }
+ }
+ }
+ }
+
private void startTouch(float x, float y, long eventTime) {
// Remember where the motion event started
mStartTouchX = mLastTouchX = Math.round(x);
@@ -7673,10 +7764,6 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
msg.arg1, /* unused */0);
break;
- case ANIMATE_TEXT_SCROLL:
- computeEditTextScroll();
- break;
-
case EDIT_TEXT_SIZE_CHANGED:
if (msg.arg1 == mFieldPointer) {
mEditTextContent.set((Rect)msg.obj);
@@ -7695,6 +7782,10 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
mEditTextContentBounds.set((Rect) msg.obj);
break;
+ case SCROLL_EDIT_TEXT:
+ scrollEditWithCursor();
+ break;
+
default:
super.handleMessage(msg);
break;
@@ -7777,13 +7868,16 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
if (mFocusedNode.mHasFocus && mFocusedNode.mEditable) {
return false;
}
- long delay = System.currentTimeMillis() - mTouchHighlightRequested;
+ long delay = SystemClock.uptimeMillis() - mTouchHighlightRequested;
if (delay < ViewConfiguration.getTapTimeout()) {
Rect r = mTouchHighlightRegion.getBounds();
mWebView.postInvalidateDelayed(delay, r.left, r.top, r.right, r.bottom);
return false;
}
- return true;
+ if (mInputDispatcher == null) {
+ return false;
+ }
+ return mInputDispatcher.shouldShowTapHighlight();
}
@@ -7893,8 +7987,8 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
if (viewRect.width() < getWidth() >> 1
|| viewRect.height() < getHeight() >> 1) {
mTouchHighlightRegion.union(viewRect);
- } else {
- Log.w(LOGTAG, "Skip the huge selection rect:"
+ } else if (DebugFlags.WEB_VIEW) {
+ Log.d(LOGTAG, "Skip the huge selection rect:"
+ viewRect);
}
}
@@ -8005,6 +8099,7 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
if (isPictureAfterFirstLayout) {
mViewManager.postReadyToDrawAll();
}
+ scrollEditWithCursor();
}
/**
@@ -8047,13 +8142,6 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
invalidate();
}
- private void computeEditTextScroll() {
- if (mEditTextScroller.computeScrollOffset()) {
- scrollEditText(mEditTextScroller.getCurrX(),
- mEditTextScroller.getCurrY());
- }
- }
-
private void scrollEditText(int scrollX, int scrollY) {
// Scrollable edit text. Scroll it.
float maxScrollX = getMaxTextScrollX();
@@ -8061,8 +8149,6 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
mEditTextContent.offsetTo(-scrollX, -scrollY);
mWebViewCore.sendMessageAtFrontOfQueue(EventHub.SCROLL_TEXT_INPUT, 0,
scrollY, (Float)scrollPercentX);
- mPrivateHandler.sendEmptyMessageDelayed(ANIMATE_TEXT_SCROLL,
- TEXT_SCROLL_ANIMATION_DELAY_MS);
}
private void beginTextBatch() {
diff --git a/core/java/android/webkit/WebViewInputDispatcher.java b/core/java/android/webkit/WebViewInputDispatcher.java
index e7024d9..c8677ec 100644
--- a/core/java/android/webkit/WebViewInputDispatcher.java
+++ b/core/java/android/webkit/WebViewInputDispatcher.java
@@ -349,6 +349,12 @@ final class WebViewInputDispatcher {
}
}
+ public boolean shouldShowTapHighlight() {
+ synchronized (mLock) {
+ return mPostLongPressScheduled || mPostClickScheduled;
+ }
+ }
+
private void postLongPress() {
synchronized (mLock) {
if (!mPostLongPressScheduled) {
diff --git a/core/java/android/widget/CheckBox.java b/core/java/android/widget/CheckBox.java
index 0685eea..858c415 100644
--- a/core/java/android/widget/CheckBox.java
+++ b/core/java/android/widget/CheckBox.java
@@ -21,8 +21,6 @@ import android.util.AttributeSet;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
-import com.android.internal.R;
-
/**
* <p>
@@ -71,16 +69,6 @@ public class CheckBox extends CompoundButton {
}
@Override
- public void onPopulateAccessibilityEvent(AccessibilityEvent event) {
- super.onPopulateAccessibilityEvent(event);
- if (isChecked()) {
- event.getText().add(mContext.getString(R.string.checkbox_checked));
- } else {
- event.getText().add(mContext.getString(R.string.checkbox_not_checked));
- }
- }
-
- @Override
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(event);
event.setClassName(CheckBox.class.getName());
diff --git a/core/java/android/widget/NumberPicker.java b/core/java/android/widget/NumberPicker.java
index d897a39..b2321d9 100644
--- a/core/java/android/widget/NumberPicker.java
+++ b/core/java/android/widget/NumberPicker.java
@@ -579,7 +579,7 @@ public class NumberPicker extends LinearLayout {
throw new IllegalArgumentException("minWidth > maxWidth");
}
- mComputeMaxWidth = (mMaxWidth == Integer.MAX_VALUE);
+ mComputeMaxWidth = (mMaxWidth == SIZE_UNSPECIFIED);
attributesArray.recycle();
@@ -771,6 +771,8 @@ public class NumberPicker extends LinearLayout {
mLastDownEventTime = event.getEventTime();
mIngonreMoveEvents = false;
mShowSoftInputOnTap = false;
+ // Make sure we wupport flinging inside scrollables.
+ getParent().requestDisallowInterceptTouchEvent(true);
if (!mFlingScroller.isFinished()) {
mFlingScroller.forceFinished(true);
mAdjustScroller.forceFinished(true);
@@ -1096,12 +1098,7 @@ public class NumberPicker extends LinearLayout {
* @see #setMaxValue(int)
*/
public void setValue(int value) {
- if (mValue == value) {
- return;
- }
setValueInternal(value, false);
- initializeSelectorWheelIndices();
- invalidate();
}
/**
@@ -1498,6 +1495,8 @@ public class NumberPicker extends LinearLayout {
if (notifyChange) {
notifyChange(previous, current);
}
+ initializeSelectorWheelIndices();
+ invalidate();
}
/**
diff --git a/core/java/android/widget/Switch.java b/core/java/android/widget/Switch.java
index a897cc3..0786909 100644
--- a/core/java/android/widget/Switch.java
+++ b/core/java/android/widget/Switch.java
@@ -806,5 +806,16 @@ public class Switch extends CompoundButton {
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
info.setClassName(Switch.class.getName());
+ CharSequence switchText = isChecked() ? mTextOn : mTextOff;
+ if (!TextUtils.isEmpty(switchText)) {
+ CharSequence oldText = info.getText();
+ if (TextUtils.isEmpty(oldText)) {
+ info.setText(switchText);
+ } else {
+ StringBuilder newText = new StringBuilder();
+ newText.append(oldText).append(' ').append(switchText);
+ info.setText(newText);
+ }
+ }
}
}
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index 879b9d2..b877071 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -549,6 +549,10 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv)
opt.optionString = heapsizeOptsBuf;
mOptions.add(opt);
+ // Increase the main thread's interpreter stack size for bug 6315322.
+ opt.optionString = "-XX:mainThreadStackSize=24K";
+ mOptions.add(opt);
+
strcpy(heapgrowthlimitOptsBuf, "-XX:HeapGrowthLimit=");
property_get("dalvik.vm.heapgrowthlimit", heapgrowthlimitOptsBuf+20, "");
if (heapgrowthlimitOptsBuf[20] != '\0') {
diff --git a/core/jni/android/graphics/Paint.cpp b/core/jni/android/graphics/Paint.cpp
index 376c841..a65262c 100644
--- a/core/jni/android/graphics/Paint.cpp
+++ b/core/jni/android/graphics/Paint.cpp
@@ -254,6 +254,13 @@ public:
obj->setTextAlign(align);
}
+ static void setTextLocale(JNIEnv* env, jobject clazz, SkPaint* obj, jstring locale) {
+ const char* localeArray = env->GetStringUTFChars(locale, NULL);
+ SkString skLocale(localeArray);
+ obj->setTextLocale(skLocale);
+ env->ReleaseStringUTFChars(locale, localeArray);
+ }
+
static jfloat getTextSize(JNIEnv* env, jobject paint) {
NPE_CHECK_RETURN_ZERO(env, paint);
return SkScalarToFloat(GraphicsJNI::getNativePaint(env, paint)->getTextSize());
@@ -817,6 +824,7 @@ static JNINativeMethod methods[] = {
{"native_setRasterizer","(II)I", (void*) SkPaintGlue::setRasterizer},
{"native_getTextAlign","(I)I", (void*) SkPaintGlue::getTextAlign},
{"native_setTextAlign","(II)V", (void*) SkPaintGlue::setTextAlign},
+ {"native_setTextLocale","(ILjava/lang/String;)V", (void*) SkPaintGlue::setTextLocale},
{"getTextSize","()F", (void*) SkPaintGlue::getTextSize},
{"setTextSize","(F)V", (void*) SkPaintGlue::setTextSize},
{"getTextScaleX","()F", (void*) SkPaintGlue::getTextScaleX},
diff --git a/core/jni/android/graphics/TextLayoutCache.cpp b/core/jni/android/graphics/TextLayoutCache.cpp
index a7abbfa..a97c710 100644
--- a/core/jni/android/graphics/TextLayoutCache.cpp
+++ b/core/jni/android/graphics/TextLayoutCache.cpp
@@ -29,10 +29,7 @@ extern "C" {
namespace android {
//--------------------------------------------------------------------------------------------------
-// Using DroidSansArabic for shaping Arabic with Harfbuzz because its metrics are more compatible
-// with the "Roboto" metrics (compared to DroidNaskh-Regular). When we will have an Arabic font
-// whose metrics are similar to the Roboto ones, then we will need to use it for shaping.
-#define TYPEFACE_ARABIC "/system/fonts/DroidSansArabic.ttf"
+#define TYPEFACE_ARABIC "/system/fonts/DroidNaskh-Regular-Shift.ttf"
#define TYPE_FACE_HEBREW_REGULAR "/system/fonts/DroidSansHebrew-Regular.ttf"
#define TYPE_FACE_HEBREW_BOLD "/system/fonts/DroidSansHebrew-Bold.ttf"
#define TYPEFACE_BENGALI "/system/fonts/Lohit-Bengali.ttf"
diff --git a/core/res/res/anim/lock_screen_behind_enter.xml b/core/res/res/anim/lock_screen_behind_enter.xml
index 4f58be4..6b06456 100644
--- a/core/res/res/anim/lock_screen_behind_enter.xml
+++ b/core/res/res/anim/lock_screen_behind_enter.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
-** Copyright 2007, The Android Open Source Project
+** Copyright 2012, 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.
@@ -18,7 +18,7 @@
-->
<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:detachWallpaper="true" android:shareInterpolator="false">
+ android:background="#ff000000" android:shareInterpolator="false">
<scale
android:fromXScale="0.95" android:toXScale="1.0"
android:fromYScale="0.95" android:toYScale="1.0"
diff --git a/core/res/res/anim/lock_screen_wallpaper_behind_enter.xml b/core/res/res/anim/lock_screen_wallpaper_behind_enter.xml
new file mode 100644
index 0000000..a354fae
--- /dev/null
+++ b/core/res/res/anim/lock_screen_wallpaper_behind_enter.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2007, 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.
+*/
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+ android:detachWallpaper="true" android:shareInterpolator="false">
+ <scale
+ android:fromXScale="0.95" android:toXScale="1.0"
+ android:fromYScale="0.95" android:toYScale="1.0"
+ android:pivotX="50%p" android:pivotY="50%p"
+ android:fillEnabled="true" android:fillBefore="true"
+ android:interpolator="@interpolator/decelerate_cubic"
+ android:startOffset="@android:integer/config_shortAnimTime"
+ android:duration="@android:integer/config_shortAnimTime" />
+ <alpha
+ android:fromAlpha="0.0" android:toAlpha="1.0"
+ android:fillEnabled="true" android:fillBefore="true"
+ android:interpolator="@interpolator/decelerate_quad"
+ android:startOffset="@android:integer/config_shortAnimTime"
+ android:duration="@android:integer/config_shortAnimTime"/>
+</set>
diff --git a/core/res/res/anim/screen_rotate_180_enter.xml b/core/res/res/anim/screen_rotate_180_enter.xml
index e2f3ce2..688a8d5 100644
--- a/core/res/res/anim/screen_rotate_180_enter.xml
+++ b/core/res/res/anim/screen_rotate_180_enter.xml
@@ -24,5 +24,5 @@
android:interpolator="@interpolator/decelerate_quint"
android:fillEnabled="true"
android:fillBefore="true" android:fillAfter="true"
- android:duration="@android:integer/config_longAnimTime" />
+ android:duration="@android:integer/config_mediumAnimTime" />
</set>
diff --git a/core/res/res/anim/screen_rotate_180_exit.xml b/core/res/res/anim/screen_rotate_180_exit.xml
index fe4a950..1eb6361 100644
--- a/core/res/res/anim/screen_rotate_180_exit.xml
+++ b/core/res/res/anim/screen_rotate_180_exit.xml
@@ -24,5 +24,8 @@
android:interpolator="@interpolator/decelerate_quint"
android:fillEnabled="true"
android:fillBefore="true" android:fillAfter="true"
- android:duration="@android:integer/config_longAnimTime" />
+ android:duration="@android:integer/config_mediumAnimTime" />
+ <alpha android:fromAlpha="1.0" android:toAlpha="0"
+ android:interpolator="@interpolator/decelerate_cubic"
+ android:duration="@android:integer/config_mediumAnimTime"/>
</set> \ No newline at end of file
diff --git a/core/res/res/anim/screen_rotate_180_frame.xml b/core/res/res/anim/screen_rotate_180_frame.xml
index 1a3ee67..19dade1 100644
--- a/core/res/res/anim/screen_rotate_180_frame.xml
+++ b/core/res/res/anim/screen_rotate_180_frame.xml
@@ -24,5 +24,5 @@
android:interpolator="@interpolator/decelerate_quint"
android:fillEnabled="true"
android:fillBefore="true" android:fillAfter="true"
- android:duration="@android:integer/config_longAnimTime" />
+ android:duration="@android:integer/config_mediumAnimTime" />
</set>
diff --git a/core/res/res/anim/screen_rotate_minus_90_enter.xml b/core/res/res/anim/screen_rotate_minus_90_enter.xml
index 38a674d..b16d5fc 100644
--- a/core/res/res/anim/screen_rotate_minus_90_enter.xml
+++ b/core/res/res/anim/screen_rotate_minus_90_enter.xml
@@ -19,10 +19,18 @@
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
+ <!-- Version for two-phase anim
<rotate android:fromDegrees="-90" android:toDegrees="0"
android:pivotX="50%" android:pivotY="50%"
android:interpolator="@interpolator/decelerate_quint"
android:fillEnabled="true"
android:fillBefore="true" android:fillAfter="true"
android:duration="@android:integer/config_longAnimTime" />
+ -->
+ <rotate android:fromDegrees="-90" android:toDegrees="0"
+ android:pivotX="50%" android:pivotY="50%"
+ android:fillEnabled="true"
+ android:fillBefore="true" android:fillAfter="true"
+ android:interpolator="@interpolator/decelerate_quint"
+ android:duration="@android:integer/config_mediumAnimTime" />
</set>
diff --git a/core/res/res/anim/screen_rotate_minus_90_exit.xml b/core/res/res/anim/screen_rotate_minus_90_exit.xml
index a75aca7..9b38939 100644
--- a/core/res/res/anim/screen_rotate_minus_90_exit.xml
+++ b/core/res/res/anim/screen_rotate_minus_90_exit.xml
@@ -19,10 +19,30 @@
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
+ <!-- Version for two-phase animation
<rotate android:fromDegrees="0" android:toDegrees="90"
android:pivotX="50%" android:pivotY="50%"
android:interpolator="@interpolator/decelerate_quint"
android:fillEnabled="true"
android:fillBefore="true" android:fillAfter="true"
android:duration="@android:integer/config_longAnimTime" />
+ -->
+ <scale android:fromXScale="100%" android:toXScale="100%p"
+ android:fromYScale="100%" android:toYScale="100%p"
+ android:pivotX="50%" android:pivotY="50%"
+ android:interpolator="@interpolator/decelerate_quint"
+ android:fillEnabled="true"
+ android:fillBefore="true" android:fillAfter="true"
+ android:duration="@android:integer/config_mediumAnimTime" />
+ <rotate android:fromDegrees="0" android:toDegrees="90"
+ android:pivotX="50%" android:pivotY="50%"
+ android:interpolator="@interpolator/decelerate_quint"
+ android:fillEnabled="true"
+ android:fillBefore="true" android:fillAfter="true"
+ android:duration="@android:integer/config_mediumAnimTime" />
+ <alpha android:fromAlpha="1.0" android:toAlpha="0"
+ android:interpolator="@interpolator/decelerate_quint"
+ android:fillEnabled="true"
+ android:fillBefore="true" android:fillAfter="true"
+ android:duration="@android:integer/config_mediumAnimTime" />
</set>
diff --git a/core/res/res/anim/screen_rotate_plus_90_enter.xml b/core/res/res/anim/screen_rotate_plus_90_enter.xml
index 583d2ba..86a8d24 100644
--- a/core/res/res/anim/screen_rotate_plus_90_enter.xml
+++ b/core/res/res/anim/screen_rotate_plus_90_enter.xml
@@ -19,10 +19,18 @@
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
+ <!-- Version for two-phase animation
<rotate android:fromDegrees="90" android:toDegrees="0"
android:pivotX="50%" android:pivotY="50%"
android:interpolator="@interpolator/decelerate_quint"
android:fillEnabled="true"
android:fillBefore="true" android:fillAfter="true"
android:duration="@android:integer/config_longAnimTime" />
+ -->
+ <rotate android:fromDegrees="90" android:toDegrees="0"
+ android:pivotX="50%" android:pivotY="50%"
+ android:interpolator="@interpolator/decelerate_quint"
+ android:fillEnabled="true"
+ android:fillBefore="true" android:fillAfter="true"
+ android:duration="@android:integer/config_mediumAnimTime" />
</set>
diff --git a/core/res/res/anim/screen_rotate_plus_90_exit.xml b/core/res/res/anim/screen_rotate_plus_90_exit.xml
index a2bef41..fa34533 100644
--- a/core/res/res/anim/screen_rotate_plus_90_exit.xml
+++ b/core/res/res/anim/screen_rotate_plus_90_exit.xml
@@ -19,10 +19,30 @@
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
+ <!-- Version for two-phase animation
<rotate android:fromDegrees="0" android:toDegrees="-90"
android:pivotX="50%" android:pivotY="50%"
android:interpolator="@interpolator/decelerate_quint"
android:fillEnabled="true"
android:fillBefore="true" android:fillAfter="true"
android:duration="@android:integer/config_longAnimTime" />
+ -->
+ <scale android:fromXScale="100%" android:toXScale="100%p"
+ android:fromYScale="100%" android:toYScale="100%p"
+ android:pivotX="50%" android:pivotY="50%"
+ android:interpolator="@interpolator/decelerate_quint"
+ android:fillEnabled="true"
+ android:fillBefore="true" android:fillAfter="true"
+ android:duration="@android:integer/config_mediumAnimTime" />
+ <rotate android:fromDegrees="0" android:toDegrees="-90"
+ android:pivotX="50%" android:pivotY="50%"
+ android:interpolator="@interpolator/decelerate_quint"
+ android:fillEnabled="true"
+ android:fillBefore="true" android:fillAfter="true"
+ android:duration="@android:integer/config_mediumAnimTime" />
+ <alpha android:fromAlpha="1.0" android:toAlpha="0"
+ android:interpolator="@interpolator/decelerate_quint"
+ android:fillEnabled="true"
+ android:fillBefore="true" android:fillAfter="true"
+ android:duration="@android:integer/config_mediumAnimTime" />
</set>
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index aaef701..d7def44 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -400,8 +400,6 @@
<java-symbol type="string" name="cfTemplateNotForwarded" />
<java-symbol type="string" name="cfTemplateRegistered" />
<java-symbol type="string" name="cfTemplateRegisteredTime" />
- <java-symbol type="string" name="checkbox_checked" />
- <java-symbol type="string" name="checkbox_not_checked" />
<java-symbol type="string" name="chooseActivity" />
<java-symbol type="string" name="config_default_dns_server" />
<java-symbol type="string" name="config_ethernet_iface_regex" />
@@ -701,8 +699,6 @@
<java-symbol type="string" name="preposition_for_time" />
<java-symbol type="string" name="progress_erasing" />
<java-symbol type="string" name="progress_unmounting" />
- <java-symbol type="string" name="radiobutton_not_selected" />
- <java-symbol type="string" name="radiobutton_selected" />
<java-symbol type="string" name="relationTypeAssistant" />
<java-symbol type="string" name="relationTypeBrother" />
<java-symbol type="string" name="relationTypeChild" />
@@ -797,8 +793,6 @@
<java-symbol type="string" name="sms_control_title" />
<java-symbol type="string" name="sms_control_yes" />
<java-symbol type="string" name="submit" />
- <java-symbol type="string" name="switch_off" />
- <java-symbol type="string" name="switch_on" />
<java-symbol type="string" name="sync_binding_label" />
<java-symbol type="string" name="sync_do_nothing" />
<java-symbol type="string" name="sync_really_delete" />
@@ -820,8 +814,6 @@
<java-symbol type="string" name="time_wday" />
<java-symbol type="string" name="time_wday_date" />
<java-symbol type="string" name="today" />
- <java-symbol type="string" name="togglebutton_not_pressed" />
- <java-symbol type="string" name="togglebutton_pressed" />
<java-symbol type="string" name="tomorrow" />
<java-symbol type="string" name="twelve_hour_time_format" />
<java-symbol type="string" name="twenty_four_hour_time_format" />
@@ -1133,6 +1125,7 @@
<!-- From android.policy -->
<java-symbol type="anim" name="app_starting_exit" />
<java-symbol type="anim" name="lock_screen_behind_enter" />
+ <java-symbol type="anim" name="lock_screen_wallpaper_behind_enter" />
<java-symbol type="anim" name="dock_top_enter" />
<java-symbol type="anim" name="dock_top_exit" />
<java-symbol type="anim" name="dock_bottom_enter" />
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 0eb46bd..968b51c 100755
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -3241,30 +3241,6 @@
<!-- Description of the button to decrease the DatePicker's year value. [CHAR LIMIT=NONE] -->
<string name="date_picker_decrement_year_button">Decrease year</string>
- <!-- CheckBox - accessibility support -->
- <!-- Description of the checked state of a CheckBox. [CHAR LIMIT=NONE] -->
- <string name="checkbox_checked">checked</string>
- <!-- Description of the not checked state of a CheckBox. [CHAR LIMIT=NONE] -->
- <string name="checkbox_not_checked">not checked</string>
-
- <!-- RadioButton/CheckedTextView - accessibility support -->
- <!-- Description of the selected state of a RadioButton. [CHAR LIMIT=NONE] -->
- <string name="radiobutton_selected">selected</string>
- <!-- Description of the not selected state of a RadioButton. [CHAR LIMIT=NONE] -->
- <string name="radiobutton_not_selected">not selected</string>
-
- <!-- Switch - accessibility support -->
- <!-- Description of the on state of a Switch. [CHAR LIMIT=NONE] -->
- <string name="switch_on">on</string>
- <!-- Description of the off state of a Switch. [CHAR LIMIT=NONE] -->
- <string name="switch_off">off</string>
-
- <!-- ToggleButton - accessibility support -->
- <!-- Description of the pressed state of a ToggleButton. [CHAR LIMIT=NONE] -->
- <string name="togglebutton_pressed">pressed</string>
- <!-- Description of the not pressed state of a ToggleButton. [CHAR LIMIT=NONE] -->
- <string name="togglebutton_not_pressed">not pressed</string>
-
<!-- KeyboardView - accessibility support -->
<!-- Description of the Alt button in a KeyboardView. [CHAR LIMIT=NONE] -->
<string name="keyboardview_keycode_alt">Alt</string>
diff --git a/data/fonts/Android.mk b/data/fonts/Android.mk
index 5ba6bf9..85a77d6 100644
--- a/data/fonts/Android.mk
+++ b/data/fonts/Android.mk
@@ -124,8 +124,8 @@ font_src_files := \
Roboto-Bold.ttf \
Roboto-Italic.ttf \
Roboto-BoldItalic.ttf \
- DroidSansArabic.ttf \
DroidNaskh-Regular.ttf \
+ DroidNaskh-Regular-Shift.ttf \
DroidSansHebrew-Regular.ttf \
DroidSansHebrew-Bold.ttf \
DroidSansThai.ttf \
diff --git a/data/fonts/DroidNaskh-Regular-Shift.ttf b/data/fonts/DroidNaskh-Regular-Shift.ttf
new file mode 100644
index 0000000..0cb843d
--- /dev/null
+++ b/data/fonts/DroidNaskh-Regular-Shift.ttf
Binary files differ
diff --git a/data/fonts/fallback_fonts-ja.xml b/data/fonts/fallback_fonts-ja.xml
index 62491d8..db998d3 100644
--- a/data/fonts/fallback_fonts-ja.xml
+++ b/data/fonts/fallback_fonts-ja.xml
@@ -34,7 +34,7 @@
<familyset>
<family>
<fileset>
- <file>DroidSansArabic.ttf</file>
+ <file>DroidNaskh-Regular-Shift.ttf</file>
</fileset>
</family>
<family>
diff --git a/data/fonts/fallback_fonts.xml b/data/fonts/fallback_fonts.xml
index ba01947..a4b5212 100644
--- a/data/fonts/fallback_fonts.xml
+++ b/data/fonts/fallback_fonts.xml
@@ -34,7 +34,7 @@
<familyset>
<family>
<fileset>
- <file>DroidSansArabic.ttf</file>
+ <file>DroidNaskh-Regular-Shift.ttf</file>
</fileset>
</family>
<family>
diff --git a/data/fonts/fonts.mk b/data/fonts/fonts.mk
index db26765..702b069 100644
--- a/data/fonts/fonts.mk
+++ b/data/fonts/fonts.mk
@@ -24,8 +24,8 @@ PRODUCT_PACKAGES := \
Roboto-Bold.ttf \
Roboto-Italic.ttf \
Roboto-BoldItalic.ttf \
- DroidSansArabic.ttf \
DroidNaskh-Regular.ttf \
+ DroidNaskh-Regular-Shift.ttf \
DroidSansHebrew-Regular.ttf \
DroidSansHebrew-Bold.ttf \
DroidSansThai.ttf \
diff --git a/graphics/java/android/graphics/ImageFormat.java b/graphics/java/android/graphics/ImageFormat.java
index 7269a71..b3a8fd7 100644
--- a/graphics/java/android/graphics/ImageFormat.java
+++ b/graphics/java/android/graphics/ImageFormat.java
@@ -25,34 +25,38 @@ public class ImageFormat {
public static final int UNKNOWN = 0;
/**
- * RGB format used for pictures encoded as RGB_565 see
+ * RGB format used for pictures encoded as RGB_565. See
* {@link android.hardware.Camera.Parameters#setPictureFormat(int)}.
*/
public static final int RGB_565 = 4;
/**
- * Android YUV format:
+ * <p>Android YUV format.</p>
*
- * This format is exposed to software decoders and applications.
+ * <p>This format is exposed to software decoders and applications.</p>
*
- * YV12 is a 4:2:0 YCrCb planar format comprised of a WxH Y plane followed
- * by (W/2) x (H/2) Cr and Cb planes.
+ * <p>YV12 is a 4:2:0 YCrCb planar format comprised of a WxH Y plane followed
+ * by (W/2) x (H/2) Cr and Cb planes.</p>
*
- * This format assumes
- * - an even width
- * - an even height
- * - a horizontal stride multiple of 16 pixels
- * - a vertical stride equal to the height
+ * <p>This format assumes
+ * <ul>
+ * <li>an even width</li>
+ * <li>an even height</li>
+ * <li>a horizontal stride multiple of 16 pixels</li>
+ * <li>a vertical stride equal to the height</li>
+ * </ul>
+ * </p>
*
- * y_size = stride * height
- * c_size = ALIGN(stride/2, 16) * height/2
- * size = y_size + c_size * 2
- * cr_offset = y_size
- * cb_offset = y_size + c_size
+ * <pre> y_size = stride * height
+ * c_size = ALIGN(stride/2, 16) * height/2
+ * size = y_size + c_size * 2
+ * cr_offset = y_size
+ * cb_offset = y_size + c_size</pre>
*
- * Whether this format is supported by the camera hardware can be determined
- * by
+ * This format is guaranteed to be supported for camera preview images since
+ * API level 12; for earlier API versions, check
* {@link android.hardware.Camera.Parameters#getSupportedPreviewFormats()}.
+ * </p>
*/
public static final int YV12 = 0x32315659;
diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java
index c97785e..8cb8466 100644
--- a/graphics/java/android/graphics/Paint.java
+++ b/graphics/java/android/graphics/Paint.java
@@ -21,6 +21,8 @@ import android.text.SpannableString;
import android.text.SpannedString;
import android.text.TextUtils;
+import java.util.Locale;
+
/**
* The Paint class holds the style and color information about how to draw
* geometries, text and bitmaps.
@@ -44,6 +46,8 @@ public class Paint {
private float mCompatScaling;
private float mInvCompatScaling;
+ private Locale mLocale;
+
/**
* @hide
*/
@@ -348,6 +352,7 @@ public class Paint {
// setHinting(DisplayMetrics.DENSITY_DEVICE >= DisplayMetrics.DENSITY_TV
// ? HINTING_OFF : HINTING_ON);
mCompatScaling = mInvCompatScaling = 1;
+ mLocale = Locale.getDefault();
}
/**
@@ -360,6 +365,7 @@ public class Paint {
public Paint(Paint paint) {
mNativePaint = native_initWithPaint(paint.mNativePaint);
setClassVariablesFrom(paint);
+ mLocale = paint.mLocale;
}
/** Restores the paint to its default settings. */
@@ -373,6 +379,7 @@ public class Paint {
mHasCompatScaling = false;
mCompatScaling = mInvCompatScaling = 1;
mBidiFlags = BIDI_DEFAULT_LTR;
+ mLocale = Locale.getDefault();
}
/**
@@ -412,6 +419,7 @@ public class Paint {
shadowColor = paint.shadowColor;
mBidiFlags = paint.mBidiFlags;
+ mLocale = paint.mLocale;
}
/** @hide */
@@ -1045,6 +1053,36 @@ public class Paint {
}
/**
+ * Get the text Locale.
+ *
+ * @return the paint's Locale used for drawing text, never null.
+ */
+ public Locale getTextLocale() {
+ return mLocale;
+ }
+
+ /**
+ * Set the text locale.
+ *
+ * This controls how the text will be drawn. Providing the ROOT Locale (default case)
+ * means that the text will be drawn with the font corresponding to its script.
+ *
+ * Using the CHINESE or CHINA Locale means that the text will be drawn with a Chinese font.
+ * Using the JAPANESE or JAPAN Locale means that the text will be drawn with a Japanese font.
+ * Using the KOREAN or KOREA Locale means that the text will be drawn with a Korean font.
+ *
+ * @param locale the paint's locale value for drawing text, must not be null.
+ */
+ public void setTextLocale(Locale locale) {
+ if (locale == null) {
+ throw new IllegalArgumentException("locale cannot be null");
+ }
+ if (locale.equals(mLocale)) return;
+ mLocale = locale;
+ native_setTextLocale(mNativePaint, locale.toString());
+ }
+
+ /**
* Return the paint's text size.
*
* @return the paint's text size.
@@ -2144,6 +2182,9 @@ public class Paint {
private static native void native_setTextAlign(int native_object,
int align);
+ private static native void native_setTextLocale(int native_object,
+ String locale);
+
private static native int native_getTextWidths(int native_object,
char[] text, int index, int count, float[] widths);
private static native int native_getTextWidths(int native_object,
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java
index cd5300d..10ccb87 100644
--- a/graphics/java/android/renderscript/Allocation.java
+++ b/graphics/java/android/renderscript/Allocation.java
@@ -136,7 +136,6 @@ public class Allocation extends BaseObj {
* consumer. This usage will cause the allocation to be created
* read only.
*
- * @hide
*/
public static final int USAGE_IO_INPUT = 0x0020;
@@ -145,7 +144,6 @@ public class Allocation extends BaseObj {
* SurfaceTexture producer. The dimensions and format of the
* SurfaceTexture will be forced to those of the allocation.
*
- * @hide
*/
public static final int USAGE_IO_OUTPUT = 0x0040;
@@ -193,8 +191,8 @@ public class Allocation extends BaseObj {
/**
* Get the element of the type of the Allocation.
*
- * @hide
- * @return Element
+ * @return Element that describes the structure of data in the
+ * allocation
*
*/
public Element getElement() {
@@ -204,8 +202,8 @@ public class Allocation extends BaseObj {
/**
* Get the usage flags of the Allocation.
*
- * @hide
- * @return usage
+ * @return usage flags associated with the allocation. e.g.
+ * script, texture, etc.
*
*/
public int getUsage() {
@@ -215,12 +213,11 @@ public class Allocation extends BaseObj {
/**
* Get the size of the Allocation in bytes.
*
- * @hide
- * @return sizeInBytes
+ * @return size of the Allocation in bytes.
*
*/
- public int getSizeBytes() {
- return mType.getCount() * mType.getElement().getSizeBytes();
+ public int getBytesSize() {
+ return mType.getCount() * mType.getElement().getBytesSize();
}
private void updateCacheInfo(Type t) {
@@ -362,8 +359,6 @@ public class Allocation extends BaseObj {
* Send a buffer to the output stream. The contents of the
* Allocation will be undefined after this operation.
*
- * @hide
- *
*/
public void ioSend() {
if ((mUsage & USAGE_IO_OUTPUT) == 0) {
@@ -385,8 +380,6 @@ public class Allocation extends BaseObj {
/**
* Receive the latest input into the Allocation.
*
- * @hide
- *
*/
public void ioReceive() {
if ((mUsage & USAGE_IO_INPUT) == 0) {
@@ -424,37 +417,37 @@ public class Allocation extends BaseObj {
throw new RSIllegalArgumentException("Allocation kind is " +
mType.getElement().mKind + ", type " +
mType.getElement().mType +
- " of " + mType.getElement().getSizeBytes() +
+ " of " + mType.getElement().getBytesSize() +
" bytes, passed bitmap was " + bc);
}
break;
case ARGB_8888:
if ((mType.getElement().mKind != Element.DataKind.PIXEL_RGBA) ||
- (mType.getElement().getSizeBytes() != 4)) {
+ (mType.getElement().getBytesSize() != 4)) {
throw new RSIllegalArgumentException("Allocation kind is " +
mType.getElement().mKind + ", type " +
mType.getElement().mType +
- " of " + mType.getElement().getSizeBytes() +
+ " of " + mType.getElement().getBytesSize() +
" bytes, passed bitmap was " + bc);
}
break;
case RGB_565:
if ((mType.getElement().mKind != Element.DataKind.PIXEL_RGB) ||
- (mType.getElement().getSizeBytes() != 2)) {
+ (mType.getElement().getBytesSize() != 2)) {
throw new RSIllegalArgumentException("Allocation kind is " +
mType.getElement().mKind + ", type " +
mType.getElement().mType +
- " of " + mType.getElement().getSizeBytes() +
+ " of " + mType.getElement().getBytesSize() +
" bytes, passed bitmap was " + bc);
}
break;
case ARGB_4444:
if ((mType.getElement().mKind != Element.DataKind.PIXEL_RGBA) ||
- (mType.getElement().getSizeBytes() != 2)) {
+ (mType.getElement().getBytesSize() != 2)) {
throw new RSIllegalArgumentException("Allocation kind is " +
mType.getElement().mKind + ", type " +
mType.getElement().mType +
- " of " + mType.getElement().getSizeBytes() +
+ " of " + mType.getElement().getBytesSize() +
" bytes, passed bitmap was " + bc);
}
break;
@@ -583,7 +576,7 @@ public class Allocation extends BaseObj {
*/
public void setFromFieldPacker(int xoff, FieldPacker fp) {
mRS.validate();
- int eSize = mType.mElement.getSizeBytes();
+ int eSize = mType.mElement.getBytesSize();
final byte[] data = fp.getData();
int count = data.length / eSize;
@@ -612,7 +605,7 @@ public class Allocation extends BaseObj {
}
final byte[] data = fp.getData();
- int eSize = mType.mElement.mElements[component_number].getSizeBytes();
+ int eSize = mType.mElement.mElements[component_number].getBytesSize();
eSize *= mType.mElement.mArraySizes[component_number];
if (data.length != eSize) {
@@ -665,7 +658,7 @@ public class Allocation extends BaseObj {
* @param d the source data array
*/
public void copy1DRangeFromUnchecked(int off, int count, int[] d) {
- int dataSize = mType.mElement.getSizeBytes() * count;
+ int dataSize = mType.mElement.getBytesSize() * count;
data1DChecks(off, count, d.length * 4, dataSize);
mRS.nAllocationData1D(getIDSafe(), off, mSelectedLOD, count, d, dataSize);
}
@@ -679,7 +672,7 @@ public class Allocation extends BaseObj {
* @param d the source data array
*/
public void copy1DRangeFromUnchecked(int off, int count, short[] d) {
- int dataSize = mType.mElement.getSizeBytes() * count;
+ int dataSize = mType.mElement.getBytesSize() * count;
data1DChecks(off, count, d.length * 2, dataSize);
mRS.nAllocationData1D(getIDSafe(), off, mSelectedLOD, count, d, dataSize);
}
@@ -693,7 +686,7 @@ public class Allocation extends BaseObj {
* @param d the source data array
*/
public void copy1DRangeFromUnchecked(int off, int count, byte[] d) {
- int dataSize = mType.mElement.getSizeBytes() * count;
+ int dataSize = mType.mElement.getBytesSize() * count;
data1DChecks(off, count, d.length, dataSize);
mRS.nAllocationData1D(getIDSafe(), off, mSelectedLOD, count, d, dataSize);
}
@@ -707,7 +700,7 @@ public class Allocation extends BaseObj {
* @param d the source data array
*/
public void copy1DRangeFromUnchecked(int off, int count, float[] d) {
- int dataSize = mType.mElement.getSizeBytes() * count;
+ int dataSize = mType.mElement.getBytesSize() * count;
data1DChecks(off, count, d.length * 4, dataSize);
mRS.nAllocationData1D(getIDSafe(), off, mSelectedLOD, count, d, dataSize);
}
@@ -1030,30 +1023,6 @@ public class Allocation extends BaseObj {
}
/**
- * @hide
- * This API is hidden and only intended to be used for
- * transitional purposes.
- *
- * @param type renderscript type describing data layout
- * @param mips specifies desired mipmap behaviour for the
- * allocation
- * @param usage bit field specifying how the allocation is
- * utilized
- */
- static public Allocation createTyped(RenderScript rs, Type type, MipmapControl mips,
- int usage, int pointer) {
- rs.validate();
- if (type.getID(rs) == 0) {
- throw new RSInvalidStateException("Bad Type");
- }
- int id = rs.nAllocationCreateTyped(type.getID(rs), mips.mID, usage, pointer);
- if (id == 0) {
- throw new RSRuntimeException("Allocation creation failed.");
- }
- return new Allocation(id, rs, type, usage);
- }
-
- /**
* Creates a renderscript allocation with the size specified by
* the type and no mipmaps generated by default
*
@@ -1194,8 +1163,11 @@ public class Allocation extends BaseObj {
}
/**
+ * For allocations used with io operations, returns the handle
+ * onto a raw buffer that is being managed by the screen
+ * compositor.
*
- * @hide
+ * @return Surface object associated with allocation
*
*/
public Surface getSurface() {
@@ -1203,7 +1175,9 @@ public class Allocation extends BaseObj {
}
/**
- * @hide
+ * Associate a surface for io output with this allocation
+ *
+ * @param sur Surface to associate with allocation
*/
public void setSurface(Surface sur) {
mRS.validate();
diff --git a/graphics/java/android/renderscript/Element.java b/graphics/java/android/renderscript/Element.java
index d75c951..28914ce 100644
--- a/graphics/java/android/renderscript/Element.java
+++ b/graphics/java/android/renderscript/Element.java
@@ -85,13 +85,13 @@ public class Element extends BaseObj {
}
/**
- * @hide
* @return element size in bytes
*/
- public int getSizeBytes() {return mSize;}
+ public int getBytesSize() {return mSize;}
/**
- * @hide
+ * Returns the number of vector components. 2 for float2, 4 for
+ * float4, etc.
* @return element vector size
*/
public int getVectorSize() {return mVectorSize;}
@@ -114,10 +114,6 @@ public class Element extends BaseObj {
* RS_* objects. 32 bit opaque handles.
*/
public enum DataType {
- /**
- * @hide
- * new enum
- */
NONE (0, 0),
//FLOAT_16 (1, 2),
FLOAT_32 (2, 4),
@@ -150,7 +146,8 @@ public class Element extends BaseObj {
RS_PROGRAM_FRAGMENT (1006, 4),
RS_PROGRAM_VERTEX (1007, 4),
RS_PROGRAM_RASTER (1008, 4),
- RS_PROGRAM_STORE (1009, 4);
+ RS_PROGRAM_STORE (1009, 4),
+ RS_FONT (1010, 4);
int mID;
int mSize;
@@ -201,7 +198,10 @@ public class Element extends BaseObj {
}
/**
- * @hide
+ * Elements could be simple, such as an int or a float, or a
+ * structure with multiple sub elements, such as a collection of
+ * floats, float2, float4. This function returns zero for simple
+ * elements or the number of sub-elements otherwise.
* @return number of sub-elements in this element
*/
public int getSubElementCount() {
@@ -212,7 +212,8 @@ public class Element extends BaseObj {
}
/**
- * @hide
+ * For complex elements, this function will return the
+ * sub-element at index
* @param index index of the sub-element to return
* @return sub-element in this element at given index
*/
@@ -227,7 +228,8 @@ public class Element extends BaseObj {
}
/**
- * @hide
+ * For complex elements, this function will return the
+ * sub-element name at index
* @param index index of the sub-element
* @return sub-element in this element at given index
*/
@@ -242,7 +244,9 @@ public class Element extends BaseObj {
}
/**
- * @hide
+ * For complex elements, some sub-elements could be statically
+ * sized arrays. This function will return the array size for
+ * sub-element at index
* @param index index of the sub-element
* @return array size of sub-element in this element at given index
*/
@@ -257,7 +261,8 @@ public class Element extends BaseObj {
}
/**
- * @hide
+ * This function specifies the location of a sub-element within
+ * the element
* @param index index of the sub-element
* @return offset in bytes of sub-element in this element at given index
*/
@@ -272,7 +277,6 @@ public class Element extends BaseObj {
}
/**
- * @hide
* @return element data type
*/
public DataType getDataType() {
@@ -280,7 +284,6 @@ public class Element extends BaseObj {
}
/**
- * @hide
* @return element data kind
*/
public DataKind getDataKind() {
@@ -455,6 +458,13 @@ public class Element extends BaseObj {
return rs.mElement_PROGRAM_STORE;
}
+ public static Element FONT(RenderScript rs) {
+ if(rs.mElement_FONT == null) {
+ rs.mElement_FONT = createUser(rs, DataType.RS_FONT);
+ }
+ return rs.mElement_FONT;
+ }
+
public static Element A_8(RenderScript rs) {
if(rs.mElement_A_8 == null) {
diff --git a/graphics/java/android/renderscript/Program.java b/graphics/java/android/renderscript/Program.java
index 104d1cd..d9f64c6 100644
--- a/graphics/java/android/renderscript/Program.java
+++ b/graphics/java/android/renderscript/Program.java
@@ -78,14 +78,20 @@ public class Program extends BaseObj {
}
/**
- * @hide
+ * Program object can have zero or more constant allocations
+ * associated with it. This method returns the total count.
+ * @return number of constant input types
*/
public int getConstantCount() {
return mConstants != null ? mConstants.length : 0;
}
/**
- * @hide
+ * Returns the type of the constant buffer used in the program
+ * object. It could be used to query internal elements or create
+ * an allocation to store constant data.
+ * @param slot index of the constant input type to return
+ * @return constant input type
*/
public Type getConstant(int slot) {
if (slot < 0 || slot >= mConstants.length) {
@@ -95,14 +101,17 @@ public class Program extends BaseObj {
}
/**
- * @hide
+ * Returns the number of textures used in this program object
+ * @return number of texture inputs
*/
public int getTextureCount() {
return mTextureCount;
}
/**
- * @hide
+ * Returns the type of texture at a given slot. e.g. 2D or Cube
+ * @param slot index of the texture input
+ * @return texture input type
*/
public TextureType getTextureType(int slot) {
if ((slot < 0) || (slot >= mTextureCount)) {
@@ -112,7 +121,10 @@ public class Program extends BaseObj {
}
/**
- * @hide
+ * Returns the name of the texture input at a given slot. e.g.
+ * tex0, diffuse, spec
+ * @param slot index of the texture input
+ * @return texture input name
*/
public String getTextureName(int slot) {
if ((slot < 0) || (slot >= mTextureCount)) {
@@ -318,7 +330,6 @@ public class Program extends BaseObj {
}
/**
- * @hide
* Adds a texture input to the Program
*
* @param texType describes that the texture to append it (2D,
diff --git a/graphics/java/android/renderscript/ProgramRaster.java b/graphics/java/android/renderscript/ProgramRaster.java
index 93ee0ce..e40751f 100644
--- a/graphics/java/android/renderscript/ProgramRaster.java
+++ b/graphics/java/android/renderscript/ProgramRaster.java
@@ -48,15 +48,16 @@ public class ProgramRaster extends BaseObj {
}
/**
- * @hide
+ * Specifies whether vertices are rendered as screen aligned
+ * elements of a specified size
* @return whether point sprites are enabled
*/
- public boolean getPointSpriteEnabled() {
+ public boolean isPointSpriteEnabled() {
return mPointSprite;
}
/**
- * @hide
+ * Specifies how triangles are culled based on their orientation
* @return cull mode
*/
public CullMode getCullMode() {
diff --git a/graphics/java/android/renderscript/ProgramStore.java b/graphics/java/android/renderscript/ProgramStore.java
index 677dadd..d0fd6e5 100644
--- a/graphics/java/android/renderscript/ProgramStore.java
+++ b/graphics/java/android/renderscript/ProgramStore.java
@@ -150,7 +150,8 @@ public class ProgramStore extends BaseObj {
}
/**
- * @hide
+ * Returns the function used to test writing into the depth
+ * buffer
* @return depth function
*/
public DepthFunc getDepthFunc() {
@@ -158,47 +159,47 @@ public class ProgramStore extends BaseObj {
}
/**
- * @hide
- * @return whether depth writes are enabled
+ * Queries whether writes are enabled into the depth buffer
+ * @return depth mask
*/
- public boolean getDepthMaskEnabled() {
+ public boolean isDepthMaskEnabled() {
return mDepthMask;
}
/**
- * @hide
+ * Queries whether red channel is written
* @return red color channel mask
*/
- public boolean getColorMaskREnabled() {
+ public boolean isColorMaskRedEnabled() {
return mColorMaskR;
}
/**
- * @hide
+ * Queries whether green channel is written
* @return green color channel mask
*/
- public boolean getColorMaskGEnabled() {
+ public boolean isColorMaskGreenEnabled() {
return mColorMaskG;
}
/**
- * @hide
+ * Queries whether blue channel is written
* @return blue color channel mask
*/
- public boolean getColorMaskBEnabled() {
+ public boolean isColorMaskBlueEnabled() {
return mColorMaskB;
}
/**
- * @hide
+ * Queries whether alpha channel is written
* @return alpha channel mask
*/
- public boolean getColorMaskAEnabled() {
+ public boolean isColorMaskAlphaEnabled() {
return mColorMaskA;
}
/**
- * @hide
+ * Specifies how the source blending factor is computed
* @return source blend function
*/
public BlendSrcFunc getBlendSrcFunc() {
@@ -206,7 +207,7 @@ public class ProgramStore extends BaseObj {
}
/**
- * @hide
+ * Specifies how the destination blending factor is computed
* @return destination blend function
*/
public BlendDstFunc getBlendDstFunc() {
@@ -214,10 +215,11 @@ public class ProgramStore extends BaseObj {
}
/**
- * @hide
+ * Specifies whether colors are dithered before writing into the
+ * framebuffer
* @return whether dither is enabled
*/
- public boolean getDitherEnabled() {
+ public boolean isDitherEnabled() {
return mDither;
}
diff --git a/graphics/java/android/renderscript/ProgramVertex.java b/graphics/java/android/renderscript/ProgramVertex.java
index 32c908e..74d666b 100644
--- a/graphics/java/android/renderscript/ProgramVertex.java
+++ b/graphics/java/android/renderscript/ProgramVertex.java
@@ -55,14 +55,15 @@ public class ProgramVertex extends Program {
}
/**
- * @hide
+ * @return number of input attribute elements
*/
public int getInputCount() {
return mInputs != null ? mInputs.length : 0;
}
/**
- * @hide
+ * @param slot location of the input to return
+ * @return input attribute element
*/
public Element getInput(int slot) {
if (slot < 0 || slot >= mInputs.length) {
diff --git a/graphics/java/android/renderscript/ProgramVertexFixedFunction.java b/graphics/java/android/renderscript/ProgramVertexFixedFunction.java
index fac4c3d..54f21b8 100644
--- a/graphics/java/android/renderscript/ProgramVertexFixedFunction.java
+++ b/graphics/java/android/renderscript/ProgramVertexFixedFunction.java
@@ -204,7 +204,7 @@ public class ProgramVertexFixedFunction extends ProgramVertex {
public Constants(RenderScript rs) {
Type constInputType = ProgramVertexFixedFunction.Builder.getConstantInputType(rs);
mAlloc = Allocation.createTyped(rs, constInputType);
- int bufferSize = constInputType.getElement().getSizeBytes()*
+ int bufferSize = constInputType.getElement().getBytesSize()*
constInputType.getCount();
mIOBuffer = new FieldPacker(bufferSize);
mModel = new Matrix4f();
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index 03294b5..abbcdd9 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -664,6 +664,7 @@ public class RenderScript {
Element mElement_PROGRAM_VERTEX;
Element mElement_PROGRAM_RASTER;
Element mElement_PROGRAM_STORE;
+ Element mElement_FONT;
Element mElement_A_8;
Element mElement_RGB_565;
diff --git a/graphics/java/android/renderscript/Sampler.java b/graphics/java/android/renderscript/Sampler.java
index 0a3c91d..0df1012 100644
--- a/graphics/java/android/renderscript/Sampler.java
+++ b/graphics/java/android/renderscript/Sampler.java
@@ -59,7 +59,6 @@ public class Sampler extends BaseObj {
}
/**
- * @hide
* @return minification setting for the sampler
*/
public Value getMinification() {
@@ -67,7 +66,6 @@ public class Sampler extends BaseObj {
}
/**
- * @hide
* @return magnification setting for the sampler
*/
public Value getMagnification() {
@@ -75,7 +73,6 @@ public class Sampler extends BaseObj {
}
/**
- * @hide
* @return S wrapping mode for the sampler
*/
public Value getWrapS() {
@@ -83,7 +80,6 @@ public class Sampler extends BaseObj {
}
/**
- * @hide
* @return T wrapping mode for the sampler
*/
public Value getWrapT() {
@@ -91,7 +87,6 @@ public class Sampler extends BaseObj {
}
/**
- * @hide
* @return anisotropy setting for the sampler
*/
public float getAnisotropy() {
@@ -288,7 +283,7 @@ public class Sampler extends BaseObj {
public Sampler create() {
mRS.validate();
- int id = mRS.nSamplerCreate(mMag.mID, mMin.mID,
+ int id = mRS.nSamplerCreate(mMag.mID, mMin.mID,
mWrapS.mID, mWrapT.mID, mWrapR.mID, mAniso);
Sampler sampler = new Sampler(id, mRS);
sampler.mMin = mMin;
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index 9f2bacd..3910739 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -818,7 +818,10 @@ status_t DisplayList::replay(OpenGLRenderer& renderer, uint32_t width,
indent[i] = ' ';
}
indent[count] = '\0';
- DISPLAY_LIST_LOGD("%sStart display list (%p, %s)", (char*) indent + 2, this, mName.string());
+ Rect* clipRect = renderer.getClipRect();
+ DISPLAY_LIST_LOGD("%sStart display list (%p, %s), clipRect: %.0f, %.f, %.0f, %.0f",
+ (char*) indent + 2, this, mName.string(), clipRect->left, clipRect->top,
+ clipRect->right, clipRect->bottom);
#endif
renderer.startMark(mName.string());
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 06928df..ebb8eb7 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -520,6 +520,7 @@ bool OpenGLRenderer::createLayer(sp<Snapshot> snapshot, float left, float top,
layer->texCoords.set(0.0f, bounds.getHeight() / float(layer->getHeight()),
bounds.getWidth() / float(layer->getWidth()), 0.0f);
layer->setColorFilter(mColorFilter);
+ layer->setBlend(true);
// Save the layer in the snapshot
snapshot->flags |= Snapshot::kFlagIsLayer;
@@ -1058,6 +1059,10 @@ bool OpenGLRenderer::clipRect(float left, float top, float right, float bottom,
return !mSnapshot->clipRect->isEmpty();
}
+Rect* OpenGLRenderer::getClipRect() {
+ return mSnapshot->clipRect;
+}
+
///////////////////////////////////////////////////////////////////////////////
// Drawing commands
///////////////////////////////////////////////////////////////////////////////
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index b52d2b0..47927bb 100644
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -101,6 +101,7 @@ public:
ANDROID_API const Rect& getClipBounds();
ANDROID_API bool quickReject(float left, float top, float right, float bottom);
virtual bool clipRect(float left, float top, float right, float bottom, SkRegion::Op op);
+ virtual Rect* getClipRect();
virtual status_t drawDisplayList(DisplayList* displayList, uint32_t width, uint32_t height,
Rect& dirty, int32_t flags, uint32_t level = 0);
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
index 52fb875..5b9160d 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
@@ -567,6 +567,7 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
synchronized (KeyguardViewMediator.this) {
if (mHidden != isHidden) {
mHidden = isHidden;
+ updateActivityLockScreenState();
adjustUserActivityLocked();
adjustStatusBarLocked();
}
@@ -1162,6 +1163,14 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
}
}
+ private void updateActivityLockScreenState() {
+ try {
+ ActivityManagerNative.getDefault().setLockScreenShown(
+ mShowing && !mHidden);
+ } catch (RemoteException e) {
+ }
+ }
+
/**
* Handle message sent by {@link #showLocked}.
* @see #SHOW
@@ -1173,6 +1182,7 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
mKeyguardViewManager.show();
mShowing = true;
+ updateActivityLockScreenState();
adjustUserActivityLocked();
adjustStatusBarLocked();
try {
@@ -1207,6 +1217,7 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
mKeyguardViewManager.hide();
mShowing = false;
+ updateActivityLockScreenState();
adjustUserActivityLocked();
adjustStatusBarLocked();
}
@@ -1324,6 +1335,7 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
if (DEBUG) Log.d(TAG, "handleVerifyUnlock");
mKeyguardViewManager.verifyUnlock();
mShowing = true;
+ updateActivityLockScreenState();
}
}
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index 1891146..0a63840 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -1628,9 +1628,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
return 0;
}
- public Animation createForceHideEnterAnimation() {
- return AnimationUtils.loadAnimation(mContext,
- com.android.internal.R.anim.lock_screen_behind_enter);
+ public Animation createForceHideEnterAnimation(boolean onWallpaper) {
+ return AnimationUtils.loadAnimation(mContext, onWallpaper
+ ? com.android.internal.R.anim.lock_screen_wallpaper_behind_enter
+ : com.android.internal.R.anim.lock_screen_behind_enter);
}
static ITelephony getTelephonyService() {
@@ -2245,12 +2246,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
vf.right = mStableRight;
vf.bottom = mStableBottom;
+ // Let the status bar determine its size.
mStatusBar.computeFrameLw(pf, df, vf, vf);
- final Rect r = mStatusBar.getFrameLw();
- // Compute the stable dimensions whether or not the status bar is hidden.
- if (mDockTop == r.top) mStableTop = r.bottom;
- else if (mDockBottom == r.bottom) mStableBottom = r.top;
+ // For layout, the status bar is always at the top with our fixed height.
+ mStableTop = mUnrestrictedScreenTop + mStatusBarHeight;
// If the status bar is hidden, we don't want to cause
// windows behind it to scroll.
@@ -2258,8 +2258,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// Status bar may go away, so the screen area it occupies
// is available to apps but just covering them when the
// status bar is visible.
- if (mDockTop == r.top) mDockTop = r.bottom;
- else if (mDockBottom == r.bottom) mDockBottom = r.top;
+ mDockTop = mUnrestrictedScreenTop + mStatusBarHeight;
mContentTop = mCurTop = mDockTop;
mContentBottom = mCurBottom = mDockBottom;
diff --git a/services/java/com/android/server/NsdService.java b/services/java/com/android/server/NsdService.java
index 768be7d..a3ac8d0 100644
--- a/services/java/com/android/server/NsdService.java
+++ b/services/java/com/android/server/NsdService.java
@@ -32,9 +32,11 @@ import android.util.Slog;
import java.io.FileDescriptor;
import java.io.PrintWriter;
+import java.net.InetAddress;
import java.util.ArrayList;
-import java.util.concurrent.CountDownLatch;
+import java.util.HashMap;
import java.util.List;
+import java.util.concurrent.CountDownLatch;
import com.android.internal.app.IBatteryStats;
import com.android.internal.telephony.TelephonyIntents;
@@ -60,10 +62,13 @@ public class NsdService extends INsdManager.Stub {
/**
* Clients receiving asynchronous messages
*/
- private List<AsyncChannel> mClients = new ArrayList<AsyncChannel>();
+ private HashMap<Messenger, ClientInfo> mClients = new HashMap<Messenger, ClientInfo>();
private AsyncChannel mReplyChannel = new AsyncChannel();
+ private int INVALID_ID = 0;
+ private int mUniqueId = 1;
+
/**
* Handles client(app) connections
*/
@@ -75,13 +80,19 @@ public class NsdService extends INsdManager.Stub {
@Override
public void handleMessage(Message msg) {
+ ClientInfo clientInfo;
+ DnsSdServiceInfo servInfo;
switch (msg.what) {
case AsyncChannel.CMD_CHANNEL_HALF_CONNECTED:
if (msg.arg1 == AsyncChannel.STATUS_SUCCESSFUL) {
AsyncChannel c = (AsyncChannel) msg.obj;
if (DBG) Slog.d(TAG, "New client listening to asynchronous messages");
c.sendMessage(AsyncChannel.CMD_CHANNEL_FULLY_CONNECTED);
- mClients.add(c);
+ ClientInfo cInfo = new ClientInfo(c, msg.replyTo);
+ if (mClients.size() == 0) {
+ startMDnsDaemon();
+ }
+ mClients.put(msg.replyTo, cInfo);
} else {
Slog.e(TAG, "Client connection failure, error=" + msg.arg1);
}
@@ -92,7 +103,10 @@ public class NsdService extends INsdManager.Stub {
} else {
if (DBG) Slog.d(TAG, "Client connection lost with reason: " + msg.arg1);
}
- mClients.remove((AsyncChannel) msg.obj);
+ mClients.remove(msg.replyTo);
+ if (mClients.size() == 0) {
+ stopMDnsDaemon();
+ }
break;
case AsyncChannel.CMD_CHANNEL_FULL_CONNECTION:
AsyncChannel ac = new AsyncChannel();
@@ -100,22 +114,98 @@ public class NsdService extends INsdManager.Stub {
break;
case NsdManager.DISCOVER_SERVICES:
if (DBG) Slog.d(TAG, "Discover services");
- DnsSdServiceInfo s = (DnsSdServiceInfo) msg.obj;
- discoverServices(1, s.getServiceType());
- mReplyChannel.replyToMessage(msg, NsdManager.DISCOVER_SERVICES_STARTED);
+ servInfo = (DnsSdServiceInfo) msg.obj;
+ clientInfo = mClients.get(msg.replyTo);
+ if (clientInfo.mDiscoveryId != INVALID_ID) {
+ //discovery already in progress
+ if (DBG) Slog.d(TAG, "discovery in progress");
+ mReplyChannel.replyToMessage(msg, NsdManager.DISCOVER_SERVICES_FAILED,
+ NsdManager.ALREADY_ACTIVE);
+ break;
+ }
+ clientInfo.mDiscoveryId = getUniqueId();
+ if (discoverServices(clientInfo.mDiscoveryId, servInfo.getServiceType())) {
+ mReplyChannel.replyToMessage(msg, NsdManager.DISCOVER_SERVICES_STARTED);
+ } else {
+ mReplyChannel.replyToMessage(msg, NsdManager.DISCOVER_SERVICES_FAILED,
+ NsdManager.ERROR);
+ clientInfo.mDiscoveryId = INVALID_ID;
+ }
break;
case NsdManager.STOP_DISCOVERY:
if (DBG) Slog.d(TAG, "Stop service discovery");
- mReplyChannel.replyToMessage(msg, NsdManager.STOP_DISCOVERY_FAILED);
+ clientInfo = mClients.get(msg.replyTo);
+ if (clientInfo.mDiscoveryId == INVALID_ID) {
+ //already stopped
+ if (DBG) Slog.d(TAG, "discovery already stopped");
+ mReplyChannel.replyToMessage(msg, NsdManager.STOP_DISCOVERY_FAILED,
+ NsdManager.ALREADY_ACTIVE);
+ break;
+ }
+ if (stopServiceDiscovery(clientInfo.mDiscoveryId)) {
+ clientInfo.mDiscoveryId = INVALID_ID;
+ mReplyChannel.replyToMessage(msg, NsdManager.STOP_DISCOVERY_SUCCEEDED);
+ } else {
+ mReplyChannel.replyToMessage(msg, NsdManager.STOP_DISCOVERY_FAILED,
+ NsdManager.ERROR);
+ }
break;
case NsdManager.REGISTER_SERVICE:
if (DBG) Slog.d(TAG, "Register service");
- mReplyChannel.replyToMessage(msg, NsdManager.REGISTER_SERVICE_FAILED);
+ clientInfo = mClients.get(msg.replyTo);
+ if (clientInfo.mRegisteredIds.size() >= ClientInfo.MAX_REG) {
+ if (DBG) Slog.d(TAG, "register service exceeds limit");
+ mReplyChannel.replyToMessage(msg, NsdManager.REGISTER_SERVICE_FAILED,
+ NsdManager.MAX_REGS_REACHED);
+ }
+
+ int id = getUniqueId();
+ if (registerService(id, (DnsSdServiceInfo) msg.obj)) {
+ clientInfo.mRegisteredIds.add(id);
+ } else {
+ mReplyChannel.replyToMessage(msg, NsdManager.REGISTER_SERVICE_FAILED,
+ NsdManager.ERROR);
+ }
break;
case NsdManager.UPDATE_SERVICE:
if (DBG) Slog.d(TAG, "Update service");
+ //TODO: implement
mReplyChannel.replyToMessage(msg, NsdManager.UPDATE_SERVICE_FAILED);
break;
+ case NsdManager.RESOLVE_SERVICE:
+ if (DBG) Slog.d(TAG, "Resolve service");
+ servInfo = (DnsSdServiceInfo) msg.obj;
+ clientInfo = mClients.get(msg.replyTo);
+ if (clientInfo.mResolveId != INVALID_ID) {
+ //first cancel existing resolve
+ stopResolveService(clientInfo.mResolveId);
+ }
+
+ clientInfo.mResolveId = getUniqueId();
+ if (!resolveService(clientInfo.mResolveId, servInfo)) {
+ mReplyChannel.replyToMessage(msg, NsdManager.RESOLVE_SERVICE_FAILED,
+ NsdManager.ERROR);
+ clientInfo.mResolveId = INVALID_ID;
+ }
+ break;
+ case NsdManager.STOP_RESOLVE:
+ if (DBG) Slog.d(TAG, "Stop resolve");
+ clientInfo = mClients.get(msg.replyTo);
+ if (clientInfo.mResolveId == INVALID_ID) {
+ //already stopped
+ if (DBG) Slog.d(TAG, "resolve already stopped");
+ mReplyChannel.replyToMessage(msg, NsdManager.STOP_RESOLVE_FAILED,
+ NsdManager.ALREADY_ACTIVE);
+ break;
+ }
+ if (stopResolveService(clientInfo.mResolveId)) {
+ clientInfo.mResolveId = INVALID_ID;
+ mReplyChannel.replyToMessage(msg, NsdManager.STOP_RESOLVE_SUCCEEDED);
+ } else {
+ mReplyChannel.replyToMessage(msg, NsdManager.STOP_RESOLVE_FAILED,
+ NsdManager.ERROR);
+ }
+ break;
default:
Slog.d(TAG, "NsdServicehandler.handleMessage ignoring msg=" + msg);
break;
@@ -134,12 +224,10 @@ public class NsdService extends INsdManager.Stub {
nsdThread.start();
mAsyncServiceHandler = new AsyncServiceHandler(nsdThread.getLooper());
- /*
mNativeConnector = new NativeDaemonConnector(new NativeCallbackReceiver(), "mdns", 10,
MDNS_TAG, 25);
Thread th = new Thread(mNativeConnector, MDNS_TAG);
th.start();
- */
}
public static NsdService create(Context context) throws InterruptedException {
@@ -152,22 +240,29 @@ public class NsdService extends INsdManager.Stub {
return new Messenger(mAsyncServiceHandler);
}
+ private int getUniqueId() {
+ if (++mUniqueId == INVALID_ID) return ++mUniqueId;
+ return mUniqueId;
+ }
+
/* These should be in sync with system/netd/mDnsResponseCode.h */
class NativeResponseCode {
- public static final int SERVICE_FOUND = 101;
- public static final int SERVICE_LOST = 102;
- public static final int SERVICE_DISCOVERY_FAILED = 103;
+ public static final int SERVICE_DISCOVERY_FAILED = 602;
+ public static final int SERVICE_FOUND = 603;
+ public static final int SERVICE_LOST = 604;
- public static final int SERVICE_REGISTERED = 104;
- public static final int SERVICE_REGISTRATION_FAILED = 105;
+ public static final int SERVICE_REGISTRATION_FAILED = 605;
+ public static final int SERVICE_REGISTERED = 606;
- public static final int SERVICE_UPDATED = 106;
- public static final int SERVICE_UPDATE_FAILED = 107;
+ public static final int SERVICE_RESOLUTION_FAILED = 607;
+ public static final int SERVICE_RESOLVED = 608;
- public static final int SERVICE_RESOLVED = 108;
- public static final int SERVICE_RESOLUTION_FAILED = 109;
- }
+ public static final int SERVICE_UPDATED = 609;
+ public static final int SERVICE_UPDATE_FAILED = 610;
+ public static final int SERVICE_GET_ADDR_FAILED = 611;
+ public static final int SERVICE_GET_ADDR_SUCCESS = 612;
+ }
class NativeCallbackReceiver implements INativeDaemonConnectorCallbacks {
public void onDaemonConnected() {
@@ -175,21 +270,55 @@ public class NsdService extends INsdManager.Stub {
}
public boolean onEvent(int code, String raw, String[] cooked) {
+ ClientInfo clientInfo;
+ DnsSdServiceInfo servInfo;
+ int id = Integer.parseInt(cooked[1]);
switch (code) {
case NativeResponseCode.SERVICE_FOUND:
- /* NNN uniqueId serviceName regType */
+ /* NNN uniqueId serviceName regType domain */
+ if (DBG) Slog.d(TAG, "SERVICE_FOUND Raw: " + raw);
+ clientInfo = getClientByDiscovery(id);
+ if (clientInfo == null) break;
+
+ servInfo = new DnsSdServiceInfo(cooked[2], cooked[3], null);
+ clientInfo.mChannel.sendMessage(NsdManager.SERVICE_FOUND, servInfo);
break;
case NativeResponseCode.SERVICE_LOST:
- /* NNN uniqueId serviceName regType */
+ /* NNN uniqueId serviceName regType domain */
+ if (DBG) Slog.d(TAG, "SERVICE_LOST Raw: " + raw);
+ clientInfo = getClientByDiscovery(id);
+ if (clientInfo == null) break;
+
+ servInfo = new DnsSdServiceInfo(cooked[2], cooked[3], null);
+ clientInfo.mChannel.sendMessage(NsdManager.SERVICE_LOST, servInfo);
break;
case NativeResponseCode.SERVICE_DISCOVERY_FAILED:
/* NNN uniqueId errorCode */
+ if (DBG) Slog.d(TAG, "SERVICE_DISC_FAILED Raw: " + raw);
+ clientInfo = getClientByDiscovery(id);
+ if (clientInfo == null) break;
+
+ clientInfo.mChannel.sendMessage(NsdManager.DISCOVER_SERVICES_FAILED,
+ NsdManager.ERROR);
break;
case NativeResponseCode.SERVICE_REGISTERED:
/* NNN regId serviceName regType */
+ if (DBG) Slog.d(TAG, "SERVICE_REGISTERED Raw: " + raw);
+ clientInfo = getClientByRegistration(id);
+ if (clientInfo == null) break;
+
+ servInfo = new DnsSdServiceInfo(cooked[2], null, null);
+ clientInfo.mChannel.sendMessage(NsdManager.REGISTER_SERVICE_SUCCEEDED,
+ id, 0, servInfo);
break;
case NativeResponseCode.SERVICE_REGISTRATION_FAILED:
/* NNN regId errorCode */
+ if (DBG) Slog.d(TAG, "SERVICE_REGISTER_FAILED Raw: " + raw);
+ clientInfo = getClientByRegistration(id);
+ if (clientInfo == null) break;
+
+ clientInfo.mChannel.sendMessage(NsdManager.REGISTER_SERVICE_FAILED,
+ NsdManager.ERROR);
break;
case NativeResponseCode.SERVICE_UPDATED:
/* NNN regId */
@@ -199,9 +328,52 @@ public class NsdService extends INsdManager.Stub {
break;
case NativeResponseCode.SERVICE_RESOLVED:
/* NNN resolveId fullName hostName port txtlen txtdata */
+ if (DBG) Slog.d(TAG, "SERVICE_RESOLVED Raw: " + raw);
+ clientInfo = getClientByResolve(id);
+ if (clientInfo == null) break;
+
+ int index = cooked[2].indexOf(".");
+ if (index == -1) {
+ Slog.e(TAG, "Invalid service found " + raw);
+ break;
+ }
+ String name = cooked[2].substring(0, index);
+ String rest = cooked[2].substring(index);
+ String type = rest.replace(".local.", "");
+
+ clientInfo.mResolvedService = new DnsSdServiceInfo(name, type, null);
+ clientInfo.mResolvedService.setPort(Integer.parseInt(cooked[4]));
+
+ stopResolveService(id);
+ getAddrInfo(id, cooked[3]);
break;
case NativeResponseCode.SERVICE_RESOLUTION_FAILED:
- /* NNN resovleId errorCode */
+ case NativeResponseCode.SERVICE_GET_ADDR_FAILED:
+ /* NNN resolveId errorCode */
+ if (DBG) Slog.d(TAG, "SERVICE_RESOLVE_FAILED Raw: " + raw);
+ clientInfo = getClientByResolve(id);
+ if (clientInfo == null) break;
+
+ clientInfo.mChannel.sendMessage(NsdManager.RESOLVE_SERVICE_FAILED,
+ NsdManager.ERROR);
+ break;
+ case NativeResponseCode.SERVICE_GET_ADDR_SUCCESS:
+ /* NNN resolveId hostname ttl addr */
+ if (DBG) Slog.d(TAG, "SERVICE_GET_ADDR_SUCCESS Raw: " + raw);
+ clientInfo = getClientByResolve(id);
+ if (clientInfo == null || clientInfo.mResolvedService == null) break;
+
+ try {
+ clientInfo.mResolvedService.setHost(InetAddress.getByName(cooked[4]));
+ clientInfo.mChannel.sendMessage(NsdManager.RESOLVE_SERVICE_SUCCEEDED,
+ clientInfo.mResolvedService);
+ clientInfo.mResolvedService = null;
+ clientInfo.mResolveId = INVALID_ID;
+ } catch (java.net.UnknownHostException e) {
+ clientInfo.mChannel.sendMessage(NsdManager.RESOLVE_SERVICE_FAILED,
+ NsdManager.ERROR);
+ }
+ stopGetAddrInfo(id);
break;
default:
break;
@@ -210,48 +382,129 @@ public class NsdService extends INsdManager.Stub {
}
}
- private void registerService(int regId, DnsSdServiceInfo service) {
+ private boolean startMDnsDaemon() {
+ if (DBG) Slog.d(TAG, "startMDnsDaemon");
+ try {
+ mNativeConnector.execute("mdnssd", "start-service");
+ } catch(NativeDaemonConnectorException e) {
+ Slog.e(TAG, "Failed to start daemon" + e);
+ return false;
+ }
+ return true;
+ }
+
+ private boolean stopMDnsDaemon() {
+ if (DBG) Slog.d(TAG, "stopMDnsDaemon");
+ try {
+ mNativeConnector.execute("mdnssd", "stop-service");
+ } catch(NativeDaemonConnectorException e) {
+ Slog.e(TAG, "Failed to start daemon" + e);
+ return false;
+ }
+ return true;
+ }
+
+ private boolean registerService(int regId, DnsSdServiceInfo service) {
+ if (DBG) Slog.d(TAG, "registerService: " + regId + " " + service);
try {
//Add txtlen and txtdata
mNativeConnector.execute("mdnssd", "register", regId, service.getServiceName(),
service.getServiceType(), service.getPort());
} catch(NativeDaemonConnectorException e) {
- Slog.e(TAG, "Failed to execute registerService");
+ Slog.e(TAG, "Failed to execute registerService " + e);
+ return false;
+ }
+ return true;
+ }
+
+ private boolean unregisterService(int regId) {
+ if (DBG) Slog.d(TAG, "unregisterService: " + regId);
+ try {
+ mNativeConnector.execute("mdnssd", "stop-register", regId);
+ } catch(NativeDaemonConnectorException e) {
+ Slog.e(TAG, "Failed to execute unregisterService " + e);
+ return false;
}
+ return true;
}
- private void updateService(int regId, DnsSdTxtRecord t) {
+ private boolean updateService(int regId, DnsSdTxtRecord t) {
+ if (DBG) Slog.d(TAG, "updateService: " + regId + " " + t);
try {
- if (t == null) return;
+ if (t == null) return false;
mNativeConnector.execute("mdnssd", "update", regId, t.size(), t.getRawData());
} catch(NativeDaemonConnectorException e) {
- Slog.e(TAG, "Failed to updateServices");
+ Slog.e(TAG, "Failed to updateServices " + e);
+ return false;
}
+ return true;
}
- private void discoverServices(int discoveryId, String serviceType) {
+ private boolean discoverServices(int discoveryId, String serviceType) {
+ if (DBG) Slog.d(TAG, "discoverServices: " + discoveryId + " " + serviceType);
try {
mNativeConnector.execute("mdnssd", "discover", discoveryId, serviceType);
} catch(NativeDaemonConnectorException e) {
- Slog.e(TAG, "Failed to discoverServices");
+ Slog.e(TAG, "Failed to discoverServices " + e);
+ return false;
+ }
+ return true;
+ }
+
+ private boolean stopServiceDiscovery(int discoveryId) {
+ if (DBG) Slog.d(TAG, "stopServiceDiscovery: " + discoveryId);
+ try {
+ mNativeConnector.execute("mdnssd", "stop-discover", discoveryId);
+ } catch(NativeDaemonConnectorException e) {
+ Slog.e(TAG, "Failed to stopServiceDiscovery " + e);
+ return false;
+ }
+ return true;
+ }
+
+ private boolean resolveService(int resolveId, DnsSdServiceInfo service) {
+ if (DBG) Slog.d(TAG, "resolveService: " + resolveId + " " + service);
+ try {
+ mNativeConnector.execute("mdnssd", "resolve", resolveId, service.getServiceName(),
+ service.getServiceType(), "local.");
+ } catch(NativeDaemonConnectorException e) {
+ Slog.e(TAG, "Failed to resolveService " + e);
+ return false;
+ }
+ return true;
+ }
+
+ private boolean stopResolveService(int resolveId) {
+ if (DBG) Slog.d(TAG, "stopResolveService: " + resolveId);
+ try {
+ mNativeConnector.execute("mdnssd", "stop-resolve", resolveId);
+ } catch(NativeDaemonConnectorException e) {
+ Slog.e(TAG, "Failed to stop resolve " + e);
+ return false;
}
+ return true;
}
- private void stopServiceDiscovery(int discoveryId) {
+ private boolean getAddrInfo(int resolveId, String hostname) {
+ if (DBG) Slog.d(TAG, "getAdddrInfo: " + resolveId);
try {
- mNativeConnector.execute("mdnssd", "stopdiscover", discoveryId);
+ mNativeConnector.execute("mdnssd", "getaddrinfo", resolveId, hostname);
} catch(NativeDaemonConnectorException e) {
- Slog.e(TAG, "Failed to stopServiceDiscovery");
+ Slog.e(TAG, "Failed to getAddrInfo " + e);
+ return false;
}
+ return true;
}
- private void resolveService(DnsSdServiceInfo service) {
+ private boolean stopGetAddrInfo(int resolveId) {
+ if (DBG) Slog.d(TAG, "stopGetAdddrInfo: " + resolveId);
try {
- mNativeConnector.execute("mdnssd", "resolve", service.getServiceName(),
- service.getServiceType());
+ mNativeConnector.execute("mdnssd", "stop-getaddrinfo", resolveId);
} catch(NativeDaemonConnectorException e) {
- Slog.e(TAG, "Failed to resolveService");
+ Slog.e(TAG, "Failed to stopGetAddrInfo " + e);
+ return false;
}
+ return true;
}
@Override
@@ -266,4 +519,51 @@ public class NsdService extends INsdManager.Stub {
pw.println("Internal state:");
}
+
+ private ClientInfo getClientByDiscovery(int discoveryId) {
+ for (ClientInfo c: mClients.values()) {
+ if (c.mDiscoveryId == discoveryId) {
+ return c;
+ }
+ }
+ return null;
+ }
+
+ private ClientInfo getClientByResolve(int resolveId) {
+ for (ClientInfo c: mClients.values()) {
+ if (c.mResolveId == resolveId) {
+ return c;
+ }
+ }
+ return null;
+ }
+
+ private ClientInfo getClientByRegistration(int regId) {
+ for (ClientInfo c: mClients.values()) {
+ if (c.mRegisteredIds.contains(regId)) {
+ return c;
+ }
+ }
+ return null;
+ }
+
+ /* Information tracked per client */
+ private class ClientInfo {
+
+ private static final int MAX_REG = 5;
+ private AsyncChannel mChannel;
+ private Messenger mMessenger;
+ private int mDiscoveryId;
+ private int mResolveId;
+ /* Remembers a resolved service until getaddrinfo completes */
+ private DnsSdServiceInfo mResolvedService;
+ private ArrayList<Integer> mRegisteredIds = new ArrayList<Integer>();
+
+ private ClientInfo(AsyncChannel c, Messenger m) {
+ mChannel = c;
+ mMessenger = m;
+ mDiscoveryId = mResolveId = INVALID_ID;
+ if (DBG) Slog.d(TAG, "New client, channel: " + c + " messenger: " + m);
+ }
+ }
}
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 0c2e6ac..e37adc7 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -697,6 +697,16 @@ public final class ActivityManagerService extends ActivityManagerNative
boolean mSleeping = false;
/**
+ * State of external calls telling us if the device is asleep.
+ */
+ boolean mWentToSleep = false;
+
+ /**
+ * State of external call telling us if the lock screen is shown.
+ */
+ boolean mLockScreenShown = false;
+
+ /**
* Set if we are shutting down the system, similar to sleeping.
*/
boolean mShuttingDown = false;
@@ -6656,17 +6666,26 @@ public final class ActivityManagerService extends ActivityManagerNative
}
public void goingToSleep() {
+ if (checkCallingPermission(android.Manifest.permission.DEVICE_POWER)
+ != PackageManager.PERMISSION_GRANTED) {
+ throw new SecurityException("Requires permission "
+ + android.Manifest.permission.DEVICE_POWER);
+ }
+
synchronized(this) {
- mSleeping = true;
+ mWentToSleep = true;
mWindowManager.setEventDispatching(false);
- mMainStack.stopIfSleepingLocked();
+ if (!mSleeping) {
+ mSleeping = true;
+ mMainStack.stopIfSleepingLocked();
- // Initialize the wake times of all processes.
- checkExcessivePowerUsageLocked(false);
- mHandler.removeMessages(CHECK_EXCESSIVE_WAKE_LOCKS_MSG);
- Message nmsg = mHandler.obtainMessage(CHECK_EXCESSIVE_WAKE_LOCKS_MSG);
- mHandler.sendMessageDelayed(nmsg, POWER_CHECK_DELAY);
+ // Initialize the wake times of all processes.
+ checkExcessivePowerUsageLocked(false);
+ mHandler.removeMessages(CHECK_EXCESSIVE_WAKE_LOCKS_MSG);
+ Message nmsg = mHandler.obtainMessage(CHECK_EXCESSIVE_WAKE_LOCKS_MSG);
+ mHandler.sendMessageDelayed(nmsg, POWER_CHECK_DELAY);
+ }
}
}
@@ -6726,12 +6745,40 @@ public final class ActivityManagerService extends ActivityManagerNative
Binder.restoreCallingIdentity(origId);
}
+ private void comeOutOfSleepIfNeededLocked() {
+ if (!mWentToSleep && !mLockScreenShown) {
+ if (mSleeping) {
+ mSleeping = false;
+ mMainStack.awakeFromSleepingLocked();
+ mMainStack.resumeTopActivityLocked(null);
+ }
+ }
+ }
+
public void wakingUp() {
+ if (checkCallingPermission(android.Manifest.permission.DEVICE_POWER)
+ != PackageManager.PERMISSION_GRANTED) {
+ throw new SecurityException("Requires permission "
+ + android.Manifest.permission.DEVICE_POWER);
+ }
+
synchronized(this) {
+ mWentToSleep = false;
mWindowManager.setEventDispatching(true);
- mSleeping = false;
- mMainStack.awakeFromSleepingLocked();
- mMainStack.resumeTopActivityLocked(null);
+ comeOutOfSleepIfNeededLocked();
+ }
+ }
+
+ public void setLockScreenShown(boolean shown) {
+ if (checkCallingPermission(android.Manifest.permission.DEVICE_POWER)
+ != PackageManager.PERMISSION_GRANTED) {
+ throw new SecurityException("Requires permission "
+ + android.Manifest.permission.DEVICE_POWER);
+ }
+
+ synchronized(this) {
+ mLockScreenShown = shown;
+ comeOutOfSleepIfNeededLocked();
}
}
@@ -8815,7 +8862,13 @@ public final class ActivityManagerService extends ActivityManagerNative
}
}
}
- pw.println(" mSleeping=" + mSleeping + " mShuttingDown=" + mShuttingDown);
+ if (mSleeping || mWentToSleep || mLockScreenShown) {
+ pw.println(" mSleeping=" + mSleeping + " mWentToSleep=" + mWentToSleep
+ + " mLockScreenShown " + mLockScreenShown);
+ }
+ if (mShuttingDown) {
+ pw.println(" mShuttingDown=" + mShuttingDown);
+ }
if (mDebugApp != null || mOrigDebugApp != null || mDebugTransient
|| mOrigWaitForDebugger) {
pw.println(" mDebugApp=" + mDebugApp + "/orig=" + mOrigDebugApp
diff --git a/services/java/com/android/server/wm/ScreenRotationAnimation.java b/services/java/com/android/server/wm/ScreenRotationAnimation.java
index e460f7f..3dcfd3c 100644
--- a/services/java/com/android/server/wm/ScreenRotationAnimation.java
+++ b/services/java/com/android/server/wm/ScreenRotationAnimation.java
@@ -33,6 +33,7 @@ class ScreenRotationAnimation {
static final String TAG = "ScreenRotationAnimation";
static final boolean DEBUG_STATE = false;
static final boolean DEBUG_TRANSFORMS = false;
+ static final boolean TWO_PHASE_ANIMATION = false;
static final boolean USE_CUSTOM_BLACK_FRAME = false;
static final int FREEZE_LAYER = WindowManagerService.TYPE_LAYER_MULTIPLIER * 200;
@@ -44,7 +45,6 @@ class ScreenRotationAnimation {
BlackFrame mEnteringBlackFrame;
int mWidth, mHeight;
- int mSnapshotDeltaRotation;
int mOriginalRotation;
int mOriginalWidth, mOriginalHeight;
int mCurRotation;
@@ -138,10 +138,9 @@ class ScreenRotationAnimation {
if (mEnteringBlackFrame != null) {
mEnteringBlackFrame.printTo(prefix + " ", pw);
}
- pw.print(prefix); pw.print(" mSnapshotDeltaRotation="); pw.print(mSnapshotDeltaRotation);
- pw.print(" mCurRotation="); pw.println(mCurRotation);
- pw.print(prefix); pw.print("mOriginalRotation="); pw.print(mOriginalRotation);
- pw.print(" mOriginalWidth="); pw.print(mOriginalWidth);
+ pw.print(prefix); pw.print("mCurRotation="); pw.print(mCurRotation);
+ pw.print(" mOriginalRotation="); pw.println(mOriginalRotation);
+ pw.print(prefix); pw.print("mOriginalWidth="); pw.print(mOriginalWidth);
pw.print(" mOriginalHeight="); pw.println(mOriginalHeight);
pw.print(prefix); pw.print("mStarted="); pw.print(mStarted);
pw.print(" mAnimRunning="); pw.print(mAnimRunning);
@@ -306,8 +305,13 @@ class ScreenRotationAnimation {
public boolean setRotation(int rotation, SurfaceSession session,
long maxAnimationDuration, float animationScale, int finalWidth, int finalHeight) {
setRotation(rotation);
- return startAnimation(session, maxAnimationDuration, animationScale,
- finalWidth, finalHeight, false);
+ if (TWO_PHASE_ANIMATION) {
+ return startAnimation(session, maxAnimationDuration, animationScale,
+ finalWidth, finalHeight, false);
+ } else {
+ // Don't start animation yet.
+ return false;
+ }
}
/**
@@ -330,7 +334,8 @@ class ScreenRotationAnimation {
// Figure out how the screen has moved from the original rotation.
int delta = deltaRotation(mCurRotation, mOriginalRotation);
- if (mFinishExitAnimation == null && (!dismissing || delta != Surface.ROTATION_0)) {
+ if (TWO_PHASE_ANIMATION && mFinishExitAnimation == null
+ && (!dismissing || delta != Surface.ROTATION_0)) {
if (DEBUG_STATE) Slog.v(TAG, "Creating start and finish animations");
firstStart = true;
mStartExitAnimation = AnimationUtils.loadAnimation(mContext,
@@ -406,7 +411,7 @@ class ScreenRotationAnimation {
// means to allow supplying the last and next size. In this definition
// "%p" is the original (let's call it "previous") size, and "%" is the
// screen's current/new size.
- if (firstStart) {
+ if (TWO_PHASE_ANIMATION && firstStart) {
if (DEBUG_STATE) Slog.v(TAG, "Initializing start and finish animations");
mStartEnterAnimation.initialize(finalWidth, finalHeight,
halfWidth, halfHeight);
@@ -433,7 +438,7 @@ class ScreenRotationAnimation {
mFinishAnimReady = false;
mFinishAnimStartTime = -1;
- if (firstStart) {
+ if (TWO_PHASE_ANIMATION && firstStart) {
mStartExitAnimation.restrictDuration(maxAnimationDuration);
mStartExitAnimation.scaleCurrentDuration(animationScale);
mStartEnterAnimation.restrictDuration(maxAnimationDuration);
@@ -624,6 +629,14 @@ class ScreenRotationAnimation {
}
public boolean isAnimating() {
+ if (TWO_PHASE_ANIMATION) {
+ return hasAnimations() || mFinishAnimReady;
+ } else {
+ return hasAnimations();
+ }
+ }
+
+ private boolean hasAnimations() {
return mStartEnterAnimation != null || mStartExitAnimation != null
|| mStartFrameAnimation != null
|| mFinishEnterAnimation != null || mFinishExitAnimation != null
@@ -633,7 +646,6 @@ class ScreenRotationAnimation {
}
private boolean stepAnimation(long now) {
-
if (mFinishAnimReady && mFinishAnimStartTime < 0) {
if (DEBUG_STATE) Slog.v(TAG, "Step: finish anim now ready");
mFinishAnimStartTime = now;
@@ -794,6 +806,10 @@ class ScreenRotationAnimation {
}
void updateSurfaces() {
+ if (!mStarted) {
+ return;
+ }
+
if (mSurface != null) {
if (!mMoreStartExit && !mMoreFinishExit && !mMoreRotateExit) {
if (DEBUG_STATE) Slog.v(TAG, "Exit animations done, hiding screenshot surface");
@@ -834,7 +850,7 @@ class ScreenRotationAnimation {
}
public boolean stepAnimationLocked(long now) {
- if (!isAnimating()) {
+ if (!hasAnimations()) {
if (DEBUG_STATE) Slog.v(TAG, "Step: no animations running");
mFinishAnimReady = false;
return false;
diff --git a/services/java/com/android/server/wm/WindowAnimator.java b/services/java/com/android/server/wm/WindowAnimator.java
index 0be6612..fa009eb 100644
--- a/services/java/com/android/server/wm/WindowAnimator.java
+++ b/services/java/com/android/server/wm/WindowAnimator.java
@@ -22,6 +22,7 @@ import android.view.animation.Animation;
import com.android.internal.policy.impl.PhoneWindowManager;
import java.io.PrintWriter;
+import java.util.ArrayList;
import java.util.HashSet;
/**
@@ -158,9 +159,7 @@ public class WindowAnimator {
}
}
- if (mScreenRotationAnimation != null &&
- (mScreenRotationAnimation.isAnimating() ||
- mScreenRotationAnimation.mFinishAnimReady)) {
+ if (mScreenRotationAnimation != null && mScreenRotationAnimation.isAnimating()) {
if (mScreenRotationAnimation.stepAnimationLocked(mCurrentTime)) {
mAnimating = true;
} else {
@@ -174,6 +173,9 @@ public class WindowAnimator {
private void updateWindowsAndWallpaperLocked() {
++mTransactionSequence;
+ ArrayList<WindowStateAnimator> unForceHiding = null;
+ boolean wallpaperInUnForceHiding = false;
+
for (int i = mService.mWindows.size() - 1; i >= 0; i--) {
WindowState win = mService.mWindows.get(i);
WindowStateAnimator winAnimator = win.mWinAnimator;
@@ -269,13 +271,12 @@ public class WindowAnimator {
if (changed) {
if ((mBulkUpdateParams & SET_FORCE_HIDING_CHANGED) != 0
&& win.isVisibleNow() /*w.isReadyForDisplay()*/) {
- // Assume we will need to animate. If
- // we don't (because the wallpaper will
- // stay with the lock screen), then we will
- // clean up later.
- Animation a = mPolicy.createForceHideEnterAnimation();
- if (a != null) {
- winAnimator.setAnimation(a);
+ if (unForceHiding == null) {
+ unForceHiding = new ArrayList<WindowStateAnimator>();
+ }
+ unForceHiding.add(winAnimator);
+ if ((win.mAttrs.flags&WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER) != 0) {
+ wallpaperInUnForceHiding = true;
}
}
if (mCurrentFocus == null || mCurrentFocus.mLayer < win.mLayer) {
@@ -358,6 +359,17 @@ public class WindowAnimator {
}
}
} // end forall windows
+
+ // If we have windows that are being show due to them no longer
+ // being force-hidden, apply the appropriate animation to them.
+ if (unForceHiding != null) {
+ for (int i=unForceHiding.size()-1; i>=0; i--) {
+ Animation a = mPolicy.createForceHideEnterAnimation(wallpaperInUnForceHiding);
+ if (a != null) {
+ unForceHiding.get(i).setAnimation(a);
+ }
+ }
+ }
}
private void testTokenMayBeDrawnLocked() {
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index f48b56d..b0e017f 100644
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -7894,28 +7894,6 @@ public class WindowManagerService extends IWindowManager.Stub
if (DEBUG_WALLPAPER) Slog.v(TAG, "****** OLD: " + oldWallpaper
+ " NEW: " + mWallpaperTarget
+ " LOWER: " + mLowerWallpaperTarget);
- if (mLowerWallpaperTarget == null) {
- // Whoops, we don't need a special wallpaper animation.
- // Clear them out.
- mAnimator.mForceHiding = false;
- for (int i=mWindows.size()-1; i>=0; i--) {
- WindowState w = mWindows.get(i);
- if (w.mHasSurface) {
- final WindowManager.LayoutParams attrs = w.mAttrs;
- if (mPolicy.doesForceHide(w, attrs) && w.isVisibleLw()) {
- if (DEBUG_FOCUS) Slog.i(TAG, "win=" + w + " force hides other windows");
- mAnimator.mForceHiding = true;
- } else if (mPolicy.canBeForceHidden(w, attrs)) {
- if (!w.mWinAnimator.mAnimating) {
- // We set the animation above so it
- // is not yet running.
- // TODO(cmautner): We lose the enter animation when this occurs.
- w.mWinAnimator.clearAnimation();
- }
- }
- }
- }
- }
return changes;
}
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java
index 98a106a0..ff7a0810 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java
@@ -28,6 +28,7 @@ import android.telephony.ServiceState;
import android.telephony.cdma.CdmaCellLocation;
import android.os.AsyncResult;
import android.os.Message;
+import android.os.SystemProperties;
import android.provider.Telephony.Intents;
import android.text.TextUtils;
@@ -370,14 +371,23 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ALPHA,
ss.getOperatorAlphaLong());
+ String prevOperatorNumeric =
+ SystemProperties.get(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, "");
operatorNumeric = ss.getOperatorNumeric();
phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, operatorNumeric);
if (operatorNumeric == null) {
+ if (DBG) {
+ log("pollStateDone: operatorNumeric=" + operatorNumeric +
+ " prevOperatorNumeric=" + prevOperatorNumeric +
+ " mNeedFixZone=" + mNeedFixZone +
+ " clear PROPERTY_OPERATOR_ISO_COUNTRY");
+ }
phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, "");
mGotCountryCode = false;
} else {
String isoCountryCode = "";
+ String mcc = operatorNumeric.substring(0, 3);
try {
isoCountryCode = MccTable.countryCodeForMcc(Integer.parseInt(operatorNumeric
.substring(0, 3)));
@@ -386,11 +396,20 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
} catch (StringIndexOutOfBoundsException ex) {
loge("countryCodeForMcc error" + ex);
}
+ if (DBG) {
+ log("pollStateDone: operatorNumeric=" + operatorNumeric +
+ " prevOperatorNumeric=" + prevOperatorNumeric +
+ " mNeedFixZone=" + mNeedFixZone +
+ " mcc=" + mcc + " iso-cc=" + isoCountryCode);
+ }
phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY,
isoCountryCode);
mGotCountryCode = true;
- if (mNeedFixZone) {
+
+ // Fix the time zone If the operator changed or we need to fix it because
+ // when the NITZ time came in we didn't know the country code.
+ if ( ! operatorNumeric.equals(prevOperatorNumeric) || mNeedFixZone) {
fixTimeZone(isoCountryCode);
}
}
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
index 9f27696..b694e0a 100755
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
@@ -866,6 +866,12 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
// If the offset is (0, false) and the time zone property
// is set, use the time zone property rather than GMT.
String zoneName = SystemProperties.get(TIMEZONE_PROPERTY);
+ if (DBG) {
+ log("fixTimeZone zoneName='" + zoneName +
+ "' mZoneOffset=" + mZoneOffset + " mZoneDst=" + mZoneDst +
+ " iso-cc='" + isoCountryCode +
+ "' iso-cc-idx=" + Arrays.binarySearch(GMT_COUNTRY_CODES, isoCountryCode));
+ }
if ((mZoneOffset == 0) && (mZoneDst == false) && (zoneName != null)
&& (zoneName.length() > 0)
&& (Arrays.binarySearch(GMT_COUNTRY_CODES, isoCountryCode) < 0)) {
@@ -880,19 +886,25 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
// Adjust the saved NITZ time to account for tzOffset.
mSavedTime = mSavedTime - tzOffset;
}
+ if (DBG) log("fixTimeZone: using default TimeZone");
} else if (isoCountryCode.equals("")) {
// Country code not found. This is likely a test network.
// Get a TimeZone based only on the NITZ parameters (best guess).
zone = getNitzTimeZone(mZoneOffset, mZoneDst, mZoneTime);
+ if (DBG) log("fixTimeZone: using NITZ TimeZone");
} else {
zone = TimeUtils.getTimeZone(mZoneOffset, mZoneDst, mZoneTime, isoCountryCode);
+ if (DBG) log("fixTimeZone: using getTimeZone(off, dst, time, iso)");
}
mNeedFixZone = false;
if (zone != null) {
+ log("fixTimeZone: zone != null zone.getID=" + zone.getID());
if (getAutoTimeZone()) {
setAndBroadcastNetworkSetTimeZone(zone.getID());
+ } else {
+ log("fixTimeZone: zone == null");
}
saveNitzTimeZone(zone.getID());
}
@@ -985,14 +997,23 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ALPHA,
ss.getOperatorAlphaLong());
+ String prevOperatorNumeric =
+ SystemProperties.get(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, "");
operatorNumeric = ss.getOperatorNumeric();
phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, operatorNumeric);
if (operatorNumeric == null) {
+ if (DBG) {
+ log("pollStateDone: operatorNumeric=" + operatorNumeric +
+ " prevOperatorNumeric=" + prevOperatorNumeric +
+ " mNeedFixZone=" + mNeedFixZone +
+ " clear PROPERTY_OPERATOR_ISO_COUNTRY");
+ }
phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, "");
mGotCountryCode = false;
} else {
String isoCountryCode = "";
+ String mcc = operatorNumeric.substring(0, 3);
try{
isoCountryCode = MccTable.countryCodeForMcc(Integer.parseInt(
operatorNumeric.substring(0,3)));
@@ -1001,11 +1022,20 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
} catch ( StringIndexOutOfBoundsException ex) {
loge("pollStateDone: countryCodeForMcc error" + ex);
}
+ if (DBG) {
+ log("pollStateDone: operatorNumeric=" + operatorNumeric +
+ " prevOperatorNumeric=" + prevOperatorNumeric +
+ " mNeedFixZone=" + mNeedFixZone +
+ " mcc=" + mcc + " iso-cc=" + isoCountryCode);
+ }
phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY,
isoCountryCode);
mGotCountryCode = true;
- if (mNeedFixZone) {
+
+ // Fix the time zone If the operator changed or we need to fix it because
+ // when the NITZ time came in we didn't know the country code.
+ if ( ! operatorNumeric.equals(prevOperatorNumeric) || mNeedFixZone) {
fixTimeZone(isoCountryCode);
}
}
@@ -1316,7 +1346,6 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
String iso = SystemProperties.get(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY);
if (zone == null) {
-
if (mGotCountryCode) {
if (iso != null && iso.length() > 0) {
zone = TimeUtils.getTimeZone(tzOffset, dst != 0,
@@ -1332,16 +1361,21 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
}
}
- if (zone == null) {
- // We got the time before the country, so we don't know
- // how to identify the DST rules yet. Save the information
- // and hope to fix it up later.
+ if ((zone == null) || (mZoneOffset != tzOffset) || (mZoneDst != (dst != 0))){
+ // We got the time before the country or the zone has changed
+ // so we don't know how to identify the DST rules yet. Save
+ // the information and hope to fix it up later.
mNeedFixZone = true;
mZoneOffset = tzOffset;
mZoneDst = dst != 0;
mZoneTime = c.getTimeInMillis();
}
+ if (DBG) {
+ log("NITZ: tzOffset=" + tzOffset + " dst=" + dst + " zone=" + zone.getID() +
+ " iso=" + iso + " mGotCountryCode=" + mGotCountryCode +
+ " mNeedFixZone=" + mNeedFixZone);
+ }
if (zone != null) {
if (getAutoTimeZone()) {
@@ -1461,6 +1495,7 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
* @param zoneId timezone set by carrier
*/
private void setAndBroadcastNetworkSetTimeZone(String zoneId) {
+ if (DBG) log("setAndBroadcastNetworkSetTimeZone: setTimeZone=" + zoneId);
AlarmManager alarm =
(AlarmManager) phone.getContext().getSystemService(Context.ALARM_SERVICE);
alarm.setTimeZone(zoneId);
@@ -1477,6 +1512,7 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
* @param time time set by network
*/
private void setAndBroadcastNetworkSetTime(long time) {
+ if (DBG) log("setAndBroadcastNetworkSetTime: time=" + time + "ms");
SystemClock.setCurrentTimeMillis(time);
Intent intent = new Intent(TelephonyIntents.ACTION_NETWORK_SET_TIME);
intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
index 662f1f6..c0acf5b 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
@@ -852,12 +852,16 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ALPHA,
ss.getOperatorAlphaLong());
+ String prevOperatorNumeric =
+ SystemProperties.get(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, "");
operatorNumeric = ss.getOperatorNumeric();
phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, operatorNumeric);
if (operatorNumeric == null) {
if (DBG) {
- log("pollStateDone: operatorNumeric is null:" +
+ log("pollStateDone: operatorNumeric=" + operatorNumeric +
+ " prevOperatorNumeric=" + prevOperatorNumeric +
+ " mNeedFixZone=" + mNeedFixZone +
" clear PROPERTY_OPERATOR_ISO_COUNTRY");
}
phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, "");
@@ -875,7 +879,9 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
}
if (DBG) {
log("pollStateDone: operatorNumeric=" + operatorNumeric +
- " mcc=" + mcc + " iso=" + iso);
+ " prevOperatorNumeric=" + prevOperatorNumeric +
+ " mNeedFixZone=" + mNeedFixZone +
+ " mcc=" + mcc + " iso-cc=" + iso);
}
phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, iso);
@@ -895,7 +901,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
if ((uniqueZones.size() == 1) || testOneUniqueOffsetPath) {
zone = uniqueZones.get(0);
if (DBG) {
- log("pollStateDone: no nitz but one TZ for iso=" + iso +
+ log("pollStateDone: no nitz but one TZ for iso-cc=" + iso +
" with zone.getID=" + zone.getID() +
" testOneUniqueOffsetPath=" + testOneUniqueOffsetPath);
}
@@ -903,22 +909,24 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
} else {
if (DBG) {
log("pollStateDone: there are " + uniqueZones.size() +
- " unique offsets for iso='" + iso +
+ " unique offsets for iso-cc='" + iso +
" testOneUniqueOffsetPath=" + testOneUniqueOffsetPath +
"', do nothing");
}
}
}
- if (mNeedFixZone) {
+ // Fix the time zone If the operator changed or we need to fix it because
+ // when the NITZ time came in we didn't know the country code.
+ if ( ! operatorNumeric.equals(prevOperatorNumeric) || mNeedFixZone) {
// If the offset is (0, false) and the timezone property
// is set, use the timezone property rather than
// GMT.
String zoneName = SystemProperties.get(TIMEZONE_PROPERTY);
if (DBG) {
- log("pollStateDone: mNeedFixZone==true zoneName='" + zoneName +
+ log("pollStateDone: fix time zone zoneName='" + zoneName +
"' mZoneOffset=" + mZoneOffset + " mZoneDst=" + mZoneDst +
- " iso='" + iso +
+ " iso-cc='" + iso +
"' iso-cc-idx=" + Arrays.binarySearch(GMT_COUNTRY_CODES, iso));
}
if ((mZoneOffset == 0) && (mZoneDst == false) &&
@@ -957,15 +965,6 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
} else {
log("pollStateDone: zone == null");
}
- } else {
- if (DBG) {
- String zoneName = SystemProperties.get(TIMEZONE_PROPERTY);
- zone = TimeZone.getDefault();
- log("pollStateDone: mNeedFixZone==false zoneName='" + zoneName +
- "' mZoneOffset=" + mZoneOffset + " mZoneDst=" + mZoneDst +
- " iso='" + iso +
- "' iso-cc-idx=" + Arrays.binarySearch(GMT_COUNTRY_CODES, iso));
- }
}
}
@@ -1442,10 +1441,10 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
}
}
- if (zone == null) {
- // We got the time before the country, so we don't know
- // how to identify the DST rules yet. Save the information
- // and hope to fix it up later.
+ if ((zone == null) || (mZoneOffset != tzOffset) || (mZoneDst != (dst != 0))){
+ // We got the time before the country or the zone has changed
+ // so we don't know how to identify the DST rules yet. Save
+ // the information and hope to fix it up later.
mNeedFixZone = true;
mZoneOffset = tzOffset;
@@ -1556,6 +1555,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
* @param zoneId timezone set by carrier
*/
private void setAndBroadcastNetworkSetTimeZone(String zoneId) {
+ if (DBG) log("setAndBroadcastNetworkSetTimeZone: setTimeZone=" + zoneId);
AlarmManager alarm =
(AlarmManager) phone.getContext().getSystemService(Context.ALARM_SERVICE);
alarm.setTimeZone(zoneId);
@@ -1576,6 +1576,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
* @param time time set by network
*/
private void setAndBroadcastNetworkSetTime(long time) {
+ if (DBG) log("setAndBroadcastNetworkSetTime: time=" + time + "ms");
SystemClock.setCurrentTimeMillis(time);
Intent intent = new Intent(TelephonyIntents.ACTION_NETWORK_SET_TIME);
intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_element.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_element.java
index 3e2a2ca..f52fe6f 100644
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_element.java
+++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_element.java
@@ -108,7 +108,7 @@ public class UT_element extends UnitTest {
_RS_ASSERT("complexElemsimpleElem.getDataType() == NONE",
complexElem.getDataType() == DataType.NONE);
_RS_ASSERT("complexElem.getSizeBytes() == ScriptField_ComplexStruct.Item.sizeof",
- complexElem.getSizeBytes() == ScriptField_ComplexStruct.Item.sizeof);
+ complexElem.getBytesSize() == ScriptField_ComplexStruct.Item.sizeof);
for (int i = 0; i < subElemCount; i ++) {
_RS_ASSERT("complexElem.getSubElement(i) != null",
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_program_raster.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_program_raster.java
index 1de4d71..ca54ac4 100644
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_program_raster.java
+++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_program_raster.java
@@ -60,13 +60,13 @@ public class UT_program_raster extends UnitTest {
}
private void testJavaSide(RenderScript RS) {
- _RS_ASSERT("pointSpriteEnabled.getPointSpriteEnabled() == true",
- pointSpriteEnabled.getPointSpriteEnabled() == true);
+ _RS_ASSERT("pointSpriteEnabled.isPointSpriteEnabled() == true",
+ pointSpriteEnabled.isPointSpriteEnabled() == true);
_RS_ASSERT("pointSpriteEnabled.getCullMode() == ProgramRaster.CullMode.BACK",
pointSpriteEnabled.getCullMode() == ProgramRaster.CullMode.BACK);
- _RS_ASSERT("cullMode.getPointSpriteEnabled() == false",
- cullMode.getPointSpriteEnabled() == false);
+ _RS_ASSERT("cullMode.isPointSpriteEnabled() == false",
+ cullMode.isPointSpriteEnabled() == false);
_RS_ASSERT("cullMode.getCullMode() == ProgramRaster.CullMode.FRONT",
cullMode.getCullMode() == ProgramRaster.CullMode.FRONT);
}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_program_store.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_program_store.java
index 72a401d..4410ee3 100644
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_program_store.java
+++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_program_store.java
@@ -112,15 +112,15 @@ public class UT_program_store extends UnitTest {
boolean B,
boolean A,
boolean dither) {
- _RS_ASSERT("ps.getDepthMaskEnabled() == depthMask", ps.getDepthMaskEnabled() == depthMask);
+ _RS_ASSERT("ps.isDepthMaskEnabled() == depthMask", ps.isDepthMaskEnabled() == depthMask);
_RS_ASSERT("ps.getDepthFunc() == df", ps.getDepthFunc() == df);
_RS_ASSERT("ps.getBlendSrcFunc() == bsf", ps.getBlendSrcFunc() == bsf);
_RS_ASSERT("ps.getBlendDstFunc() == bdf", ps.getBlendDstFunc() == bdf);
- _RS_ASSERT("ps.getColorMaskREnabled() == R", ps.getColorMaskREnabled() == R);
- _RS_ASSERT("ps.getColorMaskGEnabled() == G", ps.getColorMaskGEnabled() == G);
- _RS_ASSERT("ps.getColorMaskBEnabled() == B", ps.getColorMaskBEnabled() == B);
- _RS_ASSERT("ps.getColorMaskAEnabled() == A", ps.getColorMaskAEnabled() == A);
- _RS_ASSERT("ps.getDitherEnabled() == dither", ps.getDitherEnabled() == dither);
+ _RS_ASSERT("ps.isColorMaskRedEnabled() == R", ps.isColorMaskRedEnabled() == R);
+ _RS_ASSERT("ps.isColorMaskGreenEnabled() == G", ps.isColorMaskGreenEnabled() == G);
+ _RS_ASSERT("ps.isColorMaskBlueEnabled () == B", ps.isColorMaskBlueEnabled () == B);
+ _RS_ASSERT("ps.isColorMaskAlphaEnabled() == A", ps.isColorMaskAlphaEnabled() == A);
+ _RS_ASSERT("ps.isDitherEnabled() == dither", ps.isDitherEnabled() == dither);
}
void varyBuilderColorAndDither(ProgramStore.Builder pb,