Merge "Show private space unlocked toast when PS is unlocked from Settings" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
ca9016a8be
@@ -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] -->
|
||||
|
@@ -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();
|
||||
|
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user