Merge "Remove unused and unnecessary code from subtype enabler" into lmp-dev
diff --git a/res/layout/managed_service_item.xml b/res/layout/managed_service_item.xml
index 67aaa61..f05c77f 100644
--- a/res/layout/managed_service_item.xml
+++ b/res/layout/managed_service_item.xml
@@ -22,7 +22,8 @@
     android:layout_height="wrap_content"
     android:minHeight="?android:attr/listPreferredItemHeight"
     android:orientation="horizontal"
-    android:paddingEnd="6dip"
+    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
     android:gravity="center_vertical"
     >
 
@@ -69,7 +70,6 @@
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_gravity="center_vertical"
-        android:layout_marginEnd="16dip"
         android:layout_marginStart="16dip"
         android:focusable="false"
         android:clickable="false" />
diff --git a/res/layout/managed_service_settings.xml b/res/layout/managed_service_settings.xml
index e01da59..b2fc0b2 100644
--- a/res/layout/managed_service_settings.xml
+++ b/res/layout/managed_service_settings.xml
@@ -18,19 +18,27 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:orientation="vertical">
+
     <FrameLayout
             android:layout_width="match_parent"
             android:layout_height="0px"
             android:layout_weight="1">
+
         <ListView android:id="@android:id/list"
                 android:layout_width="match_parent" 
                 android:layout_height="match_parent"
+                android:paddingStart="@dimen/settings_side_margin"
+                android:paddingEnd="@dimen/settings_side_margin"
                 android:drawSelectorOnTop="false"
-                android:fastScrollEnabled="true" />
+                android:fastScrollEnabled="true"
+                android:scrollbarStyle="outsideInset" />
+
         <TextView android:id="@android:id/empty"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
                 android:gravity="center"
                 android:textAppearance="?android:attr/textAppearanceMedium" />
+
     </FrameLayout>
+
 </LinearLayout>
diff --git a/res/layout/notification_app.xml b/res/layout/notification_app.xml
index 6818a45..9442de6 100644
--- a/res/layout/notification_app.xml
+++ b/res/layout/notification_app.xml
@@ -15,7 +15,9 @@
 -->
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
-    android:layout_height="wrap_content" >
+    android:layout_height="wrap_content"
+    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
 
     <RelativeLayout
         android:id="@android:id/button1"
@@ -23,7 +25,7 @@
         android:layout_height="wrap_content"
         android:layout_alignWithParentIfMissing="true"
         android:layout_toStartOf="@+id/settings_divider"
-        android:background="?android:attr/listChoiceBackgroundIndicator" >
+        android:background="?android:attr/listChoiceBackgroundIndicator">
 
         <ImageView
             android:id="@android:id/icon"
diff --git a/res/layout/notification_app_list.xml b/res/layout/notification_app_list.xml
index 2c5ab40..2eac287 100644
--- a/res/layout/notification_app_list.xml
+++ b/res/layout/notification_app_list.xml
@@ -18,16 +18,16 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:orientation="vertical"
-    android:paddingStart="?android:attr/listPreferredItemPaddingStart">
+    android:orientation="vertical">
 
     <ListView
         android:id="@android:id/list"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
+        android:paddingStart="@dimen/settings_side_margin"
+        android:paddingEnd="@dimen/settings_side_margin"
         android:divider="#0000"
         android:dividerHeight="0px"
-        android:fastScrollAlwaysVisible="true"
         android:fastScrollEnabled="true"
         android:listSelector="#0000"
         android:scrollbarStyle="outsideInset" />
diff --git a/res/layout/screen_pinning_instructions.xml b/res/layout/screen_pinning_instructions.xml
new file mode 100644
index 0000000..22b2b37
--- /dev/null
+++ b/res/layout/screen_pinning_instructions.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2014, 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.
+*/
+-->
+
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/instructions_area"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    android:paddingStart="@dimen/screen_margin_sides"
+    android:paddingEnd="@dimen/screen_margin_sides">
+
+    <TextView
+        android:id="@+id/screen_pinning_description"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignParentTop="true"
+        android:paddingTop="@dimen/screen_pinning_textview_padding"
+        android:text="@string/screen_pinning_description"
+        android:textAppearance="@style/TextAppearance.Medium"
+        />
+
+</LinearLayout>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 2064e19..b7b2af0 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -183,4 +183,7 @@
     <!-- CryptKeeper pattern size for tablet -->
     <dimen name="crypt_keeper_pattern_size">354dip</dimen>
 
