From 6def09c9ebb956e985bda94adb3456f780c1087f Mon Sep 17 00:00:00 2001 From: josephpv Date: Fri, 3 Nov 2023 18:31:53 +0000 Subject: [PATCH] Start All Apps on successful PrivateSpace setup completion Bug: 309130594 Test: Verified Launcher App Alls is launched on setup complete Change-Id: I6842d85617e3862f18b2183e8dda7bd7b575bce8 --- .../privatespace/SetupSuccessFragment.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/com/android/settings/privatespace/SetupSuccessFragment.java b/src/com/android/settings/privatespace/SetupSuccessFragment.java index b761da76dcd..1868f655f49 100644 --- a/src/com/android/settings/privatespace/SetupSuccessFragment.java +++ b/src/com/android/settings/privatespace/SetupSuccessFragment.java @@ -18,6 +18,8 @@ package com.android.settings.privatespace; import android.app.Activity; import android.content.Intent; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; @@ -69,13 +71,18 @@ public class SetupSuccessFragment extends Fragment { private View.OnClickListener onClickNext() { return v -> { - accessPrivateSpaceToast(); - // TODO(b/306228087): Replace with the intent to launch All Apps once it is working. - Intent startMain = new Intent(Intent.ACTION_MAIN); - startMain.addCategory(Intent.CATEGORY_HOME); - startActivity(startMain); Activity activity = getActivity(); if (activity != null) { + Intent allAppsIntent = new Intent(Intent.ACTION_ALL_APPS); + ResolveInfo resolveInfo = activity.getPackageManager().resolveActivityAsUser( + new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME), + PackageManager.MATCH_SYSTEM_ONLY, activity.getUserId()); + if (resolveInfo != null) { + allAppsIntent.setPackage(resolveInfo.activityInfo.packageName); + allAppsIntent.setComponent(resolveInfo.activityInfo.getComponentName()); + } + accessPrivateSpaceToast(); + startActivity(allAppsIntent); activity.finish(); } };