Flipper: Flipper doesn't work with apps originally installed on the system partition

Created on 3 Sep 2019  路  16Comments  路  Source: facebook/flipper

馃悰 Bug Report

@passy I set up Flipper in our app. It worked on a (non-64 bit) emulator but when I run in on our kiosk-like hardware, Flipper shows a bar that says:
Client setup error: No matching device for app: PACKAGE_NAME
image

Flipper can see it for its generic features like logs and CPU info. However, it doesn't connect to the FlipperClient.

EDIT
I did some debugging and found that the run-as command here is failing with PACKAGE_NAME is not an application.
I tracked that down to here which is the case when the app is a system application. In our case, I have installed a debuggable version of the app over the one on the system partition and that is the setup that 100% of people here will be using when working.

To Reproduce

You can push an APK to the system partition by booting an AVD with -writeable-system (StackOverflow link). Then push your own apk to the system partition and optionally install it again in the user partition.

Expected Behavior

Flipper connects to the FlipperClient.

Environment

Our Kiosk-like hardware runs Marshmallow.

Thanks for working on Flipper. It looks really awesome and we have some ideas for useful plugins that we can build already.

Android bug

Most helpful comment

Please leave this open. It is still an issue.

All 16 comments

Thanks for the report @gpeal

I've played a little with a system app to investigate this, and have got it working with a file permission change that I'll ship asap.

However I didn't run into this run-as problem you mention, so I expect it won't fix your issue. In my tests, I had no problem executing run-as as the system app.

I tried first installing a user app and then moving it into /system/app and rebooting. I also tried placing an apk directly into /system/app on a fresh AVD. Both tests using marshmallow.

Could it be due to a variation in the OS running on your hardware? I was using an emulator for this so it might be more permissive. Or perhaps I'm not installing the app as a system app correctly?

As for the run-as problem, I expect we can execute the shell as root using su, instead of the app, to get around it. Something like this - but note that that isn't tested at all because I haven't reproduced the issue.

@jknoxville Our app also has android:sharedUserId="android.uid.system". That may be the difference here.

Ah, thats probably it. That gives me: INSTALL_FAILED_SHARED_USER_INCOMPATIBLE.

Reading up, it sounds like I'd have to sign the app with the same key that signed the firmware, is that correct?

@jknoxville Yeah, that's correct. I can't share our own hardware setup (obviously) but maybe this would help in testing it out on an emulator: https://stackoverflow.com/a/37586790/715633

Thank you for taking the time to look at this. It will be a huge help to us if it works! 馃槃

We have the same issue with React Native 0.62.0 and Flipper 0.35.0.

Our company devices are managed by Kaspersky Endpoint Security which checks the app and does _something_ with it (but apparently not copying it to /system/app). That results in two app versions: the normal one and the managed/secure one.

Flipper can connect to the normal app but not to the managed one with the same error message as @gpeal has.

Is there some workaround for this issue or maybe pointers where I could investigate more?

Thanks!

I have the same issue after upgrading React Native to 0.62.0 from 0.61.5 with Flipper 0.35.0.

same here with Flipper 0.37.0

same here with Flipper 0.40.0
and React Native 0.62.0 and 0.62.2

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

Please leave this open. It is still an issue.

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

Please add the backlog label. This is still an issue.

We made a change in the latest version of Flipper (0.70.0) to fall back to using su when a device is rooted and run-as isn't working: https://github.com/facebook/flipper/commit/805071fa4913338343615b4326ef10d9c3b116b0

It wasn't done to solve this issue in particular, but there's a chance it fixes this at the same time. Having such involved repro steps, I haven't checked. If not, I think we'll be relying on community support to fix this. PR's are very much welcome!

@jknoxville Unfortunately, it is still failing on 0.70.0
image

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

This still requires attention

Was this page helpful?
0 / 5 - 0 ratings