Merge "Modify Settings homepage layout"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 850ce8b..6af9721 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -9471,9 +9471,6 @@
     <!-- [CHAR LIMIT=25] Title of developer tile to toggle winscope trace -->
     <string name="winscope_trace_quick_settings_title">Winscope Trace</string>
 
-    <!-- Template for formatting country and language. eg Canada - French [CHAR LIMIT=NONE]-->
-    <string name="support_country_format"><xliff:g id="country" example="Canada">%1$s</xliff:g> - <xliff:g id="language" example="French">%2$s</xliff:g></string>
-
     <!-- [CHAR LIMIT=60] Title of work profile setting page -->
     <string name="managed_profile_settings_title">Work profile settings</string>
     <!-- [CHAR LIMIT=60] The preference title for enabling cross-profile remote contact search -->
diff --git a/src/com/android/settings/applications/manageapplications/ApplicationViewHolder.java b/src/com/android/settings/applications/manageapplications/ApplicationViewHolder.java
index 021a953..e46f294 100644
--- a/src/com/android/settings/applications/manageapplications/ApplicationViewHolder.java
+++ b/src/com/android/settings/applications/manageapplications/ApplicationViewHolder.java
@@ -73,8 +73,8 @@
     static View newView(ViewGroup parent, boolean twoTarget) {
         ViewGroup view = (ViewGroup) LayoutInflater.from(parent.getContext())
                 .inflate(R.layout.preference_app, parent, false);
+        final ViewGroup widgetFrame = view.findViewById(android.R.id.widget_frame);
         if (twoTarget) {
-            final ViewGroup widgetFrame = view.findViewById(android.R.id.widget_frame);
             if (widgetFrame != null) {
                LayoutInflater.from(parent.getContext())
                        .inflate(R.layout.preference_widget_master_switch, widgetFrame, true);
@@ -84,6 +84,8 @@
                // second to last, before widget frame
                view.addView(divider, view.getChildCount() - 1);
             }
+        } else if (widgetFrame != null) {
+            widgetFrame.setVisibility(View.GONE);
         }
         return view;
     }
diff --git a/src/com/android/settings/overlay/SupportFeatureProvider.java b/src/com/android/settings/overlay/SupportFeatureProvider.java
index a9b66d6..b22b458 100644
--- a/src/com/android/settings/overlay/SupportFeatureProvider.java
+++ b/src/com/android/settings/overlay/SupportFeatureProvider.java
@@ -16,55 +16,17 @@
 
 package com.android.settings.overlay;
 
-import android.accounts.Account;
-import android.annotation.IntDef;
-import android.annotation.NonNull;
 import android.app.Activity;
-import android.content.Context;
-
-import com.android.settings.support.SupportPhone;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
 
 /**
  * Feature provider for support tab.
  */
 public interface SupportFeatureProvider {
 
-    @IntDef({SupportType.EMAIL, SupportType.PHONE, SupportType.CHAT})
-    @Retention(RetentionPolicy.SOURCE)
-    @interface SupportType {
-        int EMAIL = 1;
-        int PHONE = 2;
-        int CHAT = 3;
-    }
-
     /**
-     * Refreshes all operation rules.
-     */
-    void refreshOperationRules();
-
-    /**
-     * Returns the current country code if it has a operation config, otherwise returns null.
-     */
-    String getCurrentCountryCodeIfHasConfig(@SupportType int type);
-
-    /**
-     * Returns a support phone for specified country.
-     */
-    SupportPhone getSupportPhones(String countryCode, boolean isTollfree);
-
-    /**
-     * Returns array of {@link Account} that's eligible for support options.
-     */
-    @NonNull
-    Account[] getSupportEligibleAccounts(Context context);
-
-    /**
-     * Starts support v2, invokes the support home page. Will no-op if support v2 is not enabled.
+     * Starts support, invokes the support home page.
      *
      * @param activity Calling activity.
      */
-    void startSupportV2(Activity activity);
+    void startSupport(Activity activity);
 }
diff --git a/src/com/android/settings/support/SupportDashboardActivity.java b/src/com/android/settings/support/SupportDashboardActivity.java
index ed7e76c..245810a 100644
--- a/src/com/android/settings/support/SupportDashboardActivity.java
+++ b/src/com/android/settings/support/SupportDashboardActivity.java
@@ -43,9 +43,9 @@
         SupportFeatureProvider supportFeatureProvider = FeatureFactory.getFactory(this)
                 .getSupportFeatureProvider(this);
 
-        // try to launch support v2 if we have the feature provider
+        // try to launch support if we have the feature provider
         if (supportFeatureProvider != null) {
-          supportFeatureProvider.startSupportV2(this);
+          supportFeatureProvider.startSupport(this);
           finish();
         }
     }
diff --git a/src/com/android/settings/support/SupportPhone.java b/src/com/android/settings/support/SupportPhone.java
deleted file mode 100644
index d27dca5..0000000
--- a/src/com/android/settings/support/SupportPhone.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.support;
-
-import android.content.Intent;
-import android.net.Uri;
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.text.TextUtils;
-
-import java.text.ParseException;
-
-/**
- * Data model for a support phone number.
- */
-public final class SupportPhone implements Parcelable {
-
-    public final String language;
-    public final String number;
-    public final boolean isTollFree;
-
-    public SupportPhone(String config) throws ParseException {
-        // Config follows this format: language:[tollfree|tolled]:number
-        final String[] tokens = config.split(":");
-        if (tokens.length != 3) {
-            throw new ParseException("Phone config is invalid " + config, 0);
-        }
-        language = tokens[0];
-        isTollFree = TextUtils.equals(tokens[1], "tollfree");
-        number = tokens[2];
-    }
-
-    protected SupportPhone(Parcel in) {
-        language = in.readString();
-        number = in.readString();
-        isTollFree = in.readInt() != 0;
-    }
-
-    public Intent getDialIntent() {
-        return new Intent(Intent.ACTION_DIAL)
-                .setData(new Uri.Builder()
-                        .scheme("tel")
-                        .appendPath(number)
-                        .build());
-    }
-
-    @Override
-    public int describeContents() {
-        return 0;
-    }
-
-    @Override
-    public void writeToParcel(Parcel dest, int flags) {
-        dest.writeString(language);
-        dest.writeString(number);
-        dest.writeInt(isTollFree ? 1 : 0);
-    }
-
-    public static final Creator<SupportPhone> CREATOR = new Creator<SupportPhone>() {
-        @Override
-        public SupportPhone createFromParcel(Parcel in) {
-            return new SupportPhone(in);
-        }
-
-        @Override
-        public SupportPhone[] newArray(int size) {
-            return new SupportPhone[size];
-        }
-    };
-}