diff options
author | Craig Mautner <cmautner@google.com> | 2013-06-27 21:00:43 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-06-27 21:00:44 +0000 |
commit | 5729b81ab56379e3b8736a2c716421e185756460 (patch) | |
tree | 76cdc279f1f499eccafa1f1a1981a82a3f19d737 /services | |
parent | 10113a440ef847f038a2b8ac3064b84b903e2953 (diff) | |
parent | 4addfc5f3998e3d7fc0a2ed9a9051c034da2ea3d (diff) | |
download | frameworks_base-5729b81ab56379e3b8736a2c716421e185756460.zip frameworks_base-5729b81ab56379e3b8736a2c716421e185756460.tar.gz frameworks_base-5729b81ab56379e3b8736a2c716421e185756460.tar.bz2 |
Merge "Add API to convert translucent Activity to opaque."
Diffstat (limited to 'services')
4 files changed, 67 insertions, 10 deletions
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index e37eec6..ad6ae43 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -7910,12 +7910,33 @@ public final class ActivityManagerService extends ActivityManagerNative } } + @Override public void unregisterProcessObserver(IProcessObserver observer) { synchronized (this) { mProcessObservers.unregister(observer); } } + @Override + public void convertToOpaque(IBinder token) { + final long origId = Binder.clearCallingIdentity(); + try { + synchronized (this) { + final ActivityRecord r = ActivityRecord.isInStackLocked(token); + if (r == null) { + return; + } + if (r.convertToOpaque()) { + mWindowManager.setAppFullscreen(token); + mStackSupervisor.ensureActivitiesVisibleLocked(null, 0); + } + } + } finally { + Binder.restoreCallingIdentity(origId); + } + } + + @Override public void setImmersive(IBinder token, boolean immersive) { synchronized(this) { final ActivityRecord r = ActivityRecord.isInStackLocked(token); @@ -7934,6 +7955,7 @@ public final class ActivityManagerService extends ActivityManagerNative } } + @Override public boolean isImmersive(IBinder token) { synchronized (this) { ActivityRecord r = ActivityRecord.isInStackLocked(token); @@ -8006,7 +8028,7 @@ public final class ActivityManagerService extends ActivityManagerNative String reason = (pReason == null) ? "Unknown" : pReason; // XXX Note: don't acquire main activity lock here, because the window // manager calls in with its locks held. - + boolean killed = false; synchronized (mPidsSelfLocked) { int[] types = new int[pids.length]; @@ -8021,7 +8043,7 @@ public final class ActivityManagerService extends ActivityManagerNative } } } - + // If the worst oom_adj is somewhere in the cached proc LRU range, // then constrain it so we will kill all cached procs. if (worstType < ProcessList.CACHED_APP_MAX_ADJ @@ -8188,7 +8210,7 @@ public final class ActivityManagerService extends ActivityManagerNative // no need to synchronize(this) just to read & return the value return mSystemReady; } - + private static File getCalledPreBootReceiversFile() { File dataDir = Environment.getDataDirectory(); File systemDir = new File(dataDir, "system"); diff --git a/services/java/com/android/server/am/ActivityRecord.java b/services/java/com/android/server/am/ActivityRecord.java index 561dd0f..f730e07 100644 --- a/services/java/com/android/server/am/ActivityRecord.java +++ b/services/java/com/android/server/am/ActivityRecord.java @@ -71,7 +71,7 @@ final class ActivityRecord { final String processName; // process where this component wants to run final String taskAffinity; // as per ActivityInfo.taskAffinity final boolean stateNotNeeded; // As per ActivityInfo.flags - final boolean fullscreen; // covers the full screen? + boolean fullscreen; // covers the full screen? final boolean noDisplay; // activity is not displayed? final boolean componentSpecified; // did caller specifiy an explicit component? @@ -503,6 +503,21 @@ final class ActivityRecord { } } + boolean convertToOpaque() { + if (fullscreen) { + return false; + } + + AttributeCache.Entry ent = AttributeCache.instance().get(packageName, + realTheme, com.android.internal.R.styleable.Window); + if (ent != null && !ent.array.getBoolean( + com.android.internal.R.styleable.Window_windowIsFloating, false)) { + fullscreen = true; + ++task.numFullscreen; + } + return fullscreen; + } + void putInHistory() { if (!inHistory) { inHistory = true; diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java index a9ab53d..8e8bb55 100644 --- a/services/java/com/android/server/am/ActivityStack.java +++ b/services/java/com/android/server/am/ActivityStack.java @@ -1088,11 +1088,25 @@ final class ActivityStack { r.visible = false; try { mWindowManager.setAppVisibility(r.appToken, false); - if ((r.state == ActivityState.STOPPING - || r.state == ActivityState.STOPPED) - && r.app != null && r.app.thread != null) { - if (DEBUG_VISBILITY) Slog.v(TAG, "Scheduling invisibility: " + r); - r.app.thread.scheduleWindowVisibility(r.appToken, false); + switch (r.state) { + case STOPPING: + case STOPPED: + if (r.app != null && r.app.thread != null) { + if (DEBUG_VISBILITY) Slog.v( + TAG, "Scheduling invisibility: " + r); + r.app.thread.scheduleWindowVisibility(r.appToken, false); + } + break; + + case INITIALIZING: + case RESUMED: + case PAUSING: + case PAUSED: + stopActivityLocked(r); + break; + + default: + break; } } catch (Exception e) { // Just skip on any failure; we'll make it diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index 0babeea..ee2ef37 100644 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -98,7 +98,6 @@ import android.util.SparseIntArray; import android.util.TypedValue; import android.view.Choreographer; import android.view.Display; -import android.view.DisplayAdjustments; import android.view.DisplayInfo; import android.view.Gravity; import android.view.IApplicationToken; @@ -4118,6 +4117,13 @@ public class WindowManagerService extends IWindowManager.Stub } } + public void setAppFullscreen(IBinder token) { + AppWindowToken atoken = findAppWindowToken(token); + if (atoken != null) { + atoken.appFullscreen = true; + } + } + boolean setTokenVisibilityLocked(AppWindowToken wtoken, WindowManager.LayoutParams lp, boolean visible, int transit, boolean performLayout) { boolean delayed = false; |