Show private space unlocked toast when PS is unlocked from Settings

This contains the change to show private space unlocked toast message
when PS is unlocked from private space settings entry point.
Also has change in the pending intent passed to requestQuietModeEnabled
API to allow BAL of PS settings page as suggested in go/debug-bal

Recording is uploaded to the issue b/317313482

Bug: 317313482
Test: Manually verified Toast is shown on PS unlock from settings

Change-Id: I2f03b7decdad2bb9e1018012ff5986e48305a4e7
This commit is contained in:
josephpv
2024-01-11 11:56:07 +00:00
committed by Joseph Vincent
parent 87e9f512d2
commit 4d6e11ce4b
3 changed files with 24 additions and 3 deletions

View File

@@ -18,6 +18,7 @@ package com.android.settings.privatespace;
import static android.app.admin.DevicePolicyManager.ACTION_SET_NEW_PASSWORD;
import android.app.ActivityOptions;
import android.app.AlertDialog;
import android.app.KeyguardManager;
import android.app.PendingIntent;
@@ -50,6 +51,8 @@ import com.google.android.setupdesign.util.ThemeHelper;
*/
public class PrivateSpaceAuthenticationActivity extends FragmentActivity {
private static final String TAG = "PrivateSpaceAuthCheck";
public static final String EXTRA_SHOW_PRIVATE_SPACE_UNLOCKED =
"extra_show_private_space_unlocked";
private PrivateSpaceMaintainer mPrivateSpaceMaintainer;
private KeyguardManager mKeyguardManager;
@@ -158,12 +161,19 @@ public class PrivateSpaceAuthenticationActivity extends FragmentActivity {
.setTransitionType(SettingsTransitionHelper.TransitionType.TRANSITION_SLIDE)
.setSourceMetricsCategory(SettingsEnums.PRIVATE_SPACE_SETTINGS);
if (mPrivateSpaceMaintainer.isPrivateSpaceLocked()) {
ActivityOptions options =
ActivityOptions.makeBasic()
.setPendingIntentCreatorBackgroundActivityStartMode(
ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED);
mPrivateSpaceMaintainer.unlockPrivateSpace(
PendingIntent.getActivity(
context, /* requestCode */
0,
privateSpaceSettings.toIntent(),
PendingIntent.FLAG_IMMUTABLE)
privateSpaceSettings
.toIntent()
.putExtra(EXTRA_SHOW_PRIVATE_SPACE_UNLOCKED, true),
PendingIntent.FLAG_IMMUTABLE,
options.toBundle())
.getIntentSender());
} else {
privateSpaceSettings.launch();