UI and error message fixes for 16k developer option

- Disallow disabling option when hardware offload
values aren't default ones. This was bypassing warning dialogue
- For ext4 format dialog, add a delete icon and change confirmation text
- Change error message when update is pending.
- Add padding to progress dialog

Test: m Settings && adb install -r $ANDROID_PRODUCT_OUT/system_ext/priv-app/Settings/Settings.apk
Bug: 295035851
Bug: 338139884
Change-Id: Ib1c3ac075a75a8515fe725103b062983ecf11fba
This commit is contained in:
Pawan Wagh
2024-05-08 17:08:57 +00:00
parent ef175b48f8
commit f815608a71
3 changed files with 16 additions and 4 deletions

View File

@@ -376,6 +376,13 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
|| enableAngleController.isDefaultValue())) { || enableAngleController.isDefaultValue())) {
disableDeveloperOptions(); disableDeveloperOptions();
} else { } else {
// Disabling developer options in page-agnostic mode isn't supported as device
// isn't in production state
if (Enable16kUtils.isPageAgnosticModeOn(getContext())) {
Enable16kUtils.showPageAgnosticWarning(getContext());
onDisableDevelopmentOptionsRejected();
return;
}
DisableDevSettingsDialogFragment.show(this /* host */); DisableDevSettingsDialogFragment.show(this /* host */);
} }
} }

View File

@@ -207,7 +207,10 @@ public class Enable16kPagesPreferenceController extends DeveloperOptionsPreferen
int status = data.getInt(SystemUpdateManager.KEY_STATUS); int status = data.getInt(SystemUpdateManager.KEY_STATUS);
if (status != SystemUpdateManager.STATUS_UNKNOWN if (status != SystemUpdateManager.STATUS_UNKNOWN
&& status != SystemUpdateManager.STATUS_IDLE) { && status != SystemUpdateManager.STATUS_IDLE) {
throw new RuntimeException("System has pending update!"); throw new RuntimeException(
"System has pending update! Please restart the device to complete applying"
+ " pending update. If you are seeing this after using 16KB developer"
+ " options, please check configuration and OTA packages!");
} }
// Publish system update info // Publish system update info
@@ -313,7 +316,7 @@ public class Enable16kPagesPreferenceController extends DeveloperOptionsPreferen
} }
private void displayToast(String message) { private void displayToast(String message) {
Toast.makeText(mContext, message, Toast.LENGTH_SHORT).show(); Toast.makeText(mContext, message, Toast.LENGTH_LONG).show();
} }
@Override @Override
@@ -330,7 +333,7 @@ public class Enable16kPagesPreferenceController extends DeveloperOptionsPreferen
@Override @Override
public void onFailure(@NonNull Throwable t) { public void onFailure(@NonNull Throwable t) {
Log.e(TAG, "Failed to change the /data partition with ext4"); Log.e(TAG, "Failed to change the /data partition to ext4");
displayToast(mContext.getString(R.string.format_ext4_failure_toast)); displayToast(mContext.getString(R.string.format_ext4_failure_toast));
} }
}, },
@@ -405,6 +408,7 @@ public class Enable16kPagesPreferenceController extends DeveloperOptionsPreferen
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams.WRAP_CONTENT);
progressBar.setLayoutParams(params); progressBar.setLayoutParams(params);
progressBar.setPadding(0, 24, 0, 24);
builder.setView(progressBar); builder.setView(progressBar);
builder.setCancelable(false); builder.setCancelable(false);
return builder.create(); return builder.create();

View File

@@ -70,8 +70,9 @@ public class EnableExt4WarningDialog extends InstrumentedDialogFragment
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
return new AlertDialog.Builder(getActivity()) return new AlertDialog.Builder(getActivity())
.setTitle(R.string.confirm_format_ext4_title) .setTitle(R.string.confirm_format_ext4_title)
.setIcon(R.drawable.ic_delete_accent)
.setMessage(R.string.confirm_format_ext4_text) .setMessage(R.string.confirm_format_ext4_text)
.setPositiveButton(android.R.string.ok, this /* onClickListener */) .setPositiveButton(R.string.main_clear_confirm_title, this /* onClickListener */)
.setNegativeButton(android.R.string.cancel, this /* onClickListener */) .setNegativeButton(android.R.string.cancel, this /* onClickListener */)
.create(); .create();
} }