@ANDROID_SHARED_USER_ID@
android:extractNativeLibs="true">
+ <!-- See EmacsSurfaceView.onDraw for why hardware acceleration is
+ disabled. -->
+
<activity android:name="org.gnu.emacs.EmacsActivity"
android:launchMode="singleInstance"
android:windowSoftInputMode="adjustResize"
android:exported="true"
+ android:hardwareAccelerated="false"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<activity android:name="org.gnu.emacs.EmacsMultitaskActivity"
android:windowSoftInputMode="adjustResize"
android:exported="true"
+ android:hardwareAccelerated="false"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden"/>
<activity android:autoRemoveFromRecents="true"
private boolean isFullscreen;
/* The last context menu to be closed. */
- private Menu lastClosedMenu;
+ private static Menu lastClosedMenu;
static
{
toAlertDialog (Context context)
{
AlertDialog dialog;
- int size, styleId;
+ int size, styleId, flag;
int[] attrs;
EmacsButton button;
EmacsDialogButtonLayout layout;
ViewGroup.LayoutParams layoutParams;
Theme theme;
TypedArray attributes;
+ Window window;
size = buttons.size ();
styleId = -1;
}
}
+ /* Make sure the dialog is hardware accelerated. Hardware
+ acceleration is disabled for dialogs by default, because they
+ aren't enabled in EmacsActivity either. */
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
+ {
+ flag = WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
+ window = dialog.getWindow ();
+ window.addFlags (flag);
+ }
+
return dialog;
}
onDraw (Canvas canvas)
{
/* Paint the view's bitmap; the bitmap might be recycled right
- now. */
+ now.
+
+ Hardware acceleration is disabled in AndroidManifest.xml to
+ prevent Android from uploading the front buffer to the GPU from
+ a separate thread. This is important for two reasons: first,
+ the GPU command queue uses a massive amount of memory (dozens
+ of MiB) to upload bitmaps to the GPU, regardless of how much of
+ the bitmap has actually changed.
+
+ Secondly, asynchronous texturization leads to race conditions
+ when a buffer swap occurs before the front buffer is fully
+ uploaded to the GPU. Normally, only slight and tolerable
+ tearing should result from this behavior, but Android does not
+ properly interlock the ``generation ID'' used to avoid
+ texturizing unchanged bitmaps with the bitmap contents,
+ consequentially leading to textures in an incomplete state
+ remaining in use to the GPU if a buffer swap happens between
+ the image data being uploaded and the ``generation ID'' being
+ read. */
if (frontBuffer != null)
canvas.drawBitmap (frontBuffer, 0f, 0f, uiThreadPaint);
if (tem != null)
{
- activity = (EmacsActivity) getAttachedConsumer ();
+ activity = (EmacsActivity) tem;
activity.syncFullscreenWith (EmacsWindow.this);
}
}