Merge "Longpress any row in Status to copy text to the clipboard."
diff --git a/res/drawable-hdpi/ic_qs_certificate_info.png b/res/drawable-hdpi/ic_qs_certificate_info.png
deleted file mode 100644
index 1fdaaf9..0000000
--- a/res/drawable-hdpi/ic_qs_certificate_info.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_qs_certificate_info.png b/res/drawable-mdpi/ic_qs_certificate_info.png
deleted file mode 100644
index 3b49472..0000000
--- a/res/drawable-mdpi/ic_qs_certificate_info.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_qs_certificate_info.png b/res/drawable-xhdpi/ic_qs_certificate_info.png
deleted file mode 100644
index b3de2ce..0000000
--- a/res/drawable-xhdpi/ic_qs_certificate_info.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_qs_certificate_info.png b/res/drawable-xxhdpi/ic_qs_certificate_info.png
deleted file mode 100644
index 5d6f6c7..0000000
--- a/res/drawable-xxhdpi/ic_qs_certificate_info.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_settings_about.png b/res/drawable-xxhdpi/ic_settings_about.png
new file mode 100644
index 0000000..924d962
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_settings_about.png
Binary files differ
diff --git a/res/layout/empty_print_state.xml b/res/layout/empty_print_state.xml
index 135b3dd..e97bb85 100644
--- a/res/layout/empty_print_state.xml
+++ b/res/layout/empty_print_state.xml
@@ -15,7 +15,7 @@
 -->
 
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/empty_printers_list_service_disabled"
+    android:id="@+id/empty_print_state"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:visibility="gone">
@@ -28,11 +28,12 @@
         android:orientation="vertical">
 
         <ImageView
+            android:id="@+id/icon"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_marginBottom="12dip"
             android:src="@drawable/ic_grayedout_printer"
-            android:contentDescription="@string/print_service_disabled">
+            android:contentDescription="@null">
         </ImageView>
 
         <TextView
diff --git a/res/menu/nfc_payment_settings.xml b/res/menu/nfc_payment_settings.xml
deleted file mode 100644
index f35374e..0000000
--- a/res/menu/nfc_payment_settings.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2013 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.
--->
-
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
-    <item
-        android:id="@+id/nfc_payment_menu_item_add_service"
-        android:title="@string/nfc_payment_menu_item_add_service"
-        android:showAsAction="ifRoom">
-    </item>
-</menu>
diff --git a/res/menu/print_settings.xml b/res/menu/print_settings.xml
deleted file mode 100644
index 9df1181..0000000
--- a/res/menu/print_settings.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2013 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.
--->
-
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
-    <item
-        android:id="@+id/print_menu_item_add_service"
-        android:title="@string/print_menu_item_add_service"
-        android:showAsAction="ifRoom">
-    </item>
-</menu>
diff --git a/res/values/donottranslate.xml b/res/values/donottranslate.xml
index f290f38..e6bd9a6 100644
--- a/res/values/donottranslate.xml
+++ b/res/values/donottranslate.xml
@@ -33,8 +33,4 @@
         <item>@string/input_method_selector_always_show_value</item>
         <item>@string/input_method_selector_always_hide_value</item>
     </string-array>
-    <!-- Default query string to search for a print service. -->
-    <string name="download_print_service_query">market://search?q=print service</string>
-    <!-- Default query string to search for a NFC payment service. -->
-    <string name="download_nfc_payment_service_query">market://search?q=nfc payment</string>
 </resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 5eff621..9c5d039 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -2416,8 +2416,8 @@
     <string name="location_category_recent_location_requests">Recent location requests</string>
     <!-- Location settings screen, displayed when there's no recent app accessing location -->
     <string name="location_no_recent_apps">No apps have requested location recently</string>
-    <!-- [CHAR LIMIT=30] Location settings screen, sub category for app settings -->
-    <string name="location_category_app_settings">App settings</string>
+    <!-- [CHAR LIMIT=30] Location settings screen, sub category for location services -->
+    <string name="location_category_location_services">Location services</string>
     <!-- [CHAR LIMIT=30] Location settings screen, recent location requests high battery use-->
     <string name="location_high_battery_use">High battery use</string>
     <!-- [CHAR LIMIT=30] Location settings screen, recent location requests low battery use-->
