diff options
| -rw-r--r-- | core/java/android/app/SearchDialog.java | 19 | ||||
| -rw-r--r-- | core/java/android/app/SearchManager.java | 5 | ||||
| -rw-r--r-- | core/java/android/app/SuggestionsAdapter.java | 25 | ||||
| -rw-r--r-- | core/java/com/google/android/util/GoogleWebContentHelper.java | 9 | ||||
| -rw-r--r-- | opengl/tests/lighting1709/Android.mk | 11 | ||||
| -rw-r--r-- | opengl/tests/lighting1709/AndroidManifest.xml | 13 | ||||
| -rw-r--r-- | opengl/tests/lighting1709/src/com/android/lightingtest/ClearActivity.java | 281 | ||||
| -rw-r--r-- | tests/DumpRenderTree/AndroidManifest.xml | 1 | ||||
| -rw-r--r-- | tests/DumpRenderTree/src/com/android/dumprendertree/ReliabilityTest.java | 1 |
9 files changed, 361 insertions, 4 deletions
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java index ff110c86231f..3675ec2c4684 100644 --- a/core/java/android/app/SearchDialog.java +++ b/core/java/android/app/SearchDialog.java @@ -1275,11 +1275,28 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS private void handleCursorRespondIntent(Intent intent) { Cursor c = mSuggestionsAdapter.getCursor(); if (c != null) { - c.respond(intent.getExtras()); + Bundle response = c.respond(intent.getExtras()); + + // The SHOW_CORPUS_SELECTORS command to the cursor also returns a value in + // its bundle, keyed by the same command string, which contains the index + // of the "More results..." list item, which we use to instruct the + // AutoCompleteTextView's list to scroll to that item when the item is + // clicked. + if (response.containsKey(SuggestionsAdapter.SHOW_CORPUS_SELECTORS)) { + int indexOfMore = response.getInt(SuggestionsAdapter.SHOW_CORPUS_SELECTORS); + mSuggestionsAdapter.setListItemToSelect(indexOfMore); + } } } /** + * Sets the list item selection in the AutoCompleteTextView's ListView. + */ + public void setListSelection(int index) { + mSearchAutoComplete.setListSelection(index); + } + + /** * Saves the previous component that was searched, so that we can go * back to it. */ diff --git a/core/java/android/app/SearchManager.java b/core/java/android/app/SearchManager.java index 3bf37c3b2b01..be2f50f0d799 100644 --- a/core/java/android/app/SearchManager.java +++ b/core/java/android/app/SearchManager.java @@ -1302,9 +1302,10 @@ public class SearchManager /** * Column name for suggestions cursor. <i>Optional.</i> This column allows suggestions * to provide additional arbitrary data which will be included as an extra under the key - * {@link #EXTRA_DATA_KEY}. + * {@link #EXTRA_DATA_KEY}. For use by the global search system only - if other providers + * attempt to use this column, the value will be overwritten by global search. * - * @hide pending API council approval + * @hide */ public final static String SUGGEST_COLUMN_INTENT_EXTRA_DATA = "suggest_intent_extra_data"; /** diff --git a/core/java/android/app/SuggestionsAdapter.java b/core/java/android/app/SuggestionsAdapter.java index aeb96b4cbcba..4406f8e760fe 100644 --- a/core/java/android/app/SuggestionsAdapter.java +++ b/core/java/android/app/SuggestionsAdapter.java @@ -50,6 +50,11 @@ class SuggestionsAdapter extends ResourceCursorAdapter { // so we can correctly display (or not display) the 'working' spinner in the search dialog. public static final String IS_WORKING = "isWorking"; + // The value used to tell a cursor to display the corpus selectors, if this is global + // search. Also returns the index of the more results item to allow the SearchDialog + // to tell the ListView to scroll to that list item. + public static final String SHOW_CORPUS_SELECTORS = "showCorpusSelectors"; + private static final boolean DBG = false; private static final String LOG_TAG = "SuggestionsAdapter"; @@ -68,6 +73,13 @@ class SuggestionsAdapter extends ResourceCursorAdapter { private int mIconBitmap1Col; private int mIconBitmap2Col; + // This value is stored in SuggestionsAdapter by the SearchDialog to indicate whether + // a particular list item should be selected upon the next call to notifyDataSetChanged. + // This is used to indicate the index of the "More results..." list item so that when + // the data set changes after a click of "More results...", we can correctly tell the + // ListView to scroll to the right line item. It gets reset to -1 every time it is consumed. + private int mListItemToSelect = -1; + public SuggestionsAdapter(Context context, SearchDialog searchDialog, SearchableInfo searchable, WeakHashMap<String, Drawable> outsideDrawablesCache, boolean globalSearchMode) { super(context, @@ -134,6 +146,19 @@ class SuggestionsAdapter extends ResourceCursorAdapter { public void notifyDataSetChanged() { super.notifyDataSetChanged(); updateWorking(); + if (mListItemToSelect != -1) { + mSearchDialog.setListSelection(mListItemToSelect); + mListItemToSelect = -1; + } + } + + /** + * Specifies the list item to select upon next call of {@link #notifyDataSetChanged()}, + * in order to let us scroll the "More results..." list item to the top of the screen + * (or as close as it can get) when clicked. + */ + public void setListItemToSelect(int index) { + mListItemToSelect = index; } /** diff --git a/core/java/com/google/android/util/GoogleWebContentHelper.java b/core/java/com/google/android/util/GoogleWebContentHelper.java index 291142008934..3cdf85592970 100644 --- a/core/java/com/google/android/util/GoogleWebContentHelper.java +++ b/core/java/com/google/android/util/GoogleWebContentHelper.java @@ -130,7 +130,14 @@ public class GoogleWebContentHelper { mWebView.loadUrl(mSecureUrl); return this; } - + + public GoogleWebContentHelper loadDataWithFailUrl(String base, String data, + String mimeType, String encoding, String failUrl) { + ensureViews(); + mWebView.loadDataWithBaseURL(base, data, mimeType, encoding, failUrl); + return this; + } + /** * Helper to handle the back key. Returns true if the back key was handled, * otherwise returns false. diff --git a/opengl/tests/lighting1709/Android.mk b/opengl/tests/lighting1709/Android.mk new file mode 100644 index 000000000000..9563e617f3aa --- /dev/null +++ b/opengl/tests/lighting1709/Android.mk @@ -0,0 +1,11 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_MODULE_TAGS := tests + +LOCAL_SRC_FILES := $(call all-subdir-java-files) + +LOCAL_PACKAGE_NAME := LightingTest +LOCAL_CERTIFICATE := platform + +include $(BUILD_PACKAGE) diff --git a/opengl/tests/lighting1709/AndroidManifest.xml b/opengl/tests/lighting1709/AndroidManifest.xml new file mode 100644 index 000000000000..6c23d422f5ec --- /dev/null +++ b/opengl/tests/lighting1709/AndroidManifest.xml @@ -0,0 +1,13 @@ +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.lightingtest"> + + <application> + <activity android:name="ClearActivity" android:label="LightingTest"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.DEFAULT" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + </application> +</manifest> diff --git a/opengl/tests/lighting1709/src/com/android/lightingtest/ClearActivity.java b/opengl/tests/lighting1709/src/com/android/lightingtest/ClearActivity.java new file mode 100644 index 000000000000..3dc31cc617e2 --- /dev/null +++ b/opengl/tests/lighting1709/src/com/android/lightingtest/ClearActivity.java @@ -0,0 +1,281 @@ +/* + * Copyright (C) 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. + */ + +package com.android.lightingtest; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.FloatBuffer; + +import javax.microedition.khronos.egl.EGL10; +import javax.microedition.khronos.egl.EGLConfig; +import javax.microedition.khronos.opengles.GL10; + +import android.app.Activity; +import android.content.Context; +import android.opengl.GLSurfaceView; +import android.os.Bundle; +import android.util.Log; +import android.view.MotionEvent; + +public class ClearActivity extends Activity { + @Override + protected void onCreate(Bundle savedInstanceState) { + instance = counter++; + Log.e("ClearActivity", ":::::: onCreate: instance" + instance + " is created"); + super.onCreate(savedInstanceState); + mGLView = new ClearGLSurfaceView(this); + setContentView(mGLView); + } + + @Override + protected void onPause() { + Log.e("ClearActivity", ":::::: instance" + instance + " onPause: is called"); + super.onPause(); + mGLView.onPause(); + } + + @Override + protected void onResume() { + Log.e("ClearActivity", ":::::: instance" + instance + " onResume: is called"); + super.onResume(); + mGLView.onResume(); + } + + @Override + protected void onStop() { + Log.e("ClearActivity", ":::::: instance" + instance + " onStop: is called"); + super.onStop(); + } + + @Override + protected void onDestroy() { + Log.e("ClearActivity", ":::::: instance" + instance + " onDestroy: is called"); + super.onDestroy(); + } + + private GLSurfaceView mGLView; + + private static int counter = 0; + private int instance; +} + +class ClearGLSurfaceView extends GLSurfaceView { + public ClearGLSurfaceView(Context context) { + super(context); + instance = counter++; + Log.e("ClearGLSurfaceView", ":::::: instance" + instance + " is created"); + mRenderer = new ClearRenderer(); + setRenderer(mRenderer); + } + + public boolean onTouchEvent(final MotionEvent event) { + switch (event.getAction()) { + case MotionEvent.ACTION_DOWN: + case MotionEvent.ACTION_MOVE: {// falling through on purpose here + Log.e("ClearGLSurfaceView", ":::::: instance" + instance + " onTouchEvent: handling down or move action"); + queueEvent(new Runnable(){ + public void run() { + mRenderer.setColor(event.getX() / getWidth(), + event.getY() / getHeight(), 1.0f); + }} + ); + return true; + } + case MotionEvent.ACTION_UP: { + // launch a second instance of the same activity + Log.e("ClearGLSurfaceView", ":::::: instance" + instance + " onTouchEvent: handling up action"); + // Intent intent = new Intent(); + // intent.setClass(getContext(), ClearActivity.class); + // getContext().startActivity(intent); + } + + } + return true; + } + + @Override + protected void onDetachedFromWindow() { + Log.e("ClearGLSurfaceView", ":::::: instance" + instance + " onDetachedFromWindow: is called"); + super.onDetachedFromWindow(); + } + + ClearRenderer mRenderer; + + private static int counter = 0; + private int instance; +} + +class ClearRenderer implements GLSurfaceView.Renderer { + public ClearRenderer() { + instance = counter++; + Log.e("ClearRenderer", ":::::: instance" + instance + " is created"); + } + + public void onSurfaceCreated(GL10 gl, EGLConfig config) { + // Do nothing special. + Log.e("ClearRenderer", ":::::: instance" + instance + " onSurfaceCreated: is called"); + } + + public void onSurfaceChanged(GL10 gl, int w, int h) { + Log.e("ClearRenderer", ":::::: instance" + instance + " onSurfaceChanged: is called"); + + // Compute the projection matrix + gl.glMatrixMode(GL10.GL_PROJECTION); + gl.glLoadIdentity(); + + // Compute the boundaries of the frustum + float fl = (float) (-(w / 2)) / 288; + float fr = (float) (w / 2) / 288; + float ft = (float) (h / 2) / 288; + float fb = (float) (-(h / 2)) / 288; + + // Set the view frustum + gl.glFrustumf(fl, fr, fb, ft, 1.0f, 2000.0f); + + // Set the viewport dimensions + gl.glMatrixMode(GL10.GL_MODELVIEW); + gl.glLoadIdentity(); + gl.glViewport(0, 0, w, h); + } + + public void onDrawFrame(GL10 gl) { + // gl.glClearColor(mRed, mGreen, mBlue, 1.0f); + gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); + + float lightOff[] = {0.0f, 0.0f, 0.0f, 1.0f}; + float lightAmbient[] = {5.0f, 0.0f, 0.0f, 1.0f}; + float lightDiffuse[] = {0.0f, 2.0f, 0.0f, 0.0f}; + float lightPosAmbient[] = {0.0f, 0.0f, 0.0f, 1.0f}; + float lightPosSpot[] = {0.0f, 0.0f, -8.0f, 1.0f}; + + + float v[] = new float[9]; + ByteBuffer vbb = ByteBuffer.allocateDirect(v.length*4); + vbb.order(ByteOrder.nativeOrder()); + FloatBuffer vb = vbb.asFloatBuffer(); + + gl.glDisable(GL10.GL_DITHER); + + gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_SPECULAR, lightOff, 0); + gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_DIFFUSE, lightOff, 0); + gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_AMBIENT, lightAmbient, 0); + gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_POSITION, lightPosAmbient, 0); + gl.glEnable(GL10.GL_LIGHT0); + + gl.glLightfv(GL10.GL_LIGHT1, GL10.GL_SPECULAR, lightOff, 0); + gl.glLightfv(GL10.GL_LIGHT1, GL10.GL_DIFFUSE, lightDiffuse, 0); + gl.glLightfv(GL10.GL_LIGHT1, GL10.GL_AMBIENT, lightOff, 0); + gl.glLightfv(GL10.GL_LIGHT1, GL10.GL_POSITION, lightPosSpot, 0); + gl.glLightf(GL10.GL_LIGHT1, GL10.GL_CONSTANT_ATTENUATION, 1.0f); + gl.glLightf(GL10.GL_LIGHT1, GL10.GL_LINEAR_ATTENUATION, 0.0f); + gl.glLightf(GL10.GL_LIGHT1, GL10.GL_QUADRATIC_ATTENUATION, 0.022f); + gl.glEnable(GL10.GL_LIGHT1); + + gl.glEnable(GL10.GL_LIGHTING); + + // draw upper left triangle + gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); + v[0] = -6f; v[1] = 0.5f; v[2] = -10f; + v[3] = -5f; v[4] = 2.5f; v[5] = -10f; + v[6] = -4f; v[7] = 0.5f; v[8] = -10f; + vb.put(v).position(0); + gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vb); + gl.glNormal3f(0, 0, 1); + gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 3); + + // draw upper middle triangle + gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); + v[0] = -1f; v[1] = 0.5f; v[2] = -10f; + v[3] = 0f; v[4] = 2.5f; v[5] = -10f; + v[6] = 1f; v[7] = 0.5f; v[8] = -10f; + vb.put(v).position(0); + gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vb); + gl.glNormal3f(0, 0, 1); + gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 3); + + // draw upper right triangle + gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); + v[0] = 4f; v[1] = 0.5f; v[2] = -10f; + v[3] = 5f; v[4] = 2.5f; v[5] = -10f; + v[6] = 6f; v[7] = 0.5f; v[8] = -10f; + vb.put(v).position(0); + gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vb); + gl.glNormal3f(0, 0, 1); + gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 3); + + // draw lower left triangle + gl.glPushMatrix(); + gl.glTranslatef(-5.0f, -1.5f, 0.0f); + gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); + v[0] = -1; v[1] = -1; v[2] = -10; + v[3] = 0; v[4] = 1; v[5] = -10; + v[6] = 1; v[7] = -1; v[8] = -10; + vb.put(v).position(0); + gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vb); + gl.glNormal3f(0, 0, 1); + gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 3); + gl.glPopMatrix(); + + // draw lower middle triangle + gl.glPushMatrix(); + gl.glTranslatef(0.0f, -1.5f, 0.0f); + gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); + v[0] = -1; v[1] = -1; v[2] = -10; + v[3] = 0; v[4] = 1; v[5] = -10; + v[6] = 1; v[7] = -1; v[8] = -10; + vb.put(v).position(0); + gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vb); + gl.glNormal3f(0, 0, 1); + gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 3); + gl.glPopMatrix(); + + // draw lower right triangle + gl.glPushMatrix(); + gl.glTranslatef(5.0f, -1.5f, 0.0f); + gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); + v[0] = -1; v[1] = -1; v[2] = -10; + v[3] = 0; v[4] = 1; v[5] = -10; + v[6] = 1; v[7] = -1; v[8] = -10; + vb.put(v).position(0); + gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vb); + gl.glNormal3f(0, 0, 1); + gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 3); + gl.glPopMatrix(); + + } + + public int[] getConfigSpec() { + Log.e("ClearRenderer", ":::::: instance" + instance + " getConfigSpec: is called"); + int[] configSpec = { EGL10.EGL_DEPTH_SIZE, 16, EGL10.EGL_NONE }; + return configSpec; + } + + public void setColor(float r, float g, float b) { + Log.e("ClearRenderer", ":::::: instance" + instance + " setColor: is called"); + mRed = r; + mGreen = g; + mBlue = b; + } + + private float mRed; + private float mGreen; + private float mBlue; + + private static int counter = 0; + private int instance; +} + diff --git a/tests/DumpRenderTree/AndroidManifest.xml b/tests/DumpRenderTree/AndroidManifest.xml index 8960dd2426d3..efa41131be31 100644 --- a/tests/DumpRenderTree/AndroidManifest.xml +++ b/tests/DumpRenderTree/AndroidManifest.xml @@ -33,4 +33,5 @@ /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WRITE_SDCARD" /> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> </manifest> diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/ReliabilityTest.java b/tests/DumpRenderTree/src/com/android/dumprendertree/ReliabilityTest.java index 8f0ca9f30684..081ddafa24ec 100644 --- a/tests/DumpRenderTree/src/com/android/dumprendertree/ReliabilityTest.java +++ b/tests/DumpRenderTree/src/com/android/dumprendertree/ReliabilityTest.java @@ -80,6 +80,7 @@ public class ReliabilityTest extends ActivityInstrumentationTestCase2<Reliabilit System.gc(); System.gc(); } + updateTestStatus(TEST_DONE); activity.finish(); listReader.close(); } |