Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi user (work-profile) support #20

Closed
TheRealMystic opened this issue Jul 17, 2022 · 18 comments
Closed

Multi user (work-profile) support #20

TheRealMystic opened this issue Jul 17, 2022 · 18 comments
Labels
enhancement New feature or request OutOfScope Not within the scope of this apps purpose.
Milestone

Comments

@TheRealMystic
Copy link
Collaborator

TheRealMystic commented Jul 17, 2022

If an app is installed in both the Main Profile and the Work Profile, only one of them is shown in the Apps tab.

In the attached screenshot, you'll see that the File Manager is showing up only once, as being installed by Shelter app. So this app is from the Work Profile.

I have the same app installed in the main profile too using SAI. It is not showing up.

Screenshot_2022-07-17-20-15-12-95_ce34de6323cfaeb7a2880d42987990b1

@d4rken d4rken added the bug Something isn't working label Jul 17, 2022
@d4rken
Copy link
Member

d4rken commented Jul 17, 2022

Do both show in SD Maid?

@d4rken d4rken added the Needs Info/Repro Needs more details or reproduction instructions. label Jul 17, 2022
@TheRealMystic
Copy link
Collaborator Author

Do both show in SD Maid?

It is not showing in SD Maid either. Only one app is showing up, and I'm not sure which one it is. I'm using SD Maid v5.4.0 Beta

@TheRealMystic
Copy link
Collaborator Author

Screenshot_2022-07-17-21-41-26-13_62f0e9ef2a35bdc7c62d39832d484c48

@TheRealMystic
Copy link
Collaborator Author

Should I open a new ticket for SD Maid too on this issue?

@d4rken
Copy link
Member

d4rken commented Jul 17, 2022

Which app shows 2? How do you know there should be 2?

@TheRealMystic
Copy link
Collaborator Author

Which app shows 2? How do you know there should be 2?

How do I know? I'm the one who has installed the app in both profiles. And it is not just this app. There are other apps too that have been installed in both profiles. But only one installation is shown in both SD Maid and Permissions Overview.

Technically speaking, an app is installed only once in a device. Any other 'installation', be it in Work Profile or a Multi-User environment, is just creation of a Data folder for that user, and not a second installation as such.

But when using AppControl, all such 'installations' must show up seperately.

@d4rken
Copy link
Member

d4rken commented Jul 17, 2022

I'm not sure if I would consider work profile support as in scope.
The app is installed for a specific user/profile, it makes sense that it shows the permissions and apps of that user.

I'm currently installing shelter to see what is possible. Not sure if root support is something I'd consider for this app.

@d4rken d4rken changed the title [BUG]: Missing Apps Multi user (work-profile) support Jul 17, 2022
@d4rken d4rken added enhancement New feature or request and removed bug Something isn't working labels Jul 17, 2022
@d4rken
Copy link
Member

d4rken commented Jul 17, 2022

When installed in the main profile it sees all the apps in the main profile, and if installed in the work profile only the ones in the work profile.

Screenshot from 2022-07-17 20-05-13

As far as I can see, I could detect that an app has a work profile, but that's about it.

For anything else we'd need to dive much deeper and do the same thing as Shelter does (if this is even possible in parallel with Shelter). So listing apps from other profiles is out of scope.

I don't think this is a strong enough use-case to warrant adding support for using root.

@d4rken d4rken added OutOfScope Not within the scope of this apps purpose. and removed Needs Info/Repro Needs more details or reproduction instructions. labels Jul 17, 2022
@d4rken d4rken closed this as not planned Won't fix, can't repro, duplicate, stale Jul 17, 2022
@TheRealMystic
Copy link
Collaborator Author

TheRealMystic commented Jul 17, 2022

