diff options
Diffstat (limited to 'services/java/com/android')
-rw-r--r-- | services/java/com/android/server/InputMethodManagerService.java | 4 | ||||
-rw-r--r-- | services/java/com/android/server/am/ActivityManagerService.java | 45 | ||||
-rw-r--r-- | services/java/com/android/server/updatable/ConfigUpdateInstallReceiver.java (renamed from services/java/com/android/server/updates/ConfigUpdateInstallReceiver.java) | 0 | ||||
-rw-r--r-- | services/java/com/android/server/updates/CertPinInstallReceiver.java | 24 |
4 files changed, 46 insertions, 27 deletions
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java index 8eb61dd..cd920b1 100644 --- a/services/java/com/android/server/InputMethodManagerService.java +++ b/services/java/com/android/server/InputMethodManagerService.java @@ -602,12 +602,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub mHandler = new Handler(this); mIWindowManager = IWindowManager.Stub.asInterface( ServiceManager.getService(Context.WINDOW_SERVICE)); - mCaller = new HandlerCaller(context, new HandlerCaller.Callback() { + mCaller = new HandlerCaller(context, null, new HandlerCaller.Callback() { @Override public void executeMessage(Message msg) { handleMessage(msg); } - }); + }, true /*asyncHandler*/); mWindowManagerService = windowManager; mHardKeyboardListener = new HardKeyboardListener(); diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index 49dc220..2ba9a10 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -115,6 +115,7 @@ import android.os.ServiceManager; import android.os.StrictMode; import android.os.SystemClock; import android.os.SystemProperties; +import android.os.UpdateLock; import android.os.UserHandle; import android.provider.Settings; import android.text.format.Time; @@ -191,6 +192,7 @@ public final class ActivityManagerService extends ActivityManagerNative static final boolean DEBUG_POWER = localLOGV || false; static final boolean DEBUG_POWER_QUICK = DEBUG_POWER || false; static final boolean DEBUG_MU = localLOGV || false; + static final boolean DEBUG_IMMERSIVE = localLOGV || false; static final boolean VALIDATE_TOKENS = false; static final boolean SHOW_ACTIVITY_START_TIME = true; @@ -827,6 +829,12 @@ public final class ActivityManagerService extends ActivityManagerNative long mLastWriteTime = 0; /** + * Used to retain an update lock when the foreground activity is in + * immersive mode. + */ + final UpdateLock mUpdateLock = new UpdateLock("immersive"); + + /** * Set to true after the system has finished booting. */ boolean mBooted = false; @@ -895,6 +903,7 @@ public final class ActivityManagerService extends ActivityManagerNative static final int REPORT_USER_SWITCH_MSG = 34; static final int CONTINUE_USER_SWITCH_MSG = 35; static final int USER_SWITCH_TIMEOUT_MSG = 36; + static final int IMMERSIVE_MODE_LOCK_MSG = 37; static final int FIRST_ACTIVITY_STACK_MSG = 100; static final int FIRST_BROADCAST_QUEUE_MSG = 200; @@ -1356,6 +1365,21 @@ public final class ActivityManagerService extends ActivityManagerNative timeoutUserSwitch((UserStartedState)msg.obj, msg.arg1, msg.arg2); break; } + case IMMERSIVE_MODE_LOCK_MSG: { + final boolean nextState = (msg.arg1 != 0); + if (mUpdateLock.isHeld() != nextState) { + if (DEBUG_IMMERSIVE) { + final ActivityRecord r = (ActivityRecord) msg.obj; + Slog.d(TAG, "Applying new update lock state '" + nextState + "' for " + r); + } + if (nextState) { + mUpdateLock.acquire(); + } else { + mUpdateLock.release(); + } + } + break; + } } } }; @@ -1822,9 +1846,20 @@ public final class ActivityManagerService extends ActivityManagerNative if (r != null) { mWindowManager.setFocusedApp(r.appToken, true); } + applyUpdateLockStateLocked(r); } } + final void applyUpdateLockStateLocked(ActivityRecord r) { + // Modifications to the UpdateLock state are done on our handler, outside + // the activity manager's locks. The new state is determined based on the + // state *now* of the relevant activity record. The object is passed to + // the handler solely for logging detail, not to be consulted/modified. + final boolean nextState = r != null && r.immersive; + mHandler.sendMessage( + mHandler.obtainMessage(IMMERSIVE_MODE_LOCK_MSG, (nextState) ? 1 : 0, 0, r)); + } + private final void updateLruProcessInternalLocked(ProcessRecord app, int bestPos) { // put it on the LRU to keep track of when it should be exited. int lrui = mLruProcesses.indexOf(app); @@ -7421,11 +7456,19 @@ public final class ActivityManagerService extends ActivityManagerNative public void setImmersive(IBinder token, boolean immersive) { synchronized(this) { - ActivityRecord r = mMainStack.isInStackLocked(token); + final ActivityRecord r = mMainStack.isInStackLocked(token); if (r == null) { throw new IllegalArgumentException(); } r.immersive = immersive; + + // update associated state if we're frontmost + if (r == mFocusedActivity) { + if (DEBUG_IMMERSIVE) { + Slog.d(TAG, "Frontmost changed immersion: "+ r); + } + applyUpdateLockStateLocked(r); + } } } diff --git a/services/java/com/android/server/updates/ConfigUpdateInstallReceiver.java b/services/java/com/android/server/updatable/ConfigUpdateInstallReceiver.java index 4480151..4480151 100644 --- a/services/java/com/android/server/updates/ConfigUpdateInstallReceiver.java +++ b/services/java/com/android/server/updatable/ConfigUpdateInstallReceiver.java diff --git a/services/java/com/android/server/updates/CertPinInstallReceiver.java b/services/java/com/android/server/updates/CertPinInstallReceiver.java deleted file mode 100644 index c03fbc3..0000000 --- a/services/java/com/android/server/updates/CertPinInstallReceiver.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2012 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.server.updates; - -public class CertPinInstallReceiver extends ConfigUpdateInstallReceiver { - - public CertPinInstallReceiver() { - super("/data/misc/keychain/", "pins", "metadata/", "version"); - } -} |