0x192 / universal-android-debloater

Cross-platform GUI written in Rust using ADB to debloat non-rooted android devices. Improve your privacy, the security and battery life of your device.
GNU General Public License v3.0
15.65k stars 825 forks source link

Removal of `com.lenovo.ue.device` causes system reset #713

Open PhrozenByte opened 1 year ago

PhrozenByte commented 1 year ago

Your phone model: Lenovo Tab P11 TB-J606

Describe the issue Uninstalling com.lenovo.ue.device (removal is recommended by UAD) causes the system to reset after 5-10 seconds (apparently when the annoying persistent "Join the User Experience program" notification was supposed to show). Disabling the app instead of uninstalling it causes the same issue.

I didn't use UAD on this tablet before I've just recently updated to TB-J606F_S320273_230302_ROW, so it might be a rather new issue.

Package added by @0x192 Related: #348 #350

You have a solution? Restore resp. re-enable com.lenovo.ue.device.

It's safe to remove the related app com.tblenovo.center though.

UAD log n/a

AnonymousWP commented 1 year ago

What do you think? Should we change the removal to expert and mention it in the description? Only changing the one of com.lenovo.ue.device or do you think more testing is required?

PhrozenByte commented 1 year ago

I'm running it like this (i.e. with com.lenovo.ue.device still enabled, but com.tblenovo.center removed) for a few days now, no issues yet (besides Lenovo's annoying UXP notification). So I guess changing com.lenovo.ue.device (and only this one) from removal to expert and simply referencing this GitHub issue in the description is the best way to go.

On a side note: Should it be expert, or unsafe? According to the FAQ an expert app should never cause a boot loop. Even though technically removing this app doesn't cause a boot loop, it still forces a hardware reset within just a few seconds after unlocking the device. I was lucky that this time frame was long enough to re-enable USB debugging and re-install the app without doing a factory reset...

AnonymousWP commented 1 year ago

I created a PR, can you check if it's sufficient like this? Also, I used unsafe, because a factory reset doesn't belong to the basic operations of an OS.

TikvahTerminator commented 1 year ago

Just wanted to add to this, as I recently had the same problem. Not sure about other Lenovo devices, but on the M10 Plus 3rd Gen 2023 (TB128FU) removing the com.lenovo.ue.device package results in the the system crashing immediately after a user logs in due to the package being absent. However, after looking at the logcat output, it doesn't actually seem to be com.lenovo.ue.device which is directly causing the crash. it's com.lenovo.tbengine, which is called "UDS Real Time Engine".

