Merge "Refactor DashboardFragment."
diff --git a/res/layout/support_fragment.xml b/res/layout/support_fragment.xml
index 913e607..7c79a63 100644
--- a/res/layout/support_fragment.xml
+++ b/res/layout/support_fragment.xml
@@ -15,13 +15,18 @@
      limitations under the License.
 -->
 
-<android.support.v7.widget.RecyclerView
+<FrameLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/support_items"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:clipChildren="false"
     android:clipToPadding="false"
     android:focusable="false"
     android:paddingStart="@dimen/dashboard_padding_start"
-    android:paddingEnd="@dimen/dashboard_padding_end"/>
\ No newline at end of file
+    android:paddingEnd="@dimen/dashboard_padding_end">
+    <android.support.v7.widget.RecyclerView
+        android:id="@+id/support_items"
+        android:layout_height="match_parent"
+        android:layout_width="match_parent"
+        android:background="@color/card_background"/>
+</FrameLayout>
diff --git a/res/values/config.xml b/res/values/config.xml
index 75d8697..7513cef 100755
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -58,4 +58,7 @@
     <!-- If the Storage Manager settings are enabled. -->
     <bool name="config_storage_manager_settings_enabled">false</bool>
 
+    <!-- When true show double-tap gesture setting. -->
+    <bool name="config_gesture_double_tap_settings_enabled">false</bool>
+
 </resources>
diff --git a/src/com/android/settings/DateTimeSettings.java b/src/com/android/settings/DateTimeSettings.java
index 1fed189..f33ca85 100644
--- a/src/com/android/settings/DateTimeSettings.java
+++ b/src/com/android/settings/DateTimeSettings.java
@@ -168,7 +168,8 @@
         Date dummyDate = mDummyDate.getTime();
         mDatePref.setSummary(DateFormat.getLongDateFormat(context).format(now.getTime()));
         mTimePref.setSummary(DateFormat.getTimeFormat(getActivity()).format(now.getTime()));
-        mTimeZone.setSummary(ZoneGetter.getTimeZoneOffsetAndName(now.getTimeZone(), now.getTime()));
+        mTimeZone.setSummary(ZoneGetter.getTimeZoneOffsetAndName(context,
+                now.getTimeZone(), now.getTime()));
         mTime24Pref.setSummary(DateFormat.getTimeFormat(getActivity()).format(dummyDate));
     }
 
@@ -385,7 +386,7 @@
         public void setListening(boolean listening) {
             if (listening) {
                 final Calendar now = Calendar.getInstance();
-                mSummaryLoader.setSummary(this, ZoneGetter.getTimeZoneOffsetAndName(
+                mSummaryLoader.setSummary(this, ZoneGetter.getTimeZoneOffsetAndName(mContext,
                         now.getTimeZone(), now.getTime()));
             }
         }
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index 4244a7d..9f86860 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -1326,11 +1326,7 @@
         if (intent == null || ActivityManager.isUserAMonkey()) {
             return;
         }
-        final ComponentName componentName = intent.getComponent();
-        if (componentName.equals(mCurrentSuggestion)) {
-            return;
-        }
-        mCurrentSuggestion = componentName;
+        mCurrentSuggestion = intent.getComponent();
         startActivityForResult(intent, REQUEST_SUGGESTION);
     }
 
diff --git a/src/com/android/settings/applications/ManageDomainUrls.java b/src/com/android/settings/applications/ManageDomainUrls.java
index a16a865..a011fe4 100644
--- a/src/com/android/settings/applications/ManageDomainUrls.java
+++ b/src/com/android/settings/applications/ManageDomainUrls.java
@@ -16,9 +16,7 @@
 
 import android.app.Application;
 import android.content.Context;
-import android.content.DialogInterface;
 import android.content.pm.PackageManager;
-import android.os.Build;
 import android.os.Bundle;
 import android.os.UserHandle;
 import android.provider.Settings;
@@ -26,28 +24,19 @@
 import android.support.v14.preference.SwitchPreference;
 import android.support.v7.preference.Preference;
 import android.support.v7.preference.Preference.OnPreferenceChangeListener;
+import android.support.v7.preference.Preference.OnPreferenceClickListener;
 import android.support.v7.preference.PreferenceCategory;
 import android.support.v7.preference.PreferenceGroup;
 import android.support.v7.preference.PreferenceViewHolder;
 import android.util.ArraySet;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
 import android.view.View;
 
 import com.android.internal.logging.MetricsProto.MetricsEvent;
-import com.android.settings.AppHeader;
 import com.android.settings.R;
-import com.android.settings.SettingsActivity;
 import com.android.settings.SettingsPreferenceFragment;
 import com.android.settings.Utils;
-import com.android.settings.applications.AppInfoBase;
-import com.android.settings.applications.AppStateBaseBridge;
-import com.android.settings.applications.InstalledAppDetails;
-import com.android.settings.datausage.AppStateDataUsageBridge.DataUsageState;
 import com.android.settingslib.applications.ApplicationsState;
 import com.android.settingslib.applications.ApplicationsState.AppEntry;
-import com.android.settingslib.applications.ApplicationsState.AppFilter;
 
 import java.util.ArrayList;
 
@@ -56,7 +45,11 @@
  * handling as well as system handling for Web Actions.
  */
 public class ManageDomainUrls extends SettingsPreferenceFragment
-        implements ApplicationsState.Callbacks, OnPreferenceChangeListener {
+        implements ApplicationsState.Callbacks, OnPreferenceChangeListener,
+        OnPreferenceClickListener {
+
+    // constant value that can be used to check return code from sub activity.
+    private static final int INSTALLED_APP_DETAILS = 1;
 
     private ApplicationsState mApplicationsState;
     private ApplicationsState.Session mSession;
@@ -77,7 +70,6 @@
     @Override
     public void onViewCreated(View view, Bundle savedInstanceState) {
         super.onViewCreated(view, savedInstanceState);
-        setLoading(true, false);
     }
 
     @Override
@@ -141,7 +133,6 @@
             }
         }
         rebuildAppList(mDomainAppList, apps);
-        setLoading(false, true);
     }
 
     @Override
