Merge change 6315
* changes:
should fix sim build
diff --git a/api/current.xml b/api/current.xml
index 0d11ed8..ecde4c6 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -31051,6 +31051,17 @@
<parameter name="modeFlags" type="int">
</parameter>
</method>
+<method name="isRestricted"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="obtainStyledAttributes"
return="android.content.res.TypedArray"
abstract="false"
@@ -31575,6 +31586,17 @@
visibility="public"
>
</field>
+<field name="CONTEXT_RESTRICTED"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="4"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="INPUT_METHOD_SERVICE"
type="java.lang.String"
transient="false"
diff --git a/core/java/android/app/ApplicationContext.java b/core/java/android/app/ApplicationContext.java
index 8ec1445..afda98d 100644
--- a/core/java/android/app/ApplicationContext.java
+++ b/core/java/android/app/ApplicationContext.java
@@ -187,6 +187,7 @@
private StatusBarManager mStatusBarManager = null;
private TelephonyManager mTelephonyManager = null;
private ClipboardManager mClipboardManager = null;
+ private boolean mRestricted;
private final Object mSync = new Object();
@@ -1352,6 +1353,7 @@
mMainThread.getPackageInfo(packageName, flags);
if (pi != null) {
ApplicationContext c = new ApplicationContext();
+ c.mRestricted = (flags & CONTEXT_RESTRICTED) == CONTEXT_RESTRICTED;
c.init(pi, null, mMainThread);
if (c.mResources != null) {
return c;
@@ -1363,6 +1365,11 @@
"Application package " + packageName + " not found");
}
+ @Override
+ public boolean isRestricted() {
+ return mRestricted;
+ }
+
private File getDataDirFile() {
if (mPackageInfo != null) {
return mPackageInfo.getDataDirFile();
diff --git a/core/java/android/appwidget/AppWidgetHostView.java b/core/java/android/appwidget/AppWidgetHostView.java
index 307c4c8..62d9267 100644
--- a/core/java/android/appwidget/AppWidgetHostView.java
+++ b/core/java/android/appwidget/AppWidgetHostView.java
@@ -269,7 +269,7 @@
try {
if (mInfo != null) {
Context theirContext = mContext.createPackageContext(
- mInfo.provider.getPackageName(), 0 /* no flags */);
+ mInfo.provider.getPackageName(), Context.CONTEXT_RESTRICTED);
LayoutInflater inflater = (LayoutInflater)
theirContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater = inflater.cloneInContext(theirContext);
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 6c8bafc..c6c9835 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -1664,6 +1664,13 @@
* with extreme care!
*/
public static final int CONTEXT_IGNORE_SECURITY = 0x00000002;
+
+ /**
+ * Flag for use with {@link #createPackageContext}: a restricted context may
+ * disable specific features. For instance, a View associated with a restricted
+ * context would ignore particular XML attributes.
+ */
+ public static final int CONTEXT_RESTRICTED = 0x00000004;
/**
* Return a new Context object for the given application name. This
@@ -1692,4 +1699,15 @@
*/
public abstract Context createPackageContext(String packageName,
int flags) throws PackageManager.NameNotFoundException;
+
+ /**
+ * Indicates whether this Context is restricted.
+ *
+ * @return True if this Context is restricted, false otherwise.
+ *
+ * @see #CONTEXT_RESTRICTED
+ */
+ public boolean isRestricted() {
+ return false;
+ }
}
diff --git a/core/java/android/content/ContextWrapper.java b/core/java/android/content/ContextWrapper.java
index 7513b3b..45a082a 100644
--- a/core/java/android/content/ContextWrapper.java
+++ b/core/java/android/content/ContextWrapper.java
@@ -430,4 +430,9 @@
throws PackageManager.NameNotFoundException {
return mBase.createPackageContext(packageName, flags);
}
+
+ @Override
+ public boolean isRestricted() {
+ return mBase.isRestricted();
+ }
}
diff --git a/core/java/android/content/SyncStorageEngine.java b/core/java/android/content/SyncStorageEngine.java
index aaba7c7..13bcdd3 100644
--- a/core/java/android/content/SyncStorageEngine.java
+++ b/core/java/android/content/SyncStorageEngine.java
@@ -25,6 +25,7 @@
import org.xmlpull.v1.XmlSerializer;
import android.accounts.Account;
+import android.backup.IBackupManager;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
@@ -36,6 +37,7 @@
import android.os.Parcel;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
+import android.os.ServiceManager;
import android.util.Log;
import android.util.SparseArray;
import android.util.Xml;
@@ -339,8 +341,18 @@
}
}
}
+ // Inform the backup manager about a data change
+ IBackupManager ibm = IBackupManager.Stub.asInterface(
+ ServiceManager.getService(Context.BACKUP_SERVICE));
+ if (ibm != null) {
+ try {
+ ibm.dataChanged("com.android.providers.settings");
+ } catch (RemoteException e) {
+ // Try again later
+ }
+ }
}
-
+
public boolean getSyncAutomatically(Account account, String providerName) {
synchronized (mAuthorities) {
if (account != null) {
diff --git a/core/java/android/speech/tts/TextToSpeech.java b/core/java/android/speech/tts/TextToSpeech.java
index f714dd9..61e182a 100755
--- a/core/java/android/speech/tts/TextToSpeech.java
+++ b/core/java/android/speech/tts/TextToSpeech.java
@@ -207,7 +207,7 @@
}
};
- Intent intent = new Intent("android.intent.action.USE_TTS");
+ Intent intent = new Intent("android.intent.action.START_TTS_SERVICE");
intent.addCategory("android.intent.category.TTS");
mContext.bindService(intent, mServiceConnection,
Context.BIND_AUTO_CREATE);
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index b3180ca..ff8868b 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -1996,6 +1996,11 @@
mMinHeight = a.getDimensionPixelSize(attr, 0);
break;
case R.styleable.View_onClick:
+ if (context.isRestricted()) {
+ throw new IllegalStateException("The android:onClick attribute cannot "
+ + "be used within a restricted context");
+ }
+
final String handlerName = a.getString(attr);
if (handlerName != null) {
setOnClickListener(new OnClickListener() {
diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java
index 1b5c5bc..2dac652 100644
--- a/core/java/android/widget/RemoteViews.java
+++ b/core/java/android/widget/RemoteViews.java
@@ -856,7 +856,7 @@
if (packageName != null) {
try {
- c = context.createPackageContext(packageName, 0);
+ c = context.createPackageContext(packageName, Context.CONTEXT_RESTRICTED);
} catch (NameNotFoundException e) {
Log.e(LOG_TAG, "Package name " + packageName + " not found");
c = context;
diff --git a/core/java/android/widget/VideoView.java b/core/java/android/widget/VideoView.java
index 20dd8a6..3b722f4 100644
--- a/core/java/android/widget/VideoView.java
+++ b/core/java/android/widget/VideoView.java
@@ -51,11 +51,26 @@
private Uri mUri;
private int mDuration;
+ // all possible internal states
+ private static final int STATE_ERROR = -1;
+ private static final int STATE_IDLE = 0;
+ private static final int STATE_PREPARING = 1;
+ private static final int STATE_PREPARED = 2;
+ private static final int STATE_PLAYING = 3;
+ private static final int STATE_PAUSED = 4;
+ private static final int STATE_PLAYBACK_COMPLETED = 5;
+
+ // mCurrentState is a VideoView object's current state.
+ // mTargetState is the state that a method caller intends to reach.
+ // For instance, regardless the VideoView object's current state,
+ // calling pause() intends to bring the object to a target state
+ // of STATE_PAUSED.
+ private int mCurrentState = STATE_IDLE;
+ private int mTargetState = STATE_IDLE;
+
// All the stuff we need for playing and showing a video
private SurfaceHolder mSurfaceHolder = null;
private MediaPlayer mMediaPlayer = null;
- private boolean mIsPrepared;
- private boolean mIsPlaybackCompleted;
private int mVideoWidth;
private int mVideoHeight;
private int mSurfaceWidth;
@@ -65,8 +80,7 @@
private MediaPlayer.OnPreparedListener mOnPreparedListener;
private int mCurrentBufferPercentage;
private OnErrorListener mOnErrorListener;
- private boolean mStartWhenPrepared;
- private int mSeekWhenPrepared;
+ private int mSeekWhenPrepared; // recording the seek position while preparing
public VideoView(Context context) {
super(context);
@@ -80,7 +94,6 @@
public VideoView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
-
initVideoView();
}
@@ -143,6 +156,8 @@
setFocusable(true);
setFocusableInTouchMode(true);
requestFocus();
+ mCurrentState = STATE_IDLE;
+ mTargetState = STATE_IDLE;
}
public void setVideoPath(String path) {
@@ -151,7 +166,6 @@
public void setVideoURI(Uri uri) {
mUri = uri;
- mStartWhenPrepared = false;
mSeekWhenPrepared = 0;
openVideo();
requestLayout();
@@ -163,6 +177,8 @@
mMediaPlayer.stop();
mMediaPlayer.release();
mMediaPlayer = null;
+ mCurrentState = STATE_IDLE;
+ mTargetState = STATE_IDLE;
}
}
@@ -176,18 +192,12 @@
Intent i = new Intent("com.android.music.musicservicecommand");
i.putExtra("command", "pause");
mContext.sendBroadcast(i);
-
- if (mMediaPlayer != null) {
- mMediaPlayer.reset();
- mMediaPlayer.release();
- mMediaPlayer = null;
- }
+
+ release();
try {
mMediaPlayer = new MediaPlayer();
mMediaPlayer.setOnPreparedListener(mPreparedListener);
mMediaPlayer.setOnVideoSizeChangedListener(mSizeChangedListener);
- mIsPrepared = false;
- Log.v(TAG, "reset duration to -1 in openVideo");
mDuration = -1;
mMediaPlayer.setOnCompletionListener(mCompletionListener);
mMediaPlayer.setOnErrorListener(mErrorListener);
@@ -198,12 +208,18 @@
mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mMediaPlayer.setScreenOnWhilePlaying(true);
mMediaPlayer.prepareAsync();
+ mCurrentState = STATE_PREPARING;
+ mTargetState = STATE_PREPARED;
attachMediaController();
} catch (IOException ex) {
Log.w(TAG, "Unable to open content: " + mUri, ex);
+ mCurrentState = STATE_ERROR;
+ mTargetState = STATE_ERROR;
return;
} catch (IllegalArgumentException ex) {
Log.w(TAG, "Unable to open content: " + mUri, ex);
+ mCurrentState = STATE_ERROR;
+ mTargetState = STATE_ERROR;
return;
}
}
@@ -222,7 +238,7 @@
View anchorView = this.getParent() instanceof View ?
(View)this.getParent() : this;
mMediaController.setAnchorView(anchorView);
- mMediaController.setEnabled(mIsPrepared);
+ mMediaController.setEnabled(isInPlaybackState());
}
}
@@ -239,8 +255,7 @@
MediaPlayer.OnPreparedListener mPreparedListener = new MediaPlayer.OnPreparedListener() {
public void onPrepared(MediaPlayer mp) {
- // briefly show the mediacontroller
- mIsPrepared = true;
+ mCurrentState = STATE_PREPARED;
if (mOnPreparedListener != null) {
mOnPreparedListener.onPrepared(mMediaPlayer);
}
@@ -249,6 +264,10 @@
}
mVideoWidth = mp.getVideoWidth();
mVideoHeight = mp.getVideoHeight();
+ int seekToPosition = mSeekWhenPrepared; // mSeekWhenPrepared may be changed after seekTo() call
+ if (seekToPosition != 0) {
+ seekTo(seekToPosition);
+ }
if (mVideoWidth != 0 && mVideoHeight != 0) {
//Log.i("@@@@", "video size: " + mVideoWidth +"/"+ mVideoHeight);
getHolder().setFixedSize(mVideoWidth, mVideoHeight);
@@ -256,18 +275,13 @@
// We didn't actually change the size (it was already at the size
// we need), so we won't get a "surface changed" callback, so
// start the video here instead of in the callback.
- if (mSeekWhenPrepared != 0) {
- mMediaPlayer.seekTo(mSeekWhenPrepared);
- mSeekWhenPrepared = 0;
- }
- if (mStartWhenPrepared) {
+ if (mTargetState == STATE_PLAYING) {
start();
- mStartWhenPrepared = false;
if (mMediaController != null) {
mMediaController.show();
}
} else if (!isPlaying() &&
- (mSeekWhenPrepared != 0 || getCurrentPosition() > 0)) {
+ (seekToPosition != 0 || getCurrentPosition() > 0)) {
if (mMediaController != null) {
// Show the media controls when we're paused into a video and make 'em stick.
mMediaController.show(0);
@@ -277,13 +291,8 @@
} else {
// We don't know the video size yet, but should start anyway.
// The video size might be reported to us later.
- if (mSeekWhenPrepared != 0) {
- mMediaPlayer.seekTo(mSeekWhenPrepared);
- mSeekWhenPrepared = 0;
- }
- if (mStartWhenPrepared) {
+ if (mTargetState == STATE_PLAYING) {
start();
- mStartWhenPrepared = false;
}
}
}
@@ -292,7 +301,8 @@
private MediaPlayer.OnCompletionListener mCompletionListener =
new MediaPlayer.OnCompletionListener() {
public void onCompletion(MediaPlayer mp) {
- mIsPlaybackCompleted = true;
+ mCurrentState = STATE_PLAYBACK_COMPLETED;
+ mTargetState = STATE_PLAYBACK_COMPLETED;
if (mMediaController != null) {
mMediaController.hide();
}
@@ -306,6 +316,8 @@
new MediaPlayer.OnErrorListener() {
public boolean onError(MediaPlayer mp, int framework_err, int impl_err) {
Log.d(TAG, "Error: " + framework_err + "," + impl_err);
+ mCurrentState = STATE_ERROR;
+ mTargetState = STATE_ERROR;
if (mMediaController != null) {
mMediaController.hide();
}
@@ -402,14 +414,13 @@
{
mSurfaceWidth = w;
mSurfaceHeight = h;
- if (mMediaPlayer != null && mIsPrepared && mVideoWidth == w && mVideoHeight == h) {
+ boolean isValidState = (mTargetState == STATE_PLAYING);
+ boolean hasValidSize = (mVideoWidth == w && mVideoHeight == h);
+ if (mMediaPlayer != null && isValidState && hasValidSize) {
if (mSeekWhenPrepared != 0) {
- mMediaPlayer.seekTo(mSeekWhenPrepared);
- mSeekWhenPrepared = 0;
+ seekTo(mSeekWhenPrepared);
}
- if (!mIsPlaybackCompleted) {
- start();
- }
+ start();
if (mMediaController != null) {
mMediaController.show();
}
@@ -427,17 +438,26 @@
// after we return from this we can't use the surface any more
mSurfaceHolder = null;
if (mMediaController != null) mMediaController.hide();
- if (mMediaPlayer != null) {
- mMediaPlayer.reset();
- mMediaPlayer.release();
- mMediaPlayer = null;
- }
+ release();
}
};
+ /*
+ * release the media player in any state
+ */
+ private void release() {
+ if (mMediaPlayer != null) {
+ mMediaPlayer.reset();
+ mMediaPlayer.release();
+ mMediaPlayer = null;
+ mCurrentState = STATE_IDLE;
+ mTargetState = STATE_IDLE;
+ }
+ }
+
@Override
public boolean onTouchEvent(MotionEvent ev) {
- if (mIsPrepared && mMediaPlayer != null && mMediaController != null) {
+ if (isInPlaybackState() && mMediaController != null) {
toggleMediaControlsVisiblity();
}
return false;
@@ -445,7 +465,7 @@
@Override
public boolean onTrackballEvent(MotionEvent ev) {
- if (mIsPrepared && mMediaPlayer != null && mMediaController != null) {
+ if (isInPlaybackState() && mMediaController != null) {
toggleMediaControlsVisiblity();
}
return false;
@@ -454,15 +474,13 @@
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
- if (mIsPrepared &&
- keyCode != KeyEvent.KEYCODE_BACK &&
- keyCode != KeyEvent.KEYCODE_VOLUME_UP &&
- keyCode != KeyEvent.KEYCODE_VOLUME_DOWN &&
- keyCode != KeyEvent.KEYCODE_MENU &&
- keyCode != KeyEvent.KEYCODE_CALL &&
- keyCode != KeyEvent.KEYCODE_ENDCALL &&
- mMediaPlayer != null &&
- mMediaController != null) {
+ boolean isKeyCodeSupported = keyCode != KeyEvent.KEYCODE_BACK &&
+ keyCode != KeyEvent.KEYCODE_VOLUME_UP &&
+ keyCode != KeyEvent.KEYCODE_VOLUME_DOWN &&
+ keyCode != KeyEvent.KEYCODE_MENU &&
+ keyCode != KeyEvent.KEYCODE_CALL &&
+ keyCode != KeyEvent.KEYCODE_ENDCALL;
+ if (isInPlaybackState() && isKeyCodeSupported && mMediaController != null) {
if (keyCode == KeyEvent.KEYCODE_HEADSETHOOK ||
keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE) {
if (mMediaPlayer.isPlaying()) {
@@ -494,26 +512,26 @@
}
public void start() {
- mIsPlaybackCompleted = false;
- if (mMediaPlayer != null && mIsPrepared) {
- mMediaPlayer.start();
- mStartWhenPrepared = false;
- } else {
- mStartWhenPrepared = true;
+ if (isInPlaybackState()) {
+ mMediaPlayer.start();
+ mCurrentState = STATE_PLAYING;
}
+ mTargetState = STATE_PLAYING;
}
public void pause() {
- if (mMediaPlayer != null && mIsPrepared) {
+ if (isInPlaybackState()) {
if (mMediaPlayer.isPlaying()) {
mMediaPlayer.pause();
+ mCurrentState = STATE_PAUSED;
}
}
- mStartWhenPrepared = false;
+ mTargetState = STATE_PAUSED;
}
+ // cache duration as mDuration for faster access
public int getDuration() {
- if (mMediaPlayer != null && mIsPrepared) {
+ if (isInPlaybackState()) {
if (mDuration > 0) {
return mDuration;
}
@@ -525,25 +543,23 @@
}
public int getCurrentPosition() {
- if (mMediaPlayer != null && mIsPrepared) {
+ if (isInPlaybackState()) {
return mMediaPlayer.getCurrentPosition();
}
return 0;
}
public void seekTo(int msec) {
- if (mMediaPlayer != null && mIsPrepared) {
+ if (isInPlaybackState()) {
mMediaPlayer.seekTo(msec);
+ mSeekWhenPrepared = 0;
} else {
mSeekWhenPrepared = msec;
}
}
public boolean isPlaying() {
- if (mMediaPlayer != null && mIsPrepared) {
- return mMediaPlayer.isPlaying();
- }
- return false;
+ return isInPlaybackState() && mMediaPlayer.isPlaying();
}
public int getBufferPercentage() {
@@ -552,4 +568,11 @@
}
return 0;
}
+
+ private boolean isInPlaybackState() {
+ return (mMediaPlayer != null &&
+ mCurrentState != STATE_ERROR &&
+ mCurrentState != STATE_IDLE &&
+ mCurrentState != STATE_PREPARING);
+ }
}
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
index 16be668..f9e98ef 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
@@ -166,11 +166,12 @@
pos += length;
if (!TextUtils.isEmpty(settingName) && !TextUtils.isEmpty(settingValue)) {
//Log.i(TAG, "Restore " + settingName + " = " + settingValue);
- cv.clear();
- cv.put(Settings.NameValueTable.NAME, settingName);
- cv.put(Settings.NameValueTable.VALUE, settingValue);
- getContentResolver().insert(contentUri, cv);
- mSettingsHelper.restoreValue(settingName, settingValue);
+ if (mSettingsHelper.restoreValue(settingName, settingValue)) {
+ cv.clear();
+ cv.put(Settings.NameValueTable.NAME, settingName);
+ cv.put(Settings.NameValueTable.VALUE, settingValue);
+ getContentResolver().insert(contentUri, cv);
+ }
}
}
}
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java
index d67f6f5..0becaa3 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java
@@ -19,12 +19,13 @@
import android.backup.BackupDataInput;
import android.content.ContentResolver;
import android.content.Context;
+import android.content.IContentService;
+import android.location.LocationManager;
import android.media.AudioManager;
import android.os.IHardwareService;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.provider.Settings;
-import android.content.IContentService;
import android.util.Log;
public class SettingsHelper {
@@ -33,10 +34,10 @@
private Context mContext;
private AudioManager mAudioManager;
private IContentService mContentService;
- private static final String SYNC_AUTO = "auto_sync";
- private static final String SYNC_MAIL = "gmail-ls_sync";
- private static final String SYNC_CALENDAR = "calendar_sync";
- private static final String SYNC_CONTACTS = "contacts_sync";
+ private static final String[] PROVIDERS = { "gmail-ls", "calendar", "contacts" };
+
+ private boolean mSilent;
+ private boolean mVibrate;
public SettingsHelper(Context context) {
mContext = context;
@@ -45,15 +46,43 @@
mContentService = ContentResolver.getContentService();
}
- public void restoreValue(String name, String value) {
+ /**
+ * Sets the property via a call to the appropriate API, if any, and returns
+ * whether or not the setting should be saved to the database as well.
+ * @param name the name of the setting
+ * @param value the string value of the setting
+ * @return whether to continue with writing the value to the database. In
+ * some cases the data will be written by the call to the appropriate API,
+ * and in some cases the property value needs to be modified before setting.
+ */
+ public boolean restoreValue(String name, String value) {
if (Settings.System.SCREEN_BRIGHTNESS.equals(name)) {
setBrightness(Integer.parseInt(value));
} else if (Settings.System.SOUND_EFFECTS_ENABLED.equals(name)) {
- if (Integer.parseInt(value) == 1) {
- mAudioManager.loadSoundEffects();
- } else {
- mAudioManager.unloadSoundEffects();
- }
+ setSoundEffects(Integer.parseInt(value) == 1);
+ } else if (Settings.Secure.LOCATION_PROVIDERS_ALLOWED.equals(name)) {
+ setGpsLocation(value);
+ return false;
+ }
+ return true;
+ }
+
+ private void setGpsLocation(String value) {
+ final String GPS = LocationManager.GPS_PROVIDER;
+ boolean enabled =
+ GPS.equals(value) ||
+ value.startsWith(GPS + ",") ||
+ value.endsWith("," + GPS) ||
+ value.contains("," + GPS + ",");
+ Settings.Secure.setLocationProviderEnabled(
+ mContext.getContentResolver(), GPS, enabled);
+ }
+
+ private void setSoundEffects(boolean enable) {
+ if (enable) {
+ mAudioManager.loadSoundEffects();
+ } else {
+ mAudioManager.unloadSoundEffects();
}
}
@@ -69,8 +98,19 @@
}
}
- static final String[] PROVIDERS = { "gmail-ls", "calendar", "contacts" };
-
+ private void setRingerMode() {
+ if (mSilent) {
+ mAudioManager.setRingerMode(mVibrate ? AudioManager.RINGER_MODE_VIBRATE :
+ AudioManager.RINGER_MODE_SILENT);
+ } else {
+ mAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
+ mAudioManager.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER,
+ mVibrate ? AudioManager.VIBRATE_SETTING_ON
+ : AudioManager.VIBRATE_SETTING_OFF);
+ }
+ }
+
+ /* TODO: Get a list of all sync providers and save/restore the settings */
byte[] getSyncProviders() {
byte[] sync = new byte[1 + PROVIDERS.length];
// TODO: Sync backup needs to be moved to SystemBackupAgent
@@ -88,7 +128,7 @@
*/
return sync;
}
-
+
void setSyncProviders(BackupDataInput backup) {
byte[] sync = new byte[backup.getDataSize()];
diff --git a/packages/TtsService/AndroidManifest.xml b/packages/TtsService/AndroidManifest.xml
index fab2534..bd17ba0 100755
--- a/packages/TtsService/AndroidManifest.xml
+++ b/packages/TtsService/AndroidManifest.xml
@@ -6,7 +6,7 @@
android:name=".TtsService"
android:label="TTS Service">
<intent-filter>
- <action android:name="android.intent.action.USE_TTS"/>
+ <action android:name="android.intent.action.START_TTS_SERVICE"/>
<category android:name="android.intent.category.TTS"/>
</intent-filter>
</service>
diff --git a/packages/TtsService/src/android/tts/TtsService.java b/packages/TtsService/src/android/tts/TtsService.java
index 5c3c560..0bed72bd 100755
--- a/packages/TtsService/src/android/tts/TtsService.java
+++ b/packages/TtsService/src/android/tts/TtsService.java
@@ -102,7 +102,7 @@
private static final int MAX_SPEECH_ITEM_CHAR_LENGTH = 4000;
private static final int MAX_FILENAME_LENGTH = 250;
- private static final String ACTION = "android.intent.action.USE_TTS";
+ private static final String ACTION = "android.intent.action.START_TTS_SERVICE";
private static final String CATEGORY = "android.intent.category.TTS";
private static final String PKGNAME = "android.tts";
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java
index e47d853..4b5c3df 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/BackupManagerService.java
@@ -316,6 +316,7 @@
// Add a transport to our set of available backends
private void registerTransport(String name, IBackupTransport transport) {
synchronized (mTransports) {
+ if (DEBUG) Log.v(TAG, "Registering transport " + name + " = " + transport);
mTransports.put(name, transport);
}
}
@@ -1341,7 +1342,7 @@
// Report all known, available backup transports
public String[] listAllTransports() {
- mContext.enforceCallingPermission(android.Manifest.permission.BACKUP, "listAllTransports");
+ mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP, "listAllTransports");
String[] list = null;
ArrayList<String> known = new ArrayList<String>();
@@ -1503,6 +1504,8 @@
@Override
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
synchronized (mQueueLock) {
+ long oldId = Binder.clearCallingIdentity();
+
pw.println("Backup Manager is " + (mEnabled ? "enabled" : "disabled"));
pw.println("Available transports:");
for (String t : listAllTransports()) {
@@ -1524,6 +1527,8 @@
for (BackupRequest req : mPendingBackups.values()) {
pw.println(" " + req);
}
+
+ Binder.restoreCallingIdentity(oldId);
}
}
}
diff --git a/test-runner/android/test/mock/MockContext.java b/test-runner/android/test/mock/MockContext.java
index efc4880..b83a44d6 100644
--- a/test-runner/android/test/mock/MockContext.java
+++ b/test-runner/android/test/mock/MockContext.java
@@ -397,4 +397,9 @@
throws PackageManager.NameNotFoundException {
throw new UnsupportedOperationException();
}
+
+ @Override
+ public boolean isRestricted() {
+ throw new UnsupportedOperationException();
+ }
}