The app is seeing all the packages (apps) installed from the main profile. This includes all apps installed in the Work Profile, and also potentially apps installed in multi-users (I haven't tested Multi-Users yet).

  1. It is only a matter of identifying the profile where the app is currently installed to add the badge (if applicable). I'm not sure if this requires root support since the app is already showing apps installed in the work profile, including those that are installed in the Work Profile alone (which means those apps are not installed in the main profile).

  2. I tried to uninstall the app using SD Maid, and this is what happened:

    • Without root, it was unable to delete the app. This means that the app shown in SD Maid AppControl is the one from Work Profile.

    • With root, SD Maid is completely uninstalling the app, i.e. it is gone from both profiles in just a single run.

Apps installed in Work Profile or Multi-User have very limited access, so they can't show apps from the main profile or other profiles.

@d4rken
Copy link
Member

d4rken commented Jul 17, 2022

The app is seeing all the packages (apps) installed from the main profile.

The app sees the packages that are visible in the profile it is in.

This includes all apps installed in the Work Profile, and also potentially apps installed in multi-users (I haven't tested Multi-Users yet).

Work profile is just multi-user with a fancy name. I've checked the paths on a rooted device and the data for the main profile was /data/user/0/ while for the work profile it was /data/user/10/.

It is only a matter of identifying the profile where the app is currently installed to add the badge (if applicable). I'm not sure if this requires root support since the app is already showing apps installed in the work profile, including those that are installed in the Work Profile alone (which means those apps are not installed in the main profile).

" It is only a matter of " 😁 If there is no API for it, then without root it can't really be done. I've checked all APIs I could think of, and there was none that could give me this information. If you know more, please tell me.

I tried to uninstall the app using SD Maid, and this is what happened:
• Without root, it was unable to delete the app. This means that the app shown in SD Maid AppControl is the one from Work Profile.

SD Maid does very elaborate queries to get even apps that are not really installed (out of scope for this app). The app that was only in the work profile was still visible to SD Maid. It was not visible as "work profile app", just as "it's not really installed, but still somehow here". When SD Maid asked the system to uninstall it, the system probably said "what app?" as from the main profile's perspective it is not installed.

• With root, SD Maid is completely uninstalling the app, i.e. it is gone from both profiles in just a single run.

Basically works like issuing adb uninstall.

@d4rken d4rken reopened this Jul 18, 2022
@d4rken
Copy link
Member

d4rken commented Jul 18, 2022

Reopen as we have a chance using the LauncherApps api

@dragonGod97677
Copy link
Contributor

Reopen as we have a chance using the LauncherApps api

Just a question, that API does exist on all Android version or just newer version?

@d4rken
Copy link
Member

d4rken commented Jul 18, 2022

According to the docs, since API21:
https://developer.android.com/reference/android/content/pm/LauncherApps

Code is already in the current builds.

https://github.com/d4rken-org/mystic-permissions/blob/744d14ed6dfe79da1f5e75602045b915e8f4e00e/app/src/main/java/eu/darken/myperm/apps/core/AppRepo.kt#L75-L78

Should work on your Android version if it doesn't crash already.

@d4rken d4rken closed this as completed in f44323a Jul 19, 2022
@TheRealMystic
Copy link
Collaborator Author

For apps installed in multiple profiles, can you not list all of them in the Apps Tab? Those from other profiles will have the briefcase badge.

There will also be a separate filter for such apps as discussed. I'll open a new ticket for it.

@d4rken
Copy link
Member

d4rken commented Jul 19, 2022

There is only one app installed, work profiles are still the same app (same APK version), just different data folders.
A work profile tag as part of the app tags might be a better solution.

Not super easy as I also identify every app by their package name, which isn't unique anymore if I want to display normal+work profile as they still have the same pkg name 🤔

Not sure if I need to split the UI for each too, might be more work than just "work profile badge" because work profile apps have less information than normal apps, e.g.
https://github.com/d4rken-org/mystic-permissions/blob/115abccda3eda7233bac117c5ad7281c2e3f4fe2/app/src/main/java/eu/darken/myperm/apps/core/container/WorkProfileApp.kt#L16
https://github.com/d4rken-org/mystic-permissions/blob/115abccda3eda7233bac117c5ad7281c2e3f4fe2/app/src/main/java/eu/darken/myperm/apps/core/container/NormalApp.kt#L20

@TheRealMystic
Copy link
Collaborator Author

You already have a way to find apps installed in other profiles, isn't it?

Can't the output of that be used to list these in the Apps Tab?

@d4rken
Copy link
Member

d4rken commented Jul 19, 2022

We have different amounts of information depending what app it is or rather what source the data comes from.
The normal system API gives more information about an app than the API we use for apps in other profiles (e.g. we don't know permission status). So they are treated differently in code.

Currently it doesn't feel like listing them as extra entry in the list is useful enough to warrant the additional code complexity.

Can you elaborate on your use-case?
When I think about:
You look for a workplace app, you just find it, one entry, no need to think about which one click.
Any actions that can be done will be available in the details screens.
Actions may only affect the workplace version or the main version or both, so it makes sense to have them in one place too.
If we split up apps and each have their own list entry, then we also need extra details screens for each.

@TheRealMystic
Copy link
Collaborator Author

The main use case for this is to be able to see (from the Main Profile) all apps installed in the device.

Work Profile and Multi-Users (there is a distinct advantage of a Work Profile over Multi-Users and vice-versa, although they are simply new users 10, 11, 12, etc.) support independent installations, both via Store apps and via side-loading.

This app, being one about permissions and information in one place, would give the user all the info he needs in one place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request OutOfScope Not within the scope of this apps purpose.
Projects
None yet
Development

No branches or pull requests

3 participants