diff --git a/res/xml/timezones.xml b/res/xml/timezones.xml
deleted file mode 100644
index 4426495..0000000
--- a/res/xml/timezones.xml
+++ /dev/null
@@ -1,91 +0,0 @@
-<timezones>
-    <timezone id="Pacific/Midway"></timezone>
-    <timezone id="Pacific/Honolulu"></timezone>
-    <timezone id="America/Anchorage"></timezone>
-    <timezone id="America/Los_Angeles"></timezone>
-    <timezone id="America/Tijuana"></timezone>
-    <timezone id="America/Phoenix"></timezone>
-    <timezone id="America/Chihuahua"></timezone>
-    <timezone id="America/Denver"></timezone>
-    <timezone id="America/Costa_Rica"></timezone>
-    <timezone id="America/Chicago"></timezone>
-    <timezone id="America/Mexico_City"></timezone>
-    <timezone id="America/Regina"></timezone>
-    <timezone id="America/Bogota"></timezone>
-    <timezone id="America/New_York"></timezone>
-    <timezone id="America/Caracas"></timezone>
-    <timezone id="America/Barbados"></timezone>
-    <timezone id="America/Halifax"></timezone>
-    <timezone id="America/Manaus"></timezone>
-    <timezone id="America/Santiago"></timezone>
-    <timezone id="America/St_Johns"></timezone>
-    <timezone id="America/Recife"></timezone>
-    <timezone id="America/Sao_Paulo"></timezone>
-    <timezone id="America/Buenos_Aires"></timezone>
-    <timezone id="America/Godthab"></timezone>
-    <timezone id="America/Montevideo"></timezone>
-    <timezone id="Atlantic/South_Georgia"></timezone>
-    <timezone id="Atlantic/Azores"></timezone>
-    <timezone id="Atlantic/Cape_Verde"></timezone>
-    <timezone id="Africa/Casablanca"></timezone>
-    <timezone id="Europe/London"></timezone>
-    <timezone id="Europe/Amsterdam"></timezone>
-    <timezone id="Europe/Belgrade"></timezone>
-    <timezone id="Europe/Brussels"></timezone>
-    <timezone id="Europe/Madrid"></timezone>
-    <timezone id="Europe/Sarajevo"></timezone>
-    <timezone id="Africa/Windhoek"></timezone>
-    <timezone id="Africa/Brazzaville"></timezone>
-    <timezone id="Asia/Amman"></timezone>
-    <timezone id="Europe/Athens"></timezone>
-    <timezone id="Europe/Istanbul"></timezone>
-    <timezone id="Asia/Beirut"></timezone>
-    <timezone id="Africa/Cairo"></timezone>
-    <timezone id="Europe/Helsinki"></timezone>
-    <timezone id="Asia/Jerusalem"></timezone>
-    <timezone id="Europe/Minsk"></timezone>
-    <timezone id="Africa/Harare"></timezone>
-    <timezone id="Asia/Baghdad"></timezone>
-    <timezone id="Europe/Moscow"></timezone>
-    <timezone id="Asia/Kuwait"></timezone>
-    <timezone id="Africa/Nairobi"></timezone>
-    <timezone id="Asia/Tehran"></timezone>
-    <timezone id="Asia/Baku"></timezone>
-    <timezone id="Asia/Tbilisi"></timezone>
-    <timezone id="Asia/Yerevan"></timezone>
-    <timezone id="Asia/Dubai"></timezone>
-    <timezone id="Asia/Kabul"></timezone>
-    <timezone id="Asia/Karachi"></timezone>
-    <timezone id="Asia/Oral"></timezone>
-    <timezone id="Asia/Yekaterinburg"></timezone>
-    <timezone id="Asia/Calcutta"></timezone>
-    <timezone id="Asia/Colombo"></timezone>
-    <timezone id="Asia/Katmandu"></timezone>
-    <timezone id="Asia/Almaty"></timezone>
-    <timezone id="Asia/Rangoon"></timezone>
-    <timezone id="Asia/Krasnoyarsk"></timezone>
-    <timezone id="Asia/Bangkok"></timezone>
-    <timezone id="Asia/Jakarta"></timezone>
-    <timezone id="Asia/Shanghai"></timezone>
-    <timezone id="Asia/Hong_Kong"></timezone>
-    <timezone id="Asia/Irkutsk"></timezone>
-    <timezone id="Asia/Kuala_Lumpur"></timezone>
-    <timezone id="Australia/Perth"></timezone>
-    <timezone id="Asia/Taipei"></timezone>
-    <timezone id="Asia/Seoul"></timezone>
-    <timezone id="Asia/Tokyo"></timezone>
-    <timezone id="Asia/Yakutsk"></timezone>
-    <timezone id="Australia/Adelaide"></timezone>
-    <timezone id="Australia/Darwin"></timezone>
-    <timezone id="Australia/Brisbane"></timezone>
-    <timezone id="Australia/Hobart"></timezone>
-    <timezone id="Australia/Sydney"></timezone>
-    <timezone id="Asia/Vladivostok"></timezone>
-    <timezone id="Pacific/Guam"></timezone>
-    <timezone id="Asia/Magadan"></timezone>
-    <timezone id="Pacific/Noumea"></timezone>
-    <timezone id="Pacific/Majuro"></timezone>
-    <timezone id="Pacific/Auckland"></timezone>
-    <timezone id="Pacific/Fiji"></timezone>
-    <timezone id="Pacific/Tongatapu"></timezone>
-</timezones>
diff --git a/src/com/android/settings/DateTimeSettings.java b/src/com/android/settings/DateTimeSettings.java
index a3926a3..c29dc47 100644
--- a/src/com/android/settings/DateTimeSettings.java
+++ b/src/com/android/settings/DateTimeSettings.java
@@ -16,12 +16,12 @@
 
 package com.android.settings;
 
