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

Commit dbba26c8 authored by Toha's avatar Toha Committed by Steve Kondik
Browse files

Use actual storage type of sdcard/usb (2/2).

Currently, storage volume description for mount/unmount/format determined at
build time using PRODUCT_CHARACTERISTICS. For device which has only a sdcard or
only support usb storage, displayed description is correct. For device which has
both storage, the displayed description is totally wrong.

Use of actual storage type at runtime can eliminate the needed to specify
product characteristics, either default or nosdcard.

Change-Id: I9f8d53a4648d960f1009b1fe94787eecd4343427
parent a62b6b10
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="20sp"
        android:text="@string/media_format_final_desc" />
        android:text="@string/sdcard_media_format_final_desc" />

    <Button android:id="@+id/execute_media_format"
        android:layout_gravity="center_horizontal"
+2 −2
Original line number Diff line number Diff line
@@ -26,14 +26,14 @@
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="18sp"
        android:text="@string/media_format_desc" />
        android:text="@string/sdcard_media_format_desc" />

    <Button android:id="@+id/initiate_media_format"
        android:layout_gravity="center_horizontal"
        android:layout_marginTop="40dip"
        android:layout_width="150dip"
        android:layout_height="wrap_content"
        android:text="@string/media_format_button_text"
        android:text="@string/sdcard_media_format_button_text"
        android:gravity="center" />
        
</LinearLayout>
+16 −1
Original line number Diff line number Diff line
@@ -789,9 +789,16 @@

    <string name="subs_settings">SIM card status</string>

    <!-- string resources for USB OTG & UICC features -->
    <!-- string resources for SD card, USB OTG & UICC features -->
    <string name="storage_usb">USB storage</string>
    <string name="storage_uicc">UICC storage</string>
    <string name="sdcard_eject" product="default">Unmount SD card</string>
    <string name="sdcard_eject_summary" product="default">Unmount the SD card so you can safely remove it</string>
    <string name="sd_card_format" product="default">Erase SD card</string>
    <string name="sd_card_format_summary" product="default">Erases all data on the SD card, such as music and photos</string>
    <string name="sdcard_mount" product="default">Mount SD card</string>
    <string name="sdcard_mount_summary" product="default" translatable="false"></string>
    <string name="sdcard_insert_summary" product="default">Insert an SD card to mount</string>
    <string name="usb_eject" product="default">Unmount USB storage</string>
    <string name="usb_eject_summary" product="default">Unmount the USB storage so you can safely remove it</string>
    <string name="usb_format" product="default">Erase USB storage</string>
@@ -811,12 +818,16 @@
    <!-- Message of dialog asking user to confirm before enabling UMS. [CHAR LIMIT=NONE] -->
    <string name="usb_settings_enable_ums_message">System components and apps rely on primary storage always being available. This feature breaks that functionality. It is strongly recommended to use MTP instead. Are you sure you want to enable mass storage?</string>

    <string name="dlg_confirm_sdcard_unmount_title" product="default">Unmount SD card?</string>
    <string name="dlg_confirm_usb_unmount_title" product="default">Unmount USB storage?</string>
    <string name="dlg_confirm_uicc_unmount_title" product="default">Unmount UICC storage?</string>
    <string name="dlg_confirm_sdcard_unmount_text" product="default">If you unmount the SD card, some apps you are using will stop and may be unavailable until you remount the SD card.</string>
    <string name="dlg_confirm_usb_unmount_text" product="default">If you unmount the USB storage, some apps you are using will stop and may be unavailable until you remount the USB storage.</string>
    <string name="dlg_confirm_uicc_unmount_text" product="default">If you unmount the UICC storage, some apps you are using will stop and may be unavailable until you remount the UICC storage.</string>
    <string name="dlg_error_sdcard_unmount_text" product="default">Couldn\'t unmount SD card. Try again later.</string>
    <string name="dlg_error_usb_unmount_text" product="default">Couldn\'t unmount USB storage. Try again later.</string>
    <string name="dlg_error_uicc_unmount_text" product="default">Couldn\'t unmount UICC storage. Try again later.</string>
    <string name="sdcard_unmount_inform_text" product="default">SD card will be unmounted.</string>
    <string name="usb_unmount_inform_text" product="default">USB storage will be unmounted.</string>
    <string name="uicc_unmount_inform_text" product="default">UICC storage will be unmounted.</string>

