hal: enable HPX fade-in when seeking restarts offload playback

During streaming playback when DTS HPX is enabled, while seeking
the playback pauses and fadeout is triggered, so need to trigger
fadein after seek is complete and playback restarts.

Change-Id: I90ea549f403fb75ef7476f23532bcc1a60a69ba2
diff --git a/hal/audio_extn/dts_eagle.c b/hal/audio_extn/dts_eagle.c
index 83c3506..52d7abb 100644
--- a/hal/audio_extn/dts_eagle.c
+++ b/hal/audio_extn/dts_eagle.c
@@ -150,20 +150,16 @@
     if (strncmp("true", prop, sizeof("true")))
         return;
     int fd, n = 0;
-    if ((fd = open(FADE_NOTIFY_FILE, O_RDONLY)) < 0)
-        ALOGV("No fade node");
-    else {
-        ALOGV("fade node exists, remove it before creating it");
-        close(fd);
-        remove(FADE_NOTIFY_FILE);
+    if ((fd = open(FADE_NOTIFY_FILE, O_TRUNC|O_WRONLY)) < 0) {
+        ALOGV("No fade node, create one");
+        fd = creat(FADE_NOTIFY_FILE, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
+        if (fd < 0) {
+            ALOGE("DTS_EAGLE_HAL (%s): Creating fade notifier node failed", __func__);
+            return;
+        }
+        chmod(FADE_NOTIFY_FILE, S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH);
     }
-    fd = creat(FADE_NOTIFY_FILE, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
     char *str = need_data ? "need" : "have";
-    if (fd < 0) {
-        ALOGE("DTS_EAGLE_HAL (%s): opening fade notifier node failed", __func__);
-        return;
-    }
-    chmod(FADE_NOTIFY_FILE, S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH);
     n = write(fd, str, strlen(str));
     close(fd);
     if (n > 0)
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 33e48c9..2bc6fe9 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -2132,6 +2132,7 @@
         }
         if (!out->playback_started && ret >= 0) {
             compress_start(out->compr);
+            audio_extn_dts_eagle_fade(adev, true, out);
             out->playback_started = 1;
             out->offload_state = OFFLOAD_STATE_PLAYING;