Add isSafeModeEnabled() API to WindowManagerService

This adds a means of determining when the device is in safe mode,
as required by keyguard to disabled some features.

Change-Id: I31d357e6738c92e1837f9e0263e5f3f4de66315a
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl
index 5f598b1..fdaf39e 100644
--- a/core/java/android/view/IWindowManager.aidl
+++ b/core/java/android/view/IWindowManager.aidl
@@ -254,4 +254,9 @@
      * Gets the infos for all visible windows.
      */
     void getVisibleWindowsForDisplay(int displayId, out List<WindowInfo> outInfos);
+
+    /**
+     * Device is in safe mode.
+     */
+    boolean isSafeModeEnabled();
 }
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index 06594090..4659c9d 100755
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -10347,6 +10347,10 @@
     public void lockNow(Bundle options) {
         mPolicy.lockNow(options);
     }
+    
+    public boolean isSafeModeEnabled() {
+        return mSafeMode;
+    }
 
     void dumpPolicyLocked(PrintWriter pw, String[] args, boolean dumpAll) {
         pw.println("WINDOW MANAGER POLICY STATE (dumpsys window policy)");
diff --git a/tools/layoutlib/bridge/src/android/view/IWindowManagerImpl.java b/tools/layoutlib/bridge/src/android/view/IWindowManagerImpl.java
index da736b7..fa2cb50 100644
--- a/tools/layoutlib/bridge/src/android/view/IWindowManagerImpl.java
+++ b/tools/layoutlib/bridge/src/android/view/IWindowManagerImpl.java
@@ -446,6 +446,11 @@
     public void lockNow(Bundle options) {
         // TODO Auto-generated method stub
     }
+    
+    @Override
+    public boolean isSafeModeEnabled() {
+        return false;
+    }
 
     @Override
     public IBinder getFocusedWindowToken() {