Skip to content

Commit 9cf5831

Browse files
Craig MautnerAndroid (Google) Code Review
authored andcommitted
Merge "Fix jank when launching apps that show wallpaper." into jb-dev
2 parents c1cabdf + 8e4df6c commit 9cf5831

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

policy/src/com/android/internal/policy/impl/PhoneWindowManager.java

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import android.content.res.CompatibilityInfo;
3434
import android.content.res.Configuration;
3535
import android.content.res.Resources;
36+
import android.content.res.TypedArray;
3637
import android.database.ContentObserver;
3738
import android.graphics.PixelFormat;
3839
import android.graphics.Rect;
@@ -1434,8 +1435,9 @@ public boolean canBeForceHidden(WindowState win, WindowManager.LayoutParams attr
14341435
&& attrs.type != WindowManager.LayoutParams.TYPE_NAVIGATION_BAR
14351436
&& attrs.type != WindowManager.LayoutParams.TYPE_WALLPAPER;
14361437
}
1437-
1438+
14381439
/** {@inheritDoc} */
1440+
@Override
14391441
public View addStartingWindow(IBinder appToken, String packageName, int theme,
14401442
CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes,
14411443
int icon, int windowFlags) {
@@ -1445,7 +1447,7 @@ public View addStartingWindow(IBinder appToken, String packageName, int theme,
14451447
if (packageName == null) {
14461448
return null;
14471449
}
1448-
1450+
14491451
try {
14501452
Context context = mContext;
14511453
//Log.i(TAG, "addStartingWindow " + packageName + ": nonLocalizedLabel="
@@ -1458,16 +1460,19 @@ public View addStartingWindow(IBinder appToken, String packageName, int theme,
14581460
// Ignore
14591461
}
14601462
}
1461-
1463+
14621464
Window win = PolicyManager.makeNewWindow(context);
1463-
if (win.getWindowStyle().getBoolean(
1464-
com.android.internal.R.styleable.Window_windowDisablePreview, false)) {
1465+
final TypedArray ta = win.getWindowStyle();
1466+
if (ta.getBoolean(
1467+
com.android.internal.R.styleable.Window_windowDisablePreview, false)
1468+
|| ta.getBoolean(
1469+
com.android.internal.R.styleable.Window_windowShowWallpaper,false)) {
14651470
return null;
14661471
}
1467-
1472+
14681473
Resources r = context.getResources();
14691474
win.setTitle(r.getText(labelRes, nonLocalizedLabel));
1470-
1475+
14711476
win.setType(
14721477
WindowManager.LayoutParams.TYPE_APPLICATION_STARTING);
14731478
// Force the window flags: this is a fake window, so it is not really
@@ -1483,14 +1488,14 @@ public View addStartingWindow(IBinder appToken, String packageName, int theme,
14831488
WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE|
14841489
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE|
14851490
WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
1486-
1491+
14871492
if (!compatInfo.supportsScreen()) {
14881493
win.addFlags(WindowManager.LayoutParams.FLAG_COMPATIBLE_WINDOW);
14891494
}
14901495

14911496
win.setLayout(WindowManager.LayoutParams.MATCH_PARENT,
14921497
WindowManager.LayoutParams.MATCH_PARENT);
1493-
1498+
14941499
final WindowManager.LayoutParams params = win.getAttributes();
14951500
params.token = appToken;
14961501
params.packageName = packageName;
@@ -1512,7 +1517,7 @@ public View addStartingWindow(IBinder appToken, String packageName, int theme,
15121517
// earlier.)
15131518
return null;
15141519
}
1515-
1520+
15161521
if (localLOGV) Log.v(
15171522
TAG, "Adding starting window for " + packageName
15181523
+ " / " + appToken + ": "

services/java/com/android/server/wm/WindowManagerService.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,7 +1636,7 @@ int adjustWallpaperWindowsLocked() {
16361636
continue;
16371637
}
16381638
}
1639-
if (DEBUG_WALLPAPER) Slog.v(TAG, "Win " + w + ": readyfordisplay="
1639+
if (DEBUG_WALLPAPER) Slog.v(TAG, "Win #" + i + " " + w + ": readyfordisplay="
16401640
+ w.isReadyForDisplay() + " mDrawState=" + w.mWinAnimator.mDrawState);
16411641
if ((w.mAttrs.flags&FLAG_SHOW_WALLPAPER) != 0 && w.isReadyForDisplay()
16421642
&& (mWallpaperTarget == w || w.isDrawnLw())) {
@@ -1729,12 +1729,15 @@ int adjustWallpaperWindowsLocked() {
17291729
Slog.v(TAG, "Old wallpaper still the target.");
17301730
}
17311731
mWallpaperTarget = oldW;
1732-
}
1733-
1732+
foundW = oldW;
1733+
foundI = oldI;
1734+
mLowerWallpaperTarget = null;
1735+
mUpperWallpaperTarget = null;
1736+
}
17341737
// Now set the upper and lower wallpaper targets
17351738
// correctly, and make sure that we are positioning
17361739
// the wallpaper below the lower.
1737-
if (foundI > oldI) {
1740+
else if (foundI > oldI) {
17381741
// The new target is on top of the old one.
17391742
if (DEBUG_WALLPAPER) {
17401743
Slog.v(TAG, "Found target above old target.");

0 commit comments

Comments
 (0)