Adding a confirmation dialog for deleting the last user on the device.
Dialog informs that a new admin user is created after the last user is removed.
Change-Id: I68b065cd2960909314b4242e4a3f2c50385afe7d
Fixes:112091891
Test: mojave and emulator, deleting the last admin, deleting a non-admin.
diff --git a/tests/robotests/src/com/android/car/settings/testutils/DialogTestUtils.java b/tests/robotests/src/com/android/car/settings/testutils/DialogTestUtils.java
index f4f5517..445969f 100644
--- a/tests/robotests/src/com/android/car/settings/testutils/DialogTestUtils.java
+++ b/tests/robotests/src/com/android/car/settings/testutils/DialogTestUtils.java
@@ -17,6 +17,7 @@
package com.android.car.settings.testutils;
import android.widget.Button;
+import android.widget.TextView;
import androidx.fragment.app.DialogFragment;
@@ -40,9 +41,18 @@
/**
* Invokes onClick on the dialog's negative button.
*/
- public static void clickNegativeButton(DialogFragment dialogFragment) {
+ public static void clickNegativeButton(DialogFragment dialogFragment) {
Button negativeButton = (Button) dialogFragment.getDialog().getWindow()
.findViewById(R.id.negative_button);
negativeButton.callOnClick();
}
+
+ /**
+ * Gets dialog's title.
+ */
+ public static String getTitle(DialogFragment dialogFragment) {
+ TextView titleView = (TextView) dialogFragment.getDialog().getWindow()
+ .findViewById(R.id.title);
+ return titleView.getText().toString();
+ }
}