+    <!-- Screen pinning textview paddings -->
+    <dimen name="screen_pinning_textview_padding">40dp</dimen>
+
 </resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 90fcf5c..a16c791 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -5768,4 +5768,10 @@
     <!-- Switch On/Off  -->
     <string name="switch_on_text">On</string>
     <string name="switch_off_text">Off</string>
+
+    <!-- [CHAR LIMIT=28] Screen pinning title -->
+    <string name="screen_pinning_title">Screen pinning</string>
+    <!-- [CHAR LIMIT=300] Screen pinning description -->
+    <string name="screen_pinning_description">When this setting is turned on, you can put the device in a state that keeps the current screen in view.\n\nTo pin a screen:\n\n1. Turn this setting on.\n\n2. Open an app.\n\n3. Touch the Recents button.\n\n4. Touch the pin icon.</string>
+
 </resources>
diff --git a/res/xml/security_settings_misc.xml b/res/xml/security_settings_misc.xml
index c8f3e02..1fa8b9a 100644
--- a/res/xml/security_settings_misc.xml
+++ b/res/xml/security_settings_misc.xml
@@ -23,10 +23,13 @@
         <Preference android:key="sim_lock_settings"
                 android:title="@string/sim_lock_settings_category"
                 android:persistent="false">
+
             <intent android:action="android.intent.action.MAIN"
                     android:targetPackage="com.android.settings"
                     android:targetClass="com.android.settings.IccLockSettings"/>
+
         </Preference>
+
     </PreferenceCategory>
 
     <PreferenceCategory android:title="@string/security_passwords_title"
@@ -35,6 +38,7 @@
         <CheckBoxPreference android:key="show_password"
                 android:title="@string/show_password"
                 android:persistent="false"/>
+
     </PreferenceCategory>
 
     <PreferenceCategory android:key="device_admin_category"
@@ -58,11 +62,13 @@
                 android:summaryOff="@string/verify_applications_summary"
                 android:summaryOn="@string/verify_applications_summary"
                 android:persistent="false" />
+
     </PreferenceCategory>
 
     <PreferenceCategory android:key="credentials_management"
             android:title="@string/credentials_title"
             android:persistent="false">
+
         <Preference android:key="credential_storage_type"
                 android:title="@string/credential_storage_type"
                 style="?android:attr/preferenceInformationStyle"
@@ -78,28 +84,42 @@
                 android:title="@string/credentials_install"
                 android:summary="@string/credentials_install_summary"
                 android:persistent="false">
+
             <intent android:action="android.credentials.INSTALL"
                     android:targetPackage="com.android.certinstaller"
                     android:targetClass="com.android.certinstaller.CertInstallerMain"/>
+
         </Preference>
 
         <Preference android:key="credentials_reset"
                 android:title="@string/credentials_reset"
                 android:summary="@string/credentials_reset_summary"
                 android:persistent="false">
+
             <intent android:action="com.android.credentials.RESET"
                     android:targetPackage="com.android.settings"
                     android:targetClass="com.android.settings.CredentialStorage"/>
+
         </Preference>
+
     </PreferenceCategory>
 
     <PreferenceCategory android:key="advanced_security"
             android:title="@string/advanced_security_title"
             android:persistent="false">
+
         <Preference android:key="manage_trust_agents"
                 android:title="@string/manage_trust_agents"
                 android:summary="@string/manage_trust_agents_summary"
                 android:persistent="false"
                 android:fragment="com.android.settings.AdvancedSecuritySettings"/>
+
+        <PreferenceScreen
+                android:key="screen_pinning_settings"
+                android:title="@string/screen_pinning_title"
+                android:summary="@string/switch_off_text"
+                android:fragment="com.android.settings.ScreenPinningSettings"/>
+
     </PreferenceCategory>
+
 </PreferenceScreen>
