diff options
Diffstat (limited to 'core')
| -rw-r--r-- | core/java/android/backup/BackupManager.java | 49 | ||||
| -rw-r--r-- | core/java/android/provider/Settings.java | 6 | ||||
| -rwxr-xr-x | core/java/android/speech/tts/TextToSpeech.java | 83 | ||||
| -rw-r--r-- | core/java/android/view/ViewRoot.java | 9 | ||||
| -rw-r--r-- | core/res/res/drawable/rate_star_big_half.png | bin | 1224 -> 818 bytes | |||
| -rw-r--r-- | core/res/res/drawable/rate_star_big_off.png | bin | 482 -> 527 bytes | |||
| -rw-r--r-- | core/res/res/drawable/rate_star_big_on.png | bin | 2017 -> 992 bytes |
7 files changed, 96 insertions, 51 deletions
diff --git a/core/java/android/backup/BackupManager.java b/core/java/android/backup/BackupManager.java index 5b4ac0d..34a1a0c 100644 --- a/core/java/android/backup/BackupManager.java +++ b/core/java/android/backup/BackupManager.java @@ -19,6 +19,7 @@ package android.backup; import android.content.Context; import android.os.RemoteException; import android.os.ServiceManager; +import android.util.Log; /** * BackupManager is the interface to the system's backup service. @@ -39,14 +40,17 @@ import android.os.ServiceManager; * @hide pending API solidification */ public class BackupManager { + private static final String TAG = "BackupManager"; + private Context mContext; - private IBackupManager mService; + private static IBackupManager sService; - /** - * Defined backup transports understood by {@link IBackupManager.selectBackupTransport}. - */ - public static final int TRANSPORT_LOCAL = 1; - public static final int TRANSPORT_GOOGLE = 2; + private static void checkServiceBinder() { + if (sService == null) { + sService = IBackupManager.Stub.asInterface( + ServiceManager.getService(Context.BACKUP_SERVICE)); + } + } /** * Constructs a BackupManager object through which the application can @@ -58,8 +62,6 @@ public class BackupManager { */ public BackupManager(Context context) { mContext = context; - mService = IBackupManager.Stub.asInterface( - ServiceManager.getService(Context.BACKUP_SERVICE)); } /** @@ -68,10 +70,31 @@ public class BackupManager { * {@link android.app.BackupAgent} subclass will be scheduled when you call this method. */ public void dataChanged() { - if (mService != null) { + checkServiceBinder(); + if (sService != null) { + try { + sService.dataChanged(mContext.getPackageName()); + } catch (RemoteException e) { + Log.d(TAG, "dataChanged() couldn't connect"); + } + } + } + + /** + * Convenience method for callers who need to indicate that some other package + * needs a backup pass. This can be relevant in the case of groups of packages + * that share a uid, for example. + * + * This method requires that the application hold the "android.permission.BACKUP" + * permission if the package named in the argument is not the caller's own. + */ + public static void dataChanged(String packageName) { + checkServiceBinder(); + if (sService != null) { try { - mService.dataChanged(mContext.getPackageName()); + sService.dataChanged(packageName); } catch (RemoteException e) { + Log.d(TAG, "dataChanged(pkg) couldn't connect"); } } } @@ -85,10 +108,12 @@ public class BackupManager { */ public IRestoreSession beginRestoreSession(String transport) { IRestoreSession binder = null; - if (mService != null) { + checkServiceBinder(); + if (sService != null) { try { - binder = mService.beginRestoreSession(transport); + binder = sService.beginRestoreSession(transport); } catch (RemoteException e) { + Log.d(TAG, "beginRestoreSession() couldn't connect"); } } return binder; diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 7f63bff..0d27e1e 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -2671,6 +2671,12 @@ public final class Settings { public static final String GMAIL_DISCARD_ERROR_UPHILL_OP = "gmail_discard_error_uphill_op"; /** + * Controls how many attempts Gmail will try to upload an uphill operations before it + * abandons the operation. Defaults to 20. + */ + public static final String GMAIL_NUM_RETRY_UPHILL_OP = "gmail_discard_error_uphill_op"; + + /** * the transcoder URL for mobile devices. */ public static final String TRANSCODER_URL = "mobile_transcoder_url"; diff --git a/core/java/android/speech/tts/TextToSpeech.java b/core/java/android/speech/tts/TextToSpeech.java index 61e182a..00667f4 100755 --- a/core/java/android/speech/tts/TextToSpeech.java +++ b/core/java/android/speech/tts/TextToSpeech.java @@ -342,14 +342,14 @@ public class TextToSpeech { public int speak(String text, int queueMode, HashMap<String,String> params) { synchronized (mStartLock) { + int result = TTS_ERROR; Log.i("TTS received: ", text); if (!mStarted) { - return TTS_ERROR; + return result; } try { // TODO support extra parameters, passing cache of current parameters for the moment - mITts.speak(text, queueMode, mCachedParams); - return TTS_SUCCESS; + result = mITts.speak(text, queueMode, mCachedParams); } catch (RemoteException e) { // TTS died; restart it. mStarted = false; @@ -362,8 +362,9 @@ public class TextToSpeech { // TTS died; restart it. mStarted = false; initTts(); + } finally { + return result; } - return TTS_ERROR; } } @@ -383,13 +384,13 @@ public class TextToSpeech { public int playEarcon(String earcon, int queueMode, HashMap<String,String> params) { synchronized (mStartLock) { + int result = TTS_ERROR; if (!mStarted) { - return TTS_ERROR; + return result; } try { // TODO support extra parameters, passing null for the moment - mITts.playEarcon(earcon, queueMode, null); - return TTS_SUCCESS; + result = mITts.playEarcon(earcon, queueMode, null); } catch (RemoteException e) { // TTS died; restart it. mStarted = false; @@ -402,8 +403,9 @@ public class TextToSpeech { // TTS died; restart it. mStarted = false; initTts(); + } finally { + return result; } - return TTS_ERROR; } } @@ -420,13 +422,13 @@ public class TextToSpeech { */ public int playSilence(long durationInMs, int queueMode) { synchronized (mStartLock) { + int result = TTS_ERROR; if (!mStarted) { - return TTS_ERROR; + return result; } try { // TODO support extra parameters, passing cache of current parameters for the moment - mITts.playSilence(durationInMs, queueMode, mCachedParams); - return TTS_SUCCESS; + result = mITts.playSilence(durationInMs, queueMode, mCachedParams); } catch (RemoteException e) { // TTS died; restart it. mStarted = false; @@ -439,8 +441,9 @@ public class TextToSpeech { // TTS died; restart it. mStarted = false; initTts(); + } finally { + return result; } - return TTS_ERROR; } } @@ -482,12 +485,12 @@ public class TextToSpeech { */ public int stop() { synchronized (mStartLock) { + int result = TTS_ERROR; if (!mStarted) { - return TTS_ERROR; + return result; } try { - mITts.stop(); - return TTS_SUCCESS; + result = mITts.stop(); } catch (RemoteException e) { // TTS died; restart it. mStarted = false; @@ -500,8 +503,9 @@ public class TextToSpeech { // TTS died; restart it. mStarted = false; initTts(); + } finally { + return result; } - return TTS_ERROR; } } @@ -523,22 +527,23 @@ public class TextToSpeech { */ public int setSpeechRate(float speechRate) { synchronized (mStartLock) { + int result = TTS_ERROR; if (!mStarted) { - return TTS_SUCCESS; + return result; } try { if (speechRate > 0) { mCachedRate = (int)(speechRate*100); updateCachedParamArray(); - mITts.setSpeechRate(mCachedRate); - return TTS_SUCCESS; + result = mITts.setSpeechRate(mCachedRate); } } catch (RemoteException e) { // TTS died; restart it. mStarted = false; initTts(); + } finally { + return result; } - return TTS_ERROR; } } @@ -560,20 +565,21 @@ public class TextToSpeech { */ public int setPitch(float pitch) { synchronized (mStartLock) { + int result = TTS_ERROR; if (!mStarted) { - return TTS_ERROR; + return result; } try { if (pitch > 0) { - mITts.setPitch((int)(pitch*100)); - return TTS_SUCCESS; + result = mITts.setPitch((int)(pitch*100)); } } catch (RemoteException e) { // TTS died; restart it. mStarted = false; initTts(); + } finally { + return result; } - return TTS_ERROR; } } @@ -588,26 +594,27 @@ public class TextToSpeech { * @param loc * The locale describing the language to be used. * - * @return Code indicating success or failure. See TTS_ERROR and TTS_SUCCESS. + * @return Code indicating the support status for the locale. See the TTS_LANG_ codes. */ public int setLanguage(Locale loc) { synchronized (mStartLock) { + int result = TTS_LANG_NOT_SUPPORTED; if (!mStarted) { - return TTS_ERROR; + return result; } try { mCachedLang = loc.getISO3Language(); mCachedCountry = loc.getISO3Country(); mCachedVariant = loc.getVariant(); updateCachedParamArray(); - mITts.setLanguage(mCachedLang, mCachedCountry, mCachedVariant); - return TTS_SUCCESS; + result = mITts.setLanguage(mCachedLang, mCachedCountry, mCachedVariant); } catch (RemoteException e) { // TTS died; restart it. mStarted = false; initTts(); + } finally { + return result; } - return TTS_ERROR; } } @@ -649,18 +656,20 @@ public class TextToSpeech { */ public int isLanguageAvailable(Locale loc) { synchronized (mStartLock) { + int result = TTS_LANG_NOT_SUPPORTED; if (!mStarted) { - return TTS_LANG_NOT_SUPPORTED; + return result; } try { - return mITts.isLanguageAvailable(loc.getISO3Language(), loc.getISO3Country(), - loc.getVariant()); + result = mITts.isLanguageAvailable(loc.getISO3Language(), + loc.getISO3Country(), loc.getVariant()); } catch (RemoteException e) { // TTS died; restart it. mStarted = false; initTts(); + } finally { + return result; } - return TTS_LANG_NOT_SUPPORTED; } } @@ -681,13 +690,14 @@ public class TextToSpeech { public int synthesizeToFile(String text, HashMap<String,String> params, String filename) { synchronized (mStartLock) { + int result = TTS_ERROR; if (!mStarted) { - return TTS_ERROR; + return result; } try { // TODO support extra parameters, passing null for the moment if (mITts.synthesizeToFile(text, null, filename)){ - return TTS_SUCCESS; + result = TTS_SUCCESS; } } catch (RemoteException e) { // TTS died; restart it. @@ -701,8 +711,9 @@ public class TextToSpeech { // TTS died; restart it. mStarted = false; initTts(); + } finally { + return result; } - return TTS_ERROR; } } diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewRoot.java index 65457c5..6f6e224 100644 --- a/core/java/android/view/ViewRoot.java +++ b/core/java/android/view/ViewRoot.java @@ -546,13 +546,16 @@ public final class ViewRoot extends Handler implements ViewParent, if (DEBUG_DRAW) Log.v(TAG, "Invalidate child: " + dirty); if (mCurScrollY != 0 || mTranslator != null) { mTempRect.set(dirty); + dirty = mTempRect; if (mCurScrollY != 0) { - mTempRect.offset(0, -mCurScrollY); + dirty.offset(0, -mCurScrollY); } if (mTranslator != null) { - mTranslator.translateRectInAppWindowToScreen(mTempRect); + mTranslator.translateRectInAppWindowToScreen(dirty); + } + if (mAttachInfo.mScalingRequired) { + dirty.inset(-1, -1); } - dirty = mTempRect; } mDirty.union(dirty); if (!mWillDrawSoon) { diff --git a/core/res/res/drawable/rate_star_big_half.png b/core/res/res/drawable/rate_star_big_half.png Binary files differindex e73ca79..9762292 100644 --- a/core/res/res/drawable/rate_star_big_half.png +++ b/core/res/res/drawable/rate_star_big_half.png diff --git a/core/res/res/drawable/rate_star_big_off.png b/core/res/res/drawable/rate_star_big_off.png Binary files differindex b4dfa9d..6b5039f 100644 --- a/core/res/res/drawable/rate_star_big_off.png +++ b/core/res/res/drawable/rate_star_big_off.png diff --git a/core/res/res/drawable/rate_star_big_on.png b/core/res/res/drawable/rate_star_big_on.png Binary files differindex 7442c93..a972db2 100644 --- a/core/res/res/drawable/rate_star_big_on.png +++ b/core/res/res/drawable/rate_star_big_on.png |
