CherishOS / android_manifest

Build CherishOS here
62 stars 37 forks source link

Telegram fails on multi-user, clonedapps, work-profile, etc... #34

Open Huexxx opened 5 months ago

Huexxx commented 5 months ago

The problem was reported too by an user of alioth build (official), but same problem here on my unnofficial build for chiron. Thank to that, I can asume that is not a device-related, kernel-related or tree-related specific issue.

In his case was using it with another user. I've got the same issue cloning it, with terminal activated work profile, or using island/insular. Same problem in all the cases.

After setting up cloned Telegram, you can launch it, but after pressing "Start messaging" app FCs.

CLONE_PROBLEM.txt CLONE_PROBLEM_D.txt

I've patched sepolicies as much as I could, but to say that there's a denial that I cannot address...

W ssioncontroller: type=1400 audit(0.0:42): avc: denied { search } for name="0" dev="sda17" ino=177427 scontext=u:r:permissioncontroller_app:s0:c177,c257,c522,c768 tcontext=u:object_r:system_data_file:s0:c512,c768 tclass=dir permissive=0

I have created the needed rule but it keeps being denied...

https://github.com/Huexxx/device_xiaomi_msm8998-common/commit/2e2bf1a84b102b253180d7cbcfb43b4362272948

I've also created this needed rule:

allow untrusted_app_32 media_rw_data_file:file { relabelfrom relabelto };

In this case I've removed the denials, but without sucess getting it to work.

I've forced FCs at 16:00:00, 16:00:10, 16:00:20... to better locate the problem on logs.

This is the main crash, and it only appears the first time:

--------- beginning of crash
06-21 16:00:01.369  7913 10317 E AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
06-21 16:00:01.369  7913 10317 E AndroidRuntime: Process: org.telegram.messenger, PID: 7913
06-21 16:00:01.369  7913 10317 E AndroidRuntime: java.lang.SecurityException: Neither user 1010463 nor current process has android.permission.INTERACT_ACROSS_USERS_FULL.
06-21 16:00:01.369  7913 10317 E AndroidRuntime:    at android.os.Parcel.createExceptionOrNull(Parcel.java:3182)
06-21 16:00:01.369  7913 10317 E AndroidRuntime:    at android.os.Parcel.createException(Parcel.java:3166)
06-21 16:00:01.369  7913 10317 E AndroidRuntime:    at android.os.Parcel.readException(Parcel.java:3149)
06-21 16:00:01.369  7913 10317 E AndroidRuntime:    at android.os.Parcel.readException(Parcel.java:3091)
06-21 16:00:01.369  7913 10317 E AndroidRuntime:    at com.android.internal.textservice.ITextServicesManager$Stub$Proxy.getCurrentSpellCheckerSubtype(ITextServicesManager.java:246)
06-21 16:00:01.369  7913 10317 E AndroidRuntime:    at android.view.textservice.TextServicesManager.getCurrentSpellCheckerSubtype(TextServicesManager.java:363)
06-21 16:00:01.369  7913 10317 E AndroidRuntime:    at android.widget.TextView.updateTextServicesLocaleLocked(TextView.java:13523)
06-21 16:00:01.369  7913 10317 E AndroidRuntime:    at android.widget.TextView.-$$Nest$mupdateTextServicesLocaleLocked(Unknown Source:0)
06-21 16:00:01.369  7913 10317 E AndroidRuntime:    at android.widget.TextView$3.run(TextView.java:13512)
06-21 16:00:01.369  7913 10317 E AndroidRuntime:    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
06-21 16:00:01.369  7913 10317 E AndroidRuntime:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
06-21 16:00:01.369  7913 10317 E AndroidRuntime:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
06-21 16:00:01.369  7913 10317 E AndroidRuntime:    at java.lang.Thread.run(Thread.java:1012)
06-21 16:00:01.369  7913 10317 E AndroidRuntime: Caused by: android.os.RemoteException: Remote stack trace:
06-21 16:00:01.369  7913 10317 E AndroidRuntime:    at android.app.ContextImpl.enforce(ContextImpl.java:2335)
06-21 16:00:01.369  7913 10317 E AndroidRuntime:    at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:2363)
06-21 16:00:01.369  7913 10317 E AndroidRuntime:    at com.android.server.inputmethod.InputMethodManagerService.getCurrentInputMethodSubtype(InputMethodManagerService.java:5430)
06-21 16:00:01.369  7913 10317 E AndroidRuntime:    at android.view.inputmethod.IInputMethodManagerGlobalInvoker.getCurrentInputMethodSubtype(IInputMethodManagerGlobalInvoker.java:406)
06-21 16:00:01.369  7913 10317 E AndroidRuntime:    at android.view.inputmethod.InputMethodManager.getCurrentInputMethodSubtype(InputMethodManager.java:3927)
06-21 16:00:01.369  7913 10317 E AndroidRuntime: 
06-21 16:00:01.374  7913 10318 I Process : Sending signal. PID: 7913 SIG: 9

