diff options
author | Barnaby James <bjames@google.com> | 2014-08-08 21:01:01 -0700 |
---|---|---|
committer | Barnaby James <bjames@google.com> | 2014-08-08 21:01:01 -0700 |
commit | 092c62f1f3811f205c764fcb5b8347ec8fed67e6 (patch) | |
tree | b7806c9717c2b034e4420a0de8e04f5c038b22cd /src/com/android/settings/AirplaneModeVoiceActivity.java | |
parent | f8811a59ffd4fa39997154681d753d3370697b83 (diff) | |
download | packages_apps_Settings-092c62f1f3811f205c764fcb5b8347ec8fed67e6.zip packages_apps_Settings-092c62f1f3811f205c764fcb5b8347ec8fed67e6.tar.gz packages_apps_Settings-092c62f1f3811f205c764fcb5b8347ec8fed67e6.tar.bz2 |
Add voice-only settings activities for airplane mode.
This activity can only be triggered through the Voice Interaction API - e.g. from calling VoiceInterationSession.startVoiceActivity()
Change-Id: I39ac409824693bc82e53d707a1ece2b23a89f3a3
Diffstat (limited to 'src/com/android/settings/AirplaneModeVoiceActivity.java')
-rw-r--r-- | src/com/android/settings/AirplaneModeVoiceActivity.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/com/android/settings/AirplaneModeVoiceActivity.java b/src/com/android/settings/AirplaneModeVoiceActivity.java new file mode 100644 index 0000000..3ab0c37 --- /dev/null +++ b/src/com/android/settings/AirplaneModeVoiceActivity.java @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settings; + +import android.content.Intent; +import android.provider.Settings; +import android.util.Log; + +/** + * Activity for modifying the {@link Settings.Global#AIRPLANE_MODE_ON AIRPLANE_MODE_ON} + * setting using the Voice Interaction API. + */ +public class AirplaneModeVoiceActivity extends VoiceSettingsActivity { + private static final String TAG = "AirplaneModeVoiceActivity"; + + protected void onVoiceSettingInteraction(Intent intent) { + if (intent.hasExtra(Settings.EXTRA_AIRPLANE_MODE_ENABLED)) { + boolean enabled = + intent.getBooleanExtra(Settings.EXTRA_AIRPLANE_MODE_ENABLED, false); + Settings.Global.putInt(getContentResolver(), + Settings.Global.AIRPLANE_MODE_ON, enabled ? 1 : 0); + } else { + Log.v(TAG, "Missing airplane mode extra"); + } + } +} |