osfans / trime

同文安卓輸入法平臺3.x/Android-rime/Rime Input Method Engine for Android
http://osfans.github.io/trime/
GNU General Public License v3.0
3.08k stars 372 forks source link

Crash with Shelter #823

Closed Bambooin closed 2 years ago

Bambooin commented 2 years ago

Describe the bug A clear and concise description of what the bug is.

Crash on Shelter: https://github.com/PeterCxy/Shelter

To Reproduce Steps to reproduce the bug:

  1. Install Shelter
  2. Open Trime in Shelter
  3. Select Profile->Shared directory
  4. Crash on Trime

Expected behavior A clear and concise description of what you expected to happen.

Log If applicable, add crash log to quick focus your problem.

Screenshots If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

Bambooin commented 2 years ago

Profile==> Storage ==> Shared directory

It's /storage/emulated/0/rime, but in Sheter it's /storage/emulated/12/rime

So the copy asset operation failed with IO exception.

We shoudn't hard code the shared diretory.

tumuyan commented 2 years ago

so why not use /sdcard/rime/ as before?

WhiredPlanck commented 2 years ago

Profile==> Storage ==> Shared directory

It's /storage/emulated/0/rime, but in Sheter it's /storage/emulated/12/rime

So the copy asset operation failed with IO exception.

We shoudn't hard code the shared diretory.

Manage to workaround it.

WhiredPlanck commented 2 years ago

so why not use /sdcard/rime/ as before?

I use the API given by system to get the path programmatically, but before you first modify the path, the summary will use the hardcoded default value defined in the XML file, and I have no idea how to keep it same with the value in the sharedpreference.

Iey4iej3 commented 2 years ago

This becomes a serious bug in the latest update

App Package Name: com.osfans.trime
App Version Name: 3.2.8
App Version Code: 20220901

trime does not work any longer in Work Profile, and crashes due to a lot of permission errors.

Crash log:

