The emulator's scroll counter keeps growing while a session is not being viewed
(onTextChanged() skips the screen update - and clearScrollCounter() - when the
changed session is not current or the activity is not visible). attachSession()
reset the view state but left the counter intact: the first screen update after
attaching would hand the whole stale delta to the viewport-hold logic, which
treats it as "rows appended just now" and pins the view thousands of lines deep
into the scrollback, making scrolling appear dead in that session.
Discard the counter on attach - the user starts at the live bottom.
versionCode 1024 / versionName 0.119.0-titan2.2
- Only bubble real system keys (isSystem() synthetic letter events
injected by the Titan 2 keyboard layer now reach the KCM path).
- Latch hardware Shift/Alt from modifier key events; injected letter
events arrive without meta state. Cleared on keyup, focus loss and
session attach.
- Consult the kcm alt layer for Alt+<key> (Alt+W -> '1') and send the
resolved char without the ESC alt-prefix.
- Hold the scroll viewport when the user scrolled up while output is
streaming; auto-follow resumes on scroll-to-bottom or typing.
- versionCode 1023 / versionName 0.119.0-titan2.1
It may cause a `NullPointerException` on Android `6`.
```
java.lang.RuntimeException: Unable to create service com.termux.app.TermuxService: java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.String java.lang.CharSequence.toString()' on a null object reference
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3048)
at android.app.ActivityThread.access$2000(ActivityThread.java:156)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1493)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5609)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:746)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636)
Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.String java.lang.CharSequence.toString()' on a null object reference
at android.app.Notification$Builder.processLegacyText(Notification.java:3217)
at android.app.Notification$Builder.access$1100(Notification.java:2009)
at android.app.Notification$BigTextStyle.makeBigContentView(Notification.java:4283)
at android.app.Notification$BigTextStyle.populateBigContentView(Notification.java:4321)
at android.app.Notification$Style.buildStyled(Notification.java:3858)
at android.app.Notification$Builder.build(Notification.java:3661)
at com.termux.app.TermuxService.buildNotification(TermuxService.java:841)
at com.termux.app.TermuxService.runStartForeground(TermuxService.java:206)
at com.termux.app.TermuxService.onCreate(TermuxService.java:120)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3038)
... 8 more
```
- https://cs.android.com/android/platform/superproject/+/android-6.0.1_r1:frameworks/base/core/java/android/app/Notification.java;l=4135Closestermux/termux-app#5113
Fixes the following deprecation warning when builing:
> AndroidManifest.xml:44:9-41 Warning:
> android:extractNativeLibs should not be specified in this source AndroidManifest.xml file. See https://d.android.com/guide/topics/manifest/application-element#extractNativeLibs for more information.
> The AGP Upgrade Assistant can remove the attribute from the AndroidManifest.xml file and update the build file accordingly. See https://d.android.com/studio/build/agp-upgrade-assistant for more information.
The useLegacyPackaging DSL option is already used in `app/build.gradle`.
- After https://github.com/termux/termux-app/pull/3619, unfortunately this error began to occur when one attempts to use the [Publication to Maven Local guide](https://github.com/termux/termux-app/wiki/Termux-Libraries#forking-and-local-development) to compile all Termux APKs entirely from source, which previously worked:
```
> Task :app:processDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
> Android resource linking failed
ERROR: /home/tacokoneko/code/termux/termux-generator/termux-apps-main/termux-api/app/src/main/AndroidManifest.xml:72:9-76:20: AAPT: error: resource style/Theme.BaseActivity.DayNight.NoActionBar (aka com.termux.api:style/Theme.BaseActivity.DayNight.NoActionBar) not found.
ERROR: /home/tacokoneko/code/termux/termux-generator/termux-apps-main/termux-api/app/src/main/AndroidManifest.xml:88:9-93:20: AAPT: error: resource style/Theme.BaseActivity.DayNight.NoActionBar (aka com.termux.api:style/Theme.BaseActivity.DayNight.NoActionBar) not found.
ERROR: /home/tacokoneko/code/termux/termux-generator/termux-apps-main/termux-api/app/build/intermediates/packaged_manifests/debug/processDebugManifestForPackage/AndroidManifest.xml:183: AAPT: error: resource style/Theme.MarkdownViewActivity.DayNight (aka three.termux.api:style/Theme.MarkdownViewActivity.DayNight) not found.
```
- This PR fixes that error by using `components.default` in the `publications` block instead of `components.findByName('release')` and adding a `publishing` block to the `android` section of the `build.gradle` of each affected library, in accordance with https://developer.android.com/reference/tools/gradle-api/9.1/com/android/build/api/dsl/PublishingOptions and https://stackoverflow.com/a/71366104. `components.release` no longer works, but testing indicates that `components.default` works.
I'm seeing a lot of bug reports that should have been made to
termux/termux-packages, but people don't just read things not written in
BOLD and caps it seems. So now scream out, so that they do read.
Also direct confused users to termux/termux-packages, in case it does
actually belong to termux/termux-app, we can always transfer the issue
there
Handle KEYCODE_LANGUAGE_SWITCH to allow keyboard layout switching
on external keyboards by passing the event to system handler.
Fixes#4133
Co-authored-by: uncher <36965412+uncher@users.noreply.github.com>
Replace `gradle/wrapper-validation-action@v3` with
`gradle/actions/wrapper-validation@5` which should fix the error seen
e.g. [here](https://github.com/termux/termux-app/actions/runs/20685857619/job/59386383274):
> Error: The action gradle/actions/wrapper-validation@v3.5.0 is not allowed in termux/termux-app because all actions must be from a repository owned by termux, created by GitHub, or match one of the patterns: gradle/actions/dependency-submission@*, gradle/wrapper-validation-action@v*.
Reading `ReportInfo` with `Bundle.getSerializable()` by `ReportActivity` is triggering exception when default algorithm is used for `serialVersionUID` in Termux:API plugin app when error notification created in `ResultReturner.returnData()` by `TermuxPluginUtils.sendPluginCommandErrorNotification()` is clicked.
```
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.termux/com.termux.shared.activities.ReportActivity}: android.os.BadParcelableException: Parcelable encountered IOException reading a Serializable object (name = com.termux.shared.models.ReportInfo)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4280)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4467)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:222)
at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:133)
at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:103)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2823)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loopOnce(Looper.java:248)
at android.os.Looper.loop(Looper.java:338)
at android.app.ActivityThread.main(ActivityThread.java:9067)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:593)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:932)
Caused by: android.os.BadParcelableException: Parcelable encountered IOException reading a Serializable object (name = com.termux.shared.models.ReportInfo)
at android.os.Parcel.readSerializableInternal(Parcel.java:5520)
at android.os.Parcel.readValue(Parcel.java:5038)
at android.os.Parcel.readValue(Parcel.java:4702)
at android.os.Parcel.-$$Nest$mreadValue(Unknown Source:0)
at android.os.Parcel$LazyValue.apply(Parcel.java:4811)
at android.os.Parcel$LazyValue.apply(Parcel.java:4764)
at android.os.BaseBundle.unwrapLazyValueFromMapLocked(BaseBundle.java:446)
at android.os.BaseBundle.getValueAt(BaseBundle.java:426)
at android.os.BaseBundle.getValue(BaseBundle.java:397)
at android.os.BaseBundle.getValue(BaseBundle.java:380)
at android.os.BaseBundle.getValue(BaseBundle.java:373)
at android.os.BaseBundle.getSerializable(BaseBundle.java:1522)
at android.os.Bundle.getSerializable(Bundle.java:1339)
at com.termux.shared.activities.ReportActivity.updateUI(ReportActivity.java:140)
at com.termux.shared.activities.ReportActivity.onCreate(ReportActivity.java:93)
at android.app.Activity.performCreate(Activity.java:9155)
at android.app.Activity.performCreate(Activity.java:9133)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1521)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4262)
... 13 more
Caused by: java.io.InvalidClassException: com.termux.shared.models.ReportInfo; local class incompatible: stream classdesc serialVersionUID = -5165426368218339031, local class serialVersionUID = 1
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:652)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1743)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1624)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1902)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1442)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:430)
at android.os.Parcel.readSerializableInternal(Parcel.java:5507)
... 31 more
```
If using release APK with obfuscation enabled, then following exception will be triggered.
```
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.termux/com.termux.shared.activities.ReportActivity}: android.os.BadParcelableException: Parcelable encountered ClassNotFoundException reading a Serializable object (name = I0.a)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3864)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4006)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:111)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2462)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:240)
at android.os.Looper.loop(Looper.java:351)
at android.app.ActivityThread.main(ActivityThread.java:8377)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)
Caused by: android.os.BadParcelableException: Parcelable encountered ClassNotFoundException reading a Serializable object (name = I0.a)
at android.os.Parcel.readSerializableInternal(Parcel.java:5113)
at android.os.Parcel.readValue(Parcel.java:4655)
at android.os.Parcel.readValue(Parcel.java:4363)
at android.os.Parcel.-$$Nest$mreadValue(Unknown Source:0)
at android.os.Parcel$LazyValue.apply(Parcel.java:4461)
at android.os.Parcel$LazyValue.apply(Parcel.java:4420)
at android.os.BaseBundle.getValueAt(BaseBundle.java:394)
at android.os.BaseBundle.getValue(BaseBundle.java:374)
at android.os.BaseBundle.getValue(BaseBundle.java:357)
at android.os.BaseBundle.getValue(BaseBundle.java:350)
at android.os.BaseBundle.getSerializable(BaseBundle.java:1451)
at android.os.Bundle.getSerializable(Bundle.java:1144)
at com.termux.shared.activities.ReportActivity.updateUI(ReportActivity.java:136)
at com.termux.shared.activities.ReportActivity.onCreate(ReportActivity.java:89)
at android.app.Activity.performCreate(Activity.java:8397)
at android.app.Activity.performCreate(Activity.java:8370)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1403)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3837)
... 12 more
Caused by: java.lang.ClassNotFoundException: I0.a
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:536)
at android.os.Parcel$2.resolveClass(Parcel.java:5090)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1733)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1624)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1902)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1442)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:430)
at android.os.Parcel.readSerializableInternal(Parcel.java:5096)
... 29 more
Caused by: java.lang.ClassNotFoundException: I0.a
... 38 more
```
Related issue https://github.com/termux/termux-api/issues/762
SD sequence (`${CSI}${N}T`) was scrolling the whole width
of the terminal instead of just between the margins.
RI sequence (`${ESC}M`, move cursor up 1 line) was doing the same.
Fixed that.
Fixes#2576 where in tmux scrolling one of several
side-by-side panels down resulted in all visually scrolling.
Implement the following CSI escape sequences from
https://invisible-island.net/xterm/ctlseqs/ctlseqs.html:
> CSI Ps ; Ps ; Ps t
> [..]
> Ps = 1 4 ⇒ Report xterm text area size in pixels.
> Result is CSI 4 ; height ; width t
> [..]
> Ps = 1 6 ⇒ Report xterm character cell size in pixels.
> Result is CSI 6 ; height ; width t
Extracted from changes in https://github.com/termux/termux-app/pull/2973
by @MatanZ and adopted to play well with the just merged #3098 (.ws_xpixel
and .ws_ypixel values in winsize).
This allows to get terminal size in pixel using `TIOCGWINSZ` ioctl.
Set `.ws_xpixel` using `columns * cell_width` and set `.ws_ypixel` using `rows * cell_height`.
Cell width and height is font width and line spacing, respectively.