Add check to not show PS unlock message when activity is recreated
The condition added with this change makes sure the toast message is
shown only once and to not show duplicate toast evertime the activity
is recreated on screen rotation.
Recording link : b/324442522#comment2
Bug: 324442522
Test: Manual
Change-Id: I4e17384c1d02deacdd911195f014b0c8f1eb8833
diff --git a/src/com/android/settings/privatespace/PrivateSpaceDashboardFragment.java b/src/com/android/settings/privatespace/PrivateSpaceDashboardFragment.java
index e426477..726567e 100644
--- a/src/com/android/settings/privatespace/PrivateSpaceDashboardFragment.java
+++ b/src/com/android/settings/privatespace/PrivateSpaceDashboardFragment.java
@@ -34,7 +34,8 @@
public void onCreate(Bundle icicle) {
if (android.os.Flags.allowPrivateProfile()) {
super.onCreate(icicle);
- if (getIntent().getBooleanExtra(EXTRA_SHOW_PRIVATE_SPACE_UNLOCKED, false)) {
+ if (icicle == null
+ && 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();