E/CustomActivityOnCrash( 6998): The previous app process crashed. This is the stack trace of the crash:
E/CustomActivityOnCrash( 6998): android.view.InflateException: Binary XML file line #11 in com.osfans.trime:layout/input_root: Binary XML file line #19 in com.osfans.trime:layout/tab_bar: Error inflating class com.osfans.trime.ime.symbol.TabView
E/CustomActivityOnCrash( 6998): Caused by: android.view.InflateException: Binary XML file line #19 in com.osfans.trime:layout/tab_bar: Error inflating class com.osfans.trime.ime.symbol.TabView
E/CustomActivityOnCrash( 6998): Caused by: java.lang.reflect.InvocationTargetException
E/CustomActivityOnCrash( 6998):     at java.lang.reflect.Constructor.newInstance0(Native Method)
E/CustomActivityOnCrash( 6998):     at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
E/CustomActivityOnCrash( 6998):     at android.view.LayoutInflater.createView(LayoutInflater.java:858)
E/CustomActivityOnCrash( 6998):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1010)
E/CustomActivityOnCrash( 6998):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965)
E/CustomActivityOnCrash( 6998):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:1127)
E/CustomActivityOnCrash( 6998):     at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
E/CustomActivityOnCrash( 6998):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:1130)
E/CustomActivityOnCrash( 6998):     at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
E/CustomActivityOnCrash( 6998):     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:1267)
E/CustomActivityOnCrash( 6998):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:1123)
E/CustomActivityOnCrash( 6998):     at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
E/CustomActivityOnCrash( 6998):     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:1267)
E/CustomActivityOnCrash( 6998):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:1123)
E/CustomActivityOnCrash( 6998):     at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
E/CustomActivityOnCrash( 6998):     at android.view.LayoutInflater.inflate(LayoutInflater.java:686)
E/CustomActivityOnCrash( 6998):     at android.view.LayoutInflater.inflate(LayoutInflater.java:538)
E/CustomActivityOnCrash( 6998):     at com.osfans.trime.databinding.InputRootBinding.inflate(InputRootBinding.java:52)
E/CustomActivityOnCrash( 6998):     at com.osfans.trime.databinding.InputRootBinding.inflate(InputRootBinding.java:46)
E/CustomActivityOnCrash( 6998):     at com.osfans.trime.ime.core.Trime.onCreateInputView(Trime.java:737)
E/CustomActivityOnCrash( 6998):     at android.inputmethodservice.InputMethodService.updateInputViewShown(InputMethodService.java:1877)
E/CustomActivityOnCrash( 6998):     at android.inputmethodservice.InputMethodService.prepareWindow(InputMethodService.java:2290)
E/CustomActivityOnCrash( 6998):     at android.inputmethodservice.InputMethodService.showWindow(InputMethodService.java:2257)
E/CustomActivityOnCrash( 6998):     at android.inputmethodservice.InputMethodService$InputMethodImpl.showSoftInput(InputMethodService.java:819)
E/CustomActivityOnCrash( 6998):     at android.inputmethodservice.InputMethodService$InputMethodImpl.showSoftInputWithToken(InputMethodService.java:793)
E/CustomActivityOnCrash( 6998):     at android.inputmethodservice.IInputMethodWrapper.executeMessage(IInputMethodWrapper.java:225)
E/CustomActivityOnCrash( 6998):     at com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:44)
E/CustomActivityOnCrash( 6998):     at android.os.Handler.dispatchMessage(Handler.java:106)
E/CustomActivityOnCrash( 6998):     at android.os.Looper.loopOnce(Looper.java:201)
E/CustomActivityOnCrash( 6998):     at android.os.Looper.loop(Looper.java:288)
E/CustomActivityOnCrash( 6998):     at android.app.ActivityThread.main(ActivityThread.java:7870)
E/CustomActivityOnCrash( 6998):     at java.lang.reflect.Method.invoke(Native Method)
E/CustomActivityOnCrash( 6998):     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/CustomActivityOnCrash( 6998):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
E/CustomActivityOnCrash( 6998): Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object java.util.Map.get(java.lang.Object)' on a null object reference
E/CustomActivityOnCrash( 6998):     at com.osfans.trime.data.Config.getColorObject(Config.java:641)
E/CustomActivityOnCrash( 6998):     at com.osfans.trime.data.Config.getColor(Config.java:560)
E/CustomActivityOnCrash( 6998):     at com.osfans.trime.ime.symbol.TabView.reset(TabView.java:64)
E/CustomActivityOnCrash( 6998):     at com.osfans.trime.ime.symbol.TabView.<init>(TabView.java:100)
E/CustomActivityOnCrash( 6998):     ... 34 more
E/FileIOUtils( 6998): create file </storage/emulated/0/rime/opencc/HKVariants.txt> failed.
E/FileIOUtils( 6998): create file </storage/emulated/0/rime/opencc/HKVariantsRev.txt> failed.
E/FileIOUtils( 6998): create file </storage/emulated/0/rime/opencc/HKVariantsRevPhrases.txt> failed.
E/FileIOUtils( 6998): create file </storage/emulated/0/rime/opencc/JPShinjitaiCharacters.txt> failed.
E/FileIOUtils( 6998): create file </storage/emulated/0/rime/opencc/JPShinjitaiPhrases.txt> failed.
E/FileIOUtils( 6998): create file </storage/emulated/0/rime/opencc/JPVariants.txt> failed.
E/FileIOUtils( 6998): create file </storage/emulated/0/rime/opencc/STCharacters.txt> failed.
E/FileIOUtils( 6998): create file </storage/emulated/0/rime/opencc/STPhrases.txt> failed.
E/FileIOUtils( 6998): create file </storage/emulated/0/rime/opencc/TSCharacters.txt> failed.
E/FileIOUtils( 6998): create file </storage/emulated/0/rime/opencc/TSPhrases.txt> failed.
E/FileIOUtils( 6998): create file </storage/emulated/0/rime/opencc/TWPhrases.txt> failed.
E/FileIOUtils( 6998): create file </storage/emulated/0/rime/opencc/TWPhrasesRev.txt> failed.
E/FileIOUtils( 6998): create file </storage/emulated/0/rime/opencc/TWVariants.txt> failed.
E/FileIOUtils( 6998): create file </storage/emulated/0/rime/opencc/TWVariantsRev.txt> failed.
E/FileIOUtils( 6998): create file </storage/emulated/0/rime/opencc/TWVariantsRevPhrases.txt> failed.
E/FileIOUtils( 6998): create file </storage/emulated/0/rime/opencc/hk2s.json> failed.
E/FileIOUtils( 6998): create file </storage/emulated/0/rime/opencc/hk2t.json> failed.
E/FileIOUtils( 6998): create file </storage/emulated/0/rime/opencc/jp2t.json> failed.
E/FileIOUtils( 6998): create file </storage/emulated/0/rime/opencc/s2hk.json> failed.
E/FileIOUtils( 6998): create file </storage/emulated/0/rime/opencc/s2t.json> failed.
E/FileIOUtils( 6998): create file </storage/emulated/0/rime/opencc/s2tw.json> failed.
E/FileIOUtils( 6998): create file </storage/emulated/0/rime/opencc/s2twp.json> failed.
E/FileIOUtils( 6998): create file </storage/emulated/0/rime/opencc/t2hk.json> failed.
E/FileIOUtils( 6998): create file </storage/emulated/0/rime/opencc/t2jp.json> failed.
E/FileIOUtils( 6998): create file </storage/emulated/0/rime/opencc/t2s.json> failed.
E/FileIOUtils( 6998): create file </storage/emulated/0/rime/opencc/t2tw.json> failed.
E/FileIOUtils( 6998): create file </storage/emulated/0/rime/opencc/tw2s.json> failed.
E/FileIOUtils( 6998): create file </storage/emulated/0/rime/opencc/tw2sp.json> failed.
E/FileIOUtils( 6998): create file </storage/emulated/0/rime/opencc/tw2t.json> failed.
E/FileIOUtils( 6998): create file </storage/emulated/0/rime/tongwenfeng.trime.yaml> failed.
E/FileIOUtils( 6998): create file </storage/emulated/0/rime/trime.yaml> failed.
W/System.err( 6998): java.io.IOException: Permission denied
W/System.err( 6998):    at java.io.UnixFileSystem.createFileExclusively0(Native Method)
W/System.err( 6998):    at java.io.UnixFileSystem.createFileExclusively(UnixFileSystem.java:317)
W/System.err( 6998):    at java.io.File.createNewFile(File.java:1006)
W/System.err( 6998):    at com.osfans.trime.data.DataManager.sync(DataManager.kt:59)
W/System.err( 6998):    at com.osfans.trime.data.Config.<init>(Config.java:104)
W/System.err( 6998):    at com.osfans.trime.data.Config.<init>(Config.java:92)
W/System.err( 6998):    at com.osfans.trime.data.Config.get(Config.java:73)
W/System.err( 6998):    at com.osfans.trime.ime.keyboard.KeyboardSwitcher.newOrReset(KeyboardSwitcher.kt:35)
W/System.err( 6998):    at com.osfans.trime.ime.keyboard.KeyboardSwitcher.<init>(KeyboardSwitcher.kt:27)
W/System.err( 6998):    at com.osfans.trime.ime.core.Trime.onCreate(Trime.java:387)
W/System.err( 6998):    at android.app.ActivityThread.handleCreateService(ActivityThread.java:4554)
W/System.err( 6998):    at android.app.ActivityThread.access$1700(ActivityThread.java:256)
W/System.err( 6998):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2110)
W/System.err( 6998):    at android.os.Handler.dispatchMessage(Handler.java:106)
W/System.err( 6998):    at android.os.Looper.loopOnce(Looper.java:201)
W/System.err( 6998):    at android.os.Looper.loop(Looper.java:288)
W/System.err( 6998):    at android.app.ActivityThread.main(ActivityThread.java:7870)
W/System.err( 6998):    at java.lang.reflect.Method.invoke(Native Method)
W/System.err( 6998):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
W/System.err( 6998):    at com.android.internal.os.ZygoteInit.main
Iey4iej3 commented 2 years ago

any new version incorperating this fix? the development seems a bit stalled, thus a small version bump for bug fixes might help.

WhiredPlanck commented 2 years ago

any new version incorperating this fix? the development seems a bit stalled, thus a small version bump for bug fixes might help.

Unfortunately no new version yet ...... There are a lot of bugs waiting to be fixed, so we may have no much time to care about the release. You may want to download a git version from Actions.