diff --git a/src/com/android/settings/ScreenPinningSettings.java b/src/com/android/settings/ScreenPinningSettings.java
new file mode 100644
index 0000000..ada5b17
--- /dev/null
+++ b/src/com/android/settings/ScreenPinningSettings.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2014 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;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.os.Bundle;
+import android.provider.Settings;
+import android.provider.Settings.SettingNotFoundException;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Switch;
+
+import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settings.search.Indexable;
+import com.android.settings.search.SearchIndexableRaw;
+import com.android.settings.widget.SwitchBar;
+
+/**
+ * Screen pinning settings.
+ */
+public class ScreenPinningSettings extends SettingsPreferenceFragment
+        implements SwitchBar.OnSwitchChangeListener, Indexable {
+
+    private SwitchBar mSwitchBar;
+
+    @Override
+    public void onActivityCreated(Bundle savedInstanceState) {
+        super.onActivityCreated(savedInstanceState);
+
+        final SettingsActivity activity = (SettingsActivity) getActivity();
+
+        mSwitchBar = activity.getSwitchBar();
+        mSwitchBar.addOnSwitchChangeListener(this);
+        mSwitchBar.show();
+        mSwitchBar.setChecked(isLockToAppEnabled());
+    }
+
+    @Override
+    public void onDestroyView() {
+        super.onDestroyView();
+
+        mSwitchBar.removeOnSwitchChangeListener(this);
+        mSwitchBar.hide();
+    }
+
+    @Override
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+            Bundle savedInstanceState) {
+        return inflater.inflate(R.layout.screen_pinning_instructions, null);
+    }
+
+    private boolean isLockToAppEnabled() {
+        try {
+            return Settings.System.getInt(getContentResolver(), Settings.System.LOCK_TO_APP_ENABLED)
+                != 0;
+        } catch (SettingNotFoundException e) {
+            return false;
+        }
+    }
+
+    private void setLockToAppEnabled(boolean isEnabled) {
+        Settings.System.putInt(getContentResolver(), Settings.System.LOCK_TO_APP_ENABLED,
+                isEnabled ? 1 : 0);
+    }
+
+    /**
+     * Listens to the state change of the lock-to-app master switch.
+     */
+    @Override
+    public void onSwitchChanged(Switch switchView, boolean isChecked) {
+        setLockToAppEnabled(isChecked);
+    }
+
+    /**
+     * For search
+     */
+    public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+        new BaseSearchIndexProvider() {
+            @Override
+            public List<SearchIndexableRaw> getRawDataToIndex(Context context, boolean enabled) {
+                final List<SearchIndexableRaw> result = new ArrayList<SearchIndexableRaw>();
+
+                final Resources res = context.getResources();
+
+                // Add fragment title
+                SearchIndexableRaw data = new SearchIndexableRaw(context);
+                data.title = res.getString(R.string.screen_pinning_title);
+                data.screenTitle = res.getString(R.string.screen_pinning_title);
+                result.add(data);
+
+                // Screen pinning description.
+                data = new SearchIndexableRaw(context);
+                data.title = res.getString(R.string.screen_pinning_description);
+                data.screenTitle = res.getString(R.string.screen_pinning_title);
+                result.add(data);
+
+                return result;
+            }
+        };
+}
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index 6961b2a..30fe74a 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -17,8 +17,6 @@
 package com.android.settings;
 
 
-import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
-
 import android.app.Activity;
 import android.app.AlertDialog;
 import android.app.admin.DevicePolicyManager;
@@ -41,6 +39,7 @@
 import android.preference.PreferenceScreen;
 import android.provider.SearchIndexableResource;
 import android.provider.Settings;
+import android.provider.Settings.SettingNotFoundException;
 import android.security.KeyStore;
 import android.service.trust.TrustAgentService;
 import android.telephony.TelephonyManager;
@@ -55,6 +54,8 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
+
 /**
  * Gesture lock pattern settings.
  */
@@ -93,6 +94,7 @@
     private static final String KEY_CREDENTIALS_MANAGER = "credentials_management";
     private static final String PACKAGE_MIME_TYPE = "application/vnd.android.package-archive";
     private static final String KEY_TRUST_AGENT = "trust_agent";
+    private static final String KEY_SCREEN_PINNING = "screen_pinning_settings";
 
     private DevicePolicyManager mDPM;
 
