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

Commit 0a4f639b authored by Ricardo Cerqueira's avatar Ricardo Cerqueira Committed by Gerrit Code Review
Browse files

Merge "Make "SD Card removed" notification dismissible if the removed SD Card...

Merge "Make "SD Card removed" notification dismissible if the removed SD Card is not the primary storage" into mr1-staging
parents 217fe28d 930029fa
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -127,8 +127,9 @@ public class StorageNotification extends StorageEventListener {
    }

    private void onStorageStateChangedAsync(String path, String oldState, String newState) {
        boolean isPrimary = mStorageManager.getPrimaryVolume().getPath().equals(path);
        Slog.i(TAG, String.format(
                "Media {%s} state changed from {%s} -> {%s}", path, oldState, newState));
                "Media {%s} state changed from {%s} -> {%s} (primary = %b)", path, oldState, newState, isPrimary));
        if (newState.equals(Environment.MEDIA_SHARED)) {
            /*
             * Storage is now shared. Modify the UMS notification
@@ -228,25 +229,25 @@ public class StorageNotification extends StorageEventListener {
        } else if (newState.equals(Environment.MEDIA_REMOVED)) {
            /*
             * Storage has been removed. Show nomedia media notification,
             * and disable UMS notification regardless of connection state.
             * and disable UMS notification if the removed storage is the primary storage.
             */
            setMediaStorageNotification(
                    com.android.internal.R.string.ext_media_nomedia_notification_title,
                    com.android.internal.R.string.ext_media_nomedia_notification_message,
                    com.android.internal.R.drawable.stat_notify_sdcard_usb,
                    true, false, null);
            updateUsbMassStorageNotification(false);
                    true, !isPrimary, null);
            updateUsbMassStorageNotification(isPrimary ? false : mUmsAvailable);
        } else if (newState.equals(Environment.MEDIA_BAD_REMOVAL)) {
            /*
             * Storage has been removed unsafely. Show bad removal media notification,
             * and disable UMS notification regardless of connection state.
             * and disable UMS notification if the removed storage is the primary storage.
             */
            setMediaStorageNotification(
                    com.android.internal.R.string.ext_media_badremoval_notification_title,
                    com.android.internal.R.string.ext_media_badremoval_notification_message,
                    com.android.internal.R.drawable.stat_sys_warning,
                    true, true, null);
            updateUsbMassStorageNotification(false);
            updateUsbMassStorageNotification(isPrimary ? false : mUmsAvailable);
        } else {
            Slog.w(TAG, String.format("Ignoring unknown state {%s}", newState));
        }