Fix bug 2078454 where clicking on Settings in the Home menu would
take the user to Market after clicking on "Install Voice Data" in the TTS Settings page. Launching the Activity for the installation of the TTS data should be a distinct task, dissociated from the one associated with the Settings app. Also the intent ACTION_INSTALL_TTS_DATA doesn't return a result, so the activity should be started with startActivity() rather than startActivityForResult().
This commit is contained in:
@@ -90,11 +90,6 @@ public class TextToSpeechSettings extends PreferenceActivity implements
|
|||||||
* startActivityForResult.
|
* startActivityForResult.
|
||||||
*/
|
*/
|
||||||
private static final int VOICE_DATA_INTEGRITY_CHECK = 1977;
|
private static final int VOICE_DATA_INTEGRITY_CHECK = 1977;
|
||||||
/**
|
|
||||||
* Request code (arbitrary value) for voice data installation through
|
|
||||||
* startActivityForResult.
|
|
||||||
*/
|
|
||||||
private static final int VOICE_DATA_INSTALLATION = 1980;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -218,13 +213,14 @@ public class TextToSpeechSettings extends PreferenceActivity implements
|
|||||||
PackageManager pm = getPackageManager();
|
PackageManager pm = getPackageManager();
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
|
intent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
List<ResolveInfo> resolveInfos = pm.queryIntentActivities(intent, 0);
|
List<ResolveInfo> resolveInfos = pm.queryIntentActivities(intent, 0);
|
||||||
// query only the package that matches that of the default engine
|
// query only the package that matches that of the default engine
|
||||||
for (int i = 0; i < resolveInfos.size(); i++) {
|
for (int i = 0; i < resolveInfos.size(); i++) {
|
||||||
ActivityInfo currentActivityInfo = resolveInfos.get(i).activityInfo;
|
ActivityInfo currentActivityInfo = resolveInfos.get(i).activityInfo;
|
||||||
if (mDefaultEng.equals(currentActivityInfo.packageName)) {
|
if (mDefaultEng.equals(currentActivityInfo.packageName)) {
|
||||||
intent.setClassName(mDefaultEng, currentActivityInfo.name);
|
intent.setClassName(mDefaultEng, currentActivityInfo.name);
|
||||||
this.startActivityForResult(intent, VOICE_DATA_INSTALLATION);
|
this.startActivity(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user