@@ -296,6 +298,15 @@
                 root.findPreference(KEY_SIM_LOCK).setEnabled(false);
             }
         }
+        try {
+            if (Settings.System.getInt(getContentResolver(), Settings.System.LOCK_TO_APP_ENABLED)
+                    != 0) {
+                root.findPreference(KEY_SCREEN_PINNING).setSummary(
+                        getResources().getString(R.string.switch_on_text));
+            }
+        } catch (SettingNotFoundException e) {
+            Log.w(TAG, "No Lock-to-app enabled setting", e);
+        }
 
         // Show password
         mShowPassword = (CheckBoxPreference) root.findPreference(KEY_SHOW_PASSWORD);
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index bb13fc3..b227c6b 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -81,6 +81,8 @@
 import com.android.settings.deviceinfo.UsbSettings;
 import com.android.settings.fuelgauge.BatterySaverSettings;
 import com.android.settings.fuelgauge.PowerUsageSummary;
+import com.android.settings.notification.AppNotificationSettings;
+import com.android.settings.notification.OtherSoundSettings;
 import com.android.settings.search.DynamicIndexableContentMonitor;
 import com.android.settings.search.Index;
 import com.android.settings.inputmethod.InputMethodAndLanguageSettings;
@@ -278,6 +280,8 @@
             ChooseLockPattern.ChooseLockPatternFragment.class.getName(),
             InstalledAppDetails.class.getName(),
             BatterySaverSettings.class.getName(),
+            AppNotificationSettings.class.getName(),
+            OtherSoundSettings.class.getName()
     };
 
 
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index 724c751..cd5dec7 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -390,6 +390,15 @@
         }
     }
 
