-
-
Notifications
You must be signed in to change notification settings - Fork 588
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
Android 15 Private Space Integration #2345
base: master
Are you sure you want to change the base?
Conversation
Thank you for working on this! |
return !manager.isQuietModeEnabled(user); | ||
} | ||
|
||
private void switchPrivateSpaceState() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could annotate the method switchPrivateSpaceState
instead of asserting inside
@RequiresApi(35)
This has the basic functionality for a useable Private Space interaction. What is missing is the "separate launcher container for apps installed in the private space", as well as the "an "Install Apps" button that launches an implicit intent to install apps into the user's private space".
They are disabled by default.
Edge-to-edge is the default behavior in Android 15. It however breaks the app currently.
bdf2664
to
790a29a
Compare
@@ -66,6 +68,7 @@ | |||
<category android:name="android.intent.category.LAUNCHER" /> | |||
<category android:name="android.intent.category.HOME" /> | |||
<category android:name="android.intent.category.DEFAULT" /> | |||
<category android:name="android.intent.category.APP_MARKET" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this category needed for? KISS should be launcher only
} else if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) { | ||
if (intent.getAction().equalsIgnoreCase(Intent.ACTION_PROFILE_AVAILABLE) | ||
|| intent.getAction().equalsIgnoreCase(Intent.ACTION_PROFILE_UNAVAILABLE)) { | ||
privateSpaceStateEvent(intent.getParcelableExtra(Intent.EXTRA_USER, UserHandle.class)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Private space is just another profile like e.g. any work profile. So if I read this correctly, these change here is not needed.
KISS is already reacting on these intents in ProfileChangedHandler
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) { | ||
IntentFilter intentFilterProfileAvailable = new IntentFilter(Intent.ACTION_PROFILE_AVAILABLE); | ||
IntentFilter intentFilterProfileUnAvailable = new IntentFilter(Intent.ACTION_PROFILE_UNAVAILABLE); | ||
this.registerReceiver(mReceiver, intentFilterProfileAvailable, Context.RECEIVER_EXPORTED); | ||
this.registerReceiver(mReceiver, intentFilterProfileUnAvailable, Context.RECEIVER_EXPORTED); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, see ProfileChangedHandler
@RequiresApi(35) | ||
private void privateSpaceStateEvent(UserHandle handle) { | ||
if (handle == null) { | ||
return; | ||
} | ||
|
||
final LauncherApps launcher = (LauncherApps) this.getSystemService(Context.LAUNCHER_APPS_SERVICE); | ||
|
||
LauncherUserInfo info = launcher.getLauncherUserInfo(handle); | ||
if (info != null) { | ||
if (info.getUserType().equalsIgnoreCase(UserManager.USER_TYPE_PROFILE_PRIVATE)) { | ||
Log.d(TAG, "Private Space state changed"); | ||
// TODO: Check if private space state changed and change app view accordingly | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, see ProfileChangedHandler
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how are these theme changes related to private space? Is this fix for differet problem?
} else if (isPrivateSpaceUnlocked()) { | ||
privateSpaceItem.setTitle("Lock Private Space"); | ||
} else { | ||
privateSpaceItem.setTitle("Unlock Private Space"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't forget about resources for titles here.
@@ -63,7 +68,18 @@ protected List<AppPojo> doInBackground(Void... params) { | |||
ApplicationInfo appInfo = activityInfo.getApplicationInfo(); | |||
boolean disabled = PackageManagerUtils.isAppSuspended(appInfo) || isQuietModeEnabled(manager, profile); | |||
final AppPojo app = createPojo(user, appInfo.packageName, activityInfo.getName(), activityInfo.getLabel(), disabled, excludedAppList, excludedFromHistoryAppList, excludedShortcutsAppList); | |||
apps.add(app); | |||
if ((android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you try to move code related to private space to separate class?
Code in MainActivity
, in LoadShortcutsPojos
class and in this class seems all pretty similar, this should be generalized somewhere instead of duplicated when possible.
@@ -71,10 +93,30 @@ protected List<ShortcutPojo> doInBackground(Void... params) { | |||
return pojos; | |||
} | |||
|
|||
@RequiresApi(35) | |||
private boolean shouldAddShortcut(UserManager manager, LauncherUserInfo info, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method to check if shortcuts should be hidden is already there, it's ShortcutUtil.isShortcutVisible
some lines above.
Can you add the additional check there, as there is already some more logic depending on visibility of shortcuts.
#2338
Note that this is a draft and not ready for review/merge.
This has the basic functionality for a usable Private Space integration.
What is supported:
What is missing (first two bullets as per https://developer.android.com/about/versions/15/behavior-changes-all#private-space-launcher-apps):
I might work on this on and off for some weekends a head. If someone else is implementing this, let me know so that I don't work on this in vain. If someone wants to continue the work of this PR (in what I would assume a quicker pace than I have time for), I would be fine with that too, just let me know.