Merge change 6963
* changes:
Block incoming SMS in CDMA Emergency Callback Mode
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 4234bb3..6f707cb 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -2881,10 +2881,10 @@
"gtalk_max_retries_for_auth_expired";
/**
- * This is the url for getting the app token for server-to-device data messaging.
+ * This is the url for getting the app token for server-to-device push messaging.
*/
- public static final String DATA_MESSAGE_GET_APP_TOKEN_URL =
- "data_messaging_get_app_token_url";
+ public static final String PUSH_MESSAGING_REGISTRATION_URL =
+ "push_messaging_registration_url";
/**
* Enable use of ssl session caching.
diff --git a/packages/TtsService/jni/android_tts_SynthProxy.cpp b/packages/TtsService/jni/android_tts_SynthProxy.cpp
index 1958ba9..4247483 100644
--- a/packages/TtsService/jni/android_tts_SynthProxy.cpp
+++ b/packages/TtsService/jni/android_tts_SynthProxy.cpp
@@ -33,6 +33,8 @@
#define DEFAULT_TTS_FORMAT AudioSystem::PCM_16_BIT
#define DEFAULT_TTS_NB_CHANNELS 1
#define DEFAULT_TTS_BUFFERSIZE 1024
+// TODO use the TTS stream type when available
+#define DEFAULT_TTS_STREAM_TYPE AudioSystem::MUSIC
#define USAGEMODE_PLAY_IMMEDIATELY 0
#define USAGEMODE_WRITE_TO_FILE 1
@@ -46,10 +48,12 @@
jmethodID synthProxyMethodPost;
};
+// structure to hold the data that is used each time the TTS engine has synthesized more data
struct afterSynthData_t {
jint jniStorage;
int usageMode;
FILE* outputFile;
+ AudioSystem::stream_type streamType;
};
// ----------------------------------------------------------------------------
@@ -62,6 +66,7 @@
jobject tts_ref;
TtsEngine* mNativeSynthInterface;
AudioTrack* mAudioOut;
+ AudioSystem::stream_type mStreamType;
uint32_t mSampleRate;
AudioSystem::audio_format mAudFormat;
int mNbChannels;
@@ -73,6 +78,7 @@
tts_ref = NULL;
mNativeSynthInterface = NULL;
mAudioOut = NULL;
+ mStreamType = DEFAULT_TTS_STREAM_TYPE;
mSampleRate = DEFAULT_TTS_RATE;
mAudFormat = DEFAULT_TTS_FORMAT;
mNbChannels = DEFAULT_TTS_NB_CHANNELS;
@@ -97,34 +103,33 @@
}
}
- void createAudioOut(uint32_t rate, AudioSystem::audio_format format,
- int channel) {
+ void createAudioOut(AudioSystem::stream_type streamType, uint32_t rate,
+ AudioSystem::audio_format format, int channel) {
mSampleRate = rate;
mAudFormat = format;
mNbChannels = channel;
- // TODO use the TTS stream type
- int streamType = AudioSystem::MUSIC;
+ mStreamType = streamType;
// retrieve system properties to ensure successful creation of the
// AudioTrack object for playback
int afSampleRate;
- if (AudioSystem::getOutputSamplingRate(&afSampleRate, streamType) != NO_ERROR) {
+ if (AudioSystem::getOutputSamplingRate(&afSampleRate, mStreamType) != NO_ERROR) {
afSampleRate = 44100;
}
int afFrameCount;
- if (AudioSystem::getOutputFrameCount(&afFrameCount, streamType) != NO_ERROR) {
+ if (AudioSystem::getOutputFrameCount(&afFrameCount, mStreamType) != NO_ERROR) {
afFrameCount = 2048;
}
uint32_t afLatency;
- if (AudioSystem::getOutputLatency(&afLatency, streamType) != NO_ERROR) {
+ if (AudioSystem::getOutputLatency(&afLatency, mStreamType) != NO_ERROR) {
afLatency = 500;
}
uint32_t minBufCount = afLatency / ((1000 * afFrameCount)/afSampleRate);
if (minBufCount < 2) minBufCount = 2;
int minFrameCount = (afFrameCount * rate * minBufCount)/afSampleRate;
- mAudioOut = new AudioTrack(streamType, rate, format, channel,
+ mAudioOut = new AudioTrack(mStreamType, rate, format, channel,
minFrameCount > 4096 ? minFrameCount : 4096,
0, 0, 0, 0); // not using an AudioTrack callback
@@ -142,21 +147,21 @@
// ----------------------------------------------------------------------------
-void prepAudioTrack(SynthProxyJniStorage* pJniData,
- uint32_t rate, AudioSystem::audio_format format, int channel)
-{
+void prepAudioTrack(SynthProxyJniStorage* pJniData, AudioSystem::stream_type streamType,
+ uint32_t rate, AudioSystem::audio_format format, int channel) {
// Don't bother creating a new audiotrack object if the current
- // object is already set.
+ // object is already initialized with the same audio parameters.
if ( pJniData->mAudioOut &&
(rate == pJniData->mSampleRate) &&
(format == pJniData->mAudFormat) &&
- (channel == pJniData->mNbChannels) ){
+ (channel == pJniData->mNbChannels) &&
+ (streamType == pJniData->mStreamType) ){
return;
}
if (pJniData->mAudioOut){
pJniData->killAudio();
}
- pJniData->createAudioOut(rate, format, channel);
+ pJniData->createAudioOut(streamType, rate, format, channel);
}
@@ -186,7 +191,7 @@
}
if (bufferSize > 0) {
- prepAudioTrack(pJniData, rate, format, channel);
+ prepAudioTrack(pJniData, pForAfter->streamType, rate, format, channel);
if (pJniData->mAudioOut) {
pJniData->mAudioOut->write(wav, bufferSize);
//LOGV("AudioTrack wrote: %d bytes", bufferSize);
@@ -241,7 +246,7 @@
SynthProxyJniStorage* pJniStorage = new SynthProxyJniStorage();
prepAudioTrack(pJniStorage,
- DEFAULT_TTS_RATE, DEFAULT_TTS_FORMAT, DEFAULT_TTS_NB_CHANNELS);
+ DEFAULT_TTS_STREAM_TYPE, DEFAULT_TTS_RATE, DEFAULT_TTS_FORMAT, DEFAULT_TTS_NB_CHANNELS);
const char *nativeSoLibNativeString =
env->GetStringUTFChars(nativeSoLib, 0);
@@ -526,7 +531,7 @@
static int
android_tts_SynthProxy_speak(JNIEnv *env, jobject thiz, jint jniData,
- jstring textJavaString)
+ jstring textJavaString, jint javaStreamType)
{
int result = TTS_FAILURE;
@@ -545,6 +550,7 @@
afterSynthData_t* pForAfter = new (afterSynthData_t);
pForAfter->jniStorage = jniData;
pForAfter->usageMode = USAGEMODE_PLAY_IMMEDIATELY;
+ pForAfter->streamType = (AudioSystem::stream_type) javaStreamType;
if (pSynthData->mNativeSynthInterface) {
const char *textNativeString = env->GetStringUTFChars(textJavaString, 0);
@@ -672,7 +678,7 @@
(void*)android_tts_SynthProxy_stop
},
{ "native_speak",
- "(ILjava/lang/String;)I",
+ "(ILjava/lang/String;I)I",
(void*)android_tts_SynthProxy_speak
},
{ "native_synthesizeToFile",
diff --git a/packages/TtsService/src/android/tts/SynthProxy.java b/packages/TtsService/src/android/tts/SynthProxy.java
index bb16b14..41ff92a 100755
--- a/packages/TtsService/src/android/tts/SynthProxy.java
+++ b/packages/TtsService/src/android/tts/SynthProxy.java
@@ -15,6 +15,8 @@
*/
package android.tts;
+import android.media.AudioManager;
+import android.media.AudioSystem;
import android.util.Log;
import java.lang.ref.WeakReference;
@@ -52,8 +54,13 @@
/**
* Synthesize speech and speak it directly using AudioTrack.
*/
- public int speak(String text) {
- return native_speak(mJniData, text);
+ public int speak(String text, int streamType) {
+ if ((streamType > -1) && (streamType < AudioSystem.getNumStreamTypes())) {
+ return native_speak(mJniData, text, streamType);
+ } else {
+ Log.e("SynthProxy", "Trying to speak with invalid stream type " + streamType);
+ return native_speak(mJniData, text, AudioManager.STREAM_MUSIC);
+ }
}
/**
@@ -156,7 +163,7 @@
private native final int native_stop(int jniData);
- private native final int native_speak(int jniData, String text);
+ private native final int native_speak(int jniData, String text, int streamType);
private native final int native_synthesizeToFile(int jniData, String text, String filename);
diff --git a/packages/TtsService/src/android/tts/TtsService.java b/packages/TtsService/src/android/tts/TtsService.java
index 60c30b2..949dfae 100755
--- a/packages/TtsService/src/android/tts/TtsService.java
+++ b/packages/TtsService/src/android/tts/TtsService.java
@@ -22,6 +22,7 @@
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
+import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnCompletionListener;
import android.net.Uri;
@@ -109,6 +110,8 @@
private static final int MAX_SPEECH_ITEM_CHAR_LENGTH = 4000;
private static final int MAX_FILENAME_LENGTH = 250;
+ // TODO use the TTS stream type when available
+ private static final int DEFAULT_STREAM_TYPE = AudioManager.STREAM_MUSIC;
private static final String ACTION = "android.intent.action.START_TTS_SERVICE";
private static final String CATEGORY = "android.intent.category.TTS";
@@ -450,14 +453,15 @@
synth.start();
return;
}
+ int streamType = DEFAULT_STREAM_TYPE;
if (params != null){
String language = "";
String country = "";
String variant = "";
for (int i = 0; i < params.size() - 1; i = i + 2){
String param = params.get(i);
- if (param != null){
- if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_RATE)){
+ if (param != null) {
+ if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_RATE)) {
setSpeechRate("", Integer.parseInt(params.get(i+1)));
} else if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_LANGUAGE)){
language = params.get(i+1);
@@ -465,6 +469,12 @@
country = params.get(i+1);
} else if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_VARIANT)){
variant = params.get(i+1);
+ } else if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_STREAM)) {
+ try {
+ streamType = Integer.parseInt(params.get(i + 1));
+ } catch (NumberFormatException e) {
+ streamType = DEFAULT_STREAM_TYPE;
+ }
}
}
}
@@ -472,7 +482,7 @@
setLanguage("", language, country, variant);
}
}
- nativeSynth.speak(text);
+ nativeSynth.speak(text, streamType);
} catch (InterruptedException e) {
Log.e("TTS speakInternalOnly", "tryLock interrupted");
e.printStackTrace();
@@ -651,8 +661,7 @@
// Utterance is part of the app calling the library
Context ctx;
try {
- ctx = this.createPackageContext(sr.mSourcePackageName,
- 0);
+ ctx = this.createPackageContext(sr.mSourcePackageName, 0);
} catch (NameNotFoundException e) {
e.printStackTrace();
mSpeechQueue.remove(0); // Remove it from the queue and
@@ -675,6 +684,7 @@
}
mPlayer.setOnCompletionListener(this);
try {
+ mPlayer.setAudioStreamType(getStreamTypeFromParams(currentSpeechItem.mParams));
mPlayer.start();
} catch (IllegalStateException e) {
mSpeechQueue.clear();
@@ -695,6 +705,24 @@
}
}
+ private int getStreamTypeFromParams(ArrayList<String> paramList) {
+ int streamType = DEFAULT_STREAM_TYPE;
+ if (paramList == null) {
+ return streamType;
+ }
+ for (int i = 0; i < paramList.size() - 1; i = i + 2) {
+ String param = paramList.get(i);
+ if ((param != null) && (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_STREAM))) {
+ try {
+ streamType = Integer.parseInt(paramList.get(i + 1));
+ } catch (NumberFormatException e) {
+ streamType = DEFAULT_STREAM_TYPE;
+ }
+ }
+ }
+ return streamType;
+ }
+
private void cleanUpPlayer() {
if (mPlayer != null) {
mPlayer.release();
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java
index 6e28515..69371b3 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/BackupManagerService.java
@@ -1490,7 +1490,9 @@
try {
synchronized(this) {
- if (mRestoreSets == null) {
+ if (mRestoreTransport == null) {
+ Log.w(TAG, "Null transport getting restore sets");
+ } else if (mRestoreSets == null) { // valid transport; do the one-time fetch
mRestoreSets = mRestoreTransport.getAvailableRestoreSets();
}
return mRestoreSets;
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index c9dcd8b..ba5c6e7 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -322,7 +322,9 @@
/**
* Returns the alphabetic name of current registered operator.
* <p>
- * Availability: Only when user is registered to a network
+ * Availability: Only when user is registered to a network. Result may be
+ * unreliable on CDMA networks (use {@link #getPhoneType()} to determine if
+ * on a CDMA network).
*/
public String getNetworkOperatorName() {
return SystemProperties.get(TelephonyProperties.PROPERTY_OPERATOR_ALPHA);
@@ -331,7 +333,9 @@
/**
* Returns the numeric name (MCC+MNC) of current registered operator.
* <p>
- * Availability: Only when user is registered to a network
+ * Availability: Only when user is registered to a network. Result may be
+ * unreliable on CDMA networks (use {@link #getPhoneType()} to determine if
+ * on a CDMA network).
*/
public String getNetworkOperator() {
return SystemProperties.get(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC);
@@ -341,7 +345,7 @@
* Returns true if the device is considered roaming on the current
* network, for GSM purposes.
* <p>
- * Availability: Only when user registered to a network
+ * Availability: Only when user registered to a network.
*/
public boolean isNetworkRoaming() {
return "true".equals(SystemProperties.get(TelephonyProperties.PROPERTY_OPERATOR_ISROAMING));
@@ -351,7 +355,9 @@
* Returns the ISO country code equivilent of the current registered
* operator's MCC (Mobile Country Code).
* <p>
- * Availability: Only when user is registered to a network
+ * Availability: Only when user is registered to a network. Result may be
+ * unreliable on CDMA networks (use {@link #getPhoneType()} to determine if
+ * on a CDMA network).
*/
public String getNetworkCountryIso() {
return SystemProperties.get(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY);
diff --git a/telephony/java/com/android/internal/telephony/TelephonyProperties.java b/telephony/java/com/android/internal/telephony/TelephonyProperties.java
index 290e1fc..5ec4020 100644
--- a/telephony/java/com/android/internal/telephony/TelephonyProperties.java
+++ b/telephony/java/com/android/internal/telephony/TelephonyProperties.java
@@ -40,14 +40,16 @@
//****** Current Network
- /** Alpha name of current registered operator.
- * Availability: when registered to a network
+ /** Alpha name of current registered operator.<p>
+ * Availability: when registered to a network. Result may be unreliable on
+ * CDMA networks.
*/
static final String PROPERTY_OPERATOR_ALPHA = "gsm.operator.alpha";
//TODO: most of these proprieties are generic, substitute gsm. with phone. bug 1856959
- /** Numeric name (MCC+MNC) of current registered operator.
- * Availability: when registered to a network
+ /** Numeric name (MCC+MNC) of current registered operator.<p>
+ * Availability: when registered to a network. Result may be unreliable on
+ * CDMA networks.
*/
static final String PROPERTY_OPERATOR_NUMERIC = "gsm.operator.numeric";
@@ -64,8 +66,9 @@
static final String PROPERTY_OPERATOR_ISROAMING = "gsm.operator.isroaming";
/** The ISO country code equivalent of the current registered operator's
- * MCC (Mobile Country Code)
- * Availability: when registered to a network
+ * MCC (Mobile Country Code)<p>
+ * Availability: when registered to a network. Result may be unreliable on
+ * CDMA networks.
*/
static final String PROPERTY_OPERATOR_ISO_COUNTRY = "gsm.operator.iso-country";
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
index 07044b2..92492b4e 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
@@ -296,6 +296,10 @@
EVENT_RUIM_RECORDS_LOADED, null);
mNeedToRegForRuimLoaded = false;
}
+
+ cm.getCDMASubscription(obtainMessage(EVENT_POLL_STATE_CDMA_SUBSCRIPTION));
+ if (DBG) log("Receive EVENT_RUIM_READY and Send Request getCDMASubscription.");
+
// restore the previous network selection.
pollState();
diff --git a/tools/aapt/Package.cpp b/tools/aapt/Package.cpp
index 8424169..999a5cf 100644
--- a/tools/aapt/Package.cpp
+++ b/tools/aapt/Package.cpp
@@ -168,7 +168,7 @@
delete zip; // close the file so we can remove it in Win32
zip = NULL;
if (unlink(outputFile.string()) != 0) {
- fprintf(stderr, "WARNING: could not unlink '%s'\n", outputFile.string());
+ fprintf(stderr, "warning: could not unlink '%s'\n", outputFile.string());
}
}
@@ -181,7 +181,7 @@
printf("Removing %s due to earlier failures\n", outputFile.string());
}
if (unlink(outputFile.string()) != 0) {
- fprintf(stderr, "WARNING: could not unlink '%s'\n", outputFile.string());
+ fprintf(stderr, "warning: could not unlink '%s'\n", outputFile.string());
}
}
@@ -283,7 +283,7 @@
if (fileNameLen > excludeExtensionLen
&& (0 == strcmp(storageName.string() + (fileNameLen - excludeExtensionLen),
kExcludeExtension))) {
- fprintf(stderr, "WARNING: '%s' not added to Zip\n", storageName.string());
+ fprintf(stderr, "warning: '%s' not added to Zip\n", storageName.string());
return true;
}
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
index 81db323..41ee88b 100644
--- a/tools/aapt/Resource.cpp
+++ b/tools/aapt/Resource.cpp
@@ -174,7 +174,7 @@
static status_t parsePackage(const sp<AaptAssets>& assets, const sp<AaptGroup>& grp)
{
if (grp->getFiles().size() != 1) {
- fprintf(stderr, "WARNING: Multiple AndroidManifest.xml files found, using %s\n",
+ fprintf(stderr, "warning: Multiple AndroidManifest.xml files found, using %s\n",
grp->getFiles().valueAt(0)->getPrintableSource().string());
}
@@ -419,7 +419,7 @@
if (code == ResXMLTree::START_TAG) {
ssize_t index = parser.indexOfAttribute(NULL, "id");
if (index >= 0) {
- fprintf(stderr, "%s:%d: WARNING: found plain 'id' attribute; did you mean the new 'android:id' name?\n",
+ fprintf(stderr, "%s:%d: warning: found plain 'id' attribute; did you mean the new 'android:id' name?\n",
path.string(), parser.getLineNumber());
}
}
diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp
index b004664..8dbc12e 100644
--- a/tools/aapt/ResourceTable.cpp
+++ b/tools/aapt/ResourceTable.cpp
@@ -3554,26 +3554,26 @@
}
if (p == NULL) {
- fprintf(stderr, "WARNING: Package not found for resource #%08x\n", resID);
+ fprintf(stderr, "warning: Package not found for resource #%08x\n", resID);
return NULL;
}
int tid = Res_GETTYPE(resID);
if (tid < 0 || tid >= (int)p->getOrderedTypes().size()) {
- fprintf(stderr, "WARNING: Type not found for resource #%08x\n", resID);
+ fprintf(stderr, "warning: Type not found for resource #%08x\n", resID);
return NULL;
}
sp<Type> t = p->getOrderedTypes()[tid];
int eid = Res_GETENTRY(resID);
if (eid < 0 || eid >= (int)t->getOrderedConfigs().size()) {
- fprintf(stderr, "WARNING: Entry not found for resource #%08x\n", resID);
+ fprintf(stderr, "warning: Entry not found for resource #%08x\n", resID);
return NULL;
}
sp<ConfigList> c = t->getOrderedConfigs()[eid];
if (c == NULL) {
- fprintf(stderr, "WARNING: Entry not found for resource #%08x\n", resID);
+ fprintf(stderr, "warning: Entry not found for resource #%08x\n", resID);
return NULL;
}
@@ -3581,7 +3581,7 @@
if (config) cdesc = *config;
sp<Entry> e = c->getEntries().valueFor(cdesc);
if (c == NULL) {
- fprintf(stderr, "WARNING: Entry configuration not found for resource #%08x\n", resID);
+ fprintf(stderr, "warning: Entry configuration not found for resource #%08x\n", resID);
return NULL;
}
@@ -3599,7 +3599,7 @@
for (size_t i=0; i<N; i++) {
const Item& it = e->getBag().valueAt(i);
if (it.bagKeyId == 0) {
- fprintf(stderr, "WARNING: ID not yet assigned to '%s' in bag '%s'\n",
+ fprintf(stderr, "warning: ID not yet assigned to '%s' in bag '%s'\n",
String8(e->getName()).string(),
String8(e->getBag().keyAt(i)).string());
}
@@ -3627,7 +3627,7 @@
break;
}
}
- fprintf(stderr, "WARNING: Circular reference detected in key '%s' of bag '%s'\n",
+ fprintf(stderr, "warning: Circular reference detected in key '%s' of bag '%s'\n",
String8(e->getName()).string(),
String8(e->getBag().keyAt(i)).string());
return false;
diff --git a/tools/aapt/SourcePos.cpp b/tools/aapt/SourcePos.cpp
index 2761d18..e2a921c 100644
--- a/tools/aapt/SourcePos.cpp
+++ b/tools/aapt/SourcePos.cpp
@@ -86,7 +86,7 @@
void
ErrorPos::print(FILE* to) const
{
- const char* type = fatal ? "ERROR" : "WARNING";
+ const char* type = fatal ? "error:" : "warning:";
if (this->line >= 0) {
fprintf(to, "%s:%d: %s %s\n", this->file.string(), this->line, type, this->error.string());
diff --git a/tools/aapt/XMLNode.cpp b/tools/aapt/XMLNode.cpp
index 832ba6c..6daa0d2 100644
--- a/tools/aapt/XMLNode.cpp
+++ b/tools/aapt/XMLNode.cpp
@@ -220,7 +220,7 @@
spanStack.pop();
if (empty) {
- fprintf(stderr, "%s:%d: WARNING: empty '%s' span found in text '%s'\n",
+ fprintf(stderr, "%s:%d: warning: empty '%s' span found in text '%s'\n",
fileName, inXml->getLineNumber(),
String8(spanTag).string(), String8(*outString).string());
diff --git a/tools/aapt/ZipEntry.cpp b/tools/aapt/ZipEntry.cpp
index bed0333..a0b54c2 100644
--- a/tools/aapt/ZipEntry.cpp
+++ b/tools/aapt/ZipEntry.cpp
@@ -90,7 +90,7 @@
* prefer the CDE values.)
*/
if (!hasDD && !compareHeaders()) {
- LOGW("WARNING: header mismatch\n");
+ LOGW("warning: header mismatch\n");
// keep going?
}