Merge "resolved conflicts for merge of ba04dbc6 to master"
diff --git a/cmds/app_process/app_main.cpp b/cmds/app_process/app_main.cpp
index 7decf9a..0159edd 100644
--- a/cmds/app_process/app_main.cpp
+++ b/cmds/app_process/app_main.cpp
@@ -171,9 +171,9 @@
runtime.start();
}
} else {
- LOG_ALWAYS_FATAL("app_process: no class name or --zygote supplied.");
fprintf(stderr, "Error: no class name or --zygote supplied.\n");
app_usage();
+ LOG_ALWAYS_FATAL("app_process: no class name or --zygote supplied.");
return 10;
}
diff --git a/core/java/android/webkit/CallbackProxy.java b/core/java/android/webkit/CallbackProxy.java
index b00f88c..8c9f266 100644
--- a/core/java/android/webkit/CallbackProxy.java
+++ b/core/java/android/webkit/CallbackProxy.java
@@ -710,6 +710,9 @@
break;
case ADD_MESSAGE_TO_CONSOLE:
+ if (mWebChromeClient == null) {
+ break;
+ }
String message = msg.getData().getString("message");
String sourceID = msg.getData().getString("sourceID");
int lineNumber = msg.getData().getInt("lineNumber");
@@ -786,7 +789,9 @@
host, realm, username, password);
break;
case SET_INSTALLABLE_WEBAPP:
- mWebChromeClient.setInstallableWebApp();
+ if (mWebChromeClient != null) {
+ mWebChromeClient.setInstallableWebApp();
+ }
break;
}
}
diff --git a/libs/hwui/ProgramCache.cpp b/libs/hwui/ProgramCache.cpp
index d1a1b45..439e6fb 100644
--- a/libs/hwui/ProgramCache.cpp
+++ b/libs/hwui/ProgramCache.cpp
@@ -37,12 +37,8 @@
// Linear
"uniform mat4 screenSpace;\n",
// Circular
- "uniform vec2 gradientStart;\n"
- "uniform mat4 gradientMatrix;\n"
"uniform mat4 screenSpace;\n",
// Sweep
- "uniform vec2 gradientStart;\n"
- "uniform mat4 gradientMatrix;\n"
"uniform mat4 screenSpace;\n"
};
const char* gVS_Header_Uniforms_HasBitmap =
@@ -68,11 +64,9 @@
// Linear
" index = (screenSpace * position).x;\n",
// Circular
- " vec4 location = screenSpace * position;\n"
- " circular = (gradientMatrix * vec4(location.xy - gradientStart, 0.0, 0.0)).xy;\n",
+ " circular = (screenSpace * position).xy;\n",
// Sweep
- " vec4 location = screenSpace * position;\n"
- " sweep = (gradientMatrix * vec4(location.xy - gradientStart, 0.0, 0.0)).xy;\n"
+ " sweep = (screenSpace * position).xy;\n"
};
const char* gVS_Main_OutBitmapTexCoords =
" vec4 bitmapCoords = textureTransform * position;\n"
@@ -98,7 +92,6 @@
// Linear
"uniform sampler2D gradientSampler;\n",
// Circular
- "uniform float gradientRadius;\n"
"uniform sampler2D gradientSampler;\n",
// Sweep
"uniform sampler2D gradientSampler;\n"
@@ -130,7 +123,7 @@
// Linear
" vec4 gradientColor = texture2D(gradientSampler, vec2(index, 0.5));\n",
// Circular
- " float index = length(circular) * gradientRadius;\n"
+ " float index = length(circular);\n"
" vec4 gradientColor = texture2D(gradientSampler, vec2(index, 0.5));\n",
// Sweep
" float index = atan(sweep.y, sweep.x) * 0.15915494309; // inv(2 * PI)\n"
diff --git a/libs/hwui/SkiaShader.cpp b/libs/hwui/SkiaShader.cpp
index 83de2b2..fa85d20 100644
--- a/libs/hwui/SkiaShader.cpp
+++ b/libs/hwui/SkiaShader.cpp
@@ -49,7 +49,8 @@
SkiaShader::SkiaShader(Type type, SkShader* key, SkShader::TileMode tileX,
SkShader::TileMode tileY, SkMatrix* matrix, bool blend):
- mType(type), mKey(key), mTileX(tileX), mTileY(tileY), mMatrix(matrix), mBlend(blend) {
+ mType(type), mKey(key), mTileX(tileX), mTileY(tileY), mBlend(blend) {
+ setMatrix(matrix);
}
SkiaShader::~SkiaShader() {
@@ -69,6 +70,11 @@
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapT);
}
+void SkiaShader::computeScreenSpaceMatrix(mat4& screenSpace, const mat4& modelView) {
+ screenSpace.loadMultiply(mUnitMatrix, mShaderMatrix);
+ screenSpace.multiply(modelView);
+}
+
///////////////////////////////////////////////////////////////////////////////
// Bitmap shader
///////////////////////////////////////////////////////////////////////////////
@@ -76,6 +82,7 @@
SkiaBitmapShader::SkiaBitmapShader(SkBitmap* bitmap, SkShader* key, SkShader::TileMode tileX,
SkShader::TileMode tileY, SkMatrix* matrix, bool blend):
SkiaShader(kBitmap, key, tileX, tileY, matrix, blend), mBitmap(bitmap), mTexture(NULL) {
+ updateLocalMatrix(matrix);
}
void SkiaBitmapShader::describe(ProgramDescription& description, const Extensions& extensions) {
@@ -116,14 +123,7 @@
const float height = texture->height;
mat4 textureTransform;
- if (mMatrix) {
- SkMatrix inverse;
- mMatrix->invert(&inverse);
- textureTransform.load(inverse);
- textureTransform.multiply(modelView);
- } else {
- textureTransform.load(modelView);
- }
+ computeScreenSpaceMatrix(textureTransform, modelView);
// Uniforms
bindTexture(texture->id, mWrapS, mWrapT, textureSlot);
@@ -136,15 +136,7 @@
void SkiaBitmapShader::updateTransforms(Program* program, const mat4& modelView,
const Snapshot& snapshot) {
mat4 textureTransform;
- if (mMatrix) {
- SkMatrix inverse;
- mMatrix->invert(&inverse);
- textureTransform.load(inverse);
- textureTransform.multiply(modelView);
- } else {
- textureTransform.load(modelView);
- }
-
+ computeScreenSpaceMatrix(textureTransform, modelView);
glUniformMatrix4fv(program->getUniform("textureTransform"), 1,
GL_FALSE, &textureTransform.data[0]);
}
@@ -192,23 +184,6 @@
description.gradientType = ProgramDescription::kGradientLinear;
}
-void SkiaLinearGradientShader::computeScreenSpaceMatrix(mat4& screenSpace, const mat4& modelView) {
- screenSpace.loadMultiply(mUnitMatrix, mShaderMatrix);
- screenSpace.multiply(modelView);
-}
-
-void SkiaLinearGradientShader::updateLocalMatrix(const SkMatrix* matrix) {
- if (matrix) {
- mat4 localMatrix(*matrix);
- mShaderMatrix.loadInverse(localMatrix);
- }
-}
-
-void SkiaLinearGradientShader::setMatrix(SkMatrix* matrix) {
- SkiaShader::setMatrix(matrix);
- updateLocalMatrix(matrix);
-}
-
void SkiaLinearGradientShader::setupProgram(Program* program, const mat4& modelView,
const Snapshot& snapshot, GLuint* textureUnit) {
GLuint textureSlot = (*textureUnit)++;
@@ -239,12 +214,23 @@
// Circular gradient shader
///////////////////////////////////////////////////////////////////////////////
+static void toCircularUnitMatrix(const float x, const float y, const float radius,
+ SkMatrix* matrix) {
+ const float inv = 1.0f / radius;
+ matrix->setTranslate(-x, -y);
+ matrix->postScale(inv, inv);
+}
+
SkiaCircularGradientShader::SkiaCircularGradientShader(float x, float y, float radius,
uint32_t* colors, float* positions, int count, SkShader* key, SkShader::TileMode tileMode,
SkMatrix* matrix, bool blend):
SkiaSweepGradientShader(kCircularGradient, x, y, colors, positions, count, key,
- tileMode, matrix, blend),
- mRadius(radius) {
+ tileMode, matrix, blend) {
+ SkMatrix unitMatrix;
+ toCircularUnitMatrix(x, y, radius, &unitMatrix);
+ mUnitMatrix.load(unitMatrix);
+
+ updateLocalMatrix(matrix);
}
void SkiaCircularGradientShader::describe(ProgramDescription& description,
@@ -253,28 +239,31 @@
description.gradientType = ProgramDescription::kGradientCircular;
}
-void SkiaCircularGradientShader::setupProgram(Program* program, const mat4& modelView,
- const Snapshot& snapshot, GLuint* textureUnit) {
- SkiaSweepGradientShader::setupProgram(program, modelView, snapshot, textureUnit);
- glUniform1f(program->getUniform("gradientRadius"), 1.0f / mRadius);
-}
-
///////////////////////////////////////////////////////////////////////////////
// Sweep gradient shader
///////////////////////////////////////////////////////////////////////////////
+static void toSweepUnitMatrix(const float x, const float y, SkMatrix* matrix) {
+ matrix->setTranslate(-x, -y);
+}
+
SkiaSweepGradientShader::SkiaSweepGradientShader(float x, float y, uint32_t* colors,
float* positions, int count, SkShader* key, SkMatrix* matrix, bool blend):
SkiaShader(kSweepGradient, key, SkShader::kClamp_TileMode,
SkShader::kClamp_TileMode, matrix, blend),
- mX(x), mY(y), mColors(colors), mPositions(positions), mCount(count) {
+ mColors(colors), mPositions(positions), mCount(count) {
+ SkMatrix unitMatrix;
+ toSweepUnitMatrix(x, y, &unitMatrix);
+ mUnitMatrix.load(unitMatrix);
+
+ updateLocalMatrix(matrix);
}
SkiaSweepGradientShader::SkiaSweepGradientShader(Type type, float x, float y, uint32_t* colors,
float* positions, int count, SkShader* key, SkShader::TileMode tileMode,
SkMatrix* matrix, bool blend):
SkiaShader(type, key, tileMode, tileMode, matrix, blend),
- mX(x), mY(y), mColors(colors), mPositions(positions), mCount(count) {
+ mColors(colors), mPositions(positions), mCount(count) {
}
SkiaSweepGradientShader::~SkiaSweepGradientShader() {
@@ -298,35 +287,19 @@
texture = mGradientCache->addLinearGradient(mKey, mColors, mPositions, mCount);
}
- float left = mX;
- float top = mY;
-
- mat4 shaderMatrix;
- if (mMatrix) {
- shaderMatrix.load(*mMatrix);
- shaderMatrix.mapPoint(left, top);
- }
-
- mat4 copy(shaderMatrix);
- shaderMatrix.loadInverse(copy);
-
- snapshot.transform->mapPoint(left, top);
-
- mat4 screenSpace(*snapshot.transform);
- screenSpace.multiply(modelView);
+ mat4 screenSpace;
+ computeScreenSpaceMatrix(screenSpace, modelView);
// Uniforms
bindTexture(texture->id, gTileModes[mTileX], gTileModes[mTileY], textureSlot);
glUniform1i(program->getUniform("gradientSampler"), textureSlot);
- glUniformMatrix4fv(program->getUniform("gradientMatrix"), 1, GL_FALSE, &shaderMatrix.data[0]);
- glUniform2f(program->getUniform("gradientStart"), left, top);
glUniformMatrix4fv(program->getUniform("screenSpace"), 1, GL_FALSE, &screenSpace.data[0]);
}
void SkiaSweepGradientShader::updateTransforms(Program* program, const mat4& modelView,
const Snapshot& snapshot) {
- mat4 screenSpace(*snapshot.transform);
- screenSpace.multiply(modelView);
+ mat4 screenSpace;
+ computeScreenSpaceMatrix(screenSpace, modelView);
glUniformMatrix4fv(program->getUniform("screenSpace"), 1, GL_FALSE, &screenSpace.data[0]);
}
diff --git a/libs/hwui/SkiaShader.h b/libs/hwui/SkiaShader.h
index 2c1eb35..2565e65 100644
--- a/libs/hwui/SkiaShader.h
+++ b/libs/hwui/SkiaShader.h
@@ -77,10 +77,21 @@
const Snapshot& snapshot) {
}
- virtual void setMatrix(SkMatrix* matrix) {
- mMatrix = matrix;
+ void setMatrix(SkMatrix* matrix) {
+ updateLocalMatrix(matrix);
}
+ void updateLocalMatrix(const SkMatrix* matrix) {
+ if (matrix) {
+ mat4 localMatrix(*matrix);
+ mShaderMatrix.loadInverse(localMatrix);
+ } else {
+ mShaderMatrix.loadIdentity();
+ }
+ }
+
+ void computeScreenSpaceMatrix(mat4& screenSpace, const mat4& modelView);
+
protected:
inline void bindTexture(GLuint texture, GLenum wrapS, GLenum wrapT, GLuint textureUnit);
@@ -88,11 +99,13 @@
SkShader* mKey;
SkShader::TileMode mTileX;
SkShader::TileMode mTileY;
- SkMatrix* mMatrix;
bool mBlend;
TextureCache* mTextureCache;
GradientCache* mGradientCache;
+
+ mat4 mUnitMatrix;
+ mat4 mShaderMatrix;
}; // struct SkiaShader
@@ -139,15 +152,7 @@
GLuint* textureUnit);
void updateTransforms(Program* program, const mat4& modelView, const Snapshot& snapshot);
- void setMatrix(SkMatrix* matrix);
-
private:
- void updateLocalMatrix(const SkMatrix* matrix);
- void computeScreenSpaceMatrix(mat4& screenSpace, const mat4& modelView);
-
- mat4 mUnitMatrix;
- mat4 mShaderMatrix;
-
float* mBounds;
uint32_t* mColors;
float* mPositions;
@@ -163,7 +168,7 @@
~SkiaSweepGradientShader();
virtual void describe(ProgramDescription& description, const Extensions& extensions);
- virtual void setupProgram(Program* program, const mat4& modelView, const Snapshot& snapshot,
+ void setupProgram(Program* program, const mat4& modelView, const Snapshot& snapshot,
GLuint* textureUnit);
void updateTransforms(Program* program, const mat4& modelView, const Snapshot& snapshot);
@@ -171,7 +176,6 @@
SkiaSweepGradientShader(Type type, float x, float y, uint32_t* colors, float* positions,
int count, SkShader* key, SkShader::TileMode tileMode, SkMatrix* matrix, bool blend);
- float mX, mY;
uint32_t* mColors;
float* mPositions;
int mCount;
@@ -185,11 +189,6 @@
int count, SkShader* key,SkShader::TileMode tileMode, SkMatrix* matrix, bool blend);
void describe(ProgramDescription& description, const Extensions& extensions);
- void setupProgram(Program* program, const mat4& modelView, const Snapshot& snapshot,
- GLuint* textureUnit);
-
-private:
- float mRadius;
}; // struct SkiaCircularGradientShader
/**
diff --git a/libs/rs/scriptc/rs_core.rsh b/libs/rs/scriptc/rs_core.rsh
index 99fc166..9950184 100644
--- a/libs/rs/scriptc/rs_core.rsh
+++ b/libs/rs/scriptc/rs_core.rsh
@@ -1,6 +1,30 @@
#ifndef __RS_CORE_RSH__
#define __RS_CORE_RSH__
+// Debugging, print to the LOG a description string and a value.
+extern void __attribute__((overloadable))
+ rsDebug(const char *, float);
+extern void __attribute__((overloadable))
+ rsDebug(const char *, float, float);
+extern void __attribute__((overloadable))
+ rsDebug(const char *, float, float, float);
+extern void __attribute__((overloadable))
+ rsDebug(const char *, float, float, float, float);
+extern void __attribute__((overloadable))
+ rsDebug(const char *, const rs_matrix4x4 *);
+extern void __attribute__((overloadable))
+ rsDebug(const char *, const rs_matrix3x3 *);
+extern void __attribute__((overloadable))
+ rsDebug(const char *, const rs_matrix2x2 *);
+extern void __attribute__((overloadable))
+ rsDebug(const char *, int);
+extern void __attribute__((overloadable))
+ rsDebug(const char *, uint);
+extern void __attribute__((overloadable))
+ rsDebug(const char *, const void *);
+#define RS_DEBUG(a) rsDebug(#a, a)
+#define RS_DEBUG_MARKER rsDebug(__FILE__, __LINE__)
+
static void __attribute__((overloadable)) rsDebug(const char *s, float2 v) {
rsDebug(s, v.x, v.y);
}
diff --git a/libs/rs/scriptc/rs_math.rsh b/libs/rs/scriptc/rs_math.rsh
index 5720b05..d059997 100644
--- a/libs/rs/scriptc/rs_math.rsh
+++ b/libs/rs/scriptc/rs_math.rsh
@@ -1,34 +1,6 @@
#ifndef __RS_MATH_RSH__
#define __RS_MATH_RSH__
-// Debugging, print to the LOG a description string and a value.
-extern void __attribute__((overloadable))
- rsDebug(const char *, float);
-extern void __attribute__((overloadable))
- rsDebug(const char *, float, float);
-extern void __attribute__((overloadable))
- rsDebug(const char *, float, float, float);
-extern void __attribute__((overloadable))
- rsDebug(const char *, float, float, float, float);
-extern void __attribute__((overloadable))
- rsDebug(const char *, const rs_matrix4x4 *);
-extern void __attribute__((overloadable))
- rsDebug(const char *, const rs_matrix3x3 *);
-extern void __attribute__((overloadable))
- rsDebug(const char *, const rs_matrix2x2 *);
-extern void __attribute__((overloadable))
- rsDebug(const char *, int);
-extern void __attribute__((overloadable))
- rsDebug(const char *, uint);
-extern void __attribute__((overloadable))
- rsDebug(const char *, const void *);
-#define RS_DEBUG(a) rsDebug(#a, a)
-#define RS_DEBUG_MARKER rsDebug(__FILE__, __LINE__)
-
-
-#include "rs_cl.rsh"
-#include "rs_core.rsh"
-
extern void __attribute__((overloadable))
rsSetObject(rs_element *dst, rs_element src);
extern void __attribute__((overloadable))
diff --git a/libs/rs/scriptc/rs_types.rsh b/libs/rs/scriptc/rs_types.rsh
index dd42972..212eb83 100644
--- a/libs/rs/scriptc/rs_types.rsh
+++ b/libs/rs/scriptc/rs_types.rsh
@@ -1,3 +1,5 @@
+#ifndef __RS_TYPES_RSH__
+#define __RS_TYPES_RSH__
typedef char int8_t;
typedef short int16_t;
@@ -72,3 +74,4 @@
#define RS_PACKED __attribute__((packed, aligned(4)))
+#endif
diff --git a/media/java/android/media/MediaScanner.java b/media/java/android/media/MediaScanner.java
index bc5f9fa..e5fa0f8 100644
--- a/media/java/android/media/MediaScanner.java
+++ b/media/java/android/media/MediaScanner.java
@@ -117,6 +117,10 @@
Files.FileColumns.DATE_MODIFIED, // 3
};
+ private static final String[] ID_PROJECTION = new String[] {
+ Files.FileColumns._ID,
+ };
+
private static final int FILES_PRESCAN_ID_COLUMN_INDEX = 0;
private static final int FILES_PRESCAN_PATH_COLUMN_INDEX = 1;
private static final int FILES_PRESCAN_FORMAT_COLUMN_INDEX = 2;
@@ -933,6 +937,14 @@
c.close();
}
}
+
+ // compute original size of images
+ mOriginalCount = 0;
+ c = mMediaProvider.query(mImagesUri, ID_PROJECTION, null, null, null);
+ if (c != null) {
+ mOriginalCount = c.getCount();
+ c.close();
+ }
}
private boolean inScanDirectory(String path, String[] directories) {
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_sysbar_ime_default.png b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_ime_default.png
new file mode 100644
index 0000000..bf33c946
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_ime_default.png
Binary files differ
diff --git a/packages/SystemUI/res/layout-xlarge/status_bar.xml b/packages/SystemUI/res/layout-xlarge/status_bar.xml
index 6aee011..494dfa8 100644
--- a/packages/SystemUI/res/layout-xlarge/status_bar.xml
+++ b/packages/SystemUI/res/layout-xlarge/status_bar.xml
@@ -28,11 +28,11 @@
>
<ImageView
- class="com.android.systemui.statusbar.tablet.NotificationIconArea$MoreView"
android:id="@+id/expand"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_sysbar_open"
+ android:background="@drawable/ic_sysbar_icon_bg"
android:paddingLeft="6dip"
android:onClick="notificationIconsClicked"
/>
@@ -100,8 +100,18 @@
android:background="@drawable/sysbar_hidenotification_handle"
android:layout_marginLeft="8dip"
/>
+ <com.android.systemui.statusbar.tablet.InputMethodButton
+ android:id="@+id/imeButton"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_marginLeft="8dip"
+ android:src="@drawable/ic_sysbar_ime_default"
+ android:background="@drawable/ic_sysbar_icon_bg"
+ android:visibility="visible"
+ />
</com.android.systemui.statusbar.tablet.NotificationIconArea>
+
<FrameLayout
android:id="@+id/ticker"
android:layout_width="wrap_content"
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodButton.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodButton.java
new file mode 100644
index 0000000..ba682b7
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodButton.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.statusbar.tablet;
+
+import android.content.Context;
+import android.util.Slog;
+import android.view.View;
+import android.util.AttributeSet;
+import android.widget.ImageView;
+import android.view.inputmethod.InputMethodManager;
+
+import com.android.server.InputMethodManagerService;
+
+public class InputMethodButton extends ImageView {
+
+ // other services we wish to talk to
+ InputMethodManager mImm;
+
+ public InputMethodButton(Context context, AttributeSet attrs) {
+ super(context, attrs);
+
+ // IME hookup
+ mImm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
+
+ // TODO: read the current icon & visibility state directly from the service
+
+ // TODO: register for notifications about changes to visibility & subtype from service
+
+ setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ mImm.showInputMethodSubtypePicker();
+ }
+ });
+ }
+}
+
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java
index dc4194c..70bde01 100644
--- a/services/java/com/android/server/InputMethodManagerService.java
+++ b/services/java/com/android/server/InputMethodManagerService.java
@@ -84,6 +84,7 @@
import java.text.Collator;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
@@ -1567,14 +1568,15 @@
int lastInputMethodSubtypeId = getSelectedInputMethodSubtypeId(lastInputMethodId);
if (DEBUG) Slog.v(TAG, "Current IME: " + lastInputMethodId);
- final List<InputMethodInfo> immis = getEnabledInputMethodList();
- ArrayList<Integer> subtypeIds = new ArrayList<Integer>();
-
- if (immis == null) {
- return;
- }
-
synchronized (mMethodMap) {
+ final List<Pair<InputMethodInfo, ArrayList<String>>> immis =
+ mSettings.getEnabledInputMethodAndSubtypeListLocked();
+ ArrayList<Integer> subtypeIds = new ArrayList<Integer>();
+
+ if (immis == null || immis.size() == 0) {
+ return;
+ }
+
hideInputMethodMenuLocked();
int N = immis.size();
@@ -1583,32 +1585,38 @@
new TreeMap<CharSequence, Pair<InputMethodInfo, Integer>>(Collator.getInstance());
for (int i = 0; i < N; ++i) {
- InputMethodInfo property = immis.get(i);
+ InputMethodInfo property = immis.get(i).first;
+ final ArrayList<String> enabledSubtypeIds = immis.get(i).second;
+ HashSet<String> enabledSubtypeSet = new HashSet<String>();
+ for (String s : enabledSubtypeIds) {
+ enabledSubtypeSet.add(s);
+ }
if (property == null) {
continue;
}
- // TODO: Show only enabled subtypes
ArrayList<InputMethodSubtype> subtypes = property.getSubtypes();
CharSequence label = property.loadLabel(pm);
- if (showSubtypes && subtypes.size() > 0) {
+ if (showSubtypes && enabledSubtypeSet.size() > 0) {
for (int j = 0; j < subtypes.size(); ++j) {
InputMethodSubtype subtype = subtypes.get(j);
- CharSequence title;
- int nameResId = subtype.getNameResId();
- int modeResId = subtype.getModeResId();
- if (nameResId != 0) {
- title = pm.getText(property.getPackageName(), nameResId,
- property.getServiceInfo().applicationInfo);
- } else {
- CharSequence language = subtype.getLocale();
- CharSequence mode = modeResId == 0 ? null
- : pm.getText(property.getPackageName(), modeResId,
- property.getServiceInfo().applicationInfo);
- // TODO: Use more friendly Title and UI
- title = label + "," + (mode == null ? "" : mode) + ","
- + (language == null ? "" : language);
+ if (enabledSubtypeSet.contains(String.valueOf(subtype.hashCode()))) {
+ CharSequence title;
+ int nameResId = subtype.getNameResId();
+ int modeResId = subtype.getModeResId();
+ if (nameResId != 0) {
+ title = pm.getText(property.getPackageName(), nameResId,
+ property.getServiceInfo().applicationInfo);
+ } else {
+ CharSequence language = subtype.getLocale();
+ CharSequence mode = modeResId == 0 ? null
+ : pm.getText(property.getPackageName(), modeResId,
+ property.getServiceInfo().applicationInfo);
+ // TODO: Use more friendly Title and UI
+ title = label + "," + (mode == null ? "" : mode) + ","
+ + (language == null ? "" : language);
+ }
+ imMap.put(title, new Pair<InputMethodInfo, Integer>(property, j));
}
- imMap.put(title, new Pair<InputMethodInfo, Integer>(property, j));
}
} else {
imMap.put(label,
@@ -1678,6 +1686,20 @@
}
});
+ if (showSubtypes) {
+ mDialogBuilder.setPositiveButton(com.android.internal.R.string.more_item_label,
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int whichButton) {
+ showInputMethodAndSubtypeEnabler();
+ }
+ });
+ }
+ mDialogBuilder.setNegativeButton(com.android.internal.R.string.cancel,
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int whichButton) {
+ hideInputMethodMenu();
+ }
+ });
mSwitchingDialog = mDialogBuilder.create();
mSwitchingDialog.getWindow().setType(
WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG);
@@ -1864,6 +1886,12 @@
getEnabledInputMethodsAndSubtypeListLocked());
}
+ public List<Pair<InputMethodInfo, ArrayList<String>>>
+ getEnabledInputMethodAndSubtypeListLocked() {
+ return createEnabledInputMethodAndSubtypeListLocked(
+ getEnabledInputMethodsAndSubtypeListLocked());
+ }
+
// At the initial boot, the settings for input methods are not set,
// so we need to enable IME in that case.
public void enableAllIMEsIfThereIsNoEnabledIME() {
@@ -1960,6 +1988,20 @@
return res;
}
+ private List<Pair<InputMethodInfo, ArrayList<String>>>
+ createEnabledInputMethodAndSubtypeListLocked(
+ List<Pair<String, ArrayList<String>>> imsList) {
+ final ArrayList<Pair<InputMethodInfo, ArrayList<String>>> res
+ = new ArrayList<Pair<InputMethodInfo, ArrayList<String>>>();
+ for (Pair<String, ArrayList<String>> ims : imsList) {
+ InputMethodInfo info = mMethodMap.get(ims.first);
+ if (info != null) {
+ res.add(new Pair<InputMethodInfo, ArrayList<String>>(info, ims.second));
+ }
+ }
+ return res;
+ }
+
private void putEnabledInputMethodsStr(String str) {
Settings.Secure.putString(mResolver, Settings.Secure.ENABLED_INPUT_METHODS, str);
mEnabledInputMethodsStrCache = str;
diff --git a/services/java/com/android/server/connectivity/Tethering.java b/services/java/com/android/server/connectivity/Tethering.java
index bfac346..0623f5b 100644
--- a/services/java/com/android/server/connectivity/Tethering.java
+++ b/services/java/com/android/server/connectivity/Tethering.java
@@ -113,7 +113,7 @@
private String[] mDnsServers;
private static final String DNS_DEFAULT_SERVER1 = "8.8.8.8";
- private static final String DNS_DEFAULT_SERVER2 = "4.2.2.2";
+ private static final String DNS_DEFAULT_SERVER2 = "8.8.4.4";
// resampled each time we turn on tethering - used as cache for settings/config-val
private boolean mDunRequired; // configuration info - must use DUN apn on 3g
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/GradientsActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/GradientsActivity.java
index 769bfdd..8fa626b 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/GradientsActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/GradientsActivity.java
@@ -18,11 +18,16 @@
import android.app.Activity;
import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.LinearGradient;
+import android.graphics.RadialGradient;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Shader;
+import android.graphics.SweepGradient;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
@@ -36,8 +41,13 @@
super.onCreate(savedInstanceState);
final FrameLayout layout = new FrameLayout(this);
+
final ShadersView shadersView = new ShadersView(this);
final GradientView gradientView = new GradientView(this);
+ final RadialGradientView radialGradientView = new RadialGradientView(this);
+ final SweepGradientView sweepGradientView = new SweepGradientView(this);
+ final BitmapView bitmapView = new BitmapView(this);
+
final SeekBar rotateView = new SeekBar(this);
rotateView.setMax(360);
rotateView.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@@ -51,13 +61,29 @@
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
- gradientView.setRotationY((float)progress);
+ gradientView.setRotationY((float) progress);
+ radialGradientView.setRotationX((float) progress);
+ sweepGradientView.setRotationY((float) progress);
+ bitmapView.setRotationX((float) progress);
}
});
layout.addView(shadersView);
layout.addView(gradientView, new FrameLayout.LayoutParams(
200, 200, Gravity.CENTER));
+
+ FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(200, 200, Gravity.CENTER);
+ lp.setMargins(220, 0, 0, 0);
+ layout.addView(radialGradientView, lp);
+
+ lp = new FrameLayout.LayoutParams(200, 200, Gravity.CENTER);
+ lp.setMargins(440, 0, 0, 0);
+ layout.addView(sweepGradientView, lp);
+
+ lp = new FrameLayout.LayoutParams(200, 200, Gravity.CENTER);
+ lp.setMargins(220, -220, 0, 0);
+ layout.addView(bitmapView, lp);
+
layout.addView(rotateView, new FrameLayout.LayoutParams(
300, FrameLayout.LayoutParams.WRAP_CONTENT,
Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM));
@@ -65,6 +91,32 @@
setContentView(layout);
}
+ static class BitmapView extends View {
+ private final Paint mPaint;
+
+ BitmapView(Context c) {
+ super(c);
+
+ Bitmap texture = BitmapFactory.decodeResource(c.getResources(), R.drawable.sunset1);
+ BitmapShader shader = new BitmapShader(texture, Shader.TileMode.REPEAT,
+ Shader.TileMode.REPEAT);
+ mPaint = new Paint();
+ mPaint.setShader(shader);
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+ setMeasuredDimension(200, 200);
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+ canvas.drawRect(0.0f, 0.0f, getWidth(), getHeight(), mPaint);
+ }
+ }
+
static class GradientView extends View {
private final Paint mPaint;
@@ -90,6 +142,55 @@
}
}
+ static class RadialGradientView extends View {
+ private final Paint mPaint;
+
+ RadialGradientView(Context c) {
+ super(c);
+
+ RadialGradient gradient = new RadialGradient(0.0f, 0.0f, 100.0f, 0xff000000, 0xffffffff,
+ Shader.TileMode.MIRROR);
+ mPaint = new Paint();
+ mPaint.setShader(gradient);
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+ setMeasuredDimension(200, 200);
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+ canvas.drawRect(0.0f, 0.0f, getWidth(), getHeight(), mPaint);
+ }
+ }
+
+ static class SweepGradientView extends View {
+ private final Paint mPaint;
+
+ SweepGradientView(Context c) {
+ super(c);
+
+ SweepGradient gradient = new SweepGradient(100.0f, 100.0f, 0xff000000, 0xffffffff);
+ mPaint = new Paint();
+ mPaint.setShader(gradient);
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+ setMeasuredDimension(200, 200);
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+ canvas.drawRect(0.0f, 0.0f, getWidth(), getHeight(), mPaint);
+ }
+ }
+
static class ShadersView extends View {
private final Paint mPaint;
private final float mDrawWidth;