Do not move to ALL_APPS when default Launcher is not system.
Currently we fire ALL_APP intent for System Launchers at the end of PS setup flow, even when the system launcher (NexusLauncher) was not the default Launcher. In such cases, the user is moved to NexusLauncher, but they cannot unlock PS (only default launcher can do it), leading to crashes. To fix this, we do not fire the intent in case non system Launcher has the HOME role. Bug: 331722929 Test: Manual build and flash Flag: NA Change-Id: I77353474cc74028d72508c433c89b6116b4148bd
This commit is contained in:
@@ -18,6 +18,7 @@ package com.android.settings.privatespace;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.role.RoleManager;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
@@ -103,12 +104,19 @@ public class SetupSuccessFragment extends InstrumentedFragment {
|
||||
PackageManager.MATCH_SYSTEM_ONLY,
|
||||
activity.getUserId());
|
||||
if (resolveInfo != null) {
|
||||
allAppsIntent.setPackage(resolveInfo.activityInfo.packageName);
|
||||
allAppsIntent.setComponent(resolveInfo.activityInfo.getComponentName());
|
||||
RoleManager mRoleManager = getContext().getSystemService(RoleManager.class);
|
||||
final List<String> packageNames = mRoleManager
|
||||
.getRoleHolders(RoleManager.ROLE_HOME);
|
||||
if (packageNames.contains(resolveInfo.activityInfo.packageName)) {
|
||||
allAppsIntent.setPackage(resolveInfo.activityInfo.packageName);
|
||||
allAppsIntent.setComponent(resolveInfo.activityInfo.getComponentName());
|
||||
}
|
||||
}
|
||||
activity.setTheme(R.style.Theme_SubSettings);
|
||||
accessPrivateSpaceToast();
|
||||
startActivity(allAppsIntent);
|
||||
if (allAppsIntent.getPackage() != null) {
|
||||
accessPrivateSpaceToast();
|
||||
startActivity(allAppsIntent);
|
||||
}
|
||||
Log.i(TAG, "Private space setup complete");
|
||||
deleteAllTaskAndFinish(activity);
|
||||
}
|
||||
|
Reference in New Issue
Block a user