TIZENIOT-2285 Fix minicontroller becomes smaller after hours of music playback 34/252734/1 submit/tizen/20210202.050058
authorJagrat Patidar <j1.patidar@samsung.com>
Tue, 2 Feb 2021 03:57:52 +0000 (09:27 +0530)
committerJagrat Patidar <j1.patidar@samsung.com>
Tue, 2 Feb 2021 04:44:32 +0000 (04:44 +0000)
Change-Id: I4e517d4de02f32c9d6e5d44a325a7a0c30daa4c9
(cherry picked from commit 042d3bcd7099253ae6a8c73659b2b7b0598763a1)

src/minictrl/minictrl.c

index ef6017701c0e11efeb228f2cc321c52078016b14..4ca010f53d6d601c48bcf0c84a710fab1360d61d 100755 (executable)
@@ -156,6 +156,7 @@ static void _viewer_set_size(Evas_Object *layout, void *data, int width, int hei
 {
        Evas_Object *viewer;
        struct appdata *ad;
+       bundle *event_arg_bundle;
        int max_width;
        int max_height;
        int is_landscape;
@@ -178,6 +179,7 @@ static void _viewer_set_size(Evas_Object *layout, void *data, int width, int hei
        else
                is_landscape = 1;
 
+
        INFO("Size Provided by Viewer is %s[ %d X %d ]",
                ((width > MINICONTROL_MAX_WIDTH || height > MINICONTROL_MAX_HEIGHT) ? "bigger than max size, so resizing to max size[1200X112]": ""),
                width, height);
@@ -187,6 +189,20 @@ static void _viewer_set_size(Evas_Object *layout, void *data, int width, int hei
 
        evas_object_size_hint_min_set(viewer, max_width, max_height);
        evas_object_size_hint_max_set(viewer, max_width, max_height);
+
+       /* The below code handles case when width provided by provider(music-player) is greater than MINICONTROL_MAX_WIDTH.
+       To handle the case we are sending an event to music-player, this event will cause music-player to resize the
+       minicontroller to MINICONTROL_MAX_WIDTH and MINICONTROL_MAX_HEIGHT. */
+       if (width > MINICONTROL_MAX_WIDTH) {
+               event_arg_bundle = bundle_create();
+               if (event_arg_bundle) {
+                       char bundle_value_buffer[BUNDLE_BUFFER_LENGTH] = "resize_to_original";
+                       bundle_add_str(event_arg_bundle, "resize", bundle_value_buffer);
+                       INFO("Sending event to provider to resize mini-controller");
+                       minicontrol_viewer_send_event("[musicplayer-mini]", MINICONTROL_VIEWER_EVENT_REPORT_ANGLE, event_arg_bundle);
+                       bundle_free(event_arg_bundle);
+               }
+       }
 }
 
 static void _viewer_item_free(struct _viewer_item *item)