-import android.app.admin.DevicePolicyManager;
 import android.app.Activity;
 import android.app.AlarmManager;
 import android.app.DatePickerDialog;
 import android.app.Dialog;
 import android.app.TimePickerDialog;
+import android.app.admin.DevicePolicyManager;
 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
@@ -34,20 +34,15 @@
 import android.preference.SwitchPreference;
 import android.provider.Settings;
 import android.provider.Settings.SettingNotFoundException;
-import android.text.BidiFormatter;
-import android.text.TextDirectionHeuristics;
-import android.text.TextUtils;
 import android.text.format.DateFormat;
-import android.view.View;
 import android.widget.DatePicker;
 import android.widget.TimePicker;
-import com.android.internal.logging.MetricsLogger;
 
-import java.text.SimpleDateFormat;
+import com.android.internal.logging.MetricsLogger;
+import com.android.settingslib.datetime.ZoneGetter;
+
 import java.util.Calendar;
 import java.util.Date;
-import java.util.Locale;
-import java.util.TimeZone;
 
 public class DateTimeSettings extends SettingsPreferenceFragment
         implements OnSharedPreferenceChangeListener,
@@ -170,7 +165,7 @@
         Date dummyDate = mDummyDate.getTime();
         mDatePref.setSummary(DateFormat.getLongDateFormat(context).format(now.getTime()));
         mTimePref.setSummary(DateFormat.getTimeFormat(getActivity()).format(now.getTime()));
-        mTimeZone.setSummary(getTimeZoneText(now.getTimeZone(), true));
+        mTimeZone.setSummary(ZoneGetter.getTimeZoneText(now.getTimeZone(), true));
         mTime24Pref.setSummary(DateFormat.getTimeFormat(getActivity()).format(dummyDate));
     }
 
@@ -350,34 +345,6 @@
         }
     }
 
