Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ca9016a8 authored by Joseph Vincent's avatar Joseph Vincent Committed by Android (Google) Code Review
Browse files

Merge "Show private space unlocked toast when PS is unlocked from Settings" into main

parents d28730e0 4d6e11ce
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1285,6 +1285,8 @@
    <string name="private_space_deleted">Private Space successfully deleted</string>
    <!-- Toast to show when the private space could not be deleted. [CHAR LIMIT=NONE] -->
    <string name="private_space_delete_failed">Private Space could not be deleted</string>
    <!-- Toast to show when the private space is unlocked from settings entry point. [CHAR LIMIT=40] -->
    <string name="private_space_unlocked">Private space unlocked</string>
    <!-- Title of the Alert Dialog when no screen lock is set [CHAR LIMIT=30] -->
    <string name="no_device_lock_title">Set a screen lock</string>
    <!-- Summary of the alert when no screen lock is set [CHAR LIMIT=90] -->
+12 −2
Original line number Diff line number Diff line
@@ -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();
+10 −1
Original line number Diff line number Diff line
@@ -16,20 +16,29 @@

package com.android.settings.privatespace;

import static com.android.settings.privatespace.PrivateSpaceAuthenticationActivity.EXTRA_SHOW_PRIVATE_SPACE_UNLOCKED;

import android.app.settings.SettingsEnums;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;

import com.android.settings.R;
import com.android.settings.dashboard.DashboardFragment;

/** Fragment representing the Private Space dashboard in Settings. */
public class PrivateSpaceDashboardFragment extends DashboardFragment {
    private static final String TAG = "PrivateSpaceDashboardFragment";
    private static final String TAG = "PSDashboardFragment";

    @Override
    public void onCreate(Bundle icicle) {
        if (android.os.Flags.allowPrivateProfile()) {
            super.onCreate(icicle);
            if (getIntent().getBooleanExtra(EXTRA_SHOW_PRIVATE_SPACE_UNLOCKED, false)) {
                Log.i(TAG, "Private space unlocked showing toast");
                Toast.makeText(getContext(), R.string.private_space_unlocked, Toast.LENGTH_SHORT)
                        .show();
            }
        }
    }