+    public static void forceCustomPadding(View view) {
+        final Resources res = view.getResources();
+        final int paddingSide = res.getDimensionPixelSize(R.dimen.settings_side_margin);
+        final int paddingBottom = res.getDimensionPixelSize(
+                com.android.internal.R.dimen.preference_fragment_padding_bottom);
+
+        view.setPaddingRelative(paddingSide, 0, paddingSide, paddingBottom);
+    }
+
     /**
      * Return string resource that best describes combination of tethering
      * options available on this device.
diff --git a/src/com/android/settings/applications/InstalledAppDetails.java b/src/com/android/settings/applications/InstalledAppDetails.java
index aa1c010..fc4d37d 100755
--- a/src/com/android/settings/applications/InstalledAppDetails.java
+++ b/src/com/android/settings/applications/InstalledAppDetails.java
@@ -452,17 +452,19 @@
     public View onCreateView(
             LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
         final View view = inflater.inflate(R.layout.installed_app_details, container, false);
-        Utils.prepareCustomPreferencesList(container, view, view, false);
+
+        final ViewGroup allDetails = (ViewGroup) view.findViewById(R.id.all_details);
+        Utils.forceCustomPadding(allDetails);
 
         mRootView = view;
         mComputingStr = getActivity().getText(R.string.computing_size);
         
         // Set default values on sizes
-        mTotalSize = (TextView)view.findViewById(R.id.total_size_text);
-        mAppSize = (TextView)view.findViewById(R.id.application_size_text);
-        mDataSize = (TextView)view.findViewById(R.id.data_size_text);
-        mExternalCodeSize = (TextView)view.findViewById(R.id.external_code_size_text);
-        mExternalDataSize = (TextView)view.findViewById(R.id.external_data_size_text);
+        mTotalSize = (TextView) view.findViewById(R.id.total_size_text);
+        mAppSize = (TextView) view.findViewById(R.id.application_size_text);
+        mDataSize = (TextView) view.findViewById(R.id.data_size_text);
+        mExternalCodeSize = (TextView) view.findViewById(R.id.external_code_size_text);
+        mExternalDataSize = (TextView) view.findViewById(R.id.external_data_size_text);
 
         if (Environment.isExternalStorageEmulated()) {
             ((View)mExternalCodeSize.getParent()).setVisibility(View.GONE);
@@ -473,13 +475,13 @@
         View btnPanel = view.findViewById(R.id.control_buttons_panel);
         mForceStopButton = (Button) btnPanel.findViewById(R.id.left_button);
         mForceStopButton.setText(R.string.force_stop);
-        mUninstallButton = (Button)btnPanel.findViewById(R.id.right_button);
+        mUninstallButton = (Button) btnPanel.findViewById(R.id.right_button);
         mForceStopButton.setEnabled(false);
         
         // Get More Control button panel
         mMoreControlButtons = view.findViewById(R.id.more_control_buttons_panel);
         mMoreControlButtons.findViewById(R.id.left_button).setVisibility(View.INVISIBLE);
-        mSpecialDisableButton = (Button)mMoreControlButtons.findViewById(R.id.right_button);
+        mSpecialDisableButton = (Button) mMoreControlButtons.findViewById(R.id.right_button);
         mMoreControlButtons.setVisibility(View.GONE);
         
         // Initialize clear data and move install location buttons
@@ -491,12 +493,12 @@
         mCacheSize = (TextView) view.findViewById(R.id.cache_size_text);
         mClearCacheButton = (Button) view.findViewById(R.id.clear_cache_button);
 
-        mActivitiesButton = (Button)view.findViewById(R.id.clear_activities_button);
+        mActivitiesButton = (Button) view.findViewById(R.id.clear_activities_button);
         
         // Screen compatibility control
         mScreenCompatSection = view.findViewById(R.id.screen_compatibility_section);
-        mAskCompatibilityCB = (CheckBox)view.findViewById(R.id.ask_compatibility_cb);
-        mEnableCompatibilityCB = (CheckBox)view.findViewById(R.id.enable_compatibility_cb);
+        mAskCompatibilityCB = (CheckBox) view.findViewById(R.id.ask_compatibility_cb);
+        mEnableCompatibilityCB = (CheckBox) view.findViewById(R.id.enable_compatibility_cb);
         
         mNotificationSwitch = (CompoundButton) view.findViewById(R.id.notification_switch);
 
diff --git a/src/com/android/settings/notification/ManagedServiceSettings.java b/src/com/android/settings/notification/ManagedServiceSettings.java
index 880ecde..7be644e 100644
--- a/src/com/android/settings/notification/ManagedServiceSettings.java
+++ b/src/com/android/settings/notification/ManagedServiceSettings.java
@@ -60,7 +60,7 @@
     private ContentResolver mCR;
 
     private final HashSet<ComponentName> mEnabledServices = new HashSet<ComponentName>();
-    private ServiceListAdapter mList;
+    private ServiceListAdapter mListAdapter;
 
     abstract protected Config getConfig();
 
@@ -130,7 +130,7 @@
 
         mPM = getActivity().getPackageManager();
         mCR = getActivity().getContentResolver();
-        mList = new ServiceListAdapter(getActivity());
+        mListAdapter = new ServiceListAdapter(getActivity());
     }
 
     @Override
@@ -200,10 +200,10 @@
     private void updateList() {
         loadEnabledServices();
 
-        getServices(mConfig, mList, mPM);
-        mList.sort(new PackageItemInfo.DisplayNameComparator(mPM));
+        getServices(mConfig, mListAdapter, mPM);
+        mListAdapter.sort(new PackageItemInfo.DisplayNameComparator(mPM));
 
-        getListView().setAdapter(mList);
+        getListView().setAdapter(mListAdapter);
     }
 
     protected static int getEnabledServicesCount(Config config, Context context) {
@@ -255,7 +255,7 @@
 
     @Override
     public void onListItemClick(ListView l, View v, int position, long id) {
-        ServiceInfo info = mList.getItem(position);
+        ServiceInfo info = mListAdapter.getItem(position);
         final ComponentName cn = new ComponentName(info.packageName, info.name);
         if (mEnabledServices.contains(cn)) {
             // the simple version: disabling
diff --git a/src/com/android/settings/search/Ranking.java b/src/com/android/settings/search/Ranking.java
index ba38d53..96e057e 100644
--- a/src/com/android/settings/search/Ranking.java
+++ b/src/com/android/settings/search/Ranking.java
@@ -23,6 +23,7 @@
 import com.android.settings.DeviceInfoSettings;
 import com.android.settings.DisplaySettings;
 import com.android.settings.HomeSettings;
+import com.android.settings.ScreenPinningSettings;
 import com.android.settings.PrivacySettings;
 import com.android.settings.SecuritySettings;
 import com.android.settings.WallpaperTypeSettings;
@@ -129,6 +130,7 @@
         // Security
         sRankMap.put(SecuritySettings.class.getName(), RANK_SECURITY);
         sRankMap.put(ChooseLockGeneric.ChooseLockGenericFragment.class.getName(), RANK_SECURITY);
+        sRankMap.put(ScreenPinningSettings.class.getName(), RANK_SECURITY);
 
         // IMEs
         sRankMap.put(InputMethodAndLanguageSettings.class.getName(), RANK_IME);
diff --git a/src/com/android/settings/search/SearchIndexableResources.java b/src/com/android/settings/search/SearchIndexableResources.java
index e2b1d48..228381f 100644
--- a/src/com/android/settings/search/SearchIndexableResources.java
+++ b/src/com/android/settings/search/SearchIndexableResources.java
@@ -25,6 +25,7 @@
 import com.android.settings.DeviceInfoSettings;
 import com.android.settings.DisplaySettings;
 import com.android.settings.HomeSettings;
+import com.android.settings.ScreenPinningSettings;
 import com.android.settings.PrivacySettings;
 import com.android.settings.R;
 import com.android.settings.SecuritySettings;
@@ -207,6 +208,13 @@
                         ChooseLockGeneric.ChooseLockGenericFragment.class.getName(),
                         R.drawable.ic_settings_security));
 
+        sResMap.put(ScreenPinningSettings.class.getName(),
+                new SearchIndexableResource(
+                        Ranking.getRankForClassName(ScreenPinningSettings.class.getName()),
+                        NO_DATA_RES_ID,
+                        ScreenPinningSettings.class.getName(),
+                        R.drawable.ic_settings_security));
+
         sResMap.put(InputMethodAndLanguageSettings.class.getName(),
                 new SearchIndexableResource(
                         Ranking.getRankForClassName(InputMethodAndLanguageSettings.class.getName()),
diff --git a/src/com/android/settings/users/AppRestrictionsFragment.java b/src/com/android/settings/users/AppRestrictionsFragment.java
index d1a5de3..56368ef 100644
--- a/src/com/android/settings/users/AppRestrictionsFragment.java
+++ b/src/com/android/settings/users/AppRestrictionsFragment.java
@@ -386,12 +386,12 @@
                         Log.d(TAG, "Installing " + packageName);
                     }
                 }
-                if (info != null && (info.flags&ApplicationInfo.FLAG_BLOCKED) != 0
+                if (info != null && (info.flags&ApplicationInfo.FLAG_HIDDEN) != 0
                         && (info.flags&ApplicationInfo.FLAG_INSTALLED) != 0) {
                     disableUiForPackage(packageName);
-                    mIPm.setApplicationBlockedSettingAsUser(packageName, false, userId);
+                    mIPm.setApplicationHiddenSettingAsUser(packageName, false, userId);
                     if (DEBUG) {
-                        Log.d(TAG, "Unblocking " + packageName);
+                        Log.d(TAG, "Unhiding " + packageName);
                     }
                 }
             } catch (RemoteException re) {
@@ -409,9 +409,9 @@
                         }
                     } else {
                         disableUiForPackage(packageName);
-                        mIPm.setApplicationBlockedSettingAsUser(packageName, true, userId);
+                        mIPm.setApplicationHiddenSettingAsUser(packageName, true, userId);
                         if (DEBUG) {
-                            Log.d(TAG, "Blocking " + packageName);
+                            Log.d(TAG, "Hiding " + packageName);
                         }
                     }
                 }
@@ -653,9 +653,9 @@
     private boolean isAppEnabledForUser(PackageInfo pi) {
         if (pi == null) return false;
         final int flags = pi.applicationInfo.flags;
-        // Return true if it is installed and not blocked
+        // Return true if it is installed and not hidden
         return ((flags&ApplicationInfo.FLAG_INSTALLED) != 0
-                && (flags&ApplicationInfo.FLAG_BLOCKED) == 0);
+                && (flags&ApplicationInfo.FLAG_HIDDEN) == 0);
     }
 
     private void populateApps() {