-    public static String getTimeZoneText(TimeZone tz, boolean includeName) {
-        Date now = new Date();
-
-        // Use SimpleDateFormat to format the GMT+00:00 string.
-        SimpleDateFormat gmtFormatter = new SimpleDateFormat("ZZZZ");
-        gmtFormatter.setTimeZone(tz);
-        String gmtString = gmtFormatter.format(now);
-
-        // Ensure that the "GMT+" stays with the "00:00" even if the digits are RTL.
-        BidiFormatter bidiFormatter = BidiFormatter.getInstance();
-        Locale l = Locale.getDefault();
-        boolean isRtl = TextUtils.getLayoutDirectionFromLocale(l) == View.LAYOUT_DIRECTION_RTL;
-        gmtString = bidiFormatter.unicodeWrap(gmtString,
-                isRtl ? TextDirectionHeuristics.RTL : TextDirectionHeuristics.LTR);
-
-        if (!includeName) {
-            return gmtString;
-        }
-
-        // Optionally append the time zone name.
-        SimpleDateFormat zoneNameFormatter = new SimpleDateFormat("zzzz");
-        zoneNameFormatter.setTimeZone(tz);
-        String zoneNameString = zoneNameFormatter.format(now);
-
-        // We don't use punctuation here to avoid having to worry about localizing that too!
-        return gmtString + " " + zoneNameString;
-    }
-
     private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
         @Override
         public void onReceive(Context context, Intent intent) {
diff --git a/src/com/android/settings/ZonePicker.java b/src/com/android/settings/ZonePicker.java
index 72e4a03..a3c7435 100644
--- a/src/com/android/settings/ZonePicker.java
+++ b/src/com/android/settings/ZonePicker.java
@@ -20,9 +20,8 @@
 import android.app.AlarmManager;
 import android.app.ListFragment;
 import android.content.Context;
-import android.content.res.XmlResourceParser;
 import android.os.Bundle;
-import android.util.Log;
+import android.support.annotation.NonNull;
 import android.view.LayoutInflater;
 import android.view.Menu;
 import android.view.MenuInflater;
@@ -32,21 +31,14 @@
 import android.widget.ListView;
 import android.widget.SimpleAdapter;
 
-import org.xmlpull.v1.XmlPullParserException;
+import com.android.settingslib.datetime.ZoneGetter;
 
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
 import java.util.Collections;
 import java.util.Comparator;
-import java.util.Date;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
-import java.util.Locale;
 import java.util.Map;
 import java.util.TimeZone;
-import libcore.icu.TimeZoneNames;
 
 /**
  * The class displaying a list of time zones that match a filter string
@@ -57,19 +49,11 @@
 public class ZonePicker extends ListFragment {
     private static final String TAG = "ZonePicker";
 
-    public static interface ZoneSelectionListener {
+    public interface ZoneSelectionListener {
         // You can add any argument if you really need it...
-        public void onZoneSelected(TimeZone tz);
+        void onZoneSelected(TimeZone tz);
     }
 
-    private static final String KEY_ID = "id";  // value: String
-    private static final String KEY_DISPLAYNAME = "name";  // value: String
-    private static final String KEY_GMT = "gmt";  // value: String
-    private static final String KEY_OFFSET = "offset";  // value: int (Integer)
-    private static final String XMLTAG_TIMEZONE = "timezone";
-
-    private static final int HOURS_1 = 60 * 60000;
-
     private static final int MENU_TIMEZONE = Menu.FIRST+1;
     private static final int MENU_ALPHABETICAL = Menu.FIRST;
 
@@ -98,12 +82,12 @@
      */
     public static SimpleAdapter constructTimezoneAdapter(Context context,
             boolean sortedByName, int layoutId) {
-        final String[] from = new String[] {KEY_DISPLAYNAME, KEY_GMT};
+        final String[] from = new String[] {ZoneGetter.KEY_DISPLAYNAME, ZoneGetter.KEY_GMT};
         final int[] to = new int[] {android.R.id.text1, android.R.id.text2};
 
-        final String sortKey = (sortedByName ? KEY_DISPLAYNAME : KEY_OFFSET);
+        final String sortKey = (sortedByName ? ZoneGetter.KEY_DISPLAYNAME : ZoneGetter.KEY_OFFSET);
         final MyComparator comparator = new MyComparator(sortKey);
-        ZoneGetter zoneGetter = new ZoneGetter();
+        final ZoneGetter zoneGetter = new ZoneGetter();
         final List<HashMap<String, Object>> sortedList = zoneGetter.getZones(context);
         Collections.sort(sortedList, comparator);
         final SimpleAdapter adapter = new SimpleAdapter(context,
@@ -131,7 +115,7 @@
         for (int i = 0; i < listSize; i++) {
             // Using HashMap<String, Object> induces unnecessary warning.
             final HashMap<?,?> map = (HashMap<?,?>)adapter.getItem(i);
-            final String id = (String)map.get(KEY_ID);
+            final String id = (String)map.get(ZoneGetter.KEY_ID);
             if (defaultId.equals(id)) {
                 // If current timezone is in this list, move focus to it
                 return i;
@@ -146,7 +130,7 @@
      * @return TimeZone object corresponding to the item.
      */
     public static TimeZone obtainTimeZoneFromItem(Object item) {
-        return TimeZone.getTimeZone((String)((Map<?, ?>)item).get(KEY_ID));
+        return TimeZone.getTimeZone((String)((Map<?, ?>)item).get(ZoneGetter.KEY_ID));
     }
 
     @Override
@@ -163,7 +147,7 @@
     }
 
     @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+    public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
             Bundle savedInstanceState) {
         final View view = super.onCreateView(inflater, container, savedInstanceState);
         final ListView list = (ListView) view.findViewById(android.R.id.list);
@@ -223,82 +207,12 @@
         }
     }
 
-    static class ZoneGetter {
-        private final List<HashMap<String, Object>> mZones =
-                new ArrayList<HashMap<String, Object>>();
-        private final HashSet<String> mLocalZones = new HashSet<String>();
-        private final Date mNow = Calendar.getInstance().getTime();
-        private final SimpleDateFormat mZoneNameFormatter = new SimpleDateFormat("zzzz");
-
-        private List<HashMap<String, Object>> getZones(Context context) {
-            for (String olsonId : TimeZoneNames.forLocale(Locale.getDefault())) {
-                mLocalZones.add(olsonId);
-            }
-            try {
-                XmlResourceParser xrp = context.getResources().getXml(R.xml.timezones);
-                while (xrp.next() != XmlResourceParser.START_TAG) {
-                    continue;
-                }
-                xrp.next();
-                while (xrp.getEventType() != XmlResourceParser.END_TAG) {
-                    while (xrp.getEventType() != XmlResourceParser.START_TAG) {
-                        if (xrp.getEventType() == XmlResourceParser.END_DOCUMENT) {
-                            return mZones;
-                        }
-                        xrp.next();
-                    }
-                    if (xrp.getName().equals(XMLTAG_TIMEZONE)) {
-                        String olsonId = xrp.getAttributeValue(0);
-                        addTimeZone(olsonId);
-                    }
-                    while (xrp.getEventType() != XmlResourceParser.END_TAG) {
-                        xrp.next();
-                    }
-                    xrp.next();
-                }
-                xrp.close();
-            } catch (XmlPullParserException xppe) {
-                Log.e(TAG, "Ill-formatted timezones.xml file");
-            } catch (java.io.IOException ioe) {
-                Log.e(TAG, "Unable to read timezones.xml file");
-            }
-            return mZones;
-        }
-
-        private void addTimeZone(String olsonId) {
-            // We always need the "GMT-07:00" string.
-            final TimeZone tz = TimeZone.getTimeZone(olsonId);
-
-            // For the display name, we treat time zones within the country differently
-            // from other countries' time zones. So in en_US you'd get "Pacific Daylight Time"
-            // but in de_DE you'd get "Los Angeles" for the same time zone.
-            String displayName;
-            if (mLocalZones.contains(olsonId)) {
-                // Within a country, we just use the local name for the time zone.
-                mZoneNameFormatter.setTimeZone(tz);
-                displayName = mZoneNameFormatter.format(mNow);
-            } else {
-                // For other countries' time zones, we use the exemplar location.
-                final String localeName = Locale.getDefault().toString();
-                displayName = TimeZoneNames.getExemplarLocation(localeName, olsonId);
-            }
-
-            final HashMap<String, Object> map = new HashMap<String, Object>();
-            map.put(KEY_ID, olsonId);
-            map.put(KEY_DISPLAYNAME, displayName);
-            map.put(KEY_GMT, DateTimeSettings.getTimeZoneText(tz, false));
-            map.put(KEY_OFFSET, tz.getOffset(mNow.getTime()));
-
-            mZones.add(map);
-        }
-    }
-
     @Override
     public void onListItemClick(ListView listView, View v, int position, long id) {
         // Ignore extra clicks
         if (!isResumed()) return;
         final Map<?, ?> map = (Map<?, ?>)listView.getItemAtPosition(position);
-        final String tzId = (String) map.get(KEY_ID);
+        final String tzId = (String) map.get(ZoneGetter.KEY_ID);
 
         // Update the system timezone value
         final Activity activity = getActivity();