@@ -3430,6 +3430,9 @@
     <!-- Title for the prompt shown as a placeholder if no print serivices are installed. [CHAR LIMIT=50] -->
     <string name="print_no_services_installed">No services installed</string>
 
+    <!-- Title for the prompt shown as a placeholder if no printers are found while searching. [CHAR LIMIT=50] -->
+    <string name="print_no_printers_found">No printers found</string>
+
     <!-- Title for print menu item to launch a settings activity. [CHAR LIMIT=25] -->
     <string name="print_menu_item_settings">Settings</string>
 
@@ -4656,12 +4659,12 @@
     <!-- Shows up when there is a user SSL CA Cert installed on the
          device.  Indicates to the user that SSL traffic can be intercepted.  [CHAR LIMIT=NONE] -->
     <string name="ssl_ca_cert_warning">Network may be monitored</string>
-    <!-- Button to close the SSL CA cert warning dialog box.  [CHAR LIMIT=NONE] -->
+    <!-- Button to close the SSL CA cert warning dialog box, meaning the user is done reading.  [CHAR LIMIT=NONE] -->
     <string name="done_button">Done</string>
     <!-- Title of Dialog warning users of SSL monitoring. [CHAR LIMIT=NONE] -->
     <string name="ssl_ca_cert_dialog_title">Network monitoring</string>
     <!-- Text of message to show to users whose administrator has installed a SSL CA Cert.  [CHAR LIMIT=NONE] -->
-    <string name="ssl_ca_cert_info_message">This device is managed by: <xliff:g id="managing_domain">%s</xliff:g>.\n\nYour administrator is capable of monitoring your network activity, including emails, apps, and secure websites.\n\nFor more information, contact your administrator.</string>
+    <string name="ssl_ca_cert_info_message">This device is managed by:\n<xliff:g id="managing_domain">%s</xliff:g>\n\nYour administrator is capable of monitoring your network activity, including emails, apps, and secure websites.\n\nFor more information, contact your administrator.</string>
     <!-- Text of warning to show to users that have a SSL CA Cert installed.  [CHAR LIMIT=NONE] -->
     <string name="ssl_ca_cert_warning_message">A third party is capable of monitoring your network\nactivity, including emails, apps, and secure websites.\n\nA trusted credential installed on your device is making this possible.</string>
     <!-- Label on button that will take the user to the Trusted Credentials settings page.  [CHAR LIMIT=NONE]-->
diff --git a/res/xml/location_settings.xml b/res/xml/location_settings.xml
index 5be6bd3..83b80b1 100644
--- a/res/xml/location_settings.xml
+++ b/res/xml/location_settings.xml
@@ -26,7 +26,7 @@
             android:title="@string/location_category_recent_location_requests" />
 
         <PreferenceCategory
-            android:key="app_settings"
-            android:title="@string/location_category_app_settings" />
+            android:key="location_services"
+            android:title="@string/location_category_location_services" />
 
 </PreferenceScreen>
diff --git a/src/com/android/settings/CryptKeeper.java b/src/com/android/settings/CryptKeeper.java
index 94c793d..7057f1a 100644
--- a/src/com/android/settings/CryptKeeper.java
+++ b/src/com/android/settings/CryptKeeper.java
@@ -239,6 +239,7 @@
             | StatusBarManager.DISABLE_NOTIFICATION_ALERTS
             | StatusBarManager.DISABLE_SYSTEM_INFO
             | StatusBarManager.DISABLE_HOME