IMHO every cloned app shouldn't need to have "android.permission.INTERACT_ACROSS_USERS_FULL" permission...

These are the recurrent FC on every attempt:

06-21 16:00:01.475  1811  1950 W ActivityManager: pid 1811 system sent binder code 3 with flags 1 to frozen apps and got error -32
06-21 16:00:01.476  1811  1950 W WindowManager: Failed to deliver inset control state change to w=Window{2d9157b u10 org.telegram.messenger/org.telegram.messenger.DefaultIcon EXITING}
06-21 16:00:01.476  1811  1950 W WindowManager: android.os.DeadObjectException
06-21 16:00:01.476  1811  1950 W WindowManager:     at android.os.BinderProxy.transactNative(Native Method)
06-21 16:00:01.476  1811  1950 W WindowManager:     at android.os.BinderProxy.transact(BinderProxy.java:586)
06-21 16:00:01.476  1811  1950 W WindowManager:     at android.view.IWindow$Stub$Proxy.insetsControlChanged(IWindow.java:484)
06-21 16:00:01.476  1811  1950 W WindowManager:     at com.android.server.wm.WindowState.notifyInsetsControlChanged(WindowState.java:3841)
06-21 16:00:01.476  1811  1950 W WindowManager:     at com.android.server.wm.InsetsStateController.lambda$notifyPendingInsetsControlChanged$3(InsetsStateController.java:375)
06-21 16:00:01.476  1811  1950 W WindowManager:     at com.android.server.wm.InsetsStateController.$r8$lambda$MnP7XA1MDcyrUwoj0hcoT5hTO8E(InsetsStateController.java:0)
06-21 16:00:01.476  1811  1950 W WindowManager:     at com.android.server.wm.InsetsStateController$$ExternalSyntheticLambda0.run(R8$$SyntheticClass:0)
06-21 16:00:01.476  1811  1950 W WindowManager:     at com.android.server.wm.WindowAnimator.executeAfterPrepareSurfacesRunnables(WindowAnimator.java:313)
06-21 16:00:01.476  1811  1950 W WindowManager:     at com.android.server.wm.WindowAnimator.animate(WindowAnimator.java:206)
06-21 16:00:01.476  1811  1950 W WindowManager:     at com.android.server.wm.WindowAnimator.lambda$new$1(WindowAnimator.java:99)
06-21 16:00:01.476  1811  1950 W WindowManager:     at com.android.server.wm.WindowAnimator.$r8$lambda$AS_wbK9i-bc6ocCFop7s9PnXP80(WindowAnimator.java:0)
06-21 16:00:01.476  1811  1950 W WindowManager:     at com.android.server.wm.WindowAnimator$$ExternalSyntheticLambda1.doFrame(R8$$SyntheticClass:0)
06-21 16:00:01.476  1811  1950 W WindowManager:     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1397)
06-21 16:00:01.476  1811  1950 W WindowManager:     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1408)
06-21 16:00:01.476  1811  1950 W WindowManager:     at android.view.Choreographer.doCallbacks(Choreographer.java:1008)
06-21 16:00:01.476  1811  1950 W WindowManager:     at android.view.Choreographer.doFrame(Choreographer.java:934)
06-21 16:00:01.476  1811  1950 W WindowManager:     at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1382)
06-21 16:00:01.476  1811  1950 W WindowManager:     at android.os.Handler.handleCallback(Handler.java:959)
06-21 16:00:01.476  1811  1950 W WindowManager:     at android.os.Handler.dispatchMessage(Handler.java:100)
06-21 16:00:01.476  1811  1950 W WindowManager:     at android.os.Looper.loopOnce(Looper.java:232)
06-21 16:00:01.476  1811  1950 W WindowManager:     at android.os.Looper.loop(Looper.java:317)
06-21 16:00:01.476  1811  1950 W WindowManager:     at android.os.HandlerThread.run(HandlerThread.java:68)
06-21 16:00:01.476  1811  1950 W WindowManager:     at com.android.server.ServiceThread.run(ServiceThread.java:46)

Any ideas?

I'll provide any log or test that you need.

Regards.

Huexxx commented 5 months ago

Seems to be related to InputMethod... when Telegram clone invokes the keyboard we get the FATAL EXCEPTION.

I've tried to modify clonedapps list to allow to clone GBoard, but with GBoard cloned on same user (10) Telegram keeps failing in the same way.