diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index 02769e1..891a0c4 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -19,9 +19,11 @@
 import android.accounts.Account;
 import android.accounts.AccountManager;
 import android.accounts.OnAccountsUpdateListener;
+import android.content.BroadcastReceiver;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
+import android.content.IntentFilter;
 import android.content.RestrictionEntry;
 import android.content.SharedPreferences;
 import android.content.pm.ActivityInfo;
@@ -134,6 +136,23 @@
     private Header mLastHeader;
     private boolean mListeningToAccountUpdates;
 
+    private boolean mBatteryPresent = true;
+    private BroadcastReceiver mBatteryInfoReceiver = new BroadcastReceiver() {
+
+        @Override
+        public void onReceive(Context context, Intent intent) {
+            String action = intent.getAction();
+            if (Intent.ACTION_BATTERY_CHANGED.equals(action)) {
+                boolean batteryPresent = Utils.isBatteryPresent(intent);
+
+                if (mBatteryPresent != batteryPresent) {
+                    mBatteryPresent = batteryPresent;
+                    invalidateHeaders();
+                }
+            }
+        }
+    };
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         if (getIntent().hasExtra(EXTRA_UI_OPTIONS)) {
@@ -218,12 +237,16 @@
             ((HeaderAdapter) listAdapter).resume();
         }
         invalidateHeaders();
+
+        registerReceiver(mBatteryInfoReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
     }
 
     @Override
     public void onPause() {
         super.onPause();
 
+        unregisterReceiver(mBatteryInfoReceiver);
+
         ListAdapter listAdapter = getListAdapter();
         if (listAdapter instanceof HeaderAdapter) {
             ((HeaderAdapter) listAdapter).pause();
@@ -439,6 +462,12 @@
                 } catch (RemoteException e) {
                     // ignored
                 }
+            } else if (id == R.id.battery_settings) {
+                // Remove battery settings when battery is not available. (e.g. TV)
+
+                if (!mBatteryPresent) {
+                    target.remove(i);
+                }
             } else if (id == R.id.account_settings) {
                 int headerIndex = i + 1;
                 i = insertAccountsHeaders(target, headerIndex);
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index f031f0a..58c0872 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -386,17 +386,22 @@
         }
     }
 
+    public static boolean isBatteryPresent(Intent batteryChangedIntent) {
+        return batteryChangedIntent.getBooleanExtra(BatteryManager.EXTRA_PRESENT, true);
+    }
+
     public static String getBatteryPercentage(Intent batteryChangedIntent) {
-        int level = batteryChangedIntent.getIntExtra("level", 0);
-        int scale = batteryChangedIntent.getIntExtra("scale", 100);
+        int level = batteryChangedIntent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0);
+        int scale = batteryChangedIntent.getIntExtra(BatteryManager.EXTRA_SCALE, 100);
         return String.valueOf(level * 100 / scale) + "%";
     }
 
     public static String getBatteryStatus(Resources res, Intent batteryChangedIntent) {
         final Intent intent = batteryChangedIntent;
 
-        int plugType = intent.getIntExtra("plugged", 0);
-        int status = intent.getIntExtra("status", BatteryManager.BATTERY_STATUS_UNKNOWN);
+        int plugType = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0);
+        int status = intent.getIntExtra(BatteryManager.EXTRA_STATUS,
+                BatteryManager.BATTERY_STATUS_UNKNOWN);
         String statusString;
         if (status == BatteryManager.BATTERY_STATUS_CHARGING) {
             statusString = res.getString(R.string.battery_info_status_charging);
