summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/SettingsActivity.java
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2014-08-06 23:16:27 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-08-05 00:19:02 +0000
commitf34c3501948190acf44defefba8eb161ec6dc07b (patch)
treef9995283b21ee8c08dba308877356ca313a159f7 /src/com/android/settings/SettingsActivity.java
parenta0b87a2436c95777dcb3b3a14660105aa63d0b80 (diff)
parent57fd5fd84be2497845f6c03905500d2a36668b6c (diff)
downloadpackages_apps_Settings-f34c3501948190acf44defefba8eb161ec6dc07b.tar.gz
packages_apps_Settings-f34c3501948190acf44defefba8eb161ec6dc07b.tar.bz2
packages_apps_Settings-f34c3501948190acf44defefba8eb161ec6dc07b.zip
Merge "Fix removal of optional settings tiles" into lmp-dev
Diffstat (limited to 'src/com/android/settings/SettingsActivity.java')
-rw-r--r--src/com/android/settings/SettingsActivity.java34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index f4f34bca0..bb5ac0028 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -1084,19 +1084,21 @@ public class SettingsActivity extends Activity
while (n >= 0) {
DashboardTile tile = category.getTile(n);
-
+ boolean removeTile = false;
id = (int) tile.id;
if (id == R.id.operator_settings || id == R.id.manufacturer_settings) {
- Utils.updateTileToSpecificActivityFromMetaDataOrRemove(this, category, tile);
+ if (!Utils.updateTileToSpecificActivityFromMetaDataOrRemove(this, tile)) {
+ removeTile = true;
+ }
} else if (id == R.id.wifi_settings) {
// Remove WiFi Settings if WiFi service is not available.
if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI)) {
- category.removeTile(n);
+ removeTile = true;
}
} else if (id == R.id.bluetooth_settings) {
// Remove Bluetooth Settings if Bluetooth service is not available.
if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH)) {
- category.removeTile(n);
+ removeTile = true;
}
} else if (id == R.id.data_usage_settings) {
// Remove data usage when kernel module not enabled
@@ -1104,7 +1106,7 @@ public class SettingsActivity extends Activity
.asInterface(ServiceManager.getService(Context.NETWORKMANAGEMENT_SERVICE));
try {
if (!netManager.isBandwidthControlEnabled()) {
- category.removeTile(n);
+ removeTile = true;
}
} catch (RemoteException e) {
// ignored
@@ -1113,11 +1115,11 @@ public class SettingsActivity extends Activity
// Remove battery settings when battery is not available. (e.g. TV)
if (!mBatteryPresent) {
- category.removeTile(n);
+ removeTile = true;
}
} else if (id == R.id.home_settings) {
if (!updateHomeSettingTiles(tile)) {
- category.removeTile(n);
+ removeTile = true;
}
} else if (id == R.id.user_settings) {
boolean hasMultipleUsers =
@@ -1127,38 +1129,40 @@ public class SettingsActivity extends Activity
|| (!UserManager.supportsMultipleUsers()
&& !hasMultipleUsers)
|| Utils.isMonkeyRunning()) {
- category.removeTile(n);
+ removeTile = true;
}
} else if (id == R.id.nfc_payment_settings) {
if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_NFC)) {
- category.removeTile(n);
+ removeTile = true;
} else {
// Only show if NFC is on and we have the HCE feature
NfcAdapter adapter = NfcAdapter.getDefaultAdapter(this);
if (!adapter.isEnabled() || !getPackageManager().hasSystemFeature(
PackageManager.FEATURE_NFC_HOST_CARD_EMULATION)) {
- category.removeTile(n);
+ removeTile = true;
}
}
} else if (id == R.id.print_settings) {
boolean hasPrintingSupport = getPackageManager().hasSystemFeature(
PackageManager.FEATURE_PRINTING);
if (!hasPrintingSupport) {
- category.removeTile(n);
+ removeTile = true;
}
} else if (id == R.id.development_settings) {
if (!showDev || um.hasUserRestriction(
UserManager.DISALLOW_DEBUGGING_FEATURES)) {
- category.removeTile(n);
+ removeTile = true;
}
}
if (UserHandle.MU_ENABLED && UserHandle.myUserId() != 0
- && !ArrayUtils.contains(SETTINGS_FOR_RESTRICTED, id)
- && n < category.getTilesCount()) {
- category.removeTile(n);
+ && !ArrayUtils.contains(SETTINGS_FOR_RESTRICTED, id)) {
+ removeTile = true;
}
+ if (removeTile && n < category.getTilesCount()) {
+ category.removeTile(n);
+ }
n--;
}
}