Loading core/java/android/app/ActivityManagerNative.java +4 −2 Original line number Diff line number Diff line Loading @@ -1020,7 +1020,8 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM data.enforceInterface(IActivityManager.descriptor); int[] pids = data.createIntArray(); String reason = data.readString(); boolean res = killPids(pids, reason); boolean secure = data.readInt() != 0; boolean res = killPids(pids, reason, secure); reply.writeNoException(); reply.writeInt(res ? 1 : 0); return true; Loading Loading @@ -2636,12 +2637,13 @@ class ActivityManagerProxy implements IActivityManager mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0); data.recycle(); } public boolean killPids(int[] pids, String reason) throws RemoteException { public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeIntArray(pids); data.writeString(reason); data.writeInt(secure ? 1 : 0); mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0); boolean res = reply.readInt() != 0; data.recycle(); Loading core/java/android/app/IActivityManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -250,7 +250,7 @@ public interface IActivityManager extends IInterface { public void noteWakeupAlarm(IIntentSender sender) throws RemoteException; public boolean killPids(int[] pids, String reason) throws RemoteException; public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException; // Special low-level communication with activity manager. public void startRunning(String pkg, String cls, String action, Loading core/java/android/view/HardwareRenderer.java +8 −8 Original line number Diff line number Diff line Loading @@ -108,14 +108,14 @@ public abstract class HardwareRenderer { * * @return True if the initialization was successful, false otherwise. */ abstract boolean initialize(SurfaceHolder holder); abstract boolean initialize(SurfaceHolder holder) throws Surface.OutOfResourcesException; /** * Updates the hardware renderer for the specified surface. * * @param holder The holder for the surface to hardware accelerate. */ abstract void updateSurface(SurfaceHolder holder); abstract void updateSurface(SurfaceHolder holder) throws Surface.OutOfResourcesException; /** * Setup the hardware renderer for drawing. This is called for every Loading Loading @@ -189,7 +189,7 @@ public abstract class HardwareRenderer { * @param holder */ void initializeIfNeeded(int width, int height, View.AttachInfo attachInfo, SurfaceHolder holder) { SurfaceHolder holder) throws Surface.OutOfResourcesException { if (isRequested()) { // We lost the gl context, so recreate it. if (!isEnabled()) { Loading Loading @@ -366,7 +366,7 @@ public abstract class HardwareRenderer { } @Override boolean initialize(SurfaceHolder holder) { boolean initialize(SurfaceHolder holder) throws Surface.OutOfResourcesException { if (isRequested() && !isEnabled()) { initializeEgl(); mGl = createEglSurface(holder); Loading Loading @@ -395,7 +395,7 @@ public abstract class HardwareRenderer { } @Override void updateSurface(SurfaceHolder holder) { void updateSurface(SurfaceHolder holder) throws Surface.OutOfResourcesException { if (isRequested() && isEnabled()) { createEglSurface(holder); } Loading Loading @@ -446,7 +446,7 @@ public abstract class HardwareRenderer { sEglContext = createContext(sEgl, sEglDisplay, sEglConfig); } GL createEglSurface(SurfaceHolder holder) { GL createEglSurface(SurfaceHolder holder) throws Surface.OutOfResourcesException { // Check preconditions. if (sEgl == null) { throw new RuntimeException("egl not initialized"); Loading Loading @@ -494,7 +494,7 @@ public abstract class HardwareRenderer { * the context is current and bound to a surface. */ if (!sEgl.eglMakeCurrent(sEglDisplay, mEglSurface, mEglSurface, sEglContext)) { throw new RuntimeException("eglMakeCurrent failed " throw new Surface.OutOfResourcesException("eglMakeCurrent failed " + getEGLErrorString(sEgl.eglGetError())); } Loading @@ -516,7 +516,7 @@ public abstract class HardwareRenderer { @Override void initializeIfNeeded(int width, int height, View.AttachInfo attachInfo, SurfaceHolder holder) { SurfaceHolder holder) throws Surface.OutOfResourcesException { if (isRequested()) { checkEglErrors(); super.initializeIfNeeded(width, height, attachInfo, holder); Loading core/java/android/view/IWindowSession.aidl +5 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,11 @@ interface IWindowSession { out Rect outVisibleInsets, out Configuration outConfig, out Surface outSurface); /** * Called by a client to report that it ran out of graphics memory. */ boolean outOfMemory(IWindow window); /** * Give the window manager a hint of the part of the window that is * completely transparent, allowing it to work with the surface flinger Loading core/java/android/view/ViewRoot.java +58 −8 Original line number Diff line number Diff line Loading @@ -1066,7 +1066,20 @@ public final class ViewRoot extends Handler implements ViewParent, mPreviousTransparentRegion.setEmpty(); if (mAttachInfo.mHardwareRenderer != null) { try { hwInitialized = mAttachInfo.mHardwareRenderer.initialize(mHolder); } catch (Surface.OutOfResourcesException e) { Log.e(TAG, "OutOfResourcesException initializing HW surface", e); try { if (!sWindowSession.outOfMemory(mWindow)) { Slog.w(TAG, "No processes killed for memory; killing self"); Process.killProcess(Process.myPid()); } } catch (RemoteException ex) { } mLayoutRequested = true; // ask wm for a new surface next time. return; } } } } else if (!mSurface.isValid()) { Loading @@ -1081,7 +1094,20 @@ public final class ViewRoot extends Handler implements ViewParent, } else if (surfaceGenerationId != mSurface.getGenerationId() && mSurfaceHolder == null && mAttachInfo.mHardwareRenderer != null) { fullRedrawNeeded = true; try { mAttachInfo.mHardwareRenderer.updateSurface(mHolder); } catch (Surface.OutOfResourcesException e) { Log.e(TAG, "OutOfResourcesException updating HW surface", e); try { if (!sWindowSession.outOfMemory(mWindow)) { Slog.w(TAG, "No processes killed for memory; killing self"); Process.killProcess(Process.myPid()); } } catch (RemoteException ex) { } mLayoutRequested = true; // ask wm for a new surface next time. return; } } } catch (RemoteException e) { } Loading Loading @@ -1569,14 +1595,24 @@ public final class ViewRoot extends Handler implements ViewParent, canvas.setDensity(mDensity); } catch (Surface.OutOfResourcesException e) { Log.e(TAG, "OutOfResourcesException locking surface", e); // TODO: we should ask the window manager to do something! // for now we just do nothing try { if (!sWindowSession.outOfMemory(mWindow)) { Slog.w(TAG, "No processes killed for memory; killing self"); Process.killProcess(Process.myPid()); } } catch (RemoteException ex) { } mLayoutRequested = true; // ask wm for a new surface next time. return; } catch (IllegalArgumentException e) { Log.e(TAG, "IllegalArgumentException locking surface", e); // TODO: we should ask the window manager to do something! // for now we just do nothing try { if (!sWindowSession.outOfMemory(mWindow)) { Slog.w(TAG, "No processes killed for memory; killing self"); Process.killProcess(Process.myPid()); } } catch (RemoteException ex) { } mLayoutRequested = true; // ask wm for a new surface next time. return; } Loading Loading @@ -2033,8 +2069,22 @@ public final class ViewRoot extends Handler implements ViewParent, if (mAttachInfo.mHardwareRenderer != null && mSurface != null && mSurface.isValid()) { mFullRedrawNeeded = true; try { mAttachInfo.mHardwareRenderer.initializeIfNeeded(mWidth, mHeight, mAttachInfo, mHolder); } catch (Surface.OutOfResourcesException e) { Log.e(TAG, "OutOfResourcesException locking surface", e); try { if (!sWindowSession.outOfMemory(mWindow)) { Slog.w(TAG, "No processes killed for memory; killing self"); Process.killProcess(Process.myPid()); } } catch (RemoteException ex) { } // Retry in a bit. sendMessageDelayed(obtainMessage(msg.what, msg.arg1, msg.arg2), 500); return; } } } Loading Loading
core/java/android/app/ActivityManagerNative.java +4 −2 Original line number Diff line number Diff line Loading @@ -1020,7 +1020,8 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM data.enforceInterface(IActivityManager.descriptor); int[] pids = data.createIntArray(); String reason = data.readString(); boolean res = killPids(pids, reason); boolean secure = data.readInt() != 0; boolean res = killPids(pids, reason, secure); reply.writeNoException(); reply.writeInt(res ? 1 : 0); return true; Loading Loading @@ -2636,12 +2637,13 @@ class ActivityManagerProxy implements IActivityManager mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0); data.recycle(); } public boolean killPids(int[] pids, String reason) throws RemoteException { public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeIntArray(pids); data.writeString(reason); data.writeInt(secure ? 1 : 0); mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0); boolean res = reply.readInt() != 0; data.recycle(); Loading
core/java/android/app/IActivityManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -250,7 +250,7 @@ public interface IActivityManager extends IInterface { public void noteWakeupAlarm(IIntentSender sender) throws RemoteException; public boolean killPids(int[] pids, String reason) throws RemoteException; public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException; // Special low-level communication with activity manager. public void startRunning(String pkg, String cls, String action, Loading
core/java/android/view/HardwareRenderer.java +8 −8 Original line number Diff line number Diff line Loading @@ -108,14 +108,14 @@ public abstract class HardwareRenderer { * * @return True if the initialization was successful, false otherwise. */ abstract boolean initialize(SurfaceHolder holder); abstract boolean initialize(SurfaceHolder holder) throws Surface.OutOfResourcesException; /** * Updates the hardware renderer for the specified surface. * * @param holder The holder for the surface to hardware accelerate. */ abstract void updateSurface(SurfaceHolder holder); abstract void updateSurface(SurfaceHolder holder) throws Surface.OutOfResourcesException; /** * Setup the hardware renderer for drawing. This is called for every Loading Loading @@ -189,7 +189,7 @@ public abstract class HardwareRenderer { * @param holder */ void initializeIfNeeded(int width, int height, View.AttachInfo attachInfo, SurfaceHolder holder) { SurfaceHolder holder) throws Surface.OutOfResourcesException { if (isRequested()) { // We lost the gl context, so recreate it. if (!isEnabled()) { Loading Loading @@ -366,7 +366,7 @@ public abstract class HardwareRenderer { } @Override boolean initialize(SurfaceHolder holder) { boolean initialize(SurfaceHolder holder) throws Surface.OutOfResourcesException { if (isRequested() && !isEnabled()) { initializeEgl(); mGl = createEglSurface(holder); Loading Loading @@ -395,7 +395,7 @@ public abstract class HardwareRenderer { } @Override void updateSurface(SurfaceHolder holder) { void updateSurface(SurfaceHolder holder) throws Surface.OutOfResourcesException { if (isRequested() && isEnabled()) { createEglSurface(holder); } Loading Loading @@ -446,7 +446,7 @@ public abstract class HardwareRenderer { sEglContext = createContext(sEgl, sEglDisplay, sEglConfig); } GL createEglSurface(SurfaceHolder holder) { GL createEglSurface(SurfaceHolder holder) throws Surface.OutOfResourcesException { // Check preconditions. if (sEgl == null) { throw new RuntimeException("egl not initialized"); Loading Loading @@ -494,7 +494,7 @@ public abstract class HardwareRenderer { * the context is current and bound to a surface. */ if (!sEgl.eglMakeCurrent(sEglDisplay, mEglSurface, mEglSurface, sEglContext)) { throw new RuntimeException("eglMakeCurrent failed " throw new Surface.OutOfResourcesException("eglMakeCurrent failed " + getEGLErrorString(sEgl.eglGetError())); } Loading @@ -516,7 +516,7 @@ public abstract class HardwareRenderer { @Override void initializeIfNeeded(int width, int height, View.AttachInfo attachInfo, SurfaceHolder holder) { SurfaceHolder holder) throws Surface.OutOfResourcesException { if (isRequested()) { checkEglErrors(); super.initializeIfNeeded(width, height, attachInfo, holder); Loading
core/java/android/view/IWindowSession.aidl +5 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,11 @@ interface IWindowSession { out Rect outVisibleInsets, out Configuration outConfig, out Surface outSurface); /** * Called by a client to report that it ran out of graphics memory. */ boolean outOfMemory(IWindow window); /** * Give the window manager a hint of the part of the window that is * completely transparent, allowing it to work with the surface flinger Loading
core/java/android/view/ViewRoot.java +58 −8 Original line number Diff line number Diff line Loading @@ -1066,7 +1066,20 @@ public final class ViewRoot extends Handler implements ViewParent, mPreviousTransparentRegion.setEmpty(); if (mAttachInfo.mHardwareRenderer != null) { try { hwInitialized = mAttachInfo.mHardwareRenderer.initialize(mHolder); } catch (Surface.OutOfResourcesException e) { Log.e(TAG, "OutOfResourcesException initializing HW surface", e); try { if (!sWindowSession.outOfMemory(mWindow)) { Slog.w(TAG, "No processes killed for memory; killing self"); Process.killProcess(Process.myPid()); } } catch (RemoteException ex) { } mLayoutRequested = true; // ask wm for a new surface next time. return; } } } } else if (!mSurface.isValid()) { Loading @@ -1081,7 +1094,20 @@ public final class ViewRoot extends Handler implements ViewParent, } else if (surfaceGenerationId != mSurface.getGenerationId() && mSurfaceHolder == null && mAttachInfo.mHardwareRenderer != null) { fullRedrawNeeded = true; try { mAttachInfo.mHardwareRenderer.updateSurface(mHolder); } catch (Surface.OutOfResourcesException e) { Log.e(TAG, "OutOfResourcesException updating HW surface", e); try { if (!sWindowSession.outOfMemory(mWindow)) { Slog.w(TAG, "No processes killed for memory; killing self"); Process.killProcess(Process.myPid()); } } catch (RemoteException ex) { } mLayoutRequested = true; // ask wm for a new surface next time. return; } } } catch (RemoteException e) { } Loading Loading @@ -1569,14 +1595,24 @@ public final class ViewRoot extends Handler implements ViewParent, canvas.setDensity(mDensity); } catch (Surface.OutOfResourcesException e) { Log.e(TAG, "OutOfResourcesException locking surface", e); // TODO: we should ask the window manager to do something! // for now we just do nothing try { if (!sWindowSession.outOfMemory(mWindow)) { Slog.w(TAG, "No processes killed for memory; killing self"); Process.killProcess(Process.myPid()); } } catch (RemoteException ex) { } mLayoutRequested = true; // ask wm for a new surface next time. return; } catch (IllegalArgumentException e) { Log.e(TAG, "IllegalArgumentException locking surface", e); // TODO: we should ask the window manager to do something! // for now we just do nothing try { if (!sWindowSession.outOfMemory(mWindow)) { Slog.w(TAG, "No processes killed for memory; killing self"); Process.killProcess(Process.myPid()); } } catch (RemoteException ex) { } mLayoutRequested = true; // ask wm for a new surface next time. return; } Loading Loading @@ -2033,8 +2069,22 @@ public final class ViewRoot extends Handler implements ViewParent, if (mAttachInfo.mHardwareRenderer != null && mSurface != null && mSurface.isValid()) { mFullRedrawNeeded = true; try { mAttachInfo.mHardwareRenderer.initializeIfNeeded(mWidth, mHeight, mAttachInfo, mHolder); } catch (Surface.OutOfResourcesException e) { Log.e(TAG, "OutOfResourcesException locking surface", e); try { if (!sWindowSession.outOfMemory(mWindow)) { Slog.w(TAG, "No processes killed for memory; killing self"); Process.killProcess(Process.myPid()); } } catch (RemoteException ex) { } // Retry in a bit. sendMessageDelayed(obtainMessage(msg.what, msg.arg1, msg.arg2), 500); return; } } } Loading