When Airplane mode is changed due to Voice Intent, use the system
provided ConnectionManager method to do that, instead of changing it directly using Settings.Global.putInt() - because that doesn't case ACTION_AIRPLANE_MODE_CHANGED intent to be broadcast. This breaks Google Search App (GSA) code that relies on the above broadcast to do a variety of things. Change-Id: I2aa61643ed23b373aa362a59af83427a4548c492
This commit is contained in:
@@ -16,7 +16,9 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.net.ConnectivityManager;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
@@ -31,9 +33,10 @@ public class AirplaneModeVoiceActivity extends VoiceSettingsActivity {
|
|||||||
|
|
||||||
protected boolean onVoiceSettingInteraction(Intent intent) {
|
protected boolean onVoiceSettingInteraction(Intent intent) {
|
||||||
if (intent.hasExtra(Settings.EXTRA_AIRPLANE_MODE_ENABLED)) {
|
if (intent.hasExtra(Settings.EXTRA_AIRPLANE_MODE_ENABLED)) {
|
||||||
Settings.Global.putInt(getContentResolver(),
|
ConnectivityManager mgr = (ConnectivityManager) getSystemService(
|
||||||
Settings.Global.AIRPLANE_MODE_ON,
|
Context.CONNECTIVITY_SERVICE);
|
||||||
intent.getBooleanExtra(Settings.EXTRA_AIRPLANE_MODE_ENABLED, false) ? 1 : 0);
|
mgr.setAirplaneMode(intent.getBooleanExtra(
|
||||||
|
Settings.EXTRA_AIRPLANE_MODE_ENABLED, false));
|
||||||
} else {
|
} else {
|
||||||
Log.v(TAG, "Missing airplane mode extra");
|
Log.v(TAG, "Missing airplane mode extra");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user