@@ -824,12 +835,16 @@
    <string name="uicc_media_format_title" product="default">Erase UICC storage</string>
    <string name="usb_media_format_summary" product="default">Erases all data on the USB storage</string>
    <string name="uicc_media_format_summary" product="default">Erases all data on the UICC storage</string>
    <string name="sdcard_media_format_desc" product="default">Erase the SD card? You will lose <b>all</b> data on the card!</string>
    <string name="usb_media_format_desc" product="default">Erase the USB storage? You will lose <b>all</b> data on the storage!</string>
    <string name="uicc_media_format_desc" product="default">Erase the UICC storage? You will lose <b>all</b> data on the storage!</string>
    <string name="sdcard_media_format_button_text" product="default">Erase SD card</string>
    <string name="usb_media_format_button_text" product="default">Erase USB storage</string>
    <string name="uicc_media_format_button_text" product="default">Erase UICC storage</string>
    <string name="sdcard_media_format_final_desc" product="default">Erase the SD card, deleting all files stored there? You can\'t reverse this action!</string>
    <string name="usb_media_format_final_desc" product="default">Erase the USB storage, deleting all files stored there? You can\'t reverse this action!</string>
    <string name="uicc_media_format_final_desc" product="default">Erase the UICC storage, deleting all files stored there? You can\'t reverse this action!</string>
    <string name="sdcard_media_format_gesture_explanation" product="default">You need to draw your unlock pattern to confirm that you want to erase the SD card.</string>
    <string name="usb_media_format_gesture_explanation" product="default">You need to draw your unlock pattern to confirm that you want to erase the USB storage.</string>
    <string name="uicc_media_format_gesture_explanation" product="default">You need to draw your unlock pattern to confirm that you want to erase the UICC storage.</string>

+1 −1
Original line number Diff line number Diff line
@@ -107,7 +107,7 @@ public class MediaFormat extends Activity {
     */
    private boolean runKeyguardConfirmation(int request) {
        // Initialize default resource id, then set the right string based on volume
        int explanationResId = R.string.media_format_gesture_explanation;
        int explanationResId = R.string.sdcard_media_format_gesture_explanation;

        explanationResId = R.string.media_format_gesture_explanation;
        if (isUsbStorage(mStorageVolume, this)) {
+5 −4
Original line number Diff line number Diff line
@@ -303,8 +303,8 @@ public class Memory extends SettingsPreferenceFragment implements Indexable {

        switch (id) {
            case DLG_CONFIRM_UNMOUNT:
                int titleResId = R.string.dlg_confirm_unmount_title;
                int messageResId = R.string.dlg_confirm_unmount_text;
                int titleResId = R.string.dlg_confirm_sdcard_unmount_title;
                int messageResId = R.string.dlg_confirm_sdcard_unmount_text;

                // set the strings based on volume
                if (MediaFormat.isUsbStorage(mStorageVolume, getActivity())) {
@@ -328,7 +328,7 @@ public class Memory extends SettingsPreferenceFragment implements Indexable {
                        .create();

            case DLG_ERROR_UNMOUNT:
                int errMessageResId = R.string.dlg_error_unmount_text;
                int errMessageResId = R.string.dlg_error_sdcard_unmount_text;

                // set the strings based on volume
                if (MediaFormat.isUsbStorage(mStorageVolume, getActivity())) {
@@ -353,7 +353,8 @@ public class Memory extends SettingsPreferenceFragment implements Indexable {
            Toast.makeText(getActivity(), R.string.usb_unmount_inform_text,
                    Toast.LENGTH_SHORT).show();
        } else {
            Toast.makeText(getActivity(), R.string.unmount_inform_text, Toast.LENGTH_SHORT).show();
            Toast.makeText(getActivity(), R.string.sdcard_unmount_inform_text,
                    Toast.LENGTH_SHORT).show();
        }

        IMountService mountService = getMountService();
Loading