summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrandon Bennett <bennetb@gmail.com>2013-04-15 01:51:20 -0600
committerBrandon Bennett <bennetb@gmail.com>2013-04-15 11:01:04 -0600
commit3ed641a09cf53b598065a8c5168a9e2f5f278bf4 (patch)
treefda56c1b4285c75c84c62be4b7e23be2d84f32c4
parentaf3f79a1f89c07d5629929eee0ec5dcc3f52ebda (diff)
downloadpackages_apps_Settings-3ed641a09cf53b598065a8c5168a9e2f5f278bf4.zip
packages_apps_Settings-3ed641a09cf53b598065a8c5168a9e2f5f278bf4.tar.gz
packages_apps_Settings-3ed641a09cf53b598065a8c5168a9e2f5f278bf4.tar.bz2
QS/PW: Check for mobile data instead of telephony permissions (2/2)
For QuickSettings and Power Widget check if there is ConnectivityManager.TYPE_MOBILE network avaialbe directly instead of relying on a checking for the PackageManager.FEATURE_TELEPHONY permission. Some devices like tilapia (Nexus 7 GSM) has mobile data but does not set the telephony permission. Patchset 2: - Have power widget use the same logic as quicksettings to check for mobile data Change-Id: Ibe8059aaa5f3bd1e72e958608a34e89abfd0ad4a Fixes: CYAN-803
-rw-r--r--src/com/android/settings/cyanogenmod/PowerWidget.java5
-rw-r--r--src/com/android/settings/cyanogenmod/QuickSettings.java4
-rw-r--r--src/com/android/settings/cyanogenmod/QuickSettingsUtil.java6
3 files changed, 8 insertions, 7 deletions
diff --git a/src/com/android/settings/cyanogenmod/PowerWidget.java b/src/com/android/settings/cyanogenmod/PowerWidget.java
index cee2a17..33091b7 100644
--- a/src/com/android/settings/cyanogenmod/PowerWidget.java
+++ b/src/com/android/settings/cyanogenmod/PowerWidget.java
@@ -53,6 +53,8 @@ import com.android.internal.telephony.Phone;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
+import static com.android.internal.util.cm.QSUtils.deviceSupportsMobileData;
+
public class PowerWidget extends SettingsPreferenceFragment implements
Preference.OnPreferenceChangeListener {
private static final String TAG = "PowerWidget";
@@ -244,8 +246,7 @@ public class PowerWidget extends SettingsPreferenceFragment implements
}
// Don't show mobile data options if not supported
- boolean isMobileData = pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY);
- if (!isMobileData) {
+ if (!deviceSupportsMobileData(getActivity())) {
PowerWidgetUtil.BUTTONS.remove(PowerWidgetUtil.BUTTON_MOBILEDATA);
PowerWidgetUtil.BUTTONS.remove(PowerWidgetUtil.BUTTON_NETWORKMODE);
PowerWidgetUtil.BUTTONS.remove(PowerWidgetUtil.BUTTON_WIFIAP);
diff --git a/src/com/android/settings/cyanogenmod/QuickSettings.java b/src/com/android/settings/cyanogenmod/QuickSettings.java
index 47b0f18..18491f5 100644
--- a/src/com/android/settings/cyanogenmod/QuickSettings.java
+++ b/src/com/android/settings/cyanogenmod/QuickSettings.java
@@ -29,6 +29,7 @@ import static com.android.internal.util.cm.QSUtils.deviceSupportsBluetooth;
import static com.android.internal.util.cm.QSUtils.deviceSupportsDockBattery;
import static com.android.internal.util.cm.QSUtils.deviceSupportsImeSwitcher;
import static com.android.internal.util.cm.QSUtils.deviceSupportsLte;
+import static com.android.internal.util.cm.QSUtils.deviceSupportsMobileData;
import static com.android.internal.util.cm.QSUtils.deviceSupportsNfc;
import static com.android.internal.util.cm.QSUtils.deviceSupportsUsbTether;
import static com.android.internal.util.cm.QSUtils.deviceSupportsWifiDisplay;
@@ -192,8 +193,7 @@ public class QuickSettings extends SettingsPreferenceFragment implements OnPrefe
}
// Don't show mobile data options if not supported
- boolean isMobileData = pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY);
- if (!isMobileData) {
+ if (!deviceSupportsMobileData(getActivity())) {
QuickSettingsUtil.TILES.remove(TILE_MOBILEDATA);
QuickSettingsUtil.TILES.remove(TILE_WIFIAP);
QuickSettingsUtil.TILES.remove(TILE_NETWORKMODE);
diff --git a/src/com/android/settings/cyanogenmod/QuickSettingsUtil.java b/src/com/android/settings/cyanogenmod/QuickSettingsUtil.java
index be5a466..40b1510 100644
--- a/src/com/android/settings/cyanogenmod/QuickSettingsUtil.java
+++ b/src/com/android/settings/cyanogenmod/QuickSettingsUtil.java
@@ -43,7 +43,7 @@ import static com.android.internal.util.cm.QSConstants.TILE_VOLUME;
import static com.android.internal.util.cm.QSConstants.TILE_WIFI;
import static com.android.internal.util.cm.QSConstants.TILE_WIFIAP;
import static com.android.internal.util.cm.QSUtils.deviceSupportsBluetooth;
-import static com.android.internal.util.cm.QSUtils.deviceSupportsTelephony;
+import static com.android.internal.util.cm.QSUtils.deviceSupportsMobileData;
import java.util.ArrayList;
import java.util.Arrays;
@@ -197,13 +197,13 @@ public class QuickSettingsUtil {
public static String getDefaultTiles(Context context) {
// Filter items not compatible with device
boolean bluetoothSupported = deviceSupportsBluetooth();
- boolean telephonySupported = deviceSupportsTelephony(context);
+ boolean mobileDataSupported = deviceSupportsMobileData(context);
if (!bluetoothSupported) {
TILES_DEFAULT.remove(TILE_BLUETOOTH);
}
- if (!telephonySupported) {
+ if (!mobileDataSupported) {
TILES_DEFAULT.remove(TILE_MOBILEDATA);
}