Change to add temp GAIA education screen and swap account and lock flow
The change does below things: - Interchange account and lock setup in PS setup - After profile creation checks if network is present and starts new GAIA education screen If network is not present on device skips account login and shows lock setup screen. - Adds a temp GAIA education screen before starting of account login which can skip to lock setup or start account login Recording link : b/326389818#comment5 Screenshot : go/ss/7qWLUF4WDHFBQzi.png go/ss/A8EvoCFJwihaTQP.png Bug: 326389818 Test: Manual Change-Id: I91e3591c60aae22fc10058fb94dcb624573d2e37
This commit is contained in:
25
res/drawable/ic_security_privacy_alert_primary.xml
Normal file
25
res/drawable/ic_security_privacy_alert_primary.xml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<!--
|
||||||
|
~ Copyright (C) 2024 The Android Open Source Project
|
||||||
|
~
|
||||||
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
~ you may not use this file except in compliance with the License.
|
||||||
|
~ You may obtain a copy of the License at
|
||||||
|
~
|
||||||
|
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
~
|
||||||
|
~ Unless required by applicable law or agreed to in writing, software
|
||||||
|
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
~ See the License for the specific language governing permissions and
|
||||||
|
~ limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="48dp"
|
||||||
|
android:height="48dp"
|
||||||
|
android:viewportWidth="48"
|
||||||
|
android:viewportHeight="48">
|
||||||
|
<path
|
||||||
|
android:pathData="M22,25.6H26V12.7H22V25.6ZM22,33.9H26V29.6H22V33.9ZM24,44C23.767,44 23.533,43.983 23.3,43.95C23.1,43.883 22.9,43.8 22.7,43.7C17.767,41.167 14.083,38.033 11.65,34.3C9.217,30.533 8,25.967 8,20.6V11.65C8,11.017 8.183,10.45 8.55,9.95C8.917,9.45 9.4,9.083 10,8.85L23,4.15C23.167,4.083 23.333,4.05 23.5,4.05C23.667,4.017 23.833,4 24,4C24.1,4 24.433,4.05 25,4.15L38,8.8C38.6,9.033 39.083,9.417 39.45,9.95C39.817,10.45 40,11.017 40,11.65V20.6C40,25.967 38.75,30.533 36.25,34.3C33.783,38.067 30.117,41.2 25.25,43.7C25.05,43.8 24.85,43.883 24.65,43.95C24.45,43.983 24.233,44 24,44ZM24,41C28.367,38.633 31.617,35.817 33.75,32.55C35.917,29.25 37,25.267 37,20.6V11.65L24,7L11,11.65V20.6C11,25.267 12.1,29.267 14.3,32.6C16.533,35.933 19.767,38.733 24,41Z"
|
||||||
|
android:fillColor="?android:attr/colorAccent"/>
|
||||||
|
</vector>
|
111
res/layout/private_space_gaia_education_screen.xml
Normal file
111
res/layout/private_space_gaia_education_screen.xml
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
<!--
|
||||||
|
~ Copyright (C) 2024 The Android Open Source Project
|
||||||
|
~
|
||||||
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
~ you may not use this file except in compliance with the License.
|
||||||
|
~ You may obtain a copy of the License at
|
||||||
|
~
|
||||||
|
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
~
|
||||||
|
~ Unless required by applicable law or agreed to in writing, software
|
||||||
|
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
~ See the License for the specific language governing permissions and
|
||||||
|
~ limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<com.google.android.setupdesign.GlifLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/ps_account_intro_screen"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:filterTouchesWhenObscured="true">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="24dp"
|
||||||
|
android:layout_marginRight="24dp"
|
||||||
|
android:contentDescription="@null"
|
||||||
|
android:src="@drawable/ic_security_privacy_alert_primary"/>
|
||||||
|
<TextView
|
||||||
|
style="@style/PrivateSpaceSetupTextFontStyle"
|
||||||
|
android:fontFamily="google-sans"
|
||||||
|
android:text="@string/private_space_gaia_education_title"
|
||||||
|
android:layout_margin="24dp"
|
||||||
|
android:layout_marginTop="40dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textSize="28sp"/>
|
||||||
|
<TextView
|
||||||
|
style="@style/PrivateSpaceSetupTextFontStyle"
|
||||||
|
android:layout_marginLeft="24dp"
|
||||||
|
android:layout_marginRight="24dp"
|
||||||
|
android:layout_marginBottom="40dp"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:text="@string/private_space_gaia_education_description"/>
|
||||||
|
<TextView
|
||||||
|
style="@style/PrivateSpaceSetupTextFontStyle"
|
||||||
|
android:layout_marginLeft="24dp"
|
||||||
|
android:layout_marginRight="24dp"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:text="@string/private_space_gaia_education_header"/>
|
||||||
|
<RelativeLayout
|
||||||
|
style="@style/PrivateSpaceSetupBulletPointLayoutStyle"
|
||||||
|
android:paddingTop="8dp"
|
||||||
|
android:paddingBottom="8dp">
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/point1"
|
||||||
|
style="@style/PrivateSpaceBulletPointIconStyle"
|
||||||
|
android:contentDescription="@null"
|
||||||
|
android:src="@drawable/ic_text_dot" />
|
||||||
|
<TextView
|
||||||
|
style="@style/PrivateSpaceBulletPointTextFontStyle"
|
||||||
|
android:layout_toRightOf="@+id/point1"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:text="@string/private_space_gaia_education_bullet1"/>
|
||||||
|
</RelativeLayout>
|
||||||
|
<RelativeLayout
|
||||||
|
style="@style/PrivateSpaceSetupBulletPointLayoutStyle">
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/point2"
|
||||||
|
style="@style/PrivateSpaceBulletPointIconStyle"
|
||||||
|
android:contentDescription="@null"
|
||||||
|
android:src="@drawable/ic_text_dot" />
|
||||||
|
<TextView
|
||||||
|
style="@style/PrivateSpaceBulletPointTextFontStyle"
|
||||||
|
android:layout_toRightOf="@+id/point2"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:text="@string/private_space_gaia_education_bullet2"/>
|
||||||
|
</RelativeLayout>
|
||||||
|
<RelativeLayout
|
||||||
|
style="@style/PrivateSpaceSetupBulletPointLayoutStyle">
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/point3"
|
||||||
|
style="@style/PrivateSpaceBulletPointIconStyle"
|
||||||
|
android:contentDescription="@null"
|
||||||
|
android:src="@drawable/ic_text_dot" />
|
||||||
|
<TextView
|
||||||
|
style="@style/PrivateSpaceBulletPointTextFontStyle"
|
||||||
|
android:layout_toRightOf="@+id/point3"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:text="@string/private_space_gaia_education_bullet3"/>
|
||||||
|
</RelativeLayout>
|
||||||
|
<RelativeLayout
|
||||||
|
style="@style/PrivateSpaceSetupBulletPointLayoutStyle">
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/point4"
|
||||||
|
style="@style/PrivateSpaceBulletPointIconStyle"
|
||||||
|
android:contentDescription="@null"
|
||||||
|
android:src="@drawable/ic_text_dot" />
|
||||||
|
<TextView
|
||||||
|
style="@style/PrivateSpaceBulletPointTextFontStyle"
|
||||||
|
android:layout_toRightOf="@+id/point4"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:text="@string/private_space_gaia_education_bullet4"/>
|
||||||
|
</RelativeLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</com.google.android.setupdesign.GlifLayout>
|
@@ -35,6 +35,9 @@
|
|||||||
<action
|
<action
|
||||||
android:id="@+id/action_set_lock_fragment"
|
android:id="@+id/action_set_lock_fragment"
|
||||||
app:destination="@id/ps_profile_lock_fragment"/>
|
app:destination="@id/ps_profile_lock_fragment"/>
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_account_intro_fragment"
|
||||||
|
app:destination="@id/ps_account_intro_fragment"/>
|
||||||
</fragment>
|
</fragment>
|
||||||
<fragment android:id="@+id/ps_profile_error_fragment"
|
<fragment android:id="@+id/ps_profile_error_fragment"
|
||||||
android:name="com.android.settings.privatespace.PrivateProfileCreationError"
|
android:name="com.android.settings.privatespace.PrivateProfileCreationError"
|
||||||
@@ -51,14 +54,24 @@
|
|||||||
android:label="fragment_account_error">
|
android:label="fragment_account_error">
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_advance_login_error"
|
android:id="@+id/action_advance_login_error"
|
||||||
app:destination="@id/ps_account_error_fragment"/>
|
app:destination="@id/ps_account_intro_fragment"/>
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_success_fragment"
|
android:id="@+id/action_skip_account_login"
|
||||||
app:destination="@id/ps_profile_success_fragment"/>
|
app:destination="@id/ps_profile_lock_fragment"/>
|
||||||
</fragment>
|
</fragment>
|
||||||
<fragment android:id="@+id/ps_profile_lock_fragment"
|
<fragment android:id="@+id/ps_profile_lock_fragment"
|
||||||
android:name="com.android.settings.privatespace.PrivateSpaceSetLockFragment"
|
android:name="com.android.settings.privatespace.PrivateSpaceSetLockFragment"
|
||||||
android:label="fragment_ps_lock">
|
android:label="fragment_ps_lock">
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_lock_success_fragment"
|
||||||
|
app:destination="@id/ps_profile_success_fragment"/>
|
||||||
|
</fragment>
|
||||||
|
<fragment android:id="@+id/ps_account_intro_fragment"
|
||||||
|
android:name="com.android.settings.privatespace.PrivateSpaceGaiaEducationFragment"
|
||||||
|
android:label="fragment_ps_account_intro">
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_account_lock_fragment"
|
||||||
|
app:destination="@id/ps_profile_lock_fragment"/>
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_advance_login_error"
|
android:id="@+id/action_advance_login_error"
|
||||||
app:destination="@id/ps_account_error_fragment"/>
|
app:destination="@id/ps_account_error_fragment"/>
|
||||||
|
@@ -1333,7 +1333,7 @@
|
|||||||
<!-- Title for private space setup in auto advancing screen informing to explore private space settings for hide and auto lock. [CHAR LIMIT=NONE] -->
|
<!-- Title for private space setup in auto advancing screen informing to explore private space settings for hide and auto lock. [CHAR LIMIT=NONE] -->
|
||||||
<string name="private_space_explore_settings_title">Explore private space settings to hide private space and set up automatic locking</string>
|
<string name="private_space_explore_settings_title">Explore private space settings to hide private space and set up automatic locking</string>
|
||||||
<!-- Title for private space setup in auto advancing screen informing some system apps are already installed in private space. [CHAR LIMIT=NONE] -->
|
<!-- Title for private space setup in auto advancing screen informing some system apps are already installed in private space. [CHAR LIMIT=NONE] -->
|
||||||
<string name="private_space_apps_installed_title">Some apps are already installed in your private space</string>
|
<string name="private_space_apps_installed_title">Required apps are already installed in your private space</string>
|
||||||
<!-- Title for private space creation error screen. [CHAR LIMIT=60] -->
|
<!-- Title for private space creation error screen. [CHAR LIMIT=60] -->
|
||||||
<string name="private_space_error_screen_title">Couldn\u2019t set up a private space</string>
|
<string name="private_space_error_screen_title">Couldn\u2019t set up a private space</string>
|
||||||
<!-- Label for button to retry creating private space again on creation error. [CHAR LIMIT=30] -->
|
<!-- Label for button to retry creating private space again on creation error. [CHAR LIMIT=30] -->
|
||||||
@@ -1378,6 +1378,22 @@
|
|||||||
<string name="private_space_notifications_title">Sensitive notifications on lock screen</string>
|
<string name="private_space_notifications_title">Sensitive notifications on lock screen</string>
|
||||||
<!-- Summary description for private space sensitive notifications toggle [CHAR LIMIT=200] -->
|
<!-- Summary description for private space sensitive notifications toggle [CHAR LIMIT=200] -->
|
||||||
<string name="private_space_sensitive_notifications_description">Show sensitive content when private space is unlocked</string>
|
<string name="private_space_sensitive_notifications_description">Show sensitive content when private space is unlocked</string>
|
||||||
|
<!-- Title for private space GAIA education screen [CHAR LIMIT=90] -->
|
||||||
|
<string name="private_space_gaia_education_title">Create a Google Account to help keep your data private</string>
|
||||||
|
<!-- Description for private space GAIA education screen [CHAR LIMIT=120] -->
|
||||||
|
<string name="private_space_gaia_education_description">On the next screen you can sign in to an account to use with your private space</string>
|
||||||
|
<!-- Sub header for private space GAIA education screen [CHAR LIMIT=120] -->
|
||||||
|
<string name="private_space_gaia_education_header"><b>Create a dedicated account to help stop data appearing outside private space, such as:</b></string>
|
||||||
|
<!-- Text for private space GAIA education screen [CHAR LIMIT=90] -->
|
||||||
|
<string name="private_space_gaia_education_bullet1">Synced photos, files, emails, contacts, calendar events, and other data</string>
|
||||||
|
<!-- Text for private space GAIA education screen [CHAR LIMIT=60] -->
|
||||||
|
<string name="private_space_gaia_education_bullet2">App download history and recommendations</string>
|
||||||
|
<!-- Text for private space GAIA education screen [CHAR LIMIT=60] -->
|
||||||
|
<string name="private_space_gaia_education_bullet3">Browsing history, bookmarks, and saved passwords</string>
|
||||||
|
<!-- Text for private space GAIA education screen [CHAR LIMIT=90] -->
|
||||||
|
<string name="private_space_gaia_education_bullet4">Suggested content related to your activity in private space apps</string>
|
||||||
|
<!-- Text for button in private space GAIA education screen to start login [CHAR LIMIT=20] -->
|
||||||
|
<string name="private_space_gaia_education_got_it">Got it</string>
|
||||||
|
|
||||||
<!-- Text shown when "Add fingerprint" button is disabled -->
|
<!-- Text shown when "Add fingerprint" button is disabled -->
|
||||||
<string name="fingerprint_add_max">You can add up to <xliff:g id="count" example="5">%d</xliff:g> fingerprints</string>
|
<string name="fingerprint_add_max">You can add up to <xliff:g id="count" example="5">%d</xliff:g> fingerprints</string>
|
||||||
|
@@ -24,6 +24,9 @@ import android.animation.AnimatorSet;
|
|||||||
import android.animation.ObjectAnimator;
|
import android.animation.ObjectAnimator;
|
||||||
import android.animation.ValueAnimator;
|
import android.animation.ValueAnimator;
|
||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.net.ConnectivityManager;
|
||||||
|
import android.net.NetworkInfo;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
@@ -81,8 +84,13 @@ public class AutoAdvanceSetupFragment extends InstrumentedFragment {
|
|||||||
getContext(),
|
getContext(),
|
||||||
SettingsEnums.ACTION_PRIVATE_SPACE_SETUP_SPACE_CREATED,
|
SettingsEnums.ACTION_PRIVATE_SPACE_SETUP_SPACE_CREATED,
|
||||||
true);
|
true);
|
||||||
NavHostFragment.findNavController(AutoAdvanceSetupFragment.this)
|
if (isConnectedToInternet()) {
|
||||||
.navigate(R.id.action_set_lock_fragment);
|
NavHostFragment.findNavController(AutoAdvanceSetupFragment.this)
|
||||||
|
.navigate(R.id.action_account_intro_fragment);
|
||||||
|
} else {
|
||||||
|
NavHostFragment.findNavController(AutoAdvanceSetupFragment.this)
|
||||||
|
.navigate(R.id.action_set_lock_fragment);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
mMetricsFeatureProvider.action(
|
mMetricsFeatureProvider.action(
|
||||||
getContext(),
|
getContext(),
|
||||||
@@ -190,4 +198,13 @@ public class AutoAdvanceSetupFragment extends InstrumentedFragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Returns true if device has an active internet connection, false otherwise. */
|
||||||
|
private boolean isConnectedToInternet() {
|
||||||
|
ConnectivityManager cm =
|
||||||
|
(ConnectivityManager)
|
||||||
|
getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
|
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
|
||||||
|
return activeNetwork != null && activeNetwork.isConnectedOrConnecting();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,15 +16,9 @@
|
|||||||
|
|
||||||
package com.android.settings.privatespace;
|
package com.android.settings.privatespace;
|
||||||
|
|
||||||
import static com.android.settings.privatespace.PrivateSpaceSetupActivity.ACCOUNT_LOGIN_ACTION;
|
|
||||||
import static com.android.settings.privatespace.PrivateSpaceSetupActivity.EXTRA_ACTION_TYPE;
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.UserHandle;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -93,17 +87,8 @@ public class PrivateSpaceAccountLoginError extends InstrumentedFragment {
|
|||||||
mMetricsFeatureProvider.action(
|
mMetricsFeatureProvider.action(
|
||||||
getContext(),
|
getContext(),
|
||||||
SettingsEnums.ACTION_PRIVATE_SPACE_SETUP_TRY_CREATE_ACCOUNT_AGAIN);
|
SettingsEnums.ACTION_PRIVATE_SPACE_SETUP_TRY_CREATE_ACCOUNT_AGAIN);
|
||||||
PrivateSpaceMaintainer privateSpaceMaintainer =
|
NavHostFragment.findNavController(PrivateSpaceAccountLoginError.this)
|
||||||
PrivateSpaceMaintainer.getInstance(getActivity());
|
.navigate(R.id.action_advance_login_error);
|
||||||
UserHandle userHandle;
|
|
||||||
if (privateSpaceMaintainer.doesPrivateSpaceExist()
|
|
||||||
&& (userHandle = privateSpaceMaintainer.getPrivateProfileHandle()) != null) {
|
|
||||||
Intent intent = new Intent(getContext(), PrivateProfileContextHelperActivity.class);
|
|
||||||
intent.putExtra(EXTRA_ACTION_TYPE, ACCOUNT_LOGIN_ACTION);
|
|
||||||
Log.d(TAG, "Start private space activity for account login");
|
|
||||||
getActivity()
|
|
||||||
.startActivityForResultAsUser(intent, ACCOUNT_LOGIN_ACTION, userHandle);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,7 +101,7 @@ public class PrivateSpaceAccountLoginError extends InstrumentedFragment {
|
|||||||
SettingsEnums.ACTION_PRIVATE_SPACE_SETUP_ACCOUNT_LOGIN_SUCCESS,
|
SettingsEnums.ACTION_PRIVATE_SPACE_SETUP_ACCOUNT_LOGIN_SUCCESS,
|
||||||
false);
|
false);
|
||||||
NavHostFragment.findNavController(PrivateSpaceAccountLoginError.this)
|
NavHostFragment.findNavController(PrivateSpaceAccountLoginError.this)
|
||||||
.navigate(R.id.action_success_fragment);
|
.navigate(R.id.action_skip_account_login);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,124 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2024 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.settings.privatespace;
|
||||||
|
|
||||||
|
import static com.android.settings.privatespace.PrivateSpaceSetupActivity.ACCOUNT_LOGIN_ACTION;
|
||||||
|
import static com.android.settings.privatespace.PrivateSpaceSetupActivity.EXTRA_ACTION_TYPE;
|
||||||
|
|
||||||
|
import android.app.settings.SettingsEnums;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.UserHandle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.activity.OnBackPressedCallback;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.navigation.fragment.NavHostFragment;
|
||||||
|
|
||||||
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.core.InstrumentedFragment;
|
||||||
|
|
||||||
|
import com.google.android.setupcompat.template.FooterBarMixin;
|
||||||
|
import com.google.android.setupcompat.template.FooterButton;
|
||||||
|
import com.google.android.setupdesign.GlifLayout;
|
||||||
|
|
||||||
|
/** Fragment for GAIA education screen */
|
||||||
|
public class PrivateSpaceGaiaEducationFragment extends InstrumentedFragment {
|
||||||
|
private static final String TAG = "PrivateSpaceGaiaEduFrag";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
if (android.os.Flags.allowPrivateProfile()) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public View onCreateView(
|
||||||
|
@NonNull LayoutInflater inflater,
|
||||||
|
@Nullable ViewGroup container,
|
||||||
|
@Nullable Bundle savedInstanceState) {
|
||||||
|
GlifLayout rootView =
|
||||||
|
(GlifLayout)
|
||||||
|
inflater.inflate(
|
||||||
|
R.layout.private_space_gaia_education_screen, container, false);
|
||||||
|
final FooterBarMixin mixin = rootView.getMixin(FooterBarMixin.class);
|
||||||
|
mixin.setPrimaryButton(
|
||||||
|
new FooterButton.Builder(getContext())
|
||||||
|
.setText(R.string.private_space_gaia_education_got_it)
|
||||||
|
.setListener(onStartLogin())
|
||||||
|
.setButtonType(FooterButton.ButtonType.NEXT)
|
||||||
|
.setTheme(com.google.android.setupdesign.R.style.SudGlifButton_Primary)
|
||||||
|
.build());
|
||||||
|
mixin.setSecondaryButton(
|
||||||
|
new FooterButton.Builder(getContext())
|
||||||
|
.setText(R.string.skip_label)
|
||||||
|
.setListener(onSkip())
|
||||||
|
.setButtonType(FooterButton.ButtonType.NEXT)
|
||||||
|
.setTheme(com.google.android.setupdesign.R.style.SudGlifButton_Secondary)
|
||||||
|
.build());
|
||||||
|
OnBackPressedCallback callback =
|
||||||
|
new OnBackPressedCallback(true /* enabled by default */) {
|
||||||
|
@Override
|
||||||
|
public void handleOnBackPressed() {
|
||||||
|
// Handle the back button event. We intentionally don't want to allow back
|
||||||
|
// button to work in this screen during the setup flow.
|
||||||
|
}
|
||||||
|
};
|
||||||
|
requireActivity().getOnBackPressedDispatcher().addCallback(this, callback);
|
||||||
|
|
||||||
|
return rootView;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMetricsCategory() {
|
||||||
|
return METRICS_CATEGORY_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
private View.OnClickListener onSkip() {
|
||||||
|
return v -> {
|
||||||
|
NavHostFragment.findNavController(PrivateSpaceGaiaEducationFragment.this)
|
||||||
|
.navigate(R.id.action_account_lock_fragment);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private View.OnClickListener onStartLogin() {
|
||||||
|
return v -> {
|
||||||
|
startAccountLogin();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Start new activity in private profile to add an account to private profile */
|
||||||
|
private void startAccountLogin() {
|
||||||
|
UserHandle userHandle =
|
||||||
|
PrivateSpaceMaintainer.getInstance(getActivity()).getPrivateProfileHandle();
|
||||||
|
if (userHandle != null) {
|
||||||
|
Intent intent = new Intent(getContext(), PrivateProfileContextHelperActivity.class);
|
||||||
|
intent.putExtra(EXTRA_ACTION_TYPE, ACCOUNT_LOGIN_ACTION);
|
||||||
|
mMetricsFeatureProvider.action(
|
||||||
|
getContext(), SettingsEnums.ACTION_PRIVATE_SPACE_SETUP_ACCOUNT_LOGIN_START);
|
||||||
|
getActivity().startActivityForResultAsUser(intent, ACCOUNT_LOGIN_ACTION, userHandle);
|
||||||
|
} else {
|
||||||
|
Log.w(TAG, "Private profile user handle is null");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package com.android.settings.privatespace;
|
package com.android.settings.privatespace;
|
||||||
|
|
||||||
import static com.android.settings.privatespace.PrivateSpaceSetupActivity.ACCOUNT_LOGIN_ACTION;
|
|
||||||
import static com.android.settings.privatespace.PrivateSpaceSetupActivity.EXTRA_ACTION_TYPE;
|
import static com.android.settings.privatespace.PrivateSpaceSetupActivity.EXTRA_ACTION_TYPE;
|
||||||
import static com.android.settings.privatespace.PrivateSpaceSetupActivity.SET_LOCK_ACTION;
|
import static com.android.settings.privatespace.PrivateSpaceSetupActivity.SET_LOCK_ACTION;
|
||||||
|
|
||||||
@@ -31,6 +30,7 @@ import android.view.ViewGroup;
|
|||||||
|
|
||||||
import androidx.activity.OnBackPressedCallback;
|
import androidx.activity.OnBackPressedCallback;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.navigation.fragment.NavHostFragment;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.core.InstrumentedFragment;
|
import com.android.settings.core.InstrumentedFragment;
|
||||||
@@ -97,10 +97,8 @@ public class PrivateSpaceSetLockFragment extends InstrumentedFragment {
|
|||||||
mMetricsFeatureProvider.action(
|
mMetricsFeatureProvider.action(
|
||||||
getContext(), SettingsEnums.ACTION_PRIVATE_SPACE_SETUP_USE_SCREEN_LOCK);
|
getContext(), SettingsEnums.ACTION_PRIVATE_SPACE_SETUP_USE_SCREEN_LOCK);
|
||||||
// Simply Use default screen lock. No need to handle
|
// Simply Use default screen lock. No need to handle
|
||||||
mMetricsFeatureProvider.action(
|
NavHostFragment.findNavController(PrivateSpaceSetLockFragment.this)
|
||||||
getContext(), SettingsEnums.ACTION_PRIVATE_SPACE_SETUP_ACCOUNT_LOGIN_START);
|
.navigate(R.id.action_lock_success_fragment);
|
||||||
Log.d(TAG, "Use device lock for private profile");
|
|
||||||
launchActivityForAction(ACCOUNT_LOGIN_ACTION);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -19,8 +19,6 @@ package com.android.settings.privatespace;
|
|||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.UserHandle;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
@@ -61,23 +59,12 @@ public class PrivateSpaceSetupActivity extends FragmentActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||||
if (requestCode == SET_LOCK_ACTION && resultCode == RESULT_OK) {
|
if (requestCode == SET_LOCK_ACTION && resultCode == RESULT_OK) {
|
||||||
/* Start new activity in private profile to add an account to private profile */
|
mNavHostFragment.getNavController().navigate(R.id.action_success_fragment);
|
||||||
UserHandle userHandle =
|
|
||||||
PrivateSpaceMaintainer.getInstance(this).getPrivateProfileHandle();
|
|
||||||
if (userHandle != null) {
|
|
||||||
Intent intent = new Intent(this, PrivateProfileContextHelperActivity.class);
|
|
||||||
intent.putExtra(EXTRA_ACTION_TYPE, ACCOUNT_LOGIN_ACTION);
|
|
||||||
mMetricsFeatureProvider.action(
|
|
||||||
this, SettingsEnums.ACTION_PRIVATE_SPACE_SETUP_ACCOUNT_LOGIN_START);
|
|
||||||
startActivityForResultAsUser(intent, ACCOUNT_LOGIN_ACTION, userHandle);
|
|
||||||
} else {
|
|
||||||
Log.w(TAG, "Private profile user handle is null");
|
|
||||||
}
|
|
||||||
} else if (requestCode == ACCOUNT_LOGIN_ACTION) {
|
} else if (requestCode == ACCOUNT_LOGIN_ACTION) {
|
||||||
if (resultCode == RESULT_OK) {
|
if (resultCode == RESULT_OK) {
|
||||||
mMetricsFeatureProvider.action(
|
mMetricsFeatureProvider.action(
|
||||||
this, SettingsEnums.ACTION_PRIVATE_SPACE_SETUP_ACCOUNT_LOGIN_SUCCESS, true);
|
this, SettingsEnums.ACTION_PRIVATE_SPACE_SETUP_ACCOUNT_LOGIN_SUCCESS, true);
|
||||||
mNavHostFragment.getNavController().navigate(R.id.action_success_fragment);
|
mNavHostFragment.getNavController().navigate(R.id.action_account_lock_fragment);
|
||||||
} else {
|
} else {
|
||||||
mMetricsFeatureProvider.action(
|
mMetricsFeatureProvider.action(
|
||||||
this,
|
this,
|
||||||
|
Reference in New Issue
Block a user