05-26 21:54:06.553 3659 3750 E ActivityThread: Failed to find provider info for com.lenovo.ue.device.provider 05-26 21:54:06.554 3659 3750 E AndroidRuntime: FATAL EXCEPTION: Thread-3 05-26 21:54:06.554 3659 3750 E AndroidRuntime: Process: com.lenovo.tbengine, PID: 3659 05-26 21:54:06.554 3659 3750 E AndroidRuntime: java.lang.IllegalArgumentException: Unknown URL content://com.lenovo.ue.device.provider/app 05-26 21:54:06.554 3659 3750 E AndroidRuntime: at android.content.ContentResolver.insert(ContentResolver.java:2192) 05-26 21:54:06.554 3659 3750 E AndroidRuntime: at android.content.ContentResolver.insert(ContentResolver.java:2157) 05-26 21:54:06.554 3659 3750 E AndroidRuntime: at com.lenovo.tbengine.core.util.PromptUtils.lambda$sendData$0$PromptUtils(PromptUtils.java:93) 05-26 21:54:06.554 3659 3750 E AndroidRuntime: at com.lenovo.tbengine.core.util.-$$Lambda$PromptUtils$Ciq_uYvVjyh8lbPyrVBSnqRFTKM.run(Unknown Source:6) 05-26 21:54:06.554 3659 3750 E AndroidRuntime: at java.lang.Thread.run(Thread.java:1012) 05-26 21:54:06.554 1010 1010 D SurfaceFlinger: isVirtual : 0 05-26 21:54:06.554 1010 1010 D CompositionEngine: Output::prepare isVirtual : 0 05-26 21:54:06.555 1010 1010 D CompositionEngine: setColorTransform, return 05-26 21:54:06.555 2668 2668 I AlarmManager: set [name: SystemMemoryCache type: 2 triggerAtMillis: 315360237349 windowMillis: -1 intervalMillis: 0] 05-26 21:54:06.559 3659 3659 D UDSEngine14: [V1.1.15.221014/999000002][MainService.onStartCommand:56][2]pid3659 05-26 21:54:06.559 3659 3659 D UDSEngine14: [V1.1.15.221014/999000002][MainService.onStartCommand:57][2]service_last_pid3323 05-26 21:54:06.561 1613 1630 W RescueParty: get module info error: 05-26 21:54:06.561 1613 1630 W RescueParty: android.content.pm.PackageManager$NameNotFoundException: No module info for package: com.lenovo.tbengine 05-26 21:54:06.561 1613 1630 W RescueParty: at android.app.ApplicationPackageManager.getModuleInfo(ApplicationPackageManager.java:1089) 05-26 21:54:06.561 1613 1630 W RescueParty: at com.android.server.RescueParty.needNoteCrash(RescueParty.java:814) 05-26 21:54:06.561 1613 1630 W RescueParty: at com.android.server.am.AppErrors.crashApplicationInner(AppErrors.java:599) 05-26 21:54:06.561 1613 1630 W RescueParty: at com.android.server.am.AppErrors.crashApplication(AppErrors.java:562) 05-26 21:54:06.561 1613 1630 W RescueParty: at com.android.server.am.ActivityManagerService.handleApplicationCrashInner(ActivityManagerService.java:8048) 05-26 21:54:06.561 1613 1630 W RescueParty: at com.android.server.am.ActivityManagerService.handleApplicationCrash(ActivityManagerService.java:7937) 05-26 21:54:06.561 1613 1630 W RescueParty: at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2030) 05-26 21:54:06.561 1613 1630 W RescueParty: at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2519) 05-26 21:54:06.561 1613 1630 W RescueParty: at android.os.Binder.execTransactInternal(Binder.java:1179) 05-26 21:54:06.561 1613 1630 W RescueParty: at android.os.Binder.execTransact(Binder.java:1143) 05-26 21:54:06.561 1613 1630 D RescuePartyRecorder: notePersistentAppCrash(com.lenovo.tbengine) 05-26 21:54:06.563 3659 3659 D UDSEngine14: [V1.1.15.221014/999000002][MainService.onStartCommand:61][2]service_start_count4 05-26 21:54:06.563 3659 3659 D UDSEngine14: [V1.1.15.221014/999000002][MultiUser.isUnderPrimaryUser:13][2]userId=0 05-26 21:54:06.564 1613 1630 W ActivityManager: Process com.lenovo.tbengine has crashed too many times, killing! Reason: crashed quickly

Interestingly, searching for things about people who have disabled the User Experience package previously leads to a post on the Lenovo forums where people sussed this out.. I can't find anything out about com.lenovo.tbengine online, but opening up the apk; i think that it's the Update Delivery Service for the tablet, and is responsible for querying whether new firmware ia available on login.

TL;DR: If UE is disabled, then TBEngine must also be disabled.

Oh, also, removing UE on my tablet results in it shutting down, with the message "Factory Data Reset" flashing quickly on the screen before it reboots into Android recovery. A Screenshot of the Lenovo Android Recovery screen telling a user their device may be corrupt It could be worth warning people, so that they don't think their device is borked, perform a Factory Reset from recovery, and lose all their data by accident when you can just "Try Again".

I hope any of those ramblings are helpful! 😂

SelfRef commented 1 year ago

This is the issue I explained on XDA (here). It's related with connectivity and bootloop occurs only if Internet is found. There's also logcat attached explaining that's happening.

I upgraded my Lenovo Yoga Tab 13 today to the newest Android 13 and it seems this issue is even more annoying. Before the solution was to disable both com.lenovo.ue.device and com.lenovo.tbengine but after upgrade it seems both have to be enabled. If you have this issue and want to fix it without wipe the device just wait until lockscreen show up and quickly disable WiFi. After that enable both packages or just use adb shell with commands:

adb shell pm enable com.lenovo.ue.device
adb shell pm enable com.lenovo.tbengine

You can run them quickly since boot animation starts and after reboot system should work fine.

PhrozenByte commented 1 year ago

