diff options
Diffstat (limited to 'java')
| -rw-r--r-- | java/AndroidManifest.xml.in | 5 | ||||
| -rw-r--r-- | java/org/gnu/emacs/EmacsActivity.java | 2 | ||||
| -rw-r--r-- | java/org/gnu/emacs/EmacsDialog.java | 14 | ||||
| -rw-r--r-- | java/org/gnu/emacs/EmacsSurfaceView.java | 20 | ||||
| -rw-r--r-- | java/org/gnu/emacs/EmacsWindow.java | 2 |
5 files changed, 39 insertions, 4 deletions
diff --git a/java/AndroidManifest.xml.in b/java/AndroidManifest.xml.in index e79fb4e46e7..f2aede7369c 100644 --- a/java/AndroidManifest.xml.in +++ b/java/AndroidManifest.xml.in | |||
| @@ -77,10 +77,14 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. --> | |||
| 77 | @ANDROID_SHARED_USER_ID@ | 77 | @ANDROID_SHARED_USER_ID@ |
| 78 | android:extractNativeLibs="true"> | 78 | android:extractNativeLibs="true"> |
| 79 | 79 | ||
| 80 | <!-- See EmacsSurfaceView.onDraw for why hardware acceleration is | ||
| 81 | disabled. --> | ||
| 82 | |||
| 80 | <activity android:name="org.gnu.emacs.EmacsActivity" | 83 | <activity android:name="org.gnu.emacs.EmacsActivity" |
| 81 | android:launchMode="singleInstance" | 84 | android:launchMode="singleInstance" |
| 82 | android:windowSoftInputMode="adjustResize" | 85 | android:windowSoftInputMode="adjustResize" |
| 83 | android:exported="true" | 86 | android:exported="true" |
| 87 | android:hardwareAccelerated="false" | ||
| 84 | android:configChanges="orientation|screenSize|screenLayout|keyboardHidden"> | 88 | android:configChanges="orientation|screenSize|screenLayout|keyboardHidden"> |
| 85 | <intent-filter> | 89 | <intent-filter> |
| 86 | <action android:name="android.intent.action.MAIN" /> | 90 | <action android:name="android.intent.action.MAIN" /> |
| @@ -173,6 +177,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. --> | |||
| 173 | <activity android:name="org.gnu.emacs.EmacsMultitaskActivity" | 177 | <activity android:name="org.gnu.emacs.EmacsMultitaskActivity" |
| 174 | android:windowSoftInputMode="adjustResize" | 178 | android:windowSoftInputMode="adjustResize" |
| 175 | android:exported="true" | 179 | android:exported="true" |
| 180 | android:hardwareAccelerated="false" | ||
| 176 | android:configChanges="orientation|screenSize|screenLayout|keyboardHidden"/> | 181 | android:configChanges="orientation|screenSize|screenLayout|keyboardHidden"/> |
| 177 | 182 | ||
| 178 | <activity android:autoRemoveFromRecents="true" | 183 | <activity android:autoRemoveFromRecents="true" |
diff --git a/java/org/gnu/emacs/EmacsActivity.java b/java/org/gnu/emacs/EmacsActivity.java index fa9bff39bb0..d7b51388929 100644 --- a/java/org/gnu/emacs/EmacsActivity.java +++ b/java/org/gnu/emacs/EmacsActivity.java | |||
| @@ -70,7 +70,7 @@ public class EmacsActivity extends Activity | |||
| 70 | private boolean isFullscreen; | 70 | private boolean isFullscreen; |
| 71 | 71 | ||
| 72 | /* The last context menu to be closed. */ | 72 | /* The last context menu to be closed. */ |
| 73 | private Menu lastClosedMenu; | 73 | private static Menu lastClosedMenu; |
| 74 | 74 | ||
| 75 | static | 75 | static |
| 76 | { | 76 | { |
diff --git a/java/org/gnu/emacs/EmacsDialog.java b/java/org/gnu/emacs/EmacsDialog.java index 5f48a9a5f9f..42455ed78f8 100644 --- a/java/org/gnu/emacs/EmacsDialog.java +++ b/java/org/gnu/emacs/EmacsDialog.java | |||
| @@ -152,7 +152,7 @@ public final class EmacsDialog implements DialogInterface.OnDismissListener | |||
| 152 | toAlertDialog (Context context) | 152 | toAlertDialog (Context context) |
| 153 | { | 153 | { |
| 154 | AlertDialog dialog; | 154 | AlertDialog dialog; |
| 155 | int size, styleId; | 155 | int size, styleId, flag; |
| 156 | int[] attrs; | 156 | int[] attrs; |
| 157 | EmacsButton button; | 157 | EmacsButton button; |
| 158 | EmacsDialogButtonLayout layout; | 158 | EmacsDialogButtonLayout layout; |
| @@ -160,6 +160,7 @@ public final class EmacsDialog implements DialogInterface.OnDismissListener | |||
| 160 | ViewGroup.LayoutParams layoutParams; | 160 | ViewGroup.LayoutParams layoutParams; |
| 161 | Theme theme; | 161 | Theme theme; |
| 162 | TypedArray attributes; | 162 | TypedArray attributes; |
| 163 | Window window; | ||
| 163 | 164 | ||
| 164 | size = buttons.size (); | 165 | size = buttons.size (); |
| 165 | styleId = -1; | 166 | styleId = -1; |
| @@ -273,6 +274,17 @@ public final class EmacsDialog implements DialogInterface.OnDismissListener | |||
| 273 | } | 274 | } |
| 274 | } | 275 | } |
| 275 | 276 | ||
| 277 | /* Make sure the dialog is hardware accelerated. Hardware | ||
| 278 | acceleration is disabled for dialogs by default, because they | ||
| 279 | aren't enabled in EmacsActivity either. */ | ||
| 280 | |||
| 281 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) | ||
| 282 | { | ||
| 283 | flag = WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED; | ||
| 284 | window = dialog.getWindow (); | ||
| 285 | window.addFlags (flag); | ||
| 286 | } | ||
| 287 | |||
| 276 | return dialog; | 288 | return dialog; |
| 277 | } | 289 | } |
| 278 | 290 | ||
diff --git a/java/org/gnu/emacs/EmacsSurfaceView.java b/java/org/gnu/emacs/EmacsSurfaceView.java index 3f62af4ab99..54fe70e1634 100644 --- a/java/org/gnu/emacs/EmacsSurfaceView.java +++ b/java/org/gnu/emacs/EmacsSurfaceView.java | |||
| @@ -176,7 +176,25 @@ public final class EmacsSurfaceView extends View | |||
| 176 | onDraw (Canvas canvas) | 176 | onDraw (Canvas canvas) |
| 177 | { | 177 | { |
| 178 | /* Paint the view's bitmap; the bitmap might be recycled right | 178 | /* Paint the view's bitmap; the bitmap might be recycled right |
| 179 | now. */ | 179 | now. |
| 180 | |||
| 181 | Hardware acceleration is disabled in AndroidManifest.xml to | ||
| 182 | prevent Android from uploading the front buffer to the GPU from | ||
| 183 | a separate thread. This is important for two reasons: first, | ||
| 184 | the GPU command queue uses a massive amount of memory (dozens | ||
| 185 | of MiB) to upload bitmaps to the GPU, regardless of how much of | ||
| 186 | the bitmap has actually changed. | ||
| 187 | |||
| 188 | Secondly, asynchronous texturization leads to race conditions | ||
| 189 | when a buffer swap occurs before the front buffer is fully | ||
| 190 | uploaded to the GPU. Normally, only slight and tolerable | ||
| 191 | tearing should result from this behavior, but Android does not | ||
| 192 | properly interlock the ``generation ID'' used to avoid | ||
| 193 | texturizing unchanged bitmaps with the bitmap contents, | ||
| 194 | consequentially leading to textures in an incomplete state | ||
| 195 | remaining in use to the GPU if a buffer swap happens between | ||
| 196 | the image data being uploaded and the ``generation ID'' being | ||
| 197 | read. */ | ||
| 180 | 198 | ||
| 181 | if (frontBuffer != null) | 199 | if (frontBuffer != null) |
| 182 | canvas.drawBitmap (frontBuffer, 0f, 0f, uiThreadPaint); | 200 | canvas.drawBitmap (frontBuffer, 0f, 0f, uiThreadPaint); |
diff --git a/java/org/gnu/emacs/EmacsWindow.java b/java/org/gnu/emacs/EmacsWindow.java index 5e45275631b..0e96a8382d0 100644 --- a/java/org/gnu/emacs/EmacsWindow.java +++ b/java/org/gnu/emacs/EmacsWindow.java | |||
| @@ -1377,7 +1377,7 @@ public final class EmacsWindow extends EmacsHandleObject | |||
| 1377 | 1377 | ||
| 1378 | if (tem != null) | 1378 | if (tem != null) |
| 1379 | { | 1379 | { |
| 1380 | activity = (EmacsActivity) getAttachedConsumer (); | 1380 | activity = (EmacsActivity) tem; |
| 1381 | activity.syncFullscreenWith (EmacsWindow.this); | 1381 | activity.syncFullscreenWith (EmacsWindow.this); |
| 1382 | } | 1382 | } |
| 1383 | } | 1383 | } |