nextcloud / android

📱 Nextcloud Android app
https://play.google.com/store/apps/details?id=com.nextcloud.client
GNU General Public License v2.0
4.29k stars 1.77k forks source link

`java.lang.SecurityException: uid x cannot get user data for accounts of type: nextcloud` #10159

Open opello opened 2 years ago

opello commented 2 years ago

Cause of error

Exception in thread "main" java.lang.RuntimeException: Unable to resume activity {com.nextcloud.client/com.owncloud.android.ui.activity.FileDisplayActivity}: java.lang.SecurityException: uid 10429 cannot get user data for accounts of type: nextcloud
    at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4761)
    at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4794)
    at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:54)
    at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
    at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2214)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7842)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
Caused by: Exception in thread "main" java.lang.SecurityException: uid 10429 cannot get user data for accounts of type: nextcloud
    at android.os.Parcel.createExceptionOrNull(Parcel.java:2425)
    at android.os.Parcel.createException(Parcel.java:2409)
    at android.os.Parcel.readException(Parcel.java:2392)
    at android.os.Parcel.readException(Parcel.java:2334)
    at android.accounts.IAccountManager$Stub$Proxy.getUserData(IAccountManager.java:1336)
    at android.accounts.AccountManager$2.recompute(AccountManager.java:458)
    at android.accounts.AccountManager$2.recompute(AccountManager.java:449)
    at android.app.PropertyInvalidatedCache.query(PropertyInvalidatedCache.java:562)
    at android.accounts.AccountManager.getUserData(AccountManager.java:641)
    at com.owncloud.android.ui.adapter.OCFileListAdapter.<init>(OCFileListAdapter.java:151)
    at com.owncloud.android.ui.fragment.OCFileListFragment.setAdapter(OCFileListFragment.java:418)
    at com.owncloud.android.ui.fragment.OCFileListFragment.onActivityCreated(OCFileListFragment.java:362)
    at androidx.fragment.app.Fragment.performActivityCreated(Fragment.java:3028)
    at androidx.fragment.app.FragmentStateManager.activityCreated(FragmentStateManager.java:578)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:264)
    at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1840)
    at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1758)
    at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1701)
    at androidx.fragment.app.FragmentController.execPendingActions(FragmentController.java:462)
    at androidx.fragment.app.FragmentActivity.onResume(FragmentActivity.java:412)
    at com.owncloud.android.ui.activity.BaseActivity.onResume(BaseActivity.java:91)
    at com.owncloud.android.ui.activity.DrawerActivity.onResume(DrawerActivity.java:995)
    at com.owncloud.android.ui.activity.FileActivity.onResume(FileActivity.java:241)
    at com.owncloud.android.ui.activity.FileDisplayActivity.onResume(FileDisplayActivity.java:1070)
    at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1476)
    at android.app.Activity.performResume(Activity.java:8191)
    at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4751)
    at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4794)
    at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:54)
    at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
    at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2214)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7842)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
Caused by: Exception in thread "main" android.os.RemoteException: Remote stack trace:
    at com.android.server.accounts.AccountManagerService.getUserData(AccountManagerService.java:1585)
    at android.accounts.IAccountManager$Stub.onTransact(IAccountManager.java:455)
    at com.android.server.accounts.AccountManagerService.onTransact(AccountManagerService.java:1079)
    at android.os.Binder.execTransactInternal(Binder.java:1179)
    at android.os.Binder.execTransact(Binder.java:1143)

App information

Device information

Firmware


Subsequent launch worked fine though!

opello commented 2 years ago

Looks similar to #10141

AlvaroBrey commented 2 years ago

Looks similar to #10141

Yep, same issue. I'll keep this one as it has more info

AlvaroBrey commented 2 years ago

From some quick research, this crash may happen due to a variety of reasons, the most common of which is that there are two apps that can handle accounts of a type, but aren't signed with the same signature. It seems like work profile may play a part in this, but it works fine on my tests.

Part of the problem is that our accountType is just nextcloud, which is far too simple and may collide with other apps that make the same mistake. At some point we should change it to com.nextcloud.android or something like that.