@SelfRef Looks like com.lenovo.tbengine isn't in the package list yet. What's the purpose of com.lenovo.tbengine? @TikvahTerminator noted that it might be responsible for the firmware update service; if this is true, we probably can't recommend removing it, right? Besides that issue, is it safe to remove (i.e. did you test that everything works properly when both packages were removed)? Depending on the purpose of com.lenovo.tbengine we could even add it to the recommendations list (see below).

@AnonymousWP Any updates on merging #730? Considering @SelfRef's findings, is it possible to declare that when one attempts to remove com.lenovo.ue.device, one must also remove com.lenovo.tbengine? Depending on com.lenovo.tbengine's purpose, is it even possible to declare a "negative dependency"?

SelfRef commented 1 year ago

From what I see in tbengine's manifest, this is basically Lenovo's rootkit that can handle access to everything and itself doesn't do anything. It's just a dependency for other Lenovo's apps/services. The permissions list contains everything administration related.

The most notable are receivers because they define when this module can be called and I see things like OtaBroadCastReceiver, TipsBroadCastReceiver, NotificationReceiver, a lot of com.lenovo.ota.* actions, connections with Firebase (Google Cloud, also used for telemetry). This is like a central hub for communication and management. All other Lenovo apps don't have such permissions because they are all handled by tbengine.

Thus by disabling tbengine all Lenovo applications may stop working or loose some functionality. I don't remember if I had it disabled before, probably not as I saw OTA update notifications.

There's extracted manifest attached so anyone can examine what it can do: com.lenovo.tbengine_AndroidManifest.xml.txt

AnonymousWP commented 1 year ago

@AnonymousWP Any updates on merging #730?

We need to wait for @0x192 to merge PRs. Unfortunately the project seems pretty dead, but with respect to the maintainer it could be anything why the development is a bit stalled.

muchqs commented 1 month ago

Just wanted to add to this, as I recently had the same problem. Not sure about other Lenovo devices, but on the M10 Plus 3rd Gen 2023 (TB128FU) removing the com.lenovo.ue.device package results in the the system crashing immediately after a user logs in due to the package being absent. However, after looking at the logcat output, it doesn't actually seem to be com.lenovo.ue.device which is directly causing the crash. it's com.lenovo.tbengine, which is called "UDS Real Time Engine".

Interestingly, searching for things about people who have disabled the User Experience package previously leads to a post on the Lenovo forums where people sussed this out.. I can't find anything out about com.lenovo.tbengine online, but opening up the apk; i think that it's the Update Delivery Service for the tablet, and is responsible for querying whether new firmware ia available on login.

TL;DR: If UE is disabled, then TBEngine must also be disabled.

Oh, also, removing UE on my tablet results in it shutting down, with the message "Factory Data Reset" flashing quickly on the screen before it reboots into Android recovery. A Screenshot of the Lenovo Android Recovery screen telling a user their device may be corrupt It could be worth warning people, so that they don't think their device is borked, perform a Factory Reset from recovery, and lose all their data by accident when you can just "Try Again".

I hope any of those ramblings are helpful! 😂

=============================

This is the issue I explained on XDA (here). It's related with connectivity and bootloop occurs only if Internet is found. There's also logcat attached explaining that's happening.

I upgraded my Lenovo Yoga Tab 13 today to the newest Android 13 and it seems this issue is even more annoying. Before the solution was to disable both com.lenovo.ue.device and com.lenovo.tbengine but after upgrade it seems both have to be enabled. If you have this issue and want to fix it without wipe the device just wait until lockscreen show up and quickly disable WiFi. After that enable both packages or just use adb shell with commands:

adb shell pm enable com.lenovo.ue.device
adb shell pm enable com.lenovo.tbengine

You can run them quickly since boot animation starts and after reboot system should work fine.

wow Thank you both so much! After I updated my Yoga Tab 11 to Android 12 it started to bootloop and I thought i borked it, was so scared. I saw something flash by after login before it rebooted and it was "UDS Real Time Engine has stopped responding". So I searched for this "UDS Real Time Engine" thing and found this thread. I had forgotten I removed the ue.device package. After multiple tries, I was finally able to reinstall the package back via ADB (the reboot happened way too fast and it even rebooted one time even after I turned off Wi-Fi). Finally my tablet is back and I have all my data. Thank you!