Clean up warnings.
Change-Id: I1dfe21e5f64364c90565b594e28074cabe7daa64
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index 024c247..535ff79 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -228,7 +228,7 @@
* manager with lock held. (This lock will be acquired in places
* where the window manager is calling in with its own lock held.)
*/
- final Object mLock = new Object();
+ private final Object mLock = new Object();
Context mContext;
IWindowManager mWindowManager;
@@ -694,9 +694,8 @@
// Double the time it takes to take a screenshot from the keyguard
return (long) (KEYGUARD_SCREENSHOT_CHORD_DELAY_MULTIPLIER *
ViewConfiguration.getGlobalActionKeyTimeout());
- } else {
- return ViewConfiguration.getGlobalActionKeyTimeout();
}
+ return ViewConfiguration.getGlobalActionKeyTimeout();
}
private void cancelPendingScreenshotChordAction() {
@@ -739,6 +738,7 @@
};
private final Runnable mScreenshotRunnable = new Runnable() {
+ @Override
public void run() {
takeScreenshot();
}
@@ -845,6 +845,7 @@
}
/** {@inheritDoc} */
+ @Override
public void init(Context context, IWindowManager windowManager,
WindowManagerFuncs windowManagerFuncs) {
mContext = context;
@@ -947,6 +948,7 @@
}
}
+ @Override
public void setInitialDisplaySize(Display display, int width, int height, int density) {
mDisplay = display;
diff --git a/services/java/com/android/server/display/DisplayManagerService.java b/services/java/com/android/server/display/DisplayManagerService.java
index e09970e..813c9c7 100644
--- a/services/java/com/android/server/display/DisplayManagerService.java
+++ b/services/java/com/android/server/display/DisplayManagerService.java
@@ -118,6 +118,9 @@
// The synchronization root for the display manager.
// This lock guards most of the display manager's state.
+ // NOTE: This is synchronized on while holding WindowManagerService.mWindowMap so never call
+ // into WindowManagerService methods that require mWindowMap while holding this unless you are
+ // very very sure that no deadlock can occur.
private final SyncRoot mSyncRoot = new SyncRoot();
// True if in safe mode.
@@ -158,7 +161,7 @@
new CopyOnWriteArrayList<DisplayTransactionListener>();
// Set to true if all displays have been blanked by the power manager.
- private int mAllDisplayBlankStateFromPowerManager;
+ private int mAllDisplayBlankStateFromPowerManager = DISPLAY_BLANK_STATE_UNKNOWN;
// Set to true when there are pending display changes that have yet to be applied
// to the surface flinger state.
@@ -541,9 +544,8 @@
synchronized (mSyncRoot) {
if (mWifiDisplayAdapter != null) {
return mWifiDisplayAdapter.getWifiDisplayStatusLocked();
- } else {
- return new WifiDisplayStatus();
}
+ return new WifiDisplayStatus();
}
} finally {
Binder.restoreCallingIdentity(token);
@@ -812,11 +814,9 @@
Slog.w(TAG, "Missing logical display to use for physical display device: "
+ device.getDisplayDeviceInfoLocked());
return;
- } else {
- boolean isBlanked = (mAllDisplayBlankStateFromPowerManager
- == DISPLAY_BLANK_STATE_BLANKED);
- display.configureDisplayInTransactionLocked(device, isBlanked);
}
+ boolean isBlanked = (mAllDisplayBlankStateFromPowerManager == DISPLAY_BLANK_STATE_BLANKED);
+ display.configureDisplayInTransactionLocked(device, isBlanked);
// Update the viewports if needed.
DisplayDeviceInfo info = device.getDisplayDeviceInfoLocked();
diff --git a/services/java/com/android/server/wm/ScreenRotationAnimation.java b/services/java/com/android/server/wm/ScreenRotationAnimation.java
index cfcf841..71a61c6 100644
--- a/services/java/com/android/server/wm/ScreenRotationAnimation.java
+++ b/services/java/com/android/server/wm/ScreenRotationAnimation.java
@@ -267,8 +267,7 @@
private void setSnapshotTransformInTransaction(Matrix matrix, float alpha) {
if (mSurface != null) {
matrix.getValues(mTmpFloats);
- mSurface.setPosition(mTmpFloats[Matrix.MTRANS_X],
- mTmpFloats[Matrix.MTRANS_Y]);
+ mSurface.setPosition(mTmpFloats[Matrix.MTRANS_X], mTmpFloats[Matrix.MTRANS_Y]);
mSurface.setMatrix(
mTmpFloats[Matrix.MSCALE_X], mTmpFloats[Matrix.MSKEW_Y],
mTmpFloats[Matrix.MSKEW_X], mTmpFloats[Matrix.MSCALE_Y]);
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index 7e12780..896a303 100644
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -475,7 +475,7 @@
// This is held as long as we have the screen frozen, to give us time to
// perform a rotation animation when turning off shows the lock screen which
// changes the orientation.
- PowerManager.WakeLock mScreenFrozenLock;
+ private PowerManager.WakeLock mScreenFrozenLock;
final AppTransition mAppTransition;
boolean mStartingIconInTransition = false;
@@ -761,8 +761,7 @@
mPowerManager = pm;
mPowerManager.setPolicy(mPolicy);
PowerManager pmc = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
- mScreenFrozenLock = pmc.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
- "SCREEN_FROZEN");
+ mScreenFrozenLock = pmc.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "SCREEN_FROZEN");
mScreenFrozenLock.setReferenceCounted(false);
mAppTransition = new AppTransition(context, mH);
@@ -4714,6 +4713,7 @@
}
}
+ @Override
public void closeSystemDialogs(String reason) {
synchronized(mWindowMap) {
final AllWindowsIterator iterator = new AllWindowsIterator();
@@ -4735,6 +4735,7 @@
return Math.abs(scale);
}
+ @Override
public void setAnimationScale(int which, float scale) {
if (!checkCallingPermission(android.Manifest.permission.SET_ANIMATION_SCALE,
"setAnimationScale()")) {
@@ -5468,8 +5469,7 @@
mWindowsFreezingScreen = true;
mH.removeMessages(H.WINDOW_FREEZE_TIMEOUT);
- mH.sendEmptyMessageDelayed(H.WINDOW_FREEZE_TIMEOUT,
- WINDOW_FREEZE_TIMEOUT_DURATION);
+ mH.sendEmptyMessageDelayed(H.WINDOW_FREEZE_TIMEOUT, WINDOW_FREEZE_TIMEOUT_DURATION);
mWaitingForConfig = true;
getDefaultDisplayContentLocked().layoutNeeded = true;
startFreezingDisplayLocked(inTransaction, 0, 0);
@@ -5540,13 +5540,16 @@
return true;
}
+ @Override
public int getRotation() {
return mRotation;
}
+ @Override
public int watchRotation(IRotationWatcher watcher) {
final IBinder watcherBinder = watcher.asBinder();
IBinder.DeathRecipient dr = new IBinder.DeathRecipient() {
+ @Override
public void binderDied() {
synchronized (mWindowMap) {
for (int i=0; i<mRotationWatchers.size(); i++) {
@@ -8277,7 +8280,10 @@
if (DEBUG_LAYOUT_REPEATS) debugLayoutRepeats("On entry to LockedInner",
displayContent.pendingLayoutChanges);
- if ((adjustWallpaperWindowsLocked() & ADJUST_WALLPAPER_LAYERS_CHANGED) != 0) {
+ if ((displayContent.pendingLayoutChanges &
+ WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER) != 0 &&
+ (adjustWallpaperWindowsLocked() &
+ ADJUST_WALLPAPER_LAYERS_CHANGED) != 0) {
assignLayersLocked(windows);
displayContent.layoutNeeded = true;
}
@@ -9270,7 +9276,7 @@
mInputMonitor.thawInputDispatchingLw();
boolean configChanged;
-
+
// While the display is frozen we don't re-compute the orientation
// to avoid inconsistent states. However, something interesting
// could have actually changed during that time so re-evaluate it
@@ -9338,17 +9344,16 @@
} catch (FileNotFoundException e) {
} catch (IOException e) {
} finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException e) {
- }
- }
if (ind != null) {
try {
ind.close();
} catch (IOException e) {
}
+ } else if (in != null) {
+ try {
+ in.close();
+ } catch (IOException e) {
+ }
}
}
}
diff --git a/services/java/com/android/server/wm/WindowState.java b/services/java/com/android/server/wm/WindowState.java
index 8b8bddf..5fd42c2 100644
--- a/services/java/com/android/server/wm/WindowState.java
+++ b/services/java/com/android/server/wm/WindowState.java
@@ -223,30 +223,36 @@
*/
boolean mRelayoutCalled;
- // If the application has called relayout() with changes that can
- // impact its window's size, we need to perform a layout pass on it
- // even if it is not currently visible for layout. This is set
- // when in that case until the layout is done.
+ /**
+ * If the application has called relayout() with changes that can
+ * impact its window's size, we need to perform a layout pass on it
+ * even if it is not currently visible for layout. This is set
+ * when in that case until the layout is done.
+ */
boolean mLayoutNeeded;
- // Currently running an exit animation?
+ /** Currently running an exit animation? */
boolean mExiting;
- // Currently on the mDestroySurface list?
+ /** Currently on the mDestroySurface list? */
boolean mDestroying;
- // Completely remove from window manager after exit animation?
+ /** Completely remove from window manager after exit animation? */
boolean mRemoveOnExit;
- // Set when the orientation is changing and this window has not yet
- // been updated for the new orientation.
+ /**
+ * Set when the orientation is changing and this window has not yet
+ * been updated for the new orientation.
+ */
boolean mOrientationChanging;
- // Is this window now (or just being) removed?
+ /** Is this window now (or just being) removed? */
boolean mRemoved;
- // Temp for keeping track of windows that have been removed when
- // rebuilding window list.
+ /**
+ * Temp for keeping track of windows that have been removed when
+ * rebuilding window list.
+ */
boolean mRebuilding;
// Input channel and input window handle used by the input dispatcher.