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

Commit 5f4abd39 authored by Emilio López's avatar Emilio López
Browse files

Fix dual USB notifications

This fixes duplicate mass storage notifications when using Motorola's
USB service system.

Change-Id: I47c7e5cbd77ec29602058e4e6268e3ef899bb089
parent 7fc2bb7f
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -27,13 +27,15 @@ import android.os.Handler;
import android.os.HandlerThread;
import android.os.storage.StorageEventListener;
import android.os.storage.StorageManager;
import android.os.SystemProperties;
import android.provider.Settings;
import android.util.Slog;

public class StorageNotification extends StorageEventListener {
    private static final String TAG = "StorageNotification";

    private static final boolean POP_UMS_ACTIVITY_ON_CONNECT = true;
    private static final boolean POP_UMS_ACTIVITY_ON_CONNECT =
        (SystemProperties.getInt("ro.usb.use_custom_service", 0) == 0);

    /**
     * Binder context for this service
@@ -280,6 +282,8 @@ public class StorageNotification extends StorageEventListener {
    private synchronized void setUsbStorageNotification(int titleId, int messageId, int icon,
            boolean sound, boolean visible, PendingIntent pi) {

        visible = visible && POP_UMS_ACTIVITY_ON_CONNECT;

        if (!visible && mUsbStorageNotification == null) {
            return;
        }