Merge "Make Settings shortcuts launch into the correct activity/fragment." into jb-mr1-dev
diff --git a/res/layout/installed_app_details.xml b/res/layout/installed_app_details.xml
index df4f718..3b8bf5f 100644
--- a/res/layout/installed_app_details.xml
+++ b/res/layout/installed_app_details.xml
@@ -395,6 +395,7 @@
android:text="@string/permissions_label" />
<TextView android:id="@+id/security_settings_billing_desc"
android:text="@string/security_settings_billing_desc"
+ android:textColor="#ffffb060"
android:textAppearance="?android:attr/textAppearanceSmall"
android:paddingTop="6dip"
android:paddingStart="6dip"
diff --git a/res/layout/setup_preference.xml b/res/layout/setup_preference.xml
index 30b3373..c2f6989 100644
--- a/res/layout/setup_preference.xml
+++ b/res/layout/setup_preference.xml
@@ -30,7 +30,7 @@
android:gravity="bottom">
<LinearLayout
- android:id="@+id/button_bar"
+ android:id="@+id/title_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/title"
@@ -62,7 +62,7 @@
<View
android:id="@+id/top_divider"
style="@style/TopDivider"
- android:layout_below="@id/button_bar" />
+ android:layout_below="@id/title_bar" />
</RelativeLayout>
@@ -148,6 +148,14 @@
android:layout_margin="5dip"
android:text="@string/wifi_setup_back" />
+ <Button
+ android:id="@+id/custom_button"
+ android:layout_width="150dip"
+ android:layout_height="wrap_content"
+ android:layout_alignParentEnd="true"
+ android:layout_margin="5dip"
+ android:text="@string/wifi_setup_skip" />
+
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -167,8 +175,9 @@
android:layout_width="150dip"
android:layout_height="wrap_content"
android:layout_margin="5dip"
- android:text="@string/wifi_setup_next" />
- </LinearLayout>
+ android:text="@string/wifi_setup_next"
+ android:visibility="gone" />
+ </LinearLayout>
</RelativeLayout>
</LinearLayout>
</view>
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 106d507..1802ac6 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1443,6 +1443,23 @@
<string name="wifi_failed_save_message">Failed to save network</string>
<!-- Button label to dismiss the dialog -->
<string name="wifi_cancel">Cancel</string>
+ <!-- Button for skipping a step after having been warned of a potential concern [CHAR LIMIT=30] -->
+ <string name="wifi_skip_anyway" msgid="5205612884736051138">Skip anyway</string>
+ <!-- Button for going to the previous screen or step [CHAR LIMIT=20] -->
+ <string name="wifi_dont_skip">Don\'t skip</string>
+
+ <!-- Text warning about skipping Wi-Fi with a mobile connect (tablet) [CHAR LIMIT=NONE]-->
+ <string name="wifi_skipped_message" product="tablet" msgid="6518433975501257341">WARNING: You may incur extra carrier data charges.\n\nTablet setup can require significant network activity.</string>
+ <!-- Text warning about skipping Wi-Fi with a mobile connect (phone) [CHAR LIMIT=NONE]-->
+ <string name="wifi_skipped_message" product="default" msgid="4376150150678208848">WARNING: You may incur extra carrier data charges.\n\nPhone setup can require significant network activity.</string>
+ <!-- Text warning about skipping Wi-Fi without a mobile connect (tablet) [CHAR LIMIT=NONE] -->
+ <string name="wifi_and_mobile_skipped_message" product="tablet" msgid="5647058314212144925">WARNING: The tablet won\'t be able to verify that your software is up to date.</string>
+ <!-- Text warning about skipping Wi-Fi without a mobile connect (phone) [CHAR LIMIT=NONE] -->
+ <string name="wifi_and_mobile_skipped_message" product="default" msgid="1288483646141987070">WARNING: The phone won\'t be able to verify that your software is up to date.</string>
+ <!-- Text alerting that Wi-Fi couldn't connect (tablet) [CHAR LIMIT=NONE] -->
+ <string name="wifi_connect_failed_message" product="tablet" msgid="2006689630582761529">The tablet was unable to connect to this Wi-Fi network.</string>
+ <!-- Text alerting that Wi-Fi couldn't connect (phone) [CHAR LIMIT=NONE] -->
+ <string name="wifi_connect_failed_message" product="default" msgid="8220901976514642385">The phone was unable to connect to this Wi-Fi network.</string>
<!-- Wi-Fi Advanced Settings --> <skip />
<!-- Wi-Fi settings screen, advanced, settings section. This is a header shown above advanced wifi settings. -->
@@ -1490,7 +1507,6 @@
<!-- Hint text for network prefix length -->
<string name="wifi_network_prefix_length_hint" translatable="false">24</string>
-
<!-- Wi-Fi p2p / Wi-Fi Direct settings -->
<!-- Used in the 1st-level settings screen to launch Wi-fi Direct settings [CHAR LIMIT=25] -->
<string name="wifi_p2p_settings_title">Wi-Fi Direct</string>
@@ -3076,7 +3092,7 @@
<string name="accessibility_system_title">System</string>
<!-- Title for the accessibility preference screen to enable screen magnification. [CHAR LIMIT=35] -->
<string name="accessibility_screen_magnification_title">Screen magnification</string>
- <!-- Summary for the accessibility preference screen to enable screen magnification. [CHAR LIMIT=35] -->
+ <!-- Summary for the accessibility preference screen to enable screen magnification. [CHAR LIMIT=none] -->
<string name="accessibility_screen_magnification_summary">
When screen magnification is on, you can\:\n\n
@@ -3089,6 +3105,12 @@
Pan: Drag two or more fingers across the screen.\n
Adjust zoom level: Pinch or expand using two or more fingers.
</string>
+ <!-- Title for the accessibility preference screen to enable the global geture to enable accessibility. [CHAR LIMIT=35] -->
+ <string name="accessibility_global_gesture_preference_title">Global enable gesture</string>
+ <!-- Summary for the accessibility preference screen to enable the global geture to enable accessibility. [CHAR LIMIT=none] -->
+ <string name="accessibility_global_gesture_preference_summary">
+ To enable accessibility long press the power button, after a vibration or a beep long press with two fingers.
+ </string>
<!-- Title for the accessibility preference to enable large text. [CHAR LIMIT=35] -->
<string name="accessibility_toggle_large_text_preference_title">Large text</string>
<!-- Title for the accessibility preference to enable screen magnification. [CHAR LIMIT=35] -->
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index e86dff6..15b5b2e 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -52,6 +52,11 @@
android:title="@string/accessibility_toggle_speak_password_preference_title"
android:persistent="false"/>
+ <PreferenceScreen
+ android:fragment="com.android.settings.AccessibilitySettings$ToggleGlobalGesturePreferenceFragment"
+ android:key="enable_global_gesture_preference_screen"
+ android:title="@string/accessibility_global_gesture_preference_title"/>
+
<PreferenceScreen android:key="tts_settings_preference"
android:fragment="com.android.settings.tts.TextToSpeechSettings"
android:title="@string/tts_settings_title"/>
diff --git a/src/com/android/settings/AccessibilitySettings.java b/src/com/android/settings/AccessibilitySettings.java
index 592706c..1edff17 100644
--- a/src/com/android/settings/AccessibilitySettings.java
+++ b/src/com/android/settings/AccessibilitySettings.java
@@ -108,6 +108,8 @@
"select_long_press_timeout_preference";
private static final String TOGGLE_SCRIPT_INJECTION_PREFERENCE =
"toggle_script_injection_preference";
+ private static final String ENABLE_ACCESSIBILITY_GESTURE_PREFERENCE_SCREEN =
+ "enable_global_gesture_preference_screen";
private static final String DISPLAY_MAGNIFICATION_PREFERENCE_SCREEN =
"screen_magnification_preference_screen";
@@ -168,6 +170,7 @@
private AccessibilityEnableScriptInjectionPreference mToggleScriptInjectionPreference;
private Preference mNoServicesMessagePreference;
private PreferenceScreen mDisplayMagnificationPreferenceScreen;
+ private PreferenceScreen mGlobalGesturePreferenceScreen;
private int mLongPressTimeoutDefault;
@@ -210,12 +213,6 @@
}
return false;
}
-
-
-
-
-
-
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
@@ -231,6 +228,9 @@
} else if (mToggleSpeakPasswordPreference == preference) {
handleToggleSpeakPasswordPreferenceClick();
return true;
+ } else if (mGlobalGesturePreferenceScreen == preference) {
+ handleTogglEnableAccessibilityGesturePreferenceClick();
+ return true;
} else if (mDisplayMagnificationPreferenceScreen == preference) {
handleDisplayMagnificationPreferenceScreenClick();
return true;
@@ -266,6 +266,18 @@
mToggleSpeakPasswordPreference.isChecked() ? 1 : 0);
}
+ private void handleTogglEnableAccessibilityGesturePreferenceClick() {
+ Bundle extras = mGlobalGesturePreferenceScreen.getExtras();
+ extras.putString(EXTRA_TITLE, getString(
+ R.string.accessibility_global_gesture_preference_title));
+ extras.putString(EXTRA_SUMMARY, getString(
+ R.string.accessibility_global_gesture_preference_summary));
+ extras.putBoolean(EXTRA_CHECKED, Settings.Global.getInt(getContentResolver(),
+ Settings.Global.ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED, 0) == 1);
+ super.onPreferenceTreeClick(mGlobalGesturePreferenceScreen,
+ mGlobalGesturePreferenceScreen);
+ }
+
private void handleDisplayMagnificationPreferenceScreenClick() {
Bundle extras = mDisplayMagnificationPreferenceScreen.getExtras();
extras.putString(EXTRA_TITLE, getString(
@@ -325,6 +337,10 @@
// Display magnification.
mDisplayMagnificationPreferenceScreen = (PreferenceScreen) findPreference(
DISPLAY_MAGNIFICATION_PREFERENCE_SCREEN);
+
+ // Global gesture.
+ mGlobalGesturePreferenceScreen =
+ (PreferenceScreen) findPreference(ENABLE_ACCESSIBILITY_GESTURE_PREFERENCE_SCREEN);
}
private void updateAllPreferences() {
@@ -487,6 +503,17 @@
mDisplayMagnificationPreferenceScreen.setSummary(
R.string.accessibility_feature_state_off);
}
+
+ // Global gesture
+ final boolean globalGestureEnabled = Settings.Global.getInt(getContentResolver(),
+ Settings.Global.ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED, 0) == 1;
+ if (globalGestureEnabled) {
+ mGlobalGesturePreferenceScreen.setSummary(
+ R.string.accessibility_feature_state_on);
+ } else {
+ mGlobalGesturePreferenceScreen.setSummary(
+ R.string.accessibility_feature_state_off);
+ }
}
private void updateLockScreenRotationCheckbox() {
@@ -844,6 +871,29 @@
}
}
+ public static class ToggleGlobalGesturePreferenceFragment
+ extends ToggleFeaturePreferenceFragment {
+ @Override
+ protected void onPreferenceToggled(String preferenceKey, boolean enabled) {
+ Settings.Global.putInt(getContentResolver(),
+ Settings.Global.ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED, enabled ? 1 : 0);
+ }
+
+ @Override
+ protected void onInstallActionBarToggleSwitch() {
+ super.onInstallActionBarToggleSwitch();
+ mToggleSwitch.setOnBeforeCheckedChangeListener(new OnBeforeCheckedChangeListener() {
+ @Override
+ public boolean onBeforeCheckedChanged(ToggleSwitch toggleSwitch, boolean checked) {
+ toggleSwitch.setCheckedInternal(checked);
+ getArguments().putBoolean(EXTRA_CHECKED, checked);
+ onPreferenceToggled(mPreferenceKey, checked);
+ return false;
+ }
+ });
+ }
+ }
+
public static abstract class ToggleFeaturePreferenceFragment
extends SettingsPreferenceFragment {
diff --git a/src/com/android/settings/DreamBackend.java b/src/com/android/settings/DreamBackend.java
index 8b3e941..7effe4b 100644
--- a/src/com/android/settings/DreamBackend.java
+++ b/src/com/android/settings/DreamBackend.java
@@ -33,7 +33,7 @@
import android.os.RemoteException;
import android.os.ServiceManager;
import android.provider.Settings;
-import android.service.dreams.Dream;
+import android.service.dreams.DreamService;
import android.service.dreams.IDreamManager;
import android.util.AttributeSet;
import android.util.Log;
@@ -78,7 +78,7 @@
public DreamBackend(Context context) {
mContext = context;
mDreamManager = IDreamManager.Stub.asInterface(
- ServiceManager.getService(Dream.DREAM_SERVICE));
+ ServiceManager.getService(DreamService.DREAM_SERVICE));
mComparator = new DreamInfoComparator(getDefaultDream());
}
@@ -86,8 +86,7 @@
logd("getDreamInfos()");
ComponentName activeDream = getActiveDream();
PackageManager pm = mContext.getPackageManager();
- Intent dreamIntent = new Intent(Intent.ACTION_MAIN)
- .addCategory(Dream.CATEGORY_DREAM);
+ Intent dreamIntent = new Intent(DreamService.SERVICE_INTERFACE);
List<ResolveInfo> resolveInfos = pm.queryIntentServices(dreamIntent,
PackageManager.GET_META_DATA);
List<DreamInfo> dreamInfos = new ArrayList<DreamInfo>(resolveInfos.size());
@@ -220,9 +219,9 @@
XmlResourceParser parser = null;
Exception caughtException = null;
try {
- parser = resolveInfo.serviceInfo.loadXmlMetaData(pm, Dream.DREAM_META_DATA);
+ parser = resolveInfo.serviceInfo.loadXmlMetaData(pm, DreamService.DREAM_META_DATA);
if (parser == null) {
- Log.w(TAG, "No " + Dream.DREAM_META_DATA + " meta-data");
+ Log.w(TAG, "No " + DreamService.DREAM_META_DATA + " meta-data");
return null;
}
Resources res = pm.getResourcesForApplication(resolveInfo.serviceInfo.applicationInfo);
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index 92e622d..61093e6 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -20,6 +20,8 @@
import android.app.ActionBar;
import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -45,6 +47,7 @@
import android.preference.PreferenceScreen;
import android.security.Credentials;
import android.security.KeyStore;
+import android.telephony.TelephonyManager;
import android.util.AttributeSet;
import android.util.Log;
import android.view.ContextMenu;
@@ -58,6 +61,7 @@
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.AdapterView.AdapterContextMenuInfo;
+import android.widget.Button;
import android.widget.ImageButton;
import android.widget.PopupMenu;
import android.widget.PopupMenu.OnMenuItemClickListener;
@@ -101,6 +105,8 @@
private static final int WIFI_DIALOG_ID = 1;
private static final int WPS_PBC_DIALOG_ID = 2;
private static final int WPS_PIN_DIALOG_ID = 3;
+ private static final int WIFI_SKIPPED_DIALOG_ID = 4;
+ private static final int WIFI_AND_MOBILE_SKIPPED_DIALOG_ID = 5;
// Combo scans can take 5-6s to complete - set to 10s.
private static final int WIFI_RESCAN_INTERVAL_MS = 10 * 1000;
@@ -143,6 +149,9 @@
// this boolean extra specifies whether to auto finish when connection is established
private static final String EXTRA_AUTO_FINISH_ON_CONNECT = "wifi_auto_finish_on_connect";
+ // this boolean extra shows a custom button that we can control
+ protected static final String EXTRA_SHOW_CUSTOM_BUTTON = "wifi_show_custom_button";
+
// this boolean extra is set if we are being invoked by the Setup Wizard
private static final String EXTRA_IS_FIRST_RUN = "firstRun";
@@ -228,6 +237,27 @@
}
});
}
+
+ if (getActivity().getIntent().getBooleanExtra(EXTRA_SHOW_CUSTOM_BUTTON, false)) {
+ view.findViewById(R.id.button_bar).setVisibility(View.VISIBLE);
+ view.findViewById(R.id.back_button).setVisibility(View.INVISIBLE);
+ view.findViewById(R.id.skip_button).setVisibility(View.INVISIBLE);
+ view.findViewById(R.id.next_button).setVisibility(View.INVISIBLE);
+
+ Button customButton = (Button) view.findViewById(R.id.custom_button);
+ customButton.setVisibility(View.VISIBLE);
+ customButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (isPhone() && !hasSimProblem()) {
+ showDialog(WIFI_SKIPPED_DIALOG_ID);
+ } else {
+ showDialog(WIFI_AND_MOBILE_SKIPPED_DIALOG_ID);
+ }
+ }
+ });
+ }
+
return view;
} else {
return super.onCreateView(inflater, container, savedInstanceState);
@@ -598,10 +628,69 @@
return new WpsDialog(getActivity(), WpsInfo.PBC);
case WPS_PIN_DIALOG_ID:
return new WpsDialog(getActivity(), WpsInfo.DISPLAY);
+ case WIFI_SKIPPED_DIALOG_ID:
+ return new AlertDialog.Builder(getActivity())
+ .setMessage(R.string.wifi_skipped_message)
+ .setCancelable(false)
+ .setNegativeButton(R.string.wifi_skip_anyway,
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int id) {
+ getActivity().setResult(Activity.RESULT_CANCELED);
+ getActivity().finish();
+ }
+ })
+ .setPositiveButton(R.string.wifi_dont_skip,
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int id) {
+ }
+ })
+ .create();
+ case WIFI_AND_MOBILE_SKIPPED_DIALOG_ID:
+ return new AlertDialog.Builder(getActivity())
+ .setMessage(R.string.wifi_and_mobile_skipped_message)
+ .setCancelable(false)
+ .setNegativeButton(R.string.wifi_skip_anyway,
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int id) {
+ getActivity().setResult(Activity.RESULT_CANCELED);
+ getActivity().finish();
+ }
+ })
+ .setPositiveButton(R.string.wifi_dont_skip,
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int id) {
+ }
+ })
+ .create();
+
}
return super.onCreateDialog(dialogId);
}
+ private boolean isPhone() {
+ final TelephonyManager telephonyManager = (TelephonyManager)this.getSystemService(
+ Context.TELEPHONY_SERVICE);
+ return telephonyManager != null
+ && telephonyManager.getPhoneType() != TelephonyManager.PHONE_TYPE_NONE;
+ }
+
+ /**
+ * Return true if there's any SIM related impediment to connectivity.
+ * Treats Unknown as OK. (Only returns true if we're sure of a SIM problem.)
+ */
+ protected boolean hasSimProblem() {
+ final TelephonyManager telephonyManager = (TelephonyManager)this.getSystemService(
+ Context.TELEPHONY_SERVICE);
+ return telephonyManager != null
+ && telephonyManager.getCurrentPhoneType() == TelephonyManager.PHONE_TYPE_GSM
+ && telephonyManager.getSimState() != TelephonyManager.SIM_STATE_READY
+ && telephonyManager.getSimState() != TelephonyManager.SIM_STATE_UNKNOWN;
+ }
+
private boolean requireKeyStore(WifiConfiguration config) {
if (WifiConfigController.requireKeyStore(config) &&
KeyStore.getInstance().state() != KeyStore.State.UNLOCKED) {