+            | StatusBarManager.DISABLE_SEARCH
             | StatusBarManager.DISABLE_RECENT;
 
     /** @return whether or not this Activity was started for debugging the UI only. */
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index 13f7166..87d34c6 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -879,7 +879,7 @@
                             holder.divider_.setVisibility(View.VISIBLE);
                             boolean isManaged = mDevicePolicyManager.getDeviceOwner() != null;
                             if (isManaged) {
-                                holder.button_.setImageResource(R.drawable.ic_qs_certificate_info);
+                                holder.button_.setImageResource(R.drawable.ic_settings_about);
                             } else {
                                 holder.button_.setImageResource(
                                         android.R.drawable.stat_notify_error);
diff --git a/src/com/android/settings/location/LocationMode.java b/src/com/android/settings/location/LocationMode.java
index 63ba6ea..233b010 100644
--- a/src/com/android/settings/location/LocationMode.java
+++ b/src/com/android/settings/location/LocationMode.java
@@ -45,12 +45,6 @@
     private RadioButtonPreference mSensorsOnly;
 
     @Override
-    public void onActivityResult(int requestCode, int resultCode, Intent data) {
-        super.onActivityResult(requestCode, resultCode, data);
-        createPreferenceHierarchy();
-    }
-
-    @Override
     public void onResume() {
         super.onResume();
         createPreferenceHierarchy();
diff --git a/src/com/android/settings/location/LocationSettings.java b/src/com/android/settings/location/LocationSettings.java
index add82c6..06a6650 100644
--- a/src/com/android/settings/location/LocationSettings.java
+++ b/src/com/android/settings/location/LocationSettings.java
@@ -37,7 +37,6 @@
 import android.widget.Switch;
 
 import com.android.settings.R;
-import com.android.settings.fuelgauge.BatteryStatsHelper;
 
 import java.util.Collections;
 import java.util.Comparator;
@@ -56,13 +55,12 @@
     /** Key for preference category "Recent location requests" */
     private static final String KEY_RECENT_LOCATION_REQUESTS = "recent_location_requests";
     /** Key for preference category "Location services" */
-    private static final String KEY_APP_SETTINGS = "app_settings";
+    private static final String KEY_LOCATION_SERVICES = "location_services";
 
     private Switch mSwitch;
     private boolean mValidListener;
     private Preference mLocationMode;
     private PreferenceCategory mCategoryRecentLocationRequests;
-    private BatteryStatsHelper mStatsHelper;
     /** Receives UPDATE_INTENT  */
     private BroadcastReceiver mReceiver;
 
@@ -71,24 +69,6 @@
     }
 
     @Override
-    public void onActivityResult(int requestCode, int resultCode, Intent data) {
-        super.onActivityResult(requestCode, resultCode, data);
-        createPreferenceHierarchy();
-    }
-
-    @Override
-    public void onAttach(Activity activity) {
-        super.onAttach(activity);
-        mStatsHelper = new BatteryStatsHelper(activity, null);
-    }
-
-    @Override
-    public void onCreate(Bundle icicle) {
-        super.onCreate(icicle);
-        mStatsHelper.create(icicle);
-    }
-
-    @Override
     public void onResume() {
         super.onResume();
         mSwitch = new Switch(getActivity());
@@ -107,13 +87,6 @@
         super.onPause();
         mValidListener = false;
         mSwitch.setOnCheckedChangeListener(null);
-        mStatsHelper.pause();
-    }
-
-    @Override
-    public void onDestroy() {
-        super.onDestroy();
-        mStatsHelper.destroy();
     }
 
     private void addPreferencesSorted(List<Preference> prefs, PreferenceGroup container) {
@@ -153,7 +126,7 @@
 
         mCategoryRecentLocationRequests =
                 (PreferenceCategory) root.findPreference(KEY_RECENT_LOCATION_REQUESTS);
-        RecentLocationApps recentApps = new RecentLocationApps(activity, mStatsHelper);
+        RecentLocationApps recentApps = new RecentLocationApps(activity);
         List<Preference> recentLocationRequests = recentApps.getAppList();
         if (recentLocationRequests.size() > 0) {
             addPreferencesSorted(recentLocationRequests, mCategoryRecentLocationRequests);
@@ -166,7 +139,7 @@
             mCategoryRecentLocationRequests.addPreference(banner);
         }
 
-        addAppSettings(activity, root);
+        addLocationServices(activity, root);
 
         // Only show the master switch when we're not in multi-pane mode, and not being used as
         // Setup Wizard.
@@ -198,11 +171,11 @@
      * up-to-date after mode changes even if an affected app doesn't send the setting changed
      * broadcast.
      */
-    private void addAppSettings(Context context, PreferenceScreen root) {
-        PreferenceCategory categoryAppSettings =
-                (PreferenceCategory) root.findPreference(KEY_APP_SETTINGS);
+    private void addLocationServices(Context context, PreferenceScreen root) {
+        PreferenceCategory categoryLocationServices =
+                (PreferenceCategory) root.findPreference(KEY_LOCATION_SERVICES);
         final SettingsInjector injector = new SettingsInjector(context);
-        List<Preference> appSettings = injector.getInjectedSettings();
+        List<Preference> locationServices = injector.getInjectedSettings();
 
         mReceiver = new BroadcastReceiver() {
             @Override
@@ -219,11 +192,11 @@
         filter.addAction(LocationManager.MODE_CHANGED_ACTION);
         context.registerReceiver(mReceiver, filter);
 
-        if (appSettings.size() > 0) {
-            addPreferencesSorted(appSettings, categoryAppSettings);
+        if (locationServices.size() > 0) {
+            addPreferencesSorted(locationServices, categoryLocationServices);
         } else {
             // If there's no item to display, remove the whole category.
-            root.removePreference(categoryAppSettings);
+            root.removePreference(categoryLocationServices);
         }
     }
 
diff --git a/src/com/android/settings/location/RecentLocationApps.java b/src/com/android/settings/location/RecentLocationApps.java
index 9488db7..5708434 100644
--- a/src/com/android/settings/location/RecentLocationApps.java
+++ b/src/com/android/settings/location/RecentLocationApps.java
@@ -20,7 +20,6 @@
 import android.app.AppOpsManager;
 import android.content.Context;
 import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
@@ -32,11 +31,8 @@
 
 import com.android.settings.R;
 import com.android.settings.applications.InstalledAppDetails;
-import com.android.settings.fuelgauge.BatterySipper;
-import com.android.settings.fuelgauge.BatteryStatsHelper;
 
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 
 /**
@@ -45,51 +41,15 @@
 public class RecentLocationApps {
     private static final String TAG = RecentLocationApps.class.getSimpleName();
     private static final String ANDROID_SYSTEM_PACKAGE_NAME = "android";
-    private static final String GOOGLE_SERVICES_SHARED_UID = "com.google.uid.shared";
-    private static final String GCORE_PACKAGE_NAME = "com.google.android.gms";
 
     private static final int RECENT_TIME_INTERVAL_MILLIS = 15 * 60 * 1000;
 
     private final PreferenceActivity mActivity;
-    private final BatteryStatsHelper mStatsHelper;
     private final PackageManager mPackageManager;
-    private final Drawable mGCoreIcon;
 
-    // Stores all the packages that requested location within the designated interval
-    // key - package name of the app
-    // value - whether the app has requested high power location
-
-    public RecentLocationApps(PreferenceActivity activity, BatteryStatsHelper sipperUtil) {
+    public RecentLocationApps(PreferenceActivity activity) {
         mActivity = activity;
         mPackageManager = activity.getPackageManager();
-        mStatsHelper = sipperUtil;
-        Drawable icon = null;
-        try {
-            ApplicationInfo appInfo = mPackageManager.getApplicationInfo(
-                    GCORE_PACKAGE_NAME, PackageManager.GET_META_DATA);
-            icon = mPackageManager.getApplicationIcon(appInfo);
-        } catch (PackageManager.NameNotFoundException e) {
-            if (Log.isLoggable(TAG, Log.INFO)) {
-                Log.i(TAG, "GCore not installed");
-            }
-            icon = null;
-        }
-        mGCoreIcon = icon;
-    }
-
-    private class UidEntryClickedListener
-            implements Preference.OnPreferenceClickListener {
-        private BatterySipper mSipper;
-
-        public UidEntryClickedListener(BatterySipper sipper) {
-            mSipper = sipper;
-        }
-
-        @Override
-        public boolean onPreferenceClick(Preference preference) {
-            mStatsHelper.startBatteryDetailPage(mActivity, mSipper, false);
-            return true;
-        }
     }
 
     private class PackageEntryClickedListener
@@ -129,49 +89,10 @@
     }
 
     /**
-     * Stores a BatterySipper object and records whether the sipper has been used.
-     */
-    private static final class BatterySipperWrapper {
-        private BatterySipper mSipper;
-        private boolean mUsed;
-
-        public BatterySipperWrapper(BatterySipper sipper) {
-            mSipper = sipper;
-            mUsed = false;
-        }
-
-        public BatterySipper batterySipper() {
-            return mSipper;
-        }
-
-        public boolean used() {
-            return mUsed;
-        }
-
-        public void setUsed() {
-            mUsed = true;
-        }
-    }
-
-    /**
      * Fills a list of applications which queried location recently within
      * specified time.
      */
     public List<Preference> getAppList() {
-        // Retrieve Uid-based battery blaming info and generate a package to BatterySipper HashMap
-        // for later faster looking up.
-        mStatsHelper.refreshStats(true);
-        List<BatterySipper> usageList = mStatsHelper.getUsageList();
-        // Key: package Uid. Value: BatterySipperWrapper.
-        HashMap<Integer, BatterySipperWrapper> sipperMap =
-                new HashMap<Integer, BatterySipperWrapper>(usageList.size());
-        for (BatterySipper sipper: usageList) {
-            int uid = sipper.getUid();
-            if (uid != 0) {
-                sipperMap.put(uid, new BatterySipperWrapper(sipper));
-            }
-        }
-
         // Retrieve a location usage list from AppOps
         AppOpsManager aoManager =
                 (AppOpsManager) mActivity.getSystemService(Context.APP_OPS_SERVICE);
@@ -191,8 +112,7 @@
             boolean isAndroidOs = (uid == Process.SYSTEM_UID)
                     && ANDROID_SYSTEM_PACKAGE_NAME.equals(ops.getPackageName());
             if (!isAndroidOs && ActivityManager.getCurrentUser() == UserHandle.getUserId(uid)) {
-                BatterySipperWrapper wrapper = sipperMap.get(uid);
-                Preference pref = getPreferenceFromOps(now, ops, wrapper);
+                Preference pref = getPreferenceFromOps(now, ops);
                 if (pref != null) {
                     prefs.add(pref);
                 }
@@ -203,56 +123,14 @@
     }
 
     /**
-     * Retrieves the icon for given BatterySipper object.
-     *
-     * The icons on location blaming page are actually Uid-based rather than package based. For
-     * those packages that share the same Uid, BatteryStatsHelper picks the one with the most CPU
-     * usage. Both "Contact Sync" and GCore belong to "Google Services" and they share the same Uid.
-     * As a result, sometimes Contact icon may be chosen to represent "Google Services" by
-     * BatteryStatsHelper.
-     *
-     * In order to avoid displaying Contact icon for "Google Services", we hack this method to
-     * always return Puzzle icon for all packages that share the Uid of "Google Services".
-     */
-    private Drawable getIcon(BatterySipper sipper, AppOpsManager.PackageOps ops) {
-        Drawable icon = null;
-        if (mGCoreIcon != null) {
-            try {
-                PackageInfo info = mPackageManager.getPackageInfo(
-                        ops.getPackageName(), PackageManager.GET_META_DATA);
-                if (info != null && GOOGLE_SERVICES_SHARED_UID.equals(info.sharedUserId)) {
-                    if (Log.isLoggable(TAG, Log.VERBOSE)) {
-                        Log.v(TAG, "shareUserId matches GCore, force using puzzle icon");
-                    }
-                    icon = mGCoreIcon;
-                }
-            } catch (PackageManager.NameNotFoundException e) {
-                if (Log.isLoggable(TAG, Log.VERBOSE)) {
-                    Log.v(TAG, e.toString());
-                }
-            }
-        }
-        if (icon == null) {
-            icon = sipper.getIcon();
-        }
-        return icon;
-    }
-
-    /**
      * Creates a Preference entry for the given PackageOps.
      *
      * This method examines the time interval of the PackageOps first. If the PackageOps is older
      * than the designated interval, this method ignores the PackageOps object and returns null.
-     *
-     * When the PackageOps is fresh enough, if the package has a corresponding battery blaming entry
-     * in the Uid-based battery sipper list, this method returns a Preference pointing to the Uid
-     * battery blaming page. If the package doesn't have a battery sipper entry (typically shouldn't
-     * happen), this method returns a Preference pointing to the App Info page for that package.
+     * When the PackageOps is fresh enough, this method returns a Preference pointing to the App
+     * Info page for that package.
      */
-    private Preference getPreferenceFromOps(
-            long now,
-            AppOpsManager.PackageOps ops,
-            BatterySipperWrapper wrapper) {
+    private Preference getPreferenceFromOps(long now, AppOpsManager.PackageOps ops) {
         String packageName = ops.getPackageName();
         List<AppOpsManager.OpEntry> entries = ops.getOps();
         boolean highBattery = false;
@@ -284,48 +162,27 @@
         // The package is fresh enough, continue.
 
         Preference pref = null;
-        if (wrapper != null) {
-            // Contains sipper. Link to Battery Blaming page.
-
-            // We're listing by UID rather than package. Check whether the entry has been used
-            // before to prevent the same UID from showing up twice.
-            if (!wrapper.used()) {
-                BatterySipper sipper = wrapper.batterySipper();
-                sipper.loadNameAndIcon();
-                pref = createRecentLocationEntry(
-                        getIcon(sipper, ops),
-                        sipper.getLabel(),
-                        highBattery,
-                        new UidEntryClickedListener(sipper));
-                wrapper.setUsed();
-            }
-        } else {
-            // No corresponding sipper. Link to App Info page.
-
-            // This is grouped by package rather than UID, but that's OK because this branch
-            // shouldn't happen in practice.
-            try {
-                ApplicationInfo appInfo = mPackageManager.getApplicationInfo(
-                        packageName, PackageManager.GET_META_DATA);
-                // Multiple users can install the same package. Each user gets a different Uid for
-                // the same package.
-                //
-                // Here we retrieve the Uid with package name, that will be the Uid for that package
-                // associated with the current active user. If the Uid differs from the Uid in ops,
-                // that means this entry belongs to another inactive user and we should ignore that.
-                if (appInfo.uid == ops.getUid()) {
-                    pref = createRecentLocationEntry(
-                            mPackageManager.getApplicationIcon(appInfo),
-                            mPackageManager.getApplicationLabel(appInfo),
-                            highBattery,
-                            new PackageEntryClickedListener(packageName));
-                } else if (Log.isLoggable(TAG, Log.VERBOSE)) {
-                    Log.v(TAG, "package " + packageName + " with Uid " + ops.getUid() +
-                            " belongs to another inactive account, ignored.");
-                }
-            } catch (PackageManager.NameNotFoundException e) {
-                Log.wtf(TAG, "Package not found: " + packageName, e);
-            }
+        try {
+          ApplicationInfo appInfo = mPackageManager.getApplicationInfo(
+              packageName, PackageManager.GET_META_DATA);
+          // Multiple users can install the same package. Each user gets a different Uid for
+          // the same package.
+          //
+          // Here we retrieve the Uid with package name, that will be the Uid for that package
+          // associated with the current active user. If the Uid differs from the Uid in ops,
+          // that means this entry belongs to another inactive user and we should ignore that.
+          if (appInfo.uid == ops.getUid()) {
+            pref = createRecentLocationEntry(
+                mPackageManager.getApplicationIcon(appInfo),
+                mPackageManager.getApplicationLabel(appInfo),
+                highBattery,
+                new PackageEntryClickedListener(packageName));
+          } else if (Log.isLoggable(TAG, Log.VERBOSE)) {
+            Log.v(TAG, "package " + packageName + " with Uid " + ops.getUid() +
+                " belongs to another inactive account, ignored.");
+          }
+        } catch (PackageManager.NameNotFoundException e) {
+          Log.wtf(TAG, "Package not found: " + packageName, e);
         }
 
         return pref;
diff --git a/src/com/android/settings/nfc/PaymentSettings.java b/src/com/android/settings/nfc/PaymentSettings.java
index 06697a4..7548c50 100644
--- a/src/com/android/settings/nfc/PaymentSettings.java
+++ b/src/com/android/settings/nfc/PaymentSettings.java
@@ -25,6 +25,7 @@
 import android.preference.Preference;
 import android.preference.PreferenceManager;
 import android.preference.PreferenceScreen;
+import android.provider.Settings;
 import android.text.TextUtils;
 import android.util.Log;
 import android.view.LayoutInflater;
@@ -152,10 +153,13 @@
     @Override
     public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
         super.onCreateOptionsMenu(menu, inflater);
-        inflater.inflate(R.menu.nfc_payment_settings, menu);
-        MenuItem menuItem = menu.findItem(R.id.nfc_payment_menu_item_add_service);
-        menuItem.setIntent(new Intent(Intent.ACTION_VIEW,
-                Uri.parse(getString(R.string.download_nfc_payment_service_query))));
+        String searchUri = Settings.Secure.getString(getContentResolver(),
+                Settings.Secure.PAYMENT_SERVICE_SEARCH_URI);
+        if (!TextUtils.isEmpty(searchUri)) {
+            MenuItem menuItem = menu.add(R.string.nfc_payment_menu_item_add_service);
+            menuItem.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+            menuItem.setIntent(new Intent(Intent.ACTION_VIEW,Uri.parse(searchUri)));
+        }
     }
 
     private final Handler mHandler = new Handler() {
diff --git a/src/com/android/settings/print/PrintJobSettingsFragment.java b/src/com/android/settings/print/PrintJobSettingsFragment.java
index 99499c8..b4d517d 100644
--- a/src/com/android/settings/print/PrintJobSettingsFragment.java
+++ b/src/com/android/settings/print/PrintJobSettingsFragment.java
@@ -153,10 +153,12 @@
 
         if (mPrintJob == null) {
             finish();
+            return;
         }
 
         if (mPrintJob.isCancelled() || mPrintJob.isCompleted()) {
             finish();
+            return;
         }
 
         PrintJobInfo info = mPrintJob.getInfo();
diff --git a/src/com/android/settings/print/PrintServiceSettingsFragment.java b/src/com/android/settings/print/PrintServiceSettingsFragment.java
index 9db2dec..044d86e 100644
--- a/src/com/android/settings/print/PrintServiceSettingsFragment.java
+++ b/src/com/android/settings/print/PrintServiceSettingsFragment.java
@@ -95,6 +95,7 @@
         @Override
         public void onChanged() {
             invalidateOptionsMenuIfNeeded();
+            updateEmptyView();
         }
 
         @Override
@@ -227,14 +228,15 @@
         ViewGroup contentRoot = (ViewGroup) listView.getParent();
         View emptyView = listView.getEmptyView();
         if (!mToggleSwitch.isChecked()) {
-            if (emptyView != null
-                    && emptyView.getId() != R.id.empty_printers_list_service_disabled) {
+            if (emptyView != null && emptyView.getId() != R.id.empty_print_state) {
                 contentRoot.removeView(emptyView);
                 emptyView = null;
             }
             if (emptyView == null) {
                 emptyView = getActivity().getLayoutInflater().inflate(
                         R.layout.empty_print_state, contentRoot, false);
+                ImageView iconView = (ImageView) emptyView.findViewById(R.id.icon);
+                iconView.setContentDescription(getString(R.string.print_service_disabled));
                 TextView textView = (TextView) emptyView.findViewById(R.id.message);
                 textView.setText(R.string.print_service_disabled);
                 contentRoot.addView(emptyView);
@@ -252,6 +254,21 @@
                 contentRoot.addView(emptyView);
                 listView.setEmptyView(emptyView);
             }
+        } else if (mPrintersAdapter.getCount() <= 0) {
+            if (emptyView != null && emptyView.getId() != R.id.empty_print_state) {
+                contentRoot.removeView(emptyView);
+                emptyView = null;
+            }
+            if (emptyView == null) {
+                emptyView = getActivity().getLayoutInflater().inflate(
+                        R.layout.empty_print_state, contentRoot, false);
+                ImageView iconView = (ImageView) emptyView.findViewById(R.id.icon);
+                iconView.setContentDescription(getString(R.string.print_no_printers_found));
+                TextView textView = (TextView) emptyView.findViewById(R.id.message);
+                textView.setText(R.string.print_no_printers_found);
+                contentRoot.addView(emptyView);
+                listView.setEmptyView(emptyView);
+            }
         }
     }
 
diff --git a/src/com/android/settings/print/PrintSettingsFragment.java b/src/com/android/settings/print/PrintSettingsFragment.java
index 84865c3..8d080ce 100644
--- a/src/com/android/settings/print/PrintSettingsFragment.java
+++ b/src/com/android/settings/print/PrintSettingsFragment.java
@@ -150,10 +150,13 @@
     @Override
     public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
         super.onCreateOptionsMenu(menu, inflater);
-        inflater.inflate(R.menu.print_settings, menu);
-        MenuItem menuItem = menu.findItem(R.id.print_menu_item_add_service);
-        menuItem.setIntent(new Intent(Intent.ACTION_VIEW,
-                Uri.parse(getString(R.string.download_print_service_query))));
+        String searchUri = Settings.Secure.getString(getContentResolver(),
+                Settings.Secure.PRINT_SERVICE_SEARCH_URI);
+        if (!TextUtils.isEmpty(searchUri)) {
+            MenuItem menuItem = menu.add(R.string.print_menu_item_add_service);
+            menuItem.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+            menuItem.setIntent(new Intent(Intent.ACTION_VIEW,Uri.parse(searchUri)));
+        }
     }
 
     @Override