Set default name when creating a supervised user in fallback activity.

Fallback activity for supervised user creation was creating a supervised user
without a name (null), now creates it with a default name.
Also put an explanation on the activity stating it's just a placeholder.

Bug: 215232217
Bug: 207495450
Test: croot && make RunSettingsRoboTests -j40 ROBOTEST_FILTER="com.android.settings.users.UserSettingsTest"

Change-Id: I8090fde38155817ac2b4f88271abe8a0ad1ce747
This commit is contained in:
Yasin Kilicdere
2022-01-25 20:07:54 +00:00
parent 1900be4361
commit a6db6c28a4
3 changed files with 16 additions and 5 deletions

View File

@@ -15,12 +15,18 @@
~ limitations under the License. ~ limitations under the License.
--> -->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:layout_margin="16dp"
android:orientation="vertical">
<Button <Button
android:id="@+id/createSupervisedUser" android:id="@+id/createSupervisedUser"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:text="@*android:string/supervised_user_creation_label" /> android:text="@*android:string/supervised_user_creation_label" />
</FrameLayout> <TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/placeholder_activity" />
</LinearLayout>

View File

@@ -13846,4 +13846,7 @@
<string name="reboot_dialog_reboot_now">Reboot now</string> <string name="reboot_dialog_reboot_now">Reboot now</string>
<!-- Text on the dialog button to reboot the device later [CHAR LIMIT=50] --> <!-- Text on the dialog button to reboot the device later [CHAR LIMIT=50] -->
<string name="reboot_dialog_reboot_later">Reboot later</string> <string name="reboot_dialog_reboot_later">Reboot later</string>
<!-- Text to explain an activity is a temporary placeholder [CHAR LIMIT=none] -->
<string name="placeholder_activity" translatable="false">*This is a temporary placeholder fallback activity.</string>
</resources> </resources>

View File

@@ -65,7 +65,9 @@ public class AddSupervisedUserActivity extends Activity {
} }
private void createUser() { private void createUser() {
final NewUserRequest request = new NewUserRequest.Builder().build(); final NewUserRequest request = new NewUserRequest.Builder()
.setName(getString(R.string.user_new_user_name))
.build();
final AlertDialog pleaseWaitDialog = new AlertDialog.Builder(this) final AlertDialog pleaseWaitDialog = new AlertDialog.Builder(this)
.setMessage(getString(R.string.creating_new_user_dialog_message)) .setMessage(getString(R.string.creating_new_user_dialog_message))