@@ -173,6 +164,7 @@
             if (preference == null) {
                 preference = new DomainAppPreference(getPrefContext(), entry);
                 preference.setKey(key);
+                preference.setOnPreferenceClickListener(this);
                 group.addPreference(preference);
             } else {
                 preference.reuse();
@@ -208,6 +200,18 @@
         return MetricsEvent.MANAGE_DOMAIN_URLS;
     }
 
+    @Override
+    public boolean onPreferenceClick(Preference preference) {
+        if (preference.getClass() == DomainAppPreference.class) {
+            ApplicationsState.AppEntry entry = ((DomainAppPreference) preference).mEntry;
+            AppInfoBase.startAppInfoFragment(AppLaunchSettings.class, R.string.auto_launch_label,
+                    entry.info.packageName, entry.info.uid, this,
+                    INSTALLED_APP_DETAILS);
+            return true;
+        }
+        return false;
+    }
+
     private class DomainAppPreference extends Preference {
         private final AppEntry mEntry;
         private final PackageManager mPm;
diff --git a/src/com/android/settings/gestures/GestureSettings.java b/src/com/android/settings/gestures/GestureSettings.java
index 8cb329b..32c8438 100644
--- a/src/com/android/settings/gestures/GestureSettings.java
+++ b/src/com/android/settings/gestures/GestureSettings.java
@@ -71,7 +71,7 @@
         Context context = getActivity();
         mPreferences = new ArrayList();
 
-         // Double tap power for camera
+        // Double tap power for camera
         if (isCameraDoubleTapPowerGestureAvailable(getResources())) {
             int cameraDisabled = Secure.getInt(
                     getContentResolver(), Secure.CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, 0);
@@ -81,13 +81,17 @@
         }
 
         // Ambient Display
-        if (isDozeAvailable(context)) {
+        boolean dozeEnabled = isDozeAvailable(context);
+        if (dozeEnabled) {
             int pickup = Secure.getInt(getContentResolver(), Secure.DOZE_PULSE_ON_PICK_UP, 1);
             addPreference(PREF_KEY_PICK_UP, pickup != 0, PREF_ID_PICK_UP);
+        } else {
+            removePreference(PREF_KEY_PICK_UP);
+        }
+        if (dozeEnabled && isDoubleTapAvailable(context)) {
             int doubleTap = Secure.getInt(getContentResolver(), Secure.DOZE_PULSE_ON_DOUBLE_TAP, 1);
             addPreference(PREF_KEY_DOUBLE_TAP_SCREEN, doubleTap != 0, PREF_ID_DOUBLE_TAP_SCREEN);
         } else {
-            removePreference(PREF_KEY_PICK_UP);
             removePreference(PREF_KEY_DOUBLE_TAP_SCREEN);
         }
 
@@ -215,6 +219,11 @@
         return false;
     }
 
+    private static boolean isDoubleTapAvailable(Context context) {
+        return context.getResources().getBoolean(
+                R.bool.config_gesture_double_tap_settings_enabled);
+    }
+
     private void addPreference(String key, boolean enabled, int id) {
         GesturePreference preference = (GesturePreference) findPreference(key);
         preference.setChecked(enabled);
@@ -247,6 +256,8 @@
                 if (!isDozeAvailable(context)) {
                     result.add(PREF_KEY_PICK_UP);
                     result.add(PREF_KEY_DOUBLE_TAP_SCREEN);
+                } else if (!isDoubleTapAvailable(context)) {
+                    result.add(PREF_KEY_DOUBLE_TAP_SCREEN);
                 }
                 if (!isSystemUINavigationAvailable(context)) {
                     result.add(PREF_KEY_SWIPE_DOWN_FINGERPRINT);