diff options
| author | 2011-09-02 17:18:32 -0700 | |
|---|---|---|
| committer | 2011-09-02 17:18:32 -0700 | |
| commit | 6b0c11da5a7a7ea236fd9dc409d1ce7a33bff9c2 (patch) | |
| tree | 030e2647a2ad0b6f972447e3c3640631c6e29ea2 | |
| parent | a59e3146b7dc298043e43e1816e3415b2583a3c8 (diff) | |
| parent | 5d927c2d8e832fcfcb0154c8741f896001141ef4 (diff) | |
Merge "Fix issue #5150899: Call activity takes 15MB we never get back."
11 files changed, 208 insertions, 101 deletions
diff --git a/api/current.txt b/api/current.txt index f380cf94836d..d4acca90a24f 100644 --- a/api/current.txt +++ b/api/current.txt @@ -23714,7 +23714,7 @@ package android.view { field public static final int FLAGS_CHANGED = 4; // 0x4 field public static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 1; // 0x1 field public static final int FLAG_ALT_FOCUSABLE_IM = 131072; // 0x20000 - field public static final int FLAG_BLUR_BEHIND = 4; // 0x4 + field public static final deprecated int FLAG_BLUR_BEHIND = 4; // 0x4 field public static final int FLAG_DIM_BEHIND = 2; // 0x2 field public static final int FLAG_DISMISS_KEYGUARD = 4194304; // 0x400000 field public static final int FLAG_DITHER = 4096; // 0x1000 diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 8275cbd6152c..2c2a493f85e2 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -372,6 +372,7 @@ public final class ActivityThread { IInstrumentationWatcher instrumentationWatcher; int debugMode; boolean restrictedBackupMode; + boolean persistent; Configuration config; CompatibilityInfo compatInfo; boolean handlingProfiling; @@ -644,9 +645,9 @@ public final class ActivityThread { ComponentName instrumentationName, String profileFile, ParcelFileDescriptor profileFd, boolean autoStopProfiler, Bundle instrumentationArgs, IInstrumentationWatcher instrumentationWatcher, - int debugMode, boolean isRestrictedBackupMode, Configuration config, - CompatibilityInfo compatInfo, Map<String, IBinder> services, - Bundle coreSettings) { + int debugMode, boolean isRestrictedBackupMode, boolean persistent, + Configuration config, CompatibilityInfo compatInfo, + Map<String, IBinder> services, Bundle coreSettings) { if (services != null) { // Setup the service cache in the ServiceManager @@ -666,6 +667,7 @@ public final class ActivityThread { data.instrumentationWatcher = instrumentationWatcher; data.debugMode = debugMode; data.restrictedBackupMode = isRestrictedBackupMode; + data.persistent = persistent; data.config = config; data.compatInfo = compatInfo; queueOrSendMessage(H.BIND_APPLICATION, data); @@ -3687,6 +3689,16 @@ public final class ActivityThread { Process.setArgV0(data.processName); android.ddm.DdmHandleAppName.setAppName(data.processName); + if (data.persistent) { + // Persistent processes on low-memory devices do not get to + // use hardware accelerated drawing, since this can add too much + // overhead to the process. + Display display = WindowManagerImpl.getDefault().getDefaultDisplay(); + if (!ActivityManager.isHighEndGfx(display)) { + HardwareRenderer.disable(false); + } + } + if (data.profileFd != null) { data.startProfiling(); } @@ -4242,7 +4254,7 @@ public final class ActivityThread { } public static final ActivityThread systemMain() { - HardwareRenderer.disable(); + HardwareRenderer.disable(true); ActivityThread thread = new ActivityThread(); thread.attach(true); return thread; diff --git a/core/java/android/app/ApplicationThreadNative.java b/core/java/android/app/ApplicationThreadNative.java index 0a6fdd4af98f..cde06cd891de 100644 --- a/core/java/android/app/ApplicationThreadNative.java +++ b/core/java/android/app/ApplicationThreadNative.java @@ -267,13 +267,14 @@ public abstract class ApplicationThreadNative extends Binder IInstrumentationWatcher testWatcher = IInstrumentationWatcher.Stub.asInterface(binder); int testMode = data.readInt(); boolean restrictedBackupMode = (data.readInt() != 0); + boolean persistent = (data.readInt() != 0); Configuration config = Configuration.CREATOR.createFromParcel(data); CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data); HashMap<String, IBinder> services = data.readHashMap(null); Bundle coreSettings = data.readBundle(); bindApplication(packageName, info, providers, testName, profileName, profileFd, autoStopProfiler, - testArgs, testWatcher, testMode, restrictedBackupMode, + testArgs, testWatcher, testMode, restrictedBackupMode, persistent, config, compatInfo, services, coreSettings); return true; } @@ -811,8 +812,8 @@ class ApplicationThreadProxy implements IApplicationThread { public final void bindApplication(String packageName, ApplicationInfo info, List<ProviderInfo> providers, ComponentName testName, String profileName, ParcelFileDescriptor profileFd, boolean autoStopProfiler, Bundle testArgs, - IInstrumentationWatcher testWatcher, int debugMode, - boolean restrictedBackupMode, Configuration config, CompatibilityInfo compatInfo, + IInstrumentationWatcher testWatcher, int debugMode, boolean restrictedBackupMode, + boolean persistent, Configuration config, CompatibilityInfo compatInfo, Map<String, IBinder> services, Bundle coreSettings) throws RemoteException { Parcel data = Parcel.obtain(); data.writeInterfaceToken(IApplicationThread.descriptor); @@ -837,6 +838,7 @@ class ApplicationThreadProxy implements IApplicationThread { data.writeStrongInterface(testWatcher); data.writeInt(debugMode); data.writeInt(restrictedBackupMode ? 1 : 0); + data.writeInt(persistent ? 1 : 0); config.writeToParcel(data, 0); compatInfo.writeToParcel(data, 0); data.writeMap(services); diff --git a/core/java/android/app/IApplicationThread.java b/core/java/android/app/IApplicationThread.java index 9ae5ab19760b..5d200b46a4e0 100644 --- a/core/java/android/app/IApplicationThread.java +++ b/core/java/android/app/IApplicationThread.java @@ -88,8 +88,8 @@ public interface IApplicationThread extends IInterface { static final int DEBUG_WAIT = 2; void bindApplication(String packageName, ApplicationInfo info, List<ProviderInfo> providers, ComponentName testName, String profileName, ParcelFileDescriptor profileFd, - boolean autoStopProfiler, Bundle testArguments, - IInstrumentationWatcher testWatcher, int debugMode, boolean restrictedBackupMode, + boolean autoStopProfiler, Bundle testArguments, IInstrumentationWatcher testWatcher, + int debugMode, boolean restrictedBackupMode, boolean persistent, Configuration config, CompatibilityInfo compatInfo, Map<String, IBinder> services, Bundle coreSettings) throws RemoteException; void scheduleExit() throws RemoteException; diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java index 1fcde3d13c2f..23d1b0fb6134 100644 --- a/core/java/android/view/HardwareRenderer.java +++ b/core/java/android/view/HardwareRenderer.java @@ -94,6 +94,13 @@ public abstract class HardwareRenderer { */ public static boolean sRendererDisabled = false; + /** + * Further hardware renderer disabling for the system process. + * + * @hide + */ + public static boolean sSystemRendererDisabled = false; + private boolean mEnabled; private boolean mRequested = true; @@ -102,8 +109,11 @@ public abstract class HardwareRenderer { * * @hide */ - public static void disable() { + public static void disable(boolean system) { sRendererDisabled = true; + if (system) { + sSystemRendererDisabled = true; + } } /** diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 7ca8174df956..0d160a94c409 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -584,16 +584,25 @@ public final class ViewRootImpl extends Handler implements ViewParent, return; } - // Only enable hardware acceleration if we are not in the system process - // The window manager creates ViewAncestors to display animated preview windows - // of launching apps and we don't want those to be hardware accelerated - - final boolean systemHwAccelerated = - (attrs.flags & WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED_SYSTEM) != 0; - - if (!HardwareRenderer.sRendererDisabled || systemHwAccelerated) { + // Persistent processes (including the system) should not do + // accelerated rendering on low-end devices. In that case, + // sRendererDisabled will be set. In addition, the system process + // itself should never do accelerated rendering. In that case, both + // sRendererDisabled and sSystemRendererDisabled are set. When + // sSystemRendererDisabled is set, PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED + // can be used by code on the system process to escape that and enable + // HW accelerated drawing. (This is basically for the lock screen.) + + final boolean fakeHwAccelerated = (attrs.privateFlags & + WindowManager.LayoutParams.PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED) != 0; + final boolean forceHwAccelerated = (attrs.privateFlags & + WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED) != 0; + + if (!HardwareRenderer.sRendererDisabled || (HardwareRenderer.sSystemRendererDisabled + && forceHwAccelerated)) { // Don't enable hardware acceleration when we're not on the main thread - if (!systemHwAccelerated && Looper.getMainLooper() != Looper.myLooper()) { + if (!HardwareRenderer.sSystemRendererDisabled + && Looper.getMainLooper() != Looper.myLooper()) { Log.w(HardwareRenderer.LOG_TAG, "Attempting to initialize hardware " + "acceleration outside of the main thread, aborting"); return; @@ -606,12 +615,12 @@ public final class ViewRootImpl extends Handler implements ViewParent, mAttachInfo.mHardwareRenderer = HardwareRenderer.createGlRenderer(2, translucent); mAttachInfo.mHardwareAccelerated = mAttachInfo.mHardwareAccelerationRequested = mAttachInfo.mHardwareRenderer != null; - } else { - // We would normally have enabled hardware acceleration, but - // haven't because we are in the system process. We still want - // what is drawn on the screen to behave as if it is accelerated, - // so that our preview starting windows visually match what will - // actually be drawn by the app. + } else if (fakeHwAccelerated) { + // The window had wanted to use hardware acceleration, but this + // is not allowed in its process. By setting this flag, it can + // still render as if it was accelerated. This is basically for + // the preview windows the window manager shows for launching + // applications, so they will look more like the app being launched. mAttachInfo.mHardwareAccelerationRequested = true; } } diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index 52d25d9a8e29..fb31e7d8f205 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -412,12 +412,6 @@ public interface WindowManager extends ViewManager { * End of types of system windows. */ public static final int LAST_SYSTEM_WINDOW = 2999; - - /** - * @deprecated this is ignored - */ - @Deprecated - public int memoryType; /** @deprecated this is ignored, this value is set automatically when needed. */ @Deprecated @@ -431,58 +425,12 @@ public interface WindowManager extends ViewManager { /** @deprecated this is ignored, this value is set automatically when needed. */ @Deprecated public static final int MEMORY_TYPE_PUSH_BUFFERS = 3; - + /** - * Various behavioral options/flags. Default is none. - * - * @see #FLAG_BLUR_BEHIND - * @see #FLAG_DIM_BEHIND - * @see #FLAG_NOT_FOCUSABLE - * @see #FLAG_NOT_TOUCHABLE - * @see #FLAG_NOT_TOUCH_MODAL - * @see #FLAG_LAYOUT_IN_SCREEN - * @see #FLAG_DITHER - * @see #FLAG_KEEP_SCREEN_ON - * @see #FLAG_FULLSCREEN - * @see #FLAG_FORCE_NOT_FULLSCREEN - * @see #FLAG_IGNORE_CHEEK_PRESSES - * @see #FLAG_HARDWARE_ACCELERATED + * @deprecated this is ignored */ - @ViewDebug.ExportedProperty(flagMapping = { - @ViewDebug.FlagToString(mask = FLAG_BLUR_BEHIND, equals = FLAG_BLUR_BEHIND, - name = "FLAG_BLUR_BEHIND"), - @ViewDebug.FlagToString(mask = FLAG_DIM_BEHIND, equals = FLAG_DIM_BEHIND, - name = "FLAG_DIM_BEHIND"), - @ViewDebug.FlagToString(mask = FLAG_NOT_FOCUSABLE, equals = FLAG_NOT_FOCUSABLE, - name = "FLAG_NOT_FOCUSABLE"), - @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCHABLE, equals = FLAG_NOT_TOUCHABLE, - name = "FLAG_NOT_TOUCHABLE"), - @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCH_MODAL, equals = FLAG_NOT_TOUCH_MODAL, - name = "FLAG_NOT_TOUCH_MODAL"), - @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_SCREEN, equals = FLAG_LAYOUT_IN_SCREEN, - name = "FLAG_LAYOUT_IN_SCREEN"), - @ViewDebug.FlagToString(mask = FLAG_DITHER, equals = FLAG_DITHER, - name = "FLAG_DITHER"), - @ViewDebug.FlagToString(mask = FLAG_TURN_SCREEN_ON, equals = FLAG_TURN_SCREEN_ON, - name = "FLAG_TURN_SCREEN_ON"), - @ViewDebug.FlagToString(mask = FLAG_KEEP_SCREEN_ON, equals = FLAG_KEEP_SCREEN_ON, - name = "FLAG_KEEP_SCREEN_ON"), - @ViewDebug.FlagToString(mask = FLAG_SHOW_WHEN_LOCKED, equals = FLAG_SHOW_WHEN_LOCKED, - name = "FLAG_SHOW_WHEN_LOCKED"), - @ViewDebug.FlagToString(mask = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, equals = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, - name = "FLAG_ALLOW_LOCK_WHILE_SCREEN_ON"), - @ViewDebug.FlagToString(mask = FLAG_DISMISS_KEYGUARD, equals = FLAG_DISMISS_KEYGUARD, - name = "FLAG_DISMISS_KEYGUARD"), - @ViewDebug.FlagToString(mask = FLAG_FULLSCREEN, equals = FLAG_FULLSCREEN, - name = "FLAG_FULLSCREEN"), - @ViewDebug.FlagToString(mask = FLAG_FORCE_NOT_FULLSCREEN, - equals = FLAG_FORCE_NOT_FULLSCREEN, name = "FLAG_FORCE_NOT_FULLSCREEN"), - @ViewDebug.FlagToString(mask = FLAG_IGNORE_CHEEK_PRESSES, - equals = FLAG_IGNORE_CHEEK_PRESSES, name = "FLAG_IGNORE_CHEEK_PRESSES"), - @ViewDebug.FlagToString(mask = FLAG_HARDWARE_ACCELERATED, - equals = FLAG_HARDWARE_ACCELERATED, name = "FLAG_HARDWARE_ACCELERATED") - }) - public int flags; + @Deprecated + public int memoryType; /** Window flag: as long as this window is visible to the user, allow * the lock screen to activate while the screen is on. @@ -493,10 +441,12 @@ public interface WindowManager extends ViewManager { /** Window flag: everything behind this window will be dimmed. * Use {@link #dimAmount} to control the amount of dim. */ public static final int FLAG_DIM_BEHIND = 0x00000002; - - /** Window flag: blur everything behind this window. */ + + /** Window flag: blur everything behind this window. + * @deprecated Blurring is no longer supported. */ + @Deprecated public static final int FLAG_BLUR_BEHIND = 0x00000004; - + /** Window flag: this window won't ever get key input focus, so the * user can not send key or other button events to it. Those will * instead go to whatever focusable window is behind it. This flag @@ -686,17 +636,6 @@ public interface WindowManager extends ViewManager { * XML attribute is set to true on an activity or on the application.</p> */ public static final int FLAG_HARDWARE_ACCELERATED = 0x01000000; - - /** - * Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows - * that need hardware acceleration (e.g. LockScreen), where hardware acceleration - * is generally disabled. This flag must be specified in addition to - * {@link #FLAG_HARDWARE_ACCELERATED} to enable hardware acceleration for system - * windows. - * - * @hide - */ - public static final int FLAG_HARDWARE_ACCELERATED_SYSTEM = 0x02000000; // ----- HIDDEN FLAGS. // These start at the high bit and go down. @@ -747,6 +686,125 @@ public interface WindowManager extends ViewManager { public static final int FLAG_SYSTEM_ERROR = 0x40000000; /** + * Various behavioral options/flags. Default is none. + * + * @see #FLAG_ALLOW_LOCK_WHILE_SCREEN_ON + * @see #FLAG_DIM_BEHIND + * @see #FLAG_NOT_FOCUSABLE + * @see #FLAG_NOT_TOUCHABLE + * @see #FLAG_NOT_TOUCH_MODAL + * @see #FLAG_TOUCHABLE_WHEN_WAKING + * @see #FLAG_KEEP_SCREEN_ON + * @see #FLAG_LAYOUT_IN_SCREEN + * @see #FLAG_LAYOUT_NO_LIMITS + * @see #FLAG_FULLSCREEN + * @see #FLAG_FORCE_NOT_FULLSCREEN + * @see #FLAG_DITHER + * @see #FLAG_SECURE + * @see #FLAG_SCALED + * @see #FLAG_IGNORE_CHEEK_PRESSES + * @see #FLAG_LAYOUT_INSET_DECOR + * @see #FLAG_ALT_FOCUSABLE_IM + * @see #FLAG_WATCH_OUTSIDE_TOUCH + * @see #FLAG_SHOW_WHEN_LOCKED + * @see #FLAG_SHOW_WALLPAPER + * @see #FLAG_TURN_SCREEN_ON + * @see #FLAG_DISMISS_KEYGUARD + * @see #FLAG_SPLIT_TOUCH + * @see #FLAG_HARDWARE_ACCELERATED + */ + @ViewDebug.ExportedProperty(flagMapping = { + @ViewDebug.FlagToString(mask = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, equals = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, + name = "FLAG_ALLOW_LOCK_WHILE_SCREEN_ON"), + @ViewDebug.FlagToString(mask = FLAG_DIM_BEHIND, equals = FLAG_DIM_BEHIND, + name = "FLAG_DIM_BEHIND"), + @ViewDebug.FlagToString(mask = FLAG_BLUR_BEHIND, equals = FLAG_BLUR_BEHIND, + name = "FLAG_BLUR_BEHIND"), + @ViewDebug.FlagToString(mask = FLAG_NOT_FOCUSABLE, equals = FLAG_NOT_FOCUSABLE, + name = "FLAG_NOT_FOCUSABLE"), + @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCHABLE, equals = FLAG_NOT_TOUCHABLE, + name = "FLAG_NOT_TOUCHABLE"), + @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCH_MODAL, equals = FLAG_NOT_TOUCH_MODAL, + name = "FLAG_NOT_TOUCH_MODAL"), + @ViewDebug.FlagToString(mask = FLAG_TOUCHABLE_WHEN_WAKING, equals = FLAG_TOUCHABLE_WHEN_WAKING, + name = "FLAG_TOUCHABLE_WHEN_WAKING"), + @ViewDebug.FlagToString(mask = FLAG_KEEP_SCREEN_ON, equals = FLAG_KEEP_SCREEN_ON, + name = "FLAG_KEEP_SCREEN_ON"), + @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_SCREEN, equals = FLAG_LAYOUT_IN_SCREEN, + name = "FLAG_LAYOUT_IN_SCREEN"), + @ViewDebug.FlagToString(mask = FLAG_LAYOUT_NO_LIMITS, equals = FLAG_LAYOUT_NO_LIMITS, + name = "FLAG_LAYOUT_NO_LIMITS"), + @ViewDebug.FlagToString(mask = FLAG_FULLSCREEN, equals = FLAG_FULLSCREEN, + name = "FLAG_FULLSCREEN"), + @ViewDebug.FlagToString(mask = FLAG_FORCE_NOT_FULLSCREEN, equals = FLAG_FORCE_NOT_FULLSCREEN, + name = "FLAG_FORCE_NOT_FULLSCREEN"), + @ViewDebug.FlagToString(mask = FLAG_DITHER, equals = FLAG_DITHER, + name = "FLAG_DITHER"), + @ViewDebug.FlagToString(mask = FLAG_SECURE, equals = FLAG_SECURE, + name = "FLAG_SECURE"), + @ViewDebug.FlagToString(mask = FLAG_SCALED, equals = FLAG_SCALED, + name = "FLAG_SCALED"), + @ViewDebug.FlagToString(mask = FLAG_IGNORE_CHEEK_PRESSES, equals = FLAG_IGNORE_CHEEK_PRESSES, + name = "FLAG_IGNORE_CHEEK_PRESSES"), + @ViewDebug.FlagToString(mask = FLAG_LAYOUT_INSET_DECOR, equals = FLAG_LAYOUT_INSET_DECOR, + name = "FLAG_LAYOUT_INSET_DECOR"), + @ViewDebug.FlagToString(mask = FLAG_ALT_FOCUSABLE_IM, equals = FLAG_ALT_FOCUSABLE_IM, + name = "FLAG_ALT_FOCUSABLE_IM"), + @ViewDebug.FlagToString(mask = FLAG_WATCH_OUTSIDE_TOUCH, equals = FLAG_WATCH_OUTSIDE_TOUCH, + name = "FLAG_WATCH_OUTSIDE_TOUCH"), + @ViewDebug.FlagToString(mask = FLAG_SHOW_WHEN_LOCKED, equals = FLAG_SHOW_WHEN_LOCKED, + name = "FLAG_SHOW_WHEN_LOCKED"), + @ViewDebug.FlagToString(mask = FLAG_SHOW_WALLPAPER, equals = FLAG_SHOW_WALLPAPER, + name = "FLAG_SHOW_WALLPAPER"), + @ViewDebug.FlagToString(mask = FLAG_TURN_SCREEN_ON, equals = FLAG_TURN_SCREEN_ON, + name = "FLAG_TURN_SCREEN_ON"), + @ViewDebug.FlagToString(mask = FLAG_DISMISS_KEYGUARD, equals = FLAG_DISMISS_KEYGUARD, + name = "FLAG_DISMISS_KEYGUARD"), + @ViewDebug.FlagToString(mask = FLAG_SPLIT_TOUCH, equals = FLAG_SPLIT_TOUCH, + name = "FLAG_SPLIT_TOUCH"), + @ViewDebug.FlagToString(mask = FLAG_HARDWARE_ACCELERATED, equals = FLAG_HARDWARE_ACCELERATED, + name = "FLAG_HARDWARE_ACCELERATED") + }) + public int flags; + + /** + * If the window has requested hardware acceleration, but this is not + * allowed in the process it is in, then still render it as if it is + * hardware accelerated. This is used for the starting preview windows + * in the system process, which don't need to have the overhead of + * hardware acceleration (they are just a static rendering), but should + * be rendered as much to match the actual window of the app even if it + * is hardware accelerated. + * Even if the window isn't hardware accelerated, still do its rendering + * as if it is. + * Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows + * that need hardware acceleration (e.g. LockScreen), where hardware acceleration + * is generally disabled. This flag must be specified in addition to + * {@link #FLAG_HARDWARE_ACCELERATED} to enable hardware acceleration for system + * windows. + * + * @hide + */ + public static final int PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED = 0x00000001; + + /** + * In the system process, we globally do not use hardware acceleration + * because there are many threads doing UI there and they an conflict. + * If certain parts of the UI that really do want to use hardware + * acceleration, this flag can be set to force it. This is basically + * for the lock screen. Anyone else using it, you are probably wrong. + * + * @hide + */ + public static final int PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED = 0x00000002; + + /** + * Control flags that are private to the platform. + * @hide + */ + public int privateFlags; + + /** * Given a particular set of window manager flags, determine whether * such a window may be a target for an input method when it has * focus. In particular, this checks the @@ -1110,6 +1168,7 @@ public interface WindowManager extends ViewManager { out.writeInt(y); out.writeInt(type); out.writeInt(flags); + out.writeInt(privateFlags); out.writeInt(softInputMode); out.writeInt(gravity); out.writeFloat(horizontalMargin); @@ -1149,6 +1208,7 @@ public interface WindowManager extends ViewManager { y = in.readInt(); type = in.readInt(); flags = in.readInt(); + privateFlags = in.readInt(); softInputMode = in.readInt(); gravity = in.readInt(); horizontalMargin = in.readFloat(); @@ -1190,6 +1250,8 @@ public interface WindowManager extends ViewManager { public static final int SYSTEM_UI_LISTENER_CHANGED = 1<<14; /** {@hide} */ public static final int INPUT_FEATURES_CHANGED = 1<<15; + /** {@hide} */ + public static final int PRIVATE_FLAGS_CHANGED = 1<<16; // internal buffer to backup/restore parameters under compatibility mode. private int[] mCompatibilityParamsBackup = null; @@ -1237,6 +1299,10 @@ public interface WindowManager extends ViewManager { flags = o.flags; changes |= FLAGS_CHANGED; } + if (privateFlags != o.privateFlags) { + privateFlags = o.privateFlags; + changes |= PRIVATE_FLAGS_CHANGED; + } if (softInputMode != o.softInputMode) { softInputMode = o.softInputMode; changes |= SOFT_INPUT_MODE_CHANGED; @@ -1353,6 +1419,9 @@ public interface WindowManager extends ViewManager { sb.append(type); sb.append(" fl=#"); sb.append(Integer.toHexString(flags)); + if (privateFlags != 0) { + sb.append(" pfl=0x").append(Integer.toHexString(privateFlags)); + } if (format != PixelFormat.OPAQUE) { sb.append(" fmt="); sb.append(format); diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java index fe255cba2686..3fa3078da566 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java @@ -232,7 +232,6 @@ class GlobalScreenshot { WindowManager.LayoutParams.TYPE_SECURE_SYSTEM_OVERLAY, WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED - | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED_SYSTEM | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED, PixelFormat.TRANSLUCENT); diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java b/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java index f52bb260823f..c1f1151bbcfd 100644 --- a/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java +++ b/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java @@ -115,15 +115,19 @@ public class KeyguardViewManager implements KeyguardWindowController { } if (ActivityManager.isHighEndGfx(((WindowManager)mContext.getSystemService( Context.WINDOW_SERVICE)).getDefaultDisplay())) { - flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED - | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED_SYSTEM; + flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED; } WindowManager.LayoutParams lp = new WindowManager.LayoutParams( stretch, stretch, WindowManager.LayoutParams.TYPE_KEYGUARD, flags, PixelFormat.TRANSLUCENT); lp.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE; lp.windowAnimations = com.android.internal.R.style.Animation_LockScreen; - + if (ActivityManager.isHighEndGfx(((WindowManager)mContext.getSystemService( + Context.WINDOW_SERVICE)).getDefaultDisplay())) { + lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED; + lp.privateFlags |= + WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED; + } lp.setTitle("Keyguard"); mWindowLayoutParams = lp; diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 2f5debaf66d8..304df7273c03 100755 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -1226,6 +1226,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { params.packageName = packageName; params.windowAnimations = win.getWindowStyle().getResourceId( com.android.internal.R.styleable.Window_windowAnimationStyle, 0); + params.privateFlags |= + WindowManager.LayoutParams.PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED; params.setTitle("Starting " + packageName); WindowManager wm = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE); diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index bb5e989a534a..9db56ce92b3f 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -3598,7 +3598,7 @@ public final class ActivityManagerService extends ActivityManagerNative thread.bindApplication(processName, appInfo, providers, app.instrumentationClass, profileFile, profileFd, profileAutoStop, app.instrumentationArguments, app.instrumentationWatcher, testMode, - isRestrictedBackupMode || !normalMode, + isRestrictedBackupMode || !normalMode, app.persistent, mConfiguration, app.compat, getCommonServicesLocked(), mCoreSettingsObserver.getCoreSettingsLocked()); updateLruProcessLocked(app, false, true); |