Merge change 20898
* changes:
The triumphant return of the shell scripts, with bugreports, less code dup, and enhanced readability.
diff --git a/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java b/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java
index 6b6d3c9..8c15d0b 100644
--- a/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java
+++ b/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java
@@ -315,8 +315,7 @@
for (RestoreSet s : sets) {
if (s.token == token) {
System.out.println("Scheduling restore: " + s.name);
- mRestore.performRestore(token, observer);
- didRestore = true;
+ didRestore = (mRestore.performRestore(token, observer) == 0);
break;
}
}
@@ -330,12 +329,15 @@
}
}
- // now wait for it to be done
- synchronized (observer) {
- while (!observer.done) {
- try {
- observer.wait();
- } catch (InterruptedException ex) {
+ // if we kicked off a restore successfully, we have to wait for it
+ // to complete before we can shut down the restore session safely
+ if (didRestore) {
+ synchronized (observer) {
+ while (!observer.done) {
+ try {
+ observer.wait();
+ } catch (InterruptedException ex) {
+ }
}
}
}
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java
index 9c20a4b..b75bec2 100644
--- a/core/java/android/app/SearchDialog.java
+++ b/core/java/android/app/SearchDialog.java
@@ -67,6 +67,7 @@
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
+import android.widget.ListAdapter;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemSelectedListener;
@@ -1750,7 +1751,7 @@
// case we want to dismiss the soft keyboard so the user can see the rest of the
// shortcuts.
if (isInputMethodNotNeeded() ||
- (isEmpty() && getDropDownChildCount() >= getAdapter().getCount())) {
+ (isEmpty() && getDropDownChildCount() >= getAdapterCount())) {
mSearchDialog.cancel();
return true;
}
@@ -1758,6 +1759,11 @@
}
return false;
}
+
+ private int getAdapterCount() {
+ final ListAdapter adapter = getAdapter();
+ return adapter == null ? 0 : adapter.getCount();
+ }
}
protected boolean handleBackKey(int keyCode, KeyEvent event) {
diff --git a/core/java/android/app/SearchManager.java b/core/java/android/app/SearchManager.java
index fd559d6..7ad6423 100644
--- a/core/java/android/app/SearchManager.java
+++ b/core/java/android/app/SearchManager.java
@@ -40,7 +40,7 @@
* methods and the the {@link android.content.Intent#ACTION_SEARCH ACTION_SEARCH}
* {@link android.content.Intent Intent}. This class does provide a basic
* overview of search services and how to integrate them with your activities.
- * If you do require direct access to the Search Manager, do not instantiate
+ * If you do require direct access to the SearchManager, do not instantiate
* this class directly; instead, retrieve it through
* {@link android.content.Context#getSystemService
* context.getSystemService(Context.SEARCH_SERVICE)}.
@@ -49,9 +49,10 @@
* <ol>
* <li><a href="#DeveloperGuide">Developer Guide</a>
* <li><a href="#HowSearchIsInvoked">How Search Is Invoked</a>
- * <li><a href="#QuerySearchApplications">Query-Search Applications</a>
- * <li><a href="#FilterSearchApplications">Filter-Search Applications</a>
+ * <li><a href="#ImplementingSearchForYourApp">Implementing Search for Your App</a>
* <li><a href="#Suggestions">Search Suggestions</a>
+ * <li><a href="#ExposingSearchSuggestionsToQuickSearchBox">Exposing Search Suggestions to
+ * Quick Search Box</a></li>
* <li><a href="#ActionKeys">Action Keys</a>
* <li><a href="#SearchabilityMetadata">Searchability Metadata</a>
* <li><a href="#PassingSearchContext">Passing Search Context</a>
@@ -62,37 +63,18 @@
* <h3>Developer Guide</h3>
*
* <p>The ability to search for user, system, or network based data is considered to be
- * a core user-level feature of the android platform. At any time, the user should be
+ * a core user-level feature of the Android platform. At any time, the user should be
* able to use a familiar command, button, or keystroke to invoke search, and the user
- * should be able to search any data which is available to them. The goal is to make search
- * appear to the user as a seamless, system-wide feature.
+ * should be able to search any data which is available to them.
*
- * <p>In terms of implementation, there are three broad classes of Applications:
- * <ol>
- * <li>Applications that are not inherently searchable</li>
- * <li>Query-Search Applications</li>
- * <li>Filter-Search Applications</li>
- * </ol>
- * <p>These categories, as well as related topics, are discussed in
- * the sections below.
+ * <p>To make search appear to the user as a seamless system-wide feature, the application
+ * framework centrally controls it, offering APIs to individual applications to control how they
+ * are searched. Applications can customize how search is invoked, how the search dialog looks,
+ * and what type of search results are available, including suggestions that are available as the
+ * user types.
*
- * <p>Even if your application is not <i>searchable</i>, it can still support the invocation of
- * search. Please review the section <a href="#HowSearchIsInvoked">How Search Is Invoked</a>
- * for more information on how to support this.
- *
- * <p>Many applications are <i>searchable</i>. These are
- * the applications which can convert a query string into a list of results.
- * Within this subset, applications can be grouped loosely into two families:
- * <ul><li><i>Query Search</i> applications perform batch-mode searches - each query string is
- * converted to a list of results.</li>
- * <li><i>Filter Search</i> applications provide live filter-as-you-type searches.</li></ul>
- * <p>Generally speaking, you would use query search for network-based data, and filter
- * search for local data, but this is not a hard requirement and applications
- * are free to use the model that fits them best (or invent a new model).
- * <p>It should be clear that the search implementation decouples "search
- * invocation" from "searchable". This satisfies the goal of making search appear
- * to be "universal". The user should be able to launch any search from
- * almost any context.
+ * <p>Even applications which are not searchable will by default support the invocation of
+ * search to trigger Quick Search Box, the system's 'global search'.
*
* <a name="HowSearchIsInvoked"></a>
* <h3>How Search Is Invoked</h3>
@@ -100,14 +82,15 @@
* <p>Unless impossible or inapplicable, all applications should support
* invoking the search UI. This means that when the user invokes the search command,
* a search UI will be presented to them. The search command is currently defined as a menu
- * item called "Search" (with an alphabetic shortcut key of "S"), or on some devices, a dedicated
+ * item called "Search" (with an alphabetic shortcut key of "S"), or on many devices, a dedicated
* search button key.
- * <p>If your application is not inherently searchable, you can also allow the search UI
- * to be invoked in a "web search" mode. If the user enters a search term and clicks the
- * "Search" button, this will bring the browser to the front and will launch a web-based
+ * <p>If your application is not inherently searchable, the default implementation will cause
+ * the search UI to be invoked in a "global search" mode known as Quick Search Box. As the user
+ * types, search suggestions from across the device and the web will be surfaced, and if they
+ * click the "Search" button, this will bring the browser to the front and will launch a web-based
* search. The user will be able to click the "Back" button and return to your application.
* <p>In general this is implemented by your activity, or the {@link android.app.Activity Activity}
- * base class, which captures the search command and invokes the Search Manager to
+ * base class, which captures the search command and invokes the SearchManager to
* display and operate the search UI. You can also cause the search UI to be presented in response
* to user keystrokes in your activity (for example, to instantly start filter searching while
* viewing a list and typing any key).
@@ -124,7 +107,7 @@
* button or menu item - and invoking the search UI directly.</li>
* <li>You can provide a <i>type-to-search</i> feature, in which search is invoked automatically
* when the user enters any characters.</li>
- * <li>Even if your application is not inherently searchable, you can allow web search,
+ * <li>Even if your application is not inherently searchable, you can allow global search,
* via the search key (or even via a search menu item).
* <li>You can disable search entirely. This should only be used in very rare circumstances,
* as search is a system-wide feature and users will expect it to be available in all contexts.</li>
@@ -148,21 +131,23 @@
* setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL); // search within your activity
* setDefaultKeyMode(DEFAULT_KEYS_SEARCH_GLOBAL); // search using platform global search</pre>
*
- * <p><b>How to enable web-based search.</b> In addition to searching within your activity or
- * application, you can also use the Search Manager to invoke a platform-global search, typically
- * a web search. There are two ways to do this:
+ * <p><b>How to enable global search with Quick Search Box.</b> In addition to searching within
+ * your activity or application, you can also use the Search Manager to invoke a platform-global
+ * search, which uses Quick Search Box to search across the device and the web. There are two ways
+ * to do this:
* <ul><li>You can simply define "search" within your application or activity to mean global search.
* This is described in more detail in the
* <a href="#SearchabilityMetadata">Searchability Metadata</a> section. Briefly, you will
* add a single meta-data entry to your manifest, declaring that the default search
* for your application is "*". This indicates to the system that no application-specific
* search activity is provided, and that it should launch web-based search instead.</li>
- * <li>You can specify this at invocation time via default keys (see above), overriding
- * {@link android.app.Activity#onSearchRequested}, or via a direct call to
- * {@link android.app.Activity#startSearch}. This is most useful if you wish to provide local
- * searchability <i>and</i> access to global search.</li></ul>
+ * <li>Simply do nothing and the default implementation of
+ * {@link android.app.Activity#onSearchRequested} will cause global search to be triggered.
+ * (You can also always trigger search via a direct call to {@link android.app.Activity#startSearch}.
+ * This is most useful if you wish to provide local searchability <i>and</i> access to global
+ * search.)</li></ul>
*
- * <p><b>How to disable search from your activity.</b> search is a system-wide feature and users
+ * <p><b>How to disable search from your activity.</b> Search is a system-wide feature and users
* will expect it to be available in all contexts. If your UI design absolutely precludes
* launching search, override {@link android.app.Activity#onSearchRequested onSearchRequested}
* as shown:
@@ -172,7 +157,7 @@
* return false;
* }</pre>
*
- * <p><b>Managing focus and knowing if Search is active.</b> The search UI is not a separate
+ * <p><b>Managing focus and knowing if search is active.</b> The search UI is not a separate
* activity, and when the UI is invoked or dismissed, your activity will not typically be paused,
* resumed, or otherwise notified by the methods defined in
* <a href="{@docRoot}guide/topics/fundamentals.html#actlife">Application Fundamentals:
@@ -194,17 +179,10 @@
* the search UI. More details on searchable activities and search intents are provided in the
* sections below.
*
- * <a name="QuerySearchApplications"></a>
- * <h3>Query-Search Applications</h3>
- *
- * <p>Query-search applications are those that take a single query (e.g. a search
- * string) and present a set of results that may fit. Primary examples include
- * web queries, map lookups, or email searches (with the common thread being
- * network query dispatch). It may also be the case that certain local searches
- * are treated this way. It's up to the application to decide.
+ * <a name="ImplementingSearchForYourApp"></a>
+ * <h3>Implementing Search for Your App</h3>
*
- * <p><b>What you need to do:</b> The following steps are necessary in order to
- * implement query search.
+ * <p>The following steps are necessary in order to implement search.
* <ul>
* <li>Implement search invocation as described above. (Strictly speaking,
* these are decoupled, but it would make little sense to be "searchable" but not
@@ -220,16 +198,16 @@
* {@link #QUERY getStringExtra(SearchManager.QUERY)}.</li>
* <li>To identify and support your searchable activity, you'll need to
* provide an XML file providing searchability configuration parameters, a reference to that
- * in your searchable activity's <a href="{@docRoot}guide/topics/manifest/manifest-intro.html">manifest</a>
- * entry, and an intent-filter declaring that you can
- * receive ACTION_SEARCH intents. This is described in more detail in the
- * <a href="#SearchabilityMetadata">Searchability Metadata</a> section.</li>
- * <li>Your <a href="{@docRoot}guide/topics/manifest/manifest-intro.html">manifest</a> also needs a metadata entry
- * providing a global reference to the searchable activity. This is the "glue" directing the search
- * UI, when invoked from any of your <i>other</i> activities, to use your application as the
- * default search context. This is also described in more detail in the
+ * in your searchable activity's
+ * <a href="{@docRoot}guide/topics/manifest/manifest-intro.html">manifest</a> entry, and an
+ * intent-filter declaring that you can receive ACTION_SEARCH intents. This is described in more
+ * detail in the <a href="#SearchabilityMetadata">Searchability Metadata</a> section.</li>
+ * <li>Your <a href="{@docRoot}guide/topics/manifest/manifest-intro.html">manifest</a> also needs a
+ * metadata entry providing a global reference to the searchable activity. This is the "glue"
+ * directing the search UI, when invoked from any of your <i>other</i> activities, to use your
+ * application as the default search context. This is also described in more detail in the
* <a href="#SearchabilityMetadata">Searchability Metadata</a> section.</li>
- * <li>Finally, you may want to define your search results activity as with the
+ * <li>Finally, you may want to define your search results activity as single-top with the
* {@link android.R.attr#launchMode singleTop} launchMode flag. This allows the system
* to launch searches from/to the same activity without creating a pile of them on the
* activity stack. If you do this, be sure to also override
@@ -255,25 +233,10 @@
* doSearchWithQuery(queryString);
* }</pre>
*
- * <a name="FilterSearchApplications"></a>
- * <h3>Filter-Search Applications</h3>
- *
- * <p>Filter-search applications are those that use live text entry (e.g. keystrokes)) to
- * display and continuously update a list of results. Primary examples include applications
- * that use locally-stored data.
- *
- * <p>Filter search is not directly supported by the Search Manager. Most filter search
- * implementations will use variants of {@link android.widget.Filterable}, such as a
- * {@link android.widget.ListView} bound to a {@link android.widget.SimpleCursorAdapter}. However,
- * you may find it useful to mix them together, by declaring your filtered view searchable. With
- * this configuration, you can still present the standard search dialog in all activities
- * within your application, but transition to a filtered search when you enter the activity
- * and display the results.
- *
* <a name="Suggestions"></a>
* <h3>Search Suggestions</h3>
*
- * <p>A powerful feature of the Search Manager is the ability of any application to easily provide
+ * <p>A powerful feature of the search system is the ability of any application to easily provide
* live "suggestions" in order to prompt the user. Each application implements suggestions in a
* different, unique, and appropriate way. Suggestions be drawn from many sources, including but
* not limited to:
@@ -285,11 +248,11 @@
* <li>Summaries of possible results</li>
* </ul>
*
- * <p>Another feature of suggestions is that they can expose queries or results before the user
- * ever visits the application. This reduces the amount of context switching required, and helps
- * the user access their data quickly and with less context shifting. In order to provide this
- * capability, suggestions are accessed via a
- * {@link android.content.ContentProvider Content Provider}.
+ * <p>Once an application is configured to provide search suggestions, those same suggestions can
+ * easily be made available to the system-wide Quick Search Box, providing faster access to its
+ * content from on central prominent place. See
+ * <a href="#ExposingSearchSuggestionsToQuickSearchBox">Exposing Search Suggestions to Quick Search
+ * Box</a> for more details.
*
* <p>The primary form of suggestions is known as <i>queried suggestions</i> and is based on query
* text that the user has already typed. This would generally be based on partial matches in
@@ -299,7 +262,8 @@
* available, they should be weighted based on other factors - for example, most recent queries
* or most recent results.
*
- * <p><b>Overview of how suggestions are provided.</b> When the search manager identifies a
+ * <p><b>Overview of how suggestions are provided.</b> Suggestions are accessed via a
+ * {@link android.content.ContentProvider Content Provider}. When the search manager identifies a
* particular activity as searchable, it will check for certain metadata which indicates that
* there is also a source of suggestions. If suggestions are provided, the following steps are
* taken.
@@ -569,6 +533,11 @@
* query text is provided and the SUGGEST_COLUMN_INTENT_DATA values are not suitable for user
* inspection and editing.</li></ul>
*
+ * <a name="ExposingSearchSuggestionsToQuickSearchBox"></a>
+ * <h3>Exposing Search Suggestions to Quick Search Box</h3>
+ *
+ * <p>
+ *
* <a name="ActionKeys"></a>
* <h3>Action Keys</h3>
*
diff --git a/core/java/android/backup/IRestoreSession.aidl b/core/java/android/backup/IRestoreSession.aidl
index 2a1fbc1..fd40d98 100644
--- a/core/java/android/backup/IRestoreSession.aidl
+++ b/core/java/android/backup/IRestoreSession.aidl
@@ -40,6 +40,8 @@
* Restore the given set onto the device, replacing the current data of any app
* contained in the restore set with the data previously backed up.
*
+ * @return Zero on success; nonzero on error. The observer will only receive
+ * progress callbacks if this method returned zero.
* @param token The token from {@link getAvailableRestoreSets()} corresponding to
* the restore set that should be used.
* @param observer If non-null, this binder points to an object that will receive
@@ -50,6 +52,9 @@
/**
* End this restore session. After this method is called, the IRestoreSession binder
* is no longer valid.
+ *
+ * <p><b>Note:</b> The caller <i>must</i> invoke this method to end the restore session,
+ * even if {@link getAvailableRestoreSets} or {@link performRestore} failed.
*/
void endRestoreSession();
}
diff --git a/core/java/android/inputmethodservice/KeyboardView.java b/core/java/android/inputmethodservice/KeyboardView.java
index dff7cae..9e966cd 100755
--- a/core/java/android/inputmethodservice/KeyboardView.java
+++ b/core/java/android/inputmethodservice/KeyboardView.java
@@ -163,8 +163,8 @@
private static final int MSG_REPEAT = 3;
private static final int MSG_LONGPRESS = 4;
- private static final int DELAY_BEFORE_PREVIEW = 40;
- private static final int DELAY_AFTER_PREVIEW = 60;
+ private static final int DELAY_BEFORE_PREVIEW = 0;
+ private static final int DELAY_AFTER_PREVIEW = 70;
private int mVerticalCorrection;
private int mProximityThreshold;
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index cf26b1b..e1b8e99 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -2947,6 +2947,11 @@
public static final String DATA_MESSAGE_GET_APP_TOKEN_URL =
"data_messaging_get_app_token_url";
+ /**
+ * Use android://<it> routing infos for Google Sync Server subcriptions.
+ */
+ public static final String GSYNC_USE_RMQ2_ROUTING_INFO = "gsync_use_rmq2_routing_info";
+
/**
* Enable use of ssl session caching.
* 'db' - save each session in a (per process) database
diff --git a/core/java/android/speech/tts/TextToSpeech.java b/core/java/android/speech/tts/TextToSpeech.java
index b033c6a..04a0ec8 100755
--- a/core/java/android/speech/tts/TextToSpeech.java
+++ b/core/java/android/speech/tts/TextToSpeech.java
@@ -189,6 +189,12 @@
"android.speech.tts.engine.INSTALL_TTS_DATA";
/**
+ * {@hide}
+ */
+ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
+ public static final String ACTION_TTS_DATA_INSTALLED =
+ "android.speech.tts.engine.TTS_DATA_INSTALLED";
+ /**
* Broadcast Action: Starts the activity from the platform Text-To-Speech
* engine to verify the proper installation and availability of the
* resource files on the system. Upon completion, the activity will
@@ -233,6 +239,16 @@
*/
public static final String EXTRA_VOICE_DATA_FILES_INFO = "dataFilesInfo";
+ // extras for a TTS engine's data installation
+ /**
+ * Extra information received with the {@link #ACTION_TTS_DATA_INSTALLED} intent
+ * which indicates whether the TTS data installation requested with
+ * {@link #ACTION_INSTALL_TTS_DATA} completed successfully or not. The value is
+ * {@link TextToSpeech#SUCCESS} or {@link TextToSpeech#ERROR}.
+ * {@hide}
+ */
+ public static final String EXTRA_TTS_DATA_INSTALLED = "dataInstalled";
+
// keys for the parameters passed with speak commands. Hidden keys are used internally
// to maintain engine state for each TextToSpeech instance.
/**
diff --git a/core/java/com/android/internal/service/wallpaper/ImageWallpaper.java b/core/java/com/android/internal/service/wallpaper/ImageWallpaper.java
index b9b07a8..6d50840 100644
--- a/core/java/com/android/internal/service/wallpaper/ImageWallpaper.java
+++ b/core/java/com/android/internal/service/wallpaper/ImageWallpaper.java
@@ -18,73 +18,68 @@
import android.app.WallpaperManager;
import android.graphics.Canvas;
-import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
-import android.os.Handler;
-import android.os.Message;
-import android.os.SystemClock;
import android.service.wallpaper.WallpaperService;
import android.view.SurfaceHolder;
+import android.content.Context;
+import android.content.IntentFilter;
+import android.content.Intent;
+import android.content.BroadcastReceiver;
/**
* Default built-in wallpaper that simply shows a static image.
*/
public class ImageWallpaper extends WallpaperService {
- public WallpaperManager mWallpaperManager;
-
- static final int MSG_DRAW = 1;
-
- class MyEngine extends Engine {
- final Paint mTextPaint = new Paint();
- float mDensity;
- Drawable mBackground;
- long mAnimStartTime;
- boolean mAnimLarger;
-
- final Handler mHandler = new Handler() {
+ WallpaperManager mWallpaperManager;
+ ImageWallpaper.DrawableEngine mEngine;
+ private WallpaperObserver mReceiver;
- @Override
- public void handleMessage(Message msg) {
- switch (msg.what) {
- case MSG_DRAW:
- drawFrame(true);
- mHandler.sendEmptyMessage(MSG_DRAW);
- break;
- default:
- super.handleMessage(msg);
- }
- }
- };
-
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ mWallpaperManager = (WallpaperManager) getSystemService(WALLPAPER_SERVICE);
+ IntentFilter filter = new IntentFilter(Intent.ACTION_WALLPAPER_CHANGED);
+ mReceiver = new WallpaperObserver();
+ registerReceiver(mReceiver, filter);
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ unregisterReceiver(mReceiver);
+ }
+
+ public Engine onCreateEngine() {
+ mEngine = new DrawableEngine();
+ return mEngine;
+ }
+
+ class WallpaperObserver extends BroadcastReceiver {
+ public void onReceive(Context context, Intent intent) {
+ mEngine.updateWallpaper();
+ }
+ }
+
+ class DrawableEngine extends Engine {
+ private final Object mLock = new Object();
+ Drawable mBackground;
+
@Override
public void onCreate(SurfaceHolder surfaceHolder) {
super.onCreate(surfaceHolder);
mBackground = mWallpaperManager.getDrawable();
- mTextPaint.setAntiAlias(true);
- mDensity = getResources().getDisplayMetrics().density;
- mTextPaint.setTextSize(30 * mDensity);
- mTextPaint.setShadowLayer(5*mDensity, 3*mDensity, 3*mDensity, 0xff000000);
- mTextPaint.setARGB(255, 255, 255, 255);
- mTextPaint.setTextAlign(Paint.Align.CENTER);
}
@Override
public void onVisibilityChanged(boolean visible) {
- mHandler.removeMessages(MSG_DRAW);
- if (visible) {
- mHandler.sendEmptyMessage(MSG_DRAW);
- mAnimStartTime = SystemClock.uptimeMillis();
- mAnimLarger = true;
- } else {
- drawFrame(false);
- }
+ drawFrame();
}
@Override
public void onSurfaceChanged(SurfaceHolder holder, int format, int width, int height) {
super.onSurfaceChanged(holder, format, width, height);
- drawFrame(false);
+ drawFrame();
}
@Override
@@ -97,48 +92,28 @@
super.onSurfaceDestroyed(holder);
}
- void drawFrame(boolean drawText) {
+ void drawFrame() {
SurfaceHolder sh = getSurfaceHolder();
Canvas c = null;
try {
c = sh.lockCanvas();
if (c != null) {
final Rect frame = sh.getSurfaceFrame();
- mBackground.setBounds(frame);
- mBackground.draw(c);
-
- if (drawText) {
- // Figure out animation.
- long now = SystemClock.uptimeMillis();
- while (mAnimStartTime < (now-1000)) {
- mAnimStartTime += 1000;
- mAnimLarger = !mAnimLarger;
- }
- float size = (now-mAnimStartTime) / (float)1000;
- if (!mAnimLarger) size = 1-size;
- int alpha = (int)(255*(size*size));
- mTextPaint.setARGB(alpha, 255, 255, 255);
- mTextPaint.setShadowLayer(5*mDensity, 3*mDensity, 3*mDensity,
- alpha<<24);
- mTextPaint.setTextSize(100 * mDensity * size);
- c.drawText("Am I live?",
- frame.left + (frame.right-frame.left)/2,
- frame.top + (frame.bottom-frame.top)/2, mTextPaint);
+ synchronized (mLock) {
+ final Drawable background = mBackground;
+ background.setBounds(frame);
+ background.draw(c);
}
}
} finally {
if (c != null) sh.unlockCanvasAndPost(c);
}
}
- }
-
- @Override
- public void onCreate() {
- super.onCreate();
- mWallpaperManager = (WallpaperManager)getSystemService(WALLPAPER_SERVICE);
- }
-
- public Engine onCreateEngine() {
- return new MyEngine();
+
+ void updateWallpaper() {
+ synchronized (mLock) {
+ mBackground = mWallpaperManager.getDrawable();
+ }
+ }
}
}
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index 0035142..77486b1 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -203,7 +203,7 @@
///////////////////////////////////////////////////////////////////////////////////
//
- RenderScript(Surface sur) {
+ public RenderScript(Surface sur) {
mSurface = sur;
mDev = nDeviceCreate();
mContext = nContextCreate(mDev, mSurface, 0);
diff --git a/media/java/android/media/ExifInterface.java b/media/java/android/media/ExifInterface.java
index 645f3f6..6d7c0ae 100644
--- a/media/java/android/media/ExifInterface.java
+++ b/media/java/android/media/ExifInterface.java
@@ -128,7 +128,10 @@
}
public void setFilename(String filename) {
- mFilename = filename;
+ if (mFilename == null || !mFilename.equals(filename)) {
+ mFilename = filename;
+ mCachedAttributes = null;
+ }
}
/**
diff --git a/opengl/tests/filter/filter.cpp b/opengl/tests/filter/filter.cpp
index 82aafbf..2351909 100644
--- a/opengl/tests/filter/filter.cpp
+++ b/opengl/tests/filter/filter.cpp
@@ -10,6 +10,8 @@
using namespace android;
+#define USE_DRAW_TEXTURE 1
+
int main(int argc, char** argv)
{
if (argc!=2 && argc!=3) {
@@ -45,9 +47,9 @@
dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(dpy, &majorVersion, &minorVersion);
if (!usePbuffer) {
- surface = eglCreateWindowSurface(dpy, config, window, NULL);
EGLUtils::selectConfigForNativeWindow(
dpy, s_configAttribs, window, &config);
+ surface = eglCreateWindowSurface(dpy, config, window, NULL);
} else {
printf("using pbuffer\n");
eglChooseConfig(dpy, s_configAttribs, &config, 1, &numConfigs);
@@ -63,6 +65,12 @@
eglQuerySurface(dpy, surface, EGL_HEIGHT, &h);
GLint dim = w<h ? w : h;
+ glViewport(0, 0, w, h);
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrthof(0, w, 0, h, 0, 1);
+
+ glClearColor(0,0,0,0);
glClear(GL_COLOR_BUFFER_BIT);
GLint crop[4] = { 0, 4, 4, -4 };
@@ -128,14 +136,55 @@
break;
}
- glDrawTexiOES(0, 0, 0, dim, dim);
+ //glDrawTexiOES(0, 0, 0, dim, dim);
+
+ const GLfloat vertices[4][2] = {
+ { 0, 0 },
+ { 0, dim },
+ { dim, dim },
+ { dim, 0 }
+ };
+ const GLfloat texCoords[4][2] = {
+ { 0, 0 },
+ { 0, 1 },
+ { 1, 1 },
+ { 1, 0 }
+ };
+
if (!usePbuffer) {
eglSwapBuffers(dpy, surface);
- } else {
- glFinish();
}
+ glMatrixMode(GL_MODELVIEW);
+ glScissor(0,dim,dim,h-dim);
+ glDisable(GL_SCISSOR_TEST);
+
+ for (int y=0 ; y<dim ; y++) {
+ //glDisable(GL_SCISSOR_TEST);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ //glEnable(GL_SCISSOR_TEST);
+
+#if USE_DRAW_TEXTURE && GL_OES_draw_texture
+ glDrawTexiOES(0, y, 1, dim, dim);
+#else
+ glLoadIdentity();
+ glTranslatef(0, y, 0);
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ glVertexPointer(2, GL_FLOAT, 0, vertices);
+ glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
+ glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+#endif
+
+ if (!usePbuffer) {
+ eglSwapBuffers(dpy, surface);
+ } else {
+ glFinish();
+ }
+ }
+
eglTerminate(dpy);
return 0;
}
diff --git a/packages/VpnServices/src/com/android/server/vpn/VpnService.java b/packages/VpnServices/src/com/android/server/vpn/VpnService.java
index f410c7b..e3ac996 100644
--- a/packages/VpnServices/src/com/android/server/vpn/VpnService.java
+++ b/packages/VpnServices/src/com/android/server/vpn/VpnService.java
@@ -133,11 +133,7 @@
if (VpnState.CONNECTED.equals(mState)) {
Log.i("VpnService", " recovered: " + mProfile.getName());
- new Thread(new Runnable() {
- public void run() {
- enterConnectivityLoop();
- }
- }).start();
+ startConnectivityMonitor();
}
}
@@ -213,16 +209,18 @@
SystemProperties.get(VPN_STATUS))) {
onConnected();
return;
- } else if (mDaemonHelper.anySocketError()) {
- return;
+ } else {
+ int err = mDaemonHelper.getSocketError();
+ if (err != 0) {
+ onError(err);
+ return;
+ }
}
sleep(500); // 0.5 second
}
- synchronized (VpnService.this) {
- if (mState == VpnState.CONNECTING) {
- onError(new IOException("Connecting timed out"));
- }
+ if (mState == VpnState.CONNECTING) {
+ onError(new IOException("Connecting timed out"));
}
}
@@ -235,13 +233,15 @@
mStartTime = System.currentTimeMillis();
- // set DNS after saving the states in case the process gets killed
- // before states are saved
+ // Correct order to make sure VpnService doesn't break when killed:
+ // (1) set state to CONNECTED
+ // (2) save states
+ // (3) set DNS
+ setState(VpnState.CONNECTED);
saveSelf();
setVpnDns();
- setState(VpnState.CONNECTED);
- enterConnectivityLoop();
+ startConnectivityMonitor();
}
private void saveSelf() throws IOException {
@@ -340,23 +340,28 @@
}
}
- private void enterConnectivityLoop() {
- Log.i(TAG, "VPN connectivity monitor running");
- try {
- for (;;) {
- synchronized (VpnService.this) {
- if (mState != VpnState.CONNECTED || !checkConnectivity()) {
- break;
+ private void startConnectivityMonitor() {
+ new Thread(new Runnable() {
+ public void run() {
+ Log.i(TAG, "VPN connectivity monitor running");
+ try {
+ for (;;) {
+ synchronized (VpnService.this) {
+ if ((mState != VpnState.CONNECTED)
+ || !checkConnectivity()) {
+ break;
+ }
+ mNotification.update();
+ checkDns();
+ VpnService.this.wait(1000); // 1 second
+ }
}
- mNotification.update();
- checkDns();
- VpnService.this.wait(1000); // 1 second
+ } catch (InterruptedException e) {
+ onError(e);
}
+ Log.i(TAG, "VPN connectivity monitor stopped");
}
- } catch (InterruptedException e) {
- onError(e);
- }
- Log.i(TAG, "VPN connectivity monitor stopped");
+ }).start();
}
private void saveLocalIpAndInterface(String serverIp) throws IOException {
@@ -432,11 +437,7 @@
}
synchronized void stopAll() {
- if (mDaemonList.isEmpty()) {
- onFinalCleanUp();
- } else {
- for (DaemonProxy s : mDaemonList) s.stop();
- }
+ for (DaemonProxy s : mDaemonList) s.stop();
}
synchronized void closeSockets() {
@@ -461,30 +462,26 @@
}
}
- synchronized boolean anySocketError() {
+ synchronized int getSocketError() {
for (DaemonProxy s : mDaemonList) {
switch (getResultFromSocket(s)) {
case 0:
continue;
case AUTH_ERROR_CODE:
- onError(VpnManager.VPN_ERROR_AUTH);
- return true;
+ return VpnManager.VPN_ERROR_AUTH;
case CHALLENGE_ERROR_CODE:
- onError(VpnManager.VPN_ERROR_CHALLENGE);
- return true;
+ return VpnManager.VPN_ERROR_CHALLENGE;
case REMOTE_HUNG_UP_ERROR_CODE:
- onError(VpnManager.VPN_ERROR_REMOTE_HUNG_UP);
- return true;
+ return VpnManager.VPN_ERROR_REMOTE_HUNG_UP;
default:
- onError(VpnManager.VPN_ERROR_CONNECTION_FAILED);
- return true;
+ return VpnManager.VPN_ERROR_CONNECTION_FAILED;
}
}
- return false;
+ return 0;
}
}
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java
index 1e5302e..36dca7d 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/BackupManagerService.java
@@ -1725,6 +1725,8 @@
return 0;
}
}
+
+ Log.w(TAG, "Restore token " + Long.toHexString(token) + " not found");
return -1;
}