diff options
28 files changed, 235 insertions, 352 deletions
diff --git a/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java b/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java index 6b6d3c95096e..8c15d0b4ea13 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 @@ public final class Bmgr { 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 @@ public final class Bmgr { } } - // 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 9c20a4bbba7f..b75bec2dc8eb 100644 --- a/core/java/android/app/SearchDialog.java +++ b/core/java/android/app/SearchDialog.java @@ -67,6 +67,7 @@ import android.widget.ImageButton; 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 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS // 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 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS } 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 fd559d66cba1..7ad64237569f 100644 --- a/core/java/android/app/SearchManager.java +++ b/core/java/android/app/SearchManager.java @@ -40,7 +40,7 @@ import java.util.List; * 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 @@ import java.util.List; * <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 @@ import java.util.List; * <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 @@ import java.util.List; * <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 @@ import java.util.List; * 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 @@ import java.util.List; * 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 @@ import java.util.List; * 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 @@ import java.util.List; * 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 @@ import java.util.List; * {@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 @@ import java.util.List; * 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 @@ import java.util.List; * <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 @@ import java.util.List; * 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 @@ import java.util.List; * 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 2a1fbc179933..fd40d98216ab 100644 --- a/core/java/android/backup/IRestoreSession.aidl +++ b/core/java/android/backup/IRestoreSession.aidl @@ -40,6 +40,8 @@ interface IRestoreSession { * 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 @@ interface IRestoreSession { /** * 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 dff7cae22861..9e966cd7abee 100755 --- a/core/java/android/inputmethodservice/KeyboardView.java +++ b/core/java/android/inputmethodservice/KeyboardView.java @@ -163,8 +163,8 @@ public class KeyboardView extends View implements View.OnClickListener { 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 cf26b1bf08f9..e1b8e99d5ddc 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -2947,6 +2947,11 @@ public final class Settings { 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 b033c6a7cdc2..04a0ec8fb504 100755 --- a/core/java/android/speech/tts/TextToSpeech.java +++ b/core/java/android/speech/tts/TextToSpeech.java @@ -189,6 +189,12 @@ public class TextToSpeech { "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 class TextToSpeech { */ 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 b9b07a84c733..6d5084009639 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 @@ package com.android.internal.service.wallpaper; 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; + WallpaperManager mWallpaperManager; + ImageWallpaper.DrawableEngine mEngine; + private WallpaperObserver mReceiver; + + @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; - long mAnimStartTime; - boolean mAnimLarger; - - final Handler mHandler = new Handler() { - @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(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 @@ public class ImageWallpaper extends WallpaperService { 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 0035142b5f6b..77486b12485e 100644 --- a/graphics/java/android/renderscript/RenderScript.java +++ b/graphics/java/android/renderscript/RenderScript.java @@ -203,7 +203,7 @@ public class RenderScript { /////////////////////////////////////////////////////////////////////////////////// // - RenderScript(Surface sur) { + public RenderScript(Surface sur) { mSurface = sur; mDev = nDeviceCreate(); mContext = nContextCreate(mDev, mSurface, 0); diff --git a/include/ui/FramebufferNativeWindow.h b/include/ui/FramebufferNativeWindow.h index 68144b5944a5..cb9bf940e23a 100644 --- a/include/ui/FramebufferNativeWindow.h +++ b/include/ui/FramebufferNativeWindow.h @@ -63,7 +63,6 @@ private: static int lockBuffer(android_native_window_t* window, android_native_buffer_t* buffer); static int queueBuffer(android_native_window_t* window, android_native_buffer_t* buffer); static int query(android_native_window_t* window, int what, int* value); - static int perform(android_native_window_t* window, int operation, ...); framebuffer_device_t* fbDev; alloc_device_t* grDev; diff --git a/include/ui/ISurface.h b/include/ui/ISurface.h index 7909c2f41d4a..adba45a48cb4 100644 --- a/include/ui/ISurface.h +++ b/include/ui/ISurface.h @@ -50,7 +50,7 @@ protected: public: DECLARE_META_INTERFACE(Surface); - virtual sp<SurfaceBuffer> getBuffer(int usage) = 0; + virtual sp<SurfaceBuffer> getBuffer() = 0; class BufferHeap { public: diff --git a/include/ui/Surface.h b/include/ui/Surface.h index 4ff0e4abd807..d5dad31d00b6 100644 --- a/include/ui/Surface.h +++ b/include/ui/Surface.h @@ -184,7 +184,7 @@ private: friend class IOMX; const sp<ISurface>& getISurface() const { return mSurface; } - status_t getBufferLocked(int index, int usage); + status_t getBufferLocked(int index); status_t validate(per_client_cblk_t const* cblk) const; static void _send_dirty_region(layer_cblk_t* lcblk, const Region& dirty); @@ -197,13 +197,11 @@ private: static int lockBuffer(android_native_window_t* window, android_native_buffer_t* buffer); static int queueBuffer(android_native_window_t* window, android_native_buffer_t* buffer); static int query(android_native_window_t* window, int what, int* value); - static int perform(android_native_window_t* window, int operation, ...); int dequeueBuffer(android_native_buffer_t** buffer); int lockBuffer(android_native_buffer_t* buffer); int queueBuffer(android_native_buffer_t* buffer); int query(int what, int* value); - int perform(int operation, va_list args); status_t dequeueBuffer(sp<SurfaceBuffer>* buffer); status_t lockBuffer(const sp<SurfaceBuffer>& buffer); @@ -219,7 +217,6 @@ private: uint32_t mIdentity; uint32_t mWidth; uint32_t mHeight; - uint32_t mUsage; PixelFormat mFormat; uint32_t mFlags; mutable Region mDirtyRegion; diff --git a/include/ui/egl/android_natives.h b/include/ui/egl/android_natives.h index 4c58e474c67d..7da69b144a49 100644 --- a/include/ui/egl/android_natives.h +++ b/include/ui/egl/android_natives.h @@ -67,11 +67,6 @@ enum { NATIVE_WINDOW_FORMAT = 2, }; -/* valid operations for the (*perform)() hook */ -enum { - NATIVE_WINDOW_SET_USAGE = 0 -}; - struct android_native_window_t { #ifdef __cplusplus @@ -147,45 +142,11 @@ struct android_native_window_t * Returns 0 on success or -errno on error. */ int (*query)(struct android_native_window_t* window, - int what, int* value); - - /* - * hook used to perform various operations on the surface. - * (*perform)() is a generic mechanism to add functionality to - * android_native_window_t while keeping backward binary compatibility. - * - * This hook should not be called directly, instead use the helper functions - * defined below. - * - * The valid operations are: - * NATIVE_WINDOW_SET_USAGE - * - */ - - int (*perform)(struct android_native_window_t* window, - int operation, ... ); + int what, int* value); - void* reserved_proc[3]; + void* reserved_proc[4]; }; - -/* - * native_window_set_usage() sets the intended usage flags for the next - * buffers acquired with (*lockBuffer)() and on. - * By default (if this function is never called), a usage of - * GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_TEXTURE - * is assumed. - * Calling this function will usually cause following buffers to be - * reallocated. - */ - -inline int native_window_set_usage( - struct android_native_window_t* window, int usage) -{ - return window->perform(window, NATIVE_WINDOW_SET_USAGE, usage); -} - - // --------------------------------------------------------------------------- /* FIXME: this is legacy for pixmaps */ diff --git a/libs/surfaceflinger/Layer.cpp b/libs/surfaceflinger/Layer.cpp index 8c0b40d9e471..d1142cca86da 100644 --- a/libs/surfaceflinger/Layer.cpp +++ b/libs/surfaceflinger/Layer.cpp @@ -217,7 +217,7 @@ void Layer::onDraw(const Region& clip) const drawWithOpenGL(clip, mTextures[index]); } -sp<SurfaceBuffer> Layer::peekBuffer(int usage) +sp<SurfaceBuffer> Layer::peekBuffer() { /* * This is called from the client's Surface::lock(), after it locked @@ -250,7 +250,7 @@ sp<SurfaceBuffer> Layer::peekBuffer(int usage) } LayerBitmap& layerBitmap(mBuffers[backBufferIndex]); - sp<SurfaceBuffer> buffer = layerBitmap.allocate(usage); + sp<SurfaceBuffer> buffer = layerBitmap.allocate(); LOGD_IF(DEBUG_RESIZE, "Layer::getBuffer(this=%p), index=%d, (%d,%d), (%d,%d)", @@ -649,12 +649,12 @@ Layer::SurfaceLayer::~SurfaceLayer() { } -sp<SurfaceBuffer> Layer::SurfaceLayer::getBuffer(int usage) +sp<SurfaceBuffer> Layer::SurfaceLayer::getBuffer() { sp<SurfaceBuffer> buffer = 0; sp<Layer> owner(getOwner()); if (owner != 0) { - buffer = owner->peekBuffer(usage); + buffer = owner->peekBuffer(); } return buffer; } diff --git a/libs/surfaceflinger/Layer.h b/libs/surfaceflinger/Layer.h index add5d5074741..4c13d6ea2887 100644 --- a/libs/surfaceflinger/Layer.h +++ b/libs/surfaceflinger/Layer.h @@ -101,7 +101,7 @@ private: status_t resize(int32_t index, uint32_t w, uint32_t h, const char* what); Region post(uint32_t* oldState, bool& recomputeVisibleRegions); - sp<SurfaceBuffer> peekBuffer(int usage); + sp<SurfaceBuffer> peekBuffer(); void destroy(); void scheduleBroadcast(); @@ -114,7 +114,7 @@ private: ~SurfaceLayer(); private: - virtual sp<SurfaceBuffer> getBuffer(int usage); + virtual sp<SurfaceBuffer> getBuffer(); sp<Layer> getOwner() const { return static_cast<Layer*>(Surface::getOwner().get()); diff --git a/libs/surfaceflinger/LayerBase.cpp b/libs/surfaceflinger/LayerBase.cpp index 419574c7def1..fbce73ddd3be 100644 --- a/libs/surfaceflinger/LayerBase.cpp +++ b/libs/surfaceflinger/LayerBase.cpp @@ -759,7 +759,7 @@ status_t LayerBaseClient::Surface::onTransact( return BnSurface::onTransact(code, data, reply, flags); } -sp<SurfaceBuffer> LayerBaseClient::Surface::getBuffer(int) +sp<SurfaceBuffer> LayerBaseClient::Surface::getBuffer() { return NULL; } diff --git a/libs/surfaceflinger/LayerBase.h b/libs/surfaceflinger/LayerBase.h index 65bf55b51b42..6fb1d1c50cab 100644 --- a/libs/surfaceflinger/LayerBase.h +++ b/libs/surfaceflinger/LayerBase.h @@ -335,7 +335,7 @@ public: sp<LayerBaseClient> getOwner() const; private: - virtual sp<SurfaceBuffer> getBuffer(int usage); + virtual sp<SurfaceBuffer> getBuffer(); virtual status_t registerBuffers(const ISurface::BufferHeap& buffers); virtual void postBuffer(ssize_t offset); virtual void unregisterBuffers(); diff --git a/libs/surfaceflinger/LayerBitmap.cpp b/libs/surfaceflinger/LayerBitmap.cpp index 5e74451d5f04..5221fed56f4d 100644 --- a/libs/surfaceflinger/LayerBitmap.cpp +++ b/libs/surfaceflinger/LayerBitmap.cpp @@ -38,14 +38,13 @@ namespace android { // Buffer and implementation of android_native_buffer_t // =========================================================================== -Buffer::Buffer(uint32_t w, uint32_t h, PixelFormat format, - uint32_t reqUsage, uint32_t flags) +Buffer::Buffer(uint32_t w, uint32_t h, PixelFormat format, uint32_t flags) : SurfaceBuffer(), mInitCheck(NO_INIT), mFlags(flags), mVStride(0) { this->format = format; if (w>0 && h>0) { - mInitCheck = initSize(w, h, reqUsage); + mInitCheck = initSize(w, h); } } @@ -66,7 +65,7 @@ android_native_buffer_t* Buffer::getNativeBuffer() const return static_cast<android_native_buffer_t*>(const_cast<Buffer*>(this)); } -status_t Buffer::initSize(uint32_t w, uint32_t h, uint32_t reqUsage) +status_t Buffer::initSize(uint32_t w, uint32_t h) { status_t err = NO_ERROR; @@ -89,9 +88,16 @@ status_t Buffer::initSize(uint32_t w, uint32_t h, uint32_t reqUsage) usage = BufferAllocator::USAGE_SW_READ_OFTEN | BufferAllocator::USAGE_SW_WRITE_OFTEN; } else { - // it's allowed to modify the usage flags here, but generally - // the requested flags should be honored. - usage = reqUsage | BufferAllocator::USAGE_HW_TEXTURE; + if (mFlags & Buffer::GPU) { + // the client wants to do GL rendering + usage = BufferAllocator::USAGE_HW_RENDER | + BufferAllocator::USAGE_HW_TEXTURE; + } else { + // software rendering-client, h/w composition + usage = BufferAllocator::USAGE_SW_READ_OFTEN | + BufferAllocator::USAGE_SW_WRITE_OFTEN | + BufferAllocator::USAGE_HW_TEXTURE; + } } err = allocator.alloc(w, h, format, usage, &handle, &stride); @@ -168,12 +174,12 @@ status_t LayerBitmap::setSize(uint32_t w, uint32_t h) return NO_ERROR; } -sp<Buffer> LayerBitmap::allocate(uint32_t reqUsage) +sp<Buffer> LayerBitmap::allocate() { Mutex::Autolock _l(mLock); surface_info_t* info = mInfo; mBuffer.clear(); // free buffer before allocating a new one - sp<Buffer> buffer = new Buffer(mWidth, mHeight, mFormat, reqUsage, mFlags); + sp<Buffer> buffer = new Buffer(mWidth, mHeight, mFormat, mFlags); status_t err = buffer->initCheck(); if (LIKELY(err == NO_ERROR)) { info->flags = surface_info_t::eBufferDirty; diff --git a/libs/surfaceflinger/LayerBitmap.h b/libs/surfaceflinger/LayerBitmap.h index 48ee553e523a..22525cebdfc5 100644 --- a/libs/surfaceflinger/LayerBitmap.h +++ b/libs/surfaceflinger/LayerBitmap.h @@ -58,8 +58,7 @@ public: }; // creates w * h buffer - Buffer(uint32_t w, uint32_t h, PixelFormat format, - uint32_t reqUsage, uint32_t flags = 0); + Buffer(uint32_t w, uint32_t h, PixelFormat format, uint32_t flags = 0); // return status status_t initCheck() const; @@ -82,7 +81,7 @@ private: Buffer& operator = (const Buffer& rhs); const Buffer& operator = (const Buffer& rhs) const; - status_t initSize(uint32_t w, uint32_t h, uint32_t reqUsage); + status_t initSize(uint32_t w, uint32_t h); ssize_t mInitCheck; uint32_t mFlags; @@ -109,7 +108,7 @@ public: status_t setSize(uint32_t w, uint32_t h); - sp<Buffer> allocate(uint32_t reqUsage); + sp<Buffer> allocate(); status_t free(); sp<const Buffer> getBuffer() const { return mBuffer; } diff --git a/libs/surfaceflinger/LayerBuffer.cpp b/libs/surfaceflinger/LayerBuffer.cpp index e1f4bea228c5..90e7f5048067 100644 --- a/libs/surfaceflinger/LayerBuffer.cpp +++ b/libs/surfaceflinger/LayerBuffer.cpp @@ -28,7 +28,6 @@ #include <hardware/copybit.h> -#include "BufferAllocator.h" #include "LayerBuffer.h" #include "SurfaceFlinger.h" #include "DisplayHardware/DisplayHardware.h" @@ -465,10 +464,7 @@ void LayerBuffer::BufferSource::onDraw(const Region& clip) const mTempBitmap->getWidth() < tmp_w || mTempBitmap->getHeight() < tmp_h) { mTempBitmap.clear(); - mTempBitmap = new android::Buffer( - tmp_w, tmp_h, src.img.format, - BufferAllocator::USAGE_HW_TEXTURE | - BufferAllocator::USAGE_HW_2D); + mTempBitmap = new android::Buffer(tmp_w, tmp_h, src.img.format); err = mTempBitmap->initCheck(); } diff --git a/libs/surfaceflinger/LayerDim.cpp b/libs/surfaceflinger/LayerDim.cpp index 6ebb49f64ca2..8e9df9cc9bcc 100644 --- a/libs/surfaceflinger/LayerDim.cpp +++ b/libs/surfaceflinger/LayerDim.cpp @@ -21,7 +21,6 @@ #include <utils/Errors.h> #include <utils/Log.h> -#include "BufferAllocator.h" #include "LayerDim.h" #include "SurfaceFlinger.h" #include "DisplayHardware/DisplayHardware.h" @@ -69,11 +68,7 @@ void LayerDim::initDimmer(SurfaceFlinger* flinger, uint32_t w, uint32_t h) if (LIKELY(flags & DisplayHardware::DIRECT_TEXTURE)) { // TODO: api to pass the usage flags - sp<Buffer> buffer = new Buffer(w, h, PIXEL_FORMAT_RGB_565, - BufferAllocator::USAGE_SW_WRITE_OFTEN | - BufferAllocator::USAGE_HW_TEXTURE | - BufferAllocator::USAGE_HW_2D); - + sp<Buffer> buffer = new Buffer(w, h, PIXEL_FORMAT_RGB_565); android_native_buffer_t* clientBuf = buffer->getNativeBuffer(); glGenTextures(1, &sTexId); diff --git a/libs/ui/FramebufferNativeWindow.cpp b/libs/ui/FramebufferNativeWindow.cpp index 90b51634c60c..f6c666df4263 100644 --- a/libs/ui/FramebufferNativeWindow.cpp +++ b/libs/ui/FramebufferNativeWindow.cpp @@ -132,7 +132,6 @@ FramebufferNativeWindow::FramebufferNativeWindow() android_native_window_t::lockBuffer = lockBuffer; android_native_window_t::queueBuffer = queueBuffer; android_native_window_t::query = query; - android_native_window_t::perform = perform; } FramebufferNativeWindow::~FramebufferNativeWindow() @@ -236,18 +235,6 @@ int FramebufferNativeWindow::query(android_native_window_t* window, return BAD_VALUE; } -int FramebufferNativeWindow::perform(android_native_window_t* window, - int operation, ...) -{ - switch (operation) { - case NATIVE_WINDOW_SET_USAGE: - break; - default: - return NAME_NOT_FOUND; - } - return NO_ERROR; -} - // ---------------------------------------------------------------------------- }; // namespace android // ---------------------------------------------------------------------------- diff --git a/libs/ui/ISurface.cpp b/libs/ui/ISurface.cpp index b78e8b5ab5a1..9fbae1ebafe1 100644 --- a/libs/ui/ISurface.cpp +++ b/libs/ui/ISurface.cpp @@ -71,11 +71,10 @@ public: { } - virtual sp<SurfaceBuffer> getBuffer(int usage) + virtual sp<SurfaceBuffer> getBuffer() { Parcel data, reply; data.writeInterfaceToken(ISurface::getInterfaceDescriptor()); - data.writeInt32(usage); remote()->transact(GET_BUFFER, data, &reply); sp<SurfaceBuffer> buffer = new SurfaceBuffer(reply); return buffer; @@ -136,8 +135,7 @@ status_t BnSurface::onTransact( switch(code) { case GET_BUFFER: { CHECK_INTERFACE(ISurface, data, reply); - int usage = data.readInt32(); - sp<SurfaceBuffer> buffer(getBuffer(usage)); + sp<SurfaceBuffer> buffer(getBuffer()); return SurfaceBuffer::writeToParcel(reply, buffer.get()); } case REGISTER_BUFFERS: { diff --git a/libs/ui/Surface.cpp b/libs/ui/Surface.cpp index 2b6905f33fc2..4abb7f62ad44 100644 --- a/libs/ui/Surface.cpp +++ b/libs/ui/Surface.cpp @@ -414,7 +414,6 @@ void Surface::init() android_native_window_t::lockBuffer = lockBuffer; android_native_window_t::queueBuffer = queueBuffer; android_native_window_t::query = query; - android_native_window_t::perform = perform; mSwapRectangle.makeInvalid(); DisplayInfo dinfo; SurfaceComposerClient::getDisplayInfo(0, &dinfo); @@ -424,8 +423,6 @@ void Surface::init() const_cast<int&>(android_native_window_t::minSwapInterval) = 1; const_cast<int&>(android_native_window_t::maxSwapInterval) = 1; const_cast<uint32_t&>(android_native_window_t::flags) = 0; - // be default we request a hardware surface - mUsage = GRALLOC_USAGE_HW_RENDER; } @@ -515,17 +512,6 @@ int Surface::query(android_native_window_t* window, return self->query(what, value); } -int Surface::perform(android_native_window_t* window, - int operation, ...) -{ - va_list args; - va_start(args, operation); - Surface* self = getSelf(window); - int res = self->perform(operation, args); - va_end(args); - return res; -} - // ---------------------------------------------------------------------------- status_t Surface::dequeueBuffer(sp<SurfaceBuffer>* buffer) @@ -575,7 +561,7 @@ int Surface::dequeueBuffer(android_native_buffer_t** buffer) volatile const surface_info_t* const back = lcblk->surface + backIdx; if (back->flags & surface_info_t::eNeedNewBuffer) { - err = getBufferLocked(backIdx, mUsage); + err = getBufferLocked(backIdx); } if (err == NO_ERROR) { @@ -641,20 +627,6 @@ int Surface::query(int what, int* value) return BAD_VALUE; } -int Surface::perform(int operation, va_list args) -{ - int res = NO_ERROR; - switch (operation) { - case NATIVE_WINDOW_SET_USAGE: - mUsage = va_arg(args, int); - break; - default: - res = NAME_NOT_FOUND; - break; - } - return res; -} - // ---------------------------------------------------------------------------- status_t Surface::lock(SurfaceInfo* info, bool blocking) { @@ -664,9 +636,6 @@ status_t Surface::lock(SurfaceInfo* info, bool blocking) { status_t Surface::lock(SurfaceInfo* other, Region* dirtyIn, bool blocking) { // FIXME: needs some locking here - - // we're intending to do software rendering from this point - mUsage = GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN; sp<SurfaceBuffer> backBuffer; status_t err = dequeueBuffer(&backBuffer); @@ -756,10 +725,10 @@ void Surface::setSwapRectangle(const Rect& r) { mSwapRectangle = r; } -status_t Surface::getBufferLocked(int index, int usage) +status_t Surface::getBufferLocked(int index) { status_t err = NO_MEMORY; - sp<SurfaceBuffer> buffer = mSurface->getBuffer(usage); + sp<SurfaceBuffer> buffer = mSurface->getBuffer(); LOGE_IF(buffer==0, "ISurface::getBuffer() returned NULL"); if (buffer != 0) { sp<SurfaceBuffer>& currentBuffer(mBuffers[index]); diff --git a/media/java/android/media/ExifInterface.java b/media/java/android/media/ExifInterface.java index 645f3f63a6ef..6d7c0ae2facf 100644 --- a/media/java/android/media/ExifInterface.java +++ b/media/java/android/media/ExifInterface.java @@ -128,7 +128,10 @@ public class ExifInterface { } public void setFilename(String filename) { - mFilename = filename; + if (mFilename == null || !mFilename.equals(filename)) { + mFilename = filename; + mCachedAttributes = null; + } } /** diff --git a/opengl/libagl/egl.cpp b/opengl/libagl/egl.cpp index 0762ebf605fc..cf66be33729f 100644 --- a/opengl/libagl/egl.cpp +++ b/opengl/libagl/egl.cpp @@ -384,10 +384,6 @@ egl_window_surface_v2_t::~egl_window_surface_v2_t() { EGLBoolean egl_window_surface_v2_t::connect() { - // we're intending to do software rendering - native_window_set_usage(nativeWindow, - GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN); - // dequeue a buffer if (nativeWindow->dequeueBuffer(nativeWindow, &buffer) != NO_ERROR) { return setError(EGL_BAD_ALLOC, EGL_FALSE); diff --git a/packages/VpnServices/src/com/android/server/vpn/VpnService.java b/packages/VpnServices/src/com/android/server/vpn/VpnService.java index f410c7b932a1..e3ac996fc679 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 @@ abstract class VpnService<E extends VpnProfile> implements Serializable { 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 @@ abstract class VpnService<E extends VpnProfile> implements Serializable { 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 @@ abstract class VpnService<E extends VpnProfile> implements Serializable { 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 @@ abstract class VpnService<E extends VpnProfile> implements Serializable { } } - 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 @@ abstract class VpnService<E extends VpnProfile> implements Serializable { } 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 @@ abstract class VpnService<E extends VpnProfile> implements Serializable { } } - 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 1e5302e8b2f9..36dca7d71e60 100644 --- a/services/java/com/android/server/BackupManagerService.java +++ b/services/java/com/android/server/BackupManagerService.java @@ -1725,6 +1725,8 @@ class BackupManagerService extends IBackupManager.Stub { return 0; } } + + Log.w(TAG, "Restore token " + Long.toHexString(token) + " not found"); return -1; } |