mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 03:08:19 +00:00
Making Settings Cog open PS Settings page.
Settings Cog action should direct to PS Settings page instead of PS entry point page in Privacy&Security Center Bug: 322484516 Flag: ACONFIG com.android.launcher3.Flags.enable_private_space TRUNKFOOD Flag: ACONFIG com.google.android.apps.nexuslauncher.Flags.enable_inject_private_space_tile TRUNKFOOD Test: Launcher3 test. Change-Id: I2bc7a95d591ccedb343909c159c3cbda2814e6bf
This commit is contained in:
@@ -60,9 +60,10 @@ import java.util.function.Predicate;
|
||||
*/
|
||||
public class PrivateProfileManager extends UserProfileManager {
|
||||
|
||||
private static final String SAFETY_CENTER_INTENT = Intent.ACTION_SAFETY_CENTER;
|
||||
private static final String PS_SETTINGS_FRAGMENT_KEY = ":settings:fragment_args_key";
|
||||
private static final String PS_SETTINGS_FRAGMENT_VALUE = "AndroidPrivateSpace_personal";
|
||||
// TODO (b/324573634): Fix the intent string.
|
||||
public static final Intent PRIVATE_SPACE_INTENT = new
|
||||
Intent("com.android.settings.action.PRIVATE_SPACE_SETUP_FLOW");
|
||||
|
||||
private final ActivityAllAppsContainerView<?> mAllApps;
|
||||
private final Predicate<UserHandle> mPrivateProfileMatcher;
|
||||
private Set<String> mPreInstalledSystemPackages = new HashSet<>();
|
||||
@@ -158,18 +159,23 @@ public class PrivateProfileManager extends UserProfileManager {
|
||||
}
|
||||
}
|
||||
|
||||
/** Opens the Private Space Settings Entry Point. */
|
||||
/** Opens the Private Space Settings Page. */
|
||||
public void openPrivateSpaceSettings() {
|
||||
Intent psSettingsIntent = new Intent(SAFETY_CENTER_INTENT);
|
||||
psSettingsIntent.putExtra(PS_SETTINGS_FRAGMENT_KEY, PS_SETTINGS_FRAGMENT_VALUE);
|
||||
mAllApps.getContext().startActivity(psSettingsIntent);
|
||||
if (mPrivateSpaceSettingsAvailable) {
|
||||
mAllApps.getContext().startActivity(PRIVATE_SPACE_INTENT);
|
||||
}
|
||||
}
|
||||
|
||||
/** Whether Private Space Settings Entry Point is available on the device. */
|
||||
/** Returns whether or not Private Space Settings Page is available. */
|
||||
public boolean isPrivateSpaceSettingsAvailable() {
|
||||
return mPrivateSpaceSettingsAvailable;
|
||||
}
|
||||
|
||||
/** Sets whether Private Space Settings Page is available. */
|
||||
public boolean setPrivateSpaceSettingsAvailable(boolean value) {
|
||||
return mPrivateSpaceSettingsAvailable = value;
|
||||
}
|
||||
|
||||
/** Initializes binder call based properties in non-main thread.
|
||||
* <p>
|
||||
* This can cause the Private Space container items to not load/respond correctly sometimes,
|
||||
@@ -183,19 +189,14 @@ public class PrivateProfileManager extends UserProfileManager {
|
||||
Preconditions.assertNonUiThread();
|
||||
setPreInstalledSystemPackages();
|
||||
setAppInstallerIntent();
|
||||
setPrivateSpaceSettingsAvailable();
|
||||
initializePrivateSpaceSettingsState();
|
||||
}
|
||||
|
||||
private void setPrivateSpaceSettingsAvailable() {
|
||||
if (mPrivateSpaceSettingsAvailable) {
|
||||
return;
|
||||
}
|
||||
private void initializePrivateSpaceSettingsState() {
|
||||
Preconditions.assertNonUiThread();
|
||||
Intent psSettingsIntent = new Intent(SAFETY_CENTER_INTENT);
|
||||
psSettingsIntent.putExtra(PS_SETTINGS_FRAGMENT_KEY, PS_SETTINGS_FRAGMENT_VALUE);
|
||||
ResolveInfo resolveInfo = mAllApps.getContext().getPackageManager()
|
||||
.resolveActivity(psSettingsIntent, PackageManager.MATCH_SYSTEM_ONLY);
|
||||
mPrivateSpaceSettingsAvailable = resolveInfo != null;
|
||||
.resolveActivity(PRIVATE_SPACE_INTENT, PackageManager.MATCH_SYSTEM_ONLY);
|
||||
setPrivateSpaceSettingsAvailable(resolveInfo != null);
|
||||
}
|
||||
|
||||
private void setPreInstalledSystemPackages() {
|
||||
|
||||
Reference in New Issue
Block a user