you-apps / TranslateYou

Privacy focused translator app built with MD3
https://you-apps.net
GNU General Public License v3.0
986 stars 45 forks source link

Tapping the image button gets ignored #423

Open mpeter50 opened 7 months ago

mpeter50 commented 7 months ago

Steps to reproduce

  1. Open app
  2. Install tesseract package for select languages (e.g. english) in the settings menu
  3. Go back to main screen
  4. Ensure that I have selected a source language for which I have installed a tesseract package (e.g. english)
  5. Tap image button

Expected behavior

The app should do something that allows me to give it the image to be scanned

Actual behavior

Nothing happens. No new menu opens, and the main menu remains unchanged. The app has not frozen as it can still be used for text translation.

Translate You version

9.0, F-droid official repo

Android version

Android 6

Other details

The app does not print anything to the logcat, however every time I press the image button, in that exact moment the following is printed to logcat:

D WtComponentManager: start the package is com.google.android.gms the call is com.bnyro.translate startType is 1

WtComponentManager is a component of my phone's system. The line is printed by the "system" process.

Somewhat related: I also use LibreTube, which you develop. I often have issues with it, but no log messages are printed to logcat, and I find this to make debugging harder. Not too long ago I have built the debug version of that app for myself and installed it for testing, and noticed that this way it does log some useful information. Why I tell you this is that I wanted to ask you to please consider to not turn off Info level logging in release builds of your apps. It would be even better if verbose/debug level could be toggled on temporarily in the settings.

Acknowledgements

Bnyro commented 5 months ago

Please share a crash log while using a debuggable build from the app, you can find these under the actions tab on GitHub.

mpeter50 commented 5 months ago

The app does not crash in this issue.

When using the APK I have built in #424 , pressing the image button on the top bar results in the following logcat messages being printed:

06-03 22:23:29.314 22167 22167 I Timeline: Timeline: Activity_launch_request time:144048104
06-03 22:23:29.316  3984 10466 D WtComponentManager: start the package is com.google.android.gms the call is com.bnyro.translate.debug startType is 1
06-03 22:23:29.434  3984  4053 D WtProcessController: packageMoveToBackground packageName:com.bnyro.translate.debug
06-03 22:23:29.434  3984  4053 D WtProcessController: set foreground process size 1 pid:22167pacakgeName:com.bnyro.translate.debug
06-03 22:23:29.505 22167 22191 V RenderScript: 0x55a385fc20 Launching thread(s), CPUs 8

This is a filtered list of messages, because my phone floods me with logcat messages. The filter was to only include lines containing the app's current process ID or the string bnyro.

The process ID of the app in these log lines is 22167.

If I disable the filtering, these seem to be relevant that are close to the above ones in time:

06-03 22:23:29.314 22167 22167 I Timeline: Timeline: Activity_launch_request time:144048104
06-03 22:23:29.316  3984 10466 D WtComponentManager: start the package is com.google.android.gms the call is com.bnyro.translate.debug startType is 1
06-03 22:23:29.320  1595  4009 I ActivityManager: START u0 {act=androidx.activity.result.contract.action.PICK_IMAGES typ=image/* cmp=com.google.android.gms/.photopicker.ui.PhotoPickerActivity} from uid 10646 on display 0
06-03 22:23:29.325  3984  4053 D WtProcessController: onAMCreateActivity callback
06-03 22:23:29.328  5983  5992 E ANDR-PERF-MPCTL: Invalid profile no. 0, total profiles 0 only
06-03 22:23:29.329  1595  4009 D ActivityTrigger: ActivityTrigger activityPauseTrigger
06-03 22:23:29.331  3984  4053 D WtProcessController: onAMPauseActivity callback
06-03 22:23:29.355  3984  4053 D WtProcessController: onAMRestartActivity callback
06-03 22:23:29.355  3984  4053 D WtProcessController: packageMoveToBackground packageName:com.google.android.gms
06-03 22:23:29.355  3984  4053 D WtProcessController: set foreground process size 4 pid:14027pacakgeName:com.google.android.gms
06-03 22:23:29.356  1595  4921 I Timeline: Timeline: App_transition_ready time:144048146
06-03 22:23:29.368 21709 21709 W ResourceType: For resource 0x7f1604ff, entry index(1279) is beyond type entryCount(492)
06-03 22:23:29.418  1595  3670 I Timeline: Timeline: App_transition_ready time:144048208
06-03 22:23:29.421  1595  3670 D ActivityTrigger: ActivityTrigger activityPauseTrigger
06-03 22:23:29.422  3984  4053 D WtProcessController: onAMPauseActivity callback
06-03 22:23:29.423 21709 21709 D ActivityThreadInjector: clearCachedDrawables.
06-03 22:23:29.425  1595  5051 W InputMethodManagerService: Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@b51224f attribute=null, token = android.os.BinderProxy@2c44238
06-03 22:23:29.432  1595  4071 I Timeline: Timeline: App_transition_ready time:144048222
06-03 22:23:29.432  1595  4071 I Timeline: Timeline: App_transition_stopped time:144048223
06-03 22:23:29.434  3984  4053 D WtProcessController: onAMResumeActivity callback
06-03 22:23:29.434  3984  4053 D WtProcessController: packageMoveToBackground packageName:com.bnyro.translate.debug
06-03 22:23:29.434  3984  4053 D WtProcessController: set foreground process size 1 pid:22167pacakgeName:com.bnyro.translate.debug
drogga commented 5 months ago

This is probably due to the old OS (Android 6) ver., or your ROM if you are using a custom one, tho I might be wrong, but at the same time it should support 5.0, given that the minSDKversion is 21, which doesn't necessarily mean that it's properly tested or at all there or on 6.0, from the first log in the OP - it looks like it's trying to launch Google Play Services (no idea why, probably because of the Tesseract data DL), but it should launch com.android.documentsui.picker.PickActivity, which is the SAF (aka. system's "Files" app), which is probably missing on your end or entirely in A.6, that's my guess, which is probably true.

mpeter50 commented 5 months ago

The documentsui app works with other apps. From time to time I use it to grant access for apps to the SD card, some use it for picking a file, and other than documentsui being very slow, I did not enounter issues like this.

I have found it weird too that this tries to launch a GMS activity. What happens on GMS-free devices? But the recognition models have already been downloaded at the point I click this image button, so what I expect at this point is that the app would either open documentsui for picking an image, or better, that the system prompt would open to choose from several of my gallery apps. Like, if I want to open an image with the ImagePipe app from F-droid, I can choose from Simple Gallery, the system gallery app, "Take a Photo from Camera" (this is done by an F-droid app too), MiXplorer's select action, or App Manager's Interceptor. But this system prompt is what opens from most other apps too.

drogga commented 5 months ago

"What happens on GMS-free devices?" -> It just opens the picker (I've just installed it on Lineage 18.1=A.11, without GApps), which I agree that it should be handled as you suggested, because some systems (like an A.11 car head unit) don't have this "Files" app, so some apps with a bad implementation just crash (example: "MediaInfo" v24.04), others suggest an alternative, but some only support certain apps, like Explorer (by SpeedSoftware), ZArchiver, etc.