OSDN Git Service

Hide ongoing notification icon when the screen is locked.
authorsatok <satok@google.com>
Mon, 2 Apr 2012 10:33:47 +0000 (19:33 +0900)
committersatok <satok@google.com>
Mon, 2 Apr 2012 10:54:28 +0000 (19:54 +0900)
Bug: 5858903
Change-Id: Ibee9123f4a520e77f4baf8bdd3d75364ab451100

services/java/com/android/server/InputMethodManagerService.java

index c705646..96ee2f0 100644 (file)
@@ -1132,6 +1132,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
 
     private boolean needsToShowImeSwitchOngoingNotification() {
         if (!mShowOngoingImeSwitcherForPhones) return false;
+        if (isScreenLocked()) return false;
         synchronized (mMethodMap) {
             List<InputMethodInfo> imis = mSettings.getEnabledInputMethodListLocked();
             final int N = imis.size();
@@ -2148,15 +2149,18 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
         mContext.startActivity(intent);
     }
 
+    private boolean isScreenLocked() {
+        return mKeyguardManager != null
+                && mKeyguardManager.isKeyguardLocked() && mKeyguardManager.isKeyguardSecure();
+    }
     private void showInputMethodMenuInternal(boolean showSubtypes) {
         if (DEBUG) Slog.v(TAG, "Show switching menu");
 
         final Context context = mContext;
         final PackageManager pm = context.getPackageManager();
-        final boolean isScreenLocked = mKeyguardManager != null
-                && mKeyguardManager.isKeyguardLocked() && mKeyguardManager.isKeyguardSecure();
+        final boolean isScreenLocked = isScreenLocked();
 
-        String lastInputMethodId = Settings.Secure.getString(context
+        final String lastInputMethodId = Settings.Secure.getString(context
                 .getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
         int lastInputMethodSubtypeId = getSelectedInputMethodSubtypeId(lastInputMethodId);
         if (DEBUG) Slog.v(TAG, "Current IME: " + lastInputMethodId);