iamr0s / Dhizuku

A Android Application for share DeviceOwner
GNU General Public License v3.0
989 stars 42 forks source link

Question about Work Profile #21

Open rahaaatul opened 1 year ago

rahaaatul commented 1 year ago

Can this API be used to create work Profile? Can apps like Island/Insular/Shelter utilize this API to create and manage work profiles?

iamr0s commented 1 year ago

Maybe not, Profile Owner and Device Owner are different sets of permissions and sometimes cannot coexist.

rahaaatul commented 1 year ago

What would be your suggestion if someone wants to have work profile and have device owner permissions? if any.

lelemka0 commented 10 months ago

Profile can be created when DISALLOW_ADD_MANAGED_PROFILE is disabled, which is provided by Install-Lion in DPM mode.

https://github.com/dadaewq/Install-Lion/blob/cc0b8badbb7ee34c670d280c5c05e3d8d82eec4a/app/src/main/res/xml/pref_dpm_settings.xml#L15C36-L15C36 https://github.com/dadaewq/Install-Lion/blob/cc0b8badbb7ee34c670d280c5c05e3d8d82eec4a/app/src/main/java/com/modosa/apkinstaller/fragment/DpmSettingsFragment.java#L45C24-L45C24

devicePolicyManager.addUserRestriction(adminComponentName, UserManager.DISALLOW_ADD_MANAGED_PROFILE);
devicePolicyManager.clearUserRestriction(adminComponentName, UserManager.DISALLOW_ADD_MANAGED_PROFILE);

Use the following apk to easily modify it: https://github.com/lelemka0/DPM_Operate/actions/runs/6601951179

With this option turned off (May need reboot), Shelter can create the workspace correctly. Workspace with Island can only be created manually because the app checks the device owner and refuses to continue.

This method only applies to API26-29. For Android 11 and above, I didn't find a feasible way because the feature has been removed by aosp.

This constant was deprecated in API level 30. As the ability to have a managed profile on a fully-managed device has been removed from the platform, this restriction will be silently ignored when applied by the device owner.

Reference: https://developer.android.com/reference/android/os/UserManager#DISALLOW_ADD_MANAGED_PROFILE https://stackoverflow.com/a/72330509

fu8765 commented 8 months ago

@lelemka0 your dpm app doesn't work. I install it but cannot find it anywhere somehow.

lelemka0 commented 8 months ago

@lelemka0 your dpm app doesn't work. I install it but cannot find it anywhere somehow.

Please confirm whether the installation is successful. Because the ci version is not signed, it is impossible to install successfully without core patch.

fu8765 commented 8 months ago

@lelemka0 your dpm app doesn't work. I install it but cannot find it anywhere somehow.

Please confirm whether the installation is successful. Because the ci version is not signed, it is impossible to install successfully without core patch.

No, i don't think the install is successful. There is no response after installing the apk, nor a fair message, but i can't locate the package afterwards

dxxxxp commented 8 months ago

Could a enterprise API be used in any FOSS fashion? Just a thought. Another thought, As I recall there existed a NFC function for profile or device ownership.

Edit: Unrelated but I'm trying to elevate the permissions of the Memory Locker app and came across this issue. My Nord10 was stolen in a armed robbery and the App switcher "lock" feature along with it. Any thoughts would be helpful. I refuse to root but I'm open to using LineageOS 19 or 20 without any Google services other than a after installable application or workaround. (Simple MicroG setup)

dxxxxp commented 8 months ago

I updated my above comment.