Merge "Fix: 'Make profile pattern visible'" into nyc-dev
diff --git a/res/menu/zen_settings_menu.xml b/res/menu/zen_settings_menu.xml
deleted file mode 100644
index ff28403..0000000
--- a/res/menu/zen_settings_menu.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 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/zen_access"
-        android:title="@string/manage_zen_access_title"
-        android:showAsAction="never" />
-</menu>
diff --git a/res/xml/configure_notification_settings.xml b/res/xml/configure_notification_settings.xml
index cb93792..3574aed 100644
--- a/res/xml/configure_notification_settings.xml
+++ b/res/xml/configure_notification_settings.xml
@@ -30,17 +30,4 @@
             android:title="@string/lock_screen_notifications_title"
             android:summary="%s" />
 
-    <PreferenceCategory
-        android:key="advanced"
-        android:title="@string/advanced_section_header" >
-
-        <!-- Notification access -->
-        <Preference
-                android:key="manage_notification_access"
-                android:title="@string/manage_notification_access_title"
-                android:persistent="false"
-                android:fragment="com.android.settings.notification.NotificationAccessSettings" />
-
-    </PreferenceCategory>
-
 </PreferenceScreen>
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index 068d534..d604473 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -54,6 +54,7 @@
 import android.os.StrictMode;
 import android.os.SystemProperties;
 import android.os.UserHandle;
+import android.service.persistentdata.PersistentDataBlockManager;
 import android.os.UserManager;
 import android.os.storage.IMountService;
 import android.provider.SearchIndexableResource;
@@ -221,6 +222,7 @@
     private DevicePolicyManager mDpm;
     private UserManager mUm;
     private WifiManager mWifiManager;
+    private PersistentDataBlockManager mOemUnlockManager;
 
     private SwitchBar mSwitchBar;
     private boolean mLastEnabledState;
@@ -328,6 +330,8 @@
                 ServiceManager.getService(Context.BACKUP_SERVICE));
         mWebViewUpdateService  =
             IWebViewUpdateService.Stub.asInterface(ServiceManager.getService("webviewupdate"));
+        mOemUnlockManager = (PersistentDataBlockManager)getActivity()
+                .getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
 
         mDpm = (DevicePolicyManager)getActivity().getSystemService(Context.DEVICE_POLICY_SERVICE);
         mUm = (UserManager) getSystemService(Context.USER_SERVICE);
@@ -999,9 +1003,13 @@
         return !SystemProperties.get(PERSISTENT_DATA_BLOCK_PROP).equals("");
     }
 
-    private static boolean enableOemUnlockPreference() {
-        String flashLocked = SystemProperties.get(FLASH_LOCKED_PROP);
-        return !"0".equals(flashLocked);
+    private boolean enableOemUnlockPreference() {
+        int flashLockState = PersistentDataBlockManager.FLASH_LOCK_UNKNOWN;
+        if (mOemUnlockManager != null) {
+            flashLockState = mOemUnlockManager.getFlashLockState();
+        }
+
+        return flashLockState == PersistentDataBlockManager.FLASH_LOCK_LOCKED;
     }
 
     private void updateOemUnlockOptions() {
diff --git a/src/com/android/settings/notification/ZenModeSettings.java b/src/com/android/settings/notification/ZenModeSettings.java
index 297029e..8cca84f 100644
--- a/src/com/android/settings/notification/ZenModeSettings.java
+++ b/src/com/android/settings/notification/ZenModeSettings.java
@@ -78,23 +78,6 @@
         updateVisualSettingsSummary();
     }
 
-    @Override
-    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
-        inflater.inflate(R.menu.zen_settings_menu, menu);
-    }
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        switch (item.getItemId()) {
-            case R.id.zen_access:
-                ((SettingsActivity) getActivity()).startPreferencePanel(
-                            ZenAccessSettings.class.getCanonicalName(), null,
-                            R.string.manage_zen_access_title, null, this, 0);
-                return true;
-        }
-        return super.onOptionsItemSelected(item);
-    }
-
     private void updatePrioritySettingsSummary() {
         String s = getResources().getString(R.string.zen_mode_alarms);
         s = appendLowercase(s, isCategoryEnabled(mPolicy, Policy.PRIORITY_CATEGORY_REMINDERS),