Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f815608a authored by Pawan Wagh's avatar Pawan Wagh
Browse files

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
parent ef175b48
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -376,6 +376,13 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
                        || enableAngleController.isDefaultValue())) {
                    disableDeveloperOptions();
                } 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 */);
                }
            }
+7 −3
Original line number Diff line number Diff line
@@ -207,7 +207,10 @@ public class Enable16kPagesPreferenceController extends DeveloperOptionsPreferen
        int status = data.getInt(SystemUpdateManager.KEY_STATUS);
        if (status != SystemUpdateManager.STATUS_UNKNOWN
                && 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
@@ -313,7 +316,7 @@ public class Enable16kPagesPreferenceController extends DeveloperOptionsPreferen
    }

    private void displayToast(String message) {
        Toast.makeText(mContext, message, Toast.LENGTH_SHORT).show();
        Toast.makeText(mContext, message, Toast.LENGTH_LONG).show();
    }

    @Override
@@ -330,7 +333,7 @@ public class Enable16kPagesPreferenceController extends DeveloperOptionsPreferen

                    @Override
                    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));
                    }
                },
@@ -405,6 +408,7 @@ public class Enable16kPagesPreferenceController extends DeveloperOptionsPreferen
                        LinearLayout.LayoutParams.WRAP_CONTENT,
                        LinearLayout.LayoutParams.WRAP_CONTENT);
        progressBar.setLayoutParams(params);
        progressBar.setPadding(0, 24, 0, 24);
        builder.setView(progressBar);
        builder.setCancelable(false);
        return builder.create();
+2 −1
Original line number Diff line number Diff line
@@ -70,8 +70,9 @@ public class EnableExt4WarningDialog extends InstrumentedDialogFragment
    public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
        return new AlertDialog.Builder(getActivity())
                .setTitle(R.string.confirm_format_ext4_title)
                .setIcon(R.drawable.ic_delete_accent)
                .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 */)
                .create();
    }