summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorIgor Murashkin <iam@google.com>2013-09-11 18:27:59 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-09-11 18:28:07 +0000
commit2cad64c0fbeba07bb546674e19cfb0166d7ec332 (patch)
tree7ec5d5625c648ea459f4c4ec17917dae633e26f2 /services
parent444ae3a2e66b4404fa715ab46403da09079dd572 (diff)
parenta86ab640f7bb0bf3cb4eaed80473ca8c5d131903 (diff)
downloadframeworks_base-2cad64c0fbeba07bb546674e19cfb0166d7ec332.zip
frameworks_base-2cad64c0fbeba07bb546674e19cfb0166d7ec332.tar.gz
frameworks_base-2cad64c0fbeba07bb546674e19cfb0166d7ec332.tar.bz2
Merge "Surface: Change OutOfResourcesException to be a runtime exception" into klp-dev
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/power/ElectronBeam.java7
-rw-r--r--services/java/com/android/server/wm/BlackFrame.java5
-rw-r--r--services/java/com/android/server/wm/DisplayMagnifier.java6
-rw-r--r--services/java/com/android/server/wm/FocusedStackFrame.java9
-rw-r--r--services/java/com/android/server/wm/ScreenRotationAnimation.java11
-rw-r--r--services/java/com/android/server/wm/StrictModeFlash.java3
-rw-r--r--services/java/com/android/server/wm/Watermark.java8
-rw-r--r--services/java/com/android/server/wm/WindowManagerService.java15
-rw-r--r--services/java/com/android/server/wm/WindowStateAnimator.java5
9 files changed, 36 insertions, 33 deletions
diff --git a/services/java/com/android/server/power/ElectronBeam.java b/services/java/com/android/server/power/ElectronBeam.java
index 0d92f66..729bd16 100644
--- a/services/java/com/android/server/power/ElectronBeam.java
+++ b/services/java/com/android/server/power/ElectronBeam.java
@@ -35,6 +35,7 @@ import android.util.FloatMath;
import android.util.Slog;
import android.view.Display;
import android.view.DisplayInfo;
+import android.view.Surface.OutOfResourcesException;
import android.view.Surface;
import android.view.SurfaceControl;
import android.view.SurfaceSession;
@@ -94,7 +95,7 @@ final class ElectronBeam {
// Texture names. We only use one texture, which contains the screenshot.
private final int[] mTexNames = new int[1];
private boolean mTexNamesGenerated;
- private float mTexMatrix[] = new float[16];
+ private final float mTexMatrix[] = new float[16];
// Vertex and corresponding texture coordinates.
// We have 4 2D vertices, so 8 elements. The vertices form a quad.
@@ -515,7 +516,7 @@ final class ElectronBeam {
mSurfaceControl = new SurfaceControl(mSurfaceSession,
"ElectronBeam", mDisplayWidth, mDisplayHeight,
PixelFormat.OPAQUE, flags);
- } catch (SurfaceControl.OutOfResourcesException ex) {
+ } catch (OutOfResourcesException ex) {
Slog.e(TAG, "Unable to create surface.", ex);
return false;
}
@@ -525,7 +526,7 @@ final class ElectronBeam {
mSurfaceControl.setSize(mDisplayWidth, mDisplayHeight);
mSurface = new Surface();
mSurface.copyFrom(mSurfaceControl);
-
+
mSurfaceLayout = new NaturalSurfaceLayout(mDisplayManager, mSurfaceControl);
mSurfaceLayout.onDisplayTransaction();
} finally {
diff --git a/services/java/com/android/server/wm/BlackFrame.java b/services/java/com/android/server/wm/BlackFrame.java
index 737d854..5aa266d 100644
--- a/services/java/com/android/server/wm/BlackFrame.java
+++ b/services/java/com/android/server/wm/BlackFrame.java
@@ -22,6 +22,7 @@ import android.graphics.Matrix;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.util.Slog;
+import android.view.Surface.OutOfResourcesException;
import android.view.SurfaceControl;
import android.view.SurfaceSession;
@@ -36,7 +37,7 @@ public class BlackFrame {
final SurfaceControl surface;
BlackSurface(SurfaceSession session, int layer, int l, int t, int r, int b, int layerStack)
- throws SurfaceControl.OutOfResourcesException {
+ throws OutOfResourcesException {
left = l;
top = t;
this.layer = layer;
@@ -112,7 +113,7 @@ public class BlackFrame {
}
public BlackFrame(SurfaceSession session, Rect outer, Rect inner, int layer, int layerStack,
- boolean forceDefaultOrientation) throws SurfaceControl.OutOfResourcesException {
+ boolean forceDefaultOrientation) throws OutOfResourcesException {
boolean success = false;
mForceDefaultOrientation = forceDefaultOrientation;
diff --git a/services/java/com/android/server/wm/DisplayMagnifier.java b/services/java/com/android/server/wm/DisplayMagnifier.java
index 0f51028..382d7b4 100644
--- a/services/java/com/android/server/wm/DisplayMagnifier.java
+++ b/services/java/com/android/server/wm/DisplayMagnifier.java
@@ -496,7 +496,7 @@ final class DisplayMagnifier {
mWindowManager.getDefaultDisplay().getRealSize(mTempPoint);
surfaceControl = new SurfaceControl(mWindowManagerService.mFxSession, SURFACE_TITLE,
mTempPoint.x, mTempPoint.y, PixelFormat.TRANSLUCENT, SurfaceControl.HIDDEN);
- } catch (SurfaceControl.OutOfResourcesException oore) {
+ } catch (OutOfResourcesException oore) {
/* ignore */
}
mSurfaceControl = surfaceControl;
@@ -629,7 +629,7 @@ final class DisplayMagnifier {
}
} catch (IllegalArgumentException iae) {
/* ignore */
- } catch (OutOfResourcesException oore) {
+ } catch (Surface.OutOfResourcesException oore) {
/* ignore */
}
if (canvas == null) {
@@ -644,7 +644,7 @@ final class DisplayMagnifier {
canvas.drawPath(path, mPaint);
mSurface.unlockCanvasAndPost(canvas);
-
+
if (mAlpha > 0) {
mSurfaceControl.show();
} else {
diff --git a/services/java/com/android/server/wm/FocusedStackFrame.java b/services/java/com/android/server/wm/FocusedStackFrame.java
index 9c18331..365b277 100644
--- a/services/java/com/android/server/wm/FocusedStackFrame.java
+++ b/services/java/com/android/server/wm/FocusedStackFrame.java
@@ -26,6 +26,7 @@ import android.graphics.Rect;
import android.graphics.Region;
import android.util.Slog;
import android.view.Display;
+import android.view.Surface.OutOfResourcesException;
import android.view.Surface;
import android.view.SurfaceControl;
import android.view.SurfaceSession;
@@ -39,9 +40,9 @@ class FocusedStackFrame {
private final SurfaceControl mSurfaceControl;
private final Surface mSurface = new Surface();
- private Rect mLastBounds = new Rect();
- private Rect mBounds = new Rect();
- private Rect mTmpDrawRect = new Rect();
+ private final Rect mLastBounds = new Rect();
+ private final Rect mBounds = new Rect();
+ private final Rect mTmpDrawRect = new Rect();
public FocusedStackFrame(Display display, SurfaceSession session) {
SurfaceControl ctrl = null;
@@ -56,7 +57,7 @@ class FocusedStackFrame {
ctrl.setLayerStack(display.getLayerStack());
ctrl.setAlpha(ALPHA);
mSurface.copyFrom(ctrl);
- } catch (SurfaceControl.OutOfResourcesException e) {
+ } catch (OutOfResourcesException e) {
}
mSurfaceControl = ctrl;
}
diff --git a/services/java/com/android/server/wm/ScreenRotationAnimation.java b/services/java/com/android/server/wm/ScreenRotationAnimation.java
index 7d90858..e630737 100644
--- a/services/java/com/android/server/wm/ScreenRotationAnimation.java
+++ b/services/java/com/android/server/wm/ScreenRotationAnimation.java
@@ -27,6 +27,7 @@ import android.graphics.Rect;
import android.util.Slog;
import android.view.Display;
import android.view.DisplayInfo;
+import android.view.Surface.OutOfResourcesException;
import android.view.Surface;
import android.view.SurfaceControl;
import android.view.SurfaceSession;
@@ -262,7 +263,7 @@ class ScreenRotationAnimation {
mSurfaceControl.setAlpha(0);
mSurfaceControl.show();
sur.destroy();
- } catch (SurfaceControl.OutOfResourcesException e) {
+ } catch (OutOfResourcesException e) {
Slog.w(TAG, "Unable to allocate freeze surface", e);
}
@@ -547,7 +548,7 @@ class ScreenRotationAnimation {
mCustomBlackFrame = new BlackFrame(session, outer, inner, FREEZE_LAYER + 3,
layerStack, false);
mCustomBlackFrame.setMatrix(mFrameInitialMatrix);
- } catch (SurfaceControl.OutOfResourcesException e) {
+ } catch (OutOfResourcesException e) {
Slog.w(TAG, "Unable to allocate black surface", e);
} finally {
SurfaceControl.closeTransaction();
@@ -587,7 +588,7 @@ class ScreenRotationAnimation {
mExitingBlackFrame = new BlackFrame(session, outer, inner, FREEZE_LAYER + 2,
layerStack, mForceDefaultOrientation);
mExitingBlackFrame.setMatrix(mFrameInitialMatrix);
- } catch (SurfaceControl.OutOfResourcesException e) {
+ } catch (OutOfResourcesException e) {
Slog.w(TAG, "Unable to allocate black surface", e);
} finally {
SurfaceControl.closeTransaction();
@@ -609,7 +610,7 @@ class ScreenRotationAnimation {
Rect inner = new Rect(0, 0, finalWidth, finalHeight);
mEnteringBlackFrame = new BlackFrame(session, outer, inner, FREEZE_LAYER,
layerStack, false);
- } catch (SurfaceControl.OutOfResourcesException e) {
+ } catch (OutOfResourcesException e) {
Slog.w(TAG, "Unable to allocate black surface", e);
} finally {
SurfaceControl.closeTransaction();
@@ -894,7 +895,7 @@ class ScreenRotationAnimation {
&& (mMoreStartEnter || mMoreStartExit || mMoreFinishEnter || mMoreFinishExit))
|| (USE_CUSTOM_BLACK_FRAME
&& (mMoreStartFrame || mMoreRotateFrame || mMoreFinishFrame))
- || mMoreRotateEnter || mMoreRotateExit
+ || mMoreRotateEnter || mMoreRotateExit
|| !mFinishAnimReady;
mSnapshotFinalMatrix.setConcat(mExitTransformation.getMatrix(), mSnapshotInitialMatrix);
diff --git a/services/java/com/android/server/wm/StrictModeFlash.java b/services/java/com/android/server/wm/StrictModeFlash.java
index 31628e3..fb5876b 100644
--- a/services/java/com/android/server/wm/StrictModeFlash.java
+++ b/services/java/com/android/server/wm/StrictModeFlash.java
@@ -23,6 +23,7 @@ import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.Region;
import android.view.Display;
+import android.view.Surface.OutOfResourcesException;
import android.view.Surface;
import android.view.SurfaceControl;
import android.view.SurfaceSession;
@@ -47,7 +48,7 @@ class StrictModeFlash {
ctrl.setPosition(0, 0);
ctrl.show();
mSurface.copyFrom(ctrl);
- } catch (SurfaceControl.OutOfResourcesException e) {
+ } catch (OutOfResourcesException e) {
}
mSurfaceControl = ctrl;
mDrawNeeded = true;
diff --git a/services/java/com/android/server/wm/Watermark.java b/services/java/com/android/server/wm/Watermark.java
index fedd314..e226e3d 100644
--- a/services/java/com/android/server/wm/Watermark.java
+++ b/services/java/com/android/server/wm/Watermark.java
@@ -27,10 +27,10 @@ import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;
import android.view.Display;
+import android.view.Surface.OutOfResourcesException;
import android.view.Surface;
import android.view.SurfaceControl;
import android.view.SurfaceSession;
-import android.view.Surface.OutOfResourcesException;
/**
* Displays a watermark on top of the window manager's windows.
@@ -119,7 +119,7 @@ class Watermark {
ctrl.setPosition(0, 0);
ctrl.show();
mSurface.copyFrom(ctrl);
- } catch (SurfaceControl.OutOfResourcesException e) {
+ } catch (OutOfResourcesException e) {
}
mSurfaceControl = ctrl;
}
@@ -144,11 +144,11 @@ class Watermark {
try {
c = mSurface.lockCanvas(dirty);
} catch (IllegalArgumentException e) {
- } catch (OutOfResourcesException e) {
+ } catch (Surface.OutOfResourcesException e) {
}
if (c != null) {
c.drawColor(0, PorterDuff.Mode.CLEAR);
-
+
int deltaX = mDeltaX;
int deltaY = mDeltaY;
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index b8d2050..f5e0531 100644
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -116,6 +116,7 @@ import android.view.InputEventReceiver;
import android.view.KeyEvent;
import android.view.MagnificationSpec;
import android.view.MotionEvent;
+import android.view.Surface.OutOfResourcesException;
import android.view.Surface;
import android.view.SurfaceControl;
import android.view.SurfaceSession;
@@ -461,7 +462,7 @@ public class WindowManagerService extends IWindowManager.Stub
// 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.
- private PowerManager.WakeLock mScreenFrozenLock;
+ private final PowerManager.WakeLock mScreenFrozenLock;
final AppTransition mAppTransition;
boolean mStartingIconInTransition = false;
@@ -664,7 +665,7 @@ public class WindowManagerService extends IWindowManager.Stub
boolean mInTouchMode = true;
private ViewServer mViewServer;
- private ArrayList<WindowChangeListener> mWindowChangeListeners =
+ private final ArrayList<WindowChangeListener> mWindowChangeListeners =
new ArrayList<WindowChangeListener>();
private boolean mWindowsChanged = false;
@@ -6812,7 +6813,7 @@ public class WindowManagerService extends IWindowManager.Stub
} else {
Slog.w(TAG, "Drag already in progress");
}
- } catch (SurfaceControl.OutOfResourcesException e) {
+ } catch (OutOfResourcesException e) {
Slog.e(TAG, "Can't allocate drag surface w=" + width + " h=" + height, e);
if (mDragState != null) {
mDragState.reset();
@@ -8580,12 +8581,8 @@ public class WindowManagerService extends IWindowManager.Stub
mAppTransition.getStartingPoint(p);
appAnimator.thumbnailX = p.x;
appAnimator.thumbnailY = p.y;
- } catch (SurfaceControl.OutOfResourcesException e) {
- Slog.e(TAG, "Can't allocate thumbnail surface w=" + dirty.width()
- + " h=" + dirty.height(), e);
- appAnimator.clearThumbnail();
- } catch (Surface.OutOfResourcesException e) {
- Slog.e(TAG, "Can't allocate Canvas surface w=" + dirty.width()
+ } catch (OutOfResourcesException e) {
+ Slog.e(TAG, "Can't allocate thumbnail/Canvas surface w=" + dirty.width()
+ " h=" + dirty.height(), e);
appAnimator.clearThumbnail();
}
diff --git a/services/java/com/android/server/wm/WindowStateAnimator.java b/services/java/com/android/server/wm/WindowStateAnimator.java
index 73325cb..9245542 100644
--- a/services/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/java/com/android/server/wm/WindowStateAnimator.java
@@ -29,6 +29,7 @@ import android.util.Slog;
import android.view.Display;
import android.view.DisplayInfo;
import android.view.MagnificationSpec;
+import android.view.Surface.OutOfResourcesException;
import android.view.SurfaceControl;
import android.view.SurfaceSession;
import android.view.WindowManager;
@@ -480,7 +481,7 @@ class WindowStateAnimator {
private final Rect mWindowCrop = new Rect();
private boolean mShown = false;
private int mLayerStack;
- private String mName;
+ private final String mName;
public SurfaceTrace(SurfaceSession s,
String name, int w, int h, int format, int flags)
@@ -694,7 +695,7 @@ class WindowStateAnimator {
+ attrs.format + " flags=0x"
+ Integer.toHexString(flags)
+ " / " + this);
- } catch (SurfaceControl.OutOfResourcesException e) {
+ } catch (OutOfResourcesException e) {
mWin.mHasSurface = false;
Slog.w(TAG, "OutOfResourcesException creating surface");
mService.reclaimSomeSurfaceMemoryLocked(this, "create", true);